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)
throw;
}
// Register to NRF
// Register to NRF if needed
if (amf_cfg.support_features.enable_nf_registration) register_to_nrf();
timer_id_t tid = itti_inst->timer_setup(
......@@ -146,7 +146,7 @@ void amf_app_task(void*) {
}
} break;
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);
}
......@@ -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);
}
//------------------------------------------------------------------------------
bool amf_app::ran_amf_id_2_ue_context(
const std::string& ue_context_key, std::shared_ptr<ue_context>& uc) const {
std::shared_lock lock(m_ue_ctx_key);
......@@ -201,6 +202,7 @@ bool amf_app::ran_amf_id_2_ue_context(
} else
return false;
}
//------------------------------------------------------------------------------
void amf_app::set_ran_amf_id_2_ue_context(
const string& ue_context_key, std::shared_ptr<ue_context> uc) {
......
......@@ -3198,6 +3198,14 @@ void amf_n1::initialize_registration_accept(
false, false, false, 0x01); // 3GPP Access
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;
for (auto p : amf_cfg.plmn_list) {
p_tai_t item = {};
......@@ -3211,24 +3219,28 @@ void amf_n1::initialize_registration_accept(
}
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;
for (auto p : amf_cfg.plmn_list) {
for (auto s : p.slice_list) {
SNSSAI_t snssai = {};
try {
snssai.sst = std::stoi(s.sST);
snssai.sd = std::stoi(s.sD);
} catch (const std::exception& err) {
Logger::amf_n1().warn("Invalid SST/SD");
return;
}
if ((p.mcc.compare(uc.get()->tai.mcc) == 0) and
(p.mnc.compare(uc.get()->tai.mnc) == 0) and
(p.tac == uc.get()->tai.tac)) {
for (auto s : p.slice_list) {
SNSSAI_t snssai = {};
try {
snssai.sst = std::stoi(s.sST);
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
for (auto rn : nc.get()->requestedNssai) {
if ((rn.sst == snssai.sst) and (rn.sd == snssai.sd)) {
nssai.push_back(snssai);
break;
// Check with the requested NSSAI from UE
for (auto rn : nc.get()->requestedNssai) {
if ((rn.sst == snssai.sst) and (rn.sd == snssai.sd)) {
nssai.push_back(snssai);
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