Commit 300b3355 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Code cleanup

parent 4c95e448
......@@ -786,84 +786,6 @@ void amf_n11::handle_post_sm_context_response_error(
}
}
//-----------------------------------------------------------------------------------------------------
bool amf_n11::discover_smf_from_nsi_info(
std::string& smf_addr, std::string& smf_api_version, std::string& smf_port,
const snssai_t snssai, const plmn_t plmn, const std::string dnn) {
Logger::amf_n11().debug(
"Send NS Selection to NSSF to discover the appropriate NRF");
bool result = true;
std::string nrf_addr = {};
std::string nrf_port = {};
std::string nrf_api_version = {};
uint8_t http_version = 1;
if (amf_cfg.support_features.use_http2) http_version = 2;
// Get NSI information from NSSF
nlohmann::json slice_info = {};
nlohmann::json snssai_info = {};
snssai_info["sst"] = snssai.sST;
if (!snssai.sD.empty()) snssai_info["sd"] = snssai.sD;
slice_info["sNssai"] = snssai_info;
slice_info["roamingIndication"] = "NON_ROAMING";
// ToDo Add TAI
std::string url = amf_cfg.get_nssf_network_slice_selection_information_uri();
std::string parameters = {};
parameters = "?nf-type=AMF&nf-id=" + amf_app_inst->get_nf_instance() +
"&slice-info-request-for-pdu-session=" + slice_info.dump();
url += parameters;
Logger::amf_n11().debug(
"Send Network Slice Information Retrieval during PDU session "
"establishment procedure, URL %s",
url.c_str());
nlohmann::json response_data = {};
uint32_t response_code = 0;
curl_http_client(url, "GET", "", response_data, response_code);
Logger::amf_n11().debug(
"NFDiscovery, response from NRF, json data: \n %s",
response_data.dump().c_str());
std::string nrf_uri = {};
if (response_code != 200) {
Logger::amf_n11().warn("NS Selection, could not get response from NSSF");
result = false;
} else {
Logger::amf_n11().debug("NS Selection, got successful response from NSSF");
Logger::amf_n11().debug(
"NS Selection, response from NSSF, json data: \n %s",
response_data.dump().c_str());
// Process data to obtain NRF info
if (response_data.find("nsiInformation") != response_data.end()) {
if (response_data["nsiInformation"].count("nrfId") > 0)
nrf_uri = response_data["nsiInformation"]["nrfId"].get<std::string>();
std::string nsi_id = {};
if (response_data["nsiInformation"].count("nsi_id") > 0)
nsi_id = response_data["nsiInformation"]["nsiId"].get<std::string>();
}
}
Logger::amf_n11().debug("NS Selection, NRF's URI: %s", nrf_uri.c_str());
if (!result) return result;
Logger::amf_n11().debug(
"NSI Information is successfully retrieved from NSSF");
if (!discover_smf(
smf_addr, smf_port, smf_api_version, snssai, plmn, dnn, nrf_uri)) {
return false;
}
return true;
}
//-----------------------------------------------------------------------------------------------------
bool amf_n11::discover_smf(
std::string& smf_addr, std::string& smf_port, std::string& smf_api_version,
......
......@@ -92,11 +92,6 @@ class amf_n11 {
std::string& n2sm_msg, uint8_t http_version, uint32_t& response_code,
uint32_t promise_id = 0);
bool discover_smf_from_nsi_info(
std::string& smf_addr, std::string& smf_api_version,
std::string& smf_port, const snssai_t snssai, const plmn_t plmn,
const std::string dnn);
bool discover_smf(
std::string& smf_addr, std::string& smf_port,
std::string& smf_api_version, const snssai_t snssai, const plmn_t plmn,
......
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