Commit 94c62c39 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix issue with HO State

parent bdf89837
...@@ -211,23 +211,26 @@ void amf_n11::handle_itti_message( ...@@ -211,23 +211,26 @@ void amf_n11::handle_itti_message(
Logger::amf_n11().debug("SMF URI: %s", remote_uri.c_str()); Logger::amf_n11().debug("SMF URI: %s", remote_uri.c_str());
nlohmann::json pdu_session_update_request = {}; nlohmann::json pdu_session_update_request = {};
// if (itti_msg.is_n2sm_set){ if (itti_msg.is_n2sm_set) {
pdu_session_update_request["n2SmInfoType"] = itti_msg.n2sm_info_type; pdu_session_update_request["n2SmInfoType"] = itti_msg.n2sm_info_type;
pdu_session_update_request["n2SmInfo"]["contentId"] = "n2msg"; pdu_session_update_request["n2SmInfo"]["contentId"] = "n2msg";
std::string json_part = pdu_session_update_request.dump(); }
std::string n2SmMsg = {};
octet_stream_2_hex_stream(
(uint8_t*) bdata(itti_msg.n2sm), blength(itti_msg.n2sm), n2SmMsg);
// For N2 HO // For N2 HO
if (itti_msg.n2sm_info_type.compare("HANDOVER_REQUIRED") == 0) { if (itti_msg.ho_state.compare("PREPARING") == 0) {
pdu_session_update_request["hoState"] = "PREPARING"; pdu_session_update_request["hoState"] = "PREPARING";
} else if (itti_msg.n2sm_info_type.compare("HANDOVER_REQ_ACK") == 0) { } else if (itti_msg.ho_state.compare("PREPARED") == 0) {
pdu_session_update_request["hoState"] = "PREPARED"; pdu_session_update_request["hoState"] = "PREPARED";
} else if (itti_msg.n2sm_info_type.compare("SECONDARY_RAT_USAGE") == 0) { } else if (itti_msg.ho_state.compare("COMPLETED") == 0) {
pdu_session_update_request["hoState"] = "COMPLETED"; pdu_session_update_request["hoState"] = "COMPLETED";
} }
std::string json_part = pdu_session_update_request.dump();
std::string n2SmMsg = {};
octet_stream_2_hex_stream(
(uint8_t*) bdata(itti_msg.n2sm), blength(itti_msg.n2sm), n2SmMsg);
curl_http_client( curl_http_client(
remote_uri, json_part, "", n2SmMsg, supi, itti_msg.pdu_session_id, remote_uri, json_part, "", n2SmMsg, supi, itti_msg.pdu_session_id,
itti_msg.promise_id); itti_msg.promise_id);
......
...@@ -1333,6 +1333,7 @@ bool amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1333,6 +1333,7 @@ bool amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
pdu_session_resource.HandoverRequiredTransfer.size); pdu_session_resource.HandoverRequiredTransfer.size);
itti_msg->is_n2sm_set = true; itti_msg->is_n2sm_set = true;
itti_msg->n2sm_info_type = "HANDOVER_REQUIRED"; itti_msg->n2sm_info_type = "HANDOVER_REQUIRED";
itti_msg->ho_state = "PREPARING";
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id; itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id; itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->promise_id = promise_id; itti_msg->promise_id = promise_id;
...@@ -1512,6 +1513,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) { ...@@ -1512,6 +1513,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
pdu_session_resource.handoverRequestAcknowledgeTransfer.size); pdu_session_resource.handoverRequestAcknowledgeTransfer.size);
itti_msg->is_n2sm_set = true; itti_msg->is_n2sm_set = true;
itti_msg->n2sm_info_type = "HANDOVER_REQ_ACK"; itti_msg->n2sm_info_type = "HANDOVER_REQ_ACK";
itti_msg->ho_state = "PREPARED";
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id; itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id; itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->promise_id = promise_id; itti_msg->promise_id = promise_id;
...@@ -1621,7 +1623,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) { ...@@ -1621,7 +1623,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) { void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
// TODO: Experimental procedure, to be tested // TODO: Experimental procedure, to be tested
Logger::amf_n2().debug("Handling Handover Notify ..."); Logger::amf_n2().info("Handle Handover Notify ...");
unsigned long amf_ue_ngap_id = itti_msg.handovernotify->getAmfUeNgapId(); unsigned long amf_ue_ngap_id = itti_msg.handovernotify->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = itti_msg.handovernotify->getRanUeNgapId(); uint32_t ran_ue_ngap_id = itti_msg.handovernotify->getRanUeNgapId();
Logger::amf_n2().debug( Logger::amf_n2().debug(
...@@ -1661,6 +1663,7 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) { ...@@ -1661,6 +1663,7 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
std::vector<std::shared_ptr<pdu_session_context>> sessions_ctx; std::vector<std::shared_ptr<pdu_session_context>> sessions_ctx;
if (!amf_app_inst->get_pdu_sessions_context(supi, sessions_ctx)) { if (!amf_app_inst->get_pdu_sessions_context(supi, sessions_ctx)) {
Logger::amf_n2().debug("No PDU Session Context found");
} }
// Send PDUSessionUpdateSMContextRequest to SMF for accepted PDU sessions // Send PDUSessionUpdateSMContextRequest to SMF for accepted PDU sessions
...@@ -1682,26 +1685,28 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) { ...@@ -1682,26 +1685,28 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
Logger::amf_n2().debug( Logger::amf_n2().debug(
"Sending ITTI to trigger PDUSessionUpdateSMContextRequest to SMF to " "Sending ITTI to trigger PDUSessionUpdateSMContextRequest to SMF to "
"task TASK_AMF_N11"); "task TASK_AMF_N11");
itti_nsmf_pdusession_update_sm_context* itti_msg =
new itti_nsmf_pdusession_update_sm_context(TASK_NGAP, TASK_AMF_N11); std::shared_ptr<itti_nsmf_pdusession_update_sm_context> itti_n11_msg =
itti_msg->pdu_session_id = pdu_session.get()->pdu_session_id; std::make_shared<itti_nsmf_pdusession_update_sm_context>(
TASK_NGAP, TASK_AMF_N11);
itti_n11_msg->pdu_session_id = pdu_session.get()->pdu_session_id;
// TODO: Secondary RAT Usage // TODO: Secondary RAT Usage
itti_msg->n2sm = blk2bstr("", 0); // itti_n11_msg->n2sm = blk2bstr("Secondary RAT Usage", 19);
itti_msg->is_n2sm_set = true; // itti_n11_msg->n2sm_info_type = "SECONDARY_RAT_USAGE";
itti_msg->n2sm_info_type = "SECONDARY_RAT_USAGE"; itti_n11_msg->is_n2sm_set = false;
itti_n11_msg->ho_state = "COMPLETED";
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id; itti_n11_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id; itti_n11_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->promise_id = promise_id; itti_n11_msg->promise_id = promise_id;
std::shared_ptr<itti_nsmf_pdusession_update_sm_context> i = int ret = itti_inst->send_msg(itti_n11_msg);
std::shared_ptr<itti_nsmf_pdusession_update_sm_context>(itti_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) { if (0 != ret) {
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N11", "Could not send ITTI message %s to task TASK_AMF_N11",
i->get_msg_name()); itti_n11_msg->get_msg_name());
} }
} }
} }
...@@ -1732,6 +1737,7 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) { ...@@ -1732,6 +1737,7 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
} }
// Send UE Release Command to Source gNB // Send UE Release Command to Source gNB
Logger::ngap().info("Send UE Release Command to source gNB");
std::unique_ptr<UEContextReleaseCommandMsg> ueContextReleaseCommand = std::unique_ptr<UEContextReleaseCommandMsg> ueContextReleaseCommand =
std::make_unique<UEContextReleaseCommandMsg>(); std::make_unique<UEContextReleaseCommandMsg>();
ueContextReleaseCommand->setMessageType(); ueContextReleaseCommand->setMessageType();
......
...@@ -105,6 +105,7 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 { ...@@ -105,6 +105,7 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
uint32_t ran_ue_ngap_id; uint32_t ran_ue_ngap_id;
long amf_ue_ngap_id; long amf_ue_ngap_id;
uint32_t promise_id; uint32_t promise_id;
std::string ho_state;
}; };
class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 { class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 {
......
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