Commit e19fee94 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Add support features to be able to enable/disable some options (e.g., nf...

Add support features to be able to enable/disable some options (e.g., nf registration, external UDM, etc) from conf file
parent ace69d49
...@@ -83,6 +83,15 @@ SMF = ...@@ -83,6 +83,15 @@ SMF =
# Non standard feature, normally should be set to "no", but you may need to set to yes for UE that do not explicitly request a PDN address through NAS signalling # Non standard feature, normally should be set to "no", but you may need to set to yes for UE that do not explicitly request a PDN address through NAS signalling
FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS = "no"; # STRING, {"yes", "no"}. FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS = "no"; # STRING, {"yes", "no"}.
SUPPORT_FEATURES:
{
# STRING, {"yes", "no"},
REGISTER_NRF = "no"; # Set to yes if SMF resgisters to an NRF
DISCOVER_UPF = "no"; # Set to yes to enable UPF discovery and selection
FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS = "no";
USE_LOCAL_SUBSCRIPTION_INFO = "yes"; # Set to yes if SMF uses local subscription information instead of from an UDM
}
AMF : AMF :
{ {
IPV4_ADDRESS = "@AMF_IPV4_ADDRESS@"; # YOUR AMF CONFIG HERE IPV4_ADDRESS = "@AMF_IPV4_ADDRESS@"; # YOUR AMF CONFIG HERE
......
...@@ -344,11 +344,14 @@ smf_app::smf_app(const std::string& config_file) ...@@ -344,11 +344,14 @@ smf_app::smf_app(const std::string& config_file)
} }
// Register to NRF // Register to NRF
register_to_nrf(); if (smf_cfg.register_nrf) register_to_nrf();
if (smf_cfg.discover_upf) {
// Trigger NFStatusNotify // Trigger NFStatusNotify
unsigned int microsecond = 10000; // 10ms unsigned int microsecond = 10000; // 10ms
usleep(microsecond); usleep(microsecond);
trigger_upf_status_notification_subscribe(); trigger_upf_status_notification_subscribe();
}
Logger::smf_app().startup("Started"); Logger::smf_app().startup("Started");
} }
......
...@@ -542,13 +542,49 @@ int smf_config::load(const string& config_file) { ...@@ -542,13 +542,49 @@ int smf_config::load(const string& config_file) {
astring.c_str()); astring.c_str());
} }
smf_cfg.lookupValue(SMF_CONFIG_STRING_NAS_FORCE_PUSH_PCO, astring); smf_cfg.lookupValue(SMF_CONFIG_STRING_UE_MTU, ue_mtu);
if (boost::iequals(astring, "yes")) {
// Support features
try {
const Setting& support_features =
smf_cfg[SMF_CONFIG_STRING_SUPPORT_FEATURES];
string opt;
support_features.lookupValue(
SMF_CONFIG_STRING_SUPPORT_FEATURES_REGISTER_NRF, opt);
if (boost::iequals(opt, "yes")) {
register_nrf = true;
} else {
register_nrf = false;
}
support_features.lookupValue(
SMF_CONFIG_STRING_SUPPORT_FEATURES_DISCOVER_UPF, opt);
if (boost::iequals(opt, "yes")) {
discover_upf = true;
} else {
discover_upf = false;
}
support_features.lookupValue(
SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_LOCAL_SUBSCRIPTION_INFO, opt);
if (boost::iequals(opt, "yes")) {
use_local_subscription_info = true;
} else {
use_local_subscription_info = false;
}
support_features.lookupValue(SMF_CONFIG_STRING_NAS_FORCE_PUSH_PCO, opt);
if (boost::iequals(opt, "yes")) {
force_push_pco = true; force_push_pco = true;
} else { } else {
force_push_pco = false; force_push_pco = false;
} }
smf_cfg.lookupValue(SMF_CONFIG_STRING_UE_MTU, ue_mtu);
} catch (const SettingNotFoundException& nfex) {
Logger::smf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
}
// AMF // AMF
const Setting& amf_cfg = smf_cfg[SMF_CONFIG_STRING_AMF]; const Setting& amf_cfg = smf_cfg[SMF_CONFIG_STRING_AMF];
...@@ -859,6 +895,7 @@ void smf_config::display() { ...@@ -859,6 +895,7 @@ void smf_config::display() {
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_local_subscription_info) {
Logger::smf_app().info("- UDM:"); Logger::smf_app().info("- UDM:");
Logger::smf_app().info( Logger::smf_app().info(
" IPv4 Addr ...........: %s", " IPv4 Addr ...........: %s",
...@@ -866,7 +903,9 @@ void smf_config::display() { ...@@ -866,7 +903,9 @@ 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 (register_nrf) {
Logger::smf_app().info("- NRF:"); Logger::smf_app().info("- NRF:");
Logger::smf_app().info( Logger::smf_app().info(
" IPv4 Addr ...........: %s", " IPv4 Addr ...........: %s",
...@@ -874,10 +913,18 @@ void smf_config::display() { ...@@ -874,10 +913,18 @@ 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());
}
Logger::smf_app().info("- Helpers:"); 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( Logger::smf_app().info(
" Push PCO (DNS+MTU) ..: %s", force_push_pco == 0 ? "false" : "true"); " Push PCO (DNS+MTU).........: %s", force_push_pco ? "Yes" : "No");
if (local_configuration) { if (local_configuration) {
Logger::smf_app().info( Logger::smf_app().info(
......
...@@ -55,9 +55,6 @@ ...@@ -55,9 +55,6 @@
#define SMF_CONFIG_STRING_SBI_HTTP2_PORT "HTTP2_PORT" #define SMF_CONFIG_STRING_SBI_HTTP2_PORT "HTTP2_PORT"
#define SMF_CONFIG_STRING_API_VERSION "API_VERSION" #define SMF_CONFIG_STRING_API_VERSION "API_VERSION"
#define SMF_CONFIG_STRING_NAS_FORCE_PUSH_PCO \
"FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS"
#define SMF_CONFIG_STRING_IP_ADDRESS_POOL "IP_ADDRESS_POOL" #define SMF_CONFIG_STRING_IP_ADDRESS_POOL "IP_ADDRESS_POOL"
#define SMF_CONFIG_STRING_ARP_UE "ARP_UE" #define SMF_CONFIG_STRING_ARP_UE "ARP_UE"
#define SMF_CONFIG_STRING_ARP_UE_CHOICE_NO "NO" #define SMF_CONFIG_STRING_ARP_UE_CHOICE_NO "NO"
...@@ -135,6 +132,14 @@ ...@@ -135,6 +132,14 @@
#define SMF_CONFIG_STRING_SESSION_AMBR_UL "SESSION_AMBR_UL" #define SMF_CONFIG_STRING_SESSION_AMBR_UL "SESSION_AMBR_UL"
#define SMF_CONFIG_STRING_SESSION_AMBR_DL "SESSION_AMBR_DL" #define SMF_CONFIG_STRING_SESSION_AMBR_DL "SESSION_AMBR_DL"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES "SUPPORT_FEATURES"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES_REGISTER_NRF "REGISTER_NRF"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES_DISCOVER_UPF "DISCOVER_UPF"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_LOCAL_SUBSCRIPTION_INFO \
"USE_LOCAL_SUBSCRIPTION_INFO"
#define SMF_CONFIG_STRING_NAS_FORCE_PUSH_PCO \
"FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS"
#define SMF_MAX_ALLOCATED_PDN_ADDRESSES 1024 #define SMF_MAX_ALLOCATED_PDN_ADDRESSES 1024
namespace smf { namespace smf {
...@@ -211,6 +216,10 @@ class smf_config { ...@@ -211,6 +216,10 @@ class smf_config {
bool force_push_pco; bool force_push_pco;
uint ue_mtu; uint ue_mtu;
bool register_nrf;
bool discover_upf;
bool use_local_subscription_info;
struct { struct {
struct in_addr ipv4_addr; struct in_addr ipv4_addr;
unsigned int port; unsigned int port;
......
...@@ -160,8 +160,8 @@ bool smf_n1::create_n1_pdu_session_establishment_accept( ...@@ -160,8 +160,8 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
// PDUAddress // PDUAddress
paa_t paa = sm_context_res.get_paa(); paa_t paa = sm_context_res.get_paa();
sm_msg->pdu_session_establishment_accept.pduaddress sm_msg->pdu_session_establishment_accept.pduaddress.pdu_address_information =
.pdu_address_information = bfromcstralloc(4, "\0"); bfromcstralloc(4, "\0");
util::ipv4_to_bstring( util::ipv4_to_bstring(
paa.ipv4_address, sm_msg->pdu_session_establishment_accept.pduaddress paa.ipv4_address, sm_msg->pdu_session_establishment_accept.pduaddress
.pdu_address_information); .pdu_address_information);
...@@ -228,7 +228,8 @@ bool smf_n1::create_n1_pdu_session_establishment_accept( ...@@ -228,7 +228,8 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
.extendedprotocolconfigurationoptions); .extendedprotocolconfigurationoptions);
// DNN // DNN
sm_msg->pdu_session_establishment_accept.dnn = bfromcstralloc(sm_context_res.get_dnn().length(), "\0"); sm_msg->pdu_session_establishment_accept.dnn =
bfromcstralloc(sm_context_res.get_dnn().length(), "\0");
util::string_to_bstring( util::string_to_bstring(
sm_context_res.get_dnn(), sm_msg->pdu_session_establishment_accept.dnn); sm_context_res.get_dnn(), sm_msg->pdu_session_establishment_accept.dnn);
Logger::smf_n1().debug("DNN %s", sm_context_res.get_dnn().c_str()); Logger::smf_n1().debug("DNN %s", sm_context_res.get_dnn().c_str());
......
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