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

Fix issue for NAS cause

parent 247613de
...@@ -252,7 +252,8 @@ enum class cause_value_5gsm_e { ...@@ -252,7 +252,8 @@ enum class cause_value_5gsm_e {
CAUSE_99_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED = 99, CAUSE_99_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED = 99,
CAUSE_100_CONDITIONAL_IE_ERROR = 100, CAUSE_100_CONDITIONAL_IE_ERROR = 100,
CAUSE_101_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101, CAUSE_101_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101,
CAUSE_111_PROTOCOL_ERROR_UNSPECIFIED = 111 CAUSE_111_PROTOCOL_ERROR_UNSPECIFIED = 111,
CAUSE_255_REQUEST_ACCEPTED = 255
}; };
// The 5GSM sublayer states for PDU session handling in the network // The 5GSM sublayer states for PDU session handling in the network
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "SmContextUpdateData.h" #include "SmContextUpdateData.h"
#include "SmContextReleaseData.h" #include "SmContextReleaseData.h"
#include "3gpp_29.500.h" #include "3gpp_29.500.h"
#include "3gpp_24.501.h"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void xgpp_conv::paa_to_pfcp_ue_ip_address( void xgpp_conv::paa_to_pfcp_ue_ip_address(
...@@ -464,7 +465,8 @@ void xgpp_conv::create_sm_context_response_from_ct_request( ...@@ -464,7 +465,8 @@ void xgpp_conv::create_sm_context_response_from_ct_request(
ctx_response->res.set_http_code(http_status_code_e::HTTP_STATUS_CODE_200_OK); ctx_response->res.set_http_code(http_status_code_e::HTTP_STATUS_CODE_200_OK);
ctx_response->res.set_supi(ctx_request->req.get_supi()); ctx_response->res.set_supi(ctx_request->req.get_supi());
ctx_response->res.set_supi_prefix(ctx_request->req.get_supi_prefix()); ctx_response->res.set_supi_prefix(ctx_request->req.get_supi_prefix());
ctx_response->res.set_cause(REQUEST_ACCEPTED); ctx_response->res.set_cause(
static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED));
ctx_response->res.set_pdu_session_id(ctx_request->req.get_pdu_session_id()); ctx_response->res.set_pdu_session_id(ctx_request->req.get_pdu_session_id());
ctx_response->res.set_snssai(ctx_request->req.get_snssai()); ctx_response->res.set_snssai(ctx_request->req.get_snssai());
ctx_response->res.set_dnn(ctx_request->req.get_dnn()); ctx_response->res.set_dnn(ctx_request->req.get_dnn());
...@@ -478,18 +480,13 @@ void xgpp_conv::create_sm_context_response_from_ct_request( ...@@ -478,18 +480,13 @@ void xgpp_conv::create_sm_context_response_from_ct_request(
void xgpp_conv::update_sm_context_response_from_ct_request( void xgpp_conv::update_sm_context_response_from_ct_request(
const std::shared_ptr<itti_n11_update_sm_context_request>& ct_request, const std::shared_ptr<itti_n11_update_sm_context_request>& ct_request,
std::shared_ptr<itti_n11_update_sm_context_response>& ct_response) { std::shared_ptr<itti_n11_update_sm_context_response>& ct_response) {
ct_response->res.set_http_code( ct_response->res.set_http_code(
http_status_code_e::HTTP_STATUS_CODE_200_OK); // default status code http_status_code_e::HTTP_STATUS_CODE_200_OK); // default status code
ct_response->res.set_supi(ct_request->req.get_supi()); ct_response->res.set_supi(ct_request->req.get_supi());
ct_response->res.set_supi_prefix( ct_response->res.set_supi_prefix(ct_request->req.get_supi_prefix());
ct_request->req.get_supi_prefix()); ct_response->res.set_cause(
ct_response->res.set_cause(REQUEST_ACCEPTED); static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED));
ct_response->res.set_pdu_session_id( ct_response->res.set_pdu_session_id(ct_request->req.get_pdu_session_id());
ct_request->req.get_pdu_session_id());
ct_response->res.set_snssai(ct_request->req.get_snssai()); ct_response->res.set_snssai(ct_request->req.get_snssai());
ct_response->res.set_dnn(ct_request->req.get_dnn()); ct_response->res.set_dnn(ct_request->req.get_dnn());
} }
...@@ -1342,8 +1342,11 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1342,8 +1342,11 @@ void smf_context::handle_pdu_session_create_sm_context_request(
if (success) { if (success) {
set_paa = true; set_paa = true;
} else { } else {
// TODO: // ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED;
// cause: ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED; //check for 5G? set_paa = false;
request_accepted = false;
sm_context_resp->res.set_cause(static_cast<uint8_t>(
cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES));
} }
// Static IP address allocation // Static IP address allocation
} else if ((paa_res) && (paa.is_ip_assigned())) { } else if ((paa_res) && (paa.is_ip_assigned())) {
...@@ -1389,6 +1392,7 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1389,6 +1392,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
http_status_code_e::HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR, http_status_code_e::HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR,
smreq->pid, N11_SESSION_CREATE_SM_CONTEXT_RESPONSE); smreq->pid, N11_SESSION_CREATE_SM_CONTEXT_RESPONSE);
} }
// sm_context_resp->res.set_cause(static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_28_UNKNOWN_PDU_SESSION_TYPE));
request_accepted = false; request_accepted = false;
} }
} }
...@@ -1434,7 +1438,8 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1434,7 +1438,8 @@ void smf_context::handle_pdu_session_create_sm_context_request(
std::string smf_context_uri = std::string smf_context_uri =
smreq->req.get_api_root() + "/" + smContextRef.c_str(); smreq->req.get_api_root() + "/" + smContextRef.c_str();
sm_context_response.set_smf_context_uri(smf_context_uri); sm_context_response.set_smf_context_uri(smf_context_uri);
sm_context_response.set_cause(0); // TODO sm_context_response.set_cause(static_cast<uint8_t>(
cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED)); // TODO
nlohmann::json json_data = {}; nlohmann::json json_data = {};
json_data["cause"] = 0; json_data["cause"] = 0;
...@@ -1479,7 +1484,8 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1479,7 +1484,8 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// Step 10. if error when establishing the pdu session, // Step 10. if error when establishing the pdu session,
// send ITTI message to APP to trigger N1N2MessageTransfer towards AMFs (PDU // send ITTI message to APP to trigger N1N2MessageTransfer towards AMFs (PDU
// Session Establishment Reject) // Session Establishment Reject)
if (sm_context_resp->res.get_cause() != REQUEST_ACCEPTED) { if (sm_context_resp->res.get_cause() !=
static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED)) {
// clear pco, ambr // clear pco, ambr
// TODO: // TODO:
// free paa // free paa
...@@ -1506,12 +1512,9 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1506,12 +1512,9 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// Create PDU Session Establishment Reject and embedded in // Create PDU Session Establishment Reject and embedded in
// Namf_Communication_N1N2MessageTransfer Request // Namf_Communication_N1N2MessageTransfer Request
Logger::smf_app().debug("Create PDU Session Establishment Reject"); Logger::smf_app().debug("Create PDU Session Establishment Reject");
// TODO: Should check Cause for other cases cause_value_5gsm_e cause_n1 =
cause_value_5gsm_e cause_n1 = { static_cast<cause_value_5gsm_e>(sm_context_resp->res.get_cause());
cause_value_5gsm_e::CAUSE_38_NETWORK_FAILURE};
if (sm_context_resp->res.get_cause() == NO_RESOURCES_AVAILABLE) {
cause_n1 = cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES;
}
smf_n1::get_instance().create_n1_pdu_session_establishment_reject( smf_n1::get_instance().create_n1_pdu_session_establishment_reject(
sm_context_resp_pending->res, n1_sm_message, cause_n1); sm_context_resp_pending->res, n1_sm_message, cause_n1);
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_msg_hex); smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_msg_hex);
...@@ -1995,7 +1998,6 @@ bool smf_context::handle_pdu_session_resource_setup_response_transfer( ...@@ -1995,7 +1998,6 @@ bool smf_context::handle_pdu_session_resource_setup_response_transfer(
.array[i]) .array[i])
->qosFlowIdentifier); ->qosFlowIdentifier);
} }
return true; return true;
} }
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
...@@ -2156,7 +2158,8 @@ bool smf_context::handle_service_request( ...@@ -2156,7 +2158,8 @@ bool smf_context::handle_service_request(
sm_context_request.get()->req.add_qfi(i.qfi.qfi); sm_context_request.get()->req.add_qfi(i.qfi.qfi);
qos_flow_context_updated qcu = {}; qos_flow_context_updated qcu = {};
qcu.set_cause(REQUEST_ACCEPTED); qcu.set_cause(
static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED));
qcu.set_qfi(i.qfi); qcu.set_qfi(i.qfi);
qcu.set_ul_fteid(i.ul_fteid); qcu.set_ul_fteid(i.ul_fteid);
qcu.set_qos_profile(i.qos_profile); qcu.set_qos_profile(i.qos_profile);
...@@ -2624,7 +2627,8 @@ void smf_context::handle_pdu_session_release_sm_context_request( ...@@ -2624,7 +2627,8 @@ void smf_context::handle_pdu_session_release_sm_context_request(
http_status_code_e::HTTP_STATUS_CODE_200_OK); http_status_code_e::HTTP_STATUS_CODE_200_OK);
n11_sm_context_resp->res.set_supi(smreq->req.get_supi()); n11_sm_context_resp->res.set_supi(smreq->req.get_supi());
n11_sm_context_resp->res.set_supi_prefix(smreq->req.get_supi_prefix()); n11_sm_context_resp->res.set_supi_prefix(smreq->req.get_supi_prefix());
n11_sm_context_resp->res.set_cause(REQUEST_ACCEPTED); n11_sm_context_resp->res.set_cause(
static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED));
n11_sm_context_resp->res.set_pdu_session_id(smreq->req.get_pdu_session_id()); n11_sm_context_resp->res.set_pdu_session_id(smreq->req.get_pdu_session_id());
n11_sm_context_resp->res.set_snssai(smreq->req.get_snssai()); n11_sm_context_resp->res.set_snssai(smreq->req.get_snssai());
n11_sm_context_resp->res.set_dnn(smreq->req.get_dnn()); n11_sm_context_resp->res.set_dnn(smreq->req.get_dnn());
......
...@@ -252,7 +252,8 @@ void smf_n11::send_n1n2_message_transfer_request( ...@@ -252,7 +252,8 @@ void smf_n11::send_n1n2_message_transfer_request(
itti_msg->set_procedure_type(session_management_procedures_type_e:: itti_msg->set_procedure_type(session_management_procedures_type_e::
PDU_SESSION_ESTABLISHMENT_UE_REQUESTED); PDU_SESSION_ESTABLISHMENT_UE_REQUESTED);
itti_msg->set_cause(response_data["cause"]); itti_msg->set_cause(response_data["cause"]);
if (sm_context_res->res.get_cause() == REQUEST_ACCEPTED) { if (sm_context_res->res.get_cause() ==
static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED)) {
itti_msg->set_msg_type(PDU_SESSION_ESTABLISHMENT_ACCEPT); itti_msg->set_msg_type(PDU_SESSION_ESTABLISHMENT_ACCEPT);
} else { } else {
itti_msg->set_msg_type(PDU_SESSION_ESTABLISHMENT_REJECT); itti_msg->set_msg_type(PDU_SESSION_ESTABLISHMENT_REJECT);
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include "smf_n2.hpp" #include "smf_n2.hpp"
#include "smf_pfcp_association.hpp" #include "smf_pfcp_association.hpp"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "3gpp_24.501.h"
using namespace pfcp; using namespace pfcp;
using namespace smf; using namespace smf;
...@@ -303,7 +304,8 @@ void session_create_sm_context_procedure::handle_itti_msg( ...@@ -303,7 +304,8 @@ void session_create_sm_context_procedure::handle_itti_msg(
resp.pfcp_ies.get(cause); resp.pfcp_ies.get(cause);
if (cause.cause_value == pfcp::CAUSE_VALUE_REQUEST_ACCEPTED) { if (cause.cause_value == pfcp::CAUSE_VALUE_REQUEST_ACCEPTED) {
resp.pfcp_ies.get(sps->up_fseid); resp.pfcp_ies.get(sps->up_fseid);
n11_triggered_pending->res.set_cause(REQUEST_ACCEPTED); n11_triggered_pending->res.set_cause(
static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED));
} }
for (auto it : resp.pfcp_ies.created_pdrs) { for (auto it : resp.pfcp_ies.created_pdrs) {
...@@ -333,12 +335,15 @@ void session_create_sm_context_procedure::handle_itti_msg( ...@@ -333,12 +335,15 @@ void session_create_sm_context_procedure::handle_itti_msg(
qos_flow_context_updated flow_updated = {}; qos_flow_context_updated flow_updated = {};
QOSRulesIE qos_rule = {}; QOSRulesIE qos_rule = {};
flow_updated.set_cause(REQUEST_ACCEPTED); flow_updated.set_cause(
static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED));
if (not sps->get_default_qos_flow(default_qos_flow)) { if (not sps->get_default_qos_flow(default_qos_flow)) {
flow_updated.set_cause(SYSTEM_FAILURE); flow_updated.set_cause(static_cast<uint8_t>(
cause_value_5gsm_e::CAUSE_31_REQUEST_REJECTED_UNSPECIFIED));
} else { } else {
if (default_qos_flow.ul_fteid.is_zero()) { if (default_qos_flow.ul_fteid.is_zero()) {
flow_updated.set_cause(SYSTEM_FAILURE); flow_updated.set_cause(static_cast<uint8_t>(
cause_value_5gsm_e::CAUSE_31_REQUEST_REJECTED_UNSPECIFIED));
} else { } else {
flow_updated.set_ul_fteid(default_qos_flow.ul_fteid); // tunnel info flow_updated.set_ul_fteid(default_qos_flow.ul_fteid); // tunnel info
} }
...@@ -429,7 +434,8 @@ void session_create_sm_context_procedure::handle_itti_msg( ...@@ -429,7 +434,8 @@ void session_create_sm_context_procedure::handle_itti_msg(
json_data["n1MessageContainer"]["n1MessageContent"]["contentId"] = json_data["n1MessageContainer"]["n1MessageContent"]["contentId"] =
N1_SM_CONTENT_ID; // NAS part N1_SM_CONTENT_ID; // NAS part
// N2SM // N2SM
if (n11_triggered_pending->res.get_cause() == REQUEST_ACCEPTED) { if (n11_triggered_pending->res.get_cause() ==
static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED)) {
json_data["n2InfoContainer"]["n2InformationClass"] = N1N2_MESSAGE_CLASS; json_data["n2InfoContainer"]["n2InformationClass"] = N1N2_MESSAGE_CLASS;
json_data["n2InfoContainer"]["smInfo"]["pduSessionId"] = json_data["n2InfoContainer"]["smInfo"]["pduSessionId"] =
n11_triggered_pending->res.get_pdu_session_id(); n11_triggered_pending->res.get_pdu_session_id();
...@@ -545,7 +551,8 @@ int session_update_sm_context_procedure::run( ...@@ -545,7 +551,8 @@ int session_update_sm_context_procedure::run(
"could not found any QoS flow with QFI %d", qfi.qfi); "could not found any QoS flow with QFI %d", qfi.qfi);
// Set cause to SYSTEM_FAILURE and send response // Set cause to SYSTEM_FAILURE and send response
qos_flow_context_updated qcu = {}; qos_flow_context_updated qcu = {};
qcu.set_cause(SYSTEM_FAILURE); qcu.set_cause(static_cast<uint8_t>(
cause_value_5gsm_e::CAUSE_31_REQUEST_REJECTED_UNSPECIFIED));
qcu.set_qfi(qfi); qcu.set_qfi(qfi);
n11_triggered_pending->res.add_qos_flow_context_updated(qcu); n11_triggered_pending->res.add_qos_flow_context_updated(qcu);
continue; continue;
...@@ -561,7 +568,8 @@ int session_update_sm_context_procedure::run( ...@@ -561,7 +568,8 @@ int session_update_sm_context_procedure::run(
if ((dl_fteid == flow.dl_fteid) and (not flow.released)) { if ((dl_fteid == flow.dl_fteid) and (not flow.released)) {
Logger::smf_app().debug("QFI %d dl_fteid unchanged", qfi.qfi); Logger::smf_app().debug("QFI %d dl_fteid unchanged", qfi.qfi);
qos_flow_context_updated qcu = {}; qos_flow_context_updated qcu = {};
qcu.set_cause(REQUEST_ACCEPTED); qcu.set_cause(static_cast<uint8_t>(
cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED));
qcu.set_qfi(qfi); qcu.set_qfi(qfi);
n11_triggered_pending->res.add_qos_flow_context_updated(qcu); n11_triggered_pending->res.add_qos_flow_context_updated(qcu);
continue; continue;
...@@ -777,7 +785,8 @@ int session_update_sm_context_procedure::run( ...@@ -777,7 +785,8 @@ int session_update_sm_context_procedure::run(
sps->add_qos_flow(flow); sps->add_qos_flow(flow);
qos_flow_context_updated qcu = {}; qos_flow_context_updated qcu = {};
qcu.set_cause(REQUEST_ACCEPTED); qcu.set_cause(static_cast<uint8_t>(
cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED));
qcu.set_qfi(qfi); qcu.set_qfi(qfi);
n11_triggered_pending->res.add_qos_flow_context_updated(qcu); n11_triggered_pending->res.add_qos_flow_context_updated(qcu);
} }
...@@ -796,7 +805,8 @@ int session_update_sm_context_procedure::run( ...@@ -796,7 +805,8 @@ int session_update_sm_context_procedure::run(
qfi.qfi); qfi.qfi);
// Set cause to SYSTEM_FAILURE and send response // Set cause to SYSTEM_FAILURE and send response
qos_flow_context_updated qcu = {}; qos_flow_context_updated qcu = {};
qcu.set_cause(SYSTEM_FAILURE); qcu.set_cause(static_cast<uint8_t>(
cause_value_5gsm_e::CAUSE_31_REQUEST_REJECTED_UNSPECIFIED));
qcu.set_qfi(qfi); qcu.set_qfi(qfi);
n11_triggered_pending->res.add_qos_flow_context_updated(qcu); n11_triggered_pending->res.add_qos_flow_context_updated(qcu);
continue; continue;
...@@ -948,7 +958,8 @@ void session_update_sm_context_procedure::handle_itti_msg( ...@@ -948,7 +958,8 @@ void session_update_sm_context_procedure::handle_itti_msg(
sps->add_qos_flow(flow); sps->add_qos_flow(flow);
qos_flow_context_updated qcu = {}; qos_flow_context_updated qcu = {};
qcu.set_cause(REQUEST_ACCEPTED); qcu.set_cause(static_cast<uint8_t>(
cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED));
qcu.set_qfi(pfcp::qfi_t(it.first)); qcu.set_qfi(pfcp::qfi_t(it.first));
qcu.set_ul_fteid(flow.ul_fteid); qcu.set_ul_fteid(flow.ul_fteid);
qcu.set_dl_fteid(flow.dl_fteid); qcu.set_dl_fteid(flow.dl_fteid);
...@@ -979,7 +990,8 @@ void session_update_sm_context_procedure::handle_itti_msg( ...@@ -979,7 +990,8 @@ void session_update_sm_context_procedure::handle_itti_msg(
sps->add_qos_flow(flow); sps->add_qos_flow(flow);
qos_flow_context_updated qcu = {}; qos_flow_context_updated qcu = {};
qcu.set_cause(REQUEST_ACCEPTED); qcu.set_cause(static_cast<uint8_t>(
cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED));
qcu.set_qfi(pfcp::qfi_t(it.first)); qcu.set_qfi(pfcp::qfi_t(it.first));
qcu.set_ul_fteid(flow.ul_fteid); qcu.set_ul_fteid(flow.ul_fteid);
qcu.set_dl_fteid(flow.dl_fteid); qcu.set_dl_fteid(flow.dl_fteid);
......
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