Commit 40420fef authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Support Handover preparation failure

parent 00741728
...@@ -169,7 +169,8 @@ void amf_n2_task(void* args_p) { ...@@ -169,7 +169,8 @@ void amf_n2_task(void* args_p) {
case HANDOVER_REQUIRED: { case HANDOVER_REQUIRED: {
Logger::amf_n2().info("Received HANDOVER_REQUIRED message,handling"); Logger::amf_n2().info("Received HANDOVER_REQUIRED message,handling");
itti_handover_required* m = dynamic_cast<itti_handover_required*>(msg); itti_handover_required* m = dynamic_cast<itti_handover_required*>(msg);
amf_n2_inst->handle_itti_message(ref(*m)); if (!amf_n2_inst->handle_itti_message(ref(*m)))
amf_n2_inst->send_handover_preparation_failure(m->assoc_id);
} break; } break;
case HANDOVER_REQUEST_ACK: { case HANDOVER_REQUEST_ACK: {
Logger::amf_n2().info("Received HANDOVER_REQUEST_ACK message,handling"); Logger::amf_n2().info("Received HANDOVER_REQUEST_ACK message,handling");
...@@ -1041,7 +1042,7 @@ void amf_n2::handle_itti_message( ...@@ -1041,7 +1042,7 @@ void amf_n2::handle_itti_message(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { bool amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
// TODO: Experimental procedure, to be tested // TODO: Experimental procedure, to be tested
unsigned long amf_ue_ngap_id = itti_msg.handoverReq->getAmfUeNgapId(); unsigned long amf_ue_ngap_id = itti_msg.handoverReq->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = itti_msg.handoverReq->getRanUeNgapId(); uint32_t ran_ue_ngap_id = itti_msg.handoverReq->getRanUeNgapId();
...@@ -1050,7 +1051,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1050,7 +1051,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
if (!is_assoc_id_2_gnb_context(itti_msg.assoc_id)) { if (!is_assoc_id_2_gnb_context(itti_msg.assoc_id)) {
Logger::amf_n2().error( Logger::amf_n2().error(
"gNB with assoc_id (%d) is illegal", itti_msg.assoc_id); "gNB with assoc_id (%d) is illegal", itti_msg.assoc_id);
return; return false;
} }
gc = assoc_id_2_gnb_context(itti_msg.assoc_id); gc = assoc_id_2_gnb_context(itti_msg.assoc_id);
...@@ -1058,34 +1059,32 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1058,34 +1059,32 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
if (!is_ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id)) { if (!is_ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id)) {
Logger::amf_n2().error( Logger::amf_n2().error(
"No UE NGAP context with ran_ue_ngap_id (0x%x)", ran_ue_ngap_id); "No UE NGAP context with ran_ue_ngap_id (0x%x)", ran_ue_ngap_id);
return; return false;
} }
unc = ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id); unc = ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id);
unc.get()->gnb_assoc_id = itti_msg.assoc_id;
unc.get()->ncc++;
unc.get()->ng_ue_state = NGAP_UE_HANDOVER;
if (unc.get()->amf_ue_ngap_id != amf_ue_ngap_id) { if (unc.get()->amf_ue_ngap_id != amf_ue_ngap_id) {
Logger::amf_n2().error( Logger::amf_n2().error(
"The requested UE (amf_ue_ngap_id:0x%x) is not valid, existed UE " "The requested UE (amf_ue_ngap_id:0x%x) is not valid, existed UE "
"with amf_ue_ngap_id (0x%x)", "with amf_ue_ngap_id (0x%x)",
amf_ue_ngap_id, unc.get()->amf_ue_ngap_id); amf_ue_ngap_id, unc.get()->amf_ue_ngap_id);
return false;
} }
if (itti_msg.handoverReq->getHandoverType() != Ngap_HandoverType_intra5gs) { if (itti_msg.handoverReq->getHandoverType() != Ngap_HandoverType_intra5gs) {
Logger::amf_n2().error("Handover Type is not supported"); Logger::amf_n2().error("Handover Type is not supported");
return; return false;
} }
if (itti_msg.handoverReq->getChoiceOfCause() != Ngap_Cause_PR_radioNetwork) { if (itti_msg.handoverReq->getChoiceOfCause() != Ngap_Cause_PR_radioNetwork) {
Logger::amf_n2().error("CHOICE Cause Group is not supported"); Logger::amf_n2().error("CHOICE Cause Group is not supported");
return; return false;
} }
if (itti_msg.handoverReq->getCauseValue() != if (itti_msg.handoverReq->getCauseValue() !=
Ngap_CauseRadioNetwork_handover_desirable_for_radio_reason) { Ngap_CauseRadioNetwork_handover_desirable_for_radio_reason) {
Logger::amf_n2().error("Radio Network Layer Cause is not supported"); Logger::amf_n2().error("Radio Network Layer Cause is not supported");
return; return false;
} }
if (itti_msg.handoverReq->getDirectForwardingPathAvailability() != if (itti_msg.handoverReq->getDirectForwardingPathAvailability() !=
...@@ -1093,15 +1092,20 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1093,15 +1092,20 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
Logger::amf_n2().error( Logger::amf_n2().error(
"DirectForwardingPathAvailability must be " "DirectForwardingPathAvailability must be "
"Ngap_DirectForwardingPathAvailability_direct_path_available!"); "Ngap_DirectForwardingPathAvailability_direct_path_available!");
return; return false;
} }
unc.get()->gnb_assoc_id = itti_msg.assoc_id;
unc.get()->ncc++;
unc.get()->ng_ue_state = NGAP_UE_HANDOVER;
GlobalgNBId* TargetGlobalgNBId = new GlobalgNBId(); GlobalgNBId* TargetGlobalgNBId = new GlobalgNBId();
itti_msg.handoverReq->getGlobalRanNodeId(TargetGlobalgNBId); itti_msg.handoverReq->getGlobalRanNodeId(TargetGlobalgNBId);
PlmnId* plmn = new PlmnId(); PlmnId* plmn = new PlmnId();
GNB_ID* gnbid = new GNB_ID(); GNB_ID* gnbid = new GNB_ID();
TargetGlobalgNBId->getGlobalgNBId(plmn, gnbid); TargetGlobalgNBId->getGlobalgNBId(plmn, gnbid);
string mcc, mnc; std::string mcc = {};
std::string mnc = {};
plmn->getMcc(mcc); plmn->getMcc(mcc);
plmn->getMnc(mnc); plmn->getMnc(mnc);
...@@ -1126,7 +1130,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1126,7 +1130,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
if (!itti_msg.handoverReq->getPDUSessionResourceList(List_HORqd)) { if (!itti_msg.handoverReq->getPDUSessionResourceList(List_HORqd)) {
Logger::ngap().error( Logger::ngap().error(
"Decoding HandoverRequiredMsg getPDUSessionResourceList IE error"); "Decoding HandoverRequiredMsg getPDUSessionResourceList IE error");
return; return false;
} }
OCTET_STRING_t sourceTotarget; OCTET_STRING_t sourceTotarget;
...@@ -1225,6 +1229,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1225,6 +1229,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
gc_target = gnb_id_2_gnb_context(gnbid->getValue()); gc_target = gnb_id_2_gnb_context(gnbid->getValue());
unc.get()->target_gnb_assoc_id = gc_target.get()->sctp_assoc_id; unc.get()->target_gnb_assoc_id = gc_target.get()->sctp_assoc_id;
sctp_s_38412.sctp_send_msg(gc_target.get()->sctp_assoc_id, 0, &b); sctp_s_38412.sctp_send_msg(gc_target.get()->sctp_assoc_id, 0, &b);
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -1510,6 +1515,13 @@ void amf_n2::handle_itti_message(itti_uplinkranstatsutransfer& itti_msg) { ...@@ -1510,6 +1515,13 @@ void amf_n2::handle_itti_message(itti_uplinkranstatsutransfer& itti_msg) {
sctp_s_38412.sctp_send_msg(unc.get()->target_gnb_assoc_id, 0, &b); sctp_s_38412.sctp_send_msg(unc.get()->target_gnb_assoc_id, 0, &b);
} }
//------------------------------------------------------------------------------
void amf_n2::send_handover_preparation_failure(
const sctp_assoc_id_t& gnb_assoc_id) {
// TODO:
return;
}
// Context management functions // Context management functions
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool amf_n2::is_ran_ue_id_2_ue_ngap_context( bool amf_n2::is_ran_ue_id_2_ue_ngap_context(
......
...@@ -58,10 +58,11 @@ class amf_n2 : public ngap::ngap_app { ...@@ -58,10 +58,11 @@ class amf_n2 : public ngap::ngap_app {
void handle_itti_message(itti_ue_radio_capability_indication& itti_msg); void handle_itti_message(itti_ue_radio_capability_indication& itti_msg);
void handle_itti_message(itti_ue_context_release_command& itti_msg); void handle_itti_message(itti_ue_context_release_command& itti_msg);
void handle_itti_message(itti_pdu_session_resource_release_command& itti_msg); void handle_itti_message(itti_pdu_session_resource_release_command& itti_msg);
void handle_itti_message(itti_handover_required& itti_msg); bool handle_itti_message(itti_handover_required& itti_msg);
void handle_itti_message(itti_handover_request_Ack& itti_msg); void handle_itti_message(itti_handover_request_Ack& itti_msg);
void handle_itti_message(itti_handover_notify& itti_msg); void handle_itti_message(itti_handover_notify& itti_msg);
void handle_itti_message(itti_uplinkranstatsutransfer& itti_msg); void handle_itti_message(itti_uplinkranstatsutransfer& itti_msg);
void send_handover_preparation_failure(const sctp_assoc_id_t& gnb_assoc_id);
bool verifyPlmn(std::vector<SupportedItem_t> list); bool verifyPlmn(std::vector<SupportedItem_t> list);
std::vector<SupportedItem_t> get_common_plmn( std::vector<SupportedItem_t> get_common_plmn(
......
...@@ -959,8 +959,7 @@ ngap_message_decoded_callback messages_callback[][3] = { ...@@ -959,8 +959,7 @@ ngap_message_decoded_callback messages_callback[][3] = {
{overload_stop, overload_stop, overload_stop}, /*OverloadStop*/ {overload_stop, overload_stop, overload_stop}, /*OverloadStop*/
{paging, paging, paging}, /*Paging*/ {paging, paging, paging}, /*Paging*/
{ngap_amf_handle_path_switch_request, ngap_amf_handle_path_switch_request, {ngap_amf_handle_path_switch_request, ngap_amf_handle_path_switch_request,
ngap_amf_handle_path_switch_request}, //{ngap_amf_handle_path_switch_request,0,0}, ngap_amf_handle_path_switch_request}, /*PathSwitchRequest*/
///*PathSwitchRequest*
{pdu_session_resource_modify, pdu_session_resource_modify, {pdu_session_resource_modify, pdu_session_resource_modify,
pdu_session_resource_modify}, /*PDUSessionResourceModify*/ pdu_session_resource_modify}, /*PDUSessionResourceModify*/
{pdu_session_resource_modify_indication, {pdu_session_resource_modify_indication,
......
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