Use F1AP lib for DL RRC Message Transfer in stack
This commit is contained in:
@@ -66,105 +66,27 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t
|
||||
/*
|
||||
DL RRC Message Transfer.
|
||||
*/
|
||||
int CU_send_DL_RRC_MESSAGE_TRANSFER(sctp_assoc_t assoc_id, f1ap_dl_rrc_message_t *f1ap_dl_rrc)
|
||||
int CU_send_DL_RRC_MESSAGE_TRANSFER(sctp_assoc_t assoc_id, f1ap_dl_rrc_message_t *msg)
|
||||
{
|
||||
LOG_D(F1AP, "CU send DL_RRC_MESSAGE_TRANSFER \n");
|
||||
F1AP_F1AP_PDU_t pdu= {0};
|
||||
F1AP_DLRRCMessageTransfer_t *out;
|
||||
uint8_t *buffer=NULL;
|
||||
uint32_t len=0;
|
||||
/* Create */
|
||||
/* 0. Message Type */
|
||||
pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage;
|
||||
asn1cCalloc(pdu.choice.initiatingMessage, tmp);
|
||||
tmp->procedureCode = F1AP_ProcedureCode_id_DLRRCMessageTransfer;
|
||||
tmp->criticality = F1AP_Criticality_ignore;
|
||||
tmp->value.present = F1AP_InitiatingMessage__value_PR_DLRRCMessageTransfer;
|
||||
out = &tmp->value.choice.DLRRCMessageTransfer;
|
||||
/* mandatory */
|
||||
/* c1. GNB_CU_UE_F1AP_ID */
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie1);
|
||||
ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
|
||||
ie1->criticality = F1AP_Criticality_reject;
|
||||
ie1->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
|
||||
DevAssert(f1ap_dl_rrc->gNB_CU_ue_id != 0);
|
||||
ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_dl_rrc->gNB_CU_ue_id;
|
||||
|
||||
/* mandatory */
|
||||
/* c2. GNB_DU_UE_F1AP_ID */
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie2);
|
||||
ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
|
||||
ie2->criticality = F1AP_Criticality_reject;
|
||||
ie2->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
|
||||
DevAssert(f1ap_dl_rrc->gNB_DU_ue_id != 0);
|
||||
ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_dl_rrc->gNB_DU_ue_id;
|
||||
|
||||
/* optional */
|
||||
/* c3. oldgNB_DU_UE_F1AP_ID */
|
||||
if (f1ap_dl_rrc->old_gNB_DU_ue_id != NULL) {
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie3);
|
||||
ie3->id = F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID;
|
||||
ie3->criticality = F1AP_Criticality_reject;
|
||||
ie3->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID_1;
|
||||
ie3->value.choice.GNB_DU_UE_F1AP_ID_1 = *f1ap_dl_rrc->old_gNB_DU_ue_id;
|
||||
}
|
||||
|
||||
/* mandatory */
|
||||
/* c4. SRBID */
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie4);
|
||||
ie4->id = F1AP_ProtocolIE_ID_id_SRBID;
|
||||
ie4->criticality = F1AP_Criticality_reject;
|
||||
ie4->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_SRBID;
|
||||
ie4->value.choice.SRBID = f1ap_dl_rrc->srb_id;
|
||||
|
||||
/* optional */
|
||||
/* c5. ExecuteDuplication */
|
||||
if (f1ap_dl_rrc->execute_duplication) {
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie5);
|
||||
ie5->id = F1AP_ProtocolIE_ID_id_ExecuteDuplication;
|
||||
ie5->criticality = F1AP_Criticality_ignore;
|
||||
ie5->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_ExecuteDuplication;
|
||||
ie5->value.choice.ExecuteDuplication = F1AP_ExecuteDuplication_true;
|
||||
}
|
||||
|
||||
// issue in here
|
||||
/* mandatory */
|
||||
/* c6. RRCContainer */
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie6);
|
||||
ie6->id = F1AP_ProtocolIE_ID_id_RRCContainer;
|
||||
ie6->criticality = F1AP_Criticality_reject;
|
||||
ie6->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RRCContainer;
|
||||
OCTET_STRING_fromBuf(&ie6->value.choice.RRCContainer,
|
||||
(const char *)f1ap_dl_rrc->rrc_container, f1ap_dl_rrc->rrc_container_length);
|
||||
|
||||
/* optional */
|
||||
/* c7. RAT_FrequencyPriorityInformation */
|
||||
/* TODO */
|
||||
if (0) {
|
||||
int endc=1;
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie7);
|
||||
ie7->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation;
|
||||
ie7->criticality = F1AP_Criticality_reject;
|
||||
ie7->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RAT_FrequencyPriorityInformation;
|
||||
|
||||
if (endc==1) {
|
||||
ie7->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_eNDC;
|
||||
ie7->value.choice.RAT_FrequencyPriorityInformation.choice.eNDC = 123L;
|
||||
} else {
|
||||
ie7->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN;
|
||||
ie7->value.choice.RAT_FrequencyPriorityInformation.choice.nGRAN = 11L;
|
||||
}
|
||||
|
||||
//ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority;
|
||||
//ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 123L;
|
||||
}
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 DL RRC MESSAGE TRANSFER \n");
|
||||
/* encode DL RRC Message Transfer */
|
||||
F1AP_F1AP_PDU_t *pdu = encode_dl_rrc_message_transfer(msg);
|
||||
if (pdu == NULL) {
|
||||
LOG_E(F1AP, "Failed to encode F1 DL RRC MESSAGE TRANSFER: can't send message!\n");
|
||||
ASN_STRUCT_FREE(asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* encode F1AP PDU */
|
||||
uint8_t *buffer = NULL;
|
||||
uint32_t len = 0;
|
||||
if (f1ap_encode_pdu(pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 DL RRC MESSAGE TRANSFER \n");
|
||||
ASN_STRUCT_FREE(asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
return -1;
|
||||
}
|
||||
/* Free F1AP PDU */
|
||||
ASN_STRUCT_FREE(asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
/* Send to DU */
|
||||
LOG_D(F1AP, "CU send DL_RRC_MESSAGE_TRANSFER \n");
|
||||
f1ap_itti_send_sctp_data_req(assoc_id, buffer, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -58,85 +58,16 @@
|
||||
/* DL RRC Message Transfer */
|
||||
int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu)
|
||||
{
|
||||
F1AP_DLRRCMessageTransfer_t *container;
|
||||
F1AP_DLRRCMessageTransferIEs_t *ie;
|
||||
int executeDuplication;
|
||||
//uint64_t subscriberProfileIDforRFP;
|
||||
//uint64_t rAT_FrequencySelectionPriority;
|
||||
DevAssert(pdu != NULL);
|
||||
container = &pdu->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
|
||||
/* GNB_CU_UE_F1AP_ID */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
|
||||
uint32_t cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID;
|
||||
/* GNB_DU_UE_F1AP_ID */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
|
||||
uint32_t du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
|
||||
|
||||
/* optional */
|
||||
/* oldgNB_DU_UE_F1AP_ID */
|
||||
uint32_t *old_gNB_DU_ue_id = NULL;
|
||||
uint32_t old_gNB_DU_ue_id_stack = 0;
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID, false);
|
||||
if (ie) {
|
||||
/* strange: it is not named OLD_GNB_DU_UE... */
|
||||
old_gNB_DU_ue_id_stack = ie->value.choice.GNB_DU_UE_F1AP_ID_1;
|
||||
old_gNB_DU_ue_id = &old_gNB_DU_ue_id_stack;
|
||||
f1ap_dl_rrc_message_t msg = {0};
|
||||
if (!decode_dl_rrc_message_transfer(pdu, &msg)) {
|
||||
LOG_E(F1AP, "cannot decode F1 DL RRC message Transfer\n");
|
||||
free_dl_rrc_message_transfer(&msg);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* mandatory */
|
||||
/* SRBID */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_SRBID, true);
|
||||
uint64_t srb_id = ie->value.choice.SRBID;
|
||||
LOG_D(F1AP, "srb_id %lu \n", srb_id);
|
||||
|
||||
/* optional */
|
||||
/* ExecuteDuplication */
|
||||
if (0) {
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_ExecuteDuplication, true);
|
||||
executeDuplication = ie->value.choice.ExecuteDuplication;
|
||||
LOG_D(F1AP, "ExecuteDuplication %d \n", executeDuplication);
|
||||
}
|
||||
|
||||
// issue in here
|
||||
/* mandatory */
|
||||
/* RRC Container */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_RRCContainer, true);
|
||||
/* optional */
|
||||
/* RAT_FrequencyPriorityInformation */
|
||||
if (0) {
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation, true);
|
||||
|
||||
switch(ie->value.choice.RAT_FrequencyPriorityInformation.present) {
|
||||
case F1AP_RAT_FrequencyPriorityInformation_PR_eNDC:
|
||||
//subscriberProfileIDforRFP = ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP;
|
||||
break;
|
||||
|
||||
case F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN:
|
||||
//rAT_FrequencySelectionPriority = ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_W(F1AP, "unhandled IE RAT_FrequencyPriorityInformation.present\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
f1ap_dl_rrc_message_t dl_rrc = {
|
||||
.gNB_CU_ue_id = cu_ue_f1ap_id,
|
||||
.gNB_DU_ue_id = du_ue_f1ap_id,
|
||||
.old_gNB_DU_ue_id = old_gNB_DU_ue_id,
|
||||
.rrc_container_length = ie->value.choice.RRCContainer.size,
|
||||
.rrc_container = ie->value.choice.RRCContainer.buf,
|
||||
.srb_id = srb_id
|
||||
};
|
||||
dl_rrc_message_transfer(&dl_rrc);
|
||||
dl_rrc_message_transfer(&msg);
|
||||
/* Free DL RRC Message Transfer */
|
||||
free_dl_rrc_message_transfer(&msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "mac_rrc_dl.h"
|
||||
#include "nr_rrc_defs.h"
|
||||
#include "openair2/F1AP/lib/f1ap_rrc_message_transfer.h"
|
||||
|
||||
static void f1_reset_cu_initiated_f1ap(sctp_assoc_t assoc_id, const f1ap_reset_t *reset)
|
||||
{
|
||||
@@ -210,18 +211,7 @@ static void dl_rrc_message_transfer_f1ap(sctp_assoc_t assoc_id, const f1ap_dl_rr
|
||||
MessageDef *message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_DL_RRC_MESSAGE);
|
||||
message_p->ittiMsgHeader.originInstance = assoc_id;
|
||||
f1ap_dl_rrc_message_t *msg = &F1AP_DL_RRC_MESSAGE(message_p);
|
||||
*msg = *dl_rrc;
|
||||
if (dl_rrc->old_gNB_DU_ue_id) {
|
||||
msg->old_gNB_DU_ue_id = malloc(sizeof(*msg->old_gNB_DU_ue_id));
|
||||
AssertFatal(msg->old_gNB_DU_ue_id != NULL, "out of memory\n");
|
||||
*msg->old_gNB_DU_ue_id = *dl_rrc->old_gNB_DU_ue_id;
|
||||
}
|
||||
if (dl_rrc->rrc_container) {
|
||||
msg->rrc_container = malloc(dl_rrc->rrc_container_length);
|
||||
AssertFatal(msg->rrc_container != NULL, "out of memory\n");
|
||||
msg->rrc_container_length = dl_rrc->rrc_container_length;
|
||||
memcpy(msg->rrc_container, dl_rrc->rrc_container, dl_rrc->rrc_container_length);
|
||||
}
|
||||
*msg = cp_dl_rrc_message_transfer(dl_rrc);
|
||||
itti_send_msg_to_task (TASK_CU_F1, 0, message_p);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user