Commit 37b9e7b5 authored by Bing-Kai Hong's avatar Bing-Kai Hong

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

parent 44d0fa64
...@@ -81,7 +81,7 @@ typedef struct f1ap_setup_req_s { ...@@ -81,7 +81,7 @@ typedef struct f1ap_setup_req_s {
uint16_t sctp_out_streams; uint16_t sctp_out_streams;
// F1_Setup_Req payload // F1_Setup_Req payload
uint32_t gNB_DU_id; uint64_t gNB_DU_id;
char *gNB_DU_name; char *gNB_DU_name;
/* The type of the cell */ /* The type of the cell */
...@@ -164,6 +164,16 @@ typedef struct f1ap_setup_req_s { ...@@ -164,6 +164,16 @@ typedef struct f1ap_setup_req_s {
} f1ap_setup_req_t; } f1ap_setup_req_t;
typedef struct f1ap_setup_resp_s { 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 /// string holding gNB_CU_name
char *gNB_CU_name; char *gNB_CU_name;
/// number of DU cells to activate /// number of DU cells to activate
......
...@@ -798,6 +798,13 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) { ...@@ -798,6 +798,13 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc) {
rrc->node_type = ngran_eNB_CU; rrc->node_type = ngran_eNB_CU;
rrc->sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr); rrc->sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr);
rrc->sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_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 else { // no F1
...@@ -2373,7 +2380,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { ...@@ -2373,7 +2380,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) {
paramdef_t SCTPParams[] = SCTPPARAMS_DESC; paramdef_t SCTPParams[] = SCTPPARAMS_DESC;
char aprefix[MAX_OPTNAME_SIZE*2 + 8]; 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); 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); 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) { ...@@ -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).ranac[k] = 0;
F1AP_SETUP_REQ (msg_p).mib[k] = rrc->carrier[0].MIB; 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).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; break;
} // if } // if
......
...@@ -390,7 +390,20 @@ inline void ASN_DEBUG(const char *fmt, ...); ...@@ -390,7 +390,20 @@ inline void ASN_DEBUG(const char *fmt, ...);
#endif #endif
//Forward declaration //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. /** \brief Function callback prototype.
**/ **/
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#include "common/ran_context.h" #include "common/ran_context.h"
extern RAN_CONTEXT_t RC; 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 */ /* This structure describes association of a DU to a CU */
typedef struct f1ap_info { typedef struct f1ap_info {
...@@ -84,6 +84,7 @@ typedef struct f1ap_info { ...@@ -84,6 +84,7 @@ typedef struct f1ap_info {
} f1ap_info_t; } f1ap_info_t;
// ============================================================================== // ==============================================================================
static static
void CU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { 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) { ...@@ -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 // 2. use RC.rrc[enb_id] to fill the sctp_init_t with the ip, port
// 3. creat an itti message to init // 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; MessageDef *message_p = NULL;
message_p = itti_alloc_new_message (TASK_CU_F1, SCTP_INIT_MSG); 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) { ...@@ -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.nb_ipv6_addr = 0;
message_p->ittiMsg.sctp_init.ipv6_address[0] = "0:0:0:0:0:0:0:1"; 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); itti_send_msg_to_task(TASK_SCTP, enb_id, message_p);
} }
...@@ -150,24 +149,30 @@ void *F1AP_CU_task(void *arg) { ...@@ -150,24 +149,30 @@ void *F1AP_CU_task(void *arg) {
case SCTP_NEW_ASSOCIATION_IND: case SCTP_NEW_ASSOCIATION_IND:
LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_IND\n"); 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), CU_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_ind); &received_msg->ittiMsg.sctp_new_association_ind);
break; break;
case SCTP_NEW_ASSOCIATION_RESP: case SCTP_NEW_ASSOCIATION_RESP:
LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); 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), CU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_resp); &received_msg->ittiMsg.sctp_new_association_resp);
break; break;
case SCTP_DATA_IND: case SCTP_DATA_IND:
LOG_I(CU_F1AP, "SCTP_DATA_IND\n"); 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); CU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
break; 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 // case F1AP_SETUP_RESPONSE: // This is from RRC
// CU_send_F1_SETUP_RESPONSE(instance, *f1ap_setup_ind, &(F1AP_SETUP_RESP) f1ap_setup_resp) // CU_send_F1_SETUP_RESPONSE(instance, *f1ap_setup_ind, &(F1AP_SETUP_RESP) f1ap_setup_resp)
// break; // break;
...@@ -197,13 +202,33 @@ void *F1AP_CU_task(void *arg) { ...@@ -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) { 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); //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) { void CU_handle_F1_SETUP_REQUEST(F1AP_F1SetupRequest_t *message_p) {
F1AP_F1AP_PDU_t pdu; F1AP_F1AP_PDU_t pdu;
...@@ -235,7 +260,7 @@ void CU_handle_F1_SETUP_REQUEST(F1AP_F1SetupRequest_t *message_p) { ...@@ -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) { //void CU_send_F1_SETUP_RESPONSE(F1AP_F1SetupResponse_t *F1SetupResponse) {
//AssertFatal(1==0,"Not implemented yet\n"); //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 * ...@@ -366,7 +391,7 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, sctp_new_association_ind_t *
} }
// printf("\n"); // 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 */ /* decode */
// if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
// printf("Failed to decode F1 setup request\n"); // 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 ...@@ -127,8 +127,8 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t
length, length,
0, 0,
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); //LOG_I(F1AP, "f1ap_decode_pdu.dec_ret.code = %d\n", dec_ret.code);
if (dec_ret.code != RC_OK) { if (dec_ret.code != RC_OK) {
......
...@@ -45,9 +45,6 @@ ...@@ -45,9 +45,6 @@
static f1ap_setup_req_t *f1ap_du_data; 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) { 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]; 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; 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) { ...@@ -98,7 +95,6 @@ void *F1AP_DU_task(void *arg) {
// 2. store the message in f1ap context, that is also stored in RC // 2. store the message in f1ap context, that is also stored in RC
// 2. send a sctp_association req // 2. send a sctp_association req
LOG_I(DU_F1AP, "F1AP_SETUP_REQ\n"); 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), DU_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&F1AP_SETUP_REQ(received_msg)); &F1AP_SETUP_REQ(received_msg));
break; break;
...@@ -107,7 +103,6 @@ void *F1AP_DU_task(void *arg) { ...@@ -107,7 +103,6 @@ void *F1AP_DU_task(void *arg) {
// 1. store the respon // 1. store the respon
// 2. send the f1setup_req // 2. send the f1setup_req
LOG_I(DU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); 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), DU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_resp); &received_msg->ittiMsg.sctp_new_association_resp);
break; break;
...@@ -115,7 +110,6 @@ void *F1AP_DU_task(void *arg) { ...@@ -115,7 +110,6 @@ void *F1AP_DU_task(void *arg) {
case SCTP_DATA_IND: case SCTP_DATA_IND:
// ex: any F1 incoming message for DU ends here // ex: any F1 incoming message for DU ends here
LOG_I(DU_F1AP, "SCTP_DATA_IND\n"); 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); DU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
break; break;
...@@ -170,7 +164,9 @@ void DU_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_se ...@@ -170,7 +164,9 @@ void DU_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_se
// store data // store data
f1ap_du_data = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t)); f1ap_du_data = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t));
*f1ap_du_data = *f1ap_setup_req; *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 //du_f1ap_register_to_sctp
itti_send_msg_to_task(TASK_SCTP, instance, message_p); itti_send_msg_to_task(TASK_SCTP, instance, message_p);
} }
...@@ -285,10 +281,12 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { ...@@ -285,10 +281,12 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) {
F1AP_Served_Cell_Information_t served_cell_information; F1AP_Served_Cell_Information_t served_cell_information;
memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t));
/* - nRCGI */ /* - nRCGI */
F1AP_NRCGI_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(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); //MCC_MNC_TO_PLMNID(208, 95, 2, &nRCGI.pLMN_Identity);
NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity);
served_cell_information.nRCGI = nRCGI; served_cell_information.nRCGI = nRCGI;
...@@ -297,12 +295,8 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { ...@@ -297,12 +295,8 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) {
/* - fiveGS_TAC */ /* - fiveGS_TAC */
OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC,
f1ap_du_data->tac[i], &f1ap_du_data->tac[i],
sizeof(f1ap_du_data->tac[i])); 3);
// OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC,
// "10",
// 3);
/* - Configured_EPS_TAC */ /* - Configured_EPS_TAC */
if(0){ if(0){
...@@ -321,7 +315,6 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { ...@@ -321,7 +315,6 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) {
j++) { j++) {
/* > PLMN BroadcastPLMNs Item */ /* > PLMN BroadcastPLMNs Item */
F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); 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(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); 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); ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item);
...@@ -398,7 +391,7 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { ...@@ -398,7 +391,7 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) {
served_cell_information.nR_Mode_Info = nR_Mode_Info; served_cell_information.nR_Mode_Info = nR_Mode_Info;
/* - measurementTimingConfiguration */ /* - 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, OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration,
measurementTimingConfiguration, measurementTimingConfiguration,
...@@ -415,13 +408,6 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) { ...@@ -415,13 +408,6 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance) {
OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018
f1ap_du_data->sib1[i], f1ap_du_data->sib1[i],
f1ap_du_data->sib1_length[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; // gnb_du_served_cells_item.gNB_DU_System_Information = gNB_DU_System_Information; //
......
...@@ -47,6 +47,9 @@ ...@@ -47,6 +47,9 @@
#include "conversions.h" #include "conversions.h"
#include "msc.h" #include "msc.h"
extern f1ap_setup_req_t *f1ap_du_data_from_du;
static static
int f1ap_handle_f1_setup_request(uint32_t assoc_id, int f1ap_handle_f1_setup_request(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
...@@ -108,8 +111,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream, ...@@ -108,8 +111,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream,
memset(&pdu, 0, sizeof(pdu)); memset(&pdu, 0, sizeof(pdu));
if (f1ap_decode_pdu(&pdu, data, data_length) < 0) { if (f1ap_decode_pdu(&pdu, data, data_length) < 0) {
//F1AP_ERROR("Failed to decode PDU\n"); LOG_E(F1AP, "Failed to decode PDU\n");
printf("Failed to decode PDU\n");
return -1; return -1;
} }
...@@ -117,9 +119,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream, ...@@ -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( if (pdu.choice.initiatingMessage->procedureCode > sizeof(f1ap_messages_callback) / (3 * sizeof(
f1ap_message_decoded_callback)) f1ap_message_decoded_callback))
|| (pdu.present > F1AP_F1AP_PDU_PR_unsuccessfulOutcome)) { || (pdu.present > F1AP_F1AP_PDU_PR_unsuccessfulOutcome)) {
//F1AP_ERROR("[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);
printf("[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n",
assoc_id, pdu.choice.initiatingMessage->procedureCode, pdu.present); assoc_id, pdu.choice.initiatingMessage->procedureCode, pdu.present);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu);
return -1; return -1;
...@@ -129,10 +129,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream, ...@@ -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). * This can mean not implemented or no procedure for eNB (wrong direction).
*/ */
if (f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) { if (f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) {
// F1AP_ERROR("[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));
printf("[SCTP %d] No handler for procedureCode %ld in %s\n",
assoc_id, pdu.choice.initiatingMessage->procedureCode, assoc_id, pdu.choice.initiatingMessage->procedureCode,
f1ap_direction2String(pdu.present - 1)); f1ap_direction2String(pdu.present - 1));
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); 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, ...@@ -151,9 +148,147 @@ int f1ap_handle_f1_setup_request(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
F1AP_F1AP_PDU_t *pdu) 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 static
...@@ -161,7 +296,7 @@ int f1ap_handle_f1_setup_response(uint32_t assoc_id, ...@@ -161,7 +296,7 @@ int f1ap_handle_f1_setup_response(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
F1AP_F1AP_PDU_t *pdu) F1AP_F1AP_PDU_t *pdu)
{ {
printf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"); printf("f1ap_handle_f1_setup_response\n");
return 0; return 0;
} }
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* limitations under the License. * limitations under the License.
*------------------------------------------------------------------------------- *-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance: * For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org * conmnc_digit_lengtht@openairinterface.org
*/ */
/*! \file RRC/LTE/defs.h /*! \file RRC/LTE/defs.h
...@@ -713,6 +713,8 @@ typedef struct eNB_RRC_INST_s { ...@@ -713,6 +713,8 @@ typedef struct eNB_RRC_INST_s {
int mnc; int mnc;
/// number of mnc digits /// number of mnc digits
int mnc_digit_length; int mnc_digit_length;
/// tac
int tac;
// other RAN parameters // other RAN parameters
int srb1_timer_poll_retransmit; int srb1_timer_poll_retransmit;
......
This diff is collapsed.
...@@ -42,7 +42,7 @@ void openair_rrc_top_init(int eMBMS_active, char *uecap_xer, uint8_t cba_group_a ...@@ -42,7 +42,7 @@ void openair_rrc_top_init(int eMBMS_active, char *uecap_xer, uint8_t cba_group_a
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
char char
openair_rrc_eNB_configuration( openair_rrc_eNB_configuration(
const module_id_t enb_mod_idP const module_id_t enb_mod_idP, RrcConfigurationReq *rrc_configuration_req
); );
#endif #endif
char openair_rrc_eNB_init( char openair_rrc_eNB_init(
......
...@@ -139,7 +139,7 @@ do { \ ...@@ -139,7 +139,7 @@ do { \
#define OCTET_STRING_TO_INT16(aSN, x) \ #define OCTET_STRING_TO_INT16(aSN, x) \
do { \ 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); \ BUFFER_TO_INT16((aSN)->buf, x); \
} while(0) } while(0)
......
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