Commit 12bfb2a7 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Update PDU Session Release Complete handling

parent 61e84600
...@@ -2192,11 +2192,6 @@ bool smf_context::handle_pdu_session_release_complete( ...@@ -2192,11 +2192,6 @@ bool smf_context::handle_pdu_session_release_complete(
// 5GSM Cause // 5GSM Cause
// Extended Protocol Configuration Options // Extended Protocol Configuration Options
// Update PDU Session status -> INACTIVE
sp.get()->set_pdu_session_status(pdu_session_status_e::PDU_SESSION_INACTIVE);
// Stop timer T3592
itti_inst->timer_remove(sp.get()->timer_T3592);
// TODO: SMF invokes Nsmf_PDUSession_SMContextStatusNotify to notify AMF // TODO: SMF invokes Nsmf_PDUSession_SMContextStatusNotify to notify AMF
// that the SM context for this PDU Session is released // that the SM context for this PDU Session is released
scid_t scid = {}; scid_t scid = {};
...@@ -2214,12 +2209,13 @@ bool smf_context::handle_pdu_session_release_complete( ...@@ -2214,12 +2209,13 @@ bool smf_context::handle_pdu_session_release_complete(
event_sub.sm_context_status( event_sub.sm_context_status(
scid, status, sm_context_request.get()->http_version); scid, status, sm_context_request.get()->http_version);
// Trigger PDU Session Release event notification // TODO: Notify AMF that the SM context for this PDU session is released
supi64_t supi64 = smf_supi_to_u64(sm_context_request.get()->req.get_supi()); if (sp.get()->get_pdu_session_status() ==
Logger::smf_app().debug("Signal the PDU Session Release Event notification"); pdu_session_status_e::PDU_SESSION_ACTIVE) {
event_sub.ee_pdu_session_release( Logger::smf_app().debug(
supi64, sm_context_request.get()->req.get_pdu_session_id(), "Signal the PDU Session Release Event notification");
sm_context_request.get()->http_version); trigger_pdu_session_release(scid, 1);
}
// SM Policy Association termination // SM Policy Association termination
if (sp->policy_ptr) { if (sp->policy_ptr) {
...@@ -2242,6 +2238,11 @@ bool smf_context::handle_pdu_session_release_complete( ...@@ -2242,6 +2238,11 @@ bool smf_context::handle_pdu_session_release_complete(
} }
// TODO: Invoke Nudm_UECM_Deregistration // TODO: Invoke Nudm_UECM_Deregistration
// Update PDU Session status -> INACTIVE
sp.get()->set_pdu_session_status(pdu_session_status_e::PDU_SESSION_INACTIVE);
// Stop timer T3592
itti_inst->timer_remove(sp.get()->timer_T3592);
return true; return true;
} }
...@@ -2434,7 +2435,8 @@ bool smf_context::handle_pdu_session_resource_modify_response_transfer( ...@@ -2434,7 +2435,8 @@ bool smf_context::handle_pdu_session_resource_modify_response_transfer(
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
bool smf_context::handle_pdu_session_resource_release_response_transfer( bool smf_context::handle_pdu_session_resource_release_response_transfer(
std::string& n2_sm_information, std::string& n2_sm_information,
std::shared_ptr<itti_n11_update_sm_context_request>& sm_context_request) { std::shared_ptr<itti_n11_update_sm_context_request>& sm_context_request,
std::shared_ptr<smf_pdu_session>& sp) {
std::string n1_sm_msg, n1_sm_msg_hex; std::string n1_sm_msg, n1_sm_msg_hex;
// TODO: SMF does nothing (Step 7, section 4.3.4.2@3GPP TS 23.502) // TODO: SMF does nothing (Step 7, section 4.3.4.2@3GPP TS 23.502)
...@@ -2457,6 +2459,22 @@ bool smf_context::handle_pdu_session_resource_release_response_transfer( ...@@ -2457,6 +2459,22 @@ bool smf_context::handle_pdu_session_resource_release_response_transfer(
return false; return false;
} }
scid_t scid = {};
try {
scid = std::stoi(sm_context_request->scid);
} catch (const std::exception& err) {
Logger::smf_app().warn(
"Couldn't retrieve "
"the corresponding SMF context, ignore message!");
return false;
}
// Notify AMF that the SM context for this PDU session is released
if (sp.get()->get_pdu_session_status() ==
pdu_session_status_e::PDU_SESSION_ACTIVE) {
trigger_pdu_session_release(scid, 1);
}
smf_app_inst->trigger_http_response( smf_app_inst->trigger_http_response(
http_status_code_e::HTTP_STATUS_CODE_200_OK, http_status_code_e::HTTP_STATUS_CODE_200_OK,
sm_context_request.get()->pid, N11_SESSION_UPDATE_SM_CONTEXT_RESPONSE); sm_context_request.get()->pid, N11_SESSION_UPDATE_SM_CONTEXT_RESPONSE);
...@@ -2691,15 +2709,12 @@ bool smf_context::handle_pdu_session_update_sm_context_request( ...@@ -2691,15 +2709,12 @@ bool smf_context::handle_pdu_session_update_sm_context_request(
return false; return false;
} }
// Update PDU session status to PDU_SESSION_INACTIVE
sp.get()->set_pdu_session_status(
pdu_session_status_e::PDU_SESSION_INACTIVE);
// display info // display info
Logger::smf_app().info("SMF context: \n %s", toString().c_str()); Logger::smf_app().info("SMF context: \n %s", toString().c_str());
// don't need to create a procedure to update UPF // don't need to create a procedure to update UPF
pdu_session_release_procedure = true; pdu_session_release_procedure = true;
} break; } break;
default: { default: {
Logger::smf_app().warn("Unknown message type %d", message_type); Logger::smf_app().warn("Unknown message type %d", message_type);
...@@ -2803,7 +2818,7 @@ bool smf_context::handle_pdu_session_update_sm_context_request( ...@@ -2803,7 +2818,7 @@ bool smf_context::handle_pdu_session_update_sm_context_request(
PDU_SESSION_RELEASE_UE_REQUESTED_STEP2; PDU_SESSION_RELEASE_UE_REQUESTED_STEP2;
if (!handle_pdu_session_resource_release_response_transfer( if (!handle_pdu_session_resource_release_response_transfer(
n2_sm_information, smreq)) { n2_sm_information, smreq, sp)) {
// TODO: // TODO:
return false; return false;
} }
...@@ -3965,13 +3980,34 @@ void smf_context::handle_sm_context_status_change( ...@@ -3965,13 +3980,34 @@ void smf_context::handle_sm_context_status_change(
} }
} }
//------------------------------------------------------------------------------
void smf_context::trigger_pdu_session_release(
scid_t scid, uint8_t http_version) {
event_sub.ee_pdu_session_release(scid, http_version);
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void smf_context::handle_ee_pdu_session_release( void smf_context::handle_ee_pdu_session_release(
supi64_t supi, pdu_session_id_t pdu_session_id, uint8_t http_version) { scid_t scid, uint8_t http_version) {
Logger::smf_app().debug( Logger::smf_app().debug(
"Send request to N11 to triger PDU Session Release Notification (Event " "Send request to N11 to triger PDU Session Release Notification, "
"Exposure), SUPI " SUPI_64_FMT " , PDU Session ID %d, HTTP version %d", "SMF Context ID " SCID_FMT " ",
supi, pdu_session_id, http_version); scid);
// get the smf context
std::shared_ptr<smf_context_ref> scf = {};
if (smf_app_inst->is_scid_2_smf_context(scid)) {
scf = smf_app_inst->scid_2_smf_context(scid);
} else {
Logger::smf_app().warn(
"Context associated with this id " SCID_FMT " does not exit!", scid);
return;
}
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::vector<std::shared_ptr<smf_subscription>> subscriptions = {}; std::vector<std::shared_ptr<smf_subscription>> subscriptions = {};
smf_app_inst->get_ee_subscriptions( smf_app_inst->get_ee_subscriptions(
...@@ -3987,10 +4023,9 @@ void smf_context::handle_ee_pdu_session_release( ...@@ -3987,10 +4023,9 @@ void smf_context::handle_ee_pdu_session_release(
for (auto i : subscriptions) { for (auto i : subscriptions) {
event_notification ev_notif = {}; event_notification ev_notif = {};
ev_notif.set_supi(supi); ev_notif.set_supi(supi64);
ev_notif.set_pdu_session_id(pdu_session_id); ev_notif.set_pdu_session_id(pdu_session_id);
ev_notif.set_smf_event(smf_event_t::SMF_EVENT_PDU_SES_REL); ev_notif.set_smf_event(smf_event_t::SMF_EVENT_PDU_SES_REL);
ev_notif.set_supi(supi);
ev_notif.set_notif_uri(i.get()->notif_uri); ev_notif.set_notif_uri(i.get()->notif_uri);
ev_notif.set_notif_id(i.get()->notif_id); ev_notif.set_notif_id(i.get()->notif_id);
// custom json e.g., for FlexCN // custom json e.g., for FlexCN
...@@ -5443,6 +5478,10 @@ void smf_context::send_pdu_session_release_response( ...@@ -5443,6 +5478,10 @@ void smf_context::send_pdu_session_release_response(
http_status_code_e::HTTP_STATUS_CODE_406_NOT_ACCEPTABLE); http_status_code_e::HTTP_STATUS_CODE_406_NOT_ACCEPTABLE);
} }
// clear the resources including addresses allocated to this Session and
// associated QoS flows
sps->deallocate_ressources(resp->res.get_dnn());
// send ITTI message to SMF_APP interface to trigger the response towards AMFs // send ITTI message to SMF_APP interface to trigger the response towards AMFs
Logger::smf_app().info( Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_APP", resp->get_msg_name()); "Sending ITTI message %s to task TASK_SMF_APP", resp->get_msg_name());
......
...@@ -614,7 +614,7 @@ class smf_context : public std::enable_shared_from_this<smf_context> { ...@@ -614,7 +614,7 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
// Subscribe to PDU Session Release (event exposure) // Subscribe to PDU Session Release (event exposure)
ee_pdu_session_release_connection = ee_pdu_session_release_connection =
event_sub.subscribe_ee_pdu_session_release(boost::bind( event_sub.subscribe_ee_pdu_session_release(boost::bind(
&smf_context::handle_ee_pdu_session_release, this, _1, _2, _3)); &smf_context::handle_ee_pdu_session_release, this, _1, _2));
// Subscribe to UE IP Change Event // Subscribe to UE IP Change Event
ee_ue_ip_change_connection = event_sub.subscribe_ee_ue_ip_change( ee_ue_ip_change_connection = event_sub.subscribe_ee_ue_ip_change(
...@@ -885,7 +885,8 @@ class smf_context : public std::enable_shared_from_this<smf_context> { ...@@ -885,7 +885,8 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
*/ */
bool handle_pdu_session_resource_release_response_transfer( bool handle_pdu_session_resource_release_response_transfer(
std::string& n2_sm_information, std::string& n2_sm_information,
std::shared_ptr<itti_n11_update_sm_context_request>& sm_context_request); std::shared_ptr<itti_n11_update_sm_context_request>& sm_context_request,
std::shared_ptr<smf_pdu_session>& sp);
/* /*
* Handle Xn Handover Patch Switch Request * Handle Xn Handover Patch Switch Request
...@@ -1183,14 +1184,13 @@ class smf_context : public std::enable_shared_from_this<smf_context> { ...@@ -1183,14 +1184,13 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
scid_t scid, const std::string& status, uint8_t http_version); scid_t scid, const std::string& status, uint8_t http_version);
/* /*
* Handle SM Context Status Change (Send notification AMF) * Trigger PDU Session Release Notification (Send notification AMF)
* @param [scid_t] scid: SMF Context ID * @param [scid_t] scid: SMF Context ID
* @param [uint32_t] status: Updated status
* @param [uint8_t] http_version: HTTP version * @param [uint8_t] http_version: HTTP version
* @return void * @return void
*/ */
void handle_ee_pdu_session_release( void trigger_pdu_session_release(scid_t scid, uint8_t http_version);
supi64_t supi, pdu_session_id_t pdu_session_id, uint8_t http_version); void handle_ee_pdu_session_release(scid_t scid, uint8_t http_version);
void trigger_ue_ip_change(scid_t scid, uint8_t http_version); void trigger_ue_ip_change(scid_t scid, uint8_t http_version);
void handle_ue_ip_change(scid_t scid, uint8_t http_version); void handle_ue_ip_change(scid_t scid, uint8_t http_version);
......
...@@ -46,10 +46,9 @@ typedef bs2::signal_type< ...@@ -46,10 +46,9 @@ typedef bs2::signal_type<
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type sm_context_status_sig_t; bs2::keywords::mutex_type<bs2::dummy_mutex>>::type sm_context_status_sig_t;
// Signal for Event exposure // Signal for Event exposure
// PDU session Release, SUPI, PDU SessionID, HTTP version // PDU session Release, SCID, HTTP version
typedef bs2::signal_type< typedef bs2::signal_type<
void(supi64_t, pdu_session_id_t, uint8_t), void(scid_t, uint8_t), bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ee_pdu_session_release_sig_t; ee_pdu_session_release_sig_t;
// TODO: ee_ue_ip_address_change_sig_t; //UI IP Address, UE ID // TODO: ee_ue_ip_address_change_sig_t; //UI IP Address, UE ID
......
...@@ -1569,12 +1569,6 @@ smf_procedure_code session_release_sm_context_procedure::handle_itti_msg( ...@@ -1569,12 +1569,6 @@ smf_procedure_code session_release_sm_context_procedure::handle_itti_msg(
n11_triggered_pending->res.set_cause( n11_triggered_pending->res.set_cause(
static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED)); static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED));
Logger::smf_app().info("PDU Session Release SM Context accepted by UPFs"); Logger::smf_app().info("PDU Session Release SM Context accepted by UPFs");
// clear the resources including addresses allocated to this Session and
// associated QoS flows
sps->deallocate_ressources(
n11_trigger->req
.get_dnn()); // TODO: for IPv6 (only for Ipv4 for the moment)
// trigger to send reply to AMF
return smf_procedure_code::OK; return smf_procedure_code::OK;
} else { } else {
n11_triggered_pending->res.set_cause(static_cast<uint8_t>( n11_triggered_pending->res.set_cause(static_cast<uint8_t>(
......
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