Commit 263d78eb authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Bug fix for IP Endpoint to work with NRF

parent e19fee94
...@@ -80,9 +80,6 @@ SMF = ...@@ -80,9 +80,6 @@ SMF =
DEFAULT_DNS_IPV6_ADDRESS = "2001:4860:4860::8888"; # YOUR DNS CONFIG HERE DEFAULT_DNS_IPV6_ADDRESS = "2001:4860:4860::8888"; # YOUR DNS CONFIG HERE
DEFAULT_DNS_SEC_IPV6_ADDRESS = "2001:4860:4860::8844"; # YOUR DNS CONFIG HERE DEFAULT_DNS_SEC_IPV6_ADDRESS = "2001:4860:4860::8844"; # YOUR DNS CONFIG HERE
# 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"}.
SUPPORT_FEATURES: SUPPORT_FEATURES:
{ {
# STRING, {"yes", "no"}, # STRING, {"yes", "no"},
......
...@@ -248,16 +248,14 @@ typedef struct nf_service_version_s { ...@@ -248,16 +248,14 @@ typedef struct nf_service_version_s {
} nf_service_version_t; } nf_service_version_t;
typedef struct ip_endpoint_s { typedef struct ip_endpoint_s {
std::vector<struct in_addr> ipv4_addresses; //struct in6_addr ipv6_address;
// std::vector<struct in6_addr> ipv6_addresses; struct in_addr ipv4_address;
std::string transport; // TCP std::string transport; // TCP
unsigned int port; unsigned int port;
std::string to_string() const { std::string to_string() const {
std::string s = {}; std::string s = {};
s.append("Ipv4 Addresses: "); s.append("Ipv4 Address: ");
for (auto ipv4 : ipv4_addresses) { s.append(inet_ntoa(ipv4_address));
s.append(inet_ntoa(ipv4));
}
s.append(", TransportProtocol: "); s.append(", TransportProtocol: ");
s.append(transport); s.append(transport);
s.append(", Port: "); s.append(", Port: ");
......
...@@ -343,11 +343,12 @@ smf_app::smf_app(const std::string& config_file) ...@@ -343,11 +343,12 @@ smf_app::smf_app(const std::string& config_file)
start_upf_association(*it); start_upf_association(*it);
} }
// Register to NRF // Register to NRF (if this option is enabled)
if (smf_cfg.register_nrf) register_to_nrf(); if (smf_cfg.register_nrf) register_to_nrf();
if (smf_cfg.discover_upf) { if (smf_cfg.discover_upf) {
// Trigger NFStatusNotify // Trigger NFStatusNotify subscription to be noticed when a new UPF becomes
// available (if this option is enabled)
unsigned int microsecond = 10000; // 10ms unsigned int microsecond = 10000; // 10ms
usleep(microsecond); usleep(microsecond);
trigger_upf_status_notification_subscribe(); trigger_upf_status_notification_subscribe();
...@@ -1863,9 +1864,7 @@ void smf_app::generate_smf_profile() { ...@@ -1863,9 +1864,7 @@ void smf_app::generate_smf_profile() {
ip_endpoint_t endpoint = {}; ip_endpoint_t endpoint = {};
std::vector<struct in_addr> addrs; std::vector<struct in_addr> addrs;
nf_instance_profile.get_nf_ipv4_addresses(addrs); nf_instance_profile.get_nf_ipv4_addresses(addrs);
for (auto a : addrs) { endpoint.ipv4_address = addrs[0]; //TODO: use first IP ADDR for now
endpoint.ipv4_addresses.push_back(a);
}
endpoint.transport = "TCP"; endpoint.transport = "TCP";
endpoint.port = smf_cfg.sbi.port; endpoint.port = smf_cfg.sbi.port;
nf_service.ip_endpoints.push_back(endpoint); nf_service.ip_endpoints.push_back(endpoint);
...@@ -1912,9 +1911,9 @@ void smf_app::generate_smf_profile() { ...@@ -1912,9 +1911,9 @@ void smf_app::generate_smf_profile() {
//--------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------
void smf_app::register_to_nrf() { void smf_app::register_to_nrf() {
// create a NF profile to this instance // Create a NF profile to this instance
generate_smf_profile(); generate_smf_profile();
// send request to N11 to send NF registration to NRF // Send request to N11 to send NF registration to NRF
trigger_nf_registration_request(); trigger_nf_registration_request();
} }
......
...@@ -371,10 +371,7 @@ void smf_profile::to_json(nlohmann::json& data) const { ...@@ -371,10 +371,7 @@ void smf_profile::to_json(nlohmann::json& data) const {
srv_tmp["ipEndPoints"] = nlohmann::json::array(); srv_tmp["ipEndPoints"] = nlohmann::json::array();
for (auto endpoint : service.ip_endpoints) { for (auto endpoint : service.ip_endpoints) {
nlohmann::json ep_tmp = {}; nlohmann::json ep_tmp = {};
ep_tmp["ipv4Address"] = nlohmann::json::array(); ep_tmp["ipv4Address"] = inet_ntoa(endpoint.ipv4_address);
for (auto address : endpoint.ipv4_addresses) {
ep_tmp["ipv4Address"].push_back(inet_ntoa(address));
}
ep_tmp["transport"] = endpoint.transport; ep_tmp["transport"] = endpoint.transport;
ep_tmp["port"] = endpoint.port; ep_tmp["port"] = endpoint.port;
srv_tmp["ipEndPoints"].push_back(ep_tmp); srv_tmp["ipEndPoints"].push_back(ep_tmp);
......
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