Commit 973a4557 authored by Stefan Spettel's avatar Stefan Spettel

Added configuration options for PCF

Signed-off-by: default avatarStefan Spettel <stefan.spettel@eurecom.fr>
parent 610acd8e
...@@ -77,9 +77,11 @@ SMF = ...@@ -77,9 +77,11 @@ SMF =
# STRING, {"yes", "no"}, # STRING, {"yes", "no"},
REGISTER_NRF = "@REGISTER_NRF@"; # Set to yes if SMF resgisters to an NRF REGISTER_NRF = "@REGISTER_NRF@"; # Set to yes if SMF resgisters to an NRF
DISCOVER_UPF = "@DISCOVER_UPF@"; # Set to yes to enable UPF discovery and selection DISCOVER_UPF = "@DISCOVER_UPF@"; # Set to yes to enable UPF discovery and selection
DISCOVER_PCF = "@DISCOVER_PCF@"; # Set to yes to enable PCF discovery and selection
FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS = "no"; # Non standard feature, normally should be set to "no", FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS = "no"; # 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 # but you may need to set to yes for UE that do not explicitly request a PDN address through NAS signalling
USE_LOCAL_SUBSCRIPTION_INFO = "@USE_LOCAL_SUBSCRIPTION_INFO@"; # Set to yes if SMF uses local subscription information instead of from an UDM USE_LOCAL_SUBSCRIPTION_INFO = "@USE_LOCAL_SUBSCRIPTION_INFO@"; # Set to yes if SMF uses local subscription information instead of from an UDM
USE_LOCAL_PCC_RULES = "@USE_LOCAL_PCC_RULES@"; # Set to yes if SMF uses local PCC rules instead of from an PCF
USE_FQDN_DNS = "@USE_FQDN_DNS@"; # Set to yes if AMF/UDM/NRF/UPF will relying on a DNS to resolve FQDN USE_FQDN_DNS = "@USE_FQDN_DNS@"; # Set to yes if AMF/UDM/NRF/UPF will relying on a DNS to resolve FQDN
HTTP_VERSION = @HTTP_VERSION@; # Default: 1 HTTP_VERSION = @HTTP_VERSION@; # Default: 1
USE_NETWORK_INSTANCE = "@USE_NETWORK_INSTANCE@" # Set yes if network instance is to be used for given UPF USE_NETWORK_INSTANCE = "@USE_NETWORK_INSTANCE@" # Set yes if network instance is to be used for given UPF
...@@ -110,6 +112,14 @@ SMF = ...@@ -110,6 +112,14 @@ SMF =
FQDN = "@NRF_FQDN@" # YOUR NRF FQDN CONFIG HERE FQDN = "@NRF_FQDN@" # YOUR NRF FQDN CONFIG HERE
}; };
PCF :
{
IPV4_ADDRESS = "@PCF_IPV4_ADDRESS@"; # YOUR PCF CONFIG HERE
PORT = @NPCF_PORT@; # YOUR PCF CONFIG HERE (default: 80)
API_VERSION = "@PCF_API_VERSION@"; # YOUR PCF API VERSION FOR SBI CONFIG HERE
FQDN = "@PCF_FQDN@" # YOUR PCF FQDN CONFIG HERE
};
UPF_LIST = ( UPF_LIST = (
{IPV4_ADDRESS = "@UPF_IPV4_ADDRESS@" ; FQDN = "@UPF_FQDN_0@"; NWI_LIST = ({DOMAIN_ACCESS = "@DOMAIN_ACCESS@", DOMAIN_CORE = "@DOMAIN_CORE@"})} # YOUR UPF CONFIG HERE {IPV4_ADDRESS = "@UPF_IPV4_ADDRESS@" ; FQDN = "@UPF_FQDN_0@"; NWI_LIST = ({DOMAIN_ACCESS = "@DOMAIN_ACCESS@", DOMAIN_CORE = "@DOMAIN_CORE@"})} # YOUR UPF CONFIG HERE
); # NWI_LIST IS OPTIONAL PARAMETER ); # NWI_LIST IS OPTIONAL PARAMETER
......
...@@ -516,6 +516,23 @@ int smf_config::load(const string& config_file) { ...@@ -516,6 +516,23 @@ int smf_config::load(const string& config_file) {
discover_upf = false; discover_upf = false;
} }
support_features.lookupValue(
SMF_CONFIG_STRING_SUPPORT_FEATURES_DISCOVER_PCF, opt);
if (boost::iequals(opt, "yes")) {
discover_pcf = true;
} else {
discover_pcf = false;
}
support_features.lookupValue(
SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_LOCAL_PCC_RULES, opt);
if (boost::iequals(opt, "yes")) {
use_local_pcc_rules = true;
discover_pcf = false;
} else {
use_local_pcc_rules = false;
}
support_features.lookupValue( support_features.lookupValue(
SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_LOCAL_SUBSCRIPTION_INFO, opt); SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_LOCAL_SUBSCRIPTION_INFO, opt);
if (boost::iequals(opt, "yes")) { if (boost::iequals(opt, "yes")) {
...@@ -659,6 +676,52 @@ int smf_config::load(const string& config_file) { ...@@ -659,6 +676,52 @@ int smf_config::load(const string& config_file) {
} }
} }
if (!use_local_pcc_rules) {
if (!discover_pcf) {
const Setting& pcf_cfg = smf_cfg[SMF_CONFIG_STRING_PCF];
struct in_addr pcf_ipv4_addr = {};
unsigned int pcf_port = {0};
std::string pcf_api_version = {};
if (!use_fqdn_dns) {
pcf_cfg.lookupValue(SMF_CONFIG_STRING_PCF_IPV4_ADDRESS, astring);
IPV4_STR_ADDR_TO_INADDR(
util::trim(astring).c_str(), pcf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR UDM !");
pcf_addr.ipv4_addr = pcf_ipv4_addr;
if (!(pcf_cfg.lookupValue(SMF_CONFIG_STRING_PCF_PORT, pcf_port))) {
Logger::smf_app().error(SMF_CONFIG_STRING_PCF_PORT "failed");
throw(SMF_CONFIG_STRING_PCF_PORT "failed");
}
pcf_addr.port = pcf_port;
if (!(pcf_cfg.lookupValue(
SMF_CONFIG_STRING_API_VERSION, pcf_api_version))) {
Logger::smf_app().error(SMF_CONFIG_STRING_API_VERSION "failed");
throw(SMF_CONFIG_STRING_API_VERSION "failed");
}
pcf_addr.api_version = pcf_api_version;
} else {
pcf_cfg.lookupValue(SMF_CONFIG_STRING_FQDN_DNS, astring);
uint8_t addr_type = {0};
std::string address = {};
fqdn::resolve(astring, address, pcf_port, addr_type);
if (addr_type != 0) { // IPv6
// TODO:
throw("DO NOT SUPPORT IPV6 ADDR FOR UDM!");
} else { // IPv4
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), pcf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR UDM !");
pcf_addr.ipv4_addr = pcf_ipv4_addr;
pcf_addr.port = pcf_port;
pcf_addr.api_version = "v1"; // TODO: to get API version from DNS
}
}
}
}
// UPF list // UPF list
if (!discover_upf) { if (!discover_upf) {
unsigned char buf_in_addr[sizeof(struct in_addr) + 1]; unsigned char buf_in_addr[sizeof(struct in_addr) + 1];
...@@ -740,7 +803,7 @@ int smf_config::load(const string& config_file) { ...@@ -740,7 +803,7 @@ int smf_config::load(const string& config_file) {
} }
// NRF // NRF
if (discover_upf or register_nrf) { if (discover_upf or register_nrf or discover_pcf) {
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};
...@@ -931,40 +994,21 @@ void smf_config::display() { ...@@ -931,40 +994,21 @@ void smf_config::display() {
*/ */
Logger::smf_app().info("- AMF:"); Logger::smf_app().info("- AMF:");
Logger::smf_app().info( amf_addr.log_infos(use_fqdn_dns);
" IPv4 Addr ...........: %s",
inet_ntoa(*((struct in_addr*) &amf_addr.ipv4_addr)));
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) { if (!use_local_subscription_info) {
Logger::smf_app().info("- UDM:"); Logger::smf_app().info("- UDM:");
Logger::smf_app().info( udm_addr.log_infos(use_fqdn_dns);
" IPv4 Addr ...........: %s",
inet_ntoa(*((struct in_addr*) &udm_addr.ipv4_addr)));
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 or discover_upf) { if (register_nrf or discover_upf or discover_pcf) {
Logger::smf_app().info("- NRF:"); Logger::smf_app().info("- NRF:");
Logger::smf_app().info( nrf_addr.log_infos(use_fqdn_dns);
" IPv4 Addr ...........: %s", }
inet_ntoa(*((struct in_addr*) &nrf_addr.ipv4_addr)));
Logger::smf_app().info(" Port ................: %lu ", nrf_addr.port); if (!use_local_pcc_rules && !discover_pcf) {
Logger::smf_app().info( Logger::smf_app().info("- PCF:");
" API version .........: %s", nrf_addr.api_version.c_str()); pcf_addr.log_infos(use_fqdn_dns);
if (use_fqdn_dns)
Logger::smf_app().info(
" FQDN ................: %s", nrf_addr.fqdn.c_str());
} }
if (!discover_upf) { if (!discover_upf) {
...@@ -1008,9 +1052,16 @@ void smf_config::display() { ...@@ -1008,9 +1052,16 @@ void smf_config::display() {
Logger::smf_app().info( Logger::smf_app().info(
" Discover UPF........................: %s", " Discover UPF........................: %s",
discover_upf ? "Yes" : "No"); discover_upf ? "Yes" : "No");
Logger::smf_app().info(
" Discover PCF........................: %s",
discover_pcf ? "Yes" : "No");
Logger::smf_app().info( Logger::smf_app().info(
" Use Local Subscription Configuration: %s", " Use Local Subscription Configuration: %s",
use_local_subscription_info ? "Yes" : "No"); use_local_subscription_info ? "Yes" : "No");
Logger::smf_app().info(
" Use Local PCC Rules: ...............: %s",
use_local_pcc_rules ? "Yes" : "No");
Logger::smf_app().info( Logger::smf_app().info(
" Push PCO (DNS+MTU)..................: %s", " Push PCO (DNS+MTU)..................: %s",
force_push_pco ? "Yes" : "No"); force_push_pco ? "Yes" : "No");
......
...@@ -109,6 +109,10 @@ ...@@ -109,6 +109,10 @@
#define SMF_CONFIG_STRING_UDM_IPV4_ADDRESS "IPV4_ADDRESS" #define SMF_CONFIG_STRING_UDM_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_UDM_PORT "PORT" #define SMF_CONFIG_STRING_UDM_PORT "PORT"
#define SMF_CONFIG_STRING_PCF "PCF"
#define SMF_CONFIG_STRING_PCF_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_PCF_PORT "PORT"
#define SMF_CONFIG_STRING_UPF_LIST "UPF_LIST" #define SMF_CONFIG_STRING_UPF_LIST "UPF_LIST"
#define SMF_CONFIG_STRING_UPF_IPV4_ADDRESS "IPV4_ADDRESS" #define SMF_CONFIG_STRING_UPF_IPV4_ADDRESS "IPV4_ADDRESS"
...@@ -144,6 +148,9 @@ ...@@ -144,6 +148,9 @@
#define SMF_CONFIG_STRING_SUPPORT_FEATURES "SUPPORT_FEATURES" #define SMF_CONFIG_STRING_SUPPORT_FEATURES "SUPPORT_FEATURES"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES_REGISTER_NRF "REGISTER_NRF" #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_DISCOVER_UPF "DISCOVER_UPF"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES_DISCOVER_PCF "DISCOVER_PCF"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_LOCAL_PCC_RULES \
"USE_LOCAL_PCC_RULES"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_LOCAL_SUBSCRIPTION_INFO \ #define SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_LOCAL_SUBSCRIPTION_INFO \
"USE_LOCAL_SUBSCRIPTION_INFO" "USE_LOCAL_SUBSCRIPTION_INFO"
#define SMF_CONFIG_STRING_NAS_FORCE_PUSH_PCO \ #define SMF_CONFIG_STRING_NAS_FORCE_PUSH_PCO \
...@@ -233,35 +240,39 @@ class smf_config { ...@@ -233,35 +240,39 @@ class smf_config {
bool register_nrf; bool register_nrf;
bool discover_upf; bool discover_upf;
bool discover_pcf;
bool use_local_subscription_info; bool use_local_subscription_info;
bool use_local_pcc_rules;
bool use_fqdn_dns; bool use_fqdn_dns;
unsigned int http_version; unsigned int http_version;
bool use_nwi; bool use_nwi;
bool enable_ur; bool enable_ur;
struct {
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; std::vector<pfcp::node_id_t> upfs;
struct { struct sbi_addr {
struct in_addr ipv4_addr; struct in_addr ipv4_addr;
unsigned int port; unsigned int port;
unsigned int http_version; unsigned int http_version;
std::string api_version; std::string api_version;
std::string fqdn; std::string fqdn;
} nrf_addr;
void log_infos(bool _use_fqdn_dns) {
Logger::smf_app().info(
" IPv4 Addr ...........: %s",
inet_ntoa(*((struct in_addr*) &ipv4_addr)));
Logger::smf_app().info(" Port ................: %lu ", port);
Logger::smf_app().info(
" API version .........: %s", api_version.c_str());
if (_use_fqdn_dns)
Logger::smf_app().info(" FQDN ................: %s", fqdn.c_str());
}
};
sbi_addr nrf_addr;
sbi_addr pcf_addr;
sbi_addr udm_addr;
sbi_addr amf_addr;
// Network instance // Network instance
// bool network_instance_configuration; // bool network_instance_configuration;
...@@ -314,13 +325,20 @@ class smf_config { ...@@ -314,13 +325,20 @@ class smf_config {
nrf_addr.api_version = "v1"; nrf_addr.api_version = "v1";
nrf_addr.fqdn = {}; nrf_addr.fqdn = {};
pcf_addr.ipv4_addr.s_addr = INADDR_ANY;
nrf_addr.port = 80;
nrf_addr.api_version = "v1";
nrf_addr.fqdn = {};
sbi_http2_port = 8080; sbi_http2_port = 8080;
sbi_api_version = "v1"; sbi_api_version = "v1";
http_version = 1; http_version = 1;
use_local_subscription_info = false; use_local_subscription_info = false;
use_local_pcc_rules = false;
register_nrf = false; register_nrf = false;
discover_upf = false; discover_upf = false;
discover_pcf = false;
use_fqdn_dns = false; use_fqdn_dns = false;
use_nwi = false; use_nwi = false;
}; };
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file smf_n7.cpp
\author Stefan Spettel
\company Openairinterface Software Alliance
\date 2021
\email: stefan.spettel@gmx.at
*/
#include "smf_n7.hpp"
#include "smf_config.hpp"
using namespace smf;
using namespace smf::n7;
using namespace oai::smf_server::model;
extern smf_config smf_cfg;
bool smf_n7::discover_pcf(
std::string& addr, std::string& port, std::string& api_version,
const Snssai snssai, const PlmnId, const std::string) {
// if (smf_cfg.)
}
bool smf_n7::discover_pcf_with_nrf(
std::string& addr, std::string& port, std::string& api_version,
const Snssai snssai, const PlmnId, const std::string) {}
bool smf_n7::discover_pcf_from_config_file(
std::string& addr, std::string& port, std::string& api_version,
const Snssai snssai, const PlmnId, const std::string) {}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file smf_n7.hpp
\author Stefan Spettel
\company Openairinterface Software Alliance
\date 2021
\email: stefan.spettel@gmx.at
*/
#ifndef FILE_SMF_N7_HPP_SEEN
#define FILE_SMF_N7_HPP_SEEN
#include <string>
#include "Snssai.h"
#include "PlmnId.h"
namespace smf::n7 {
class smf_n7 {
public:
explicit smf_n7();
virtual ~smf_n7();
bool discover_pcf(
std::string& addr, std::string& port, std::string& api_version,
const oai::smf_server::model::Snssai snssai,
const oai::smf_server::model::PlmnId, const std::string);
private:
bool discover_pcf_with_nrf(
std::string& addr, std::string& port, std::string& api_version,
const oai::smf_server::model::Snssai snssai,
const oai::smf_server::model::PlmnId, const std::string);
bool discover_pcf_from_config_file(
std::string& addr, std::string& port, std::string& api_version,
const oai::smf_server::model::Snssai snssai,
const oai::smf_server::model::PlmnId, const std::string);
};
} // namespace smf::n7
#endif /* FILE_SMF_N4_HPP_SEEN */
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