Commit 3775a9b8 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Update with UPF info

parent 3ddb01c7
......@@ -107,5 +107,17 @@ SPGW-U =
PORT = @NRF_PORT@; # YOUR NRF CONFIG HERE (default: 80)
API_VERSION = "@NRF_API_VERSION@"; # YOUR NRF API VERSION FOR SBI CONFIG HERE
};
UPF_INFO = (
{ NSSAI_SST = 222, NSSAI_SD = "123", DNN = "default"},
{ NSSAI_SST = 222; NSSAI_SD = "123", DNN = "carrier.com"}
);
SUPPORT_FEATURES:
{
# STRING, {"yes", "no"},
REGISTER_NRF = "no"; # Set to yes if UPF resgisters to an NRF
}
};
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
SPGW-U =
{
INSTANCE = 0; # 0 is the default
PID_DIRECTORY = "/var/run"; # /var/run is the default
#ITTI_TASKS :
#{
#ITTI_TIMER_SCHED_PARAMS :
#{
#CPU_ID = 1;
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
#SCHED_PRIORITY = 85;
#};
#S1U_SCHED_PARAMS :
#{
#CPU_ID = 1;
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
#SCHED_PRIORITY = 84;
#};
#SX_SCHED_PARAMS :
#{
#CPU_ID = 1;
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
#SCHED_PRIORITY = 84;
#};
#ASYNC_CMD_SCHED_PARAMS :
#{
#CPU_ID = 1;
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
#SCHED_PRIORITY = 84;
#};
#};
INTERFACES :
{
S1U_S12_S4_UP :
{
# S-GW binded interface for S1-U communication (GTPV1-U) can be ethernet interface, virtual ethernet interface, we don't advise wireless interfaces
INTERFACE_NAME = "enx0050b6f4ba5b"; # STRING, interface name, YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read"; # STRING, CIDR or "read to let app read interface configured IP address
#PORT = 2152; # Default is 2152
#SCHED_PARAMS :
#{
#CPU_ID = 2;
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
#SCHED_PRIORITY = 98;
#};
};
SX :
{
# S/P-GW binded interface for SX communication
INTERFACE_NAME = "enx0050b6f4ba5b"; # STRING, interface name
IPV4_ADDRESS = "read"; # STRING, CIDR or "read" to let app read interface configured IP address
#PORT = 8805; # Default is 8805
#SCHED_PARAMS :
#{
#CPU_ID = 1;
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
#SCHED_PRIORITY = 95;
#};
};
SGI :
{
# No config to set, the software will set the SGi interface to the interface used for the default route.
INTERFACE_NAME = "enx0050b6f4ba5b"; # STRING, interface name or "default_gateway"
IPV4_ADDRESS = "read"; # STRING, CIDR or "read" to let app read interface configured IP address
#SCHED_PARAMS :
#{
#CPU_ID = 3;
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
#SCHED_PRIORITY = 98;
#};
};
};
PDN_NETWORK_LIST = (
{NETWORK_IPV4 = "12.1.1.0/24"; SNAT = "yes";} # SNAT Values in {yes, no}
);
SPGW-C_LIST = (
{IPV4_ADDRESS="192.168.1.23" ;}
);
NRF :
{
IPV4_ADDRESS = "192.168.1.23"; # YOUR NRF CONFIG HERE
PORT = 8080; # YOUR NRF CONFIG HERE (default: 80)
API_VERSION = "v1"; # YOUR NRF API VERSION FOR SBI CONFIG HERE
};
UPF_INFO = (
{ NSSAI_SST = 222, NSSAI_SD = "123", DNN = "default"},
{ NSSAI_SST = 222; NSSAI_SD = "123", DNN = "carrier.com"}
);
SUPPORT_FEATURES:
{
# STRING, {"yes", "no"},
REGISTER_NRF = "no"; # Set to yes if UPF resgisters to an NRF
}
};
......@@ -58,6 +58,30 @@ typedef struct snssai_upf_info_item_s {
typedef struct upf_info_s {
std::vector<snssai_upf_info_item_t> snssai_upf_info_list;
void add_snssai(snssai_t snssai, std::string dnn) {
bool found = false;
dnn_upf_info_item_t dnn_item = {};
dnn_item.dnn = dnn;
for (int i = 0; i < snssai_upf_info_list.size(); i++) {
if (snssai_upf_info_list[i].snssai == snssai) {
for (int j = 0; j < snssai_upf_info_list[i].dnn_upf_info_list.size();
j++) {
if (snssai_upf_info_list[i].dnn_upf_info_list[j].dnn.compare(dnn) !=
0) {
snssai_upf_info_list[i].dnn_upf_info_list.push_back(dnn_item);
break;
}
}
found = true;
}
}
if (!found) {
snssai_upf_info_item_t snssai_item = {};
snssai_item.snssai = snssai;
snssai_item.dnn_upf_info_list.push_back(dnn_item);
snssai_upf_info_list.push_back(snssai_item);
}
}
} upf_info_t;
typedef struct patch_item_s {
......
......@@ -455,14 +455,15 @@ int spgwu_config::load(const string& config_file) {
}
// NRF
const Setting &nrf_cfg = spgwu_cfg[SPGWU_CONFIG_STRING_NRF];
const Setting& nrf_cfg = spgwu_cfg[SPGWU_CONFIG_STRING_NRF];
struct in_addr nrf_ipv4_addr;
unsigned int nrf_port = 0;
std::string nrf_api_version;
string nrf_address = {};
nrf_cfg.lookupValue(SPGWU_CONFIG_STRING_NRF_IPV4_ADDRESS, nrf_address);
IPV4_STR_ADDR_TO_INADDR(util::trim(nrf_address).c_str(), nrf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR NRF !");
IPV4_STR_ADDR_TO_INADDR(
util::trim(nrf_address).c_str(), nrf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR NRF !");
nrf_addr.ipv4_addr = nrf_ipv4_addr;
if (!(nrf_cfg.lookupValue(SPGWU_CONFIG_STRING_NRF_PORT, nrf_port))) {
Logger::spgwu_app().error(SPGWU_CONFIG_STRING_NRF_PORT "failed");
......@@ -470,13 +471,44 @@ int spgwu_config::load(const string& config_file) {
}
nrf_addr.port = nrf_port;
if (!(nrf_cfg.lookupValue(SPGWU_CONFIG_STRING_API_VERSION,
nrf_api_version))) {
if (!(nrf_cfg.lookupValue(
SPGWU_CONFIG_STRING_API_VERSION, nrf_api_version))) {
Logger::spgwu_app().error(SPGWU_CONFIG_STRING_API_VERSION "failed");
throw(SPGWU_CONFIG_STRING_API_VERSION "failed");
}
nrf_addr.api_version = nrf_api_version;
// Support features
const Setting& support_features =
spgwu_cfg[SPGWU_CONFIG_STRING_SUPPORT_FEATURES];
string opt;
support_features.lookupValue(
SPGWU_CONFIG_STRING_SUPPORT_FEATURES_REGISTER_NRF, opt);
if (boost::iequals(opt, "yes")) {
register_nrf = true;
} else {
register_nrf = false;
}
// UPF info
const Setting& upf_info_cfg = spgwu_cfg[SPGWU_CONFIG_STRING_UPF_INFO];
count = upf_info_cfg.getLength();
for (int i = 0; i < count; i++) {
const Setting& upf_info_item_cfg = upf_info_cfg[i];
unsigned int nssai_sst = 0;
string nssai_sd = {};
string dnn = {};
upf_info_item_cfg.lookupValue(SPGWU_CONFIG_STRING_NSSAI_SST, nssai_sst);
upf_info_item_cfg.lookupValue(SPGWU_CONFIG_STRING_NSSAI_SD, nssai_sd);
upf_info_item_cfg.lookupValue(SPGWU_CONFIG_STRING_DNN, dnn);
snssai_t snssai = {};
snssai.sST = nssai_sst;
snssai.sD = nssai_sd;
upf_info.add_snssai(snssai, dnn);
}
} catch (const SettingNotFoundException& nfex) {
Logger::spgwu_app().error("%s : %s", nfex.what(), nfex.getPath());
......@@ -592,4 +624,17 @@ void spgwu_config::display() {
}
i++;
}
if (register_nrf) {
if (upf_info.snssai_upf_info_list.size() > 0) {
Logger::spgwu_app().debug("\tUPF Info:");
}
for (auto s : upf_info.snssai_upf_info_list) {
Logger::spgwu_app().debug("\t\tParameters supported by the UPF:");
Logger::spgwu_app().debug(
"\t\t\tSNSSAI (SST %d, SD %s)", s.snssai.sST, s.snssai.sD.c_str());
for (auto d : s.dnn_upf_info_list) {
Logger::spgwu_app().debug("\t\t\tDNN %s", d.dnn.c_str());
}
}
}
}
......@@ -30,6 +30,7 @@
#define FILE_SPGWU_CONFIG_HPP_SEEN
#include "3gpp_29.244.h"
#include "3gpp_29.510.h"
#include "gtpv1u.hpp"
#include "pfcp.hpp"
#include "thread_sched.hpp"
......@@ -74,6 +75,14 @@ namespace spgwu {
#define SPGWU_CONFIG_STRING_SPGWU_APP_SCHED_PARAMS "SPGWU_APP_SCHED_PARAMS"
#define SPGWU_CONFIG_STRING_ASYNC_CMD_SCHED_PARAMS "ASYNC_CMD_SCHED_PARAMS"
#define SPGWU_CONFIG_STRING_SUPPORT_FEATURES "SUPPORT_FEATURES"
#define SPGWU_CONFIG_STRING_SUPPORT_FEATURES_REGISTER_NRF "REGISTER_NRF"
#define SPGWU_CONFIG_STRING_UPF_INFO "UPF_INFO"
#define SPGWU_CONFIG_STRING_NSSAI_SST "NSSAI_SST"
#define SPGWU_CONFIG_STRING_NSSAI_SD "NSSAI_SD"
#define SPGWU_CONFIG_STRING_DNN "DNN"
#define SPGW_ABORT_ON_ERROR true
#define SPGW_WARN_ON_ERROR false
......@@ -128,6 +137,9 @@ class spgwu_config {
std::vector<pdn_cfg_t> pdns;
std::vector<pfcp::node_id_t> spgwcs;
bool register_nrf;
upf_info_t upf_info;
struct {
struct in_addr ipv4_addr;
unsigned int port;
......@@ -161,8 +173,11 @@ class spgwu_config {
sx.port = pfcp::default_port;
nrf_addr.ipv4_addr.s_addr = INADDR_ANY;
nrf_addr.port = 80;
nrf_addr.api_version = "v1";
nrf_addr.port = 80;
nrf_addr.api_version = "v1";
register_nrf = false;
upf_info = {};
};
void lock() { m_rw_lock.lock(); };
void unlock() { m_rw_lock.unlock(); };
......
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