Unverified Commit 70e1dce1 authored by kharade's avatar kharade

Merge remote-tracking branch 'origin/develop' into httpv2_support

parents 5a94d11f 12738682
...@@ -114,6 +114,10 @@ pipeline { ...@@ -114,6 +114,10 @@ pipeline {
error "Stopping pipeline!" error "Stopping pipeline!"
} }
} }
if (params.DockerHubCredentials == null) {
echo '\u26D4 \u001B[31mNo Credentials to push to DockerHub!\u001B[0m'
error "Stopping pipeline!"
}
} }
} }
} }
...@@ -197,6 +201,10 @@ pipeline { ...@@ -197,6 +201,10 @@ pipeline {
myShCmd('docker build --no-cache --target oai-smf --tag oai-smf:' + smf_tag + ' --file ci-scripts/docker/Dockerfile.ci.ubuntu.18.04 . > archives/smf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('docker build --no-cache --target oai-smf --tag oai-smf:' + smf_tag + ' --file ci-scripts/docker/Dockerfile.ci.ubuntu.18.04 . > archives/smf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
} }
myShCmd('docker image ls >> archives/smf_docker_image_build.log', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('docker image ls >> archives/smf_docker_image_build.log', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
// We will keep also the TMP image in U18 case.
if ("MERGE".equals(env.gitlabActionType)) {
myShCmd('docker image tag oai-smf:' + smf_tag + ' oai-smf:' + rhel_smf_tag, rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
} }
} }
} }
...@@ -403,6 +411,25 @@ pipeline { ...@@ -403,6 +411,25 @@ pipeline {
} }
} }
} }
// For the moment it is Docker-Hub, but we might have a new one internally.
stage ('Pushing Image to Official Registry') {
steps {
script {
// Only in case of push to target branch!
if ("PUSH".equals(env.gitlabActionType)) {
withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.DockerHubCredentials}", usernameVariable: 'DH_Username', passwordVariable: 'DH_Password']
]) {
myShCmd("echo ${DH_Password} | docker login --username ${DH_Username} --password-stdin", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker image tag oai-smf:develop ${DH_Username}/oai-smf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker push ${DH_Username}/oai-smf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker rmi ${DH_Username}/oai-smf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker logout", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
}
}
}
}
} }
post { post {
success { success {
......
...@@ -68,8 +68,8 @@ SMF = ...@@ -68,8 +68,8 @@ SMF =
DNN_LIST = ( DNN_LIST = (
# IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDU_SESSION_TYPE choice in {IPv4, IPv6, IPv4v6} # IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDU_SESSION_TYPE choice in {IPv4, IPv6, IPv4v6}
{DNN_NI = "default"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1}, {DNN_NI = "default"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1},
{DNN_NI = "carrier.com"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1}, {DNN_NI = "carrier.com"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1},
{DNN_NI = "oai"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1} {DNN_NI = "oai"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1}
); );
# DNS address communicated to UEs # DNS address communicated to UEs
...@@ -89,7 +89,8 @@ SMF = ...@@ -89,7 +89,8 @@ 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
HTTP_VERSION = @HTTP_VERSION@; # YOUR NRF CONFIG HERE (default: 1) HTTP_VERSION = @HTTP_VERSION@; # YOUR NRF CONFIG HERE (default: 1)
USE_NETWORK_INSTANCE = "@USE_NETWORK_INSTANCE@" # Set yes if network instance is to be used for given UPF
} }
AMF : AMF :
...@@ -117,8 +118,8 @@ SMF = ...@@ -117,8 +118,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 :
{ {
...@@ -126,9 +127,9 @@ SMF = ...@@ -126,9 +127,9 @@ SMF =
{ NSSAI_SST = 222, NSSAI_SD = "123", DNN = "default", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1, { NSSAI_SST = 222, NSSAI_SD = "123", DNN = "default", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1,
QOS_PROFILE_5QI = 6, QOS_PROFILE_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT", QOS_PROFILE_5QI = 6, QOS_PROFILE_PRIORITY_LEVEL = 1, 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"}, QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "20Mbps", SESSION_AMBR_DL = "22Mbps"},
{ NSSAI_SST = 111; NSSAI_SD = "124", DNN = "oai", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1, { NSSAI_SST = 1; NSSAI_SD = "1", DNN = "oai", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1,
QOS_PROFILE_5QI = 7, QOS_PROFILE_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT", QOS_PROFILE_5QI = 7, QOS_PROFILE_PRIORITY_LEVEL = 1, 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"} QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "20Mbps", SESSION_AMBR_DL = "22Mbps"}
); );
}; };
......
...@@ -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}
......
...@@ -63,10 +63,16 @@ void from_json(const nlohmann::json& j, InterfaceUpfInfoItem& o) { ...@@ -63,10 +63,16 @@ void from_json(const nlohmann::json& j, InterfaceUpfInfoItem& o) {
} }
} }
UPInterfaceType InterfaceUpfInfoItem::getInterfaceType() const { // UPInterfaceType InterfaceUpfInfoItem::getInterfaceType() const {
// return m_InterfaceType;
// }
// void InterfaceUpfInfoItem::setInterfaceType(UPInterfaceType const& value) {
// m_InterfaceType = value;
// }
std::string InterfaceUpfInfoItem::getInterfaceType() const {
return m_InterfaceType; return m_InterfaceType;
} }
void InterfaceUpfInfoItem::setInterfaceType(UPInterfaceType const& value) { void InterfaceUpfInfoItem::setInterfaceType(std::string const& value) {
m_InterfaceType = value; m_InterfaceType = value;
} }
std::vector<std::string>& InterfaceUpfInfoItem::getIpv4EndpointAddresses() { std::vector<std::string>& InterfaceUpfInfoItem::getIpv4EndpointAddresses() {
......
...@@ -45,8 +45,10 @@ class InterfaceUpfInfoItem { ...@@ -45,8 +45,10 @@ class InterfaceUpfInfoItem {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
UPInterfaceType getInterfaceType() const; // UPInterfaceType getInterfaceType() const;
void setInterfaceType(UPInterfaceType const& value); // void setInterfaceType(UPInterfaceType const& value);
std::string getInterfaceType() const;
void setInterfaceType(std::string const& value);
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
...@@ -80,7 +82,8 @@ class InterfaceUpfInfoItem { ...@@ -80,7 +82,8 @@ class InterfaceUpfInfoItem {
friend void from_json(const nlohmann::json& j, InterfaceUpfInfoItem& o); friend void from_json(const nlohmann::json& j, InterfaceUpfInfoItem& o);
protected: protected:
UPInterfaceType m_InterfaceType; // UPInterfaceType m_InterfaceType;
std::string m_InterfaceType;
std::vector<std::string> m_Ipv4EndpointAddresses; std::vector<std::string> m_Ipv4EndpointAddresses;
bool m_Ipv4EndpointAddressesIsSet; bool m_Ipv4EndpointAddressesIsSet;
......
...@@ -318,7 +318,16 @@ typedef struct snssai_upf_info_item_s { ...@@ -318,7 +318,16 @@ typedef struct snssai_upf_info_item_s {
std::vector<dnn_upf_info_item_t> dnn_upf_info_list; std::vector<dnn_upf_info_item_t> dnn_upf_info_list;
} snssai_upf_info_item_t; } snssai_upf_info_item_t;
typedef struct interface_upf_info_item_s {
std::string interface_type;
std::vector<struct in_addr> ipv4_addresses;
std::vector<struct in6_addr> ipv6_addresses;
std::string endpoint_fqdn;
std::string network_instance;
} interface_upf_info_item_t;
typedef struct upf_info_s { typedef struct upf_info_s {
std::vector<interface_upf_info_item_t> interface_upf_info_list;
std::vector<snssai_upf_info_item_t> snssai_upf_info_list; std::vector<snssai_upf_info_item_t> snssai_upf_info_list;
} upf_info_t; } upf_info_t;
......
...@@ -604,6 +604,14 @@ int smf_config::load(const string& config_file) { ...@@ -604,6 +604,14 @@ int smf_config::load(const string& config_file) {
SMF_CONFIG_STRING_SUPPORT_FEATURES_SBI_HTTP_VERSION, httpVersion); SMF_CONFIG_STRING_SUPPORT_FEATURES_SBI_HTTP_VERSION, httpVersion);
http_version = httpVersion; http_version = httpVersion;
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());
...@@ -707,12 +715,13 @@ int smf_config::load(const string& config_file) { ...@@ -707,12 +715,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));
...@@ -741,9 +750,9 @@ int smf_config::load(const string& config_file) { ...@@ -741,9 +750,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));
...@@ -757,6 +766,25 @@ int smf_config::load(const string& config_file) { ...@@ -757,6 +766,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);
}
}
} }
} }
...@@ -889,7 +917,7 @@ int smf_config::load(const string& config_file) { ...@@ -889,7 +917,7 @@ int smf_config::load(const string& config_file) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void smf_config::display() { void smf_config::display() {
Logger::smf_app().info( Logger::smf_app().info(
"==== EURECOM %s v%s ====", PACKAGE_NAME, PACKAGE_VERSION); "==== OAI-CN5G %s v%s ====", PACKAGE_NAME, PACKAGE_VERSION);
Logger::smf_app().info("Configuration SMF:"); Logger::smf_app().info("Configuration SMF:");
Logger::smf_app().info("- Instance ..............: %d\n", instance); Logger::smf_app().info("- Instance ..............: %d\n", instance);
Logger::smf_app().info("- PID dir ...............: %s\n", pid_dir.c_str()); Logger::smf_app().info("- PID dir ...............: %s\n", pid_dir.c_str());
...@@ -1019,6 +1047,8 @@ void smf_config::display() { ...@@ -1019,6 +1047,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(
...@@ -1187,3 +1217,33 @@ std::string smf_config::get_default_dnn() { ...@@ -1187,3 +1217,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"
...@@ -140,6 +145,8 @@ ...@@ -140,6 +145,8 @@
"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_SBI_HTTP_VERSION "HTTP_VERSION" #define SMF_CONFIG_STRING_SUPPORT_FEATURES_SBI_HTTP_VERSION "HTTP_VERSION"
#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
...@@ -223,6 +230,7 @@ class smf_config { ...@@ -223,6 +230,7 @@ class smf_config {
bool use_local_subscription_info; bool use_local_subscription_info;
bool use_fqdn_dns; bool use_fqdn_dns;
unsigned int http_version; unsigned int http_version;
bool use_nwi;
struct { struct {
struct in_addr ipv4_addr; struct in_addr ipv4_addr;
...@@ -248,6 +256,18 @@ class smf_config { ...@@ -248,6 +256,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;
...@@ -341,6 +361,8 @@ class smf_config { ...@@ -341,6 +361,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, up_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);
......
...@@ -519,6 +519,26 @@ void upf_profile::display() const { ...@@ -519,6 +519,26 @@ void upf_profile::display() const {
Logger::smf_app().debug("\t\t\tDNN %s", d.dnn.c_str()); Logger::smf_app().debug("\t\t\tDNN %s", d.dnn.c_str());
} }
} }
if (!upf_info.interface_upf_info_list.empty()) {
for (auto s : upf_info.interface_upf_info_list) {
std::string network_instance = {};
std::string endpoint_fqdn = {};
std::vector<struct in_addr> ipv4_addresses = {};
// std::vector<struct in6_addr> ipv6_addresses = {};
if (!s.network_instance.empty()) network_instance = s.network_instance;
if (!s.endpoint_fqdn.empty()) endpoint_fqdn = s.endpoint_fqdn;
Logger::smf_app().debug(
"\t\tINTERFACE UPF Info List, Interface Type : %s, Network Instance "
"%s, EndpointFqdn: %s",
s.interface_type.c_str(), s.network_instance.c_str(),
s.endpoint_fqdn.c_str());
if (s.ipv4_addresses.size() > 0)
Logger::smf_app().debug("\t\t\tINTERFACE UPF Info List, IPv4 Addr:");
for (auto address : s.ipv4_addresses) {
Logger::smf_app().debug("\t\t\t\t\t\t %s", inet_ntoa(address));
}
}
}
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -540,7 +560,24 @@ void upf_profile::to_json(nlohmann::json& data) const { ...@@ -540,7 +560,24 @@ void upf_profile::to_json(nlohmann::json& data) const {
} }
data["upfInfo"]["sNssaiUpfInfoList"].push_back(tmp); data["upfInfo"]["sNssaiUpfInfoList"].push_back(tmp);
} }
if (!upf_info.interface_upf_info_list.empty()) {
data["upfInfo"]["interfaceUpfInfoList"] = nlohmann::json::array();
for (auto s : upf_info.interface_upf_info_list) {
nlohmann::json tmp = {};
tmp["interfaceType"] = s.interface_type;
if (!s.endpoint_fqdn.empty()) tmp["endpointFqdn"] = s.endpoint_fqdn;
if (!s.network_instance.empty())
tmp["networkInstance"] = s.network_instance;
if (s.ipv4_addresses.size() > 0) {
tmp["ipv4EndpointAddresses"] = nlohmann::json::array();
for (auto address : s.ipv4_addresses) {
tmp["ipv4EndpointAddresses"].push_back(inet_ntoa(address));
}
}
// ToDo for ipv6
data["upfInfo"]["interfaceUpfInfoList"].push_back(tmp);
}
}
Logger::smf_app().debug("UPF profile to json:\n %s", data.dump().c_str()); Logger::smf_app().debug("UPF profile to json:\n %s", data.dump().c_str());
} }
...@@ -576,6 +613,42 @@ void upf_profile::from_json(const nlohmann::json& data) { ...@@ -576,6 +613,42 @@ void upf_profile::from_json(const nlohmann::json& data) {
upf_info.snssai_upf_info_list.push_back(upf_info_item); upf_info.snssai_upf_info_list.push_back(upf_info_item);
} }
} }
if (info.find("interfaceUpfInfoList") != info.end()) {
nlohmann::json interface_upf_info_list =
data["upfInfo"]["interfaceUpfInfoList"];
for (auto it : interface_upf_info_list) {
interface_upf_info_item_t up_interface_info_item = {};
if (it.find("interfaceType") != it.end())
up_interface_info_item.interface_type =
it["interfaceType"].get<std::string>();
if (it.find("networkInstance") != it.end())
up_interface_info_item.network_instance =
it["networkInstance"].get<std::string>();
if (it.find("endpointFqdn") != it.end())
up_interface_info_item.endpoint_fqdn =
it["endpointFqdn"].get<std::string>();
if (it.find("ipv4EndpointAddresses") != it.end()) {
nlohmann::json addresses = it["ipv4EndpointAddresses"];
for (auto d : addresses) {
struct in_addr addr4 = {};
std::string address = d.get<std::string>();
unsigned char buf_in_addr[sizeof(struct in_addr)];
if (inet_pton(AF_INET, util::trim(address).c_str(), buf_in_addr) ==
1) {
memcpy(&addr4, buf_in_addr, sizeof(struct in_addr));
} else {
Logger::smf_app().warn(
"Address conversion: Bad value %s",
util::trim(address).c_str());
}
up_interface_info_item.ipv4_addresses.push_back(addr4);
}
}
// ToDo for ipv6
upf_info.interface_upf_info_list.push_back(up_interface_info_item);
}
}
} }
display(); display();
......
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