Commit 99634b3b authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Add default value for SD

parent a82bfecd
...@@ -32,6 +32,8 @@ typedef uint64_t supi64_t; ...@@ -32,6 +32,8 @@ typedef uint64_t supi64_t;
#define SUPI_DIGITS_MAX 15 #define SUPI_DIGITS_MAX 15
const uint32_t SD_NO_VALUE = 0xFFFFFF;
const std::string SD_NO_VALUE_STR = "0xFFFFFF";
const uint8_t SST_MAX_STANDARDIZED_VALUE = 127; const uint8_t SST_MAX_STANDARDIZED_VALUE = 127;
typedef struct { typedef struct {
...@@ -176,8 +178,8 @@ enum class sm_context_status_e { ...@@ -176,8 +178,8 @@ enum class sm_context_status_e {
SM_CONTEXT_STATUS_RELEASED = 1 SM_CONTEXT_STATUS_RELEASED = 1
}; };
static const std::vector<std::string> sm_context_status_e2str = {"ACTIVE", static const std::vector<std::string> sm_context_status_e2str = {
"RELEASED"}; "ACTIVE", "RELEASED"};
typedef struct qos_profile_gbr_s { typedef struct qos_profile_gbr_s {
gfbr_t gfbr; // Guaranteed Flow Bit Rate gfbr_t gfbr; // Guaranteed Flow Bit Rate
......
...@@ -802,7 +802,7 @@ int smf_config::load(const string& config_file) { ...@@ -802,7 +802,7 @@ int smf_config::load(const string& config_file) {
session_management_subscription_t sub_item = {}; session_management_subscription_t sub_item = {};
unsigned int nssai_sst = 0; unsigned int nssai_sst = 0;
string nssai_sd = {}; string nssai_sd = SD_NO_VALUE_STR;
string dnn = {}; string dnn = {};
string default_session_type = {}; string default_session_type = {};
unsigned int default_ssc_mode = 0; unsigned int default_ssc_mode = 0;
...@@ -1057,37 +1057,48 @@ void smf_config::display() { ...@@ -1057,37 +1057,48 @@ void smf_config::display() {
for (auto sub : session_management_subscriptions) { for (auto sub : session_management_subscriptions) {
Logger::smf_app().info( Logger::smf_app().info(
" Session Management Subscription Data %d:", index); " Session Management Subscription Data %d:", index);
std::string nssai_str = {};
nssai_str = nssai_str.append(" ")
.append(SMF_CONFIG_STRING_NSSAI_SST)
.append(": ")
.append(std::to_string(sub.single_nssai.sST));
if (!boost::iequals(sub.single_nssai.sD, "0xffffff")) {
nssai_str = nssai_str.append(", ")
.append(SMF_CONFIG_STRING_NSSAI_SD)
.append(": ")
.append(sub.single_nssai.sD);
}
Logger::smf_app().info("%s", nssai_str.c_str());
Logger::smf_app().info( Logger::smf_app().info(
" " SMF_CONFIG_STRING_NSSAI_SST " " SMF_CONFIG_STRING_DNN ": %s", sub.dnn.c_str());
": %d, " SMF_CONFIG_STRING_NSSAI_SD " %s",
sub.single_nssai.sST, sub.single_nssai.sD.c_str());
Logger::smf_app().info(
" " SMF_CONFIG_STRING_DNN ": %s", sub.dnn.c_str());
Logger::smf_app().info( Logger::smf_app().info(
" " SMF_CONFIG_STRING_DEFAULT_SESSION_TYPE ": %s", " " SMF_CONFIG_STRING_DEFAULT_SESSION_TYPE ": %s",
sub.session_type.c_str()); sub.session_type.c_str());
Logger::smf_app().info( Logger::smf_app().info(
" " SMF_CONFIG_STRING_DEFAULT_SSC_MODE ": %d", sub.ssc_mode); " " SMF_CONFIG_STRING_DEFAULT_SSC_MODE ": %d", sub.ssc_mode);
Logger::smf_app().info( Logger::smf_app().info(
" " SMF_CONFIG_STRING_QOS_PROFILE_5QI ": %d", " " SMF_CONFIG_STRING_QOS_PROFILE_5QI ": %d",
sub.default_qos._5qi); sub.default_qos._5qi);
Logger::smf_app().info( Logger::smf_app().info(
" " SMF_CONFIG_STRING_QOS_PROFILE_PRIORITY_LEVEL ": %d", " " SMF_CONFIG_STRING_QOS_PROFILE_PRIORITY_LEVEL ": %d",
sub.default_qos.priority_level); sub.default_qos.priority_level);
Logger::smf_app().info( Logger::smf_app().info(
" " SMF_CONFIG_STRING_QOS_PROFILE_ARP_PRIORITY_LEVEL ": %d", " " SMF_CONFIG_STRING_QOS_PROFILE_ARP_PRIORITY_LEVEL ": %d",
sub.default_qos.arp.priority_level); sub.default_qos.arp.priority_level);
Logger::smf_app().info( Logger::smf_app().info(
" " SMF_CONFIG_STRING_QOS_PROFILE_ARP_PREEMPTCAP ": %s", " " SMF_CONFIG_STRING_QOS_PROFILE_ARP_PREEMPTCAP ": %s",
sub.default_qos.arp.preempt_cap.c_str()); sub.default_qos.arp.preempt_cap.c_str());
Logger::smf_app().info( Logger::smf_app().info(
" " SMF_CONFIG_STRING_QOS_PROFILE_ARP_PREEMPTVULN ": %s", " " SMF_CONFIG_STRING_QOS_PROFILE_ARP_PREEMPTVULN ": %s",
sub.default_qos.arp.preempt_vuln.c_str()); sub.default_qos.arp.preempt_vuln.c_str());
Logger::smf_app().info( Logger::smf_app().info(
" " SMF_CONFIG_STRING_SESSION_AMBR_UL ": %s", " " SMF_CONFIG_STRING_SESSION_AMBR_UL ": %s",
sub.session_ambr.uplink.c_str()); sub.session_ambr.uplink.c_str());
Logger::smf_app().info( Logger::smf_app().info(
" " SMF_CONFIG_STRING_SESSION_AMBR_DL ": %s", " " SMF_CONFIG_STRING_SESSION_AMBR_DL ": %s",
sub.session_ambr.downlink.c_str()); sub.session_ambr.downlink.c_str());
index++; index++;
} }
......
...@@ -3558,25 +3558,50 @@ bool smf_context::handle_ho_cancellation( ...@@ -3558,25 +3558,50 @@ bool smf_context::handle_ho_cancellation(
return true; return true;
} }
//------------------------------------------------------------------------------
void smf_context::get_snssai_key(const snssai_t& snssai, uint32_t& key) {
uint32_t sd = SD_NO_VALUE;
try {
sd = std::stoul(snssai.sD, nullptr, 10);
} catch (const std::exception& e) {
Logger::smf_app().warn(
"Error when converting from string to int for snssai.SD, error: %s",
e.what());
}
key = (sd << 8 | snssai.sST);
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void smf_context::insert_dnn_subscription( void smf_context::insert_dnn_subscription(
const snssai_t& snssai, const snssai_t& snssai,
std::shared_ptr<session_management_subscription>& ss) { std::shared_ptr<session_management_subscription>& ss) {
// Get a unique key from S-NSSAI
uint32_t key = 0;
get_snssai_key(snssai, key);
std::unique_lock<std::recursive_mutex> lock(m_context); std::unique_lock<std::recursive_mutex> lock(m_context);
dnn_subscriptions[(uint8_t) snssai.sST] = ss; dnn_subscriptions[key] = ss;
Logger::smf_app().info( Logger::smf_app().info(
"Inserted DNN Subscription, key: %d", (uint8_t) snssai.sST); "Inserted DNN Subscription, key: %ld (SST %d, SD %s)", key, snssai.sST,
snssai.sD.c_str());
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void smf_context::insert_dnn_subscription( void smf_context::insert_dnn_subscription(
const snssai_t& snssai, const std::string& dnn, const snssai_t& snssai, const std::string& dnn,
std::shared_ptr<session_management_subscription>& ss) { std::shared_ptr<session_management_subscription>& ss) {
// Get a unique key from S-NSSAI
uint32_t key = 0;
get_snssai_key(snssai, key);
std::unique_lock<std::recursive_mutex> lock(m_context); std::unique_lock<std::recursive_mutex> lock(m_context);
if (dnn_subscriptions.count((uint8_t) snssai.sST) > 0) {
if (dnn_subscriptions.count(key) > 0) {
std::shared_ptr<session_management_subscription> old_ss = std::shared_ptr<session_management_subscription> old_ss =
dnn_subscriptions.at((uint8_t) snssai.sST); dnn_subscriptions.at(key);
std::shared_ptr<dnn_configuration_t> dnn_configuration = {}; std::shared_ptr<dnn_configuration_t> dnn_configuration = {};
ss.get()->find_dnn_configuration(dnn, dnn_configuration); ss.get()->find_dnn_configuration(dnn, dnn_configuration);
...@@ -3585,20 +3610,24 @@ void smf_context::insert_dnn_subscription( ...@@ -3585,20 +3610,24 @@ void smf_context::insert_dnn_subscription(
} }
} else { } else {
dnn_subscriptions[(uint8_t) snssai.sST] = ss; dnn_subscriptions[key] = ss;
} }
Logger::smf_app().info( Logger::smf_app().info(
"Inserted DNN Subscription, key: %d, dnn %s", (uint8_t) snssai.sST, "Inserted DNN Subscription, key: %ld (SST %d, SD %s), dnn %s", key,
dnn.c_str()); snssai.sST, snssai.sD.c_str(), dnn.c_str());
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool smf_context::is_dnn_snssai_subscription_data( bool smf_context::is_dnn_snssai_subscription_data(
const std::string& dnn, const snssai_t& snssai) { const std::string& dnn, const snssai_t& snssai) {
// Get a unique key from S-NSSAI
uint32_t key = 0;
get_snssai_key(snssai, key);
std::unique_lock<std::recursive_mutex> lock(m_context); std::unique_lock<std::recursive_mutex> lock(m_context);
if (dnn_subscriptions.count((uint8_t) snssai.sST) > 0) { if (dnn_subscriptions.count(key) > 0) {
std::shared_ptr<session_management_subscription> ss = std::shared_ptr<session_management_subscription> ss =
dnn_subscriptions.at((uint8_t) snssai.sST); dnn_subscriptions.at(key);
if (ss.get()->dnn_configuration(dnn)) if (ss.get()->dnn_configuration(dnn))
return true; return true;
else else
...@@ -3611,17 +3640,23 @@ bool smf_context::is_dnn_snssai_subscription_data( ...@@ -3611,17 +3640,23 @@ bool smf_context::is_dnn_snssai_subscription_data(
bool smf_context::find_dnn_subscription( bool smf_context::find_dnn_subscription(
const snssai_t& snssai, const snssai_t& snssai,
std::shared_ptr<session_management_subscription>& ss) { std::shared_ptr<session_management_subscription>& ss) {
// Get a unique key from S-NSSAI
uint32_t key = 0;
get_snssai_key(snssai, key);
Logger::smf_app().info( Logger::smf_app().info(
"Find a DNN Subscription with key: %d, map size %d", (uint8_t) snssai.sST, "Find a DNN Subscription with key: %ld (SST %d, SD %s), map size %d",
dnn_subscriptions.size()); (uint8_t) snssai.sST, snssai.sD.c_str(), dnn_subscriptions.size());
std::unique_lock<std::recursive_mutex> lock(m_context); std::unique_lock<std::recursive_mutex> lock(m_context);
if (dnn_subscriptions.count((uint8_t) snssai.sST) > 0) { if (dnn_subscriptions.count(key) > 0) {
ss = dnn_subscriptions.at((uint8_t) snssai.sST); ss = dnn_subscriptions.at(key);
return true; return true;
} }
Logger::smf_app().info( Logger::smf_app().info(
"DNN subscription (SNSSAI %d) not found", (uint8_t) snssai.sST); "DNN subscription (SST %d, SD %s) not found", (uint8_t) snssai.sST,
snssai.sD.c_str());
return false; return false;
} }
......
...@@ -1082,6 +1082,14 @@ class smf_context : public std::enable_shared_from_this<smf_context> { ...@@ -1082,6 +1082,14 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
const snssai_t& snssai, const snssai_t& snssai,
std::shared_ptr<session_management_subscription>& ss); std::shared_ptr<session_management_subscription>& ss);
/*
* Get a unique key from SNSSAI
* @param [const snssai_t&] snssai
* @param [uint32_t&] key: generated key
* @return void
*/
void get_snssai_key(const snssai_t& snssai, uint32_t& key);
/* /*
* Convert all members of this class to string for logging * Convert all members of this class to string for logging
* @return std::string * @return std::string
...@@ -1350,8 +1358,8 @@ class smf_context : public std::enable_shared_from_this<smf_context> { ...@@ -1350,8 +1358,8 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
private: private:
std::vector<std::shared_ptr<smf_procedure>> pending_procedures; std::vector<std::shared_ptr<smf_procedure>> pending_procedures;
// snssai-sst <-> session management subscription // snssai <-> session management subscription
std::map<uint8_t, std::shared_ptr<session_management_subscription>> std::map<uint32_t, std::shared_ptr<session_management_subscription>>
dnn_subscriptions; dnn_subscriptions;
std::map<pdu_session_id_t, std::shared_ptr<smf_pdu_session>> std::map<pdu_session_id_t, std::shared_ptr<smf_pdu_session>>
pdu_sessions; // Store all PDU Sessions associated with this UE pdu_sessions; // Store all PDU Sessions associated with this UE
......
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