Commit e9614ab6 authored by kharade's avatar kharade

nssf parameters added in config file

parent 632c3bb9
......@@ -85,6 +85,10 @@ services:
- AUSF_PORT=80
- AUSF_API_VERSION=v1
- AUSF_FQDN=localhost
- NSSF_IPV4_ADDRESS=0.0.0.0
- NSSF_PORT=80
- NSSF_API_VERSION=v1
- NSSF_FQDN=localhost
depends_on:
- cicd_mysql
networks:
......
......@@ -96,13 +96,21 @@ AMF =
API_VERSION = "@AUSF_API_VERSION@"; # YOUR AUSF API VERSION FOR SBI CONFIG HERE
FQDN = "@AUSF_FQDN@" # YOUR AUSF FQDN CONFIG HERE
};
NSSF :
{
IPV4_ADDRESS = "@NSSF_IPV4_ADDRESS@"; # YOUR NSSF CONFIG HERE
PORT = @NSSF_PORT@; # YOUR NSSF CONFIG HERE (default: 80)
API_VERSION = "@NSSF_API_VERSION@"; # YOUR NSSF API VERSION FOR SBI CONFIG HERE
FQDN = "@NSSF_FQDN@" # YOUR NSSF FQDN CONFIG HERE
};
};
SUPPORT_FEATURES:
{
# STRING, {"yes", "no"},
NF_REGISTRATION = "@NF_REGISTRATION@"; # Set to yes if AMF resgisters to an NRF
NRF_SELECTION = "@NRF_SELECTION@"; # Set to yes to enable NRF discovery and selection
SMF_SELECTION = "@SMF_SELECTION@"; # Set to yes to enable SMF discovery and selection
EXTERNAL_AUSF = "@EXTERNAL_AUSF@"; # Set to yes if AMF works with an external AUSF
EXTERNAL_UDM = "@EXTERNAL_UDM@"; # Set to yes if AMF works with an external UDM
......
......@@ -7,7 +7,14 @@ CONFIG_DIR="/openair-amf/etc"
# Default values
EXTERNAL_AUSF=${EXTERNAL_AUSF:-no}
EXTERNAL_UDM=${EXTERNAL_UDM:-no}
NRF_SELECTION=${NRF_SELECTION:-no}
NSSF_IPV4_ADDRESS=${NSSF_IPV4_ADDRESS:-0.0.0.0}
NSSF_PORT=${NSSF_PORT:-80}
NSSF_API_VERSION=${NSSF_API_VERSION:-v2}
NSSF_FQDN=${NSSF_FQDN:-oai-nssf}
if [[ ${USE_FQDN_DNS} == "yes" ]];then
NSSF_IPV4_ADDR=${NSSF_IPV4_ADDR_0:-0.0.0.0}
SMF_IPV4_ADDR_0=${SMF_IPV4_ADDR_0:-0.0.0.0}
SMF_IPV4_ADDR_1=${SMF_IPV4_ADDR_1:-0.0.0.0}
NRF_IPV4_ADDRESS=${NRF_IPV4_ADDRESS:-0.0.0.0}
......
......@@ -78,6 +78,7 @@ amf_config::amf_config() {
nas_cfg = {};
smf_pool = {};
support_features.enable_nf_registration = false;
support_features.enable_nrf_selection = false;
support_features.enable_smf_selection = false;
support_features.enable_external_ausf = false;
support_features.enable_external_udm = false;
......@@ -237,6 +238,14 @@ int amf_config::load(const std::string& config_file) {
support_features.enable_nf_registration = false;
}
support_features_cfg.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_NRF_SELECTION, opt);
if (boost::iequals(opt, "yes")) {
support_features.enable_nrf_selection = true;
} else {
support_features.enable_nrf_selection = false;
}
support_features_cfg.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_SMF_SELECTION, opt);
if (boost::iequals(opt, "yes")) {
......@@ -456,6 +465,48 @@ int amf_config::load(const std::string& config_file) {
}
}
// NSSF
if (support_features.enable_nrf_selection) {
const Setting& nssf_cfg = new_if_cfg[AMF_CONFIG_STRING_NSSF];
struct in_addr nssf_ipv4_addr = {};
unsigned int nssf_port = {};
std::string nssf_api_version = {};
if (!support_features.use_fqdn_dns) {
nssf_cfg.lookupValue(AMF_CONFIG_STRING_IPV4_ADDRESS, address);
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), nssf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR NSSF !");
nssf_addr.ipv4_addr = nssf_ipv4_addr;
if (!(nssf_cfg.lookupValue(AMF_CONFIG_STRING_PORT, nssf_port))) {
Logger::amf_app().error(AMF_CONFIG_STRING_PORT "failed");
throw(AMF_CONFIG_STRING_PORT "failed");
}
nssf_addr.port = nssf_port;
if (!(nssf_cfg.lookupValue(
AMF_CONFIG_STRING_API_VERSION, nssf_api_version))) {
Logger::amf_app().error(AMF_CONFIG_STRING_API_VERSION "failed");
throw(AMF_CONFIG_STRING_API_VERSION "failed");
}
nssf_addr.api_version = nssf_api_version;
} else {
std::string nssf_fqdn = {};
nssf_cfg.lookupValue(AMF_CONFIG_STRING_FQDN_DNS, nssf_fqdn);
uint8_t addr_type = {};
fqdn::resolve(nssf_fqdn, address, nssf_port, addr_type);
if (addr_type != 0) { // IPv6: TODO
throw("DO NOT SUPPORT IPV6 ADDR FOR NSSF!");
} else { // IPv4
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), nssf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR NSSF !");
nssf_addr.ipv4_addr = nssf_ipv4_addr;
nssf_addr.port = nssf_port;
nssf_addr.api_version = "v1"; // TODO: get API version
}
}
}
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
......@@ -607,6 +658,15 @@ void amf_config::display() {
" API version ...........: %s", nrf_addr.api_version.c_str());
}
if (support_features.enable_nrf_selection) {
Logger::config().info("- NSSF:");
Logger::config().info(
" IP Addr ...............: %s", inet_ntoa(nssf_addr.ipv4_addr));
Logger::config().info(" Port ..................: %d", nssf_addr.port);
Logger::config().info(
" API version ...........: %s", nssf_addr.api_version.c_str());
}
if (support_features.enable_external_ausf) {
Logger::config().info("- AUSF:");
Logger::config().info(
......@@ -634,6 +694,9 @@ void amf_config::display() {
Logger::config().info(
" NF Registration .......: %s",
support_features.enable_nf_registration ? "Yes" : "No");
Logger::config().info(
" NRF Selection .........: %s",
support_features.enable_nrf_selection ? "Yes" : "No");
Logger::config().info(
" SMF Selection .........: %s",
support_features.enable_smf_selection ? "Yes" : "No");
......
......@@ -67,6 +67,8 @@
#define AMF_CONFIG_STRING_AUSF "AUSF"
#define AMF_CONFIG_STRING_NSSF "NSSF"
#define AMF_CONFIG_STRING_SCHED_PARAMS "SCHED_PARAMS"
#define AMF_CONFIG_STRING_THREAD_RD_CPU_ID "CPU_ID"
#define AMF_CONFIG_STRING_THREAD_RD_SCHED_POLICY "SCHED_POLICY"
......@@ -102,6 +104,7 @@
"ORDERED_SUPPORTED_CIPHERING_ALGORITHM_LIST"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES "SUPPORT_FEATURES"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_NF_REGISTRATION "NF_REGISTRATION"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_NRF_SELECTION "NRF_SELECTION"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_SMF_SELECTION "SMF_SELECTION"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_AUSF "EXTERNAL_AUSF"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_UDM "EXTERNAL_UDM"
......@@ -204,6 +207,7 @@ class amf_config {
struct {
bool enable_nf_registration;
bool enable_nrf_selection;
bool enable_smf_selection;
bool enable_external_ausf;
bool enable_external_udm;
......@@ -222,6 +226,12 @@ class amf_config {
unsigned int port;
std::string api_version;
} ausf_addr;
struct {
struct in_addr ipv4_addr;
unsigned int port;
std::string api_version;
} nssf_addr;
};
} // namespace config
......
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