Commit ffa579b0 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

add option to get Session Management Subscription from configuration file...

add option to get Session Management Subscription from configuration file instead of UDM/ code cleanup
parent b5deefeb
......@@ -71,13 +71,13 @@ SMF =
);
};
APN_LIST = (
DNN_LIST = (
# IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDN_TYPE choice in {IPv4, IPv6, IPv4v6}
{APN_NI = "default"; PDN_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1},
{APN_NI = "carrier.com"; PDN_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1},
{APN_NI = "apn2"; PDN_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1},
{APN_NI = "apn3"; PDN_TYPE = "IPv4"; IPV4_POOL = 3; IPV6_POOL = -1},
{APN_NI = "apn4"; PDN_TYPE = "IPv4"; IPV4_POOL = 4; IPV6_POOL = -1}
{DNN_NI = "default"; PDN_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1},
{DNN_NI = "carrier.com"; PDN_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1},
{DNN_NI = "apn2"; PDN_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1},
{DNN_NI = "apn3"; PDN_TYPE = "IPv4"; IPV4_POOL = 3; IPV6_POOL = -1},
{DNN_NI = "apn4"; PDN_TYPE = "IPv4"; IPV4_POOL = 4; IPV6_POOL = -1}
);
# DNS address communicated to UEs
......@@ -97,12 +97,26 @@ SMF =
UDM :
{
IPV4_ADDRESS="@UDM_IPV4_ADDRESS@";
PORT = @UDM_PORT@; #should be removed (default 80)
PORT = @UDM_PORT@; #should be removed (default 80)
};
UPF_LIST = (
{IPV4_ADDRESS="@UPF_IPV4_ADDRESS@" ;}
);
LOCAL_CONFIGURATION :
{
USE_LOCAL_CONFIGURATION = "yes";
SESSION_MANAGEMENT_SUBSCRIPTION_LIST = (
{ NSSAI_SST = 222; NSSAI_SD = "123", DNN = "default", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1,
QOS_PROFILE_5QI = 6, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT",
QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "20Mbps", SESSION_AMBR_DL = "22Mbps"},
{ NSSAI_SST = 222; NSSAI_SD = "123", DNN = "carrier.com", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1,
QOS_PROFILE_5QI = 7, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT",
QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "10Mbps", SESSION_AMBR_DL = "11Mbps"}
);
};
};
......@@ -28,7 +28,6 @@
typedef uint64_t supi64_t;
#define SUPI_64_FMT "%" SCNu64
//typedef imsi_t supi_t;
#define SUPI_DIGITS_MAX 15
......@@ -193,4 +192,7 @@ static const std::vector<std::string> multipart_related_content_part_e2str = {
#define UDM_NUMBER_RETRIES 3
//for N1N2
#define BUF_LEN 512
constexpr uint64_t SECONDS_SINCE_FIRST_EPOCH = 2208988800;
#endif
......@@ -363,62 +363,62 @@ std::string Utility::epc(const unsigned char *plmnid) {
return epc(mnc, mcc);
}
std::string Utility::apn_fqdn(const char *apnoi, const char *mnc,
std::string Utility::dnn_fqdn(const char *apnoi, const char *mnc,
const char *mcc) {
std::string s;
// '(.+)\.apn\.epc\.mnc(\d{3})\.mcc(\d{3})\.3gppnetworks\.org$'
s.append(apnoi).append(".apn.epc.").APPEND_MNC( mnc ).APPEND_MCC( mcc ).
// '(.+)\.dnn\.epc\.mnc(\d{3})\.mcc(\d{3})\.3gppnetworks\.org$'
s.append(apnoi).append(".dnn.epc.").APPEND_MNC( mnc ).APPEND_MCC( mcc ).
APPEND_3GPPNETWORK;
return s;
}
std::string Utility::apn_fqdn(const char *apnoi, const unsigned char *plmnid) {
std::string Utility::dnn_fqdn(const char *apnoi, const unsigned char *plmnid) {
PARSE_PLMNID(plmnid);
return apn_fqdn(apnoi, mnc, mcc);
return dnn_fqdn(apnoi, mnc, mcc);
}
std::string Utility::apn(const char *apnoi, const char *mnc, const char *mcc) {
std::string Utility::dnn(const char *apnoi, const char *mnc, const char *mcc) {
std::string s;
// '(.+)\.apn\.mnc(\d{3})\.mcc(\d{3})\.gprs$'}
s.append(apnoi).append(".apn.").APPEND_MNC( mnc ).APPEND_MCC( mcc ).append(
// '(.+)\.dnn\.mnc(\d{3})\.mcc(\d{3})\.gprs$'}
s.append(apnoi).append(".dnn.").APPEND_MNC( mnc ).APPEND_MCC( mcc ).append(
"gprs");
return s;
}
std::string Utility::apn(const char *apnoi, const unsigned char *plmnid) {
std::string Utility::dnn(const char *apnoi, const unsigned char *plmnid) {
PARSE_PLMNID(plmnid);
return apn(apnoi, mnc, mcc);
return dnn(apnoi, mnc, mcc);
}
std::string Utility::apn_label(const std::string &apn) {
std::string apn_label = { };
std::string Utility::dnn_label(const std::string &dnn) {
std::string dnn_label = { };
bool to_count = true;
uint8_t counted = 0;
int index = 0;
apn_label.push_back('?');
dnn_label.push_back('?');
for (int i = 0; i < apn.length(); ++i) {
if (isalnum(apn[i]) || (apn[i] == '-')) {
apn_label.push_back(apn[i]);
for (int i = 0; i < dnn.length(); ++i) {
if (isalnum(dnn[i]) || (dnn[i] == '-')) {
dnn_label.push_back(dnn[i]);
counted++;
} else if (apn[i] == '.') {
apn_label.push_back('?');
} else if (dnn[i] == '.') {
dnn_label.push_back('?');
if (to_count) { // always true
apn_label[index] = counted;
dnn_label[index] = counted;
}
to_count = true;
counted = 0;
index = apn_label.length() - 1;
index = dnn_label.length() - 1;
}
}
if (to_count) {
apn_label[index] = counted;
dnn_label[index] = counted;
}
return apn_label;
return dnn_label;
}
......@@ -336,12 +336,12 @@ class Utility {
const unsigned char *plmnid);
static std::string epc(const char *mnc, const char *mcc);
static std::string epc(const unsigned char *plmnid);
static std::string apn_fqdn(const char *apnoi, const char *mnc,
static std::string dnn_fqdn(const char *apnoi, const char *mnc,
const char *mcc);
static std::string apn_fqdn(const char *apnoi, const unsigned char *plmnid);
static std::string apn(const char *apnoi, const char *mnc, const char *mcc);
static std::string apn(const char *apnoi, const unsigned char *plmnid);
static std::string apn_label(const std::string &apn);
static std::string dnn_fqdn(const char *apnoi, const unsigned char *plmnid);
static std::string dnn(const char *apnoi, const char *mnc, const char *mcc);
static std::string dnn(const char *apnoi, const unsigned char *plmnid);
static std::string dnn_label(const std::string &dnn);
static AppServiceEnum getAppService(const std::string &s);
static AppProtocolEnum getAppProtocol(const std::string &p);
......
......@@ -28,6 +28,5 @@ include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/gtpv2c)
include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/oai_spgw_c)
include_directories(${SRC_TOP_DIR}/udp)
include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
......@@ -64,10 +64,6 @@ extern "C" {
using namespace smf;
constexpr auto SECONDS_SINCE_FIRST_EPOCH = (2208988800ULL);
constexpr auto NTP_SCALE_FRAC = (4294967296ULL);
#define SYSTEM_CMD_MAX_STR_SIZE 512
extern util::async_shell_cmd *async_shell_cmd_inst;
extern smf_app *smf_app_inst;
......@@ -83,24 +79,24 @@ void smf_app_task(void*);
int smf_app::apply_config(const smf_config &cfg) {
Logger::smf_app().info("Apply config...");
for (int ia = 0; ia < cfg.num_apn; ia++) {
if (cfg.apn[ia].pool_id_iv4 >= 0) {
int pool_id = cfg.apn[ia].pool_id_iv4;
for (int ia = 0; ia < cfg.num_dnn; ia++) {
if (cfg.dnn[ia].pool_id_iv4 >= 0) {
int pool_id = cfg.dnn[ia].pool_id_iv4;
int range =
be32toh(
cfg.ue_pool_range_high[pool_id].s_addr) - be32toh(cfg.ue_pool_range_low[pool_id].s_addr);
paa_dynamic::get_instance().add_pool(cfg.apn[ia].apn, pool_id,
paa_dynamic::get_instance().add_pool(cfg.dnn[ia].dnn, pool_id,
cfg.ue_pool_range_low[pool_id],
range);
//TODO: check with apn_label
Logger::smf_app().info("Applied config %s", cfg.apn[ia].apn.c_str());
//TODO: check with dnn_label
Logger::smf_app().info("Applied config %s", cfg.dnn[ia].dnn.c_str());
}
if (cfg.apn[ia].pool_id_iv6 >= 0) {
int pool_id = cfg.apn[ia].pool_id_iv6;
paa_dynamic::get_instance().add_pool(cfg.apn[ia].apn, pool_id,
if (cfg.dnn[ia].pool_id_iv6 >= 0) {
int pool_id = cfg.dnn[ia].pool_id_iv6;
paa_dynamic::get_instance().add_pool(cfg.dnn[ia].dnn, pool_id,
cfg.paa_pool6_prefix[pool_id],
cfg.paa_pool6_prefix_len[pool_id]);
//TODO: check with apn_label
//TODO: check with dnn_label
}
}
......@@ -291,21 +287,9 @@ smf_app::smf_app(const std::string &config_file)
//------------------------------------------------------------------------------
//From SPGWU
void smf_app::start_upf_association(const pfcp::node_id_t &node_id) {
// TODO refine this, look at RFC5905
std::tm tm_epoch = { 0 }; // Feb 8th, 2036
tm_epoch.tm_year = 2036 - 1900; // years count from 1900
tm_epoch.tm_mon = 2 - 1; // months count from January=0
tm_epoch.tm_mday = 8 - 1; // days count from 1
std::time_t time_epoch = std::mktime(&tm_epoch);
std::chrono::time_point<std::chrono::system_clock> now =
std::chrono::system_clock::now();
std::time_t now_c = std::chrono::system_clock::to_time_t(now);
std::time_t ellapsed = now_c - time_epoch;
uint64_t recovery_time_stamp = ellapsed;
std::time_t _timeEpoch = std::time(nullptr);
unsigned long tv_ntp;
tv_ntp = _timeEpoch + SECONDS_SINCE_FIRST_EPOCH;
std::time_t time_epoch = std::time(nullptr);
uint64_t tv_ntp = time_epoch + SECONDS_SINCE_FIRST_EPOCH;
pfcp_associations::get_instance().add_peer_candidate_node(node_id);
std::shared_ptr<itti_n4_association_setup_request> n4_asc = std::shared_ptr<
......@@ -318,34 +302,12 @@ void smf_app::start_upf_association(const pfcp::node_id_t &node_id) {
cp_function_features.load = 1;
cp_function_features.ovrl = 1;
/*
pfcp::up_function_features_s up_function_features;
// TODO load from config when features available ?
up_function_features = {};
up_function_features.bucp = 0;
up_function_features.ddnd = 0;
up_function_features.dlbd = 0;
up_function_features.trst = 0;
up_function_features.ftup = 1;
up_function_features.pfdm = 0;
up_function_features.heeu = 0;
up_function_features.treu = 0;
up_function_features.empu = 0;
up_function_features.pdiu = 0;
up_function_features.udbc = 0;
up_function_features.quoac = 0;
up_function_features.trace = 0;
up_function_features.frrt = 0;
*/
pfcp::node_id_t this_node_id = { };
if (smf_cfg.get_pfcp_node_id(this_node_id) == RETURNok) {
n4_asc->pfcp_ies.set(this_node_id);
pfcp::recovery_time_stamp_t r = { .recovery_time_stamp =
(uint32_t) tv_ntp };
pfcp::recovery_time_stamp_t r = { .recovery_time_stamp = (uint32_t) tv_ntp };
n4_asc->pfcp_ies.set(r);
//n4_asc->pfcp_ies.set(up_function_features);
n4_asc->pfcp_ies.set(cp_function_features);
if (node_id.node_id_type == pfcp::NODE_ID_TYPE_IPV4_ADDRESS) {
n4_asc->r_endpoint = endpoint(node_id.u1.ipv4_address,
......@@ -625,8 +587,9 @@ void smf_app::handle_pdu_session_create_sm_context_request(
if (request_type.compare("INITIAL_REQUEST") != 0) {
Logger::smf_app().warn("Invalid request type (request type = %s)",
request_type.c_str());
//TODO:
//return
//"Existing PDU Session", AMF should use PDUSession_UpdateSMContext instead (see step 3, section 4.3.2.2.1 @ 3GPP TS 23.502 v16.0.0)
//ignore the message
return;
}
//TODO: For the moment, not support PDU session authentication and authorization by the external DN
......@@ -721,6 +684,20 @@ void smf_app::handle_pdu_session_create_sm_context_request(
Pistache::Http::Code::Forbidden, n1_sm_message_hex);
return;
}
} else {
//use local configuration
Logger::smf_app().debug(
"Retrieve Session Management Subscription data from local configuration");
session_management_subscription *s = new session_management_subscription(
snssai);
std::shared_ptr<session_management_subscription> subscription =
std::shared_ptr<session_management_subscription>(s);
if (get_session_management_subscription_data(supi64, dnn, snssai,
subscription)) {
//update dnn_context with subscription info
sc.get()->insert_dnn_subscription(snssai, subscription);
}
}
// Step 7. generate a SMF context Id and store the corresponding information in a map (SM_Context_ID, (supi, dnn, nssai, pdu_session_id))
......@@ -1026,7 +1003,7 @@ bool smf_app::scid_2_smf_context(const scid_t &scid,
bool smf_app::use_local_configuration_subscription_data(
const std::string &dnn_selection_mode) {
//TODO: should be implemented
return false; //get Session Management Subscription from UDM
return true; //get Session Management Subscription from UDM
}
//------------------------------------------------------------------------------
......@@ -1224,3 +1201,74 @@ n2_sm_info_type_e smf_app::n2_sm_info_type_str2e(std::string &n2_info_type) {
}
}
bool smf_app::get_session_management_subscription_data(
supi64_t &supi, std::string &dnn, snssai_t &snssai,
std::shared_ptr<session_management_subscription> subscription) {
Logger::smf_app().debug(
"Get Session Management Subscription from configuration file");
for (int i = 0; i < smf_cfg.num_session_management_subscription; i++) {
if ((0 == dnn.compare(smf_cfg.session_management_subscription[i].dnn))
and (snssai.sST
== smf_cfg.session_management_subscription[i].single_nssai.sST)) {
std::shared_ptr<dnn_configuration_t> dnn_configuration = std::make_shared<
dnn_configuration_t>();
//PDU Session Type
pdu_session_type_t pdu_session_type(
pdu_session_type_e::PDU_SESSION_TYPE_E_IPV4);
Logger::smf_app().debug(
"Default session type %s",
smf_cfg.session_management_subscription[i].session_type.c_str());
if (smf_cfg.session_management_subscription[i].session_type.compare(
"IPV4") == 0) {
pdu_session_type.pdu_session_type =
pdu_session_type_e::PDU_SESSION_TYPE_E_IPV4;
} else if (smf_cfg.session_management_subscription[i].session_type.compare(
"IPV6") == 0) {
pdu_session_type.pdu_session_type =
pdu_session_type_e::PDU_SESSION_TYPE_E_IPV6;
} else if (smf_cfg.session_management_subscription[i].session_type.compare(
"IPV4V6") == 0) {
pdu_session_type.pdu_session_type =
pdu_session_type_e::PDU_SESSION_TYPE_E_IPV4V6;
}
dnn_configuration->pdu_session_types.default_session_type =
pdu_session_type;
//Ssc_Mode
dnn_configuration->ssc_modes.default_ssc_mode.ssc_mode = smf_cfg
.session_management_subscription[i].ssc_mode;
//5gQosProfile
dnn_configuration->_5g_qos_profile._5qi = smf_cfg
.session_management_subscription[i].default_qos._5qi;
dnn_configuration->_5g_qos_profile.arp.priority_level = smf_cfg
.session_management_subscription[i].default_qos.priority_level;
dnn_configuration->_5g_qos_profile.arp.preempt_cap = smf_cfg
.session_management_subscription[i].default_qos.arp.preempt_cap;
dnn_configuration->_5g_qos_profile.arp.preempt_vuln = smf_cfg
.session_management_subscription[i].default_qos.arp.preempt_vuln;
dnn_configuration->_5g_qos_profile.priority_level = 1; //TODO: hardcoded
//session_ambr
dnn_configuration->session_ambr.uplink = smf_cfg
.session_management_subscription[i].session_ambr.uplink;
dnn_configuration->session_ambr.downlink = smf_cfg
.session_management_subscription[i].session_ambr.downlink;
Logger::smf_app().debug("Session AMBR Uplink %s, Downlink %s",
dnn_configuration->session_ambr.uplink.c_str(),
dnn_configuration->session_ambr.downlink.c_str());
subscription->insert_dnn_configuration(dnn, dnn_configuration);
return true;
}
}
return false;
}
......@@ -115,7 +115,7 @@ class smf_app {
mutable std::shared_mutex m_scid2smf_context;
/*
* Apply the config from the configuration file for APN pools
* Apply the config from the configuration file for DNN pools
* @param [const smf_config &cfg] cfg
* @return
*/
......@@ -444,6 +444,18 @@ class smf_app {
bool is_supi_dnn_snssai_subscription_data(supi_t &supi, std::string &dnn,
snssai_t &snssai);
/*
* Get the Session Management Subscription data from local configuration
* @param [supi_t &] SUPI
* @param [std::string &] DNN
* @param [snssai_t &] S-NSSAI
* @param [std::shared_ptr<session_management_subscription>] subscription: store subscription data if exist
* @return True if local configuration for this session management subscription exists, False otherwise
*/
bool get_session_management_subscription_data(
supi64_t &supi, std::string &dnn, snssai_t &snssai,
std::shared_ptr<session_management_subscription> subscription);
/*
* Verify whether the UE request is valid according to the user subscription and with local policies
* @param [..]
......
......@@ -406,66 +406,66 @@ int smf_config::load(const string &config_file) {
num_paa6_pool += 1;
}
const Setting &apn_list_cfg = smf_cfg[SMF_CONFIG_STRING_APN_LIST];
count = apn_list_cfg.getLength();
int apn_idx = 0;
num_apn = 0;
const Setting &dnn_list_cfg = smf_cfg[SMF_CONFIG_STRING_DNN_LIST];
count = dnn_list_cfg.getLength();
int dnn_idx = 0;
num_dnn = 0;
for (int i = 0; i < count; i++) {
const Setting &apn_cfg = apn_list_cfg[i];
apn_cfg.lookupValue(SMF_CONFIG_STRING_APN_NI, astring);
apn[apn_idx].apn = astring;
apn[apn_idx].apn_label = EPC::Utility::apn_label(astring);
apn_cfg.lookupValue(SMF_CONFIG_STRING_PDN_TYPE, astring);
const Setting &dnn_cfg = dnn_list_cfg[i];
dnn_cfg.lookupValue(SMF_CONFIG_STRING_DNN_NI, astring);
dnn[dnn_idx].dnn = astring;
dnn[dnn_idx].dnn_label = EPC::Utility::dnn_label(astring);
dnn_cfg.lookupValue(SMF_CONFIG_STRING_PDN_TYPE, astring);
if (boost::iequals(astring, "IPv4")) {
apn[apn_idx].pdn_type.pdn_type = PDN_TYPE_E_IPV4;
dnn[dnn_idx].pdn_type.pdn_type = PDN_TYPE_E_IPV4;
} else if (boost::iequals(astring, "IPv6") == 0) {
apn[apn_idx].pdn_type.pdn_type = PDN_TYPE_E_IPV6;
dnn[dnn_idx].pdn_type.pdn_type = PDN_TYPE_E_IPV6;
} else if (boost::iequals(astring, "IPv4IPv6") == 0) {
apn[apn_idx].pdn_type.pdn_type = PDN_TYPE_E_IPV4V6;
dnn[dnn_idx].pdn_type.pdn_type = PDN_TYPE_E_IPV4V6;
} else if (boost::iequals(astring, "Non-IP") == 0) {
apn[apn_idx].pdn_type.pdn_type = PDN_TYPE_E_NON_IP;
dnn[dnn_idx].pdn_type.pdn_type = PDN_TYPE_E_NON_IP;
} else {
Logger::smf_app().error(
" " SMF_CONFIG_STRING_PDN_TYPE " in %d'th APN :%s", i + 1,
" " SMF_CONFIG_STRING_PDN_TYPE " in %d'th DNN :%s", i + 1,
astring.c_str());
throw("Error PDN_TYPE in config file");
}
apn_cfg.lookupValue(SMF_CONFIG_STRING_IPV4_POOL,
apn[apn_idx].pool_id_iv4);
apn_cfg.lookupValue(SMF_CONFIG_STRING_IPV6_POOL,
apn[apn_idx].pool_id_iv6);
dnn_cfg.lookupValue(SMF_CONFIG_STRING_IPV4_POOL,
dnn[dnn_idx].pool_id_iv4);
dnn_cfg.lookupValue(SMF_CONFIG_STRING_IPV6_POOL,
dnn[dnn_idx].pool_id_iv6);
if ((0 <= apn[apn_idx].pool_id_iv4)
&& (apn[apn_idx].pdn_type.pdn_type == PDN_TYPE_E_IPV6)) {
if ((0 <= dnn[dnn_idx].pool_id_iv4)
&& (dnn[dnn_idx].pdn_type.pdn_type == PDN_TYPE_E_IPV6)) {
Logger::smf_app().error(
"PDN_TYPE versus pool identifier %d 'th APN in config file", i + 1);
throw("PDN_TYPE versus pool identifier APN");
"PDN_TYPE versus pool identifier %d 'th DNN in config file", i + 1);
throw("PDN_TYPE versus pool identifier DNN");
}
if ((0 <= apn[apn_idx].pool_id_iv6)
&& (apn[apn_idx].pdn_type.pdn_type == PDN_TYPE_E_IPV4)) {
if ((0 <= dnn[dnn_idx].pool_id_iv6)
&& (dnn[dnn_idx].pdn_type.pdn_type == PDN_TYPE_E_IPV4)) {
Logger::smf_app().error(
"PDN_TYPE versus pool identifier %d 'th APN in config file", i + 1);
throw("PDN_TYPE versus pool identifier APN");
"PDN_TYPE versus pool identifier %d 'th DNN in config file", i + 1);
throw("PDN_TYPE versus pool identifier DNN");
}
if (((0 <= apn[apn_idx].pool_id_iv4) || (0 <= apn[apn_idx].pool_id_iv6))
&& (not boost::iequals(apn[apn_idx].apn, "none"))) {
if (((0 <= dnn[dnn_idx].pool_id_iv4) || (0 <= dnn[dnn_idx].pool_id_iv6))
&& (not boost::iequals(dnn[dnn_idx].dnn, "none"))) {
bool doublon = false;
for (int j = 0; j < apn_idx; j++) {
if (boost::iequals(apn[j].apn, apn[apn_idx].apn)) {
for (int j = 0; j < dnn_idx; j++) {
if (boost::iequals(dnn[j].dnn, dnn[dnn_idx].dnn)) {
doublon = true;
Logger::smf_app().info(
"%d'th APN %s already found in config file (%d 'th APN %s), bypassing",
i + 1, apn[apn_idx].apn.c_str(), j + 1, apn[j].apn.c_str());
"%d'th dnn %s already found in config file (%d 'th DNN %s), bypassing",
i + 1, dnn[dnn_idx].dnn.c_str(), j + 1, dnn[j].dnn.c_str());
}
}
if (not doublon) {
apn_idx++;
num_apn++;
dnn_idx++;
num_dnn++;
}
} else {
Logger::smf_app().error("Bypass %d'th APN %s in config file", i + 1,
apn[apn_idx].apn.c_str());
Logger::smf_app().error("Bypass %d'th DNN %s in config file", i + 1,
dnn[dnn_idx].dnn.c_str());
}
}
smf_cfg.lookupValue(SMF_CONFIG_STRING_DEFAULT_DNS_IPV4_ADDRESS, astring);
......@@ -559,6 +559,88 @@ int smf_config::load(const string &config_file) {
.c_str());
}
}
//Local configuration
num_session_management_subscription = 0;
const Setting &local_cfg = smf_cfg[SMF_CONFIG_STRING_LOCAL_CONFIGURATION];
string local_configuration_str = { };
local_cfg.lookupValue(SMF_CONFIG_STRING_USE_LOCAL_CONFIGURATION,
local_configuration_str);
if (boost::iequals(local_configuration_str, "yes")) {
local_configuration = true;
} else {
local_configuration = false;
}
const Setting &session_management_subscription_list_cfg =
local_cfg[SMF_CONFIG_STRING_SESSION_MANAGEMENT_SUBSCRIPTION_LIST];
count = session_management_subscription_list_cfg.getLength();
for (int i = 0; i < count; i++) {
const Setting &session_management_subscription_cfg =
session_management_subscription_list_cfg[i];
unsigned int nssai_sst = { 0 };
string nssai_sd = { };
string dnn = { };
string default_session_type = { };
unsigned int default_ssc_mode = { 0 };
unsigned int qos_profile_5qi = { 0 };
unsigned int qos_profile_arp_priority_level = { };
string qos_profile_arp_preemptcap = { };
string qos_profile_arp_preemptvuln = { };
string session_ambr_ul = { };
string session_ambr_dl = { };
session_management_subscription_cfg.lookupValue(
SMF_CONFIG_STRING_NSSAI_SST,
nssai_sst);
session_management_subscription_cfg.lookupValue(
SMF_CONFIG_STRING_NSSAI_SD,
nssai_sd);
session_management_subscription_cfg.lookupValue(SMF_CONFIG_STRING_DNN,
dnn);
session_management_subscription_cfg.lookupValue(
SMF_CONFIG_STRING_DEFAULT_SESSION_TYPE,
default_session_type);
session_management_subscription_cfg.lookupValue(
SMF_CONFIG_STRING_DEFAULT_SSC_MODE,
default_ssc_mode);
session_management_subscription_cfg.lookupValue(
SMF_CONFIG_STRING_QOS_PROFILE_5QI,
qos_profile_5qi);
session_management_subscription_cfg.lookupValue(
SMF_CONFIG_STRING_QOS_PROFILE_ARP_PRIORITY_LEVEL,
qos_profile_arp_priority_level);
session_management_subscription_cfg.lookupValue(
SMF_CONFIG_STRING_QOS_PROFILE_ARP_PREEMPTCAP,
qos_profile_arp_preemptcap);
session_management_subscription_cfg.lookupValue(
SMF_CONFIG_STRING_QOS_PROFILE_ARP_PREEMPTVULN,
qos_profile_arp_preemptvuln);
session_management_subscription_cfg.lookupValue(
SMF_CONFIG_STRING_SESSION_AMBR_UL,
session_ambr_ul);
session_management_subscription_cfg.lookupValue(
SMF_CONFIG_STRING_SESSION_AMBR_DL, session_ambr_dl);
session_management_subscription[i].single_nssai.sST