Commit 451b609a authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

update User Plane connection status

parent f6e168f8
......@@ -419,7 +419,8 @@ void smf_app::handle_itti_msg(
Logger::smf_app().info("Process N1N2MessageTransfer Response");
//Update PDU Session accordingly
//TODO: to be completed (process cause)
pdu_session_status_e status;
pdu_session_status_e status = {pdu_session_status_e::PDU_SESSION_INACTIVE};
upCnx_state_e state = {upCnx_state_e::UPCNX_STATE_DEACTIVATED};
if ((static_cast<http_response_codes_e>(m.response_code)
== http_response_codes_e::HTTP_RESPONSE_CODE_OK)
or (static_cast<http_response_codes_e>(m.response_code)
......@@ -428,8 +429,10 @@ void smf_app::handle_itti_msg(
status = pdu_session_status_e::PDU_SESSION_INACTIVE;
} else if (m.msg_type == PDU_SESSION_ESTABLISHMENT_ACCEPT) {
status = pdu_session_status_e::PDU_SESSION_ESTABLISHMENT_PENDING;
state = upCnx_state_e::UPCNX_STATE_ACTIVATING;
}
update_pdu_session_status(m.scid, status);
update_pdu_session_upCnx_state(m.scid, state);
Logger::smf_app().debug(
"Got successful response from AMF (Response code %d), set session status to %s",
m.response_code,
......@@ -1016,6 +1019,62 @@ void smf_app::update_pdu_session_status(const scid_t scid,
pdu_session_status_e2str[static_cast<int>(status)].c_str());
}
//---------------------------------------------------------------------------------------------
void smf_app::update_pdu_session_upCnx_state(const scid_t scid,
const upCnx_state_e state) {
Logger::smf_app().info("Update UpCnx_State");
//get the smf context
std::shared_ptr<smf_context_ref> scf = { };
if (is_scid_2_smf_context(scid)) {
scf = scid_2_smf_context(scid);
} else {
Logger::smf_app().warn(
"Context associated with this id " SCID_FMT " does not exit!", scid);
}
supi_t supi = scf.get()->supi;
supi64_t supi64 = smf_supi_to_u64(supi);
pdu_session_id_t pdu_session_id = scf.get()->pdu_session_id;
std::shared_ptr<smf_context> sc = { };
if (is_supi_2_smf_context(supi64)) {
sc = supi_2_smf_context(supi64);
Logger::smf_app().debug("Retrieve SMF context with SUPI " SUPI_64_FMT "",
supi64);
} else {
Logger::smf_app().error(
"Could not retrieve the corresponding SMF context with Supi " SUPI_64_FMT "!",
supi64);
//TODO:
}
//get dnn context
std::shared_ptr<dnn_context> sd = { };
if (!sc.get()->find_dnn_context(scf.get()->nssai, scf.get()->dnn, sd)) {
if (nullptr == sd.get()) {
//Error, DNN context doesn't exist
Logger::smf_app().warn(
"Could not retrieve the corresponding DNN context!");
}
}
//get smd_pdu_session
std::shared_ptr<smf_pdu_session> sp = { };
bool find_pdn = sd.get()->find_pdu_session(pdu_session_id, sp);
if (nullptr == sp.get()) {
Logger::smf_app().warn(
"Could not retrieve the corresponding SMF PDU Session context!");
}
sp.get()->set_upCnx_state(state);
Logger::smf_app().info(
"Set PDU Session UpCnxState to %s",
upCnx_state_e2str[static_cast<int>(state)].c_str());
}
//---------------------------------------------------------------------------------------------
void smf_app::timer_t3591_timeout(timer_id_t timer_id, uint64_t arg2_user) {
//TODO: send session modification request again...
......
......@@ -285,6 +285,15 @@ class smf_app {
void update_pdu_session_status(const scid_t id,
const pdu_session_status_e status);
/*
* Update PDU session UpCnxState
* @param [const scid_t] id SM Context ID
* @param [const upCnx_state_e] status PDU Session UpCnxState
* @return void
*/
void update_pdu_session_upCnx_state(const scid_t scid,
const upCnx_state_e state);
void timer_t3591_timeout(timer_id_t timer_id, uint64_t arg2_user);
n2_sm_info_type_e n2_sm_info_type_str2e(std::string n2_info_type);
......
......@@ -1009,6 +1009,10 @@ void session_update_sm_context_procedure::handle_itti_msg(
//Update PDU session status to ACTIVE
ppc->set_pdu_session_status(pdu_session_status_e::PDU_SESSION_ACTIVE);
//set UpCnxState to DEACTIVATED
ppc->set_upCnx_state(upCnx_state_e::UPCNX_STATE_ACTIVATED);
}
break;
......@@ -1100,23 +1104,36 @@ void session_update_sm_context_procedure::handle_itti_msg(
smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
n11_triggered_pending->res.set_n1_sm_message(n1_sm_msg_hex);
//N2 SM Information
smf_n1_n2_inst.create_n2_sm_information(
n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_REL_CMD,
n2_sm_info);
smf_app_inst->convert_string_2_hex(n2_sm_info, n2_sm_info_hex);
n11_triggered_pending->res.set_n2_sm_information(n2_sm_info_hex);
//fill the content of SmContextUpdatedData
n11_triggered_pending->res.sm_context_updated_data =
sm_context_updated_data;
n11_triggered_pending->res.sm_context_updated_data["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapIeType"] =
"PDU_RES_REL_CMD"; //NGAP message
//include N2 SM Resource Release Request only when User Plane connection is activated
if (ppc->get_upCnx_state() == upCnx_state_e::UPCNX_STATE_ACTIVATED) {
//N2 SM Information
smf_n1_n2_inst.create_n2_sm_information(
n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_REL_CMD,
n2_sm_info);
smf_app_inst->convert_string_2_hex(n2_sm_info, n2_sm_info_hex);
n11_triggered_pending->res.set_n2_sm_information(n2_sm_info_hex);
//fill the content of SmContextUpdatedData
n11_triggered_pending->res.sm_context_updated_data =
sm_context_updated_data;
n11_triggered_pending->res.sm_context_updated_data["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapIeType"] =
"PDU_RES_REL_CMD"; //NGAP message
} else {
//fill the content of SmContextUpdatedData
n11_triggered_pending->res.sm_context_updated_data = {};
n11_triggered_pending->res.sm_context_updated_data["n1MessageContainer"]["n1MessageClass"] =
N1N2_MESSAGE_CLASS;
n11_triggered_pending->res.sm_context_updated_data["n1MessageContainer"]["n1MessageContent"]["contentId"] =
N1_SM_CONTENT_ID;
}
//Update PDU session status to PDU_SESSION_INACTIVE_PENDING
ppc->set_pdu_session_status(
pdu_session_status_e::PDU_SESSION_INACTIVE_PENDING);
//set UpCnxState to DEACTIVATED
ppc->set_upCnx_state(upCnx_state_e::UPCNX_STATE_DEACTIVATED);
//TODO: To be completed
//TODO: start timer T3592 (see Section 6.3.3@3GPP TS 24.501)
//get smf_pdu_session and set the corresponding timer
......
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