Commit 7e46eca2 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Update AMF info

parent 33ae125f
...@@ -12,7 +12,7 @@ NRF_CONF[@INSTANCE@]=$INSTANCE ...@@ -12,7 +12,7 @@ NRF_CONF[@INSTANCE@]=$INSTANCE
NRF_CONF[@PREFIX@]=$PREFIX NRF_CONF[@PREFIX@]=$PREFIX
NRF_CONF[@PID_DIRECTORY@]='/var/run' NRF_CONF[@PID_DIRECTORY@]='/var/run'
NRF_CONF[@NRF_INTERFACE_NAME_FOR_SBI@]='enx0050b6f4b8f0' NRF_CONF[@NRF_INTERFACE_NAME_FOR_SBI@]='wlo1'
NRF_CONF[@NRF_INTERFACE_PORT_FOR_SBI@]='80' NRF_CONF[@NRF_INTERFACE_PORT_FOR_SBI@]='80'
NRF_CONF[@NRF_INTERFACE_HTTP2_PORT_FOR_SBI@]='9090' NRF_CONF[@NRF_INTERFACE_HTTP2_PORT_FOR_SBI@]='9090'
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#include "NFInstanceIDDocumentApiImpl.h" #include "NFInstanceIDDocumentApiImpl.h"
#include "logger.hpp" #include "logger.hpp"
#include "nrf_app.hpp" #include "nrf_app.hpp"
#include "nrf_config.hpp"
extern oai::nrf::app::nrf_config nrf_cfg;
namespace oai { namespace oai {
namespace nrf { namespace nrf {
......
...@@ -41,7 +41,7 @@ void NFInstancesStoreApiImpl::get_nf_instances( ...@@ -41,7 +41,7 @@ void NFInstancesStoreApiImpl::get_nf_instances(
if (!nfType.isEmpty()) { if (!nfType.isEmpty()) {
nf_type = nfType.get(); nf_type = nfType.get();
Logger::nrf_sbi().debug( Logger::nrf_sbi().debug(
"Retrieve a collection of NF Instances, NF type: %s", ".........................................NF type: %s",
nf_type.c_str()); nf_type.c_str());
} }
...@@ -49,9 +49,8 @@ void NFInstancesStoreApiImpl::get_nf_instances( ...@@ -49,9 +49,8 @@ void NFInstancesStoreApiImpl::get_nf_instances(
if (!limit.isEmpty()) { if (!limit.isEmpty()) {
limit_item = limit.get(); limit_item = limit.get();
Logger::nrf_sbi().debug( Logger::nrf_sbi().debug(
"Retrieve a collection of NF Instances, limit number of items: %d", ".........................................Limit number of items: %d",
limit_item); limit_item);
} }
int http_code = 0; int http_code = 0;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#define FILE_3GPP_23_003_SEEN #define FILE_3GPP_23_003_SEEN
#include <stdint.h> #include <stdint.h>
/*
typedef struct plmn_s { typedef struct plmn_s {
uint8_t mcc_digit2 :4; uint8_t mcc_digit2 :4;
uint8_t mcc_digit1 :4; uint8_t mcc_digit1 :4;
...@@ -38,6 +38,13 @@ typedef struct plmn_s { ...@@ -38,6 +38,13 @@ typedef struct plmn_s {
uint8_t mnc_digit2 :4; uint8_t mnc_digit2 :4;
uint8_t mnc_digit1 :4; uint8_t mnc_digit1 :4;
} plmn_t; } plmn_t;
*/
typedef struct plmn_s {
std::string mcc;
std::string mnc;
} plmn_t;
#define INVALID_TAC_0000 (uint16_t)0x0000 #define INVALID_TAC_0000 (uint16_t)0x0000
#define INVALID_TAC_FFFE (uint16_t)0xFFFE #define INVALID_TAC_FFFE (uint16_t)0xFFFE
......
...@@ -38,13 +38,13 @@ ...@@ -38,13 +38,13 @@
#include "api_conversions.hpp" #include "api_conversions.hpp"
#include "string.hpp" #include "string.hpp"
#include "nrf.h" #include "nrf.h"
//#include "api_conversions.hpp" #include "AmfInfo.h"
#include "logger.hpp" #include "logger.hpp"
using namespace oai::nrf::model; using namespace oai::nrf::model;
using namespace oai::nrf::app; using namespace oai::nrf::app;
using namespace oai::nrf; using namespace oai::nrf;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/* /*
bool api_conv::profile_api_to_amf_profile(const NFProfile &api_profile, bool api_conv::profile_api_to_amf_profile(const NFProfile &api_profile,
...@@ -99,26 +99,30 @@ using namespace oai::nrf; ...@@ -99,26 +99,30 @@ using namespace oai::nrf;
} }
*/ */
//------------------------------------------------------------------------------
bool api_conv::profile_api_to_amf_profile( bool api_conv::profile_api_to_amf_profile(
const NFProfile &api_profile, std::shared_ptr<nrf_profile> &profile) { const NFProfile &api_profile, std::shared_ptr<nrf_profile> &profile) {
Logger::nrf_app().debug( Logger::nrf_app().debug(
"Convert a NF profile generated from OpenAPI to an AMF profile (profile name %s)", "Convert a json-type profile a NF profile (profile ID: %s)",
api_profile.getNfInstanceName().c_str()); api_profile.getNfInstanceId().c_str());
profile.get()->set_nf_instance_id(api_profile.getNfInstanceId());
profile.get()->set_nf_instance_name(api_profile.getNfInstanceName()); profile.get()->set_nf_instance_name(api_profile.getNfInstanceName());
Logger::nrf_app().debug("NF profile, instance name %s", Logger::nrf_app().debug("............Instance name: %s",
profile.get()->get_nf_instance_name().c_str()); profile.get()->get_nf_instance_name().c_str());
profile.get()->set_nf_status(api_profile.getNfStatus()); profile.get()->set_nf_status(api_profile.getNfStatus());
Logger::nrf_app().debug("NF profile, status %s", Logger::nrf_app().debug("............Status: %s",
profile.get()->get_nf_status().c_str()); profile.get()->get_nf_status().c_str());
profile.get()->set_nf_heartBeat_timer(api_profile.getHeartBeatTimer()); profile.get()->set_nf_heartBeat_timer(api_profile.getHeartBeatTimer());
Logger::nrf_app().debug("NF profile, status %d", Logger::nrf_app().debug("............HeartBeart timer: %d",
profile.get()->get_nf_hertBeat_timer()); profile.get()->get_nf_heartBeat_timer());
profile.get()->set_nf_priority(api_profile.getPriority()); profile.get()->set_nf_priority(api_profile.getPriority());
Logger::nrf_app().debug("NF profile, priority %d", Logger::nrf_app().debug("............Priority: %d",
profile.get()->get_nf_priority()); profile.get()->get_nf_priority());
profile.get()->set_nf_capacity(api_profile.getCapacity()); profile.get()->set_nf_capacity(api_profile.getCapacity());
Logger::nrf_app().debug("NF profile, capacity %d", Logger::nrf_app().debug("............Capacity: %d",
profile.get()->get_nf_capacity()); profile.get()->get_nf_capacity());
//SNSSAIs //SNSSAIs
std::vector<Snssai> snssai = api_profile.getSNssais(); std::vector<Snssai> snssai = api_profile.getSNssais();
...@@ -127,7 +131,7 @@ bool api_conv::profile_api_to_amf_profile( ...@@ -127,7 +131,7 @@ bool api_conv::profile_api_to_amf_profile(
sn.sD = s.getSd(); sn.sD = s.getSd();
sn.sST = s.getSst(); sn.sST = s.getSst();
profile.get()->add_snssai(sn); profile.get()->add_snssai(sn);
Logger::nrf_app().debug("NF profile, SNSSAI SD %d, SST %s", sn.sST, Logger::nrf_app().debug("............SNSSAI (SD, SST): %d, %s", sn.sST,
sn.sD.c_str()); sn.sD.c_str());
} }
...@@ -138,22 +142,129 @@ bool api_conv::profile_api_to_amf_profile( ...@@ -138,22 +142,129 @@ bool api_conv::profile_api_to_amf_profile(
if (inet_pton(AF_INET, util::trim(address).c_str(), buf_in_addr) == 1) { if (inet_pton(AF_INET, util::trim(address).c_str(), buf_in_addr) == 1) {
memcpy(&addr4, buf_in_addr, sizeof(struct in_addr)); memcpy(&addr4, buf_in_addr, sizeof(struct in_addr));
} else { } else {
Logger::nrf_app().warn("NF IPv4, address conversion: Bad value %s", Logger::nrf_app().warn("Address conversion: Bad value %s",
util::trim(address).c_str()); util::trim(address).c_str());
} }
Logger::nrf_app().debug("NF profile, IPv4 Addr %s", address.c_str()); Logger::nrf_app().debug("............IPv4 Addr: %s", address.c_str());
profile.get()->add_nf_ipv4_addresses(addr4); profile.get()->add_nf_ipv4_addresses(addr4);
} }
if (api_profile.getNfType().compare("AMF") == 0) { nf_type_t nf_type = string_to_nf_type(api_profile.getNfType());
Logger::nrf_app().debug("AMF profile, AMF Info");
switch (nf_type) {
case NF_TYPE_AMF: {
Logger::nrf_app().debug("............AMF profile, AMF Info");
profile.get()->set_nf_type(NF_TYPE_AMF);
amf_info_t info = { }; amf_info_t info = { };
info.amf_region_id = "AMF_REGION_ID"; AmfInfo amf_info_api = api_profile.getAmfInfo();
info.amf_set_id = "AMF_SET_ID"; info.amf_region_id = amf_info_api.getAmfRegionId();
info.amf_set_id = amf_info_api.getAmfSetId();
Logger::nrf_app().debug("............AMF Set ID: %s, AMF Region ID: %s",
info.amf_set_id.c_str(),
info.amf_region_id.c_str());
for (auto g : amf_info_api.getGuamiList()) {
guami_t guami = { };
guami.amf_id = g.getAmfId();
guami.plmn.mcc = g.getPlmnId().getMcc();
guami.plmn.mnc = g.getPlmnId().getMnc();
info.guami_list.push_back(guami);
Logger::nrf_app().debug("............AMF GUAMI, AMF_ID: %s",
guami.amf_id.c_str());
Logger::nrf_app().debug(
"....................., PLMN (MCC: %s, MNC: %s)",
guami.plmn.mcc.c_str(), guami.plmn.mnc.c_str());
}
(std::static_pointer_cast < amf_profile > (profile)).get()->add_amf_info( (std::static_pointer_cast < amf_profile > (profile)).get()->add_amf_info(
info); info);
} }
break;
case NF_TYPE_SMF: {
}
break;
default: {
}
}
/*
if (api_profile.getNfType().compare("AMF") == 0) {
Logger::nrf_app().debug("............AMF profile, AMF Info");
profile.get()->set_nf_type("AMF");
amf_info_t info = { };
AmfInfo amf_info_api = api_profile.getAmfInfo();
info.amf_region_id = amf_info_api.getAmfRegionId();
info.amf_set_id = amf_info_api.getAmfSetId();
Logger::nrf_app().debug("............AMF Set ID: %s, AMF Region ID: %s",
info.amf_set_id.c_str(),
info.amf_region_id.c_str());
for (auto g : amf_info_api.getGuamiList()) {
guami_t guami = { };
guami.amf_id = g.getAmfId();
guami.plmn.mcc = g.getPlmnId().getMcc();
guami.plmn.mnc = g.getPlmnId().getMnc();
info.guami_list.push_back(guami);
Logger::nrf_app().debug("............AMF GUAMI, AMF_ID: %s",
guami.amf_id.c_str());
Logger::nrf_app().debug("....................., PLMN (MCC: %s, MNC: %s)",
guami.plmn.mcc.c_str(), guami.plmn.mnc.c_str());
}
(std::static_pointer_cast < amf_profile > (profile)).get()->add_amf_info(
info);
}
*/
return true; return true;
} }
//------------------------------------------------------------------------------
nf_type_t api_conv::string_to_nf_type(const std::string &str) {
if (str.compare("NRF") == 0)
return NF_TYPE_NRF;
if (str.compare("AMF") == 0)
return NF_TYPE_AMF;
if (str.compare("SMF") == 0)
return NF_TYPE_SMF;
if (str.compare("AUSF") == 0)
return NF_TYPE_AUSF;
if (str.compare("NEF") == 0)
return NF_TYPE_NEF;
if (str.compare("PCP") == 0)
return NF_TYPE_PCF;
if (str.compare("SMSF") == 0)
return NF_TYPE_SMSF;
if (str.compare("NSSF") == 0)
return NF_TYPE_NSSF;
if (str.compare("UDR") == 0)
return NF_TYPE_UDR;
if (str.compare("LMF") == 0)
return NF_TYPE_LMF;
if (str.compare("GMLC") == 0)
return NF_TYPE_GMLC;
if (str.compare("5G_EIR") == 0)
return NF_TYPE_5G_EIR;
if (str.compare("SEPP") == 0)
return NF_TYPE_SEPP;
if (str.compare("UPF") == 0)
return NF_TYPE_UPF;
if (str.compare("N3IWF") == 0)
return NF_TYPE_N3IWF;
if (str.compare("AF") == 0)
return NF_TYPE_AF;
if (str.compare("UDSF") == 0)
return NF_TYPE_UDSF;
if (str.compare("BSF") == 0)
return NF_TYPE_BSF;
if (str.compare("CHF") == 0)
return NF_TYPE_CHF;
if (str.compare("NWDAF") == 0)
return NF_TYPE_NWDAF;
//default
return NF_TYPE_UNKNOWN;
}
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "NFProfile.h" #include "NFProfile.h"
#include "nrf_profile.hpp" #include "nrf_profile.hpp"
#include "nrf.h"
using namespace oai::nrf::model; using namespace oai::nrf::model;
using namespace oai::nrf::app; using namespace oai::nrf::app;
...@@ -43,10 +44,8 @@ namespace api_conv { ...@@ -43,10 +44,8 @@ namespace api_conv {
bool profile_api_to_amf_profile(const NFProfile &api_profile, bool profile_api_to_amf_profile(const NFProfile &api_profile,
std::shared_ptr<nrf_profile> &profile); std::shared_ptr<nrf_profile> &profile);
//bool profile_api_to_amf_profile(const NFProfile &api_profile, nf_type_t string_to_nf_type(const std::string &str);
// std::shared_ptr<amf_profile> &profile); } // namespace api_conv
}// namespace api_conv
} }
} }
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "nrf_config.hpp" #include "nrf_config.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "api_conversions.hpp" #include "api_conversions.hpp"
#include "3gpp_29.500.h"
using namespace oai::nrf::app; using namespace oai::nrf::app;
using namespace oai::nrf::model; using namespace oai::nrf::model;
...@@ -51,7 +52,7 @@ void nrf_app::handle_register_nf_instance( ...@@ -51,7 +52,7 @@ void nrf_app::handle_register_nf_instance(
const oai::nrf::model::NFProfile &nf_profile, int &http_code, const oai::nrf::model::NFProfile &nf_profile, int &http_code,
const uint8_t http_version) { const uint8_t http_version) {
Logger::nrf_app().info("Handle NF Instance Registration(HTTP version %d)", Logger::nrf_app().info("Handle NF Instance Registration (HTTP version %d)",
http_version); http_version);
//Check if nfInstanceID is a valid UUID (version 4) //Check if nfInstanceID is a valid UUID (version 4)
//TODO //TODO
...@@ -116,21 +117,45 @@ void nrf_app::handle_register_nf_instance( ...@@ -116,21 +117,45 @@ void nrf_app::handle_register_nf_instance(
} }
*/ */
nf_type_t type = api_conv::string_to_nf_type(nf_profile.getNfType());
//Create a new NF profile or Update an existing NF profile //Create a new NF profile or Update an existing NF profile
Logger::nrf_app().debug("NF Profile with (ID %s, NF type %s)", Logger::nrf_app().debug("NF Profile with (ID %s, NF type %s)",
nf_instance_id.c_str(), nf_instance_id.c_str(),
nf_profile.getNfType().c_str()); nf_profile.getNfType().c_str());
std::shared_ptr<nrf_profile> sn = { }; std::shared_ptr<nrf_profile> sn = { };
if (nf_profile.getNfType().compare("AMF") == 0) { switch (type) {
case NF_TYPE_AMF:
sn = std::make_shared<amf_profile>(); sn = std::make_shared<amf_profile>();
break;
case NF_TYPE_SMF:
//TODO
break;
default:
sn = std::make_shared<nrf_profile>();
} }
/*
if (nf_profile.getNfType().compare("AMF") == 0) {
sn = std::make_shared<amf_profile>();
} else if (nf_profile.getNfType().compare("SMF") == 0) {
//TODO:
} else {
//default
sn = std::make_shared<nrf_profile>();
}
*/
//convert to nrf_profile //convert to nrf_profile
if (api_conv::profile_api_to_amf_profile(nf_profile, sn)) { if (api_conv::profile_api_to_amf_profile(nf_profile, sn)) {
add_nf_profile(nf_instance_id, sn); add_nf_profile(nf_instance_id, sn);
http_code = HTTP_STATUS_CODE_201_CREATED; http_code = HTTP_STATUS_CODE_201_CREATED;
Logger::nrf_app().debug("Added NF Profile to the DB");
if (nf_profile.getNfType().compare("AMF") == 0)
std::static_pointer_cast < amf_profile > (sn).get()->display();
} else { } else {
//error //error
Logger::nrf_app().warn( Logger::nrf_app().warn(
...@@ -140,12 +165,12 @@ void nrf_app::handle_register_nf_instance( ...@@ -140,12 +165,12 @@ void nrf_app::handle_register_nf_instance(
} }
//For Debug purpose //For Debug purpose
std::vector < std::shared_ptr < nrf_profile >> profiles = { }; /* std::vector < std::shared_ptr < nrf_profile >> profiles = { };
find_nf_profiles("AMF", profiles); find_nf_profiles("AMF", profiles);
for (auto profile : profiles) { for (auto profile : profiles) {
(std::static_pointer_cast < amf_profile > (profile)).get()->display(); (std::static_pointer_cast < amf_profile > (profile)).get()->display();
} }
*/
} }
...@@ -190,7 +215,11 @@ void nrf_app::handle_get_nf_instances(const std::string &nf_type, ...@@ -190,7 +215,11 @@ void nrf_app::handle_get_nf_instances(const std::string &nf_type,
http_version); http_version);
std::vector < std::shared_ptr < nrf_profile >> profiles = { }; std::vector < std::shared_ptr < nrf_profile >> profiles = { };
find_nf_profiles("AMF", profiles); nf_type_t type = api_conv::string_to_nf_type(nf_type);
find_nf_profiles(type, profiles);
if (profiles.size() == 0) {
Logger::nrf_app().debug("No profile found with type %s", nf_type.c_str());
}
for (auto profile : profiles) { for (auto profile : profiles) {
(std::static_pointer_cast < amf_profile > (profile)).get()->display(); (std::static_pointer_cast < amf_profile > (profile)).get()->display();
} }
...@@ -271,15 +300,16 @@ bool nrf_app::find_nf_profile(const std::string &profile_id, ...@@ -271,15 +300,16 @@ bool nrf_app::find_nf_profile(const std::string &profile_id,
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool nrf_app::find_nf_profiles( void nrf_app::find_nf_profiles(
const std::string &nf_type, const nf_type_t &nf_type,
std::vector<std::shared_ptr<nrf_profile>> &profiles) const { std::vector<std::shared_ptr<nrf_profile>> &profiles) const {
for (auto profile : instance_id2nrf_profile) { for (auto profile : instance_id2nrf_profile) {
nf_type_t type = profile.second.get()->get_nf_type(); //std::string type = profile.second.get()->get_nf_type();
//if (type == NF_TYPE_AMF) if (profile.second.get()->get_nf_type() == nf_type) {
profiles.push_back(profile.second); profiles.push_back(profile.second);
} }
return true; }
//return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -93,8 +93,8 @@ class nrf_app { ...@@ -93,8 +93,8 @@ class nrf_app {
bool find_nf_profile(const std::string &profile_id, bool find_nf_profile(const std::string &profile_id,
std::shared_ptr<nrf_profile> &p) const; std::shared_ptr<nrf_profile> &p) const;
bool find_nf_profiles( void find_nf_profiles(
const std::string &nf_type, const nf_type_t &nf_type,
std::vector<std::shared_ptr<nrf_profile>> &profiles) const; std::vector<std::shared_ptr<nrf_profile>> &profiles) const;
bool is_profile_exist(const std::string &profile_id) const; bool is_profile_exist(const std::string &profile_id) const;
......
...@@ -58,6 +58,11 @@ std::string nrf_profile::get_nf_instance_name() const { ...@@ -58,6 +58,11 @@ std::string nrf_profile::get_nf_instance_name() const {
return nf_instance_name; return nf_instance_name;
} }
//------------------------------------------------------------------------------
void nrf_profile::set_nf_type(const nf_type_t &type) {
nf_type = type;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
nf_type_t nrf_profile::get_nf_type() const { nf_type_t nrf_profile::get_nf_type() const {
return nf_type; return nf_type;
...@@ -83,12 +88,12 @@ void nrf_profile::set_nf_heartBeat_timer(const int32_t &timer) { ...@@ -83,12 +88,12 @@ void nrf_profile::set_nf_heartBeat_timer(const int32_t &timer) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void nrf_profile::get_nf_hertBeat_timer(int32_t &timer) const { void nrf_profile::get_nf_heartBeat_timer(int32_t &timer) const {
timer = heartBeat_timer; timer = heartBeat_timer;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int32_t nrf_profile::get_nf_hertBeat_timer() const { int32_t nrf_profile::get_nf_heartBeat_timer() const {
return heartBeat_timer; return heartBeat_timer;
} }
...@@ -153,24 +158,26 @@ void nrf_profile::get_nf_ipv4_addresses(std::vector<struct in_addr> &a) const { ...@@ -153,24 +158,26 @@ void nrf_profile::get_nf_ipv4_addresses(std::vector<struct in_addr> &a) const {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void nrf_profile::display() { void nrf_profile::display() {
Logger::nrf_app().debug("NF profile, instance ID %s", nf_instance_id.c_str()); Logger::nrf_app().debug("............Instance ID: %s",
nf_instance_id.c_str());
Logger::nrf_app().debug("NF profile, instance name %s", Logger::nrf_app().debug("............Instance name: %s",
nf_instance_name.c_str()); nf_instance_name.c_str());
Logger::nrf_app().debug("NF profile, instance type %s", Logger::nrf_app().debug("............Instance type: %s",
nf_type_e2str[nf_type].c_str()); nf_type_e2str[nf_type].c_str());
Logger::nrf_app().debug("NF profile, status %s", nf_status.c_str()); Logger::nrf_app().debug("............Status: %s", nf_status.c_str());
Logger::nrf_app().debug("NF profile, status %d", heartBeat_timer); Logger::nrf_app().debug("............HeartBeat timer: %d", heartBeat_timer);
Logger::nrf_app().debug("NF profile, priority %d", priority); Logger::nrf_app().debug("............Priority: %d", priority);
Logger::nrf_app().debug("NF profile, capacity %d", capacity); Logger::nrf_app().debug("............Capacity: %d", capacity);
//SNSSAIs //SNSSAIs
for (auto s : snssais) { for (auto s : snssais) {
Logger::nrf_app().debug("NF profile, SNSSAI %d, %s", s.sST, s.sD.c_str()); Logger::nrf_app().debug("............NNSSAI(SST, SD): %d, %s", s.sST,
s.sD.c_str());
} }
//IPv4 Addresses //IPv4 Addresses
for (auto address : ipv4_addresses) { for (auto address : ipv4_addresses) {
Logger::nrf_app().debug("NF profile, IPv4 Addr %s", inet_ntoa(address)); Logger::nrf_app().debug("............IPv4 Addr: %s", inet_ntoa(address));
} }
} }
...@@ -188,8 +195,16 @@ void amf_profile::get_amf_info(amf_info_t &infos) const { ...@@ -188,8 +195,16 @@ void amf_profile::get_amf_info(amf_info_t &infos) const {
void amf_profile::display() { void amf_profile::display() {
nrf_profile::display(); nrf_profile::display();
Logger::nrf_app().debug("AMF Info: AMF Set ID %s, AMF Region ID %s",
Logger::nrf_app().debug("............AMF Set ID: %s, AMF Region ID: %s",
amf_info.amf_set_id.c_str(), amf_info.amf_set_id.c_str(),
amf_info.amf_region_id.c_str()); amf_info.amf_region_id.c_str());
for (auto g : amf_info.guami_list) {
Logger::nrf_app().debug("............AMF GUAMI, AMF_ID: %s",
g.amf_id.c_str());
Logger::nrf_app().debug("....................., PLMN (MCC: %s, MNC: %s)",
g.plmn.mcc.c_str(), g.plmn.mnc.c_str());
}
} }
...@@ -50,15 +50,24 @@ using namespace std; ...@@ -50,15 +50,24 @@ using namespace std;
class nrf_profile : public std::enable_shared_from_this<nrf_profile> { class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
public: public:
nrf_profile() = delete; nrf_profile()
nrf_profile(const nf_type_t type)
: :
nf_type(NF_TYPE_UNKNOWN),
heartBeat_timer(0),
snssais(),
ipv4_addresses(),
priority(0),
capacity(0) {
nf_instance_name = "";
nf_status = "";
}
nrf_profile(const nf_type_t type)
:nf_type(type),
heartBeat_timer(0), heartBeat_timer(0),
snssais(), snssais(),
ipv4_addresses(), ipv4_addresses(),
priority(0), priority(0),
capacity(0) { capacity(0) {
nf_type = type;
nf_instance_name = ""; nf_instance_name = "";
nf_status = ""; nf_status = "";
} }
...@@ -70,10 +79,10 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> { ...@@ -70,10 +79,10 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
snssais(), snssais(),
ipv4_addresses(), ipv4_addresses(),
priority(0), priority(0),
capacity(0) { capacity(0),
nf_type(NF_TYPE_UNKNOWN){
nf_instance_name = ""; nf_instance_name = "";
nf_status = ""; nf_status = "";
nf_type = NF_TYPE_UNKNOWN;
} }
nrf_profile(nrf_profile &b) = delete; nrf_profile(nrf_profile &b) = delete;
...@@ -136,10 +145,17 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> { ...@@ -136,10 +145,17 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
/* /*
* Get NF type * Get NF type
* @param * @param
* @return [nf_type_t] nf type * @return [std::string] nf type
*/ */
nf_type_t get_nf_type() const; nf_type_t get_nf_type() const;
/*
* Set NF type
* @param [const nf_type_t &] type: nf type
* @return void
*/
void set_nf_type(const nf_type_t &type);
/* /*
* Set NF instance heartBeat_timer * Set NF instance heartBeat_timer
* @param [const std::string &] timer: heartBeat_timer * @param [const std::string &] timer: heartBeat_timer
...@@ -152,14 +168,14 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> { ...@@ -152,14 +168,14 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
* @param [std::string &] timer: store heartBeat_timer * @param [std::string &] timer: store heartBeat_timer
* @return void: * @return void:
*/ */
void get_nf_hertBeat_timer(int32_t &timer) const; void get_nf_heartBeat_timer(int32_t &timer) const;
/* /*
* Get NF heartBeat_timer * Get NF heartBeat_timer
* @param void * @param void
* @return heartBeat_timer * @return heartBeat_timer
*/ */
int32_t get_nf_hertBeat_timer() const; int32_t get_nf_heartBeat_timer() const;
/* /*
* Set NF instance priority * Set NF instance priority
......
...@@ -57,7 +57,7 @@ void my_app_signal_handler(int s) { ...@@ -57,7 +57,7 @@ void my_app_signal_handler(int s) {
delete nrf_app_inst; delete nrf_app_inst;
nrf_app_inst = nullptr; nrf_app_inst = nullptr;
std::cout << "NRF APP memory done." << std::endl; std::cout << "NRF APP memory done." << std::endl;
std::cout << "Freeing Allocated memory done" << std::endl; std::cout << "Freeing allocated memory done" << std::endl;
exit(0); exit(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