Commit 55d09578 authored by kharade's avatar kharade

custom info field enabled

parent d50abc66
...@@ -12,62 +12,63 @@ ...@@ -12,62 +12,63 @@
*/ */
#include "NFProfile.h" #include "NFProfile.h"
#include <iostream>
namespace oai { namespace oai {
namespace nrf { namespace nrf {
namespace model { namespace model {
NFProfile::NFProfile() { NFProfile::NFProfile() {
m_NfInstanceId = ""; m_NfInstanceId = "";
m_NfInstanceName = ""; m_NfInstanceName = "";
m_NfInstanceNameIsSet = false; m_NfInstanceNameIsSet = false;
m_HeartBeatTimer = 0; m_HeartBeatTimer = 0;
m_HeartBeatTimerIsSet = false; m_HeartBeatTimerIsSet = false;
m_PlmnListIsSet = false; m_PlmnListIsSet = false;
m_SNssaisIsSet = false; m_SNssaisIsSet = false;
m_PerPlmnSnssaiListIsSet = false; m_PerPlmnSnssaiListIsSet = false;
m_NsiListIsSet = false; m_NsiListIsSet = false;
m_Fqdn = ""; m_Fqdn = "";
m_FqdnIsSet = false; m_FqdnIsSet = false;
m_InterPlmnFqdn = ""; m_InterPlmnFqdn = "";
m_InterPlmnFqdnIsSet = false; m_InterPlmnFqdnIsSet = false;
m_Ipv4AddressesIsSet = false; m_Ipv4AddressesIsSet = false;
m_Ipv6AddressesIsSet = false; m_Ipv6AddressesIsSet = false;
m_AllowedPlmnsIsSet = false; m_AllowedPlmnsIsSet = false;
m_AllowedNfTypesIsSet = false; m_AllowedNfTypesIsSet = false;
m_AllowedNfDomainsIsSet = false; m_AllowedNfDomainsIsSet = false;
m_AllowedNssaisIsSet = false; m_AllowedNssaisIsSet = false;
m_Priority = 0; m_Priority = 0;
m_PriorityIsSet = false; m_PriorityIsSet = false;
m_Capacity = 0; m_Capacity = 0;
m_CapacityIsSet = false; m_CapacityIsSet = false;
m_Load = 0; m_Load = 0;
m_LoadIsSet = false; m_LoadIsSet = false;
m_Locality = ""; m_Locality = "";
m_LocalityIsSet = false; m_LocalityIsSet = false;
m_Priority = 0; m_Priority = 0;
m_PriorityIsSet = false; m_PriorityIsSet = false;
m_UdrInfoIsSet = false; m_UdrInfoIsSet = false;
m_UdrInfoExtIsSet = false; m_UdrInfoExtIsSet = false;
m_UdmInfoIsSet = false; m_UdmInfoIsSet = false;
m_UdmInfoExtIsSet = false; m_UdmInfoExtIsSet = false;
m_AusfInfoIsSet = false; m_AusfInfoIsSet = false;
m_AusfInfoExtIsSet = false; m_AusfInfoExtIsSet = false;
m_AmfInfoIsSet = false; m_AmfInfoIsSet = false;
m_AmfInfoExtIsSet = false; m_AmfInfoExtIsSet = false;
m_SmfInfoIsSet = false; m_SmfInfoIsSet = false;
m_SmfInfoExtIsSet = false; m_SmfInfoExtIsSet = false;
m_UpfInfoIsSet = false; m_UpfInfoIsSet = false;
m_UpfInfoExtIsSet = false; m_UpfInfoExtIsSet = false;
m_PcfInfoIsSet = false; m_PcfInfoIsSet = false;
m_PcfInfoExtIsSet = false; m_PcfInfoExtIsSet = false;
m_BsfInfoIsSet = false; m_BsfInfoIsSet = false;
m_BsfInfoExtIsSet = false; m_BsfInfoExtIsSet = false;
m_ChfInfoIsSet = false; m_ChfInfoIsSet = false;
m_ChfInfoExtIsSet = false; m_ChfInfoExtIsSet = false;
m_NrfInfoIsSet = false; m_NrfInfoIsSet = false;
m_NwdafInfoIsSet = false; m_NwdafInfoIsSet = false;
// m_CustomInfoIsSet = false; m_CustomInfoIsSet = false;
m_RecoveryTime = ""; m_RecoveryTime = "";
m_RecoveryTimeIsSet = false; m_RecoveryTimeIsSet = false;
m_NfServicePersistence = false; m_NfServicePersistence = false;
...@@ -146,8 +147,7 @@ void to_json(nlohmann::json& j, const NFProfile& o) { ...@@ -146,8 +147,7 @@ void to_json(nlohmann::json& j, const NFProfile& o) {
j["chfInfoExt"] = o.m_ChfInfoExt; j["chfInfoExt"] = o.m_ChfInfoExt;
if (o.nrfInfoIsSet()) j["nrfInfo"] = o.m_NrfInfo; if (o.nrfInfoIsSet()) j["nrfInfo"] = o.m_NrfInfo;
if (o.nwdafInfoIsSet()) j["nwdafInfo"] = o.m_NwdafInfo; if (o.nwdafInfoIsSet()) j["nwdafInfo"] = o.m_NwdafInfo;
// if(o.customInfoIsSet()) if (o.customInfoIsSet()) j["customInfo"] = o.m_CustomInfo;
// j["customInfo"] = o.m_CustomInfo;
if (o.recoveryTimeIsSet()) j["recoveryTime"] = o.m_RecoveryTime; if (o.recoveryTimeIsSet()) j["recoveryTime"] = o.m_RecoveryTime;
if (o.nfServicePersistenceIsSet()) if (o.nfServicePersistenceIsSet())
j["nfServicePersistence"] = o.m_NfServicePersistence; j["nfServicePersistence"] = o.m_NfServicePersistence;
...@@ -323,11 +323,10 @@ void from_json(const nlohmann::json& j, NFProfile& o) { ...@@ -323,11 +323,10 @@ void from_json(const nlohmann::json& j, NFProfile& o) {
j.at("nwdafInfo").get_to(o.m_NwdafInfo); j.at("nwdafInfo").get_to(o.m_NwdafInfo);
o.m_NwdafInfoIsSet = true; o.m_NwdafInfoIsSet = true;
} }
/*if(j.find("customInfo") != j.end()) if (j.find("customInfo") != j.end()) {
{ j.at("customInfo").get_to(o.m_CustomInfo);
j.at("customInfo").get_to(o.m_CustomInfo); o.m_CustomInfoIsSet = true;
o.m_CustomInfoIsSet = true; }
} */
if (j.find("recoveryTime") != j.end()) { if (j.find("recoveryTime") != j.end()) {
j.at("recoveryTime").get_to(o.m_RecoveryTime); j.at("recoveryTime").get_to(o.m_RecoveryTime);
o.m_RecoveryTimeIsSet = true; o.m_RecoveryTimeIsSet = true;
...@@ -867,26 +866,21 @@ bool NFProfile::nwdafInfoIsSet() const { ...@@ -867,26 +866,21 @@ bool NFProfile::nwdafInfoIsSet() const {
void NFProfile::unsetNwdafInfo() { void NFProfile::unsetNwdafInfo() {
m_NwdafInfoIsSet = false; m_NwdafInfoIsSet = false;
} }
/*Object NFProfile::getCustomInfo() const nlohmann::json NFProfile::getCustomInfo() const {
{ return m_CustomInfo;
return m_CustomInfo; }
}
*/ void NFProfile::setCustomInfo(nlohmann::json const& value) {
/* m_CustomInfo = value;
void NFProfile::setCustomInfo(Object const& value) m_CustomInfoIsSet = true;
{ }
m_CustomInfo = value; bool NFProfile::customInfoIsSet() const {
m_CustomInfoIsSet = true; return m_CustomInfoIsSet;
}*/ }
/* bool NFProfile::customInfoIsSet() const
{ void NFProfile::unsetCustomInfo() {
return m_CustomInfoIsSet; m_CustomInfoIsSet = false;
}*/ }
/*
void NFProfile::unsetCustomInfo()
{
m_CustomInfoIsSet = false;
}*/
std::string NFProfile::getRecoveryTime() const { std::string NFProfile::getRecoveryTime() const {
return m_RecoveryTime; return m_RecoveryTime;
......
...@@ -345,10 +345,10 @@ class NFProfile { ...@@ -345,10 +345,10 @@ class NFProfile {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
// Object getCustomInfo() const; nlohmann::json getCustomInfo() const;
// void setCustomInfo(Object const& value); void setCustomInfo(nlohmann::json const& value);
// bool customInfoIsSet() const; bool customInfoIsSet() const;
// void unsetCustomInfo(); void unsetCustomInfo();
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
...@@ -480,8 +480,8 @@ class NFProfile { ...@@ -480,8 +480,8 @@ class NFProfile {
bool m_NrfInfoIsSet; bool m_NrfInfoIsSet;
NwdafInfo m_NwdafInfo; NwdafInfo m_NwdafInfo;
bool m_NwdafInfoIsSet; bool m_NwdafInfoIsSet;
// Object m_CustomInfo; nlohmann::json m_CustomInfo;
// bool m_CustomInfoIsSet; bool m_CustomInfoIsSet;
std::string m_RecoveryTime; std::string m_RecoveryTime;
bool m_RecoveryTimeIsSet; bool m_RecoveryTimeIsSet;
bool m_NfServicePersistence; bool m_NfServicePersistence;
......
...@@ -65,6 +65,9 @@ bool api_conv::profile_api_to_nrf_profile( ...@@ -65,6 +65,9 @@ bool api_conv::profile_api_to_nrf_profile(
"\tInstance name: %s", profile.get()->get_nf_instance_name().c_str()); "\tInstance name: %s", profile.get()->get_nf_instance_name().c_str());
profile.get()->set_nf_status(api_profile.getNfStatus()); profile.get()->set_nf_status(api_profile.getNfStatus());
profile.get()->set_custom_info(api_profile.getCustomInfo());
Logger::nrf_app().debug(
"getCustomInfo -> %s", api_profile.getCustomInfo().dump().c_str());
Logger::nrf_app().debug( Logger::nrf_app().debug(
"\tStatus: %s", profile.get()->get_nf_status().c_str()); "\tStatus: %s", 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());
......
...@@ -230,6 +230,16 @@ void nrf_profile::get_nf_services(std::vector<nf_service_t>& n) const { ...@@ -230,6 +230,16 @@ void nrf_profile::get_nf_services(std::vector<nf_service_t>& n) const {
n = nf_services; n = nf_services;
} }
//------------------------------------------------------------------------------
void nrf_profile::set_custom_info(const nlohmann::json& c) {
custom_info = c;
}
//------------------------------------------------------------------------------
void nrf_profile::get_custom_info(nlohmann::json& c) const {
c = custom_info;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void nrf_profile::display() { void nrf_profile::display() {
Logger::nrf_app().debug("NF instance info"); Logger::nrf_app().debug("NF instance info");
...@@ -242,6 +252,8 @@ void nrf_profile::display() { ...@@ -242,6 +252,8 @@ void nrf_profile::display() {
Logger::nrf_app().debug("\tPriority: %d", priority); Logger::nrf_app().debug("\tPriority: %d", priority);
Logger::nrf_app().debug("\tCapacity: %d", capacity); Logger::nrf_app().debug("\tCapacity: %d", capacity);
// SNSSAIs // SNSSAIs
if (!custom_info.empty())
Logger::nrf_app().debug("\tCustomInfo: %s", custom_info.dump().c_str());
if (!plmn_list.empty()) { if (!plmn_list.empty()) {
for (auto s : plmn_list) { for (auto s : plmn_list) {
Logger::nrf_app().debug("\tPLMN List(MCC, MNC): %d, %s", s.mcc, s.mnc); Logger::nrf_app().debug("\tPLMN List(MCC, MNC): %d, %s", s.mcc, s.mnc);
...@@ -593,6 +605,8 @@ void nrf_profile::to_json(nlohmann::json& data) const { ...@@ -593,6 +605,8 @@ void nrf_profile::to_json(nlohmann::json& data) const {
// } // }
data["priority"] = priority; data["priority"] = priority;
data["capacity"] = capacity; data["capacity"] = capacity;
// CustomInfo
if (!custom_info.empty()) data["customInfo"] = custom_info;
// NF services // NF services
data["nfServices"] = nlohmann::json::array(); data["nfServices"] = nlohmann::json::array();
for (auto service : nf_services) { for (auto service : nf_services) {
......
...@@ -68,6 +68,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> { ...@@ -68,6 +68,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
nf_instance_name = ""; nf_instance_name = "";
nf_status = ""; nf_status = "";
json_data = {}; json_data = {};
custom_info = {};
first_update = true; first_update = true;
is_updated = false; is_updated = false;
} }
...@@ -365,6 +366,20 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> { ...@@ -365,6 +366,20 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
*/ */
void get_json_data(nlohmann::json& data) const; void get_json_data(nlohmann::json& data) const;
/*
* Set custom info
* @param [const nlohmann::json &] c: custom info to be set
* @return void
*/
void set_custom_info(const nlohmann::json& c);
/*
* Get custom info
* @param [nlohmann::json &] c: Store custom info
* @return void
*/
void get_custom_info(nlohmann::json& c) const;
/* /*
* Set NF instance services * Set NF instance services
* @param [std::vector<nf_service_t> &] n: nf_service * @param [std::vector<nf_service_t> &] n: nf_service
...@@ -507,6 +522,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> { ...@@ -507,6 +522,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
uint16_t capacity; uint16_t capacity;
nlohmann::json json_data; // store extra json data nlohmann::json json_data; // store extra json data
std::vector<nf_service_t> nf_services; std::vector<nf_service_t> nf_services;
nlohmann::json custom_info; // store extra json data
/* /*
std::vector<PlmnId> m_PlmnList; std::vector<PlmnId> m_PlmnList;
......
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