fix supi in location report

parent 7e481ee8
...@@ -786,7 +786,7 @@ void amf_n1::identity_response_handle( ...@@ -786,7 +786,7 @@ void amf_n1::identity_response_handle(
Logger::amf_n1().debug( Logger::amf_n1().debug(
"Signal the UE Registration State Event notification for SUPI %s", "Signal the UE Registration State Event notification for SUPI %s",
supi.c_str()); supi.c_str());
event_sub.ue_registration_state(supi, _5GMM_COMMON_PROCEDURE_INITIATED, 1); //event_sub.ue_registration_state(supi, _5GMM_COMMON_PROCEDURE_INITIATED, 1);
// TODO: Trigger UE Location Report // TODO: Trigger UE Location Report
run_registration_procedure(nc); run_registration_procedure(nc);
...@@ -1355,56 +1355,6 @@ void amf_n1::registration_request_handle( ...@@ -1355,56 +1355,6 @@ void amf_n1::registration_request_handle(
"No Optional NAS Container inside Registration Request message"); "No Optional NAS Container inside Registration Request message");
} }
// Trigger UE Location Report
std::shared_ptr<ue_ngap_context> unc = {};
if (!amf_n2_inst->is_ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id, unc)) {
Logger::amf_n1().warn(
"No UE NGAP context with ran_ue_ngap_id (" GNB_UE_NGAP_ID_FMT ")",
ran_ue_ngap_id);
} else {
std::shared_ptr<gnb_context> gc = {};
if (!amf_n2_inst->is_assoc_id_2_gnb_context(unc->gnb_assoc_id, gc)) {
Logger::amf_n1().error(
"No existed gNB context with assoc_id (%d)", unc->gnb_assoc_id);
} else {
oai::amf::model::UserLocation user_location = {};
oai::amf::model::NrLocation nr_location = {};
oai::amf::model::Tai tai = {};
nlohmann::json tai_json = {};
tai_json["plmnId"]["mcc"] = uc->cgi.mcc;
tai_json["plmnId"]["mnc"] = uc->cgi.mnc;
tai_json["tac"] = std::to_string(uc->tai.tac);
nlohmann::json global_ran_node_id_json = {};
global_ran_node_id_json["plmnId"]["mcc"] = uc->cgi.mcc;
global_ran_node_id_json["plmnId"]["mnc"] = uc->cgi.mnc;
global_ran_node_id_json["gNbId"]["bitLength"] = 32;
global_ran_node_id_json["gNbId"]["gNBValue"] =
std::to_string(gc->globalRanNodeId);
oai::amf::model::GlobalRanNodeId global_ran_node_id = {};
try {
from_json(tai_json, tai);
from_json(global_ran_node_id_json, global_ran_node_id);
} catch (std::exception& e) {
Logger::amf_n1().error("Exception with Json: %s", e.what());
return;
}
// uc->cgi.nrCellID;
nr_location.setTai(tai);
nr_location.setGlobalGnbId(global_ran_node_id);
user_location.setNrLocation(nr_location);
// Trigger UE Location Report
string supi = uc->supi;
Logger::amf_n1().debug(
"Signal the UE Location Report Event notification for SUPI %s",
supi.c_str());
event_sub.ue_location_report(supi, user_location, 1);
}
}
// Store NAS information into nas_context // Store NAS information into nas_context
// Run the corresponding registration procedure // Run the corresponding registration procedure
...@@ -2627,6 +2577,71 @@ void amf_n1::security_mode_complete_handle( ...@@ -2627,6 +2577,71 @@ void amf_n1::security_mode_complete_handle(
set_5gmm_state(nc, _5GMM_REGISTERED); set_5gmm_state(nc, _5GMM_REGISTERED);
stacs.display(); stacs.display();
// Trigger UE location Status Notify
// Find UE context
std::shared_ptr<ue_ngap_context> unc = {};
if (!amf_n2_inst->is_ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id, unc)) {
Logger::amf_n1().warn(
"No UE NGAP context with ran_ue_ngap_id (" GNB_UE_NGAP_ID_FMT ")",
ran_ue_ngap_id);
} else {
std::shared_ptr<gnb_context> gc = {};
if (!amf_n2_inst->is_assoc_id_2_gnb_context(unc->gnb_assoc_id, gc)) {
Logger::amf_n1().error(
"No existed gNB context with assoc_id (%d)", unc->gnb_assoc_id);
} else {
oai::amf::model::UserLocation user_location = {};
oai::amf::model::NrLocation nr_location = {};
oai::amf::model::Tai tai = {};
nlohmann::json tai_json = {};
tai_json["plmnId"]["mcc"] = uc->cgi.mcc;
tai_json["plmnId"]["mnc"] = uc->cgi.mnc;
tai_json["tac"] = std::to_string(uc->tai.tac);
nlohmann::json global_ran_node_id_json = {};
global_ran_node_id_json["plmnId"]["mcc"] = uc->cgi.mcc;
global_ran_node_id_json["plmnId"]["mnc"] = uc->cgi.mnc;
global_ran_node_id_json["gNbId"]["bitLength"] = 32;
global_ran_node_id_json["gNbId"]["gNBValue"] =
std::to_string(gc->globalRanNodeId);
oai::amf::model::GlobalRanNodeId global_ran_node_id = {};
try {
from_json(tai_json, tai);
from_json(global_ran_node_id_json, global_ran_node_id);
} catch (std::exception& e) {
Logger::amf_n1().error("Exception with Json: %s", e.what());
return;
}
// uc->cgi.nrCellID;
nr_location.setTai(tai);
nr_location.setGlobalGnbId(global_ran_node_id);
user_location.setNrLocation(nr_location);
// Trigger UE Location Report
string supi = uc->supi;
Logger::amf_n1().debug(
"Signal the UE Location Report Event notification for SUPI %s",
supi.c_str());
event_sub.ue_location_report(supi, user_location, 1);
}
}
// Trigger UE Registration Status Notify // Trigger UE Registration Status Notify
string supi = "imsi-" + nc->imsi; string supi = "imsi-" + nc->imsi;
Logger::amf_n1().debug( Logger::amf_n1().debug(
......
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