From 608a14591e0da1f988035c24860a25425550295f Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Tue, 23 Oct 2018 17:52:32 +0200 Subject: [PATCH] Add BS ID and Capabilities to FlexRAN Hello Msg * Hello msg agent->RTC carries ID and capabilities this agent supports * RAN API provides ID and capabilities: - flexran_get_bs_id() - flexran_get_capabilities() // protobuf list of capabilities - flexran_get_capabilities() // capabilities as bit mask Add FlexRAN capabilities mask RAN API function --- openair2/ENB_APP/flexran_agent_common.c | 7 +- openair2/ENB_APP/flexran_agent_ran_api.c | 91 ++++++++++++++++++++++++ openair2/ENB_APP/flexran_agent_ran_api.h | 13 ++++ 3 files changed, 108 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index db1943c9451..bffe145c92a 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 e39d676061f..97e91dcfa85 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 dacca55ab78..8fbff216d3a 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); -- GitLab