Commit 2e25e545 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix issue for duplicate Slice info in Registration Accept

parent a0d42520
...@@ -85,7 +85,7 @@ amf_app::amf_app(const amf_config& amf_cfg) ...@@ -85,7 +85,7 @@ amf_app::amf_app(const amf_config& amf_cfg)
throw; throw;
} }
// Register to NRF // Register to NRF if needed
if (amf_cfg.support_features.enable_nf_registration) register_to_nrf(); if (amf_cfg.support_features.enable_nf_registration) register_to_nrf();
timer_id_t tid = itti_inst->timer_setup( timer_id_t tid = itti_inst->timer_setup(
...@@ -146,7 +146,7 @@ void amf_app_task(void*) { ...@@ -146,7 +146,7 @@ void amf_app_task(void*) {
} }
} break; } break;
default: default:
Logger::amf_app().info("no handler for msg type %d", msg->msg_type); Logger::amf_app().info("No handler for msg type %d", msg->msg_type);
} }
} while (true); } while (true);
} }
...@@ -191,6 +191,7 @@ std::shared_ptr<ue_context> amf_app::ran_amf_id_2_ue_context( ...@@ -191,6 +191,7 @@ std::shared_ptr<ue_context> amf_app::ran_amf_id_2_ue_context(
return ue_ctx_key.at(ue_context_key); return ue_ctx_key.at(ue_context_key);
} }
//------------------------------------------------------------------------------
bool amf_app::ran_amf_id_2_ue_context( bool amf_app::ran_amf_id_2_ue_context(
const std::string& ue_context_key, std::shared_ptr<ue_context>& uc) const { const std::string& ue_context_key, std::shared_ptr<ue_context>& uc) const {
std::shared_lock lock(m_ue_ctx_key); std::shared_lock lock(m_ue_ctx_key);
...@@ -201,6 +202,7 @@ bool amf_app::ran_amf_id_2_ue_context( ...@@ -201,6 +202,7 @@ bool amf_app::ran_amf_id_2_ue_context(
} else } else
return false; return false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_app::set_ran_amf_id_2_ue_context( void amf_app::set_ran_amf_id_2_ue_context(
const string& ue_context_key, std::shared_ptr<ue_context> uc) { const string& ue_context_key, std::shared_ptr<ue_context> uc) {
......
...@@ -3198,6 +3198,14 @@ void amf_n1::initialize_registration_accept( ...@@ -3198,6 +3198,14 @@ void amf_n1::initialize_registration_accept(
false, false, false, 0x01); // 3GPP Access false, false, false, 0x01); // 3GPP Access
registration_accept->setT3512_Value(0x5, T3512_TIMER_VALUE_MIN); registration_accept->setT3512_Value(0x5, T3512_TIMER_VALUE_MIN);
// Find UE Context
std::shared_ptr<ue_context> uc = {};
if (!find_ue_context(
nc.get()->ran_ue_ngap_id, nc.get()->amf_ue_ngap_id, uc)) {
Logger::amf_n1().warn("Cannot find the UE context");
return;
}
std::vector<p_tai_t> tai_list; std::vector<p_tai_t> tai_list;
for (auto p : amf_cfg.plmn_list) { for (auto p : amf_cfg.plmn_list) {
p_tai_t item = {}; p_tai_t item = {};
...@@ -3211,24 +3219,28 @@ void amf_n1::initialize_registration_accept( ...@@ -3211,24 +3219,28 @@ void amf_n1::initialize_registration_accept(
} }
registration_accept->setTaiList(tai_list); registration_accept->setTaiList(tai_list);
// TODO: get the list of common SST, SD between UE/gNB and AMF // TODO: get the list of common SST, SD between UE and AMF
std::vector<struct SNSSAI_s> nssai; std::vector<struct SNSSAI_s> nssai;
for (auto p : amf_cfg.plmn_list) { for (auto p : amf_cfg.plmn_list) {
for (auto s : p.slice_list) { if ((p.mcc.compare(uc.get()->tai.mcc) == 0) and
SNSSAI_t snssai = {}; (p.mnc.compare(uc.get()->tai.mnc) == 0) and
try { (p.tac == uc.get()->tai.tac)) {
snssai.sst = std::stoi(s.sST); for (auto s : p.slice_list) {
snssai.sd = std::stoi(s.sD); SNSSAI_t snssai = {};
} catch (const std::exception& err) { try {
Logger::amf_n1().warn("Invalid SST/SD"); snssai.sst = std::stoi(s.sST);
return; snssai.sd = std::stoi(s.sD);
} } catch (const std::exception& err) {
Logger::amf_n1().warn("Invalid SST/SD");
return;
}
// Check with the requested NSSAI from UE // Check with the requested NSSAI from UE
for (auto rn : nc.get()->requestedNssai) { for (auto rn : nc.get()->requestedNssai) {
if ((rn.sst == snssai.sst) and (rn.sd == snssai.sd)) { if ((rn.sst == snssai.sst) and (rn.sd == snssai.sd)) {
nssai.push_back(snssai); nssai.push_back(snssai);
break; 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