Commit 3f94d8e0 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix issue when adding subscription information with the same NSSAI

parent 07852f13
......@@ -957,7 +957,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
"Retrieve Session Management Subscription data from the UDM");
if (smf_sbi_inst->get_sm_data(supi64, dnn, snssai, subscription)) {
// update dnn_context with subscription info
sc.get()->insert_dnn_subscription(snssai, subscription);
sc.get()->insert_dnn_subscription(snssai, dnn, subscription);
} else {
// Cannot retrieve information from UDM, reject PDU session
// establishment
......@@ -992,7 +992,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
if (get_session_management_subscription_data(
supi64, dnn, snssai, subscription)) {
// update dnn_context with subscription info
sc.get()->insert_dnn_subscription(snssai, subscription);
sc.get()->insert_dnn_subscription(snssai, dnn, subscription);
}
}
}
......
......@@ -2873,11 +2873,35 @@ void smf_context::insert_dnn_subscription(
const snssai_t& snssai,
std::shared_ptr<session_management_subscription>& ss) {
std::unique_lock<std::recursive_mutex> lock(m_context);
dnn_subscriptions[(uint8_t) snssai.sST] = ss;
Logger::smf_app().info(
"Inserted DNN Subscription, key: %d", (uint8_t) snssai.sST);
}
//------------------------------------------------------------------------------
void smf_context::insert_dnn_subscription(
const snssai_t& snssai, const std::string& dnn,
std::shared_ptr<session_management_subscription>& ss) {
std::unique_lock<std::recursive_mutex> lock(m_context);
if (dnn_subscriptions.count((uint8_t) snssai.sST) > 0) {
std::shared_ptr<session_management_subscription> old_ss =
dnn_subscriptions.at((uint8_t) snssai.sST);
std::shared_ptr<dnn_configuration_t> dnn_configuration = {};
ss.get()->find_dnn_configuration(dnn, dnn_configuration);
if (dnn_configuration != nullptr) {
old_ss.get()->insert_dnn_configuration(dnn, dnn_configuration);
}
} else {
dnn_subscriptions[(uint8_t) snssai.sST] = ss;
}
Logger::smf_app().info(
"Inserted DNN Subscription, key: %d, dnn %s", (uint8_t) snssai.sST,
dnn.c_str());
}
//------------------------------------------------------------------------------
bool smf_context::is_dnn_snssai_subscription_data(
const std::string& dnn, const snssai_t& snssai) {
......
......@@ -854,6 +854,18 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
const snssai_t& snssai,
std::shared_ptr<session_management_subscription>& ss);
/*
* Insert a session management subscription into the SMF context
* @param [const snssai_t&] snssai
* @param [const dnn&] dnn
* @param [std::shared_ptr<session_management_subscription>&] ss: pointer to
* the subscription
* @return void
*/
void insert_dnn_subscription(
const snssai_t& snssai, const std::string& dnn,
std::shared_ptr<session_management_subscription>& ss);
/*
* Verify whether a subscription data exist with a given dnn and snssai
* @param [const std::string &] dnn: DNN
......
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