Commit 161a9f7c authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Code cleanup for getting common PLMNs between AMF and gNB

parent 776c8949
...@@ -377,10 +377,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) { ...@@ -377,10 +377,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
// in gNB context, if verified; else response NG SETUP FAILURE with cause // in gNB context, if verified; else response NG SETUP FAILURE with cause
// "Unknown PLMN"(9.3.1.2, ts38413) // "Unknown PLMN"(9.3.1.2, ts38413)
// std::vector<SupportedItem_t> common_plmn_list = get_common_plmn(s_ta_list); // std::vector<SupportedItem_t> common_plmn_list = get_common_plmn(s_ta_list);
get_common_plmn(s_ta_list, gc->s_ta_list); if (!get_common_plmn(s_ta_list, gc->s_ta_list)) {
if (gc->s_ta_list.size() == 0) {
// if (!verifyPlmn(s_ta_list)) {
// encode NG SETUP FAILURE MESSAGE and send back // encode NG SETUP FAILURE MESSAGE and send back
void* buffer = calloc(1, BUFFER_SIZE_1024); void* buffer = calloc(1, BUFFER_SIZE_1024);
NGSetupFailureMsg ngSetupFailure; NGSetupFailureMsg ngSetupFailure;
...@@ -394,24 +391,8 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) { ...@@ -394,24 +391,8 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
Logger::amf_n2().error( Logger::amf_n2().error(
"No common PLMN, encoding NG_SETUP_FAILURE with cause (Unknown PLMN)"); "No common PLMN, encoding NG_SETUP_FAILURE with cause (Unknown PLMN)");
return; return;
} else { } else {
// store only the common PLMN
// gc->s_ta_list = common_plmn_list;
/*
Logger::amf_n2().debug("Common PLMN");
for (auto ta : gc->s_ta_list) {
for (auto p : ta.b_plmn_list) {
std::string mcc;
std::string mnc;
Logger::amf_n2().debug(
"PLMN MCC %s, MNC %s", p.mcc.c_str(), p.mnc.c_str());
for (auto s : p.slice_list) {
Logger::amf_n2().debug(
"S-NSSAI (SST %s, SD %s)", s.sst.c_str(), s.sd.c_str());
}
}
}
*/
for (auto i : gc->s_ta_list) { for (auto i : gc->s_ta_list) {
gnbItem.plmn_list.push_back(i); gnbItem.plmn_list.push_back(i);
} }
...@@ -2123,10 +2104,10 @@ bool amf_n2::verifyPlmn(vector<SupportedItem_t> list) { ...@@ -2123,10 +2104,10 @@ bool amf_n2::verifyPlmn(vector<SupportedItem_t> list) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n2::get_common_plmn( bool amf_n2::get_common_plmn(
std::vector<SupportedItem_t> list, std::vector<SupportedItem_t>& result) { std::vector<SupportedItem_t> list, std::vector<SupportedItem_t>& result) {
std::vector<SupportedItem_t> plmn_list = {}; std::vector<SupportedItem_t> plmn_list = {};
bool found_common_plmn = false;
for (int i = 0; i < amf_cfg.plmn_list.size(); i++) { for (int i = 0; i < amf_cfg.plmn_list.size(); i++) {
for (int j = 0; j < list.size(); j++) { for (int j = 0; j < list.size(); j++) {
Logger::amf_n2().debug( Logger::amf_n2().debug(
...@@ -2156,6 +2137,7 @@ void amf_n2::get_common_plmn( ...@@ -2156,6 +2137,7 @@ void amf_n2::get_common_plmn(
"Common S-NSSAI (SST %s, SD %s)", s1.sst.c_str(), "Common S-NSSAI (SST %s, SD %s)", s1.sst.c_str(),
s1.sd.c_str()); s1.sd.c_str());
plmn_slice_support_item.slice_list.push_back(s1); plmn_slice_support_item.slice_list.push_back(s1);
found_common_plmn = true;
} }
} }
} }
...@@ -2166,5 +2148,5 @@ void amf_n2::get_common_plmn( ...@@ -2166,5 +2148,5 @@ void amf_n2::get_common_plmn(
} }
} }
} }
// return plmn_list; return found_common_plmn;
} }
...@@ -68,7 +68,7 @@ class amf_n2 : public ngap::ngap_app { ...@@ -68,7 +68,7 @@ class amf_n2 : public ngap::ngap_app {
void handle_itti_message(itti_paging& itti_msg); void handle_itti_message(itti_paging& itti_msg);
bool verifyPlmn(std::vector<SupportedItem_t> list); bool verifyPlmn(std::vector<SupportedItem_t> list);
void get_common_plmn( bool get_common_plmn(
std::vector<SupportedItem_t> list, std::vector<SupportedItem_t>& result); std::vector<SupportedItem_t> list, std::vector<SupportedItem_t>& result);
std::shared_ptr<ue_ngap_context> ran_ue_id_2_ue_ngap_context( std::shared_ptr<ue_ngap_context> ran_ue_id_2_ue_ngap_context(
......
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