diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index db1943c9451f15304902cefd1d5ee080897280bf..bffe145c92abad43233e628056aab3f64de10cde 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -120,6 +120,9 @@ int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessa goto error; hello_msg->header = header; + hello_msg->bs_id = flexran_get_bs_id(mod_id); + hello_msg->has_bs_id = 1; + hello_msg->n_capabilities = flexran_get_capabilities(mod_id, &hello_msg->capabilities); *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) @@ -150,6 +153,7 @@ int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg) { goto error; free(msg->hello_msg->header); + free(msg->hello_msg->capabilities); free(msg->hello_msg); free(msg); return 0; @@ -816,9 +820,6 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F enb_config_reply_msg->header = header; - enb_config_reply_msg->enb_id = RC.flexran[mod_id]->agent_id; - enb_config_reply_msg->has_enb_id = 1; - enb_config_reply_msg->n_cell_config = MAX_NUM_CCs; Protocol__FlexCellConfig **cell_conf; diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index e39d676061f5e38a47078ee38001c785790811be..97e91dcfa8505323dac724b735ef9d4ceed00e64 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -1393,3 +1393,94 @@ float flexran_get_rrc_neigh_rsrq(mid_t mod_id, mid_t ue_id, int cell_id) if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrqResult) return 0; return RSRQ_meas_mapping[*(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrqResult)]; } + +uint64_t flexran_get_bs_id(mid_t mod_id) +{ + if (!rrc_is_present(mod_id)) return 0; + return RC.rrc[mod_id]->nr_cellid; +} + +size_t flexran_get_capabilities(mid_t mod_id, Protocol__FlexBsCapability **caps) +{ + if (!caps) return 0; + if (!rrc_is_present(mod_id)) return 0; + size_t n_caps = 0; + switch (RC.rrc[mod_id]->node_type) { + case ngran_eNB_CU: + case ngran_ng_eNB_CU: + case ngran_gNB_CU: + n_caps = 3; + *caps = calloc(n_caps, sizeof(Protocol__FlexBsCapability)); + AssertFatal(*caps, "could not allocate %zu bytes for Protocol__FlexBsCapability array\n", + n_caps * sizeof(Protocol__FlexBsCapability)); + (*caps)[0] = PROTOCOL__FLEX_BS_CAPABILITY__PDCP; + (*caps)[1] = PROTOCOL__FLEX_BS_CAPABILITY__SDAP; + (*caps)[2] = PROTOCOL__FLEX_BS_CAPABILITY__RRC; + break; + case ngran_eNB_DU: + case ngran_gNB_DU: + n_caps = 5; + *caps = calloc(n_caps, sizeof(Protocol__FlexBsCapability)); + AssertFatal(*caps, "could not allocate %zu bytes for Protocol__FlexBsCapability array\n", + n_caps * sizeof(Protocol__FlexBsCapability)); + (*caps)[0] = PROTOCOL__FLEX_BS_CAPABILITY__LOPHY; + (*caps)[1] = PROTOCOL__FLEX_BS_CAPABILITY__HIPHY; + (*caps)[2] = PROTOCOL__FLEX_BS_CAPABILITY__LOMAC; + (*caps)[3] = PROTOCOL__FLEX_BS_CAPABILITY__HIMAC; + (*caps)[4] = PROTOCOL__FLEX_BS_CAPABILITY__RLC; + break; + case ngran_eNB: + case ngran_ng_eNB: + case ngran_gNB: + n_caps = 8; + *caps = calloc(n_caps, sizeof(Protocol__FlexBsCapability)); + AssertFatal(*caps, "could not allocate %zu bytes for Protocol__FlexBsCapability array\n", + n_caps * sizeof(Protocol__FlexBsCapability)); + (*caps)[0] = PROTOCOL__FLEX_BS_CAPABILITY__LOPHY; + (*caps)[1] = PROTOCOL__FLEX_BS_CAPABILITY__HIPHY; + (*caps)[2] = PROTOCOL__FLEX_BS_CAPABILITY__LOMAC; + (*caps)[3] = PROTOCOL__FLEX_BS_CAPABILITY__HIMAC; + (*caps)[4] = PROTOCOL__FLEX_BS_CAPABILITY__RLC; + (*caps)[5] = PROTOCOL__FLEX_BS_CAPABILITY__PDCP; + (*caps)[6] = PROTOCOL__FLEX_BS_CAPABILITY__SDAP; + (*caps)[7] = PROTOCOL__FLEX_BS_CAPABILITY__RRC; + break; + } + return n_caps; +} + +uint16_t flexran_get_capabilities_mask(mid_t mod_id) +{ + if (!rrc_is_present(mod_id)) return 0; + uint16_t mask = 0; + switch (RC.rrc[mod_id]->node_type) { + case ngran_eNB_CU: + case ngran_ng_eNB_CU: + case ngran_gNB_CU: + mask = (1 << PROTOCOL__FLEX_BS_CAPABILITY__PDCP) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__SDAP) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC); + break; + case ngran_eNB_DU: + case ngran_gNB_DU: + mask = (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOPHY) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIPHY) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOMAC) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIMAC) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RLC); + break; + case ngran_eNB: + case ngran_ng_eNB: + case ngran_gNB: + mask = (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOPHY) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIPHY) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOMAC) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIMAC) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RLC) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__PDCP) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__SDAP) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC); + break; + } + return mask; +} diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index dacca55ab78a2bba6f642c25bc7e5d710429ba3a..8fbff216d3a283dc946a92be6f9bd1beb7025338 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -504,3 +504,16 @@ int flexran_get_rrc_neigh_plmn_mcc(mid_t mod_id, mid_t ue_id, int cell_id); */ /*Get MNC PLMN identity neighbouring Cell*/ /* currently not implemented int flexran_get_rrc_neigh_plmn_mnc(mid_t mod_id, mid_t ue_id, int cell_id); */ + +/********************* general information *****************/ +/* get an ID for this BS (or part of a BS) */ +uint64_t flexran_get_bs_id(mid_t mod_id); + +/* get the capabilities supported by the underlying network function, + * returns the number and stores list of this length in caps. If there are zero + * capabilities, *caps will be NULL */ +size_t flexran_get_capabilities(mid_t mod_id, Protocol__FlexBsCapability **caps); + +/* get the capabilities supported by the underlying network function as a bit + * mask. */ +uint16_t flexran_get_capabilities_mask(mid_t mod_id);