Commit 0b816634 authored by Raymond Knopp's avatar Raymond Knopp

Merge branch 'feature-127-protocol-split' of...

Merge branch 'feature-127-protocol-split' of https://gitlab.eurecom.fr/oai/openairinterface5g into feature-127-protocol-split

Conflicts:
	openair2/F1AP/f1ap_du_rrc_message_transfer.c
parents de205def d9661177
......@@ -211,6 +211,7 @@ typedef struct f1ap_dl_rrc_message_s {
uint32_t gNB_CU_ue_id;
uint32_t gNB_DU_ue_id;
uint32_t old_gNB_DU_ue_id;
uint16_t rnti;
uint8_t srb_id;
uint8_t execute_duplication;
uint8_t *rrc_container;
......
......@@ -209,9 +209,160 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_
return transaction_identifier[enb_mod_idP+cu_mod_idP];
}
uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) {
static uint8_t UE_identifier[NUMBER_OF_eNB_MAX];
module_id_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) {
static module_id_t UE_identifier[NUMBER_OF_eNB_MAX];
UE_identifier[enb_mod_idP+CC_idP+UE_id] = (UE_identifier[enb_mod_idP+CC_idP+UE_id] + 1) % F1AP_UE_IDENTIFIER_NUMBER;
//LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+du_mod_idP]);
return UE_identifier[enb_mod_idP+CC_idP+UE_id];
}
int f1ap_add_ue(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t module_idP,
int CC_idP,
int UE_id,
rnti_t rntiP){
int i;
for (i=0; i < MAX_MOBILES_PER_ENB; i++){
if (f1_ue_inst->rnti[i] == rntiP) {
f1_ue_inst->f1ap_uid[i] = i;
f1_ue_inst->mac_uid[i] = UE_id;
LOG_I(F1AP, "Updating the index of UE with RNTI %x and du_ue_f1ap_id %d\n", f1_ue_inst->rnti[i], f1_ue_inst->du_ue_f1ap_id[i]);
return i;
}
}
for (i=0; i < MAX_MOBILES_PER_ENB ; i++){
if (f1_ue_inst->rnti[i] == 0 ){
f1_ue_inst->rnti[i]=rntiP;
f1_ue_inst->f1ap_uid[i]=i;
f1_ue_inst->mac_uid[i]=UE_id;
f1_ue_inst->du_ue_f1ap_id[i] = F1AP_get_UE_identifier(module_idP, CC_idP, i);
f1_ue_inst->cu_ue_f1ap_id[i] = F1AP_get_UE_identifier(module_idP, CC_idP, i);
f1_ue_inst->num_ues++;
LOG_I(F1AP, "Adding a new UE with RNTI %x and cu/du ue_f1ap_id %d\n", f1_ue_inst->rnti[i], f1_ue_inst->du_ue_f1ap_id[i]);
return i;
}
}
return -1;
}
int f1ap_remove_ue(f1ap_cudu_ue_inst_t *f1_ue_inst,
rnti_t rntiP){
int i;
for (i=0; i < MAX_MOBILES_PER_ENB; i++){
if (f1_ue_inst->rnti[i] == rntiP) {
f1_ue_inst->rnti[i] = 0;
break;
}
}
return 0 ;
}
int f1ap_get_du_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst,
rnti_t rntiP){
int i;
for (i=0; i < MAX_MOBILES_PER_ENB; i++){
if (f1_ue_inst->rnti[i] == rntiP) {
return f1_ue_inst->du_ue_f1ap_id[i];
}
}
return -1;
}
int f1ap_get_cu_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst,
rnti_t rntiP){
int i;
for (i=0; i < MAX_MOBILES_PER_ENB; i++){
if (f1_ue_inst->rnti[i] == rntiP) {
return f1_ue_inst->cu_ue_f1ap_id[i];
}
}
return -1;
}
int f1ap_get_rnti_by_du_id(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t du_ue_f1ap_id ){
int i;
for (i=0; i < MAX_MOBILES_PER_ENB; i++){
if (f1_ue_inst->du_ue_f1ap_id[i] == du_ue_f1ap_id) {
return f1_ue_inst->rnti[i];
}
}
return -1;
}
int f1ap_get_rnti_by_cu_id(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t cu_ue_f1ap_id ){
int i;
for (i=0; i < MAX_MOBILES_PER_ENB; i++){
if (f1_ue_inst->cu_ue_f1ap_id[i] == cu_ue_f1ap_id) {
return f1_ue_inst->rnti[i];
}
}
return -1;
}
int f1ap_get_du_uid(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t du_ue_f1ap_id ){
int i;
for (i=0; i < MAX_MOBILES_PER_ENB; i++){
if (f1_ue_inst->du_ue_f1ap_id[i] == du_ue_f1ap_id) {
return i;
}
}
return -1;
}
int f1ap_get_cu_uid(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t cu_ue_f1ap_id ){
int i;
for (i=0; i < MAX_MOBILES_PER_ENB; i++){
if (f1_ue_inst->cu_ue_f1ap_id[i] == cu_ue_f1ap_id) {
return i;
}
}
return -1;
}
int f1ap_get_uid_by_rnti(f1ap_cudu_ue_inst_t *f1_ue_inst,
rnti_t rntiP ){
int i;
for (i=0; i < MAX_MOBILES_PER_ENB; i++){
if (f1_ue_inst->rnti[i] == rntiP) {
return i;
}
}
return -1;
}
int f1ap_du_add_cu_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t du_ue_f1ap_id,
module_id_t cu_ue_f1ap_id){
module_id_t f1ap_uid = f1ap_get_du_uid(f1_ue_inst,du_ue_f1ap_id);
if (f1ap_uid < 0 )
return -1 ;
f1_ue_inst->cu_ue_f1ap_id[f1ap_uid]=cu_ue_f1ap_id;
LOG_I(F1AP, "Adding cu_ue_f1ap_id %d for UE with RNTI %x \n", cu_ue_f1ap_id, f1_ue_inst->rnti[f1ap_uid]);
return 0 ;
}
int f1ap_cu_add_du_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t cu_ue_f1ap_id,
module_id_t du_ue_f1ap_id){
module_id_t f1ap_uid = f1ap_get_cu_uid(f1_ue_inst,cu_ue_f1ap_id);
if (f1ap_uid < 0 )
return -1 ;
f1_ue_inst->du_ue_f1ap_id[f1ap_uid]=du_ue_f1ap_id;
LOG_I(F1AP, "Adding du_ue_f1ap_id %d for UE with RNTI %x \n", du_ue_f1ap_id, f1_ue_inst->rnti[f1ap_uid]);
return 0 ;
}
\ No newline at end of file
......@@ -425,8 +425,67 @@ typedef int (*f1ap_message_decoded_callback)(
F1AP_F1AP_PDU_t *message_p
);
// instance and module_id are assumed to be the same
typedef struct f1ap_cudu_ue_inst_s {
// used for eNB stats generation
rnti_t rnti[MAX_MOBILES_PER_ENB];
module_id_t f1ap_uid[MAX_MOBILES_PER_ENB];
module_id_t mac_uid[MAX_MOBILES_PER_ENB];
module_id_t du_ue_f1ap_id[MAX_MOBILES_PER_ENB];
module_id_t cu_ue_f1ap_id[MAX_MOBILES_PER_ENB];
uint16_t num_ues;
} f1ap_cudu_ue_inst_t;
uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP);
uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id);
module_id_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id);
int f1ap_add_ue(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t module_idP,
int CC_idP,
int UE_id,
rnti_t rntiP);
int f1ap_remove_ue(f1ap_cudu_ue_inst_t *f1_ue_inst,
rnti_t rntiP);
int f1ap_get_du_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst,
rnti_t rntiP);
int f1ap_get_cu_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst,
rnti_t rntiP);
//rnti
int f1ap_get_rnti_by_du_id(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t du_ue_f1ap_id );
int f1ap_get_rnti_by_cu_id(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t cu_ue_f1ap_id );
int f1ap_get_du_uid(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t du_ue_f1ap_id );
int f1ap_get_cu_uid(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t cu_ue_f1ap_id );
int f1ap_get_uid_by_rnti(f1ap_cudu_ue_inst_t *f1_ue_inst,
rnti_t rntiP );
int f1ap_du_add_cu_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t du_ue_f1ap_id,
module_id_t cu_ue_f1ap_id);
int f1ap_cu_add_du_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst,
module_id_t cu_ue_f1ap_id,
module_id_t du_ue_f1ap_id);
#endif /* F1AP_COMMON_H_ */
......@@ -84,7 +84,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu)
{
printf("CU_handle_F1_SETUP_REQUEST\n");
LOG_D(CU_F1AP, "CU_handle_F1_SETUP_REQUEST\n");
MessageDef *message_p;
F1AP_F1SetupRequest_t *container;
......@@ -112,7 +112,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_ID, true);
asn_INTEGER2ulong(&ie->value.choice.GNB_DU_ID, &F1AP_SETUP_REQ(message_p).gNB_DU_id);
printf("F1AP_SETUP_REQ(message_p).gNB_DU_id %lu \n", F1AP_SETUP_REQ(message_p).gNB_DU_id);
LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).gNB_DU_id %lu \n", F1AP_SETUP_REQ(message_p).gNB_DU_id);
/* gNB_DU_name */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container,
......@@ -122,13 +122,13 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
ie->value.choice.GNB_DU_Name.size);
/* Convert the mme name to a printable string */
F1AP_SETUP_REQ(message_p).gNB_DU_name[ie->value.choice.GNB_DU_Name.size] = '\0';
printf ("F1AP_SETUP_REQ(message_p).gNB_DU_name %s \n", F1AP_SETUP_REQ(message_p).gNB_DU_name);
LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).gNB_DU_name %s \n", F1AP_SETUP_REQ(message_p).gNB_DU_name);
/* GNB_DU_Served_Cells_List */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List, true);
F1AP_SETUP_REQ(message_p).num_cells_available = ie->value.choice.GNB_DU_Served_Cells_List.list.count;
printf ("F1AP_SETUP_REQ(message_p).num_cells_available %d \n", F1AP_SETUP_REQ(message_p).num_cells_available);
LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).num_cells_available %d \n", F1AP_SETUP_REQ(message_p).num_cells_available);
int num_cells_available = F1AP_SETUP_REQ(message_p).num_cells_available;
......@@ -139,7 +139,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
/* tac */
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]);
LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]);
/* - nRCGI */
TBCD_TO_MCC_MNC(&(served_celles_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i],
......@@ -150,11 +150,11 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
// NR cellID
BIT_STRING_TO_NR_CELL_IDENTITY(&served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity,
F1AP_SETUP_REQ(message_p).nr_cellid[i]);
printf("[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %d\n", assoc_id,
LOG_D(CU_F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %d\n", assoc_id,
F1AP_SETUP_REQ(message_p).mcc[i],
F1AP_SETUP_REQ(message_p).mnc[i],
F1AP_SETUP_REQ(message_p).nr_cellid[i]);
printf("nr_cellId : %x %x %x %x %x\n",
LOG_D(CU_F1AP, "nr_cellId : %x %x %x %x %x\n",
served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[0],
served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[1],
served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[2],
......@@ -162,7 +162,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[4]);
/* - nRPCI */
F1AP_SETUP_REQ(message_p).nr_pci[i] = served_celles_item_p->served_Cell_Information.nRPCI;
printf ("F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", i, F1AP_SETUP_REQ(message_p).nr_pci[i]);
LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", i, F1AP_SETUP_REQ(message_p).nr_pci[i]);
// System Information
/* mib */
......@@ -172,7 +172,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
/* Convert the mme name to a printable string */
F1AP_SETUP_REQ(message_p).mib[i][served_celles_item_p->gNB_DU_System_Information->mIB_message.size] = '\0';
F1AP_SETUP_REQ(message_p).mib_length[i] = served_celles_item_p->gNB_DU_System_Information->mIB_message.size;
printf ("F1AP_SETUP_REQ(message_p).mib[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).mib[i], F1AP_SETUP_REQ(message_p).mib_length[i]);
LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).mib[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).mib[i], F1AP_SETUP_REQ(message_p).mib_length[i]);
/* sib1 */
F1AP_SETUP_REQ(message_p).sib1[i] = calloc(served_celles_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char));
......@@ -181,7 +181,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
/* Convert the mme name to a printable string */
F1AP_SETUP_REQ(message_p).sib1[i][served_celles_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0';
F1AP_SETUP_REQ(message_p).sib1_length[i] = served_celles_item_p->gNB_DU_System_Information->sIB1_message.size;
printf ("F1AP_SETUP_REQ(message_p).sib1[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).sib1[i], F1AP_SETUP_REQ(message_p).sib1_length[i]);
LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).sib1[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).sib1[i], F1AP_SETUP_REQ(message_p).sib1_length[i]);
}
......@@ -294,7 +294,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance,
ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List;
int num_cells_to_activate = f1ap_setup_resp->num_cells_to_activate;
printf("num_cells_to_activate = %d \n", num_cells_to_activate);
LOG_D(CU_F1AP, "num_cells_to_activate = %d \n", num_cells_to_activate);
for (i=0;
i<num_cells_to_activate;
i++) {
......@@ -335,13 +335,13 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance,
F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t));
printf("SI %d: ");
for (int n=0;n<f1ap_setup_resp->SI_container_length[i][0];n++) printf("%2x ",f1ap_setup_resp->SI_container[i][0][n]);
printf("\n");
LOG_D(CU_F1AP, "SI %d: ");
for (int n=0;n<f1ap_setup_resp->SI_container_length[i][0];n++) LOG_D(CU_F1AP, "%2x ",f1ap_setup_resp->SI_container[i][0][n]);
LOG_D(CU_F1AP, "\n");
OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage,
f1ap_setup_resp->SI_container[i][0], f1ap_setup_resp->SI_container_length[i][0]);
printf("f1ap_setup_resp->SI_container_length = %d \n" , f1ap_setup_resp->SI_container_length[0][0]);
LOG_D(CU_F1AP, "f1ap_setup_resp->SI_container_length = %d \n" , f1ap_setup_resp->SI_container_length[0][0]);
cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation;
......@@ -362,24 +362,17 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance,
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
printf("Failed to encode F1 setup request\n");
LOG_E(CU_F1AP, "Failed to encode F1 setup request\n");
return -1;
}
// printf("\n");
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0);
/* decode */
// if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
// printf("Failed to decode F1 setup request\n");
// }
//printf("F1 setup response present = %d\n", out->value.present);
//f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0);
return 0;
}
int CU_send_F1_SETUP_FAILURE(instance_t instance) {
printf("CU_send_F1_SETUP_FAILURE\n");
LOG_D(CU_F1AP, "CU_send_F1_SETUP_FAILURE\n");
module_id_t enb_mod_idP;
module_id_t cu_mod_idP;
......@@ -454,7 +447,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) {
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
printf("Failed to encode F1 setup request\n");
LOG_E(CU_F1AP, "Failed to encode F1 setup request\n");
return -1;
}
......@@ -858,7 +851,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
printf("Failed to encode F1 setup request\n");
LOG_E(CU_F1AP, "Failed to encode F1 setup request\n");
return -1;
}
......
......@@ -44,10 +44,15 @@
// a compile error
#undef C_RNTI
// Bing Kai: create CU and DU context, and put all the information there.
uint64_t du_ue_f1ap_id = 0;
uint32_t f1ap_assoc_id = 0;
uint32_t f1ap_stream = 0;
f1ap_cudu_ue_inst_t f1ap_cu_ue[MAX_eNB];
/*
Initial UL RRC Message Transfer
*/
......@@ -59,7 +64,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu) {
printf("CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER\n");
LOG_D(CU_F1AP, "CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER\n");
// decode the F1 message
// get the rrc message from the contauiner
// call func rrc_eNB_decode_ccch: <-- needs some update here
......@@ -90,7 +95,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id);
LOG_D(CU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id);
/* NRCGI
* TODO: process NRCGI
......@@ -117,9 +122,9 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
ccch_sdu_len = ie->value.choice.RRCContainer.size;
memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf,
ccch_sdu_len);
printf ("RRCContainer(CCCH) :");
for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]);
LOG_D(CU_F1AP, "RRCContainer(CCCH) :");
for (int i=0;i<ie->value.choice.RRCContainer.size;i++) LOG_D(CU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]);
LOG_D(CU_F1AP, "\n");
// Find instance from nr_cellid
int rrc_inst = -1;
for (int i=0;i<RC.nb_inst;i++) {
......@@ -132,6 +137,14 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
}
AssertFatal(rrc_inst>=0,"couldn't find an RRC instance for nr_cell %ll\n",nr_cellid);
int f1ap_uid = f1ap_add_ue(&f1ap_cu_ue[rrc_inst], rrc_inst, CC_id, 0, rnti);
if (f1ap_uid < 0 ) {
LOG_E(CU_F1AP, "Failed to add UE \n");
return -1;
}
f1ap_cu_ue[rrc_inst].du_ue_f1ap_id[f1ap_uid] = du_ue_f1ap_id;
RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
......@@ -141,32 +154,6 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p);
// OR creat the ctxt and srb_info struct required by rrc_eNB_decode_ccch
/*
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
instance, // to fix
ENB_FLAG_YES,
rnti,
0, // frame
0); // slot
CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id;
srb_info_p = &RC.rrc[instance]->carrier[CC_id].Srb0;
if (ccch_sdu_len >= RRC_BUFFER_SIZE_MAX) {
LOG_E(RRC, "CCCH message has size %d > %d\n",ccch_sdu_len,RRC_BUFFER_SIZE_MAX);
break;
}
memcpy(srb_info_p->Rx_buffer.Payload,
ccch_sdu,
ccch_sdu_len);
srb_info->Rx_buffer.payload_size = ccch_sdu_len;
rrc_eNB_decode_ccch(&ctxt, srb_info, CC_id);
*/
// if size > 0
// CU_send_DL_RRC_MESSAGE_TRANSFER(C.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size)
return 0;
}
......@@ -204,8 +191,11 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_dl_rrc->gNB_CU_ue_id;
ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_ue[instance],f1ap_dl_rrc->rnti);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
LOG_I(CU_F1AP, "Setting GNB_CU_UE_F1AP_ID %d associated with UE RNTI %x (instance %d)\n",
ie->value.choice.GNB_CU_UE_F1AP_ID, f1ap_dl_rrc->rnti, instance);
/* mandatory */
/* c2. GNB_DU_UE_F1AP_ID */
......@@ -213,8 +203,9 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie->value.choice.GNB_DU_UE_F1AP_ID = du_ue_f1ap_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id
ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_ue[instance],f1ap_dl_rrc->rnti); //f1ap_dl_rrc->gNB_DU_ue_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
LOG_I(CU_F1AP, "GNB_DU_UE_F1AP_ID %d associated with UE RNTI %x \n", ie->value.choice.GNB_DU_UE_F1AP_ID, f1ap_dl_rrc->rnti);
/* optional */
/* c3. oldgNB_DU_UE_F1AP_ID */
......@@ -276,22 +267,12 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
printf("Failed to encode F1 setup request\n");
LOG_E(CU_F1AP, "Failed to encode F1 setup request\n");
return -1;
}
#ifdef F1AP_TEST
printf("\n");
/* decode */
if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
printf("Failed to decode F1 setup request\n");
return -1;
}
#endif
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id, buffer, len, 0);
return 0;
}
......@@ -304,7 +285,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu) {
printf("CU_handle_UL_RRC_MESSAGE_TRANSFER \n");
LOG_D(CU_F1AP, "CU_handle_UL_RRC_MESSAGE_TRANSFER \n");
MessageDef *message_p;
F1AP_ULRRCMessageTransfer_t *container;
......@@ -336,14 +317,14 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID;
printf("cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id);
LOG_D(CU_F1AP, "cu_ue_f1ap_id %lu associated with RNTI %x \n", cu_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],cu_ue_f1ap_id));
/* GNB_DU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id);
LOG_D(CU_F1AP, "du_ue_f1ap_id %lu associated with RNTI %x \n", du_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],du_ue_f1ap_id));
/* mandatory */
......@@ -351,7 +332,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_SRBID, true);
srb_id = ie->value.choice.SRBID;
printf("srb_id %lu \n", srb_id);
LOG_D(CU_F1AP, "srb_id %lu \n", srb_id);
// issue in here
......@@ -366,8 +347,9 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
ccch_sdu_len = ie->value.choice.RRCContainer.size;
memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf,
ccch_sdu_len);
printf ("RRCContainer(CCCH) :");
for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]);
LOG_D(CU_F1AP, "RRCContainer(CCCH) :");
for (int i=0;i<ie->value.choice.RRCContainer.size;i++) LOG_D(CU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]);
LOG_D(CU_F1AP, "\n");
return 0;
}
......@@ -120,25 +120,25 @@ void *F1AP_CU_task(void *arg) {
switch (ITTI_MSG_ID(received_msg)) {
case SCTP_NEW_ASSOCIATION_IND:
LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_IND for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg));
LOG_I(CU_F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_IND for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg));
cu_task_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_ind);
break;
case SCTP_NEW_ASSOCIATION_RESP:
LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_RESP for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg));
LOG_I(CU_F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_RESP for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg));
cu_task_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_resp);
break;
case SCTP_DATA_IND:
LOG_I(CU_F1AP, "SCTP_DATA_IND for Instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg));
LOG_I(CU_F1AP, "CU Task Received SCTP_DATA_IND for Instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg));
cu_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_data_ind);
break;
case F1AP_SETUP_RESP: // from rrc
LOG_W(CU_F1AP, "F1AP_SETUP_RESP\n");
LOG_I(CU_F1AP, "CU Task Received F1AP_SETUP_RESP\n");
// CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
// &F1AP_SETUP_RESP(received_msg));
CU_send_F1_SETUP_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg),
......@@ -146,7 +146,7 @@ void *F1AP_CU_task(void *arg) {
break;
case F1AP_DL_RRC_MESSAGE: // from rrc
LOG_W(CU_F1AP, "F1AP_DL_RRC_MESSAGE\n");
LOG_I(CU_F1AP, "CU Task Received F1AP_DL_RRC_MESSAGE\n");
// CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
// &F1AP_SETUP_RESP(received_msg));
CU_send_DL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg),
......
......@@ -356,18 +356,10 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) {
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
printf("Failed to encode F1 setup request\n");
LOG_E(CU_F1AP, "Failed to encode F1 setup request\n");
return -1;
}
printf("\n");
/* decode */
if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
printf("Failed to decode F1 setup request\n");
return -1;
}
//AssertFatal(1==0,"Not implemented yet\n");
return 0;
}
......@@ -869,15 +861,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) {
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
printf("Failed to encode F1 setup request\n");
return -1;
}
printf("\n");
/* decode */
if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
printf("Failed to decode F1 setup request\n");
LOG_E(CU_F1AP, "Failed to encode F1 setup request\n");
return -1;
}
......
......@@ -33,33 +33,35 @@
#include "f1ap_common.h"
#include "f1ap_decoder.h"
int asn1_decoder_xer_print = 1;
static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu)
{
MessageDef *message_p;
MessagesIds message_id;
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
//MessageDef *message_p;
//MessagesIds message_id;
//asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
DevAssert(pdu != NULL);
switch(pdu->choice.initiatingMessage->procedureCode) {
case F1AP_ProcedureCode_id_F1Setup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
printf("f1ap_eNB_decode_initiating_message!\n");
//res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n");
break;
case F1AP_ProcedureCode_id_InitialULRRCMessageTransfer:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
printf("f1ap_eNB_decode_initiating_message!\n");
//res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n");
break;
case F1AP_ProcedureCode_id_DLRRCMessageTransfer:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
printf("f1ap_eNB_decode_initiating_message!\n");
//res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n");
break;
case F1AP_ProcedureCode_id_ULRRCMessageTransfer:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
printf("f1ap_eNB_decode_initiating_message!\n");
//res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n");
break;
// case F1AP_ProcedureCode_id_InitialContextSetup:
// res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
......@@ -75,7 +77,7 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu)
default:
// F1AP_ERROR("Unknown procedure ID (%d) for initiating message\n",
// (int)pdu->choice.initiatingMessage->procedureCode);
printf("Unknown procedure ID (%d) for initiating message\n",
LOG_E(F1AP, "Unknown procedure ID (%d) for initiating message\n",
(int)pdu->choice.initiatingMessage->procedureCode);
AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n",
(int)pdu->choice.initiatingMessage->procedureCode);
......@@ -137,8 +139,12 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t
length,
0,
0);
xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu);
if (asn1_decoder_xer_print) {
LOG_E(F1AP, "----------------- ASN1 DECODER PRINT START----------------- \n");
xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu);
LOG_E(F1AP, "----------------- ASN1 DECODER PRINT END ----------------- \n");
}
//LOG_I(F1AP, "f1ap_decode_pdu.dec_ret.code = %d\n", dec_ret.code);
if (dec_ret.code != RC_OK) {
......@@ -157,7 +163,7 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t
return f1ap_decode_unsuccessful_outcome(pdu);
default:
LOG_D(F1AP, "Unknown presence (%d) or not implemented\n", (int)pdu->present);
LOG_E(F1AP, "Unknown presence (%d) or not implemented\n", (int)pdu->present);
break;
}
......
......@@ -145,7 +145,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List;
int num_cells_available = f1ap_du_data->num_cells_available;
printf("num_cells_available = %d \n", num_cells_available);
LOG_D(DU_F1AP, "num_cells_available = %d \n", num_cells_available);
for (i=0;
i<num_cells_available;
i++) {
......@@ -170,11 +170,11 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
/* - nRCGI */
F1AP_NRCGI_t nRCGI;
MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity);
printf("plmn: (%d,%d)\n",f1ap_du_data->mcc[i],f1ap_du_data->mnc[i]);
LOG_D(DU_F1AP, "plmn: (%d,%d)\n",f1ap_du_data->mcc[i],f1ap_du_data->mnc[i]);
//MCC_MNC_TO_PLMNID(208, 95, 2, &nRCGI.pLMN_Identity);
NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity);
printf("nRCellIdentity (%llx): %x.%x.%x.%x.%x\n",f1ap_du_data->nr_cellid[i],
LOG_D(DU_F1AP, "nRCellIdentity (%llx): %x.%x.%x.%x.%x\n",f1ap_du_data->nr_cellid[i],
nRCGI.nRCellIdentity.buf[0],
nRCGI.nRCellIdentity.buf[1],
nRCGI.nRCellIdentity.buf[2],
......@@ -202,7 +202,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
/* - broadcast PLMNs */
// RK: add the num_available_broadcast_PLMNs to the message
int num_available_broadcast_PLMNs = 1; //f1ap_du_data->num_available_broadcast_PLMNs;
printf("num_available_broadcast_PLMNs = %d \n", num_available_broadcast_PLMNs);
LOG_D(DU_F1AP, "num_available_broadcast_PLMNs = %d \n", num_available_broadcast_PLMNs);
for (j=0;
j<num_available_broadcast_PLMNs; // num_available_broadcast_PLMNs
j++) {
......@@ -235,7 +235,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
/* FDD.1.3 freqBandListNr */
int fdd_ul_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_frequency_bands;
printf("fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands);
LOG_D(DU_F1AP, "fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands);
int fdd_ul_j;
for (fdd_ul_j=0;
fdd_ul_j<fdd_ul_num_available_freq_Bands;
......@@ -248,7 +248,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
/* FDD.1.3.2 supportedSULBandList*/
int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_sul_frequency_bands;
printf("num_available_supported_SULBands = %d \n", num_available_supported_SULBands);
LOG_D(DU_F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands);
int fdd_ul_k;
for (fdd_ul_k=0;
fdd_ul_k<num_available_supported_SULBands;
......@@ -277,7 +277,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
/* FDD.2.3 freqBandListNr */
int fdd_dl_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_frequency_bands;
printf("fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands);
LOG_D(DU_F1AP, "fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands);
int fdd_dl_j;
for (fdd_dl_j=0;
fdd_dl_j<fdd_dl_num_available_freq_Bands;
......@@ -290,7 +290,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
/* FDD.2.3.2 supportedSULBandList*/
int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_sul_frequency_bands;
printf("num_available_supported_SULBands = %d \n", num_available_supported_SULBands);
LOG_D(DU_F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands);
int fdd_dl_k;
for (fdd_dl_k=0;
fdd_dl_k<num_available_supported_SULBands;
......@@ -331,7 +331,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
/* TDD.1.3 freqBandListNr */
int tdd_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].tdd.num_frequency_bands;
printf("tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands);
LOG_D(DU_F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands);
int j;
for (j=0;
j<tdd_num_available_freq_Bands;
......@@ -344,7 +344,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
/* TDD.1.3.2 supportedSULBandList*/
int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].tdd.num_sul_frequency_bands;
printf("num_available_supported_SULBands = %d \n", num_available_supported_SULBands);
LOG_D(DU_F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands);
int k;
for (k=0;
k<num_available_supported_SULBands;
......@@ -399,7 +399,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
printf("Failed to encode F1 setup request\n");
LOG_E(DU_F1AP, "Failed to encode F1 setup request\n");
return -1;
}
......@@ -414,7 +414,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
F1AP_F1AP_PDU_t *pdu)
{
printf("DU_handle_F1_SETUP_RESPONSE\n");
LOG_D(DU_F1AP, "DU_handle_F1_SETUP_RESPONSE\n");
AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_successfulOutcome,
"pdu->present != F1AP_F1AP_PDU_PR_successfulOutcome\n");
......@@ -435,7 +435,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, F1AP_SETUP_RESP);
printf("F1AP: F1Setup-Resp: protocolIEs.list.count %d\n",
LOG_D(DU_F1AP, "F1AP: F1Setup-Resp: protocolIEs.list.count %d\n",
in->protocolIEs.list.count);
for (int i=0;i < in->protocolIEs.list.count; i++) {
ie = in->protocolIEs.list.array[i];
......@@ -446,7 +446,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_TransactionID,
"ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n");
TransactionId=ie->value.choice.TransactionID;
printf("F1AP: F1Setup-Resp: TransactionId %d\n",
LOG_D(DU_F1AP, "F1AP: F1Setup-Resp: TransactionId %d\n",
TransactionId);
break;
case F1AP_ProtocolIE_ID_id_gNB_CU_Name:
......@@ -457,7 +457,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
F1AP_SETUP_RESP (msg_p).gNB_CU_name = malloc(ie->value.choice.GNB_CU_Name.size+1);
memcpy(F1AP_SETUP_RESP (msg_p).gNB_CU_name,ie->value.choice.GNB_CU_Name.buf,ie->value.choice.GNB_CU_Name.size);
F1AP_SETUP_RESP (msg_p).gNB_CU_name[ie->value.choice.GNB_CU_Name.size]='\0';
printf("F1AP: F1Setup-Resp: gNB_CU_name %s\n",
LOG_D(DU_F1AP, "F1AP: F1Setup-Resp: gNB_CU_name %s\n",
F1AP_SETUP_RESP (msg_p).gNB_CU_name);
break;
case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List:
......@@ -466,7 +466,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List,
"ie->value.present != F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List\n");
num_cells_to_activate = ie->value.choice.Cells_to_be_Activated_List.list.count;
printf("F1AP: Activating %d cells\n",num_cells_to_activate);
LOG_D(DU_F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate);
for (int i=0;i<num_cells_to_activate;i++) {
F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies = ie->value.choice.Cells_to_be_Activated_List.list.array[i];
......@@ -482,7 +482,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], F1AP_SETUP_RESP (msg_p).mnc_digit_length[i]);
AssertFatal(cell->nRPCI != NULL, "nRPCI is null\n");
printf("nr_cellId : %x %x %x %x %x\n",
LOG_D(DU_F1AP, "nr_cellId : %x %x %x %x %x\n",
cell->nRCGI.nRCellIdentity.buf[0],
cell->nRCGI.nRCellIdentity.buf[1],
cell->nRCGI.nRCellIdentity.buf[2],
......@@ -496,11 +496,11 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
AssertFatal(ext!=NULL,"Extension for SI is null\n");
F1AP_SETUP_RESP (msg_p).num_SI[i] = ext->list.count;
AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n");
printf("F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %x num_si %d\n",i,F1AP_SETUP_RESP (msg_p).mcc[i],F1AP_SETUP_RESP (msg_p).mnc[i],F1AP_SETUP_RESP (msg_p).nr_cellid[i],F1AP_SETUP_RESP (msg_p).num_SI[i]);
LOG_D(DU_F1AP, "F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %x num_si %d\n",i,F1AP_SETUP_RESP (msg_p).mcc[i],F1AP_SETUP_RESP (msg_p).mnc[i],F1AP_SETUP_RESP (msg_p).nr_cellid[i],F1AP_SETUP_RESP (msg_p).num_SI[i]);
for (int si =0;si < ext->list.count;si++) {
size_t size = ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.size;
F1AP_SETUP_RESP (msg_p).SI_container_length[i][si] = size;
printf("F1AP: F1Setup-Resp SI_container_length[%d][%d] %d bytes\n",i,si,size);
LOG_D(DU_F1AP, "F1AP: F1Setup-Resp SI_container_length[%d][%d] %d bytes\n",i,si,size);
F1AP_SETUP_RESP (msg_p).SI_container[i][si] = malloc(F1AP_SETUP_RESP (msg_p).SI_container_length[i][si]);
memcpy((void*)F1AP_SETUP_RESP (msg_p).SI_container[i][si],
......@@ -519,7 +519,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
AssertFatal(F1AP_SETUP_RESP (msg_p).num_SI[i] > 0, "System Information %d is missing",i);
printf("Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n",
LOG_D(DU_F1AP, "Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n",
assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id));
itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p);
......@@ -600,7 +600,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance,
/* - nRCGI */
F1AP_NRCGI_t nRCGI;
MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity);
printf("nr_cellId : %x %x %x %x %x\n",
LOG_D(DU_F1AP, "nr_cellId : %x %x %x %x %x\n",
nRCGI.nRCellIdentity.buf[0],
nRCGI.nRCellIdentity.buf[1],
nRCGI.nRCellIdentity.buf[2],
......@@ -975,17 +975,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance,
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
printf("Failed to encode F1 setup request\n");
return -1;
}
printf("\n");
//du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0);
/* decode */
if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
printf("Failed to decode F1 setup request\n");
LOG_E(DU_F1AP, "Failed to encode F1 setup request\n");
return -1;
}
......
......@@ -37,6 +37,7 @@
#include "f1ap_du_rrc_message_transfer.h"
#include "DL-CCCH-Message.h"
#include "DL-DCCH-Message.h"
......@@ -44,6 +45,7 @@
#include "rrc_extern.h"
#include "common/ran_context.h"
// undefine C_RNTI from
// openair1/PHY/LTE_TRANSPORT/transport_common.h which
// replaces in ie->value.choice.C_RNTI, causing
......@@ -54,13 +56,18 @@
extern f1ap_setup_req_t *f1ap_du_data;
extern RAN_CONTEXT_t RC;
f1ap_cudu_ue_inst_t f1ap_du_ue[MAX_eNB];
/* DL RRC Message Transfer */
int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
uint32_t assoc_id,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu) {
printf("DU_handle_DL_RRC_MESSAGE_TRANSFER \n");
LOG_D(DU_F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n");
MessageDef *message_p;
F1AP_DLRRCMessageTransfer_t *container;
......@@ -92,16 +99,20 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID;
printf("cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id);
LOG_D(DU_F1AP, "cu_ue_f1ap_id %lu \n", 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);
du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id);
LOG_D(DU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); // this should be the one transmitted via initial ul rrc message transfer
if (f1ap_du_add_cu_ue_id(&f1ap_du_ue[instance],du_ue_f1ap_id,cu_ue_f1ap_id) < 0 ) {
LOG_E(DU_F1AP, "Failed to find the F1AP UID \n");
//return -1;
}
/* optional */
/* oldgNB_DU_UE_F1AP_ID */
if (0) {
......@@ -114,8 +125,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_SRBID, true);
srb_id = ie->value.choice.SRBID;
printf("srb_id %lu \n", srb_id);
LOG_D(DU_F1AP, "srb_id %lu \n", srb_id);
/* optional */
/* ExecuteDuplication */
......@@ -123,7 +133,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_ExecuteDuplication, true);
executeDuplication = ie->value.choice.ExecuteDuplication;
printf("ExecuteDuplication %d \n", executeDuplication);
LOG_D(DU_F1AP, "ExecuteDuplication %d \n", executeDuplication);
}
// issue in here
......@@ -133,6 +143,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
F1AP_ProtocolIE_ID_id_RRCContainer, true);
// BK: need check
// create an ITTI message and copy SDU
// message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND);
// memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
rrc_dl_sdu_len = ie->value.choice.RRCContainer.size;
......@@ -193,30 +204,11 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
case DL_CCCH_MessageType__c1_PR_rrcConnectionSetup:
{
LOG_I(RRC,
"Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup RNTI %x\n", (rnti_t)du_ue_f1ap_id);
"Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %x/RNTI %x\n",
du_ue_f1ap_id,
f1ap_get_rnti_by_du_id(&f1ap_du_ue[0],du_ue_f1ap_id));
// Get configuration
// find rrc instance and ue_context for this UE
/*
eNB_RRC_INST *rrc;
rrc_eNB_ue_context_t *ue_context_pP = NULL;
for (int i = 0; i<RC.nb_inst; i++) {
rrc = RC.rrc[i];
// note this requires that du_ue_f1ap_id == RNTI!
ue_context_pP = rrc_eNB_get_ue_context(rrc,(rnti_t)du_ue_f1ap_id);
if (ue_context_pP != NULL) break;
}
AssertFatal(ue_context_pP != NULL, "no UE context found!\n");
*/
// find MACRLC instance based on RNTI/UE_DU_ID
int macrlc_instance=-1;
for (macrlc_instance=0;macrlc_instance<RC.nb_macrlc_inst;macrlc_instance++)
if (find_UE_id(macrlc_instance,du_ue_f1ap_id)>=0) break;
AssertFatal(macrlc_instance>=0,"cannot find macrlc instance for ue\n");
RRCConnectionSetup_t* rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup;
// eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
AssertFatal(rrcConnectionSetup!=NULL,"rrcConnectionSetup is null\n");
......@@ -248,6 +240,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
}
}
// This should be somewhere in the f1ap_cudu_ue_inst_t
int macrlc_instance = 0;
rrc_mac_config_req_eNB(
macrlc_instance,
0, //primaryCC_id,
......@@ -255,7 +250,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
0,
#endif
(rnti_t) du_ue_f1ap_id, //rnti
f1ap_get_rnti_by_du_id(&f1ap_du_ue[0],du_ue_f1ap_id), //rnti
(BCCH_BCH_Message_t *) NULL,
(RadioResourceConfigCommonSIB_t *) NULL,
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
......@@ -305,7 +300,13 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
}
//void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) {
int DU_send_UL_RRC_MESSAGE_TRANSFER(void) {
int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP,
rb_id_t srb_idP,
uint8_t *sduP,
sdu_size_t sdu_lenP) {
LOG_D(DU_F1AP, "DU_send_UL_RRC_MESSAGE_TRANSFER \n");
F1AP_F1AP_PDU_t pdu;
F1AP_ULRRCMessageTransfer_t *out;
F1AP_ULRRCMessageTransferIEs_t *ie;
......@@ -329,7 +330,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(void) {
ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
ie->value.choice.GNB_CU_UE_F1AP_ID = 126L;
ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_du_ue[ctxt_pP->module_id].cu_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[ctxt_pP->module_id], ctxt_pP->rnti)];
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
......@@ -338,7 +339,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(void) {
ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie->value.choice.GNB_DU_UE_F1AP_ID = 651L;
ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[ctxt_pP->module_id].du_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[ctxt_pP->module_id], ctxt_pP->rnti)];
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
......@@ -347,7 +348,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(void) {
ie->id = F1AP_ProtocolIE_ID_id_SRBID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID;
ie->value.choice.SRBID = 1;
ie->value.choice.SRBID = srb_idP;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
// issue in here
......@@ -357,43 +358,38 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(void) {
ie->id = F1AP_ProtocolIE_ID_id_RRCContainer;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer;
OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as",
strlen("asdsa1d32sa1d31asd31as"));
OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, sduP, sdu_lenP);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
printf("Failed to encode F1 setup request\n");
LOG_E(DU_F1AP, "Failed to encode F1 setup request\n");
return -1;
}
printf("\n");
//du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0);
/* decode */
// if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
// printf("Failed to decode F1 setup request\n");
// }
//AssertFatal(1==0,"Not implemented yet\n");
return 0;
}
/* UL RRC Message Transfer */
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
module_id_t module_idP,
int CC_idP,
int UE_id,
rnti_t rntiP,
uint8_t *sduP,
sdu_size_t sdu_lenP
) {
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
int CC_idP,
int UE_id,
rnti_t rntiP,
uint8_t *sduP,
sdu_size_t sdu_lenP) {
F1AP_F1AP_PDU_t pdu;
F1AP_InitialULRRCMessageTransfer_t *out;
F1AP_InitialULRRCMessageTransferIEs_t *ie;
uint8_t *buffer;
uint32_t len;
int f1ap_uid = f1ap_add_ue (&f1ap_du_ue[module_idP], module_idP, CC_idP,UE_id, rntiP);
if (f1ap_uid < 0 ) {
LOG_E(DU_F1AP, "Failed to add UE \n");
return -1;
}
/* Create */
/* 0. Message Type */
......@@ -412,7 +408,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie->value.choice.GNB_DU_UE_F1AP_ID = F1AP_get_UE_identifier(module_idP, CC_idP, UE_id);
ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[module_idP].du_ue_f1ap_id[f1ap_uid];
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
......@@ -462,10 +458,18 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
printf("Failed to encode F1 setup request\n");
LOG_E(DU_F1AP, "Failed to encode F1 setup request\n");
return -1;
}
du_f1ap_itti_send_sctp_data_req(0, f1ap_du_data->assoc_id, buffer, len, 0);
return 0;
}
void init_f1ap_du_ue_inst (void) {
memset(f1ap_du_ue, 0, sizeof(f1ap_du_ue));
}
......@@ -39,14 +39,16 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu);
int DU_send_UL_RRC_MESSAGE_TRANSFER(void);
int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP,
rb_id_t srb_idP,
uint8_t *sduP,
sdu_size_t sdu_lenP);
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
module_id_t module_idP,
int CC_idP,
int UE_id,
rnti_t rntiP,
uint8_t *sduP,
sdu_size_t sdu_lenP);
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
int CC_idP,
int UE_id,
rnti_t rntiP,
uint8_t *sduP,
sdu_size_t sdu_lenP);
#endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */
......@@ -69,7 +69,7 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1
*f1ap_du_data = *f1ap_setup_req;
//printf("sib itti message %s\n", f1ap_setup_req_t->sib1[0]);
printf("nr_cellid : %llx (%lld)",f1ap_setup_req->nr_cellid[0],f1ap_setup_req->nr_cellid[0]);
//printf("nr_cellid : %llx (%lld)",f1ap_setup_req->nr_cellid[0],f1ap_setup_req->nr_cellid[0]);
//du_f1ap_register_to_sctp
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
......@@ -139,7 +139,7 @@ void *F1AP_DU_task(void *arg) {
// 1. save the itti msg so that you can use it to sen f1ap_setup_req, fill the f1ap_setup_req message,
// 2. store the message in f1ap context, that is also stored in RC
// 2. send a sctp_association req
LOG_I(DU_F1AP, "F1AP_SETUP_REQ\n");
LOG_I(DU_F1AP, "DU Task Received F1AP_SETUP_REQ\n");
du_task_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&F1AP_SETUP_REQ(received_msg));
break;
......@@ -147,14 +147,14 @@ void *F1AP_DU_task(void *arg) {
case SCTP_NEW_ASSOCIATION_RESP:
// 1. store the respon
// 2. send the f1setup_req
LOG_I(DU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n");
LOG_I(DU_F1AP, "DU Task Received SCTP_NEW_ASSOCIATION_RESP\n");
du_task_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_resp);
break;
case SCTP_DATA_IND:
// ex: any F1 incoming message for DU ends here
LOG_I(DU_F1AP, "SCTP_DATA_IND\n");
LOG_I(DU_F1AP, "DU Task Received SCTP_DATA_IND\n");
du_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_data_ind);
break;
......
......@@ -298,17 +298,10 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) {
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
printf("Failed to encode F1 setup request\n");
LOG_E(DU_F1AP, "Failed to encode F1 setup request\n");
return -1;
}
printf("\n");
/* decode */
// if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
// printf("Failed to decode F1 setup request\n");
// }
//du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0);
return 0;
}
......@@ -688,16 +681,10 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) {
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
printf("Failed to encode F1 setup request\n");
LOG_E(DU_F1AP, "Failed to encode F1 setup request\n");
return -1;
}
printf("\n");
/* decode */
// if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
// printf("Failed to decode F1 setup request\n");
// }
//du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0);
return 0;
......
......@@ -33,6 +33,8 @@
#include "f1ap_common.h"
#include "f1ap_encoder.h"
int asn1_encoder_xer_print = 1;
/*
static inline int f1ap_encode_initiating(f1ap_message *message,
uint8_t **buffer,
......@@ -76,14 +78,21 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length)
DevAssert(buffer != NULL);
DevAssert(length != NULL);
xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu);
if (asn1_encoder_xer_print) {
LOG_E(F1AP, "----------------- ASN1 ENCODER PRINT START ----------------- \n");
xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu);
LOG_E(F1AP, "----------------- ASN1 ENCODER PRINT END----------------- \n");
}
encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer);
if (encoded < 0) {
LOG_E(F1AP, "Failed to encode F1AP message\n");
return -1;
}
*length = encoded;
/* Is the following needed? I moved the code here from CU_F1AP.c/DU_F1AP.c */
// ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, pdu);
return encoded;
......
......@@ -117,7 +117,7 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream,
}
/* Calling the right handler */
printf("Calling handler with instance %d\n",instance);
LOG_I(DU_F1AP, "Calling handler with instance %d\n",instance);
ret = (*f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1])
(instance, assoc_id, stream, &pdu);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu);
......
......@@ -55,7 +55,7 @@ void du_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint
sctp_data_req->buffer_length = buffer_length;
sctp_data_req->stream = stream;
printf("Sending ITTI message to SCTP Task\n");
LOG_I(F1AP, "Sending ITTI message to SCTP Task\n");
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
......
......@@ -1135,7 +1135,7 @@ void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP){
pdcp_enb[ctxt_pP->module_id].rnti[i]=ctxt_pP->rnti;
pdcp_enb[ctxt_pP->module_id].uid[i]=i;
pdcp_enb[ctxt_pP->module_id].num_ues++;
printf("add new uid is %d %x\n\n", i, ctxt_pP->rnti);
LOG_I(PDCP,"add new uid is %d %x\n\n", i, ctxt_pP->rnti);
// ret=1;
break;
}
......
......@@ -37,6 +37,8 @@
#include "assertions.h"
#include "common/ran_context.h"
extern RAN_CONTEXT_t RC;
extern boolean_t pdcp_data_ind(
const protocol_ctxt_t* const ctxt_pP,
......@@ -689,13 +691,40 @@ void rlc_data_ind (
else
#endif /*UETARGET*/
{
pdcp_data_ind (
ctxt_pP,
srb_flagP,
MBMS_flagP,
rb_idP,
sdu_sizeP,
sdu_pP);
switch (RC.rrc[ctxt_pP->module_id]->node_type){
case ngran_eNB_CU :
case ngran_ng_eNB_CU :
case ngran_gNB_CU :
pdcp_data_ind (
ctxt_pP,
1, // srb_flagP,
0, // MBMS_flagP,
rb_idP,
sdu_sizeP,
sdu_pP);
break;
case ngran_eNB_DU :
case ngran_gNB_DU :
DU_send_UL_RRC_MESSAGE_TRANSFER(
ctxt_pP,
rb_idP,
sdu_pP,
sdu_sizeP
);
break;
default:
pdcp_data_ind (
ctxt_pP,
srb_flagP,
MBMS_flagP,
rb_idP,
sdu_sizeP,
sdu_pP);
break;
}
}
}
//-----------------------------------------------------------------------------
......
......@@ -5771,11 +5771,12 @@ rrc_eNB_generate_RRCConnectionSetup(
F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_p->rnti;
F1AP_DL_RRC_MESSAGE (message_p).srb_id = CCCH;
F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1;
F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0;
itti_send_msg_to_task (TASK_CU_F1, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_p);
LOG_E(RRC, "F1AP_DL_RRC_MESSAGE\n");
itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
LOG_D(RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n");
break;
case ngran_eNB_DU :
case ngran_gNB_DU :
......
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