Commit 608a1459 authored by Robert Schmidt's avatar Robert Schmidt

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
parent eb577d11
...@@ -120,6 +120,9 @@ int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessa ...@@ -120,6 +120,9 @@ int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessa
goto error; goto error;
hello_msg->header = header; 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)); *msg = malloc(sizeof(Protocol__FlexranMessage));
if(*msg == NULL) if(*msg == NULL)
...@@ -150,6 +153,7 @@ int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg) { ...@@ -150,6 +153,7 @@ int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg) {
goto error; goto error;
free(msg->hello_msg->header); free(msg->hello_msg->header);
free(msg->hello_msg->capabilities);
free(msg->hello_msg); free(msg->hello_msg);
free(msg); free(msg);
return 0; return 0;
...@@ -816,9 +820,6 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F ...@@ -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->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; enb_config_reply_msg->n_cell_config = MAX_NUM_CCs;
Protocol__FlexCellConfig **cell_conf; Protocol__FlexCellConfig **cell_conf;
......
...@@ -1393,3 +1393,94 @@ float flexran_get_rrc_neigh_rsrq(mid_t mod_id, mid_t ue_id, int cell_id) ...@@ -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; 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)]; 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;
}
...@@ -504,3 +504,16 @@ int flexran_get_rrc_neigh_plmn_mcc(mid_t mod_id, mid_t ue_id, int cell_id); */ ...@@ -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*/ /*Get MNC PLMN identity neighbouring Cell*/
/* currently not implemented /* currently not implemented
int flexran_get_rrc_neigh_plmn_mnc(mid_t mod_id, mid_t ue_id, int cell_id); */ 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);
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