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

fix issue for NSSAI/Cause and add PDU Session Release Reject

parent 42c70894
...@@ -73,8 +73,8 @@ SMF = ...@@ -73,8 +73,8 @@ 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 = "default"; PDN_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1},
{APN_NI = "default"; PDN_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1}, {APN_NI = "carrier.com"; 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}
......
...@@ -103,7 +103,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts( ...@@ -103,7 +103,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
smContextCreateData.getSNssai().getSst(), smContextCreateData.getSNssai().getSst(),
smContextCreateData.getSNssai().getSd().c_str()); smContextCreateData.getSNssai().getSd().c_str());
snssai_t snssai(smContextCreateData.getSNssai().getSst(), snssai_t snssai(smContextCreateData.getSNssai().getSst(),
smContextCreateData.getSNssai().getSd().c_str()); smContextCreateData.getSNssai().getSd());
sm_context_req_msg.set_snssai(snssai); sm_context_req_msg.set_snssai(snssai);
//PDU session ID //PDU session ID
......
...@@ -526,8 +526,8 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -526,8 +526,8 @@ void smf_app::handle_pdu_session_create_sm_context_request(
uint8_t message_type = decoded_nas_msg.plain.sm.header.message_type; uint8_t message_type = decoded_nas_msg.plain.sm.header.message_type;
std::string request_type = smreq->req.get_request_type(); std::string request_type = smreq->req.get_request_type();
Logger::smf_app().info( Logger::smf_app().info(
"Handle a PDU Session Create SM Context Request message from AMF, supi " SUPI_64_FMT ", dnn %s, snssai_sst %d", "Handle a PDU Session Create SM Context Request message from AMF, supi " SUPI_64_FMT ", dnn %s, snssai_sst %d, snssai_sd %s",
supi64, dnn.c_str(), snssai.sST); supi64, dnn.c_str(), snssai.sST, snssai.sD.c_str());
//If no DNN information from UE, set to default value //If no DNN information from UE, set to default value
if (dnn.length() == 0) { if (dnn.length() == 0) {
...@@ -581,9 +581,8 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -581,9 +581,8 @@ void smf_app::handle_pdu_session_create_sm_context_request(
smreq->req, 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);
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);
...@@ -617,7 +616,6 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -617,7 +616,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
smreq->req, 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
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);
...@@ -672,8 +670,7 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -672,8 +670,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//update dnn_context with subscription info //update dnn_context with subscription info
sc.get()->insert_dnn_subscription(snssai, subscription); sc.get()->insert_dnn_subscription(snssai, subscription);
} else { } else {
// Cannot retrieve information from UDM, // Cannot retrieve information from UDM, reject PDU session establishment
//Not accept to establish a PDU session
Logger::smf_app().warn( Logger::smf_app().warn(
"Received PDU_SESSION_CREATESMCONTEXT_REQUEST, couldn't retrieve the Session Management Subscription from UDM, ignore message!"); "Received PDU_SESSION_CREATESMCONTEXT_REQUEST, couldn't retrieve the Session Management Subscription from UDM, ignore message!");
problem_details.setCause( problem_details.setCause(
...@@ -681,7 +678,7 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -681,7 +678,7 @@ 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, 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(
smreq->req, smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT, PDU_SESSION_ESTABLISHMENT_REJECT,
...@@ -712,8 +709,6 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -712,8 +709,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
Logger::smf_app().debug("Generated a SCID " SCID_FMT " ", scid); Logger::smf_app().debug("Generated a SCID " SCID_FMT " ", scid);
//Step 8. let the context handle the message //Step 8. let the context handle the message
//in this step, SMF will send N4 Session Establishment/Modification to UPF (step 10a, section 4.3.2 3GPP 23.502)
//SMF, then, sends response to AMF
sc.get()->handle_pdu_session_create_sm_context_request(smreq); sc.get()->handle_pdu_session_create_sm_context_request(smreq);
} }
...@@ -733,7 +728,6 @@ void smf_app::handle_pdu_session_update_sm_context_request( ...@@ -733,7 +728,6 @@ void smf_app::handle_pdu_session_update_sm_context_request(
try { try {
scid = std::stoi(smreq->scid); scid = std::stoi(smreq->scid);
} catch (const std::exception &err) { } catch (const std::exception &err) {
//TODO: send PDUSession_SMUpdateContext Response to AMF with CAUSE: invalid context
Logger::smf_app().warn( Logger::smf_app().warn(
"Received a PDU Session Update SM Context Request, couldn't retrieve the corresponding SMF context, ignore message!"); "Received a PDU Session Update SM Context Request, couldn't retrieve the corresponding SMF context, ignore message!");
problem_details.setCause( problem_details.setCause(
...@@ -793,8 +787,7 @@ void smf_app::handle_pdu_session_update_sm_context_request( ...@@ -793,8 +787,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
if (!sc.get()->find_dnn_context(scf.get()->nssai, scf.get()->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
Logger::smf_app().warn( Logger::smf_app().warn(
"Received PDU Session Update SM Context Request, couldn't retrieve the corresponding SMF context, ignore message!"); "Received PDU Session Update SM Context Request, couldn't retrieve the corresponding SMF context, ignore message!");
problem_details.setCause( problem_details.setCause(
......
This diff is collapsed.
...@@ -192,7 +192,7 @@ void smf_n11::send_n1n2_message_transfer_request( ...@@ -192,7 +192,7 @@ void smf_n11::send_n1n2_message_transfer_request(
try { try {
response_data = json::parse(*httpData.get()); response_data = json::parse(*httpData.get());
} catch (json::exception &e) { } catch (json::exception &e) {
Logger::smf_n11().error("Could not get the cause from the response"); Logger::smf_n11().warn("Could not get the cause from the response");
//Set the default Cause //Set the default Cause
response_data["cause"] = "504 Gateway Timeout"; response_data["cause"] = "504 Gateway Timeout";
} }
......
...@@ -109,7 +109,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg, ...@@ -109,7 +109,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
//Extended Protocol Discriminator //Extended Protocol Discriminator
sm_msg->header.extended_protocol_discriminator = sm_msg->header.extended_protocol_discriminator =
EPD_5GS_SESSION_MANAGEMENT_MESSAGES; EPD_5GS_SESSION_MANAGEMENT_MESSAGES;
//Message Type //PDU Session Identity
sm_msg->header.pdu_session_identity = msg.get_pdu_session_id(); sm_msg->header.pdu_session_identity = msg.get_pdu_session_id();
switch (n1_msg_type) { switch (n1_msg_type) {
...@@ -131,7 +131,6 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg, ...@@ -131,7 +131,6 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
//get default QoS value //get default QoS value
qos_flow_context_updated qos_flow = { }; qos_flow_context_updated qos_flow = { };
qos_flow = sm_context_res.get_qos_flow_context(); qos_flow = sm_context_res.get_qos_flow_context();
//TODO: to be completed //TODO: to be completed
//get the default QoS profile and assign to the NAS message //get the default QoS profile and assign to the NAS message
...@@ -156,7 +155,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg, ...@@ -156,7 +155,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
sm_msg->header.procedure_transaction_identity, sm_msg->header.procedure_transaction_identity,
sm_msg->header.message_type); sm_msg->header.message_type);
//Fill the content of PDU Session Establishment Request message //Fill the content of PDU Session Establishment Accept message
//PDU Session Type //PDU Session Type
sm_msg->pdu_session_establishment_accept._pdusessiontype sm_msg->pdu_session_establishment_accept._pdusessiontype
.pdu_session_type_value = sm_context_res.get_pdu_session_type(); .pdu_session_type_value = sm_context_res.get_pdu_session_type();
...@@ -277,10 +276,12 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg, ...@@ -277,10 +276,12 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
.get_snssai().sST; .get_snssai().sST;
try { try {
sm_msg->pdu_session_establishment_accept.snssai.sd = std::stoi( sm_msg->pdu_session_establishment_accept.snssai.sd = std::stoul(sm_context_res.get_snssai().sD, nullptr, 16);
sm_context_res.get_snssai().sD);
} catch (const std::exception &e) { } catch (const std::exception &e) {
Logger::smf_app().warn("Error when converting from string to int for snssai.SD, error: %s", e.what()); Logger::smf_app().warn(
"Error when converting from string to int for snssai.SD, error: %s",
e.what());
//"no SD value associated with the SST" //"no SD value associated with the SST"
sm_msg->pdu_session_establishment_accept.snssai.sd = 0xFFFFFF; sm_msg->pdu_session_establishment_accept.snssai.sd = 0xFFFFFF;
} }
...@@ -358,7 +359,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg, ...@@ -358,7 +359,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
//1 - PDU Session Create SM Context Response (PDU Session Establishment procedure - reject) //1 - PDU Session Create SM Context Response (PDU Session Establishment procedure - reject)
//2 - N1N2MessageTransfer Request (PDU Session Establishment procedure - reject) //2 - N1N2MessageTransfer Request (PDU Session Establishment procedure - reject)
//3- PDU Session Update SM Context Response (PDU Session Establishment procedure - reject)​ //3- PDU Session Update SM Context Response (PDU Session Establishment procedure - reject)​
//PDU_SESSION_CREATE_SM_CONTEXT_RESPONSE or PDU_SESSION_CREATE_SM_CONTEXT_REQUEST //PDU_SESSION_CREATE_SM_CONTEXT_RESPONSE or PDU_SESSION_CREATE_SM_CONTEXT_REQUEST
Logger::smf_app().info( Logger::smf_app().info(
"PDU_SESSION_ESTABLISHMENT_REJECT, encode starting..."); "PDU_SESSION_ESTABLISHMENT_REJECT, encode starting...");
...@@ -386,7 +387,8 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg, ...@@ -386,7 +387,8 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
sm_msg->pdu_session_establishment_reject._5gsmcause = sm_msg->pdu_session_establishment_reject._5gsmcause =
static_cast<uint8_t>(sm_cause); static_cast<uint8_t>(sm_cause);
//Presence //Presence
sm_msg->pdu_session_establishment_reject.presence = 0x00; sm_msg->pdu_session_establishment_reject.presence =
PDU_SESSION_ESTABLISHMENT_REJECT_ALLOWED_SSC_MODE_PRESENCE; //Should be updated according to the following IEs
/* /*
//GPRSTimer3 //GPRSTimer3
sm_msg->pdu_session_establishment_reject.gprstimer3.unit = sm_msg->pdu_session_establishment_reject.gprstimer3.unit =
...@@ -436,8 +438,6 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg, ...@@ -436,8 +438,6 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
.is_ssc2_allowed, .is_ssc2_allowed,
sm_msg->pdu_session_establishment_reject.allowedsscmode sm_msg->pdu_session_establishment_reject.allowedsscmode
.is_ssc3_allowed); .is_ssc3_allowed);
//Logger::smf_app().debug("SM MSG, GPSR Timer3, unit: 0x%x, value: 0x%x",sm_msg->pdu_session_establishment_reject.gprstimer3.unit,sm_msg->pdu_session_establishment_reject.gprstimer3.timeValue);
//Logger::smf_app().debug("SM MSG, 5G SM Congestion Re-attempt Indicator: 0x%x",sm_msg->pdu_session_establishment_reject._5gsmcongestionreattemptindicator.abo);
//Encode NAS message //Encode NAS message
bytes = nas_message_encode(data, &nas_msg, bytes = nas_message_encode(data, &nas_msg,
...@@ -480,8 +480,8 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg, ...@@ -480,8 +480,8 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
//Presence //Presence
sm_msg->pdu_session_modification_command.presence = 0xff; //TODO: to be updated sm_msg->pdu_session_modification_command.presence = 0xff; //TODO: to be updated
//5GSMCause //5GSMCause
sm_msg->pdu_session_modification_command._5gsmcause = sm_context_res sm_msg->pdu_session_modification_command._5gsmcause =
.get_cause(); static_cast<uint8_t>(sm_cause); //sm_context_res.get_cause();
//SessionAMBR //SessionAMBR
//TODO: get from subscription DB //TODO: get from subscription DB
...@@ -590,7 +590,6 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg, ...@@ -590,7 +590,6 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
//this IE is included in the following message //this IE is included in the following message
//1 - PDU Session Update SM Context Response (PDU Session Release UE-Initiated, step 1) //1 - PDU Session Update SM Context Response (PDU Session Release UE-Initiated, step 1)
//2 - N1N2MessageTransfer Request (PDU Session Release SMF-Requested, step 1) //2 - N1N2MessageTransfer Request (PDU Session Release SMF-Requested, step 1)
//TODO: to be completed
Logger::smf_app().debug( Logger::smf_app().debug(
"[Create N1 SM Message] PDU Session Release Command"); "[Create N1 SM Message] PDU Session Release Command");
...@@ -599,26 +598,68 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg, ...@@ -599,26 +598,68 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
static_cast<pdu_session_update_sm_context_response&>(msg); static_cast<pdu_session_update_sm_context_response&>(msg);
Logger::smf_app().info("PDU_SESSION_RELEASE_COMMAND, encode starting..."); Logger::smf_app().info("PDU_SESSION_RELEASE_COMMAND, encode starting...");
//Fill the content of PDU Session Release Command (with hardcoded values) //Fill the content of PDU Session Release Command
//Message Type //PDU Session ID
sm_msg->header.message_type = PDU_SESSION_RELEASE_COMMAND; sm_msg->header.pdu_session_identity = sm_context_res.get_pdu_session_id();
//PTI //PTI
sm_msg->header.procedure_transaction_identity = sm_context_res.get_pti() sm_msg->header.procedure_transaction_identity = sm_context_res.get_pti()
.procedure_transaction_id; .procedure_transaction_id;
//PDU Session Type //Message Type
sm_msg->pdu_session_release_command.messagetype = sm_context_res sm_msg->header.message_type = PDU_SESSION_RELEASE_COMMAND;
.get_msg_type();
//5GSMCause //5GSMCause
sm_msg->pdu_session_release_command._5gsmcause = sm_msg->pdu_session_release_command._5gsmcause =
sm_context_res.get_cause(); static_cast<uint8_t>(sm_cause); //sm_context_res.get_cause();
//Presence //Presence
sm_msg->pdu_session_modification_command.presence = 0x00; //TODO: to be updated sm_msg->pdu_session_release_command.presence = 0x00; //TODO: to be updated when adding the following IEs
//GPRSTimer3 //GPRSTimer3
//EAPMessage //EAPMessage
//_5GSMCongestionReattemptIndicator //_5GSMCongestionReattemptIndicator
// ExtendedProtocolConfigurationOptions // ExtendedProtocolConfigurationOptions
Logger::smf_app().debug("SM MSG, 5GSM Cause: 0x%x, %d",
sm_msg->pdu_session_release_command._5gsmcause,
static_cast<uint8_t>(sm_cause));
//Encode NAS message
bytes = nas_message_encode(data, &nas_msg,
sizeof(data)/*don't know the size*/, nullptr);
Logger::smf_app().debug("Buffer Data: ");
for (int i = 0; i < bytes; i++)
printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
std::string n1Message((char*) data, bytes);
nas_msg_str = n1Message;
}
break;
case PDU_SESSION_RELEASE_REJECT: {
//This IE is included in the PDU Session Update SM Context Response (PDU Session Release UE-Initiated, step 1)
Logger::smf_app().debug(
"[Create N1 SM Message] PDU Session Release Reject");
Logger::smf_app().info("PDU_SESSION_RELEASE_REJECT, encode starting...");
pdu_session_update_sm_context_response &sm_context_res =
static_cast<pdu_session_update_sm_context_response&>(msg);
//Fill the content of PDU Session Release Reject
//PDU Session ID
sm_msg->header.pdu_session_identity = sm_context_res.get_pdu_session_id();
//PTI
sm_msg->header.procedure_transaction_identity = sm_context_res.get_pti()
.procedure_transaction_id;
//Message Type
sm_msg->header.message_type = PDU_SESSION_RELEASE_REJECT;
//5GSMCause
sm_msg->pdu_session_release_reject._5gsmcause =
static_cast<uint8_t>(sm_cause); //sm_context_res.get_cause();
//Presence
sm_msg->pdu_session_release_command.presence = 0x00; //TODO: to be updated when adding the following IE
//Extended protocol configuration options
//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);
...@@ -1520,8 +1561,8 @@ int smf_n1_n2::decode_n2_sm_information( ...@@ -1520,8 +1561,8 @@ int smf_n1_n2::decode_n2_sm_information(
//Ngap_PDUSessionResourceModifyResponseTransfer //Ngap_PDUSessionResourceModifyResponseTransfer
asn_dec_rval_t rc = asn_decode( asn_dec_rval_t rc = asn_decode(
nullptr, ATS_ALIGNED_CANONICAL_PER, nullptr, ATS_ALIGNED_CANONICAL_PER,
&asn_DEF_Ngap_PDUSessionResourceReleaseResponseTransfer, (void**) &ngap_IE, &asn_DEF_Ngap_PDUSessionResourceReleaseResponseTransfer,
(void*) data, data_len); (void**) &ngap_IE, (void*) data, data_len);
//free memory //free memory
free_wrapper((void**) &data); free_wrapper((void**) &data);
...@@ -1535,4 +1576,3 @@ int smf_n1_n2::decode_n2_sm_information( ...@@ -1535,4 +1576,3 @@ int smf_n1_n2::decode_n2_sm_information(
} }
...@@ -127,6 +127,8 @@ int main(int argc, char* argv[]) { ...@@ -127,6 +127,8 @@ int main(int argc, char* argv[]) {
SubscriptionsCollectionDocumentApiImpl SubscriptionsCollectionDocumentApiserver(router); SubscriptionsCollectionDocumentApiImpl SubscriptionsCollectionDocumentApiserver(router);
SubscriptionsCollectionDocumentApiserver.init(); SubscriptionsCollectionDocumentApiserver.init();
std::cout << "AMF server is listening on address: " << amf_ip_address.c_str() << std::endl;
httpEndpoint->setHandler(router->handler()); httpEndpoint->setHandler(router->handler());
httpEndpoint->serve(); httpEndpoint->serve();
......
...@@ -77,6 +77,7 @@ enum class multipart_related_content_part_e { ...@@ -77,6 +77,7 @@ enum class multipart_related_content_part_e {
NGAP = 2 NGAP = 2
}; };
//------------------------------------------------------------------------------
unsigned char* format_string_as_hex(std::string str) { unsigned char* format_string_as_hex(std::string str) {
unsigned int str_len = str.length(); unsigned int str_len = str.length();
char *data = (char*) malloc(str_len + 1); char *data = (char*) malloc(str_len + 1);
...@@ -108,8 +109,8 @@ void create_multipart_related_content(std::string &body, std::string &json_part, ...@@ -108,8 +109,8 @@ void create_multipart_related_content(std::string &body, std::string &json_part,
std::string &n2_message) { std::string &n2_message) {
//format string as hex //format string as hex
unsigned char *n1_msg_hex = format_string_as_hex(n1_message); //unsigned char *n1_msg_hex = format_string_as_hex(n1_message);
unsigned char *n2_msg_hex = format_string_as_hex(n2_message); //unsigned char *n2_msg_hex = format_string_as_hex(n2_message);
std::string CRLF = "\r\n"; std::string CRLF = "\r\n";
body.append("--" + boundary + CRLF); body.append("--" + boundary + CRLF);
...@@ -122,15 +123,16 @@ void create_multipart_related_content(std::string &body, std::string &json_part, ...@@ -122,15 +123,16 @@ void create_multipart_related_content(std::string &body, std::string &json_part,
"Content-Type: application/vnd.3gpp.5gnas" + CRLF + "Content-Id: n1SmMsg" "Content-Type: application/vnd.3gpp.5gnas" + CRLF + "Content-Id: n1SmMsg"
+ CRLF); + CRLF);
body.append(CRLF); body.append(CRLF);
body.append(std::string((char*) n1_msg_hex, n1_message.length() / 2) + CRLF); //body.append(std::string((char*) n1_msg_hex, n1_message.length() / 2) + CRLF);
//body.append(n1_message + CRLF); body.append(n1_message + CRLF);
body.append("--" + boundary + CRLF); body.append("--" + boundary + CRLF);
body.append( body.append(
"Content-Type: application/vnd.3gpp.ngap" + CRLF + "Content-Id: n2SmMsg" "Content-Type: application/vnd.3gpp.ngap" + CRLF + "Content-Id: n2SmMsg"
+ CRLF); + CRLF);
body.append(CRLF); body.append(CRLF);
body.append(std::string((char*) n2_msg_hex, n2_message.length() / 2) + CRLF); //body.append(std::string((char*) n2_msg_hex, n2_message.length() / 2) + CRLF);
body.append(n2_message + CRLF);
body.append("--" + boundary + "--" + CRLF); body.append("--" + boundary + "--" + CRLF);
} }
...@@ -164,6 +166,7 @@ void create_multipart_related_content( ...@@ -164,6 +166,7 @@ void create_multipart_related_content(
body.append("--" + boundary + "--" + CRLF); body.append("--" + boundary + "--" + CRLF);
} }
//------------------------------------------------------------------------------
void send_pdu_session_establishment_request(std::string smf_ip_address) { void send_pdu_session_establishment_request(std::string smf_ip_address) {
std::cout << "[AMF N11] PDU Session Establishment Request (SM Context Create)" std::cout << "[AMF N11] PDU Session Establishment Request (SM Context Create)"
<< std::endl; << std::endl;
...@@ -270,6 +273,7 @@ void send_pdu_session_establishment_request(std::string smf_ip_address) { ...@@ -270,6 +273,7 @@ void send_pdu_session_establishment_request(std::string smf_ip_address) {
free(buffer); free(buffer);
} }
//------------------------------------------------------------------------------
void send_pdu_session_update_sm_context_establishment( void send_pdu_session_update_sm_context_establishment(
std::string smf_ip_address) { std::string smf_ip_address) {
std::cout << "[AMF N11] PDU Session Establishment Request (SM Context Update)" std::cout << "[AMF N11] PDU Session Establishment Request (SM Context Update)"
...@@ -379,6 +383,7 @@ void send_pdu_session_update_sm_context_establishment( ...@@ -379,6 +383,7 @@ void send_pdu_session_update_sm_context_establishment(
free(buffer); free(buffer);
} }
//------------------------------------------------------------------------------
void send_pdu_session_release_request(std::string smf_ip_address) { void send_pdu_session_release_request(std::string smf_ip_address) {
std::cout << "[AMF N11] PDU Session Release Request (SM Context Update)" std::cout << "[AMF N11] PDU Session Release Request (SM Context Update)"
...@@ -471,6 +476,7 @@ void send_pdu_session_release_request(std::string smf_ip_address) { ...@@ -471,6 +476,7 @@ void send_pdu_session_release_request(std::string smf_ip_address) {
free(buffer); free(buffer);
} }
//------------------------------------------------------------------------------
void send_pdu_session_release_resource_release_ack( void send_pdu_session_release_resource_release_ack(
std::string smf_ip_address) { std::string smf_ip_address) {
...@@ -559,6 +565,7 @@ void send_pdu_session_release_resource_release_ack( ...@@ -559,6 +565,7 @@ void send_pdu_session_release_resource_release_ack(
free(buffer); free(buffer);
} }
//------------------------------------------------------------------------------
void send_pdu_session_release_complete(std::string smf_ip_address) { void send_pdu_session_release_complete(std::string smf_ip_address) {
std::cout std::cout
...@@ -653,6 +660,7 @@ void send_pdu_session_release_complete(std::string smf_ip_address) { ...@@ -653,6 +660,7 @@ void send_pdu_session_release_complete(std::string smf_ip_address) {
free(buffer); free(buffer);
} }
//------------------------------------------------------------------------------
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
std::string smf_ip_address; std::string smf_ip_address;
......
...@@ -46,7 +46,7 @@ void SessionManagementSubscriptionDataRetrievalApiImpl::get_sm_data(const std::s ...@@ -46,7 +46,7 @@ void SessionManagementSubscriptionDataRetrievalApiImpl::get_sm_data(const std::s
jsonData["singleNssai"]["sd"] = 123; jsonData["singleNssai"]["sd"] = 123;
jsonData["dnnConfigurations"]["default"]["pduSessionTypes"]["defaultSessionType"] = "IPV4"; jsonData["dnnConfigurations"]["default"]["pduSessionTypes"]["defaultSessionType"] = "IPV4";
jsonData["dnnConfigurations"]["default"]["sscModes"]["defaultSscMode"] = "SSC_MODE_1"; jsonData["dnnConfigurations"]["default"]["sscModes"]["defaultSscMode"] = "SSC_MODE_1";
jsonData["dnnConfigurations"]["default"]["5gQosProfile"]["5qi"] = 61; jsonData["dnnConfigurations"]["default"]["5gQosProfile"]["5qi"] = 60;
jsonData["dnnConfigurations"]["default"]["5gQosProfile"]["arp"]["priorityLevel"] = 1; jsonData["dnnConfigurations"]["default"]["5gQosProfile"]["arp"]["priorityLevel"] = 1;
jsonData["dnnConfigurations"]["default"]["5gQosProfile"]["arp"]["preemptCap"] = "NOT_PREEMPT"; jsonData["dnnConfigurations"]["default"]["5gQosProfile"]["arp"]["preemptCap"] = "NOT_PREEMPT";
jsonData["dnnConfigurations"]["default"]["5gQosProfile"]["arp"]["preemptVuln"] = "NOT_PREEMPTABLE"; jsonData["dnnConfigurations"]["default"]["5gQosProfile"]["arp"]["preemptVuln"] = "NOT_PREEMPTABLE";
...@@ -55,7 +55,7 @@ void SessionManagementSubscriptionDataRetrievalApiImpl::get_sm_data(const std::s ...@@ -55,7 +55,7 @@ void SessionManagementSubscriptionDataRetrievalApiImpl::get_sm_data(const std::s
jsonData["dnnConfigurations"]["carrier.com"]["pduSessionTypes"]["defaultSessionType"] = "IPV4"; jsonData["dnnConfigurations"]["carrier.com"]["pduSessionTypes"]["defaultSessionType"] = "IPV4";
jsonData["dnnConfigurations"]["carrier.com"]["sscModes"]["defaultSscMode"] = "SSC_MODE_1"; jsonData["dnnConfigurations"]["carrier.com"]["sscModes"]["defaultSscMode"] = "SSC_MODE_1";
jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["5qi"] = 60; jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["5qi"] = 61;
jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["priorityLevel"] = 1; jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["priorityLevel"] = 1;
jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["preemptCap"] = "NOT_PREEMPT"; jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["preemptCap"] = "NOT_PREEMPT";
jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["preemptVuln"] = "NOT_PREEMPTABLE"; jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["preemptVuln"] = "NOT_PREEMPTABLE";
......
...@@ -117,7 +117,6 @@ int main(int argc, char* argv[]) { ...@@ -117,7 +117,6 @@ int main(int argc, char* argv[]) {
opts.flags(Pistache::Tcp::Options::ReuseAddr); opts.flags(Pistache::Tcp::Options::ReuseAddr);
opts.maxPayload(PISTACHE_SERVER_MAX_PAYLOAD); opts.maxPayload(PISTACHE_SERVER_MAX_PAYLOAD);
httpEndpoint->init(opts); httpEndpoint->init(opts);
AccessAndMobilitySubscriptionDataRetrievalApiImpl AccessAndMobilitySubscriptionDataRetrievalApiserver(router); AccessAndMobilitySubscriptionDataRetrievalApiImpl AccessAndMobilitySubscriptionDataRetrievalApiserver(router);
AccessAndMobilitySubscriptionDataRetrievalApiserver.init(); AccessAndMobilitySubscriptionDataRetrievalApiserver.init();
...@@ -160,9 +159,12 @@ int main(int argc, char* argv[]) { ...@@ -160,9 +159,12 @@ int main(int argc, char* argv[]) {
UEContextInSMSFDataRetrievalApiImpl UEContextInSMSFDataRetrievalApiserver(router); UEContextInSMSFDataRetrievalApiImpl UEContextInSMSFDataRetrievalApiserver(router);
UEContextInSMSFDataRetrievalApiserver.init(); UEContextInSMSFDataRetrievalApiserver.init();
std::cout << "UDM is listening on address: " << udm_ip_address.c_str() << std::endl;
httpEndpoint->setHandler(router->handler()); httpEndpoint->setHandler(router->handler());
httpEndpoint->serve(); httpEndpoint->serve();
httpEndpoint->shutdown(); httpEndpoint->shutdown();
} }
......
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