diff --git a/src/api-server/impl/IndividualSMContextApiImpl.cpp b/src/api-server/impl/IndividualSMContextApiImpl.cpp index 83182f5819bf29e80edbc1abf38d21b1936ae23b..bd7b132ea761f9a2d1ea12a23e9a0aa32e36c690 100644 --- a/src/api-server/impl/IndividualSMContextApiImpl.cpp +++ b/src/api-server/impl/IndividualSMContextApiImpl.cpp @@ -150,6 +150,12 @@ void IndividualSMContextApiImpl::update_sm_context( //TODO: Existing PDU session, step 3, SUPI, DNN, S-NSSAIs, SM Context ID, AMF ID, Request Type, N1 SM Container (PDU Session Establishment Request), User location, Access Type, RAT Type, PEI //step 15. (SM Context ID -> SCID, N2 SM, Request Type)(Initial Request) //TODO: verify why Request Type is not define in smContextUpdateData + + /* AMF-initiated with a release indication to request the release of the PDU Session (step 3.d, section 4.3.4.2@3GPP TS 23.502)*/ + if (smContextUpdateData.releaseIsSet()) { + sm_context_req_msg.set_release(smContextUpdateData.isRelease()); + } + /* PDU Session Modification (SM Context ID -> SCID, N1/N2), section 4.3.3.2@3GPP TS 23.502: */ //step 1.a,UE-initiated: SM Context ID + N1 (PDU Session Modification Request) //step 1.e (AN initiated modification): SM Context ID, N2 SM information (QFI, User location Information and an indication that the QoS Flow is released) diff --git a/src/common/smf.h b/src/common/smf.h index 87fcd98177c7e158758c3f659217fa2c11da2ba4..87a2e4fffb9ad332dbe02a8d36659d5038318973 100644 --- a/src/common/smf.h +++ b/src/common/smf.h @@ -122,8 +122,10 @@ enum class session_management_procedures_type_e { PDU_SESSION_RELEASE_UE_REQUESTED_STEP1 = 9, PDU_SESSION_RELEASE_UE_REQUESTED_STEP2 = 10, PDU_SESSION_RELEASE_UE_REQUESTED_STEP3 = 11, - PDU_SESSION_RELEASE_NETWORK_REQUESTED = 12, - PDU_SESSION_TEST = 13 + PDU_SESSION_RELEASE_SMF_INITIATED = 12, + PDU_SESSION_RELEASE_AMF_INITIATED = 13, + PDU_SESSION_RELEASE_AN_INITIATED = 14, + PDU_SESSION_TEST = 15 }; static const std::vector<std::string> session_management_procedures_type_e2str = @@ -139,7 +141,9 @@ static const std::vector<std::string> session_management_procedures_type_e2str = "PDU_SESSION_RELEASE_UE_REQUESTED_STEP1", "PDU_SESSION_RELEASE_UE_REQUESTED_STEP2", "PDU_SESSION_RELEASE_UE_REQUESTED_STEP3", - "PDU_SESSION_RELEASE_NETWORK_REQUESTED", + "PDU_SESSION_RELEASE_SMF_INITIATED", + "PDU_SESSION_RELEASE_AMF_INITIATED", + "PDU_SESSION_RELEASE_AN_INITIATED", "PDU_SESSION_TEST" }; diff --git a/src/smf_app/smf_context.cpp b/src/smf_app/smf_context.cpp index e01b9d7b855fe4e5c6d82ab108d45f13e9819b63..7080cf232e51ac8c642a5cbf662847f8b26ea92d 100644 --- a/src/smf_app/smf_context.cpp +++ b/src/smf_app/smf_context.cpp @@ -1120,13 +1120,14 @@ void smf_context::handle_pdu_session_create_sm_context_request( //Create PDU Session Establishment Reject and embedded in Namf_Communication_N1N2MessageTransfer Request Logger::smf_app().debug("Create PDU Session Establishment Reject"); //TODO: Should check Cause for other cases - cause_value_5gsm_e cause_n1 = { cause_value_5gsm_e::CAUSE_38_NETWORK_FAILURE }; + cause_value_5gsm_e cause_n1 = + { cause_value_5gsm_e::CAUSE_38_NETWORK_FAILURE }; if (sm_context_resp->res.get_cause() == NO_RESOURCES_AVAILABLE) { - cause_n1 = cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES; + cause_n1 = cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES; } - smf_n1_n2_inst.create_n1_sm_container( - sm_context_resp_pending->res, PDU_SESSION_ESTABLISHMENT_REJECT, - n1_sm_message, cause_n1); + smf_n1_n2_inst.create_n1_sm_container(sm_context_resp_pending->res, + PDU_SESSION_ESTABLISHMENT_REJECT, + n1_sm_message, cause_n1); smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_msg_hex); sm_context_resp_pending->res.set_n1_sm_message(n1_sm_msg_hex); @@ -1861,8 +1862,6 @@ void smf_context::handle_pdu_session_update_sm_context_request( //if request accepted-> set unCnxState to ACTIVATING //Update upCnxState sp.get()->set_upCnx_state(upCnx_state_e::UPCNX_STATE_ACTIVATING); - //need update UPF - update_upf = true; //get QFIs associated with PDU session ID std::vector<smf_qos_flow> qos_flows = { }; @@ -1870,11 +1869,27 @@ void smf_context::handle_pdu_session_update_sm_context_request( for (auto i : qos_flows) { sm_context_req_msg.add_qfi(i.qfi.qfi); } + //need update UPF + update_upf = true; //TODO: to be completed } - //Step 4. Create a procedure for update sm context and let the procedure handle the request if necessary + //Step 4. For AMF-initiated Session Release (with release indication) + if (sm_context_req_msg.release_is_set()) { + procedure_type = + session_management_procedures_type_e::PDU_SESSION_RELEASE_AMF_INITIATED; + //get QFIs associated with PDU session ID + std::vector<smf_qos_flow> qos_flows = { }; + sp.get()->get_qos_flows(qos_flows); + for (auto i : qos_flows) { + sm_context_req_msg.add_qfi(i.qfi.qfi); + } + //need update UPF + update_upf = true; + } + + //Step 5. Create a procedure for update sm context and let the procedure handle the request if necessary if (update_upf) { session_update_sm_context_procedure *proc = new session_update_sm_context_procedure(sp); diff --git a/src/smf_app/smf_msg.cpp b/src/smf_app/smf_msg.cpp index c26966fb5d39260774b2929e6b44f9afdef2c783..2d73b74d3f4c7907083e5c7df9482623ba3ef1e9 100644 --- a/src/smf_app/smf_msg.cpp +++ b/src/smf_app/smf_msg.cpp @@ -419,6 +419,17 @@ void pdu_session_update_sm_context_request::set_an_type( m_an_type = value; } +//----------------------------------------------------------------------------- +bool pdu_session_update_sm_context_request::release_is_set() const { + return m_release_is_set; +} + +//----------------------------------------------------------------------------- +void pdu_session_update_sm_context_request::set_release(bool const value) { + m_release = value; + m_release_is_set = true; +} + //----------------------------------------------------------------------------- void pdu_session_update_sm_context_response::set_cause(uint8_t cause) { m_cause = cause; diff --git a/src/smf_app/smf_msg.hpp b/src/smf_app/smf_msg.hpp index f5641aca1930c418293d628215369b5e5f57a8f0..ddcd4792376b36c81c73b07105125e548cb71234 100644 --- a/src/smf_app/smf_msg.hpp +++ b/src/smf_app/smf_msg.hpp @@ -428,6 +428,8 @@ class pdu_session_update_sm_context_request : public pdu_session_msg { bool upCnx_state_is_set() const; void set_rat_type(std::string const &value); void set_an_type(std::string const &value); + bool release_is_set() const; + void set_release(bool const value); private: @@ -449,6 +451,8 @@ class pdu_session_update_sm_context_request : public pdu_session_msg { // std::vector<std::string> m_eps_bearer_setup; // std::vector<int> m_revoke_ebi_list; uint8_t m_5gMm_cause_value; + bool m_release_is_set; + bool m_release; //oai::smf_server::model::NgRanTargetId m_target_id; //oai::smf_server::model::Guami m_guami; @@ -466,17 +470,16 @@ class pdu_session_update_sm_context_request : public pdu_session_msg { hoState toBeSwitched failedToBeSwitched - sNssai: - EpsBearerId: - release: - cause: - traceData: - epsInterworkingInd: - anTypeCanBeChanged: - n2SmInfoExt1: - n2SmInfoTypeExt1: - maReleaseInd: - exemptionInd: + sNssai + EpsBearerId + cause + traceData + epsInterworkingInd + anTypeCanBeChanged + n2SmInfoExt1 + n2SmInfoTypeExt1 + maReleaseInd + exemptionInd */ }; diff --git a/src/smf_app/smf_procedure.cpp b/src/smf_app/smf_procedure.cpp index 8a3e8268e33be164bc25573db49a312eb1be018f..b1ca13a22cf238c89ec95fe502b64c8e81d444e7 100644 --- a/src/smf_app/smf_procedure.cpp +++ b/src/smf_app/smf_procedure.cpp @@ -714,7 +714,7 @@ int session_update_sm_context_procedure::run( } break; - case session_management_procedures_type_e::PDU_SESSION_RELEASE_NETWORK_REQUESTED: + case session_management_procedures_type_e::PDU_SESSION_RELEASE_AMF_INITIATED: case session_management_procedures_type_e::PDU_SESSION_RELEASE_UE_REQUESTED_STEP1: { for (auto qfi : list_of_qfis_to_be_modified) { @@ -946,7 +946,7 @@ void session_update_sm_context_procedure::handle_itti_msg( } break; - case session_management_procedures_type_e::PDU_SESSION_RELEASE_NETWORK_REQUESTED: + case session_management_procedures_type_e::PDU_SESSION_RELEASE_AMF_INITIATED: case session_management_procedures_type_e::PDU_SESSION_RELEASE_UE_REQUESTED_STEP1: { if (cause.cause_value == CAUSE_VALUE_REQUEST_ACCEPTED) {