Commit 19bd6d87 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

Fix issues for N11 interface integration test (dsTester)

parent 9a00386f
......@@ -173,11 +173,15 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
Logger::smf_api_server().debug("Got result for promise ID %d", promise_id);
nlohmann::json json_data = { };
response.headers().add < Pistache::Http::Header::Location
> (sm_context_response.get_smf_context_uri()); //Location header
sm_context_response.get_json_data(json_data);
if (!json_data.empty()) {
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType("application/json"));
response.send(Pistache::Http::Code(sm_context_response.get_http_code()), json_data.dump().c_str());
response.headers().add < Pistache::Http::Header::ContentType
> (Pistache::Http::Mime::MediaType("application/json"));
response.send(Pistache::Http::Code(sm_context_response.get_http_code()),
json_data.dump().c_str());
} else {
response.send(Pistache::Http::Code(sm_context_response.get_http_code()));
}
......
......@@ -175,7 +175,9 @@ typedef struct qos_profile_s {
#define NUDM_SDM_GET_SM_DATA_URL "/nudm-sdm/v2/{}/sm-data" //may get from configuration file
#define N1_SM_CONTENT_ID "n1SmMsg"
#define N1N2_MESSAGE_CLASS "SM"
#define N2_SM_CONTENT_ID "n2SmMsg"
#define N2_SM_CONTENT_ID "n2msg"
#define NSMF_CALLBACK_N1N2_MESSAGE_TRANSFER_FAILURE "/nsmf-pdusession/v2/callback/N1N2MsgTxfrFailureNotification/{}" //may get from configuration file
//for CURL
#define AMF_CURL_TIMEOUT_MS 100L
......
......@@ -119,7 +119,7 @@ void mime_parser::create_multipart_related_content(std::string &body,
body.append(std::string((char*) n1_msg_hex, n1_message.length() / 2) + CRLF);
body.append("--" + boundary + CRLF);
body.append(
"Content-Type: application/vnd.3gpp.ngap" + CRLF + "Content-Id: n2SmMsg"
"Content-Type: application/vnd.3gpp.ngap" + CRLF + "Content-Id: n2msg"
+ CRLF);
body.append(CRLF);
body.append(std::string((char*) n2_msg_hex, n2_message.length() / 2) + CRLF);
......@@ -148,7 +148,7 @@ void mime_parser::create_multipart_related_content(
+ "Content-Id: n1SmMsg" + CRLF);
} else if (content_type == multipart_related_content_part_e::NGAP) { //NGAP
body.append(
"Content-Type: application/vnd.3gpp.ngap" + CRLF + "Content-Id: n2SmMsg"
"Content-Type: application/vnd.3gpp.ngap" + CRLF + "Content-Id: n2msg"
+ CRLF);
}
body.append(CRLF);
......
......@@ -1364,7 +1364,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
json_data["cause"] = 0;
sm_context_response.set_json_data(json_data);
sm_context_response.set_http_code(
http_status_code_e::HTTP_STATUS_CODE_200_OK);
http_status_code_e::HTTP_STATUS_CODE_201_CREATED);
itti_msg->res = sm_context_response;
int ret = itti_inst->send_msg(itti_msg);
......
......@@ -801,7 +801,8 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
pduSessionType->criticality = Ngap_Criticality_reject;
pduSessionType->value.present =
Ngap_PDUSessionResourceSetupRequestTransferIEs__value_PR_PDUSessionType;
pduSessionType->value.choice.PDUSessionType = msg.get_pdu_session_type(); //TODO: different between Ngap_PDUSessionType_ipv4 vs pdu_session_type_e::PDU_SESSION_TYPE_E_IPV4
pduSessionType->value.choice.PDUSessionType = msg.get_pdu_session_type()
- 1; //TODO: dirty code, difference between Ngap_PDUSessionType_ipv4 vs pdu_session_type_e::PDU_SESSION_TYPE_E_IPV4 (TS 38.413 vs TS 24.501)
ASN_SEQUENCE_ADD(&ngap_IEs->protocolIEs.list, pduSessionType);
//SecurityIndication
......@@ -1606,9 +1607,9 @@ int smf_n1_n2::decode_n2_sm_information(
if (rc.code != RC_OK) {
Logger::smf_app().warn("asn_decode failed with code %d", rc.code);
return RETURNerror;
return RETURNerror ;
}
return RETURNok;
return RETURNok ;
}
//---------------------------------------------------------------------------------------------
......@@ -1635,9 +1636,9 @@ int smf_n1_n2::decode_n2_sm_information(
if (rc.code != RC_OK) {
Logger::smf_app().warn("asn_decode failed with code %d", rc.code);
return RETURNerror;
return RETURNerror ;
}
return RETURNok;
return RETURNok ;
}
//---------------------------------------------------------------------------------------------
......@@ -1664,9 +1665,9 @@ int smf_n1_n2::decode_n2_sm_information(
if (rc.code != RC_OK) {
Logger::smf_app().warn("asn_decode failed with code %d", rc.code);
return RETURNerror;
return RETURNerror ;
}
return RETURNok;
return RETURNok ;
}
//---------------------------------------------------------------------------------------------
......@@ -1693,7 +1694,7 @@ int smf_n1_n2::decode_n2_sm_information(
if (rc.code != RC_OK) {
Logger::smf_app().warn("asn_decode failed with code %d", rc.code);
return RETURNerror;
return RETURNerror ;
}
return RETURNok;
return RETURNok ;
}
......@@ -465,7 +465,7 @@ void session_create_sm_context_procedure::handle_itti_msg(
if (n11_triggered_pending->res.get_cause() == REQUEST_ACCEPTED) {
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();
//N2InfoContent (section 6.1.6.2.27@3GPP TS 29.518)
json_data["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapIeType"] =
......@@ -477,6 +477,15 @@ void session_create_sm_context_procedure::handle_itti_msg(
json_data["n2InfoContainer"]["smInfo"]["sNssai"]["sd"] =
n11_triggered_pending->res.get_snssai().sD;
json_data["n2InfoContainer"]["ranInfo"] = "SM";
//N1N2MsgTxfrFailureNotification
std::string callback_uri = std::string(
inet_ntoa(*((struct in_addr*) &smf_cfg.amf_addr.ipv4_addr))) + ":"
+ std::to_string(smf_cfg.amf_addr.port)
+ fmt::format(NSMF_CALLBACK_N1N2_MESSAGE_TRANSFER_FAILURE,
supi_str.c_str());
json_data["n1n2FailureTxfNotifURI"] = callback_uri.c_str();
//json_data["n1n2FailureTxfNotifURI"] = "http://192.168.122.1/namf-comm/callback/N1N2MsgTxfrFailureNotification/imsi-310410000000001-1";
}
//Others information
//n11_triggered_pending->res.n1n2_message_transfer_data["pti"] = 1; //Don't need this info for the moment
......
......@@ -129,7 +129,7 @@ void create_multipart_related_content(std::string &body, std::string &json_part,
body.append("--" + boundary + CRLF);
body.append(
"Content-Type: application/vnd.3gpp.ngap" + CRLF + "Content-Id: n2SmMsg"
"Content-Type: application/vnd.3gpp.ngap" + CRLF + "Content-Id: n2msg"
+ CRLF);
body.append(CRLF);
body.append(n2_message + CRLF);
......@@ -154,7 +154,7 @@ void create_multipart_related_content(
+ "Content-Id: n1SmMsg" + CRLF);
} else if (content_type == multipart_related_content_part_e::NGAP) { //NGAP
body.append(
"Content-Type: application/vnd.3gpp.ngap" + CRLF + "Content-Id: n2SmMsg"
"Content-Type: application/vnd.3gpp.ngap" + CRLF + "Content-Id: n2msg"
+ CRLF);
}
body.append(CRLF);
......@@ -334,10 +334,10 @@ void send_pdu_session_update_sm_context_establishment(
//Fill the json part
pdu_session_update_request["n2SmInfoType"] = "PDU_RES_SETUP_RSP";
pdu_session_update_request["n2SmInfo"]["contentId"] = "n2SmMsg"; //NGAP
pdu_session_update_request["n2SmInfo"]["contentId"] = "n2msg"; //NGAP
//pdu_session_update_request["n2InfoContainer"]["n2InformationClass"] = "SM";
//pdu_session_update_request["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapData"]["contentId"] = "n2SmMsg";
//pdu_session_update_request["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapData"]["contentId"] = "n2msg";
// pdu_session_update_request["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapIeType"] =
// "PDU_RES_SETUP_RSP"; //NGAP message
......@@ -603,7 +603,7 @@ void send_pdu_session_modification_request_step2(std::string smf_ip_address,
//Fill the json part
pdu_session_modification["n2SmInfoType"] = "PDU_RES_MOD_RSP"; //"PDU_RES_SETUP_RSP"
pdu_session_modification["n2SmInfo"]["contentId"] = "n2SmMsg"; //NGAP
pdu_session_modification["n2SmInfo"]["contentId"] = "n2msg"; //NGAP
std::string body;
std::string boundary = "----Boundary";
......@@ -933,7 +933,7 @@ void send_pdu_session_release_resource_release_ack(std::string smf_ip_address,
//Fill the json part
pdu_session_release_ack["n2SmInfoType"] = "PDU_RES_REL_RSP";
pdu_session_release_ack["n2SmInfo"]["contentId"] = "n2SmMsg"; //NGAP
pdu_session_release_ack["n2SmInfo"]["contentId"] = "n2msg"; //NGAP
std::string body;
std::string boundary = "----Boundary";
......@@ -1253,10 +1253,10 @@ void send_pdu_session_update_sm_context_ue_service_request_step2(
//Fill the json part
service_requests["n2SmInfoType"] = "PDU_RES_SETUP_RSP";
service_requests["n2SmInfo"]["contentId"] = "n2SmMsg"; //NGAP
service_requests["n2SmInfo"]["contentId"] = "n2msg"; //NGAP
//service_requests["n2InfoContainer"]["n2InformationClass"] = "SM";
//service_requests["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapData"]["contentId"] = "n2SmMsg";
//service_requests["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapData"]["contentId"] = "n2msg";
// service_requests["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapIeType"] =
// "PDU_RES_SETUP_RSP"; //NGAP message
......
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