Commit 598b67f4 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix issue for NF registration to work with NRF

parent 13b8ab42
...@@ -404,13 +404,9 @@ void amf_app::generate_amf_profile() { ...@@ -404,13 +404,9 @@ void amf_app::generate_amf_profile() {
nf_service.nf_service_status = "REGISTERED"; nf_service.nf_service_status = "REGISTERED";
// IP Endpoint // IP Endpoint
ip_endpoint_t endpoint = {}; ip_endpoint_t endpoint = {};
std::vector<struct in_addr> addrs; endpoint.ipv4_address = amf_cfg.n11.addr4;
nf_instance_profile.get_nf_ipv4_addresses(addrs); endpoint.transport = "TCP";
for (auto a : addrs) { endpoint.port = amf_cfg.n11.port;
endpoint.ipv4_addresses.push_back(a);
}
endpoint.transport = "TCP";
endpoint.port = amf_cfg.n11.port;
nf_service.ip_endpoints.push_back(endpoint); nf_service.ip_endpoints.push_back(endpoint);
nf_instance_profile.add_nf_service(nf_service); nf_instance_profile.add_nf_service(nf_service);
......
...@@ -371,11 +371,9 @@ void amf_profile::to_json(nlohmann::json& data) const { ...@@ -371,11 +371,9 @@ void amf_profile::to_json(nlohmann::json& data) const {
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"] = nlohmann::json::array();
for (auto address : endpoint.ipv4_addresses) { ep_tmp["ipv4Address"] = inet_ntoa(endpoint.ipv4_address);
ep_tmp["ipv4Address"].push_back(inet_ntoa(address)); ep_tmp["transport"] = endpoint.transport;
} ep_tmp["port"] = endpoint.port;
ep_tmp["transport"] = endpoint.transport;
ep_tmp["port"] = endpoint.port;
srv_tmp["ipEndPoints"].push_back(ep_tmp); srv_tmp["ipEndPoints"].push_back(ep_tmp);
} }
......
...@@ -276,16 +276,14 @@ typedef struct nf_service_version_s { ...@@ -276,16 +276,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 in_addr ipv4_address;
// std::vector<struct in6_addr> ipv6_addresses; // struct in6_addr ipv6_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: ");
......
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