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

Merge branch 'nwi_support' into 'develop'

optional nwi handling

See merge request oai/cn5g/oai-cn5g-smf!88
parents 60b3612c ea26689b
...@@ -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 :
...@@ -116,8 +117,8 @@ SMF = ...@@ -116,8 +117,8 @@ SMF =
}; };
UPF_LIST = ( UPF_LIST = (
{IPV4_ADDRESS = "@UPF_IPV4_ADDRESS@" ; FQDN = "@UPF_FQDN_0@"} # YOUR UPF CONFIG HERE {IPV4_ADDRESS = "@UPF_IPV4_ADDRESS@" ; FQDN = "@UPF_FQDN_0@"; NWI_LIST = ({DOMAIN_ACCESS = "@DOMAIN_ACCESS@", DOMAIN_CORE = "@DOMAIN_CORE@"})} # YOUR UPF CONFIG HERE
); ); # NWI_LIST IS OPTIONAL PARAMETER
LOCAL_CONFIGURATION : LOCAL_CONFIGURATION :
{ {
......
...@@ -5,6 +5,11 @@ set -euo pipefail ...@@ -5,6 +5,11 @@ set -euo pipefail
CONFIG_DIR="/openair-smf/etc" CONFIG_DIR="/openair-smf/etc"
# Default values # 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}
if [[ ${USE_FQDN_DNS} == "yes" ]];then if [[ ${USE_FQDN_DNS} == "yes" ]];then
AMF_IPV4_ADDRESS=${AMF_IPV4_ADDRESS:-0.0.0.0} AMF_IPV4_ADDRESS=${AMF_IPV4_ADDRESS:-0.0.0.0}
NRF_IPV4_ADDRESS=${NRF_IPV4_ADDRESS:-0.0.0.0} NRF_IPV4_ADDRESS=${NRF_IPV4_ADDRESS:-0.0.0.0}
......
...@@ -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());
...@@ -702,12 +710,13 @@ int smf_config::load(const string& config_file) { ...@@ -702,12 +710,13 @@ int smf_config::load(const string& config_file) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
const Setting& upf_cfg = upf_list_cfg[i]; const Setting& upf_cfg = upf_list_cfg[i];
// TODO FQDN // TODO FQDN
string address = {}; string address = {};
pfcp::node_id_t n = {};
if (!use_fqdn_dns) { if (!use_fqdn_dns) {
if (upf_cfg.lookupValue( if (upf_cfg.lookupValue(
SMF_CONFIG_STRING_UPF_IPV4_ADDRESS, address)) { SMF_CONFIG_STRING_UPF_IPV4_ADDRESS, address)) {
pfcp::node_id_t n = {}; // pfcp::node_id_t n = {};
n.node_id_type = pfcp::NODE_ID_TYPE_IPV4_ADDRESS; // actually n.node_id_type = pfcp::NODE_ID_TYPE_IPV4_ADDRESS; // actually
if (inet_pton(AF_INET, util::trim(address).c_str(), buf_in_addr) == if (inet_pton(AF_INET, util::trim(address).c_str(), buf_in_addr) ==
1) { 1) {
memcpy(&n.u1.ipv4_address, buf_in_addr, sizeof(struct in_addr)); memcpy(&n.u1.ipv4_address, buf_in_addr, sizeof(struct in_addr));
...@@ -736,9 +745,9 @@ int smf_config::load(const string& config_file) { ...@@ -736,9 +745,9 @@ int smf_config::load(const string& config_file) {
// TODO: // TODO:
throw("DO NOT SUPPORT IPV6 ADDR FOR NRF!"); throw("DO NOT SUPPORT IPV6 ADDR FOR NRF!");
} else { // IPv4 } else { // IPv4
pfcp::node_id_t n = {}; // pfcp::node_id_t n = {};
n.node_id_type = pfcp::NODE_ID_TYPE_IPV4_ADDRESS; // actually n.node_id_type = pfcp::NODE_ID_TYPE_IPV4_ADDRESS; // actually
n.fqdn = astring; n.fqdn = astring;
if (inet_pton(AF_INET, util::trim(address).c_str(), buf_in_addr) == if (inet_pton(AF_INET, util::trim(address).c_str(), buf_in_addr) ==
1) { 1) {
memcpy(&n.u1.ipv4_address, buf_in_addr, sizeof(struct in_addr)); memcpy(&n.u1.ipv4_address, buf_in_addr, sizeof(struct in_addr));
...@@ -752,6 +761,25 @@ int smf_config::load(const string& config_file) { ...@@ -752,6 +761,25 @@ int smf_config::load(const string& config_file) {
upfs.push_back(n); upfs.push_back(n);
} }
} }
// Network Instance
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) {
upf_nwi_list_t upf_nwi;
nwi_cfg[0].lookupValue(
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",
upf_nwi.domain_access.c_str(), upf_nwi.domain_core.c_str());
upf_nwi_list.push_back(upf_nwi);
}
}
} }
} }
...@@ -1014,6 +1042,8 @@ void smf_config::display() { ...@@ -1014,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(
...@@ -1182,3 +1212,33 @@ std::string smf_config::get_default_dnn() { ...@@ -1182,3 +1212,33 @@ std::string smf_config::get_default_dnn() {
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;
} }
//------------------------------------------------------------------------------
bool smf_config::get_nwi_list_index(
bool nwi_enabled, uint8_t nwi_list_index, pfcp::node_id_t node_id) {
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 < 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;
nwi_enabled = true;
return true;
}
}
nwi_enabled = false;
return false;
}
if (node_id.node_id_type == pfcp::NODE_ID_TYPE_FQDN) {
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;
return true;
}
}
nwi_enabled = false;
return false;
}
}
\ No newline at end of file
...@@ -111,6 +111,11 @@ ...@@ -111,6 +111,11 @@
#define SMF_CONFIG_STRING_NRF_IPV4_ADDRESS "IPV4_ADDRESS" #define SMF_CONFIG_STRING_NRF_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_NRF_PORT "PORT" #define SMF_CONFIG_STRING_NRF_PORT "PORT"
#define SMF_CONFIG_STRING_NWI_LIST "NWI_LIST"
#define SMF_CONFIG_STRING_DOMAIN_ACCESS "DOMAIN_ACCESS"
#define SMF_CONFIG_STRING_DOMAIN_CORE "DOMAIN_CORE"
#define SMF_CONFIG_STRING_DOMAIN_SGI_LAN "DOMAIN_SGI_LAN"
#define SMF_CONFIG_STRING_LOCAL_CONFIGURATION "LOCAL_CONFIGURATION" #define SMF_CONFIG_STRING_LOCAL_CONFIGURATION "LOCAL_CONFIGURATION"
#define SMF_CONFIG_STRING_SESSION_MANAGEMENT_SUBSCRIPTION_LIST \ #define SMF_CONFIG_STRING_SESSION_MANAGEMENT_SUBSCRIPTION_LIST \
"SESSION_MANAGEMENT_SUBSCRIPTION_LIST" "SESSION_MANAGEMENT_SUBSCRIPTION_LIST"
...@@ -139,6 +144,8 @@ ...@@ -139,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
...@@ -221,6 +228,7 @@ class smf_config { ...@@ -221,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;
...@@ -245,6 +253,18 @@ class smf_config { ...@@ -245,6 +253,18 @@ class smf_config {
std::string fqdn; std::string fqdn;
} nrf_addr; } nrf_addr;
// Network instance
// 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;
};
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 {
snssai_t single_nssai; snssai_t single_nssai;
...@@ -338,6 +358,8 @@ class smf_config { ...@@ -338,6 +358,8 @@ class smf_config {
bool is_dotted_dnn_handled( bool is_dotted_dnn_handled(
const std::string& dnn, const pdu_session_type_t& pdn_session_type); const std::string& dnn, const pdu_session_type_t& pdn_session_type);
std::string get_default_dnn(); std::string get_default_dnn();
bool get_nwi_list_index(
bool nwi_enabled, uint8_t nwi_list_index, pfcp::node_id_t node_id);
}; };
} // namespace smf } // namespace smf
......
...@@ -153,6 +153,15 @@ int session_create_sm_context_procedure::run( ...@@ -153,6 +153,15 @@ int session_create_sm_context_procedure::run(
cp_fseid.seid = sps->seid; cp_fseid.seid = sps->seid;
n4_triggered->pfcp_ies.set(cp_fseid); n4_triggered->pfcp_ies.set(cp_fseid);
//-------------------
// IE network instance
//-------------------
bool nwi_list_present = false;
uint8_t nwi_list_index = 0;
if (smf_cfg.get_nwi_list_index(nwi_list_present, nwi_list_index, node_id) &
smf_cfg.use_nwi)
nwi_list_present = true;
//******************* //*******************
// UPLINK // UPLINK
//******************* //*******************
...@@ -173,7 +182,14 @@ int session_create_sm_context_procedure::run( ...@@ -173,7 +182,14 @@ int session_create_sm_context_procedure::run(
destination_interface.interface_value = destination_interface.interface_value =
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);
// TODO: Network Instance
if (nwi_list_present) {
pfcp::network_instance_t network_instance = {};
network_instance.network_instance =
smf_cfg.upf_nwi_list[nwi_list_index].domain_core;
forwarding_parameters.set(network_instance);
}
// TODO: Redirect Information // TODO: Redirect Information
// TODO: Outer Header Creation (e.g., in case of N9) // TODO: Outer Header Creation (e.g., in case of N9)
...@@ -220,6 +236,13 @@ int session_create_sm_context_procedure::run( ...@@ -220,6 +236,13 @@ int session_create_sm_context_procedure::run(
// Session Establishment Request, 3GPP TS 29.244 V16.0.0) source interface // Session Establishment Request, 3GPP TS 29.244 V16.0.0) source interface
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_list_present) {
pfcp::network_instance_t network_instance = {};
network_instance.network_instance = smf_cfg.upf_nwi_list[0].domain_access;
pdi.set(network_instance);
}
// CN tunnel info // CN tunnel info
local_fteid.ch = local_fteid.ch =
1; // SMF requests the UPF to assign a local F-TEID to the PDR 1; // SMF requests the UPF to assign a local F-TEID to the PDR
...@@ -546,6 +569,15 @@ int session_update_sm_context_procedure::run( ...@@ -546,6 +569,15 @@ int session_update_sm_context_procedure::run(
} }
*/ */
//-------------------
// IE network instance
//-------------------
bool nwi_list_present = false;
uint8_t nwi_list_index = 0;
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; n11_trigger = sm_context_req;
n11_triggered_pending = sm_context_resp; n11_triggered_pending = sm_context_resp;
...@@ -679,6 +711,12 @@ int session_update_sm_context_procedure::run( ...@@ -679,6 +711,12 @@ 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_list_present) {
pfcp::network_instance_t network_instance = {};
network_instance.network_instance =
smf_cfg.upf_nwi_list[0].domain_access;
forwarding_parameters.set(network_instance);
}
forwarding_parameters.set(destination_interface); forwarding_parameters.set(destination_interface);
outer_header_creation.outer_header_creation_description = outer_header_creation.outer_header_creation_description =
OUTER_HEADER_CREATION_GTPU_UDP_IPV4; OUTER_HEADER_CREATION_GTPU_UDP_IPV4;
...@@ -731,7 +769,13 @@ int session_update_sm_context_procedure::run( ...@@ -731,7 +769,13 @@ 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_list_present) {
pfcp::network_instance_t network_instance =
{}; // mandatory for travelping
network_instance.network_instance =
smf_cfg.upf_nwi_list[0].domain_core;
pdi.set(network_instance);
}
// local_fteid.from_core_fteid(qos_flow.qos_flow.dl_fteid); // local_fteid.from_core_fteid(qos_flow.qos_flow.dl_fteid);
if (sps->ipv4) { if (sps->ipv4) {
ue_ip_address.v4 = 1; ue_ip_address.v4 = 1;
...@@ -813,6 +857,13 @@ int session_update_sm_context_procedure::run( ...@@ -813,6 +857,13 @@ 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_list_present) {
pfcp::network_instance_t network_instance =
{}; // mandatory for travelping
network_instance.network_instance =
smf_cfg.upf_nwi_list[0].domain_core;
pdi.set(network_instance);
}
pdi.set(source_interface); pdi.set(source_interface);
pdi.set(ue_ip_address); pdi.set(ue_ip_address);
......
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