Commit b3ba2eaf authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

First version for T3952 handling

parent 07d3e19d
......@@ -382,6 +382,10 @@ struct paa_s {
};
typedef struct paa_s paa_t;
constexpr uint8_t NUMBER_RETRANSMISSION_TIMES_T3591 = 4;
constexpr uint8_t NUMBER_RETRANSMISSION_TIMES_T3592 = 4;
#endif
#endif
......@@ -1639,9 +1639,10 @@ void smf_app::update_pdu_session_upCnx_state(
"Set PDU Session UpCnxState to %s",
upCnx_state_e2str.at(static_cast<int>(state)).c_str());
}
//---------------------------------------------------------------------------------------------
void smf_app::timer_t3591_timeout(timer_id_t timer_id, scid_t scid) {
// Send session modification request again ...
// Re-send Session Modification Command ...
// get the SMF Context
std::shared_ptr<smf_context_ref> scf = {};
......@@ -1692,9 +1693,13 @@ void smf_app::timer_t3591_timeout(timer_id_t timer_id, scid_t scid) {
if (n11_msg) {
uint8_t number_retransmission = sp.get()->get_number_retransmission_T3591();
if (number_retransmission < 5) {
if (number_retransmission <= NUMBER_RETRANSMISSION_TIMES_T3591) {
sp.get()->set_number_retransmission_T3591(number_retransmission + 1);
} else {
// Update PDU Session status -> ACTIVE
sp.get()->set_pdu_session_status(
pdu_session_status_e::PDU_SESSION_ACTIVE);
// TODO: check 6.3.2.5 a,@3GPP TS 24.501 V16.1.0 (2019-06)
return;
}
Logger::smf_app().info(
......@@ -1716,6 +1721,87 @@ void smf_app::timer_t3591_timeout(timer_id_t timer_id, scid_t scid) {
return;
}
//---------------------------------------------------------------------------------------------
void smf_app::timer_t3592_timeout(timer_id_t timer_id, scid_t scid) {
// Re-send Session Release Command ...
// 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().warn(
"Could not retrieve the corresponding SMF context with "
"Supi " SUPI_64_FMT "!",
supi64);
}
// Get PDU Session
std::shared_ptr<smf_pdu_session> sp = {};
if (!sc.get()->find_pdu_session(pdu_session_id, sp)) {
Logger::smf_app().warn(
"Could not retrieve the corresponding SMF PDU Session context!");
return;
}
std::shared_ptr<itti_n11_msg> pending_n11_msg = {};
sp.get()->get_pending_n11_msg(pending_n11_msg);
if (!pending_n11_msg) {
Logger::smf_app().warn("Could not retrieve the pending message!");
return;
}
std::shared_ptr<itti_n11_update_sm_context_response> n11_msg =
std::static_pointer_cast<itti_n11_update_sm_context_response>(
pending_n11_msg);
if (n11_msg) {
uint8_t number_retransmission = sp.get()->get_number_retransmission_T3592();
if (number_retransmission <= NUMBER_RETRANSMISSION_TIMES_T3592) {
sp.get()->set_number_retransmission_T3592(number_retransmission + 1);
} else {
// Update PDU Session status -> INACTIVE - to be verified
sp.get()->set_pdu_session_status(
pdu_session_status_e::PDU_SESSION_INACTIVE);
return;
}
Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_APP to trigger response",
n11_msg->get_msg_name());
int ret = itti_inst->send_msg(n11_msg);
if (RETURNok != ret) {
Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_APP",
n11_msg->get_msg_name());
} else {
// Start timer T3591
sp.get()->timer_T3592 = itti_inst->timer_setup(
T3592_TIMER_VALUE_SEC, 0, TASK_SMF_APP, TASK_SMF_APP_TRIGGER_T3592,
scid);
}
return;
}
return;
}
//---------------------------------------------------------------------------------------------
void smf_app::timer_nrf_heartbeat_timeout(
timer_id_t timer_id, uint64_t arg2_user) {
......
......@@ -629,6 +629,14 @@ class smf_app {
*/
void timer_t3591_timeout(timer_id_t timer_id, scid_t scid);
/*
* will be executed when timer T3592 expires
* @param [timer_id_t] timer_id
* @param [scid_t] scid
* @return void
*/
void timer_t3592_timeout(timer_id_t timer_id, scid_t scid);
/*
* will be executed when NRF Heartbeat timer expires
* @param [timer_id_t] timer_id
......
......@@ -684,6 +684,21 @@ uint8_t smf_pdu_session::get_number_retransmission_T3591() const {
return number_retransmission_T3591;
}
//------------------------------------------------------------------------------
void smf_pdu_session::set_number_retransmission_T3592(const uint8_t& n) {
number_retransmission_T3592 = n;
}
//------------------------------------------------------------------------------
void smf_pdu_session::get_number_retransmission_T3592(uint8_t& n) const {
n = number_retransmission_T3592;
}
//------------------------------------------------------------------------------
uint8_t smf_pdu_session::get_number_retransmission_T3592() const {
return number_retransmission_T3592;
}
//------------------------------------------------------------------------------
void session_management_subscription::insert_dnn_configuration(
const std::string& dnn,
......
......@@ -136,6 +136,7 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
number_of_supported_packet_filters = 0;
maximum_number_of_supported_packet_filters = 0;
number_retransmission_T3591 = 0;
number_retransmission_T3592 = 0;
}
void clear() {
......@@ -159,6 +160,7 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
timer_T3591 = ITTI_INVALID_TIMER_ID;
timer_T3592 = ITTI_INVALID_TIMER_ID;
number_retransmission_T3591 = 0;
number_retransmission_T3592 = 0;
}
smf_pdu_session(smf_pdu_session& b) = delete;
......@@ -501,6 +503,10 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
void get_number_retransmission_T3591(uint8_t& n) const;
uint8_t get_number_retransmission_T3591() const;
void set_number_retransmission_T3592(const uint8_t& n);
void get_number_retransmission_T3592(uint8_t& n) const;
uint8_t get_number_retransmission_T3592() const;
public:
bool ipv4; // IPv4 Addr
struct in_addr ipv4_address; // IPv4 Addr
......@@ -553,6 +559,7 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
private:
std::shared_ptr<itti_n11_msg> pending_n11_msg;
uint8_t number_retransmission_T3591;
uint8_t number_retransmission_T3592;
};
class session_management_subscription {
......
......@@ -1334,12 +1334,25 @@ void session_update_sm_context_procedure::handle_itti_msg(
// 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
sps->timer_T3592 = itti_inst->timer_setup(
T3591_TIMER_VALUE_SEC, 0, TASK_SMF_APP, TASK_SMF_APP_TRIGGER_T3592,
n11_trigger->req.get_pdu_session_id());
// TODO: How SMF can retransmit the PDU SESSION RELEASE COMMAND message on
// the expiry of the timer T3592
scid_t scid = {};
try {
scid = (scid_t) std::stoul(n11_trigger.get()->scid, nullptr, 10);
} catch (const std::exception& e) {
Logger::smf_n1().warn(
"Error when converting from string to int for SCID, "
"error: %s",
e.what());
return;
}
// Store the context for the timer handling
sps.get()->set_pending_n11_msg(
std::dynamic_pointer_cast<itti_n11_msg>(n11_triggered_pending));
sps->timer_T3592 = itti_inst->timer_setup(
T3592_TIMER_VALUE_SEC, 0, TASK_SMF_APP, TASK_SMF_APP_TRIGGER_T3592,
scid);
} break;
......
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