Commit 9a72671d authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Get NRF info from configuration file

parent 53d44562
......@@ -87,7 +87,7 @@ SMF =
{
IPV4_ADDRESS = "@AMF_IPV4_ADDRESS@"; # YOUR AMF CONFIG HERE
PORT = @AMF_PORT@; # YOUR AMF CONFIG HERE (default: 80)
API_VERSION = "@AMF_API_VERSION@"; # YOUR SMF API VERSION FOR SBI CONFIG HERE
API_VERSION = "@AMF_API_VERSION@"; # YOUR AMF API VERSION FOR SBI CONFIG HERE
};
UDM :
......@@ -101,6 +101,13 @@ SMF =
{IPV4_ADDRESS = "@UPF_IPV4_ADDRESS@" ;} # YOUR UPF CONFIG HERE
);
NRF :
{
IPV4_ADDRESS = "@NRF_IPV4_ADDRESS@"; # YOUR NRF CONFIG HERE
PORT = @NRF_PORT@; # YOUR NRF CONFIG HERE (default: 80)
API_VERSION = "@NRF_API_VERSION@"; # YOUR NRF API VERSION FOR SBI CONFIG HERE
};
LOCAL_CONFIGURATION :
{
USE_LOCAL_CONFIGURATION = "yes";
......
......@@ -611,6 +611,28 @@ int smf_config::load(const string &config_file) {
}
}
// NRF
const Setting &nrf_cfg = smf_cfg[SMF_CONFIG_STRING_NRF];
struct in_addr nrf_ipv4_addr;
unsigned int nrf_port = 0;
std::string nrf_api_version;
nrf_cfg.lookupValue(SMF_CONFIG_STRING_NRF_IPV4_ADDRESS, astring);
IPV4_STR_ADDR_TO_INADDR(util::trim(astring).c_str(), nrf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR NRF !");
nrf_addr.ipv4_addr = nrf_ipv4_addr;
if (!(nrf_cfg.lookupValue(SMF_CONFIG_STRING_NRF_PORT, nrf_port))) {
Logger::smf_app().error(SMF_CONFIG_STRING_NRF_PORT "failed");
throw(SMF_CONFIG_STRING_NRF_PORT "failed");
}
nrf_addr.port = nrf_port;
if (!(nrf_cfg.lookupValue(SMF_CONFIG_STRING_API_VERSION,
nrf_api_version))) {
Logger::smf_app().error(SMF_CONFIG_STRING_API_VERSION "failed");
throw(SMF_CONFIG_STRING_API_VERSION "failed");
}
nrf_addr.api_version = nrf_api_version;
// Local configuration
num_session_management_subscription = 0;
const Setting &local_cfg = smf_cfg[SMF_CONFIG_STRING_LOCAL_CONFIGURATION];
......@@ -818,6 +840,13 @@ void smf_config::display() {
Logger::smf_app().info(" API version .........: %s",
udm_addr.api_version.c_str());
Logger::smf_app().info("- NRF:");
Logger::smf_app().info(" IPv4 Addr ...........: %s",
inet_ntoa(*((struct in_addr *)&nrf_addr.ipv4_addr)));
Logger::smf_app().info(" Port ................: %lu ", nrf_addr.port);
Logger::smf_app().info(" API version .........: %s",
nrf_addr.api_version.c_str());
Logger::smf_app().info("- Helpers:");
Logger::smf_app().info(" Push PCO (DNS+MTU) ..: %s",
force_push_pco == 0 ? "false" : "true");
......
......@@ -110,6 +110,10 @@
#define SMF_CONFIG_STRING_UPF_LIST "UPF_LIST"
#define SMF_CONFIG_STRING_UPF_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_NRF "NRF"
#define SMF_CONFIG_STRING_NRF_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_NRF_PORT "PORT"
#define SMF_CONFIG_STRING_LOCAL_CONFIGURATION "LOCAL_CONFIGURATION"
#define SMF_CONFIG_STRING_USE_LOCAL_CONFIGURATION "USE_LOCAL_CONFIGURATION"
#define SMF_CONFIG_STRING_SESSION_MANAGEMENT_SUBSCRIPTION_LIST \
......@@ -221,6 +225,12 @@ class smf_config {
std::vector<pfcp::node_id_t> upfs;
struct {
struct in_addr ipv4_addr;
unsigned int port;
std::string api_version;
} nrf_addr;
// Local configuration
bool local_configuration;
#define SMF_NUM_SESSION_MANAGEMENT_SUBSCRIPTION_MAX 5
......@@ -284,6 +294,10 @@ class smf_config {
udm_addr.port = 80;
udm_addr.api_version = "v1";
nrf_addr.ipv4_addr.s_addr = INADDR_ANY;
nrf_addr.port = 80;
nrf_addr.api_version = "v1";
local_configuration = false;
num_session_management_subscription = 0;
......
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