Commit 2cb98406 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix issue for NFSubscribeNotify

parent 09c7657e
...@@ -193,7 +193,7 @@ typedef struct qos_profile_s { ...@@ -193,7 +193,7 @@ typedef struct qos_profile_s {
// NRF // NRF
#define NNRF_NFM_BASE "/nnrf-nfm/" #define NNRF_NFM_BASE "/nnrf-nfm/"
#define NNRF_NF_REGISTER_URL "/nf-instances/" #define NNRF_NF_REGISTER_URL "/nf-instances/"
#define NNRF_NF_STATUS_SUBSCRIBE_URL "/subscriptions/" #define NNRF_NF_STATUS_SUBSCRIBE_URL "/subscriptions"
#define NRF_CURL_TIMEOUT_MS 100L #define NRF_CURL_TIMEOUT_MS 100L
// for CURL // for CURL
......
...@@ -344,6 +344,10 @@ smf_app::smf_app(const std::string& config_file) ...@@ -344,6 +344,10 @@ smf_app::smf_app(const std::string& config_file)
// Register to NRF // Register to NRF
register_to_nrf(); register_to_nrf();
// Trigger NFStatusNotify
unsigned int microsecond = 10000; // 10ms
usleep(microsecond);
trigger_upf_status_notification_subscribe();
Logger::smf_app().startup("Started"); Logger::smf_app().startup("Started");
} }
...@@ -1950,6 +1954,7 @@ void smf_app::trigger_upf_status_notification_subscribe() { ...@@ -1950,6 +1954,7 @@ void smf_app::trigger_upf_status_notification_subscribe() {
TASK_SMF_APP, TASK_SMF_N11); TASK_SMF_APP, TASK_SMF_N11);
nlohmann::json json_data = {}; nlohmann::json json_data = {};
//TODO: remove hardcoded values
json_data["nfStatusNotificationUri"] = json_data["nfStatusNotificationUri"] =
std::string(inet_ntoa(*((struct in_addr*) &smf_cfg.sbi.addr4))) + std::string(inet_ntoa(*((struct in_addr*) &smf_cfg.sbi.addr4))) +
":" + std::to_string(smf_cfg.sbi.port) + "/nsmf_nfstatus_notify/" + ":" + std::to_string(smf_cfg.sbi.port) + "/nsmf_nfstatus_notify/" +
......
...@@ -921,11 +921,11 @@ void smf_n11::subscribe_upf_status_notify( ...@@ -921,11 +921,11 @@ void smf_n11::subscribe_upf_status_notify(
msg->http_version); msg->http_version);
Logger::smf_n11().debug( Logger::smf_n11().debug(
"Send NF De-register to NRF (NRF URL %s)", msg->url.c_str()); "Send NFStatusNotify to NRF, NRF URL %s)", msg->url.c_str());
std::string body = msg->json_data.dump(); std::string body = msg->json_data.dump();
Logger::smf_n11().debug( Logger::smf_n11().debug(
"Send NF Instance Registration to NRF, msg body: \n %s", body.c_str()); "Send NFStatusNotify to NRF, msg body: %s", body.c_str());
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);
CURL* curl = curl = curl_easy_init(); CURL* curl = curl = curl_easy_init();
...@@ -938,7 +938,6 @@ void smf_n11::subscribe_upf_status_notify( ...@@ -938,7 +938,6 @@ void smf_n11::subscribe_upf_status_notify(
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, msg->url.c_str()); curl_easy_setopt(curl, CURLOPT_URL, msg->url.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1); curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, NRF_CURL_TIMEOUT_MS); curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, NRF_CURL_TIMEOUT_MS);
if (msg->http_version == 2) { if (msg->http_version == 2) {
......
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