Commit 260bff8c authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'fix_ran_ue_ngap_id' into 'develop'

Fix mapping between RAN UE NGAP ID and UE context

See merge request oai/cn5g/oai-cn5g-amf!190
parents 82634cdd 4c4cb649
...@@ -388,11 +388,14 @@ void amf_app::handle_itti_message( ...@@ -388,11 +388,14 @@ void amf_app::handle_itti_message(
// Update AMF UE NGAP ID // Update AMF UE NGAP ID
std::shared_ptr<ue_ngap_context> unc = {}; std::shared_ptr<ue_ngap_context> unc = {};
if (!amf_n2_inst->ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id, unc)) { if (!amf_n2_inst->ran_ue_id_2_ue_ngap_context(
itti_msg.ran_ue_ngap_id, itti_msg.gnb_id, unc)) {
Logger::amf_n1().error( Logger::amf_n1().error(
"Could not find UE NGAP Context with ran_ue_ngap_id " "Could not find UE NGAP Context with ran_ue_ngap_id "
"(" GNB_UE_NGAP_ID_FMT ")", "(" GNB_UE_NGAP_ID_FMT
itti_msg.ran_ue_ngap_id); "), gNB ID "
"(" GNB_ID_FMT ")",
itti_msg.ran_ue_ngap_id, itti_msg.gnb_id);
} else { } else {
unc->amf_ue_ngap_id = amf_ue_ngap_id; unc->amf_ue_ngap_id = amf_ue_ngap_id;
amf_n2_inst->set_amf_ue_ngap_id_2_ue_ngap_context(amf_ue_ngap_id, unc); amf_n2_inst->set_amf_ue_ngap_id_2_ue_ngap_context(amf_ue_ngap_id, unc);
...@@ -410,6 +413,7 @@ void amf_app::handle_itti_message( ...@@ -410,6 +413,7 @@ void amf_app::handle_itti_message(
uc->ran_ue_ngap_id = itti_msg.ran_ue_ngap_id; uc->ran_ue_ngap_id = itti_msg.ran_ue_ngap_id;
uc->amf_ue_ngap_id = amf_ue_ngap_id; uc->amf_ue_ngap_id = amf_ue_ngap_id;
uc->gnb_id = itti_msg.gnb_id;
std::string guti = {}; std::string guti = {};
bool is_guti_valid = false; bool is_guti_valid = false;
...@@ -473,11 +477,10 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) { ...@@ -473,11 +477,10 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
registration_context.getRanNodeId(); registration_context.getRanNodeId();
// RAN UE NGAP ID // RAN UE NGAP ID
uint32_t ran_ue_ngap_id = registration_context.getAnN2ApId(); uint32_t ran_ue_ngap_id = registration_context.getAnN2ApId();
uint32_t gnb_id = {};
if (ran_node_id.gNbIdIsSet()) { if (ran_node_id.gNbIdIsSet()) {
oai::amf::model::GNbId gnb_id_model = ran_node_id.getGNbId(); oai::amf::model::GNbId gnb_id_model = ran_node_id.getGNbId();
uint32_t gnb_id = {};
try { try {
gnb_id = std::stoul(gnb_id_model.getGNBValue(), nullptr, 10); gnb_id = std::stoul(gnb_id_model.getGNBValue(), nullptr, 10);
} catch (const std::exception& e) { } catch (const std::exception& e) {
...@@ -487,7 +490,7 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) { ...@@ -487,7 +490,7 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
return; return;
} }
gc->globalRanNodeId = gnb_id; gc->gnb_id = gnb_id;
// TODO: gc->gnb_name // TODO: gc->gnb_name
// TODO: DefaultPagingDRX // TODO: DefaultPagingDRX
// TODO: Supported TA List // TODO: Supported TA List
...@@ -518,6 +521,7 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) { ...@@ -518,6 +521,7 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
uc = std::shared_ptr<ue_context>(new ue_context()); uc = std::shared_ptr<ue_context>(new ue_context());
uc->amf_ue_ngap_id = -1; uc->amf_ue_ngap_id = -1;
uc->supi = supi; uc->supi = supi;
uc->gnb_id = gnb_id;
set_supi_2_ue_context(supi, uc); set_supi_2_ue_context(supi, uc);
} }
} }
...@@ -555,7 +559,8 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) { ...@@ -555,7 +559,8 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
Logger::amf_app().debug( Logger::amf_app().debug(
"Create a new UE Context with UE Context Key", "Create a new UE Context with UE Context Key",
ue_context_key.c_str()); ue_context_key.c_str());
uc = std::make_shared<ue_context>(); uc = std::make_shared<ue_context>();
uc->gnb_id = gnb_id;
} }
set_ran_amf_id_2_ue_context(ue_context_key, uc); set_ran_amf_id_2_ue_context(ue_context_key, uc);
} }
...@@ -584,12 +589,13 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) { ...@@ -584,12 +589,13 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
// Step 4. Create UE NGAP Context if necessary // Step 4. Create UE NGAP Context if necessary
// Create/Update UE NGAP Context // Create/Update UE NGAP Context
std::shared_ptr<ue_ngap_context> unc = {}; std::shared_ptr<ue_ngap_context> unc = {};
if (!amf_n2_inst->ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id, unc)) { if (!amf_n2_inst->ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id, gnb_id, unc)) {
Logger::amf_app().debug( Logger::amf_app().debug(
"Create a new UE NGAP context with ran_ue_ngap_id " GNB_UE_NGAP_ID_FMT, "Create a new UE NGAP context with ran_ue_ngap_id " GNB_UE_NGAP_ID_FMT,
ran_ue_ngap_id); ran_ue_ngap_id);
unc = std::shared_ptr<ue_ngap_context>(new ue_ngap_context()); unc = std::shared_ptr<ue_ngap_context>(new ue_ngap_context());
amf_n2_inst->set_ran_ue_ngap_id_2_ue_ngap_context(ran_ue_ngap_id, unc); amf_n2_inst->set_ran_ue_ngap_id_2_ue_ngap_context(
ran_ue_ngap_id, gnb_id, unc);
} }
// Store related information into UE NGAP context // Store related information into UE NGAP context
......
...@@ -1270,7 +1270,8 @@ void amf_n1::registration_request_handle( ...@@ -1270,7 +1270,8 @@ void amf_n1::registration_request_handle(
if (uc) uc.reset(); if (uc) uc.reset();
std::shared_ptr<ue_ngap_context> unc = {}; std::shared_ptr<ue_ngap_context> unc = {};
if (!amf_n2_inst->ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id, unc)) { if (!amf_n2_inst->ran_ue_id_2_ue_ngap_context(
ran_ue_ngap_id, uc->gnb_id, unc)) {
Logger::amf_n1().error( Logger::amf_n1().error(
"No UE NGAP context with ran_ue_ngap_id (" GNB_UE_NGAP_ID_FMT ")", "No UE NGAP context with ran_ue_ngap_id (" GNB_UE_NGAP_ID_FMT ")",
ran_ue_ngap_id); ran_ue_ngap_id);
...@@ -2624,7 +2625,8 @@ void amf_n1::security_mode_complete_handle( ...@@ -2624,7 +2625,8 @@ void amf_n1::security_mode_complete_handle(
// Find UE context // Find UE context
std::shared_ptr<ue_ngap_context> unc = {}; std::shared_ptr<ue_ngap_context> unc = {};
if (!amf_n2_inst->ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id, unc)) { if (!amf_n2_inst->ran_ue_id_2_ue_ngap_context(
ran_ue_ngap_id, uc->gnb_id, unc)) {
Logger::amf_n1().warn( Logger::amf_n1().warn(
"No UE NGAP context with ran_ue_ngap_id (" GNB_UE_NGAP_ID_FMT ")", "No UE NGAP context with ran_ue_ngap_id (" GNB_UE_NGAP_ID_FMT ")",
ran_ue_ngap_id); ran_ue_ngap_id);
...@@ -2647,8 +2649,7 @@ void amf_n1::security_mode_complete_handle( ...@@ -2647,8 +2649,7 @@ void amf_n1::security_mode_complete_handle(
global_ran_node_id_json["plmnId"]["mcc"] = uc->cgi.mcc; 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["plmnId"]["mnc"] = uc->cgi.mnc;
global_ran_node_id_json["gNbId"]["bitLength"] = 32; global_ran_node_id_json["gNbId"]["bitLength"] = 32;
global_ran_node_id_json["gNbId"]["gNBValue"] = global_ran_node_id_json["gNbId"]["gNBValue"] = std::to_string(gc->gnb_id);
std::to_string(gc->globalRanNodeId);
oai::amf::model::GlobalRanNodeId global_ran_node_id = {}; oai::amf::model::GlobalRanNodeId global_ran_node_id = {};
try { try {
...@@ -4128,7 +4129,7 @@ void amf_n1::initialize_registration_accept( ...@@ -4128,7 +4129,7 @@ void amf_n1::initialize_registration_accept(
// Allowed/Rejected/Configured NSSAI // Allowed/Rejected/Configured NSSAI
// Get the list of common SST, SD between UE and AMF // Get the list of common SST, SD between UE and AMF
std::vector<struct SNSSAI_s> common_nssais; std::vector<struct SNSSAI_s> common_nssais;
amf_n2_inst->get_common_NSSAI(nc->ran_ue_ngap_id, common_nssais); amf_n2_inst->get_common_NSSAI(nc->ran_ue_ngap_id, uc->gnb_id, common_nssais);
std::vector<struct SNSSAI_s> allowed_nssais; std::vector<struct SNSSAI_s> allowed_nssais;
std::vector<Rejected_SNSSAI> rejected_nssais; std::vector<Rejected_SNSSAI> rejected_nssais;
...@@ -4753,7 +4754,8 @@ bool amf_n1::get_slice_selection_subscription_data_from_conf_file( ...@@ -4753,7 +4754,8 @@ bool amf_n1::get_slice_selection_subscription_data_from_conf_file(
// Get UE NGAP Context // Get UE NGAP Context
std::shared_ptr<ue_ngap_context> unc = {}; std::shared_ptr<ue_ngap_context> unc = {};
if (!amf_n2_inst->ran_ue_id_2_ue_ngap_context(nc->ran_ue_ngap_id, unc)) { if (!amf_n2_inst->ran_ue_id_2_ue_ngap_context(
nc->ran_ue_ngap_id, uc->gnb_id, unc)) {
Logger::amf_n1().error( Logger::amf_n1().error(
"No existed UE NGAP context associated with " "No existed UE NGAP context associated with "
"ran_ue_ngap_id " GNB_UE_NGAP_ID_FMT, "ran_ue_ngap_id " GNB_UE_NGAP_ID_FMT,
......
This diff is collapsed.
...@@ -222,99 +222,116 @@ class amf_n2 : public ngap::ngap_app { ...@@ -222,99 +222,116 @@ class amf_n2 : public ngap::ngap_app {
* @return void * @return void
*/ */
bool get_common_NSSAI( bool get_common_NSSAI(
const uint32_t& ran_ue_ngap_id, std::vector<nas::SNSSAI_t>& common_nssai); const uint32_t& ran_ue_ngap_id, uint32_t gnb_id,
std::vector<nas::SNSSAI_t>& common_nssai);
/* /*
* Get the UE NGAP context associated with a RAN UE NGAP ID if it exists and * Get the UE NGAP context associated with a RAN UE NGAP ID if it exists and
* not null * not null
* @param [const uint32_t&] ran_ue_ngap_id: RAN UE NGAP ID * @param [const uint32_t&] ran_ue_ngap_id: RAN UE NGAP ID
* @param [const uint32_t&] gnb_id: gNB ID
* @param [std::shared_ptr<ue_ngap_context>&] unc: shared pointer to the * @param [std::shared_ptr<ue_ngap_context>&] unc: shared pointer to the
* existing UE NGAP context * existing UE NGAP context
* @return true if the context exists and is not null, otherwise return false * @return true if the context exists and is not null, otherwise return false
*/ */
bool ran_ue_id_2_ue_ngap_context( bool ran_ue_id_2_ue_ngap_context(
const uint32_t& ran_ue_ngap_id, uint32_t ran_ue_ngap_id, uint32_t gnb_id,
std::shared_ptr<ue_ngap_context>& unc) const; std::shared_ptr<ue_ngap_context>& unc) const;
/*
* Get the UE NGAP context associated with a RAN UE NGAP ID if it exists and
* not null
* @param [uint32_t&] ran_ue_ngap_id: RAN UE NGAP ID
* @param [const std::string&] ue_context_key: UE context key from AMF UE NGAP
* ID and RAN UE NGAP ID
* @param [const std::shared_ptr<ue_ngap_context>&] unc: shared pointer to the
* existing UE NGAP context
* @return true if the context exists and is not null, otherwise return false
*/
bool ran_ue_id_2_ue_ngap_context(
uint32_t ran_ue_ngap_id, const std::string& ue_context_key,
std::shared_ptr<ue_ngap_context>& unc) const;
/* /*
* Verify whether a UE NGAP context associated with a RAN UE NGAP ID exists * Verify whether a UE NGAP context associated with a RAN UE NGAP ID exists
* @param [const uint32_t&] ran_ue_ngap_id: RAN UE NGAP ID * @param [uint32_t] ran_ue_ngap_id: RAN UE NGAP ID
* @param [uint32_t] gnb_id: gNB ID
* @return true if the context exists and is not null, otherwise return false * @return true if the context exists and is not null, otherwise return false
*/ */
bool is_ran_ue_id_2_ue_ngap_context(const uint32_t& ran_ue_ngap_id) const; bool is_ran_ue_id_2_ue_ngap_context(
uint32_t ran_ue_ngap_id, uint32_t gnb_id) const;
/* /*
* Store UE NGAP context associated with a RAN UE NGAP ID * Store UE NGAP context associated with a RAN UE NGAP ID
* @param [const uint32_t&] ran_ue_ngap_id: RAN UE NGAP ID * @param [uint32_t] ran_ue_ngap_id: RAN UE NGAP ID
* @param [uint32_t] gnb_id: gNB ID
* @param [const std::shared_ptr<ue_ngap_context>&] unc: pointer to UE NGAP * @param [const std::shared_ptr<ue_ngap_context>&] unc: pointer to UE NGAP
* context * context
* @return void * @return void
*/ */
void set_ran_ue_ngap_id_2_ue_ngap_context( void set_ran_ue_ngap_id_2_ue_ngap_context(
const uint32_t& ran_ue_ngap_id, uint32_t ran_ue_ngap_id, uint32_t gnb_id,
const std::shared_ptr<ue_ngap_context>& unc); const std::shared_ptr<ue_ngap_context>& unc);
/* /*
* Remove UE NGAP context associated with a RAN UE NGAP ID * Remove UE NGAP context associated with a RAN UE NGAP ID
* @param [const uint32_t&] ran_ue_ngap_id: RAN UE NGAP ID * @param [uint32_t] ran_ue_ngap_id: RAN UE NGAP ID
* @param [uint32_t] gnb_id: gNB ID
* @return void * @return void
*/ */
void remove_ran_ue_ngap_id_2_ngap_context(const uint32_t& ran_ue_ngap_id); void remove_ran_ue_ngap_id_2_ngap_context(
uint32_t ran_ue_ngap_id, uint32_t gnb_id);
/* /*
* Remove UE Context associated with a RAN UE NGAP ID * Remove UE Context associated with a RAN UE NGAP ID
* @param [const uint32_t&] ran_ue_ngap_id: RAN UE NGAP ID * @param [uint32_t] ran_ue_ngap_id: RAN UE NGAP ID
* @param [uint32_t] gnb_id: gNB ID
* @return void * @return void
*/ */
void remove_ue_context_with_ran_ue_ngap_id(const uint32_t& ran_ue_ngap_id); void remove_ue_context_with_ran_ue_ngap_id(
uint32_t ran_ue_ngap_id, uint32_t gnb_id);
/* /*
* Verify whether a UE NGAP context associated with a AMF UE NGAP ID exists * Verify whether a UE NGAP context associated with a AMF UE NGAP ID exists
* and is not null * and is not null
* @param [const unsigned long&] amf_ue_ngap_id: AMF UE NGAP ID * @param [const long&] amf_ue_ngap_id: AMF UE NGAP ID
* @return true if the context exists and is not null, otherwise return false * @return true if the context exists and is not null, otherwise return false
*/ */
bool is_amf_ue_id_2_ue_ngap_context( bool is_amf_ue_id_2_ue_ngap_context(const long& amf_ue_ngap_id) const;
const unsigned long& amf_ue_ngap_id) const;
/* /*
* Get UE NGAP context associated with a AMF UE NGAP ID if the context exists * Get UE NGAP context associated with a AMF UE NGAP ID if the context exists
* and is not null * and is not null
* @param [const unsigned long&] amf_ue_ngap_id: AMF UE NGAP ID * @param [const long&] amf_ue_ngap_id: AMF UE NGAP ID
* @param [std::shared_ptr<ue_ngap_context>&] unc: store the pointer to UE * @param [std::shared_ptr<ue_ngap_context>&] unc: store the pointer to UE
* NGAP context * NGAP context
* @return true if the context exists and is not null, otherwise return false * @return true if the context exists and is not null, otherwise return false
*/ */
bool amf_ue_id_2_ue_ngap_context( bool amf_ue_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id, const long& amf_ue_ngap_id, std::shared_ptr<ue_ngap_context>& unc) const;
std::shared_ptr<ue_ngap_context>& unc) const;
/* /*
* Store UE NGAP context associated with a AMF UE NGAP ID * Store UE NGAP context associated with a AMF UE NGAP ID
* @param [const unsigned long&] amf_ue_ngap_id: AMF UE NGAP ID * @param [const long&] amf_ue_ngap_id: AMF UE NGAP ID
* @param [const std::shared_ptr<ue_ngap_context>&] unc: pointer to UE NGAP * @param [const std::shared_ptr<ue_ngap_context>&] unc: pointer to UE NGAP
* context * context
* @return void * @return void
*/ */
void set_amf_ue_ngap_id_2_ue_ngap_context( void set_amf_ue_ngap_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id, const long& amf_ue_ngap_id, std::shared_ptr<ue_ngap_context> unc);
std::shared_ptr<ue_ngap_context> unc);
/* /*
* Remove UE NGAP context associated with a AMF UE NGAP ID * Remove UE NGAP context associated with a AMF UE NGAP ID
* @param [const unsigned long&] amf_ue_ngap_id: AMF UE NGAP ID * @param [const long&] amf_ue_ngap_id: AMF UE NGAP ID
* @return void * @return void
*/ */
void remove_amf_ue_ngap_id_2_ue_ngap_context( void remove_amf_ue_ngap_id_2_ue_ngap_context(const long& amf_ue_ngap_id);
const unsigned long& amf_ue_ngap_id);
/* /*
* Remove UE Context associated with a AMF UE NGAP ID * Remove UE Context associated with a AMF UE NGAP ID
* @param [const unsigned long&] amf_ue_ngap_id: AMF UE NGAP ID * @param [const unsigned long&] amf_ue_ngap_id: AMF UE NGAP ID
* @return void * @return void
*/ */
void remove_ue_context_with_amf_ue_ngap_id( void remove_ue_context_with_amf_ue_ngap_id(const long& amf_ue_ngap_id);
const unsigned long& amf_ue_ngap_id);
/* /*
* Get list of UE Context associated with a gNB * Get list of UE Context associated with a gNB
...@@ -328,7 +345,7 @@ class amf_n2 : public ngap::ngap_app { ...@@ -328,7 +345,7 @@ class amf_n2 : public ngap::ngap_app {
std::vector<std::shared_ptr<ue_ngap_context>>& ue_contexts); std::vector<std::shared_ptr<ue_ngap_context>>& ue_contexts);
private: private:
std::map<uint32_t, std::shared_ptr<ue_ngap_context>> std::map<std::pair<uint32_t, uint32_t>, std::shared_ptr<ue_ngap_context>>
ranid2uecontext; // ran ue ngap id ranid2uecontext; // ran ue ngap id
mutable std::shared_mutex m_ranid2uecontext; mutable std::shared_mutex m_ranid2uecontext;
......
...@@ -55,8 +55,9 @@ void statistics::display() { ...@@ -55,8 +55,9 @@ void statistics::display() {
int i = 1; int i = 1;
for (auto const& gnb : gnbs) { for (auto const& gnb : gnbs) {
Logger::amf_app().info( Logger::amf_app().info(
"| %d | Connected | 0x%x | %s " "| %d | Connected | 0x%x | %s "
" | %s, %s | ", " "
" | %s, %s | ",
i, gnb.second.gnb_id, gnb.second.gnb_name.c_str(), i, gnb.second.gnb_id, gnb.second.gnb_name.c_str(),
gnb.second.mcc.c_str(), gnb.second.mnc.c_str()); gnb.second.mcc.c_str(), gnb.second.mnc.c_str());
// Comment out to show the supported TA list // Comment out to show the supported TA list
...@@ -149,6 +150,21 @@ void statistics::add_gnb(const uint32_t& gnb_id, const gnb_infos& gnb) { ...@@ -149,6 +150,21 @@ void statistics::add_gnb(const uint32_t& gnb_id, const gnb_infos& gnb) {
gNB_connected += 1; gNB_connected += 1;
} }
//------------------------------------------------------------------------------
void statistics::add_gnb(const std::shared_ptr<gnb_context>& gc) {
gnb_infos gnb = {};
gnb.gnb_id = gc->gnb_id;
gnb.mcc = gc->plmn.mcc;
gnb.mnc = gc->plmn.mnc;
gnb.gnb_name = gc->gnb_name;
for (auto i : gc->s_ta_list) {
gnb.plmn_list.push_back(i);
}
std::unique_lock lock(m_gnbs);
gnbs.insert(std::pair<uint32_t, gnb_infos>(gc->gnb_id, gnb));
gNB_connected += 1;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void statistics::update_gnb(const uint32_t& gnb_id, const gnb_infos& gnb) { void statistics::update_gnb(const uint32_t& gnb_id, const gnb_infos& gnb) {
std::unique_lock lock(m_gnbs); std::unique_lock lock(m_gnbs);
......
...@@ -109,6 +109,13 @@ class statistics { ...@@ -109,6 +109,13 @@ class statistics {
*/ */
void add_gnb(const uint32_t& gnb_id, const gnb_infos& gnb); void add_gnb(const uint32_t& gnb_id, const gnb_infos& gnb);
/*
* Add gNB to the list connected gNB to this AMF
* @param [const std::shared_ptr<gnb_context> &] gc: pointer to gNB Context
* @return void
*/
void add_gnb(const std::shared_ptr<gnb_context>& gc);
/* /*
* Update gNB info * Update gNB info
* @param [const uint32_t&] gnb_id: gNB ID * @param [const uint32_t&] gnb_id: gNB ID
......
...@@ -39,6 +39,7 @@ constexpr auto CURL_MIME_BOUNDARY = "----Boundary"; ...@@ -39,6 +39,7 @@ constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
#define FUTURE_STATUS_TIMEOUT_MS 100 #define FUTURE_STATUS_TIMEOUT_MS 100
#define GNB_ID_FMT "%" PRIu32
#define GNB_UE_NGAP_ID_FMT "%" PRIu32 #define GNB_UE_NGAP_ID_FMT "%" PRIu32
#define AMF_UE_NGAP_ID_FMT "%" PRIu64 #define AMF_UE_NGAP_ID_FMT "%" PRIu64
......
...@@ -22,11 +22,9 @@ ...@@ -22,11 +22,9 @@
#ifndef _GNB_CONTEXT_H_ #ifndef _GNB_CONTEXT_H_
#define _GNB_CONTEXT_H_ #define _GNB_CONTEXT_H_
#include <stdint.h>
#include <string>
#include <vector> #include <vector>
#include "3gpp_23.003.h"
#include "NgapIEsStruct.hpp" #include "NgapIEsStruct.hpp"
#include "sctp_server.hpp" #include "sctp_server.hpp"
...@@ -53,7 +51,8 @@ class gnb_context { ...@@ -53,7 +51,8 @@ class gnb_context {
ng_gnb_state_t ng_state; ng_gnb_state_t ng_state;
std::string gnb_name; std::string gnb_name;
long globalRanNodeId; uint32_t gnb_id; // Global RAN Node ID
plmn_t plmn;
e_Ngap_PagingDRX default_paging_drx; // v32, v64, v128, v256 e_Ngap_PagingDRX default_paging_drx; // v32, v64, v128, v256
std::vector<SupportedTaItem_t> s_ta_list; std::vector<SupportedTaItem_t> s_ta_list;
bstring ue_radio_cap_ind; bstring ue_radio_cap_ind;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
ue_context::ue_context() { ue_context::ue_context() {
ran_ue_ngap_id = 0; ran_ue_ngap_id = 0;
amf_ue_ngap_id = -1; amf_ue_ngap_id = -1;
gnb_id = 0;
rrc_estb_cause = {}; rrc_estb_cause = {};
isUeContextRequest = false; isUeContextRequest = false;
cgi = {}; cgi = {};
......
...@@ -57,6 +57,7 @@ class ue_context { ...@@ -57,6 +57,7 @@ class ue_context {
public: public:
uint32_t ran_ue_ngap_id; // 32bits uint32_t ran_ue_ngap_id; // 32bits
long amf_ue_ngap_id : 40; // 40bits long amf_ue_ngap_id : 40; // 40bits
uint32_t gnb_id;
e_Ngap_RRCEstablishmentCause rrc_estb_cause; e_Ngap_RRCEstablishmentCause rrc_estb_cause;
bool isUeContextRequest; bool isUeContextRequest;
......
...@@ -35,15 +35,18 @@ class itti_msg_amf_app : public itti_msg { ...@@ -35,15 +35,18 @@ class itti_msg_amf_app : public itti_msg {
const itti_msg_type_t msg_type, const task_id_t origin, const itti_msg_type_t msg_type, const task_id_t origin,
const task_id_t destination) const task_id_t destination)
: itti_msg(msg_type, origin, destination) { : itti_msg(msg_type, origin, destination) {
gnb_id = 0;
ran_ue_ngap_id = 0; ran_ue_ngap_id = 0;
amf_ue_ngap_id = 0; amf_ue_ngap_id = 0;
} }
itti_msg_amf_app(const itti_msg_amf_app& i) : itti_msg(i) { itti_msg_amf_app(const itti_msg_amf_app& i) : itti_msg(i) {
gnb_id = i.gnb_id;
ran_ue_ngap_id = i.ran_ue_ngap_id; ran_ue_ngap_id = i.ran_ue_ngap_id;
amf_ue_ngap_id = i.amf_ue_ngap_id; amf_ue_ngap_id = i.amf_ue_ngap_id;
} }
uint32_t gnb_id;
uint32_t ran_ue_ngap_id; uint32_t ran_ue_ngap_id;
long amf_ue_ngap_id; long amf_ue_ngap_id;
}; };
......
...@@ -60,7 +60,9 @@ constexpr uint8_t NGAP_PRESENT_MAX_VALUE = 3; ...@@ -60,7 +60,9 @@ constexpr uint8_t NGAP_PRESENT_MAX_VALUE = 3;
int ngap_amf_handle_ng_setup_request( int ngap_amf_handle_ng_setup_request(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) { struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending ITTI NG Setup Request message to TASK_AMF_N2"); Logger::ngap().debug(
"[gNB Assoc Id %d] Sending ITTI NG Setup Request message to TASK_AMF_N2",
assoc_id);
output_wrapper::print_asn_msg(&asn_DEF_Ngap_NGAP_PDU, message_p); output_wrapper::print_asn_msg(&asn_DEF_Ngap_NGAP_PDU, message_p);
NGSetupRequestMsg* ng_setup_req = new NGSetupRequestMsg(); NGSetupRequestMsg* ng_setup_req = new NGSetupRequestMsg();
if (!ng_setup_req->decodeFromPdu(message_p)) { if (!ng_setup_req->decodeFromPdu(message_p)) {
...@@ -106,7 +108,9 @@ int ngap_handle_ng_setup_failure( ...@@ -106,7 +108,9 @@ int ngap_handle_ng_setup_failure(
int ngap_amf_handle_initial_ue_message( int ngap_amf_handle_initial_ue_message(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) { struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending ITTI Initial UE Message to TASK_AMF_N2"); Logger::ngap().debug(
"[gNB Assoc ID %d] Sending ITTI Initial UE Message to TASK_AMF_N2",
assoc_id);
output_wrapper::print_asn_msg(&asn_DEF_Ngap_NGAP_PDU, message_p); output_wrapper::print_asn_msg(&asn_DEF_Ngap_NGAP_PDU, message_p);
InitialUEMessageMsg* init_ue_msg = new InitialUEMessageMsg(); InitialUEMessageMsg* init_ue_msg = new InitialUEMessageMsg();
......
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