diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 517c319e4d69c5fb741c4b0a080f0d5e37a910b9..4564c997944276675692fccc827711b46b340e71 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -128,7 +128,6 @@ void CU_handle_F1_SETUP_REQUEST(instance_t instance, served_celles_item_p = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *)ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])->value.choice.GNB_DU_Served_Cells_Item); /* tac */ - // @issue in here OCTET_STRING_TO_INT16(&(served_celles_item_p->served_Cell_Information.fiveGS_TAC), F1AP_SETUP_REQ(message_p).tac[i]); printf ("F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]); @@ -213,8 +212,11 @@ void CU_handle_F1_SETUP_REQUEST(instance_t instance, // } tdd; // } nr_mode_info[F1AP_MAX_NB_CELLS]; - - itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); + if (num_cells_available < 1) { + itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); + } else { + CU_send_F1_SETUP_FAILURE(instance); + } } void CU_send_F1_SETUP_RESPONSE(instance_t instance, @@ -352,11 +354,86 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, } -void CU_send_F1_SETUP_FAILURE(instance_t instance, - F1AP_F1SetupFailure_t *F1SetupFailure) { - AssertFatal(1==0,"Not implemented yet\n"); - //AssertFatal(1==0,"Not implemented yet\n"); - //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); +void CU_send_F1_SETUP_FAILURE(instance_t instance) { + printf("CU_send_F1_SETUP_FAILURE\n"); + + module_id_t enb_mod_idP; + module_id_t cu_mod_idP; + + enb_mod_idP = (module_id_t)12; + cu_mod_idP = (module_id_t)34; + + F1AP_F1AP_PDU_t pdu; + F1AP_F1SetupFailure_t *out; + F1AP_F1SetupFailureIEs_t *ie; + + uint8_t *buffer; + uint32_t len; + + /* Create */ + /* 0. Message Type */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = F1AP_F1AP_PDU_PR_unsuccessfulOutcome; + pdu.choice.unsuccessfulOutcome = (F1AP_UnsuccessfulOutcome_t *)calloc(1, sizeof(F1AP_UnsuccessfulOutcome_t)); + pdu.choice.unsuccessfulOutcome->procedureCode = F1AP_ProcedureCode_id_F1Setup; + pdu.choice.unsuccessfulOutcome->criticality = F1AP_Criticality_reject; + pdu.choice.unsuccessfulOutcome->value.present = F1AP_UnsuccessfulOutcome__value_PR_F1SetupFailure; + out = &pdu.choice.unsuccessfulOutcome->value.choice.F1SetupFailure; + + /* mandatory */ + /* c1. Transaction ID (integer value)*/ + ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_F1SetupFailureIEs__value_PR_TransactionID; + ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* mandatory */ + /* c2. Cause */ + ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_Cause; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_F1SetupFailureIEs__value_PR_Cause; + ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; + ie->value.choice.Cause.choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + /* c3. TimeToWait */ + if (0) { + ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_TimeToWait; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_F1SetupFailureIEs__value_PR_TimeToWait; + ie->value.choice.TimeToWait = F1AP_TimeToWait_v10s; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + /* c4. CriticalityDiagnostics*/ + if (0) { + ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_F1SetupFailureIEs__value_PR_CriticalityDiagnostics; + ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); + *ie->value.choice.CriticalityDiagnostics.procedureCode = F1AP_ProcedureCode_id_UEContextSetup; + ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); + *ie->value.choice.CriticalityDiagnostics.triggeringMessage = F1AP_TriggeringMessage_initiating_message; + ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); + *ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; + ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); + *ie->value.choice.CriticalityDiagnostics.transactionID = 0; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* encode */ + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { + printf("Failed to encode F1 setup request\n"); + } + + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); } @@ -756,12 +833,7 @@ void CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod return; } - printf("\n"); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); - } + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); } void CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, diff --git a/openair2/F1AP/f1ap_cu_interface_management.h b/openair2/F1AP/f1ap_cu_interface_management.h index 8b4b88dc4e691ad74825e322e8787c99504bcde5..9902d1a58f232ecb53a06444d552b11a507bef00 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.h +++ b/openair2/F1AP/f1ap_cu_interface_management.h @@ -57,7 +57,7 @@ void CU_handle_F1_SETUP_REQUEST(instance_t instance, void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp); -void CU_send_F1_SETUP_FAILURE(instance_t instance, F1AP_F1SetupFailure_t *F1SetupFailure); +void CU_send_F1_SETUP_FAILURE(instance_t instance); /* * gNB-DU Configuration Update diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 82e2ab0f01e02d4a0425df04217d0e227bc1c118..dfcd6048a34c61d9b86fb3d7ec315bdef235759b 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -312,8 +312,13 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, } // SETUP FAILURE -void DU_handle_F1_SETUP_FAILURE(instance_t instance, F1AP_F1AP_PDU_t *pdu_p) { - AssertFatal(1==0,"Not implemented yet\n"); +int DU_handle_F1_SETUP_FAILURE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) +{ + LOG_E(DU_F1AP, "DU_handle_F1_SETUP_FAILURE\n"); + return 0; } diff --git a/openair2/F1AP/f1ap_du_interface_management.h b/openair2/F1AP/f1ap_du_interface_management.h index 7e925b0b9746a17383162ac3af989b36ebd4be8b..1c23ad987facf05e26d9bfff3ae78740f2868097 100644 --- a/openair2/F1AP/f1ap_du_interface_management.h +++ b/openair2/F1AP/f1ap_du_interface_management.h @@ -58,7 +58,10 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -void DU_handle_F1_SETUP_FAILURE(instance_t instance, F1AP_F1AP_PDU_t *pdu_p); +int DU_handle_F1_SETUP_FAILURE(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * gNB-DU Configuration Update diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 62b1f3226e661daaaaac3aeb4a412f10ee67d606..068fdf584967080a5bdfaf9ea87fe753cf202901 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -43,19 +43,19 @@ f1ap_message_decoded_callback f1ap_messages_callback[][3] = { { 0, 0, 0 }, /* Reset */ - { CU_handle_F1_SETUP_REQUEST, DU_handle_F1_SETUP_RESPONSE, 0 }, /* F1Setup */ + { CU_handle_F1_SETUP_REQUEST, DU_handle_F1_SETUP_RESPONSE, DU_handle_F1_SETUP_FAILURE }, /* F1Setup */ { 0, 0, 0 }, /* ErrorIndication */ - { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* gNBDUConfigurationUpdate */ - { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* gNBCUConfigurationUpdate */ - { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* UEContextSetup */ + { 0, 0, 0 }, /* gNBDUConfigurationUpdate */ + { 0, 0, 0 }, /* gNBCUConfigurationUpdate */ + { 0, 0, 0 }, /* UEContextSetup */ { 0, 0, 0 }, /* UEContextRelease */ - { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* UEContextModification */ + { 0, 0, 0 }, /* UEContextModification */ { 0, 0, 0 }, /* UEContextModificationRequired */ { 0, 0, 0 }, /* UEMobilityCommand */ { 0, 0, 0 }, /* UEContextReleaseRequest */ { CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER, 0, 0 }, /* InitialULRRCMessageTransfer */ - { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* DLRRCMessageTransfer */ - { CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* ULRRCMessageTransfer */ + { 0, 0, 0 }, /* DLRRCMessageTransfer */ + { 0, 0, 0 }, /* ULRRCMessageTransfer */ { 0, 0, 0 }, /* privateMessage */ { 0, 0, 0 }, /* UEInactivityNotification */ { 0, 0, 0 }, /* GNBDUResourceCoordination */