Commit 643c367c authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Update action with support features

parent 8f92ce7c
......@@ -340,17 +340,17 @@ smf_app::smf_app(const std::string& config_file)
throw;
}
if (smf_cfg.discover_upf) {
// Trigger NFStatusNotify subscription to be noticed when a new UPF becomes
// available (if this option is enabled)
trigger_upf_status_notification_subscribe();
} else {
// TODO: should be done when SMF select UPF for a particular UE (should be
// verified)
for (std::vector<pfcp::node_id_t>::const_iterator it = smf_cfg.upfs.begin();
it != smf_cfg.upfs.end(); ++it) {
start_upf_association(*it);
}
if (smf_cfg.discover_upf) {
// Trigger NFStatusNotify subscription to be noticed when a new UPF becomes
// available (if this option is enabled)
trigger_upf_status_notification_subscribe();
}
// Register to NRF (if this option is enabled)
......
......@@ -635,10 +635,12 @@ int smf_config::load(const string& config_file) {
amf_addr.ipv4_addr = amf_ipv4_addr;
amf_addr.port = amf_port;
amf_addr.api_version = "v1"; // TODO: to get API version from DNS
amf_addr.fqdn = astring;
}
}
// UDM
// UDM: Get UDM information if necessary
if (!use_local_subscription_info) {
const Setting& udm_cfg = smf_cfg[SMF_CONFIG_STRING_UDM];
struct in_addr udm_ipv4_addr = {};
unsigned int udm_port = {0};
......@@ -680,8 +682,10 @@ int smf_config::load(const string& config_file) {
udm_addr.api_version = "v1"; // TODO: to get API version from DNS
}
}
}
// UPF list
if (!discover_upf) {
unsigned char buf_in_addr[sizeof(struct in_addr) + 1];
const Setting& upf_list_cfg = smf_cfg[SMF_CONFIG_STRING_UPF_LIST];
count = upf_list_cfg.getLength();
......@@ -690,7 +694,8 @@ int smf_config::load(const string& config_file) {
// TODO FQDN
string address = {};
if (!use_fqdn_dns) {
if (upf_cfg.lookupValue(SMF_CONFIG_STRING_UPF_IPV4_ADDRESS, address)) {
if (upf_cfg.lookupValue(
SMF_CONFIG_STRING_UPF_IPV4_ADDRESS, address)) {
pfcp::node_id_t n = {};
n.node_id_type = pfcp::NODE_ID_TYPE_IPV4_ADDRESS; // actually
if (inet_pton(AF_INET, util::trim(address).c_str(), buf_in_addr) ==
......@@ -723,6 +728,7 @@ int smf_config::load(const string& config_file) {
} else { // IPv4
pfcp::node_id_t n = {};
n.node_id_type = pfcp::NODE_ID_TYPE_IPV4_ADDRESS; // actually
n.fqdn = astring;
if (inet_pton(AF_INET, util::trim(address).c_str(), buf_in_addr) ==
1) {
memcpy(&n.u1.ipv4_address, buf_in_addr, sizeof(struct in_addr));
......@@ -737,8 +743,10 @@ int smf_config::load(const string& config_file) {
}
}
}
}
// NRF
if (discover_upf or register_nrf) {
const Setting& nrf_cfg = smf_cfg[SMF_CONFIG_STRING_NRF];
struct in_addr nrf_ipv4_addr = {};
unsigned int nrf_port = {0};
......@@ -777,10 +785,13 @@ int smf_config::load(const string& config_file) {
nrf_addr.ipv4_addr = nrf_ipv4_addr;
nrf_addr.port = nrf_port;
nrf_addr.api_version = "v1"; // TODO: to get API version from DNS
nrf_addr.fqdn = astring;
}
}
}
// Local configuration
if (use_local_subscription_info) {
num_session_management_subscription = 0;
const Setting& local_cfg = smf_cfg[SMF_CONFIG_STRING_LOCAL_CONFIGURATION];
......@@ -848,10 +859,11 @@ int smf_config::load(const string& config_file) {
qos_profile_arp_preemptvuln;
session_management_subscription[i].session_ambr.downlink =
session_ambr_dl;
session_management_subscription[i].session_ambr.uplink = session_ambr_ul;
session_management_subscription[i].session_ambr.uplink =
session_ambr_ul;
num_session_management_subscription++;
}
}
} catch (const SettingNotFoundException& nfex) {
Logger::smf_app().error("%s : %s", nfex.what(), nfex.getPath());
return RETURNerror;
......@@ -980,6 +992,19 @@ void smf_config::display() {
}
}
Logger::smf_app().info("- Supported Features:");
Logger::smf_app().info(
" Register to NRF............: %s", register_nrf ? "Yes" : "No");
Logger::smf_app().info(
" Discover UPF...............: %s", discover_upf ? "Yes" : "No");
Logger::smf_app().info(
" Use Local Subscription Info: %s",
use_local_subscription_info ? "Yes" : "No");
Logger::smf_app().info(
" Push PCO (DNS+MTU).........: %s", force_push_pco ? "Yes" : "No");
Logger::smf_app().info(
" Use FQDN ..................: %s", use_fqdn_dns ? "Yes" : "No");
Logger::smf_app().info("- AMF:");
Logger::smf_app().info(
" IPv4 Addr ...........: %s",
......@@ -987,6 +1012,9 @@ void smf_config::display() {
Logger::smf_app().info(" Port ................: %lu ", amf_addr.port);
Logger::smf_app().info(
" API version .........: %s", amf_addr.api_version.c_str());
if (use_fqdn_dns)
Logger::smf_app().info(
" FQDN ................: %s", amf_addr.fqdn.c_str());
if (!use_local_subscription_info) {
Logger::smf_app().info("- UDM:");
......@@ -996,9 +1024,12 @@ void smf_config::display() {
Logger::smf_app().info(" Port ................: %lu ", udm_addr.port);
Logger::smf_app().info(
" API version .........: %s", udm_addr.api_version.c_str());
if (use_fqdn_dns)
Logger::smf_app().info(
" FQDN ................: %s", udm_addr.fqdn.c_str());
}
if (register_nrf) {
if (register_nrf or discover_upf) {
Logger::smf_app().info("- NRF:");
Logger::smf_app().info(
" IPv4 Addr ...........: %s",
......@@ -1006,18 +1037,22 @@ void smf_config::display() {
Logger::smf_app().info(" Port ................: %lu ", nrf_addr.port);
Logger::smf_app().info(
" API version .........: %s", nrf_addr.api_version.c_str());
if (use_fqdn_dns)
Logger::smf_app().info(
" FQDN ................: %s", nrf_addr.fqdn.c_str());
}
Logger::smf_app().info("- Supported Features:");
Logger::smf_app().info(
" Register to NRF............: %s", register_nrf ? "Yes" : "No");
if (!discover_upf) {
Logger::smf_app().info("- UPF:");
for (auto u : upfs) {
if (u.node_id_type == pfcp::NODE_ID_TYPE_IPV4_ADDRESS)
Logger::smf_app().info(
" Discover UPF...............: %s", discover_upf ? "Yes" : "No");
Logger::smf_app().info(
" Use Local Subscription Info: %s",
use_local_subscription_info ? "Yes" : "No");
Logger::smf_app().info(
" Push PCO (DNS+MTU).........: %s", force_push_pco ? "Yes" : "No");
" IPv4 Addr ...........: %s",
inet_ntoa(*((struct in_addr*) &u.u1.ipv4_address)));
if (use_fqdn_dns)
Logger::smf_app().info(" FQDN ................: %s", u.fqdn.c_str());
}
}
if (use_local_subscription_info) {
Logger::smf_app().info(
......
......@@ -226,12 +226,14 @@ class smf_config {
struct in_addr ipv4_addr;
unsigned int port;
std::string api_version;
std::string fqdn;
} amf_addr;
struct {
struct in_addr ipv4_addr;
unsigned int port;
std::string api_version;
std::string fqdn;
} udm_addr;
std::vector<pfcp::node_id_t> upfs;
......@@ -240,6 +242,7 @@ class smf_config {
struct in_addr ipv4_addr;
unsigned int port;
std::string api_version;
std::string fqdn;
} nrf_addr;
#define SMF_NUM_SESSION_MANAGEMENT_SUBSCRIPTION_MAX 10
......@@ -299,13 +302,17 @@ class smf_config {
amf_addr.ipv4_addr.s_addr = INADDR_ANY;
amf_addr.port = 80;
amf_addr.api_version = "v1";
amf_addr.fqdn = {};
udm_addr.ipv4_addr.s_addr = INADDR_ANY;
udm_addr.port = 80;
udm_addr.api_version = "v1";
udm_addr.fqdn = {};
nrf_addr.ipv4_addr.s_addr = INADDR_ANY;
nrf_addr.port = 80;
nrf_addr.api_version = "v1";
nrf_addr.fqdn = {};
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