Commit 7b7ea0b4 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Remove unnecessary ITTI to trigger Http response

parent 2a0dd9c8
...@@ -1843,48 +1843,66 @@ void smf_app::trigger_http_response( ...@@ -1843,48 +1843,66 @@ void smf_app::trigger_http_response(
"Send ITTI msg to SMF APP to trigger the response of HTTP Server"); "Send ITTI msg to SMF APP to trigger the response of HTTP Server");
switch (msg_type) { switch (msg_type) {
case N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE: { case N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE: {
std::shared_ptr<itti_n11_release_sm_context_response> itti_msg = /*std::shared_ptr<itti_n11_release_sm_context_response> itti_msg =
std::make_shared<itti_n11_release_sm_context_response>( std::make_shared<itti_n11_release_sm_context_response>(
TASK_SMF_SBI, TASK_SMF_APP, promise_id); TASK_SMF_SBI, TASK_SMF_APP, promise_id);
*/
pdu_session_release_sm_context_response sm_context_response = {}; pdu_session_release_sm_context_response sm_context_response = {};
sm_context_response.set_http_code(http_code); sm_context_response.set_http_code(http_code);
trigger_session_release_sm_context_response(
sm_context_response, promise_id);
/*
itti_msg->res = sm_context_response; itti_msg->res = sm_context_response;
int ret = itti_inst->send_msg(itti_msg); int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) { if (RETURNok != ret) {
Logger::smf_app().error( Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_APP", "Could not send ITTI message %s to task TASK_SMF_APP",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
} }*/
} break; } break;
case N11_SESSION_CREATE_SM_CONTEXT_RESPONSE: { case N11_SESSION_CREATE_SM_CONTEXT_RESPONSE: {
std::shared_ptr<itti_n11_create_sm_context_response> itti_msg = /* std::shared_ptr<itti_n11_create_sm_context_response> itti_msg =
std::make_shared<itti_n11_create_sm_context_response>( std::make_shared<itti_n11_create_sm_context_response>(
TASK_SMF_SBI, TASK_SMF_APP, promise_id); TASK_SMF_SBI, TASK_SMF_APP, promise_id);
*/
pdu_session_create_sm_context_response sm_context_response = {}; pdu_session_create_sm_context_response sm_context_response = {};
sm_context_response.set_http_code(http_code); sm_context_response.set_http_code(http_code);
trigger_session_create_sm_context_response(
sm_context_response, promise_id);
/*
itti_msg->res = sm_context_response; itti_msg->res = sm_context_response;
int ret = itti_inst->send_msg(itti_msg); int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) { if (RETURNok != ret) {
Logger::smf_app().error( Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_APP", "Could not send ITTI message %s to task TASK_SMF_APP",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
} }*/
} break; } break;
case N11_SESSION_UPDATE_SM_CONTEXT_RESPONSE: { case N11_SESSION_UPDATE_SM_CONTEXT_RESPONSE: {
std::shared_ptr<itti_n11_update_sm_context_response> itti_msg = /* std::shared_ptr<itti_n11_update_sm_context_response> itti_msg =
std::make_shared<itti_n11_update_sm_context_response>( std::make_shared<itti_n11_update_sm_context_response>(
TASK_SMF_SBI, TASK_SMF_APP, promise_id); TASK_SMF_SBI, TASK_SMF_APP, promise_id);
*/
pdu_session_update_sm_context_response sm_context_response = {}; pdu_session_update_sm_context_response sm_context_response = {};
sm_context_response.set_http_code(http_code); sm_context_response.set_http_code(http_code);
itti_msg->res = sm_context_response; trigger_session_update_sm_context_response(
sm_context_response, promise_id);
/* itti_msg->res = sm_context_response;
int ret = itti_inst->send_msg(itti_msg); int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) { if (RETURNok != ret) {
Logger::smf_app().error( Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_APP", "Could not send ITTI message %s to task TASK_SMF_APP",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
} }*/
} break; } break;
default: { default: {
...@@ -1893,6 +1911,54 @@ void smf_app::trigger_http_response( ...@@ -1893,6 +1911,54 @@ void smf_app::trigger_http_response(
} }
} }
//------------------------------------------------------------------------------
void smf_app::trigger_session_create_sm_context_response(
pdu_session_create_sm_context_response& sm_context_response,
uint32_t& pid) {
Logger::smf_app().debug(
"Trigger PDU Session Create SM Context Response: Set promise with ID %d "
"to ready",
pid);
std::unique_lock lock(m_sm_context_create_promises);
if (sm_context_create_promises.count(pid) > 0) {
sm_context_create_promises[pid]->set_value(sm_context_response);
// Remove this promise from list
sm_context_create_promises.erase(pid);
}
}
//------------------------------------------------------------------------------
void smf_app::trigger_session_update_sm_context_response(
pdu_session_update_sm_context_response& sm_context_response,
uint32_t& pid) {
Logger::smf_app().debug(
"Trigger PDU Session Update SM Context Response: Set promise with ID %d "
"to ready",
pid);
std::unique_lock lock(m_sm_context_update_promises);
if (sm_context_update_promises.count(pid) > 0) {
sm_context_update_promises[pid]->set_value(sm_context_response);
// Remove this promise from list
sm_context_update_promises.erase(pid);
}
}
//------------------------------------------------------------------------------
void smf_app::trigger_session_release_sm_context_response(
pdu_session_release_sm_context_response& sm_context_response,
uint32_t& pid) {
Logger::smf_app().debug(
"Trigger PDU Session Release SM Context Response: Set promise with ID %d "
"to ready",
pid);
std::unique_lock lock(m_sm_context_release_promises);
if (sm_context_release_promises.count(pid) > 0) {
sm_context_release_promises[pid]->set_value(sm_context_response);
// Remove this promise from list
sm_context_release_promises.erase(pid);
}
}
//--------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------
void smf_app::add_event_subscription( void smf_app::add_event_subscription(
evsub_id_t sub_id, smf_event_t ev, std::shared_ptr<smf_subscription> ss) { evsub_id_t sub_id, smf_event_t ev, std::shared_ptr<smf_subscription> ss) {
......
...@@ -772,6 +772,16 @@ class smf_app { ...@@ -772,6 +772,16 @@ class smf_app {
void trigger_http_response( void trigger_http_response(
const uint32_t& http_code, uint32_t& promise_id, uint8_t msg_type); const uint32_t& http_code, uint32_t& promise_id, uint8_t msg_type);
void trigger_session_create_sm_context_response(
pdu_session_create_sm_context_response& sm_context_response,
uint32_t& pid);
void trigger_session_update_sm_context_response(
pdu_session_update_sm_context_response& sm_context_response,
uint32_t& pid);
void trigger_session_release_sm_context_response(
pdu_session_release_sm_context_response& sm_context_response,
uint32_t& pid);
/* /*
* Add an Event Subscription to the list * Add an Event Subscription to the list
* @param [const evsub_id_t&] sub_id: Subscription ID * @param [const evsub_id_t&] sub_id: Subscription ID
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment