Commit 6a4351b4 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Update UE-requested Service Request/Code cleanup

parent dd228492
......@@ -184,7 +184,7 @@ void IndividualSMContextApi::update_sm_context_handler(
free_wrapper((void**) &data);
uint8_t size = g_parts.size();
Logger::smf_api_server().debug("Number of g_parts %d", g_parts.size());
Logger::smf_api_server().debug("Number of MIME parts %d", g_parts.size());
part p0 = { };
part p1 = { };
......
......@@ -189,7 +189,9 @@ static const std::vector<std::string> multipart_related_content_part_e2str = {
//for CURL
#define AMF_CURL_TIMEOUT_MS 100L
#define AMF_NUMBER_RETRIES 3
#define UDM_CURL_TIMEOUT_MS 100L
#define UDM_NUMBER_RETRIES 3
//for N1N2
#define BUF_LEN 512
#endif
......@@ -494,12 +494,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
return;
}
Logger::smf_app().debug(
"NAS information: Extended Protocol Discriminator %d, Security Header Type %d, Message Type %d",
decoded_nas_msg.header.extended_protocol_discriminator,
decoded_nas_msg.header.security_header_type,
decoded_nas_msg.plain.sm.header.message_type);
//Extended protocol discriminator (Mandatory)
smreq->req.set_epd(decoded_nas_msg.header.extended_protocol_discriminator);
//PDUSessionIdentity
......@@ -517,7 +511,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
== PDU_SESSION_ESTABLISHMENT_REQUEST) {
//TODO: Disable this command temporarily since can't get this info from tester
Logger::smf_app().debug(
"NAS, pdu_session_type %d",
"PDU Session Type %d",
decoded_nas_msg.plain.sm.pdu_session_establishment_request
._pdusessiontype.pdu_session_type_value);
pdu_session_type.pdu_session_type = decoded_nas_msg.plain.sm
......@@ -565,7 +559,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
uint8_t message_type = decoded_nas_msg.plain.sm.header.message_type;
std::string request_type = smreq->req.get_request_type();
Logger::smf_app().info(
"Handle a PDU Session Create SM Context Request message from AMF, supi " SUPI_64_FMT ", dnn %s, snssai_sst %d, snssai_sd %s",
"Handle a PDU Session Create SM Context Request message from AMF, SUPI " SUPI_64_FMT ", DNN %s, SNSSAI SST %d, SD %s",
supi64, dnn.c_str(), snssai.sST, snssai.sD.c_str());
//If no DNN information from UE, set to default value
......@@ -577,7 +571,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//check pti
if ((pti.procedure_transaction_id == PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED )
|| (pti.procedure_transaction_id > PROCEDURE_TRANSACTION_IDENTITY_LAST )) {
Logger::smf_app().warn(" Invalid PTI value (pti = %d)",
Logger::smf_app().warn("Invalid PTI value (pti = %d)",
pti.procedure_transaction_id);
problem_details.setCause(
pdu_session_application_error_e2str[PDU_SESSION_APPLICATION_ERROR_N1_SM_ERROR]);
......@@ -599,7 +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)",
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;
......@@ -630,7 +624,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//check request type
if (request_type.compare("INITIAL_REQUEST") != 0) {
Logger::smf_app().warn("Invalid request type (request type = %s)",
"INITIAL_REQUEST");
request_type.c_str());
//TODO:
//return
}
......@@ -703,7 +697,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
std::shared_ptr<session_management_subscription> subscription =
std::shared_ptr<session_management_subscription>(s);
if (smf_n10_inst->get_sm_data(supi64, dnn, snssai, subscription)) {
Logger::smf_app().debug("Update DNN subscription info");
//update dnn_context with subscription info
sc.get()->insert_dnn_subscription(snssai, subscription);
} else {
......@@ -782,7 +775,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
scf = scid_2_smf_context(scid);
} else {
Logger::smf_app().warn(
"Context associated with this id " SCID_FMT " does not exit!", scid);
"SM Context associated with this id " SCID_FMT " does not exit!", scid);
problem_details.setCause(
pdu_session_application_error_e2str[PDU_SESSION_APPLICATION_ERROR_CONTEXT_NOT_FOUND]);
smContextUpdateError.setError(problem_details);
......
......@@ -741,15 +741,15 @@ smf_config::~smf_config() {
//------------------------------------------------------------------------------
bool smf_config::is_dotted_dnn_handled(
const std::string &dnn, const pdu_session_type_t &pdn_session_type) {
Logger::smf_app().debug("requested dnn: %s", dnn.c_str());
Logger::smf_app().debug("Requested DNN: %s", dnn.c_str());
for (int i = 0; i < smf_cfg.num_apn; i++) {
Logger::smf_app().debug("apn_label: %s, apn: %s",
Logger::smf_app().debug("DNN label: %s, dnn: %s",
smf_cfg.apn[i].apn_label.c_str(),
smf_cfg.apn[i].apn.c_str());
//if (0 == dnn.compare(smf_cfg.apn[i].apn_label)) {
if (0 == dnn.compare(smf_cfg.apn[i].apn)) {
Logger::smf_app().debug("DNN matched!");
Logger::smf_app().debug("pdu session type %d, pdn_type %d",
Logger::smf_app().debug("PDU Session Type %d, PDN Type %d",
pdn_session_type.pdu_session_type,
smf_cfg.apn[i].pdn_type.pdn_type);
if (pdn_session_type.pdu_session_type
......
This diff is collapsed.
......@@ -200,6 +200,13 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
*/
void set_default_qos_flow(const pfcp::qfi_t &qfi);
/*
* Get the default QoS flow of this PDU Session
* @param [smf_qos_flow &] flow: Default QoS flow
* @return bool: Return true if the default QoS flow exist
*/
bool get_default_qos_flow(smf_qos_flow &flow);
/*
* Find a QoS flow by its PDR ID
* @param [const pfcp::pdr_id_t &] pdr_id: PDR ID
......
......@@ -457,11 +457,11 @@ void pdu_session_update_sm_context_response::add_qos_flow_context_updated(
std::pair<uint8_t, qos_flow_context_updated>((uint8_t) flow.qfi.qfi,
flow));
Logger::smf_app().trace(
"pdu_session_update_sm_context_response::add_qos_flow_context(%d) success",
"A QoS Flow Context (QFI %d) has been added successfully",
flow.qfi.qfi);
} else {
Logger::smf_app().error(
"pdu_session_update_sm_context_response::add_qos_flow_context(%d) failed, invalid QFI",
"Failed to add a QoS Flow Context (QFI %d), invalid QFI",
flow.qfi.qfi);
}
}
......
......@@ -423,9 +423,7 @@ class pdu_session_release_sm_context_request : public pdu_session_msg {
}
;
private:
};
class pdu_session_release_sm_context_response : public pdu_session_msg {
......
......@@ -119,7 +119,7 @@ bool smf_n10::get_sm_data(
inet_ntoa(*((struct in_addr*) &smf_cfg.udm_addr.ipv4_addr))) + ":"
+ std::to_string(smf_cfg.udm_addr.port)
+ fmt::format(NUDM_SDM_GET_SM_DATA_URL, std::to_string(supi));
Logger::smf_n10().debug("[get_sm_data] UDM's URL: %s ", url.c_str());
Logger::smf_n10().debug("UDM's URL: %s ", url.c_str());
if (curl) {
CURLcode res = { };
......@@ -142,13 +142,13 @@ 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("[get_sm_data] Response from UDM, Http Code: %d ",
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(
"[get_sm_data] Got successful response from UDM, URL: %s ",
"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 {
......@@ -157,12 +157,12 @@ bool smf_n10::get_sm_data(
break;
} catch (json::exception &e) {
Logger::smf_n10().warn(
"[get_sm_data] Couldn't Parse json data from UDM");
"Could not parse json data from UDM");
}
numRetries++;
} else {
Logger::smf_n10().warn(
"[get_sm_data] Couldn't GET response from UDM, URL %s, retry ...",
"Could not get response from UDM, URL %s, retry ...",
url.c_str());
//retry
numRetries++;
......@@ -173,13 +173,13 @@ bool smf_n10::get_sm_data(
//process the response
if (!jsonData.empty()) {
Logger::smf_n10().debug("[get_sm_data] GET response from UDM %s",
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();
it != jsonData["dnnConfigurations"].end(); ++it) {
Logger::smf_n10().debug("[get_sm_data] DNN %s", it.key().c_str());
Logger::smf_n10().debug("DNN %s", it.key().c_str());
try {
std::shared_ptr<dnn_configuration_t> dnn_configuration =
std::make_shared<dnn_configuration_t>();
......@@ -188,7 +188,7 @@ bool smf_n10::get_sm_data(
pdu_session_type_e::PDU_SESSION_TYPE_E_IPV4);
std::string default_session_type =
it.value()["pduSessionTypes"]["defaultSessionType"];
Logger::smf_n10().debug("[get_sm_data] default_session_type %s",
Logger::smf_n10().debug("Default session type %s",
default_session_type.c_str());
if (default_session_type.compare("IPV4") == 0) {
pdu_session_type.pdu_session_type =
......@@ -206,7 +206,7 @@ bool smf_n10::get_sm_data(
//Ssc_Mode
ssc_mode_t ssc_mode(ssc_mode_e::SSC_MODE_1);
std::string default_ssc_mode = it.value()["sscModes"]["defaultSscMode"];
Logger::smf_n10().debug("[get_sm_data] defaultSscMode %s",
Logger::smf_n10().debug("Default SSC Mode %s",
default_ssc_mode.c_str());
if (default_ssc_mode.compare("SSC_MODE_1") == 0) {
dnn_configuration->ssc_modes.default_ssc_mode = ssc_mode_t(
......@@ -236,15 +236,14 @@ bool smf_n10::get_sm_data(
dnn_configuration->session_ambr.downlink =
it.value()["sessionAmbr"]["downlink"];
Logger::smf_n10().debug(
"[get_sm_data] sessionAmbr uplink %s, downlink %s",
"Session AMBR Uplink %s, Downlink %s",
dnn_configuration->session_ambr.uplink.c_str(),
dnn_configuration->session_ambr.downlink.c_str());
//sdc = std::shared_ptr<dnn_configuration_t> (dnn_configuration);
subscription->insert_dnn_configuration(it.key(), dnn_configuration);
} catch (nlohmann::json::exception &e) {
Logger::smf_n10().warn(
"[get_sm_data] exception message %s, exception id %d ", e.what(),
"Exception message %s, exception id %d ", e.what(),
e.id);
return false;
}
......
......@@ -443,7 +443,7 @@ 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) {
Logger::smf_n11().debug("Send PDUSessionUpdateContextResponse to AMF ");
Logger::smf_n11().debug("Send PDUSession_UpdateSMContext Response to AMF.");
switch (sm_context_res->session_procedure_type) {
......@@ -591,7 +591,7 @@ void smf_n11::send_pdu_session_update_sm_context_response(
Pistache::Http::Code code) {
Logger::smf_n11().debug(
"[SMF N11] Send PDUSessionUpdateContextResponse to AMF!");
"Send PDUSession_UpdateSMContext Response to AMF.");
nlohmann::json json_data = { };
to_json(json_data, smContextUpdateError);
......@@ -611,7 +611,7 @@ void smf_n11::send_pdu_session_update_sm_context_response(
oai::smf_server::model::SmContextUpdateError &smContextUpdateError,
Pistache::Http::Code code, std::string &n1_sm_msg) {
Logger::smf_n11().debug(
"[SMF N11] Send PDUSessionUpdateContextResponse to AMF!");
"Send PDUSession_UpdateSMContext Response to AMF.");
std::string boundary = "----Boundary";
nlohmann::json json_part = { };
......@@ -634,7 +634,7 @@ void smf_n11::send_pdu_session_create_sm_context_response(
oai::smf_server::model::SmContextCreateError &smContextCreateError,
Pistache::Http::Code code, std::string &n1_sm_msg) {
Logger::smf_n11().debug(
"[SMF N11] Send PDUSessionCreateContextResponse to AMF!");
"Send PDUSession_CreateSMContext Response to AMF.");
std::string boundary = "----Boundary";
nlohmann::json json_part = { };
......@@ -657,7 +657,7 @@ void smf_n11::send_pdu_session_update_sm_context_response(
oai::smf_server::model::SmContextUpdatedData &smContextUpdatedData,
Pistache::Http::Code code) {
Logger::smf_n11().debug(
"[SMF N11] Send PDUSessionUpdateContextResponse to AMF!");
"Send PDUSession_UpdateSMContext Response to AMF.");
nlohmann::json json_data = { };
to_json(json_data, smContextUpdatedData);
if (!json_data.empty()) {
......@@ -676,7 +676,7 @@ void smf_n11::send_pdu_session_create_sm_context_response(
oai::smf_server::model::SmContextCreatedData &smContextCreatedData,
Pistache::Http::Code code) {
Logger::smf_n11().debug(
"[SMF N11] Send PDUSessionUpdateContextResponse to AMF!");
"Send PDUSession_CreateSMContext Response to AMF.");
nlohmann::json json_data = { };
to_json(json_data, smContextCreatedData);
if (!json_data.empty()) {
......@@ -699,7 +699,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(
"[SMF N11] Send PDUSessionReleaseContextResponse to AMF!");
"Send PDUSession_ReleaseSMContext Response to AMF.");
httpResponse.send(code);
}
......@@ -710,7 +710,7 @@ void smf_n11::send_pdu_session_release_sm_context_response(
Pistache::Http::Code code) {
Logger::smf_n11().debug(
"[SMF N11] Send PDUSessionReleaseContextResponse to AMF!");
"Send PDUSession_ReleaseSMContext Response to AMF.");
nlohmann::json json_data = { };
to_json(json_data, problem);
if (!json_data.empty()) {
......
This diff is collapsed.
This diff is collapsed.
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