Commit 622905a5 authored by Fang-WANG's avatar Fang-WANG

fix some data format

parent 9d9ce0a5
......@@ -1309,12 +1309,15 @@ bool smf_app::handle_nf_status_notification(
json_data["nfStatus"] = profile.get()->get_nf_status().c_str();
json_data["nfInstanceId"] = profile.get()->get_nf_instance_id().c_str();
json_data["nfType"] = profile.get()->get_nf_type().c_str();
json_data["ipv4Addresses"] = nlohmann::json::array();
//json_data["ipv4Addresses"] = nlohmann::json::array();
std::vector<struct in_addr> nfIpv4Addresses;
profile.get()->get_nf_ipv4_addresses(nfIpv4Addresses);
for (auto address : nfIpv4Addresses) {
/*for (auto address : nfIpv4Addresses) {
json_data["ipv4Addresses"].push_back(inet_ntoa(address));
}
}*/
string ipv4;
ipv4 = conv::toString(nfIpv4Addresses[0]);
json_data["ipv4Addresses"] = ipv4.c_str();
time_t rawtime;
struct tm *info;
char buffer[80];
......@@ -1340,12 +1343,12 @@ bool smf_app::handle_nf_status_notification(
if(nf_status_json_arr[i]["nfType"].dump().compare(json_data["nfType"].dump().c_str())==0)
{
Logger::smf_app().error("the nftype is exist");
nf_status_json_arr[i]["nfInstanceName"]=json_data["nfInstanceName"].dump().c_str();
nf_status_json_arr[i]["nfEvent"]=json_data["nfEvent"].dump().c_str();
nf_status_json_arr[i]["nfStatus"]=json_data["nfStatus"].dump().c_str();
nf_status_json_arr[i]["nfInstanceId"]=json_data["nfInstanceId"].dump().c_str();
nf_status_json_arr[i]["ipv4Addresses"]=json_data["ipv4Addresses"].dump().c_str();
nf_status_json_arr[i]["time"]=json_data["time"].dump().c_str();
nf_status_json_arr[i]["nfInstanceName"]=json_data["nfInstanceName"];
nf_status_json_arr[i]["nfEvent"]=json_data["nfEvent"];
nf_status_json_arr[i]["nfStatus"]=json_data["nfStatus"];
nf_status_json_arr[i]["nfInstanceId"]=json_data["nfInstanceId"];
nf_status_json_arr[i]["ipv4Addresses"]=json_data["ipv4Addresses"];
nf_status_json_arr[i]["time"]=json_data["time"];
}
else
{
......
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