Commit acd67431 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

fix issue for local test

parent 6a4351b4
......@@ -142,8 +142,7 @@ static const std::vector<std::string> session_management_procedures_type_e2str =
"PDU_SESSION_RELEASE_UE_REQUESTED_STEP2",
"PDU_SESSION_RELEASE_UE_REQUESTED_STEP3",
"PDU_SESSION_RELEASE_SMF_INITIATED",
"PDU_SESSION_RELEASE_AMF_INITIATED",
"PDU_SESSION_RELEASE_AN_INITIATED",
"PDU_SESSION_RELEASE_AMF_INITIATED", "PDU_SESSION_RELEASE_AN_INITIATED",
"PDU_SESSION_TEST"
};
......
......@@ -593,8 +593,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//check pdu session id
if ((pdu_session_id == PDU_SESSION_IDENTITY_UNASSIGNED )
|| (pdu_session_id > PDU_SESSION_IDENTITY_LAST )) {
Logger::smf_app().warn("Invalid PDU Session ID value (%d)",
pdu_session_id);
Logger::smf_app().warn("Invalid PDU Session ID value (%d)", pdu_session_id);
//section 7.3.2@3GPP TS 24.501; NAS N1 SM message: ignore the message
return;
}
......@@ -1012,9 +1011,10 @@ bool smf_app::is_scid_2_smf_context(const scid_t &scid) const {
}
//------------------------------------------------------------------------------
bool smf_app::scid_2_smf_context(const scid_t &scid, std::shared_ptr<smf_context_ref> & scf) const {
bool smf_app::scid_2_smf_context(const scid_t &scid,
std::shared_ptr<smf_context_ref> &scf) const {
std::shared_lock lock(m_scid2smf_context);
if ( scid2smf_context.count(scid) > 0 ) {
if (scid2smf_context.count(scid) > 0) {
scf = scid2smf_context.at(scid);
return true;
}
......
......@@ -363,7 +363,8 @@ class smf_app {
* @param [std::shared_ptr<smf_context_ref> &] scf : Shared_ptr to a SMF Context Reference
* @return bool: True if SMF Context Reference found, otherwise return false
*/
bool scid_2_smf_context(const scid_t &scid, std::shared_ptr<smf_context_ref> & scf) const;
bool scid_2_smf_context(const scid_t &scid,
std::shared_ptr<smf_context_ref> &scf) const;
/*
* Handle PDUSession_CreateSMContextRequest from AMF
......
......@@ -95,7 +95,8 @@ int smf_config::load_thread_sched_params(const Setting &thread_sched_params_cfg,
try {
std::string thread_rd_sched_policy;
thread_sched_params_cfg.lookupValue(
SMF_CONFIG_STRING_THREAD_RD_SCHED_POLICY, thread_rd_sched_policy);
SMF_CONFIG_STRING_THREAD_RD_SCHED_POLICY,
thread_rd_sched_policy);
util::trim(thread_rd_sched_policy);
if (boost::iequals(thread_rd_sched_policy, "SCHED_OTHER")) {
cfg.sched_policy = SCHED_OTHER;
......@@ -120,7 +121,8 @@ int smf_config::load_thread_sched_params(const Setting &thread_sched_params_cfg,
try {
thread_sched_params_cfg.lookupValue(
SMF_CONFIG_STRING_THREAD_RD_SCHED_PRIORITY, cfg.sched_priority);
SMF_CONFIG_STRING_THREAD_RD_SCHED_PRIORITY,
cfg.sched_priority);
if ((cfg.sched_priority > 99) || (cfg.sched_priority < 1)) {
Logger::smf_app().error(
"thread_rd_sched_priority: %d, must be in interval [1..99] in config file",
......@@ -330,7 +332,7 @@ int smf_config::load(const string &config_file) {
boost::token_compress_on);
if (ips.size() != 2) {
Logger::smf_app().error("Bad value %s : %s in config file %s",
SMF_CONFIG_STRING_IPV4_ADDRESS_RANGE_DELIMITER,
SMF_CONFIG_STRING_IPV4_ADDRESS_RANGE_DELIMITER,
ipv4_range.c_str(), config_file.c_str());
throw("Bad value %s : %s in config file %s", SMF_CONFIG_STRING_IPV4_ADDRESS_RANGE_DELIMITER, ipv4_range
.c_str(), config_file.c_str());
......@@ -380,8 +382,8 @@ int smf_config::load(const string &config_file) {
boost::token_compress_on);
if (ips6.size() != 2) {
Logger::smf_app().error("Bad value %s : %s in config file %s",
SMF_CONFIG_STRING_PREFIX, ipv6_prefix.c_str(),
config_file.c_str());
SMF_CONFIG_STRING_PREFIX,
ipv6_prefix.c_str(), config_file.c_str());
throw("Bad value %s : %s in config file %s", SMF_CONFIG_STRING_PREFIX, ipv6_prefix
.c_str(), config_file.c_str());
}
......
......@@ -142,28 +142,24 @@ bool smf_n10::get_sm_data(
while (numRetries < UDM_NUMBER_RETRIES) {
res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
Logger::smf_n10().debug("Response from UDM, HTTP Code: %d ",
httpCode);
Logger::smf_n10().debug("Response from UDM, HTTP Code: %d ", httpCode);
if (static_cast<http_response_codes_e>(httpCode)
== http_response_codes_e::HTTP_RESPONSE_CODE_OK) {
Logger::smf_n10().debug(
"Got successful response from UDM, URL: %s ",
url.c_str());
Logger::smf_n10().debug("Got successful response from UDM, URL: %s ",
url.c_str());
//Logger::smf_n10().debug("[get_sm_data] Http Data from UDM: %s ", *httpData.get());
try {
jsonData = nlohmann::json::parse(*httpData.get());
//curl_easy_cleanup(curl);
break;
} catch (json::exception &e) {
Logger::smf_n10().warn(
"Could not parse json data from UDM");
Logger::smf_n10().warn("Could not parse json data from UDM");
}
numRetries++;
} else {
Logger::smf_n10().warn(
"Could not get response from UDM, URL %s, retry ...",
url.c_str());
"Could not get response from UDM, URL %s, retry ...", url.c_str());
//retry
numRetries++;
}
......@@ -173,8 +169,7 @@ bool smf_n10::get_sm_data(
//process the response
if (!jsonData.empty()) {
Logger::smf_n10().debug("Response from UDM %s",
jsonData.dump().c_str());
Logger::smf_n10().debug("Response from UDM %s", jsonData.dump().c_str());
//retrieve SessionManagementSubscription and store in the context
for (nlohmann::json::iterator it = jsonData["dnnConfigurations"].begin();
......@@ -242,9 +237,8 @@ bool smf_n10::get_sm_data(
subscription->insert_dnn_configuration(it.key(), dnn_configuration);
} catch (nlohmann::json::exception &e) {
Logger::smf_n10().warn(
"Exception message %s, exception id %d ", e.what(),
e.id);
Logger::smf_n10().warn("Exception message %s, exception id %d ",
e.what(), e.id);
return false;
}
}
......
......@@ -354,8 +354,6 @@ void smf_n11::send_n1n2_message_transfer_request(
*/
}
//------------------------------------------------------------------------------
void smf_n11::send_n1n2_message_transfer_request(
std::shared_ptr<itti_nx_trigger_pdu_session_modification> sm_context_res) {
......@@ -428,8 +426,7 @@ void smf_n11::send_n1n2_message_transfer_request(
//Set the default Cause
//response_data["cause"] = "504 Gateway Timeout";
}
Logger::smf_n11().debug("Response from AMF, Http Code: %d",
httpCode);
Logger::smf_n11().debug("Response from AMF, Http Code: %d", httpCode);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
......@@ -439,7 +436,6 @@ void smf_n11::send_n1n2_message_transfer_request(
}
//------------------------------------------------------------------------------
void smf_n11::send_pdu_session_update_sm_context_response(
std::shared_ptr<itti_n11_update_sm_context_response> sm_context_res) {
......@@ -590,8 +586,7 @@ void smf_n11::send_pdu_session_update_sm_context_response(
oai::smf_server::model::SmContextUpdateError &smContextUpdateError,
Pistache::Http::Code code) {
Logger::smf_n11().debug(
"Send PDUSession_UpdateSMContext Response to AMF.");
Logger::smf_n11().debug("Send PDUSession_UpdateSMContext Response to AMF.");
nlohmann::json json_data = { };
to_json(json_data, smContextUpdateError);
......@@ -610,8 +605,7 @@ void smf_n11::send_pdu_session_update_sm_context_response(
Pistache::Http::ResponseWriter &httpResponse,
oai::smf_server::model::SmContextUpdateError &smContextUpdateError,
Pistache::Http::Code code, std::string &n1_sm_msg) {
Logger::smf_n11().debug(
"Send PDUSession_UpdateSMContext Response to AMF.");
Logger::smf_n11().debug("Send PDUSession_UpdateSMContext Response to AMF.");
std::string boundary = "----Boundary";
nlohmann::json json_part = { };
......@@ -633,8 +627,7 @@ void smf_n11::send_pdu_session_create_sm_context_response(
Pistache::Http::ResponseWriter &httpResponse,
oai::smf_server::model::SmContextCreateError &smContextCreateError,
Pistache::Http::Code code, std::string &n1_sm_msg) {
Logger::smf_n11().debug(
"Send PDUSession_CreateSMContext Response to AMF.");
Logger::smf_n11().debug("Send PDUSession_CreateSMContext Response to AMF.");
std::string boundary = "----Boundary";
nlohmann::json json_part = { };
......@@ -656,8 +649,7 @@ void smf_n11::send_pdu_session_update_sm_context_response(
Pistache::Http::ResponseWriter &httpResponse,
oai::smf_server::model::SmContextUpdatedData &smContextUpdatedData,
Pistache::Http::Code code) {
Logger::smf_n11().debug(
"Send PDUSession_UpdateSMContext Response to AMF.");
Logger::smf_n11().debug("Send PDUSession_UpdateSMContext Response to AMF.");
nlohmann::json json_data = { };
to_json(json_data, smContextUpdatedData);
if (!json_data.empty()) {
......@@ -675,8 +667,7 @@ void smf_n11::send_pdu_session_create_sm_context_response(
Pistache::Http::ResponseWriter &httpResponse,
oai::smf_server::model::SmContextCreatedData &smContextCreatedData,
Pistache::Http::Code code) {
Logger::smf_n11().debug(
"Send PDUSession_CreateSMContext Response to AMF.");
Logger::smf_n11().debug("Send PDUSession_CreateSMContext Response to AMF.");
nlohmann::json json_data = { };
to_json(json_data, smContextCreatedData);
if (!json_data.empty()) {
......@@ -698,8 +689,7 @@ void smf_n11::send_n1n2_message_transfer_request(
//------------------------------------------------------------------------------
void smf_n11::send_pdu_session_release_sm_context_response(
Pistache::Http::ResponseWriter &httpResponse, Pistache::Http::Code code) {
Logger::smf_n11().debug(
"Send PDUSession_ReleaseSMContext Response to AMF.");
Logger::smf_n11().debug("Send PDUSession_ReleaseSMContext Response to AMF.");
httpResponse.send(code);
}
......@@ -709,8 +699,7 @@ void smf_n11::send_pdu_session_release_sm_context_response(
oai::smf_server::model::ProblemDetails &problem,
Pistache::Http::Code code) {
Logger::smf_n11().debug(
"Send PDUSession_ReleaseSMContext Response to AMF.");
Logger::smf_n11().debug("Send PDUSession_ReleaseSMContext Response to AMF.");
nlohmann::json json_data = { };
to_json(json_data, problem);
if (!json_data.empty()) {
......
......@@ -286,6 +286,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
sm_msg->pdu_session_establishment_accept.dnn->slen);
Logger::smf_app().debug("DNN %s", dnn_str.c_str());
Logger::smf_app().info("Encode PDU Session Establishment Accept");
//Encode NAS message
bytes = nas_message_encode(data, &nas_msg,
sizeof(data)/*don't know the size*/, nullptr);
......
......@@ -186,7 +186,6 @@ class session_update_sm_context_procedure : public smf_procedure {
};
//------------------------------------------------------------------------------
class session_release_sm_context_procedure : public smf_procedure {
public:
......
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