Commit 42c70894 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

add default DNN to test with BUPT

parent c3fa4c4b
...@@ -74,7 +74,7 @@ SMF = ...@@ -74,7 +74,7 @@ SMF =
APN_LIST = ( APN_LIST = (
# IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDN_TYPE choice in {IPv4, IPv6, IPv4v6} # IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDN_TYPE choice in {IPv4, IPv6, IPv4v6}
{APN_NI = "carrier.com"; PDN_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1}, {APN_NI = "carrier.com"; PDN_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1},
{APN_NI = "apn1"; PDN_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1}, {APN_NI = "default"; PDN_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1},
{APN_NI = "apn2"; PDN_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1}, {APN_NI = "apn2"; PDN_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1},
{APN_NI = "apn3"; PDN_TYPE = "IPv4"; IPV4_POOL = 3; IPV6_POOL = -1}, {APN_NI = "apn3"; PDN_TYPE = "IPv4"; IPV4_POOL = 3; IPV6_POOL = -1},
{APN_NI = "apn4"; PDN_TYPE = "IPv4"; IPV4_POOL = 4; IPV6_POOL = -1} {APN_NI = "apn4"; PDN_TYPE = "IPv4"; IPV4_POOL = 4; IPV6_POOL = -1}
......
...@@ -459,7 +459,7 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -459,7 +459,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
oai::smf_server::model::SmContextCreateError smContextCreateError = { }; oai::smf_server::model::SmContextCreateError smContextCreateError = { };
oai::smf_server::model::ProblemDetails problem_details = { }; oai::smf_server::model::ProblemDetails problem_details = { };
oai::smf_server::model::RefToBinaryData refToBinaryData = { }; oai::smf_server::model::RefToBinaryData refToBinaryData = { };
std::string n1_sm_message, n1_sm_message_hex; //N1 SM container std::string n1_sm_message, n1_sm_message_hex;
smf_n1_n2 smf_n1_n2_inst = { }; smf_n1_n2 smf_n1_n2_inst = { };
nas_message_t decoded_nas_msg = { }; nas_message_t decoded_nas_msg = { };
...@@ -467,46 +467,37 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -467,46 +467,37 @@ void smf_app::handle_pdu_session_create_sm_context_request(
std::string n1_sm_msg = smreq->req.get_n1_sm_message(); std::string n1_sm_msg = smreq->req.get_n1_sm_message();
memset(&decoded_nas_msg, 0, sizeof(nas_message_t)); memset(&decoded_nas_msg, 0, sizeof(nas_message_t));
pdu_session_create_sm_context_request context_req_msg = smreq->req;
int decoder_rc = smf_n1_n2_inst.decode_n1_sm_container(decoded_nas_msg, int decoder_rc = smf_n1_n2_inst.decode_n1_sm_container(decoded_nas_msg,
n1_sm_msg); n1_sm_msg);
if (decoder_rc != RETURNok) { if (decoder_rc != RETURNok) {
//error, should send reply to AMF with error code!! //error, send reply to AMF with PDU Session Establishment Reject
Logger::smf_app().warn("N1 SM container cannot be decoded correctly!"); Logger::smf_app().warn("N1 SM container cannot be decoded correctly!");
problem_details.setCause( problem_details.setCause(
pdu_session_application_error_e2str[PDU_SESSION_APPLICATION_ERROR_N1_SM_ERROR]); pdu_session_application_error_e2str[PDU_SESSION_APPLICATION_ERROR_N1_SM_ERROR]);
smContextCreateError.setError(problem_details); smContextCreateError.setError(problem_details);
refToBinaryData.setContentId(N1_SM_CONTENT_ID); refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData); smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject
//24.501: response with a 5GSM STATUS message including cause "#95 Semantically incorrect message"
smf_n1_n2_inst.create_n1_sm_container( smf_n1_n2_inst.create_n1_sm_container(
context_req_msg, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message, smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE); cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE);
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex); smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//Send response to AMF
smf_n11_inst->send_pdu_session_create_sm_context_response( smf_n11_inst->send_pdu_session_create_sm_context_response(
smreq->http_response, smContextCreateError, smreq->http_response, smContextCreateError,
Pistache::Http::Code::Forbidden, n1_sm_message_hex); Pistache::Http::Code::Forbidden, n1_sm_message_hex);
return;
} }
Logger::smf_app().debug( Logger::smf_app().debug(
"NAS header information: extended protocol discriminator %d, security headertype %d", "NAS information: Extended Protocol Discriminator %d, Security Header Type %d, Message Type %d",
decoded_nas_msg.header.extended_protocol_discriminator, decoded_nas_msg.header.extended_protocol_discriminator,
decoded_nas_msg.header.security_header_type); decoded_nas_msg.header.security_header_type,
decoded_nas_msg.plain.sm.header.message_type);
//Extended protocol discriminator (Mandatory) //Extended protocol discriminator (Mandatory)
smreq->req.set_epd(decoded_nas_msg.header.extended_protocol_discriminator); smreq->req.set_epd(decoded_nas_msg.header.extended_protocol_discriminator);
//Message type (Mandatory)
//Message type (Mandatory) (PDU SESSION ESTABLISHMENT REQUEST message identity)
Logger::smf_app().debug("NAS header information, Message Type %d",
decoded_nas_msg.plain.sm.header.message_type);
smreq->req.set_message_type(decoded_nas_msg.plain.sm.header.message_type); smreq->req.set_message_type(decoded_nas_msg.plain.sm.header.message_type);
//TODO: Integrity protection maximum data rate (Mandatory)
//Integrity protection maximum data rate (Mandatory)
//TODO:
//PDU session type (Optional) //PDU session type (Optional)
smreq->req.set_pdu_session_type(PDU_SESSION_TYPE_E_IPV4); //set default value smreq->req.set_pdu_session_type(PDU_SESSION_TYPE_E_IPV4); //set default value
if (decoded_nas_msg.plain.sm.header.message_type if (decoded_nas_msg.plain.sm.header.message_type
...@@ -554,18 +545,16 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -554,18 +545,16 @@ void smf_app::handle_pdu_session_create_sm_context_request(
smContextCreateError.setError(problem_details); smContextCreateError.setError(problem_details);
refToBinaryData.setContentId(N1_SM_CONTENT_ID); refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData); smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject //PDU Session Establishment Reject including cause "#81 Invalid PTI value" (section 7.3.1 @3GPP TS 24.501)
//(24.501 (section 7.3.1)) NAS N1 SM message: response with a 5GSM STATUS message including cause "#81 Invalid PTI value"
smf_n1_n2_inst.create_n1_sm_container( smf_n1_n2_inst.create_n1_sm_container(
context_req_msg, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message, smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
cause_value_5gsm_e::CAUSE_81_INVALID_PTI_VALUE); cause_value_5gsm_e::CAUSE_81_INVALID_PTI_VALUE);
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex); smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//Send response to AMF
smf_n11_inst->send_pdu_session_create_sm_context_response( smf_n11_inst->send_pdu_session_create_sm_context_response(
smreq->http_response, smContextCreateError, smreq->http_response, smContextCreateError,
Pistache::Http::Code::Forbidden, n1_sm_message_hex); Pistache::Http::Code::Forbidden, n1_sm_message_hex);
return;
} }
smreq->req.set_pti(pti); smreq->req.set_pti(pti);
//check pdu session id //check pdu session id
...@@ -589,7 +578,7 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -589,7 +578,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//PDU Session Establishment Reject //PDU Session Establishment Reject
//(24.501 (section 7.4)) implementation dependent->do similar to UE: response with a 5GSM STATUS message including cause "#98 message type not compatible with protocol state." //(24.501 (section 7.4)) implementation dependent->do similar to UE: response with a 5GSM STATUS message including cause "#98 message type not compatible with protocol state."
smf_n1_n2_inst.create_n1_sm_container( smf_n1_n2_inst.create_n1_sm_container(
context_req_msg, smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT, PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message, n1_sm_message,
cause_value_5gsm_e::CAUSE_98_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE); //TODO: should define 5GSM cause in 24.501 cause_value_5gsm_e::CAUSE_98_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE); //TODO: should define 5GSM cause in 24.501
...@@ -625,7 +614,7 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -625,7 +614,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
smContextCreateError.setN1SmMsg(refToBinaryData); smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject, 24.501 cause "#27 Missing or unknown DNN" //PDU Session Establishment Reject, 24.501 cause "#27 Missing or unknown DNN"
smf_n1_n2_inst.create_n1_sm_container( smf_n1_n2_inst.create_n1_sm_container(
context_req_msg, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message, smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
cause_value_5gsm_e::CAUSE_27_MISSING_OR_UNKNOWN_DNN); cause_value_5gsm_e::CAUSE_27_MISSING_OR_UNKNOWN_DNN);
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex); smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//Send response to AMF //Send response to AMF
...@@ -694,7 +683,7 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -694,7 +683,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
smContextCreateError.setN1SmMsg(refToBinaryData); smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject, with cause "29 User authentication or authorization failed"? //PDU Session Establishment Reject, with cause "29 User authentication or authorization failed"?
smf_n1_n2_inst.create_n1_sm_container( smf_n1_n2_inst.create_n1_sm_container(
context_req_msg, smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT, PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message, n1_sm_message,
cause_value_5gsm_e::CAUSE_29_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED); cause_value_5gsm_e::CAUSE_29_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED);
...@@ -772,19 +761,12 @@ void smf_app::handle_pdu_session_update_sm_context_request( ...@@ -772,19 +761,12 @@ void smf_app::handle_pdu_session_update_sm_context_request(
return; return;
} }
supi_t supi = scf.get()->supi;
std::string dnn = scf.get()->dnn;
pdu_session_id_t pdu_session_id = scf.get()->pdu_session_id;
snssai_t nssai = scf.get()->nssai;
//Step 2. store supi, dnn, nssai in itti_n11_update_sm_context_request to be processed later on //Step 2. store supi, dnn, nssai in itti_n11_update_sm_context_request to be processed later on
supi64_t supi64 = smf_supi_to_u64(supi); supi64_t supi64 = smf_supi_to_u64(scf.get()->supi);
smreq->req.set_supi(supi); smreq->req.set_supi(scf.get()->supi);
smreq->req.set_dnn(dnn); smreq->req.set_dnn(scf.get()->dnn);
smreq->req.set_snssai(nssai); smreq->req.set_snssai(scf.get()->nssai);
smreq->req.set_pdu_session_id(pdu_session_id); smreq->req.set_pdu_session_id(scf.get()->pdu_session_id);
pdu_session_update_sm_context_request context_req_msg = smreq->req;
//Step 2. find the smf context //Step 2. find the smf context
std::shared_ptr<smf_context> sc = { }; std::shared_ptr<smf_context> sc = { };
...@@ -809,7 +791,7 @@ void smf_app::handle_pdu_session_update_sm_context_request( ...@@ -809,7 +791,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
//get dnn context //get dnn context
std::shared_ptr<dnn_context> sd = { }; std::shared_ptr<dnn_context> sd = { };
if (!sc.get()->find_dnn_context(scf.get()->nssai, dnn, sd)) { if (!sc.get()->find_dnn_context(scf.get()->nssai, scf.get()->dnn, sd)) {
if (nullptr == sd.get()) { if (nullptr == sd.get()) {
//Error, DNN context doesn't exist //Error, DNN context doesn't exist
// send PDUSession_SMUpdateContext Response to AMF // send PDUSession_SMUpdateContext Response to AMF
......
...@@ -198,7 +198,7 @@ void send_pdu_session_establishment_request(std::string smf_ip_address) { ...@@ -198,7 +198,7 @@ void send_pdu_session_establishment_request(std::string smf_ip_address) {
pdu_session_establishment_request["supi"] = "imsi-200000000000001"; pdu_session_establishment_request["supi"] = "imsi-200000000000001";
pdu_session_establishment_request["pei"] = "imei-200000000000001"; pdu_session_establishment_request["pei"] = "imei-200000000000001";
pdu_session_establishment_request["gpsi"] = "msisdn-200000000001"; pdu_session_establishment_request["gpsi"] = "msisdn-200000000001";
pdu_session_establishment_request["dnn"] = "carrier.com"; pdu_session_establishment_request["dnn"] = "default";
pdu_session_establishment_request["sNssai"]["sst"] = 222; pdu_session_establishment_request["sNssai"]["sst"] = 222;
pdu_session_establishment_request["sNssai"]["sd"] = "0000D4"; pdu_session_establishment_request["sNssai"]["sd"] = "0000D4";
pdu_session_establishment_request["pduSessionId"] = 1; pdu_session_establishment_request["pduSessionId"] = 1;
......
...@@ -44,14 +44,23 @@ void SessionManagementSubscriptionDataRetrievalApiImpl::get_sm_data(const std::s ...@@ -44,14 +44,23 @@ void SessionManagementSubscriptionDataRetrievalApiImpl::get_sm_data(const std::s
nlohmann::json jsonData; nlohmann::json jsonData;
jsonData["singleNssai"]["sst"] = 222; jsonData["singleNssai"]["sst"] = 222;
jsonData["singleNssai"]["sd"] = 123; jsonData["singleNssai"]["sd"] = 123;
jsonData["dnnConfigurations"]["carrier.com"]["pduSessionTypes"]["defaultSessionType"] = "IPV4"; jsonData["dnnConfigurations"]["default"]["pduSessionTypes"]["defaultSessionType"] = "IPV4";
jsonData["dnnConfigurations"]["carrier.com"]["sscModes"]["defaultSscMode"] = "SSC_MODE_1"; jsonData["dnnConfigurations"]["default"]["sscModes"]["defaultSscMode"] = "SSC_MODE_1";
jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["5qi"] = 60; jsonData["dnnConfigurations"]["default"]["5gQosProfile"]["5qi"] = 61;
jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["priorityLevel"] = 1; jsonData["dnnConfigurations"]["default"]["5gQosProfile"]["arp"]["priorityLevel"] = 1;
jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["preemptCap"] = "NOT_PREEMPT"; jsonData["dnnConfigurations"]["default"]["5gQosProfile"]["arp"]["preemptCap"] = "NOT_PREEMPT";
jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["preemptVuln"] = "NOT_PREEMPTABLE"; jsonData["dnnConfigurations"]["default"]["5gQosProfile"]["arp"]["preemptVuln"] = "NOT_PREEMPTABLE";
jsonData["dnnConfigurations"]["carrier.com"]["sessionAmbr"]["uplink"] = "10Mbps"; jsonData["dnnConfigurations"]["default"]["sessionAmbr"]["uplink"] = "20Mbps";
jsonData["dnnConfigurations"]["carrier.com"]["sessionAmbr"]["downlink"] = "11Mbps"; jsonData["dnnConfigurations"]["default"]["sessionAmbr"]["downlink"] = "22Mbps";
jsonData["dnnConfigurations"]["carrier.com"]["pduSessionTypes"]["defaultSessionType"] = "IPV4";
jsonData["dnnConfigurations"]["carrier.com"]["sscModes"]["defaultSscMode"] = "SSC_MODE_1";
jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["5qi"] = 60;
jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["priorityLevel"] = 1;
jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["preemptCap"] = "NOT_PREEMPT";
jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["preemptVuln"] = "NOT_PREEMPTABLE";
jsonData["dnnConfigurations"]["carrier.com"]["sessionAmbr"]["uplink"] = "10Mbps";
jsonData["dnnConfigurations"]["carrier.com"]["sessionAmbr"]["downlink"] = "11Mbps";
/* /*
SessionManagementSubscriptionData subscriptionData; SessionManagementSubscriptionData subscriptionData;
......
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