Unverified Commit ea26689b authored by kharade's avatar kharade

added use_nwi flag

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