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

fix issue for local test

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