From deac180224bb82e96d5051ab99cf8b3e770d84fd Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 22 Nov 2023 18:53:47 +0100 Subject: [PATCH] Set correct gNB/gnB-DU/gNB-CU-UP ID for agent start --- executables/nr-softmodem.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 29cb7caeda..aa8dd6025e 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -572,6 +572,7 @@ void init_pdcp(void) { } #ifdef E2_AGENT +#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" // need to get info from MAC static void initialize_agent(ngran_node_t node_type, e2_agent_args_t oai_args) { AssertFatal(oai_args.sm_dir != NULL , "Please, specify the directory where the SMs are located in the config file, i.e., add in config file the next line: e2_agent = {near_ric_ip_addr = \"127.0.0.1\"; sm_dir = \"/usr/local/lib/flexric/\");} "); @@ -593,15 +594,17 @@ static void initialize_agent(ngran_node_t node_type, e2_agent_args_t oai_args) int nb_id = 0; int cu_du_id = 0; if (node_type == ngran_gNB) { - nb_id = rrc->nr_cellid; + nb_id = rrc->node_id; } else if (node_type == ngran_gNB_DU) { - AssertFatal(rrc->node_id != 0, "cannot handle node ID 0, please change gNB_ID\n"); - cu_du_id = rrc->node_id; - nb_id = rrc->nr_cellid; + const gNB_MAC_INST* mac = RC.nrmac[0]; + AssertFatal(mac != NULL, "MAC not initialized\n"); + cu_du_id = mac->f1_config.gnb_id; + nb_id = mac->f1_config.setup_req->gNB_DU_id; } else if (node_type == ngran_gNB_CU) { - AssertFatal(rrc->node_id != 0, "cannot handle node ID 0, please change gNB_ID\n"); + // agent buggy: the CU has no second ID, it is the CU-UP ID + // however, that is not a problem her for us, so put the same ID twice + nb_id = rrc->node_id; cu_du_id = rrc->node_id; - nb_id = rrc->nr_cellid; } else { LOG_E(NR_RRC, "not supported ran type detect\n"); }