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