Commit 7bbcaf07 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Update UE status

parent 1cd7c2cc
...@@ -774,31 +774,26 @@ void amf_n1::identity_response_handle( ...@@ -774,31 +774,26 @@ void amf_n1::identity_response_handle(
// Continue the Registration Procedure // Continue the Registration Procedure
if (nc->to_be_register_by_new_suci) { if (nc->to_be_register_by_new_suci) {
if (!nc->is_stacs_available) { // Update 5GMM State
ue_info_t ueItem; ue_info_t ueItem;
ueItem.connStatus = "5GMM-CONNECTED"; //"CM-CONNECTED"; ueItem.connStatus = "5GMM-CONNECTED"; //"CM-CONNECTED";
ueItem.registerStatus = ueItem.registerStatus =
"5GMM-REG-INITIATED"; // 5GMM-COMMON-PROCEDURE-INITIATED "5GMM-REG-INITIATED"; // 5GMM-COMMON-PROCEDURE-INITIATED
ueItem.ranid = ran_ue_ngap_id; ueItem.ranid = ran_ue_ngap_id;
ueItem.amfid = amf_ue_ngap_id; ueItem.amfid = amf_ue_ngap_id;
ueItem.imsi = nc->imsi; ueItem.imsi = nc->imsi;
// Find UE context // Find UE context
std::shared_ptr<ue_context> uc = {}; std::shared_ptr<ue_context> uc = {};
if (!find_ue_context(ran_ue_ngap_id, amf_ue_ngap_id, uc)) { if (!find_ue_context(ran_ue_ngap_id, amf_ue_ngap_id, uc)) {
Logger::amf_n1().warn("Cannot find the UE context"); Logger::amf_n1().warn("Cannot find the UE context");
} else { } else {
ueItem.mcc = uc->cgi.mcc; ueItem.mcc = uc->cgi.mcc;
ueItem.mnc = uc->cgi.mnc; ueItem.mnc = uc->cgi.mnc;
ueItem.cellId = uc->cgi.nrCellID; ueItem.cellId = uc->cgi.nrCellID;
}
stacs.update_ue_info(ueItem);
set_5gmm_state(nc, _5GMM_COMMON_PROCEDURE_INITIATED);
// stacs.display();
nc->is_stacs_available = true;
} }
stacs.update_ue_info(ueItem);
set_5gmm_state(nc, _5GMM_COMMON_PROCEDURE_INITIATED); set_5gmm_state(nc, _5GMM_COMMON_PROCEDURE_INITIATED);
Logger::amf_n1().debug( Logger::amf_n1().debug(
...@@ -923,7 +918,13 @@ void amf_n1::service_request_handle( ...@@ -923,7 +918,13 @@ void amf_n1::service_request_handle(
Logger::amf_n1().error( Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
dnt->get_msg_name()); dnt->get_msg_name());
} else {
// Update 5GMM State
stacs.update_5gmm_state(nc->imsi, "5GMM-DEREGISTERED");
set_5gmm_state(nc, _5GMM_DEREGISTERED);
stacs.display();
} }
return; return;
} }
...@@ -1063,8 +1064,8 @@ void amf_n1::service_request_handle( ...@@ -1063,8 +1064,8 @@ void amf_n1::service_request_handle(
if (pdu_session_to_be_activated.size() == 0) { if (pdu_session_to_be_activated.size() == 0) {
Logger::amf_n1().debug("There is no PDU session to be activated"); Logger::amf_n1().debug("There is no PDU session to be activated");
// service_accept->SetPduSessionStatus(0x0000); // service_accept->SetPduSessionStatus(0x0000);
uint8_t buffer[BUFFER_SIZE_256]; uint8_t buffer[BUFFER_SIZE_1024];
int encoded_size = service_accept->Encode(buffer, BUFFER_SIZE_256); int encoded_size = service_accept->Encode(buffer, BUFFER_SIZE_1024);
bstring protected_nas = nullptr; bstring protected_nas = nullptr;
encode_nas_message_protected( encode_nas_message_protected(
nc->security_ctx.value(), false, INTEGRITY_PROTECTED_AND_CIPHERED, nc->security_ctx.value(), false, INTEGRITY_PROTECTED_AND_CIPHERED,
...@@ -1100,10 +1101,14 @@ void amf_n1::service_request_handle( ...@@ -1100,10 +1101,14 @@ void amf_n1::service_request_handle(
Logger::amf_n1().error( Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
} else {
// Update 5GMM State
stacs.update_5gmm_state(nc->imsi, "5GMM-REGISTERED");
set_5gmm_state(nc, _5GMM_REGISTERED);
stacs.display();
} }
bdestroy_wrapper(&protected_nas); bdestroy_wrapper(&protected_nas);
return; return;
} else { } else {
// TODO: Contact SMF to activate UP for these sessions // TODO: Contact SMF to activate UP for these sessions
// TODO: modify itti_initial_context_setup_request for supporting multiple // TODO: modify itti_initial_context_setup_request for supporting multiple
...@@ -1122,8 +1127,8 @@ void amf_n1::service_request_handle( ...@@ -1122,8 +1127,8 @@ void amf_n1::service_request_handle(
service_accept->SetPduSessionReactivationResult(0x0000); service_accept->SetPduSessionReactivationResult(0x0000);
} }
uint8_t buffer[BUFFER_SIZE_256]; uint8_t buffer[BUFFER_SIZE_1024];
int encoded_size = service_accept->Encode(buffer, BUFFER_SIZE_256); int encoded_size = service_accept->Encode(buffer, BUFFER_SIZE_1024);
bstring protected_nas = nullptr; bstring protected_nas = nullptr;
encode_nas_message_protected( encode_nas_message_protected(
nc->security_ctx.value(), false, INTEGRITY_PROTECTED_AND_CIPHERED, nc->security_ctx.value(), false, INTEGRITY_PROTECTED_AND_CIPHERED,
...@@ -1161,7 +1166,13 @@ void amf_n1::service_request_handle( ...@@ -1161,7 +1166,13 @@ void amf_n1::service_request_handle(
Logger::amf_n1().error( Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
} else {
// Update 5GMM State
stacs.update_5gmm_state(nc->imsi, "5GMM-REGISTERED");
set_5gmm_state(nc, _5GMM_REGISTERED);
stacs.display();
} }
bdestroy_wrapper(&protected_nas); bdestroy_wrapper(&protected_nas);
} }
} }
...@@ -1279,7 +1290,13 @@ void amf_n1::service_request_handle( ...@@ -1279,7 +1290,13 @@ void amf_n1::service_request_handle(
Logger::amf_n1().error( Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
dnt->get_msg_name()); dnt->get_msg_name());
} else {
// Update 5GMM State
stacs.update_5gmm_state(nc->imsi, "5GMM-DEREGISTERED");
set_5gmm_state(nc, _5GMM_DEREGISTERED);
stacs.display();
} }
return; return;
} }
...@@ -1418,8 +1435,8 @@ void amf_n1::service_request_handle( ...@@ -1418,8 +1435,8 @@ void amf_n1::service_request_handle(
if (pdu_session_to_be_activated.size() == 0) { if (pdu_session_to_be_activated.size() == 0) {
Logger::amf_n1().debug("There is no PDU session to be activated"); Logger::amf_n1().debug("There is no PDU session to be activated");
// service_accept->SetPduSessionStatus(0x0000); // service_accept->SetPduSessionStatus(0x0000);
uint8_t buffer[BUFFER_SIZE_256]; uint8_t buffer[BUFFER_SIZE_1024];
int encoded_size = service_accept->Encode(buffer, BUFFER_SIZE_256); int encoded_size = service_accept->Encode(buffer, BUFFER_SIZE_1024);
bstring protected_nas = nullptr; bstring protected_nas = nullptr;
encode_nas_message_protected( encode_nas_message_protected(
nc->security_ctx.value(), false, INTEGRITY_PROTECTED_AND_CIPHERED, nc->security_ctx.value(), false, INTEGRITY_PROTECTED_AND_CIPHERED,
...@@ -1454,7 +1471,13 @@ void amf_n1::service_request_handle( ...@@ -1454,7 +1471,13 @@ void amf_n1::service_request_handle(
Logger::amf_n1().error( Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
} else {
// Update 5GMM State
stacs.update_5gmm_state(nc->imsi, "5GMM-REGISTERED");
set_5gmm_state(nc, _5GMM_REGISTERED);
stacs.display();
} }
bdestroy_wrapper(&protected_nas); bdestroy_wrapper(&protected_nas);
return; return;
...@@ -1476,8 +1499,8 @@ void amf_n1::service_request_handle( ...@@ -1476,8 +1499,8 @@ void amf_n1::service_request_handle(
service_accept->SetPduSessionReactivationResult(0x0000); service_accept->SetPduSessionReactivationResult(0x0000);
} }
uint8_t buffer[BUFFER_SIZE_256]; uint8_t buffer[BUFFER_SIZE_1024];
int encoded_size = service_accept->Encode(buffer, BUFFER_SIZE_256); int encoded_size = service_accept->Encode(buffer, BUFFER_SIZE_1024);
bstring protected_nas = nullptr; bstring protected_nas = nullptr;
encode_nas_message_protected( encode_nas_message_protected(
nc->security_ctx.value(), false, INTEGRITY_PROTECTED_AND_CIPHERED, nc->security_ctx.value(), false, INTEGRITY_PROTECTED_AND_CIPHERED,
...@@ -1523,6 +1546,11 @@ void amf_n1::service_request_handle( ...@@ -1523,6 +1546,11 @@ void amf_n1::service_request_handle(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
} }
// Update 5GMM State
stacs.update_5gmm_state(nc->imsi, "5GMM-REGISTERED");
set_5gmm_state(nc, _5GMM_REGISTERED);
stacs.display();
bdestroy_wrapper(&protected_nas); bdestroy_wrapper(&protected_nas);
} }
} }
...@@ -1605,24 +1633,20 @@ void amf_n1::registration_request_handle( ...@@ -1605,24 +1633,20 @@ void amf_n1::registration_request_handle(
Logger::amf_n1().info( Logger::amf_n1().info(
"Associating SUPI (%s) with nas_context (%p)", supi.c_str(), "Associating SUPI (%s) with nas_context (%p)", supi.c_str(),
(void*) nc.get()); (void*) nc.get());
if (!nc->is_stacs_available) { // Update 5GMM state
ue_info_t ueItem; ue_info_t ueItem;
ueItem.connStatus = "5GMM-CONNECTED"; //"CM-CONNECTED"; ueItem.connStatus = "5GMM-CONNECTED"; //"CM-CONNECTED";
ueItem.registerStatus = ueItem.registerStatus =
"5GMM-REG-INITIATED"; // 5GMM-COMMON-PROCEDURE-INITIATED "5GMM-REG-INITIATED"; // 5GMM-COMMON-PROCEDURE-INITIATED
ueItem.ranid = ran_ue_ngap_id; ueItem.ranid = ran_ue_ngap_id;
ueItem.amfid = amf_ue_ngap_id; ueItem.amfid = amf_ue_ngap_id;
ueItem.imsi = nc->imsi; ueItem.imsi = nc->imsi;
ueItem.mcc = uc->cgi.mcc; ueItem.mcc = uc->cgi.mcc;
ueItem.mnc = uc->cgi.mnc; ueItem.mnc = uc->cgi.mnc;
ueItem.cellId = uc->cgi.nrCellID; ueItem.cellId = uc->cgi.nrCellID;
stacs.update_ue_info(ueItem); stacs.update_ue_info(ueItem);
set_5gmm_state(nc, _5GMM_COMMON_PROCEDURE_INITIATED); set_5gmm_state(nc, _5GMM_COMMON_PROCEDURE_INITIATED);
// stacs.display();
nc->is_stacs_available = true;
}
} }
} break; } break;
...@@ -3057,11 +3081,8 @@ void amf_n1::security_mode_complete_handle( ...@@ -3057,11 +3081,8 @@ void amf_n1::security_mode_complete_handle(
"UE (IMSI %s, GUTI %s, current RAN ID %d, current AMF ID %d) has been " "UE (IMSI %s, GUTI %s, current RAN ID %d, current AMF ID %d) has been "
"registered to the network", "registered to the network",
nc->imsi.c_str(), guti.c_str(), ran_ue_ngap_id, amf_ue_ngap_id); nc->imsi.c_str(), guti.c_str(), ran_ue_ngap_id, amf_ue_ngap_id);
if (nc->is_stacs_available) {
stacs.update_5gmm_state(nc->imsi, "5GMM-REGISTERED"); stacs.update_5gmm_state(nc->imsi, "5GMM-REGISTERED");
} else {
nc->is_stacs_available = true;
}
set_5gmm_state(nc, _5GMM_REGISTERED); set_5gmm_state(nc, _5GMM_REGISTERED);
stacs.display(); stacs.display();
...@@ -3648,9 +3669,8 @@ void amf_n1::ue_initiate_de_registration_handle( ...@@ -3648,9 +3669,8 @@ void amf_n1::ue_initiate_de_registration_handle(
// event_sub.ue_loss_of_connectivity(supi, PURGED, 1, ran_ue_ngap_id, // event_sub.ue_loss_of_connectivity(supi, PURGED, 1, ran_ue_ngap_id,
// amf_ue_ngap_id); // amf_ue_ngap_id);
if (nc->is_stacs_available) { // Update 5GMM state
stacs.update_5gmm_state(nc->imsi, "5GMM-DEREGISTERED"); stacs.update_5gmm_state(nc->imsi, "5GMM-DEREGISTERED");
}
// Remove NC context // Remove NC context
if (remove_amf_ue_ngap_id_2_nas_context(amf_ue_ngap_id)) { if (remove_amf_ue_ngap_id_2_nas_context(amf_ue_ngap_id)) {
......
...@@ -908,7 +908,7 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) { ...@@ -908,7 +908,7 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
} }
if (itti_msg.is_sr) if (itti_msg.is_sr)
Logger::amf_n2().debug("Encoding parameters for Service Request"); Logger::amf_n2().debug("Encoding parameters for Service Accept");
else else
Logger::amf_n2().debug( Logger::amf_n2().debug(
"Encoding parameters for Initial Context Setup Request"); "Encoding parameters for Initial Context Setup Request");
...@@ -2287,9 +2287,8 @@ void amf_n2::remove_ue_context_with_ran_ue_ngap_id( ...@@ -2287,9 +2287,8 @@ void amf_n2::remove_ue_context_with_ran_ue_ngap_id(
if (amf_n1_inst->amf_ue_id_2_nas_context(unc->amf_ue_ngap_id, nc)) { if (amf_n1_inst->amf_ue_id_2_nas_context(unc->amf_ue_ngap_id, nc)) {
// Remove all NAS context // Remove all NAS context
string supi = conv::imsi_to_supi(nc->imsi); string supi = conv::imsi_to_supi(nc->imsi);
if (nc->is_stacs_available) { stacs.update_5gmm_state(nc->imsi, "5GMM-DEREGISTERED");
stacs.update_5gmm_state(nc->imsi, "5GMM-DEREGISTERED");
}
// Trigger UE Loss of Connectivity Status Notify // Trigger UE Loss of Connectivity Status Notify
Logger::amf_n1().debug( Logger::amf_n1().debug(
"Signal the UE Loss of Connectivity Event notification for SUPI %s", "Signal the UE Loss of Connectivity Event notification for SUPI %s",
...@@ -2372,9 +2371,8 @@ void amf_n2::remove_ue_context_with_amf_ue_ngap_id(const long& amf_ue_ngap_id) { ...@@ -2372,9 +2371,8 @@ void amf_n2::remove_ue_context_with_amf_ue_ngap_id(const long& amf_ue_ngap_id) {
// Remove all NAS context // Remove all NAS context
string supi = conv::imsi_to_supi(nc->imsi); string supi = conv::imsi_to_supi(nc->imsi);
// Update UE status // Update UE status
if (nc->is_stacs_available) { stacs.update_5gmm_state(nc->imsi, "5GMM-DEREGISTERED");
stacs.update_5gmm_state(nc->imsi, "5GMM-DEREGISTERED");
}
// Trigger UE Loss of Connectivity Status Notify // Trigger UE Loss of Connectivity Status Notify
Logger::amf_n1().debug( Logger::amf_n1().debug(
"Signal the UE Loss of Connectivity Event notification for SUPI %s", "Signal the UE Loss of Connectivity Event notification for SUPI %s",
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
nas_context::nas_context() : _5g_he_av(), _5g_av(), kamf(), _5gmm_capability() { nas_context::nas_context() : _5g_he_av(), _5g_av(), kamf(), _5gmm_capability() {
is_imsi_present = false; is_imsi_present = false;
is_stacs_available = false;
is_auth_vectors_present = false; is_auth_vectors_present = false;
auts = nullptr; auts = nullptr;
ctx_avaliability_ind = false; ctx_avaliability_ind = false;
......
...@@ -66,7 +66,6 @@ class nas_context { ...@@ -66,7 +66,6 @@ class nas_context {
nas_context(); nas_context();
~nas_context(); ~nas_context();
bool ctx_avaliability_ind; bool ctx_avaliability_ind;
bool is_stacs_available;
long amf_ue_ngap_id; long amf_ue_ngap_id;
uint32_t ran_ue_ngap_id; uint32_t ran_ue_ngap_id;
cm_state_t nas_status; cm_state_t nas_status;
......
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