Skip to content
Snippets Groups Projects
Commit 37b9e7b5 authored by Bing-Kai Hong's avatar Bing-Kai Hong
Browse files

Handle the f1 setup request and send back f1 response with value from conf

parent 44d0fa64
No related branches found
No related tags found
No related merge requests found
......@@ -81,7 +81,7 @@ typedef struct f1ap_setup_req_s {
uint16_t sctp_out_streams;
// F1_Setup_Req payload
uint32_t gNB_DU_id;
uint64_t gNB_DU_id;
char *gNB_DU_name;
/* The type of the cell */
......@@ -164,6 +164,16 @@ typedef struct f1ap_setup_req_s {
} f1ap_setup_req_t;
typedef struct f1ap_setup_resp_s {
/* Connexion id used between SCTP/F1AP */
uint16_t cnx_id;
/* SCTP association id */
int32_t assoc_id;
/* Number of SCTP streams used for a mme association */
uint16_t sctp_in_streams;
uint16_t sctp_out_streams;
/// string holding gNB_CU_name
char *gNB_CU_name;
/// number of DU cells to activate
......
......@@ -798,6 +798,13 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) {
rrc->node_type = ngran_eNB_CU;
rrc->sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr);
rrc->sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_IDX].uptr);
// MCC and MNC
rrc->mcc= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr) );
rrc->mnc= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr) );
rrc->mnc_digit_length= strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr));
rrc->tac= (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr) );
}
else { // no F1
......@@ -2373,7 +2380,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) {
paramdef_t SCTPParams[] = SCTPPARAMS_DESC;
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
F1AP_SETUP_REQ (msg_p).num_cells_available++;
F1AP_SETUP_REQ (msg_p).num_cells_available++;
F1AP_SETUP_REQ (msg_p).gNB_DU_id = *(ENBParamList.paramarray[0][ENB_ENB_ID_IDX].uptr);
LOG_I(ENB_APP,"F1AP: gNB_DU_id[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_id);
......@@ -2474,6 +2481,8 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) {
F1AP_SETUP_REQ (msg_p).ranac[k] = 0;
F1AP_SETUP_REQ (msg_p).mib[k] = rrc->carrier[0].MIB;
F1AP_SETUP_REQ (msg_p).sib1[k] = rrc->carrier[0].SIB1;
F1AP_SETUP_REQ (msg_p).mib_length[k] = rrc->carrier[0].sizeof_MIB;
F1AP_SETUP_REQ (msg_p).sib1_length[k] = rrc->carrier[0].sizeof_SIB1;
break;
} // if
......
......@@ -390,7 +390,20 @@ inline void ASN_DEBUG(const char *fmt, ...);
#endif
//Forward declaration
//struct f1ap_message_s;
#define F1AP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \
do {\
IE_TYPE **ptr; \
ie = NULL; \
for (ptr = container->protocolIEs.list.array; \
ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; \
ptr++) { \
if((*ptr)->id == IE_ID) { \
ie = *ptr; \
break; \
} \
} \
if (mandatory) DevAssert(ie != NULL); \
} while(0)
/** \brief Function callback prototype.
**/
......
......@@ -49,7 +49,7 @@
#include "common/ran_context.h"
extern RAN_CONTEXT_t RC;
static f1ap_setup_resp_t *f1ap_cu_data;
f1ap_setup_req_t *f1ap_du_data_from_du;
/* This structure describes association of a DU to a CU */
typedef struct f1ap_info {
......@@ -84,6 +84,7 @@ typedef struct f1ap_info {
} f1ap_info_t;
// ==============================================================================
static
void CU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) {
......@@ -103,7 +104,7 @@ void CU_send_sctp_init_req(instance_t enb_id) {
// 2. use RC.rrc[enb_id] to fill the sctp_init_t with the ip, port
// 3. creat an itti message to init
LOG_I(CU_F1AP, "F1AP_CU_SCTP_REQ\n");
LOG_I(CU_F1AP, "F1AP_CU_SCTP_REQ(create socket)\n");
MessageDef *message_p = NULL;
message_p = itti_alloc_new_message (TASK_CU_F1, SCTP_INIT_MSG);
......@@ -120,8 +121,6 @@ void CU_send_sctp_init_req(instance_t enb_id) {
message_p->ittiMsg.sctp_init.nb_ipv6_addr = 0;
message_p->ittiMsg.sctp_init.ipv6_address[0] = "0:0:0:0:0:0:0:1";
LOG_I(CU_F1AP,"CU.my_addr = %s \n", RC.rrc[enb_id]->eth_params_s.my_addr);
LOG_I(CU_F1AP,"CU.enb_id = %d \n", enb_id);
itti_send_msg_to_task(TASK_SCTP, enb_id, message_p);
}
......@@ -150,24 +149,30 @@ void *F1AP_CU_task(void *arg) {
case SCTP_NEW_ASSOCIATION_IND:
LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_IND\n");
LOG_I(DU_F1AP, "--------------3--------------\n");
CU_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\n");
LOG_I(DU_F1AP, "--------------4--------------\n");
CU_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\n");
LOG_I(DU_F1AP, "--------------5--------------\n");
CU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
break;
case F1AP_SETUP_RESP: // from rrc
LOG_W(CU_F1AP, "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),
&F1AP_SETUP_RESP(received_msg));
break;
// case F1AP_SETUP_RESPONSE: // This is from RRC
// CU_send_F1_SETUP_RESPONSE(instance, *f1ap_setup_ind, &(F1AP_SETUP_RESP) f1ap_setup_resp)
// break;
......@@ -197,13 +202,33 @@ void *F1AP_CU_task(void *arg) {
void CU_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) {
CU_send_F1_SETUP_RESPONSE(instance, sctp_new_association_ind);
//CU_send_F1_SETUP_RESPONSE(instance, sctp_new_association_ind);
}
void CU_handle_sctp_association_resp(instance_t instance, sctp_new_association_ind_t *sctp_new_association_resp) {
void CU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) {
//CU_send_F1_SETUP_RESPONSE(instance, sctp_new_association_resp);
DevAssert(sctp_new_association_resp != NULL);
if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) {
LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n",
sctp_new_association_resp->sctp_state,
instance,
sctp_new_association_resp->ulp_cnx_id);
//f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
return; // exit -1 for debugging
}
// go to an init func
f1ap_du_data_from_du = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t));
// save the assoc id
f1ap_du_data_from_du->assoc_id = sctp_new_association_resp->assoc_id;
f1ap_du_data_from_du->sctp_in_streams = sctp_new_association_resp->in_streams;
f1ap_du_data_from_du->sctp_out_streams = sctp_new_association_resp->out_streams;
}
// ==============================================================================
void CU_handle_F1_SETUP_REQUEST(F1AP_F1SetupRequest_t *message_p) {
F1AP_F1AP_PDU_t pdu;
......@@ -235,7 +260,7 @@ void CU_handle_F1_SETUP_REQUEST(F1AP_F1SetupRequest_t *message_p) {
}
void CU_send_F1_SETUP_RESPONSE(instance_t instance, sctp_new_association_ind_t *f1ap_setup_ind, f1ap_setup_resp_t *f1ap_setup_resp) {
void CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp) {
//void CU_send_F1_SETUP_RESPONSE(F1AP_F1SetupResponse_t *F1SetupResponse) {
//AssertFatal(1==0,"Not implemented yet\n");
......@@ -366,7 +391,7 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, sctp_new_association_ind_t *
}
// printf("\n");
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_ind->assoc_id, buffer, len, 0);
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");
......
......@@ -127,8 +127,8 @@ 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);
xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu);
//LOG_I(F1AP, "f1ap_decode_pdu.dec_ret.code = %d\n", dec_ret.code);
if (dec_ret.code != RC_OK) {
......
......@@ -45,9 +45,6 @@
static f1ap_setup_req_t *f1ap_du_data;
void DU_handle_sctp_association_resp(instance_t instance,sctp_new_association_resp_t *sctp_new_association_resp);
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];
UE_identifier[enb_mod_idP+CC_idP+UE_id] = (UE_identifier[enb_mod_idP+CC_idP+UE_id] + 1) % F1AP_UE_IDENTIFIER_NUMBER;
......@@ -98,7 +95,6 @@ void *F1AP_DU_task(void *arg) {
// 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, "--------------0--------------\n");
DU_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&F1AP_SETUP_REQ(received_msg));
break;
......@@ -107,7 +103,6 @@ void *F1AP_DU_task(void *arg) {
// 1. store the respon
// 2. send the f1setup_req
LOG_I(DU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n");
LOG_I(DU_F1AP, "--------------1--------------\n");
DU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_resp);
break;
......@@ -115,7 +110,6 @@ void *F1AP_DU_task(void *arg) {
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, "--------------2--------------\n");
DU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
break;
......@@ -170,7 +164,9 @@ void DU_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_se
// store data
f1ap_du_data = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t));
*f1ap_du_data = *f1ap_setup_req;
//printf("sib itti message %s\n", f1ap_setup_req_t->sib1[0]);
printf("sib f1ap context %s\n", f1ap_du_data->sib1[0]);
//du_f1ap_register_to_sctp
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
......@@ -285,10 +281,12 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) {
F1AP_Served_Cell_Information_t served_cell_information;
memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t));
/* - 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);
//MCC_MNC_TO_PLMNID(208, 95, 2, &nRCGI.pLMN_Identity);
NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity);
served_cell_information.nRCGI = nRCGI;
......@@ -297,12 +295,8 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) {
/* - fiveGS_TAC */
OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC,
f1ap_du_data->tac[i],
sizeof(f1ap_du_data->tac[i]));
// OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC,
// "10",
// 3);
&f1ap_du_data->tac[i],
3);
/* - Configured_EPS_TAC */
if(0){
......@@ -321,7 +315,6 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) {
j++) {
/* > PLMN BroadcastPLMNs Item */
F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t));
//memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t));
//MCC_MNC_TO_PLMNID(208, 95, 2, &broadcastPLMNs_Item->pLMN_Identity);
MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity);
ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item);
......@@ -398,7 +391,7 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) {
served_cell_information.nR_Mode_Info = nR_Mode_Info;
/* - measurementTimingConfiguration */
char *measurementTimingConfiguration = "0"; // sept. 2018
char *measurementTimingConfiguration = "0"; //&f1ap_du_data->measurement_timing_information[i]; // sept. 2018
OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration,
measurementTimingConfiguration,
......@@ -415,13 +408,6 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) {
OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018
f1ap_du_data->sib1[i],
f1ap_du_data->sib1_length[i]);
// OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018
// "1",//f1ap_setup_req->mib,
// sizeof("1"));
// OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018
// "1",
// sizeof("1"));
gnb_du_served_cells_item.gNB_DU_System_Information = gNB_DU_System_Information; //
......
......@@ -47,6 +47,9 @@
#include "conversions.h"
#include "msc.h"
extern f1ap_setup_req_t *f1ap_du_data_from_du;
static
int f1ap_handle_f1_setup_request(uint32_t assoc_id,
uint32_t stream,
......@@ -108,8 +111,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream,
memset(&pdu, 0, sizeof(pdu));
if (f1ap_decode_pdu(&pdu, data, data_length) < 0) {
//F1AP_ERROR("Failed to decode PDU\n");
printf("Failed to decode PDU\n");
LOG_E(F1AP, "Failed to decode PDU\n");
return -1;
}
......@@ -117,9 +119,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream,
if (pdu.choice.initiatingMessage->procedureCode > sizeof(f1ap_messages_callback) / (3 * sizeof(
f1ap_message_decoded_callback))
|| (pdu.present > F1AP_F1AP_PDU_PR_unsuccessfulOutcome)) {
//F1AP_ERROR("[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n",
// assoc_id, pdu.choice.initiatingMessage->procedureCode, pdu.present);
printf("[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n",
LOG_E(F1AP, "[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n",
assoc_id, pdu.choice.initiatingMessage->procedureCode, pdu.present);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu);
return -1;
......@@ -129,10 +129,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream,
* This can mean not implemented or no procedure for eNB (wrong direction).
*/
if (f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) {
// F1AP_ERROR("[SCTP %d] No handler for procedureCode %ld in %s\n",
// assoc_id, pdu.choice.initiatingMessage->procedureCode,
// f1ap_direction2String(pdu.present - 1));
printf("[SCTP %d] No handler for procedureCode %ld in %s\n",
LOG_E(F1AP, "[SCTP %d] No handler for procedureCode %ld in %s\n",
assoc_id, pdu.choice.initiatingMessage->procedureCode,
f1ap_direction2String(pdu.present - 1));
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu);
......@@ -151,9 +148,147 @@ int f1ap_handle_f1_setup_request(uint32_t assoc_id,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu)
{
printf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n");
printf("f1ap_handle_f1_setup_request\n");
MessageDef *message_p;
F1AP_F1SetupRequest_t *container;
F1AP_F1SetupRequestIEs_t *ie;
int i = 0;
return 0;
DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage->value.choice.F1SetupRequest;
/* F1 Setup Request == Non UE-related procedure -> stream 0 */
if (stream != 0) {
LOG_W(F1AP, "[SCTP %d] Received f1 setup request on stream != 0 (%d)\n",
assoc_id, stream);
}
message_p = itti_alloc_new_message(TASK_RRC_ENB, F1AP_SETUP_REQ);
/* assoc_id */
F1AP_SETUP_REQ(message_p).assoc_id = assoc_id;
/* gNB_DU_id */
// this function exits if the ie is mandatory
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);
/* gNB_DU_name */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_Name, true);
F1AP_SETUP_REQ(message_p).gNB_DU_name = calloc(ie->value.choice.GNB_DU_Name.size + 1, sizeof(char));
memcpy(F1AP_SETUP_REQ(message_p).gNB_DU_name, ie->value.choice.GNB_DU_Name.buf,
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);
/* 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);
int num_cells_available = F1AP_SETUP_REQ(message_p).num_cells_available;
for (i=0; i<num_cells_available; i++) {
F1AP_GNB_DU_Served_Cells_Item_t *served_celles_item_p;
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]);
/* - nRCGI */
TBCD_TO_MCC_MNC(&(served_celles_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i],
F1AP_SETUP_REQ(message_p).mnc[i],
F1AP_SETUP_REQ(message_p).mnc_digit_length[i]);
// @issue in here cellID
F1AP_SETUP_REQ(message_p).nr_cellid[i] = 1;
printf("[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]);
/* - 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]);
// System Information
/* mib */
F1AP_SETUP_REQ(message_p).mib[i] = calloc(served_celles_item_p->gNB_DU_System_Information->mIB_message.size + 1, sizeof(char));
memcpy(F1AP_SETUP_REQ(message_p).mib[i], served_celles_item_p->gNB_DU_System_Information->mIB_message.buf,
served_celles_item_p->gNB_DU_System_Information->mIB_message.size);
/* 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]);
/* sib1 */
F1AP_SETUP_REQ(message_p).sib1[i] = calloc(served_celles_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char));
memcpy(F1AP_SETUP_REQ(message_p).sib1[i], served_celles_item_p->gNB_DU_System_Information->sIB1_message.buf,
served_celles_item_p->gNB_DU_System_Information->sIB1_message.size);
/* 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]);
}
*f1ap_du_data_from_du = F1AP_SETUP_REQ(message_p);
// char *measurement_timing_information[F1AP_MAX_NB_CELLS];
// uint8_t ranac[F1AP_MAX_NB_CELLS];
// int fdd_flag = f1ap_setup_req->fdd_flag;
// union {
// struct {
// uint32_t ul_nr_arfcn;
// uint8_t ul_scs;
// uint8_t ul_nrb;
// uint32_t dl_nr_arfcn;
// uint8_t dl_scs;
// uint8_t dl_nrb;
// uint32_t sul_active;
// uint32_t sul_nr_arfcn;
// uint8_t sul_scs;
// uint8_t sul_nrb;
// uint8_t num_frequency_bands;
// uint16_t nr_band[32];
// uint8_t num_sul_frequency_bands;
// uint16_t nr_sul_band[32];
// } fdd;
// struct {
// uint32_t nr_arfcn;
// uint8_t scs;
// uint8_t nrb;
// uint32_t sul_active;
// uint32_t sul_nr_arfcn;
// uint8_t sul_scs;
// uint8_t sul_nrb;
// uint8_t num_frequency_bands;
// uint16_t nr_band[32];
// uint8_t num_sul_frequency_bands;
// uint16_t nr_sul_band[32];
// } tdd;
// } nr_mode_info[F1AP_MAX_NB_CELLS];
return itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(assoc_id), message_p);
}
static
......@@ -161,7 +296,7 @@ int f1ap_handle_f1_setup_response(uint32_t assoc_id,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu)
{
printf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n");
printf("f1ap_handle_f1_setup_response\n");
return 0;
}
......@@ -16,7 +16,7 @@
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
* conmnc_digit_lengtht@openairinterface.org
*/
/*! \file RRC/LTE/defs.h
......@@ -713,6 +713,8 @@ typedef struct eNB_RRC_INST_s {
int mnc;
/// number of mnc digits
int mnc_digit_length;
/// tac
int tac;
// other RAN parameters
int srb1_timer_poll_retransmit;
......
......@@ -183,7 +183,8 @@ init_SI(
(int)configuration->N_RB_DL[CC_id],
(int)configuration->phich_resource[CC_id],
(int)configuration->phich_duration[CC_id]);
do_MIB(&rrc->carrier[CC_id],
carrier->sizeof_MIB= do_MIB(&rrc->carrier[CC_id],
#ifdef ENABLE_ITTI
configuration->N_RB_DL[CC_id],
configuration->phich_resource[CC_id],
......@@ -5837,7 +5838,7 @@ void setup_ngran_CU(eNB_RRC_INST *rrc) {
//-----------------------------------------------------------------------------
char
openair_rrc_eNB_configuration(
const module_id_t enb_mod_idP
const module_id_t enb_mod_idP, RrcConfigurationReq *rrc_configuration_req
)
#else
char
......@@ -5990,7 +5991,15 @@ openair_rrc_eNB_init(
}
openair_rrc_on(&ctxt);
/*
RC.rrc[ctxt.module_id]->mcc= rrc_configuration_req->mcc;
RC.rrc[ctxt.module_id]->mnc= rrc_configuration_req->mnc;
RC.rrc[ctxt.module_id]->mnc_digit_length= rrc_configuration_req->mnc_digit_length;
RC.rrc[ctxt.module_id]->tac= rrc_configuration_req->tac;
LOG_W(RRC, "[inst %d] RRC->MCC/MSG->MCC %d/%d \n", ctxt.module_id, RC.rrc[ctxt.module_id]->mcc, rrc_configuration_req->mcc);
*/
if (RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU)
// msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SCTP_REQ);
// RCconfig_CU_F1(msg_p, enb_id);
......@@ -7285,76 +7294,85 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
int cu_cell_ind=0;
MessageDef *msg_p;
MessageDef *msg_p = NULL;
//LOG_W(RRC,"num_cells_available %d \n", f1_setup_req->num_cells_available);
for (int i=0;i<f1_setup_req->num_cells_available;i++) {
// check that mcc/mnc match and grab MIB/SIB1
int found_cell=0;
for (int j=0;j<RC.nb_inst;j++) {
eNB_RRC_INST *rrc = RC.rrc[j];
if (rrc->mcc == f1_setup_req->mcc[i] && rrc->mnc == f1_setup_req->mnc[i]) {
rrc->carrier[0].MIB = malloc(f1_setup_req->mib_length[i]);
rrc->carrier[0].sizeof_MIB = f1_setup_req->mib_length[i];
memcpy((void*)rrc->carrier[0].MIB,f1_setup_req->mib[i],f1_setup_req->mib_length[i]);
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_BCCH_BCH_Message,
(void **)&rrc->carrier[0].mib_DU,
f1_setup_req->mib[i],
f1_setup_req->mib_length[i]);
AssertFatal(dec_rval.code == RC_OK,
"[eNB_DU %"PRIu8"] Failed to decode BCCH_BCH_MESSAGE (%zu bits)\n",
j,
dec_rval.consumed );
BCCH_BCH_Message_t *mib = &rrc->carrier[0].mib;
BCCH_BCH_Message_t *mib_DU = rrc->carrier[0].mib_DU;
mib->message.dl_Bandwidth = mib_DU->message.dl_Bandwidth;
mib->message.phich_Config.phich_Resource = mib_DU->message.phich_Config.phich_Resource;
mib->message.phich_Config.phich_Duration = mib_DU->message.phich_Config.phich_Duration;
rrc->carrier[0].SIB1 = malloc(f1_setup_req->sib1_length[i]);
rrc->carrier[0].sizeof_SIB1 = f1_setup_req->sib1_length[i];
memcpy((void*)rrc->carrier[0].SIB1,f1_setup_req->sib1[i],f1_setup_req->sib1_length[i]);
dec_rval = uper_decode_complete(NULL,
&asn_DEF_BCCH_DL_SCH_Message,
(void **)&rrc->carrier[0].siblock1_DU,
f1_setup_req->sib1[i],
f1_setup_req->sib1_length[i]);
AssertFatal(dec_rval.code == RC_OK,
"[eNB_DU %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n",
j,
dec_rval.consumed );
// Parse message and extract SystemInformationBlockType1 field
BCCH_DL_SCH_Message_t *bcch_message = rrc->carrier[0].siblock1_DU;
AssertFatal(bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1,
"bcch_message->message.present != BCCH_DL_SCH_MessageType_PR_c1\n");
AssertFatal(bcch_message->message.choice.c1.present == BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1,
"bcch_message->message.choice.c1.present != BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n");
rrc->carrier[0].sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1;
rrc->carrier[0].physCellId = f1_setup_req->nr_pci[i];
// prepare F1_SETUP_RESPONSE
if (msg_p == NULL) {
msg_p = itti_alloc_new_message (TASK_CU_F1,F1AP_SETUP_RESP);
F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name;
}
// RK: cu_cell_ind is the index for cu_cell_ind, could you confirm?
rrc->carrier[0].MIB = malloc(f1_setup_req->mib_length[i]);
rrc->carrier[0].sizeof_MIB = f1_setup_req->mib_length[i];
LOG_W(RRC, "instance %d mib length %d\n", i, f1_setup_req->mib_length[i]);
LOG_W(RRC, "instance %d sib1 length %d\n", i, f1_setup_req->sib1_length[i]);
memcpy((void*)rrc->carrier[0].MIB,f1_setup_req->mib[i],f1_setup_req->mib_length[i]);
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_BCCH_BCH_Message,
(void **)&rrc->carrier[0].mib_DU,
f1_setup_req->mib[i],
f1_setup_req->mib_length[i]);
AssertFatal(dec_rval.code == RC_OK,
"[eNB_DU %"PRIu8"] Failed to decode BCCH_BCH_MESSAGE (%zu bits)\n",
j,
dec_rval.consumed );
BCCH_BCH_Message_t *mib = &rrc->carrier[0].mib;
BCCH_BCH_Message_t *mib_DU = rrc->carrier[0].mib_DU;
mib->message.dl_Bandwidth = mib_DU->message.dl_Bandwidth;
mib->message.phich_Config.phich_Resource = mib_DU->message.phich_Config.phich_Resource;
mib->message.phich_Config.phich_Duration = mib_DU->message.phich_Config.phich_Duration;
rrc->carrier[0].SIB1 = malloc(f1_setup_req->sib1_length[i]);
rrc->carrier[0].sizeof_SIB1 = f1_setup_req->sib1_length[i];
memcpy((void*)rrc->carrier[0].SIB1,f1_setup_req->sib1[i],f1_setup_req->sib1_length[i]);
dec_rval = uper_decode_complete(NULL,
&asn_DEF_BCCH_DL_SCH_Message,
(void **)&rrc->carrier[0].siblock1_DU,
f1_setup_req->sib1[i],
f1_setup_req->sib1_length[i]);
AssertFatal(dec_rval.code == RC_OK,
"[eNB_DU %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n",
j,
dec_rval.consumed );
// Parse message and extract SystemInformationBlockType1 field
BCCH_DL_SCH_Message_t *bcch_message = rrc->carrier[0].siblock1_DU;
AssertFatal(bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1,
"bcch_message->message.present != BCCH_DL_SCH_MessageType_PR_c1\n");
AssertFatal(bcch_message->message.choice.c1.present == BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1,
"bcch_message->message.choice.c1.present != BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n");
rrc->carrier[0].sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1;
rrc->carrier[0].physCellId = f1_setup_req->nr_pci[i];
// prepare F1_SETUP_RESPONSE
if (msg_p == NULL) {
msg_p = itti_alloc_new_message (TASK_CU_F1,F1AP_SETUP_RESP);
}
F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name;
F1AP_SETUP_RESP (msg_p).mcc[cu_cell_ind] = rrc->mcc;
F1AP_SETUP_RESP (msg_p).mnc[cu_cell_ind] = rrc->mnc;
F1AP_SETUP_RESP (msg_p).mnc_digit_length[cu_cell_ind] = rrc->mnc_digit_length;
F1AP_SETUP_RESP (msg_p).nrpci[cu_cell_ind] = f1_setup_req->nr_pci[i];
int num_SI= 0;
if (rrc->carrier[0].SIB23) {
F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][num_SI] = rrc->carrier[0].SIB23;
F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][num_SI] = rrc->carrier[0].sizeof_SIB23;
num_SI++;
}
F1AP_SETUP_RESP (msg_p).num_SI[cu_cell_ind] = num_SI;
// send ITTI message to F1AP-CU task
itti_send_msg_to_task (TASK_CU_F1, ENB_MODULE_ID_TO_INSTANCE(j), (MessageDef*)f1_setup_resp);
cu_cell_ind++;
found_cell=1;
break;
} // setup_req mcc/mnc match rrc internal list element
F1AP_SETUP_RESP (msg_p).mnc[cu_cell_ind] = rrc->mnc;
F1AP_SETUP_RESP (msg_p).mnc_digit_length[cu_cell_ind] = rrc->mnc_digit_length;
F1AP_SETUP_RESP (msg_p).nrpci[cu_cell_ind] = f1_setup_req->nr_pci[i];
int num_SI= 0;
if (rrc->carrier[0].SIB23) {
F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][num_SI] = rrc->carrier[0].SIB23;
F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][num_SI] = rrc->carrier[0].sizeof_SIB23;
num_SI++;
}
F1AP_SETUP_RESP (msg_p).num_SI[cu_cell_ind] = num_SI;
// send ITTI message to F1AP-CU task
itti_send_msg_to_task (TASK_CU_F1, ENB_MODULE_ID_TO_INSTANCE(j), msg_p);
cu_cell_ind++;
found_cell=1;
break;
} else {// setup_req mcc/mnc match rrc internal list element
LOG_W(RRC,"[Inst %d] No matching MCC/MNC: rrc->mcc/f1_setup_req->mcc %d/%d rrc->mnc/f1_setup_req->mnc %d/%d \n",
j, rrc->mcc, f1_setup_req->mcc[i],rrc->mnc, f1_setup_req->mnc[i]);
}
}// for (int j=0;j<RC.nb_inst;j++)
if (found_cell==0) {
AssertFatal(1==0,"No cell found\n");
......@@ -7519,12 +7537,12 @@ rrc_enb_task(
/* Messages from eNB app */
case RRC_CONFIGURATION_REQ:
LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p, &RRC_CONFIGURATION_REQ(msg_p));
openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance));
openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_CONFIGURATION_REQ(msg_p));
break;
/* Messages from F1AP task */
case F1AP_SETUP_REQ:
AssertFatal(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU,
"should not receive F1AP_SETUP_REQUEST if this isn't a CU!\n");
"should not receive F1AP_SETUP_REQUEST, need call by CU!\n");
LOG_I(RRC,"[eNB %d] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p));
......
......@@ -42,7 +42,7 @@ void openair_rrc_top_init(int eMBMS_active, char *uecap_xer, uint8_t cba_group_a
#if defined(ENABLE_ITTI)
char
openair_rrc_eNB_configuration(
const module_id_t enb_mod_idP
const module_id_t enb_mod_idP, RrcConfigurationReq *rrc_configuration_req
);
#endif
char openair_rrc_eNB_init(
......
......@@ -139,7 +139,7 @@ do { \
#define OCTET_STRING_TO_INT16(aSN, x) \
do { \
DevCheck((aSN)->size == 2, (aSN)->size, 0, 0); \
DevCheck((aSN)->size == 2 || (aSN)->size == 3, (aSN)->size, 0, 0); \
BUFFER_TO_INT16((aSN)->buf, x); \
} while(0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment