Unverified Commit ea26689b authored by kharade's avatar kharade

added use_nwi flag

parent a134bea1
......@@ -89,6 +89,7 @@ SMF =
# but you may need to set to yes for UE that do not explicitly request a PDN address through NAS signalling
USE_LOCAL_SUBSCRIPTION_INFO = "yes"; # Set to yes if SMF uses local subscription information instead of from an UDM
USE_FQDN_DNS = "@USE_FQDN_DNS@"; # Set to yes if AMF/UDM/NRF/UPF will relying on a DNS to resolve FQDN
USE_NETWORK_INSTANCE = "@USE_NETWORK_INSTANCE@" # Set yes if network instance is to be used for given UPF
}
AMF :
......
......@@ -6,6 +6,7 @@ CONFIG_DIR="/openair-smf/etc"
# Default values
# (Default NWI Domain for all UPFs in OAI-Integration)
USE_NETWORK_INSTANCE=${USE_NETWORK_INSTANCE:-no}
DOMAIN_ACCESS=${DOMAIN_ACCESS:-access.oai.org}
DOMAIN_CORE=${DOMAIN_CORE:-core.oai.org}
......
......@@ -599,6 +599,14 @@ int smf_config::load(const string& config_file) {
use_fqdn_dns = false;
}
support_features.lookupValue(
SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_NETWORK_INSTANCE, opt);
if (boost::iequals(opt, "yes")) {
use_nwi = true;
} else {
use_nwi = false;
}
} catch (const SettingNotFoundException& nfex) {
Logger::smf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
......@@ -754,23 +762,22 @@ int smf_config::load(const string& config_file) {
}
}
// Network Instance
if (upf_cfg.exists(SMF_CONFIG_STRING_NWI_LIST)) {
if (upf_cfg.exists(SMF_CONFIG_STRING_NWI_LIST) & use_nwi) {
const Setting& nwi_cfg = upf_cfg[SMF_CONFIG_STRING_NWI_LIST];
count = nwi_cfg.getLength();
// Check if NWI list for given UPF is present
if (count > 0) {
network_instance_configuration = true;
string domain_access = {};
string domain_core = {};
upf_nwi_list_t upf_nwi;
nwi_cfg[0].lookupValue(
SMF_CONFIG_STRING_DOMAIN_ACCESS, domain_access);
nwi_cfg[0].lookupValue(SMF_CONFIG_STRING_DOMAIN_CORE, domain_core);
upf_nwi_list[i].domain_access = domain_access;
upf_nwi_list[i].domain_core = domain_core;
upf_nwi_list[i].upf_id = n;
SMF_CONFIG_STRING_DOMAIN_ACCESS, upf_nwi.domain_access);
nwi_cfg[0].lookupValue(
SMF_CONFIG_STRING_DOMAIN_CORE, upf_nwi.domain_core);
upf_nwi.upf_id = n;
Logger::smf_app().debug(
"NWI config found for UP node:-\t Nwi access: %s , \t Nwi "
"core: %s",
domain_access.c_str(), domain_core.c_str());
upf_nwi.domain_access.c_str(), upf_nwi.domain_core.c_str());
upf_nwi_list.push_back(upf_nwi);
}
}
}
......@@ -1035,6 +1042,8 @@ void smf_config::display() {
" Push PCO (DNS+MTU).........: %s", force_push_pco ? "Yes" : "No");
Logger::smf_app().info(
" Use FQDN ..................: %s", use_fqdn_dns ? "Yes" : "No");
Logger::smf_app().info(
" Use NWI ..................: %s", use_nwi ? "Yes" : "No");
Logger::smf_app().info("- AMF:");
Logger::smf_app().info(
......@@ -1210,7 +1219,7 @@ bool smf_config::get_nwi_list_index(
Logger::smf_app().debug("Default DNN: %s", smf_cfg.dnn[0].dnn.c_str());
// return smf_cfg.dnn[0].dnn;
if (node_id.node_id_type == pfcp::NODE_ID_TYPE_IPV4_ADDRESS) {
for (int i = 0; i < SMF_NUM_NETWORK_INSTANCE_LIST_MAX; i++) {
for (int i = 0; i < upf_nwi_list.size(); i++) {
if (node_id.u1.ipv4_address.s_addr ==
upf_nwi_list[i].upf_id.u1.ipv4_address.s_addr) {
nwi_list_index = i;
......@@ -1219,9 +1228,10 @@ bool smf_config::get_nwi_list_index(
}
}
nwi_enabled = false;
return false;
}
if (node_id.node_id_type == pfcp::NODE_ID_TYPE_FQDN) {
for (int i = 0; i < SMF_NUM_NETWORK_INSTANCE_LIST_MAX; i++) {
for (int i = 0; i < upf_nwi_list.size(); i++) {
if (node_id.fqdn == upf_nwi_list[i].upf_id.fqdn) {
nwi_list_index = i;
nwi_enabled = true;
......@@ -1229,5 +1239,6 @@ bool smf_config::get_nwi_list_index(
}
}
nwi_enabled = false;
return false;
}
}
\ No newline at end of file
......@@ -144,6 +144,8 @@
#define SMF_CONFIG_STRING_NAS_FORCE_PUSH_PCO \
"FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_FQDN_DNS "USE_FQDN_DNS"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_NETWORK_INSTANCE \
"USE_NETWORK_INSTANCE"
#define SMF_MAX_ALLOCATED_PDN_ADDRESSES 1024
......@@ -226,6 +228,7 @@ class smf_config {
bool discover_upf;
bool use_local_subscription_info;
bool use_fqdn_dns;
bool use_nwi;
struct {
struct in_addr ipv4_addr;
......@@ -251,15 +254,16 @@ class smf_config {
} nrf_addr;
// Network instance
bool network_instance_configuration;
#define SMF_NUM_NETWORK_INSTANCE_LIST_MAX 10
struct {
// bool network_instance_configuration;
struct upf_nwi_list_s {
pfcp::node_id_t upf_id;
std::string domain_access;
std::string domain_core;
// std::string domain_sgi_lan;
} upf_nwi_list[SMF_NUM_NETWORK_INSTANCE_LIST_MAX];
uint8_t num_upf_network_instance_list;
};
typedef struct upf_nwi_list_s upf_nwi_list_t;
std::vector<upf_nwi_list_t> upf_nwi_list;
#define SMF_NUM_SESSION_MANAGEMENT_SUBSCRIPTION_MAX 10
struct {
......
......@@ -156,10 +156,11 @@ int session_create_sm_context_procedure::run(
//-------------------
// IE network instance
//-------------------
bool nwi_enabled = false;
bool nwi_list_present = false;
uint8_t nwi_list_index = 0;
if (smf_cfg.get_nwi_list_index(nwi_enabled, nwi_list_index, node_id))
nwi_enabled = true;
if (smf_cfg.get_nwi_list_index(nwi_list_present, nwi_list_index, node_id) &
smf_cfg.use_nwi)
nwi_list_present = true;
//*******************
// UPLINK
......@@ -182,7 +183,7 @@ int session_create_sm_context_procedure::run(
pfcp::INTERFACE_VALUE_CORE; // ACCESS is for downlink, CORE for uplink
forwarding_parameters.set(destination_interface);
if (nwi_enabled) {
if (nwi_list_present) {
pfcp::network_instance_t network_instance = {};
network_instance.network_instance =
smf_cfg.upf_nwi_list[nwi_list_index].domain_core;
......@@ -236,7 +237,7 @@ int session_create_sm_context_procedure::run(
source_interface.interface_value = pfcp::INTERFACE_VALUE_ACCESS;
pdi.set(source_interface);
if (nwi_enabled) {
if (nwi_list_present) {
pfcp::network_instance_t network_instance = {};
network_instance.network_instance = smf_cfg.upf_nwi_list[0].domain_access;
pdi.set(network_instance);
......@@ -571,10 +572,11 @@ int session_update_sm_context_procedure::run(
//-------------------
// IE network instance
//-------------------
bool nwi_enabled = false;
bool nwi_list_present = false;
uint8_t nwi_list_index = 0;
if (smf_cfg.get_nwi_list_index(nwi_enabled, nwi_list_index, up_node_id))
nwi_enabled = true;
if (smf_cfg.get_nwi_list_index(nwi_list_present, nwi_list_index, up_node_id) &
smf_cfg.use_nwi)
nwi_list_present = true;
//-------------------
n11_trigger = sm_context_req;
......@@ -709,7 +711,7 @@ int session_update_sm_context_procedure::run(
destination_interface.interface_value =
pfcp::INTERFACE_VALUE_ACCESS; // ACCESS is for downlink, CORE for
// uplink
if (nwi_enabled) {
if (nwi_list_present) {
pfcp::network_instance_t network_instance = {};
network_instance.network_instance =
smf_cfg.upf_nwi_list[0].domain_access;
......@@ -767,7 +769,7 @@ int session_update_sm_context_procedure::run(
// pfcp::framed_routing_t framed_routing = {};
// pfcp::framed_ipv6_route_t framed_ipv6_route = {};
source_interface.interface_value = pfcp::INTERFACE_VALUE_CORE;
if (nwi_enabled) {
if (nwi_list_present) {
pfcp::network_instance_t network_instance =
{}; // mandatory for travelping
network_instance.network_instance =
......@@ -855,7 +857,7 @@ int session_update_sm_context_procedure::run(
precedence.precedence = flow.precedence.precedence;
source_interface.interface_value = pfcp::INTERFACE_VALUE_CORE;
if (nwi_enabled) {
if (nwi_list_present) {
pfcp::network_instance_t network_instance =
{}; // mandatory for travelping
network_instance.network_instance =
......
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