// bool amf_n11::discover_smf(
//     std::string& smf_addr, std::string& smf_api_version, const snssai_t snssai,
//     const plmn_t plmn, const std::string dnn) {
//   Logger::amf_n11().debug(
//       "Send NFDiscovery to NRF to discover the available SMFs");
//   bool result = true;

//   nlohmann::json json_data = {};
//   // TODO: remove hardcoded values
//   std::string url =
//       std::string(inet_ntoa(*((struct in_addr*) &amf_cfg.nrf_addr.ipv4_addr))) +
//       ":" + std::to_string(amf_cfg.nrf_addr.port) + "/nnrf-disc/" +
//       amf_cfg.nrf_addr.api_version +
//       "/nf-instances?target-nf-type=SMF&requester-nf-type=AMF";

//   curl_global_init(CURL_GLOBAL_ALL);
//   CURL* curl = curl = curl_easy_init();

//   if (curl) {
//     CURLcode res               = {};
//     struct curl_slist* headers = nullptr;
//     // headers = curl_slist_append(headers, "charsets: utf-8");
//     headers = curl_slist_append(headers, "content-type: application/json");
//     curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
//     curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
//     curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
//     curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, NRF_CURL_TIMEOUT_MS);

//     // Response information.
//     long httpCode = {0};
//     std::unique_ptr<std::string> httpData(new std::string());
//     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &callback);
//     curl_easy_setopt(curl, CURLOPT_WRITEDATA, httpData.get());
//     // curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, body.length());
//     // curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());

//     res = curl_easy_perform(curl);
//     curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);

//     Logger::amf_n11().debug(
//         "NFDiscovery, response from NRF, HTTP Code: %d", httpCode);

//     if (httpCode == 200) {
//       Logger::amf_n11().debug("NFDiscovery, got successful response from NRF");

//       nlohmann::json response_data = {};
//       try {
//         response_data = nlohmann::json::parse(*httpData.get());
//       } catch (nlohmann::json::exception& e) {
//         Logger::amf_n11().warn(
//             "NFDiscovery, could not parse json from the NRF "
//             "response");
//       }
//       Logger::amf_n11().debug(
//           "NFDiscovery, response from NRF, json data: \n %s",
//           response_data.dump().c_str());

//       // Process data to obtain SMF info
//       if (response_data.find("nfInstances") != response_data.end()) {
//         for (auto& it : response_data["nfInstances"].items()) {
//           nlohmann::json instance_json = it.value();
//           // TODO: convert instance_json to SMF profile
//           // TODO: add SMF to the list of available SMF
//           // TODO: check with sNSSAI and DNN
//           // TODO: PLMN (need to add plmnList into NRF profile, SMF profile)
//           // for now, just IP addr of SMF of the first NF instance
//           if (instance_json.find("ipv4Addresses") != instance_json.end()) {
//             if (instance_json["ipv4Addresses"].size() > 0)
//               smf_addr =
//                   instance_json["ipv4Addresses"].at(0).get<std::string>();
//             // break;
//           }
//           if (instance_json.find("nfServices") != instance_json.end()) {
//             if (instance_json["nfServices"].size() > 0) {
//               nlohmann::json nf_service = instance_json["nfServices"].at(0);
//               if (nf_service.find("versions") != nf_service.end()) {
//                 nlohmann::json nf_version = nf_service["versions"].at(0);
//                 if (nf_version.find("apiVersionInUri") != nf_version.end()) {
//                   smf_api_version =
//                       nf_version["apiVersionInUri"].get<std::string>();
//                 }
//               }
//             }
//             break;
//           }
//         }
//       }
//     } else {
//       Logger::amf_n11().warn("NFDiscovery, could not get response from NRF");
//       result = false;
//     }

//     Logger::amf_n11().debug(
//         "NFDiscovery, SMF Addr: %s, SMF Api Version: %s", smf_addr.c_str(),
//         smf_api_version.c_str());

//     curl_slist_free_all(headers);
//     curl_easy_cleanup(curl);
//   }
//   curl_global_cleanup();
//   return result;
// }