Commit 6ec237d7 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

add AMF-initiated session release

parent 7dff323e
......@@ -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)
......
......@@ -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"
};
......
......@@ -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);
......
......@@ -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;
......
......@@ -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
*/
};
......
......@@ -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) {
......
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