From 6370ad25fae242a1b09284a701c15807eacc4881 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 16 Jan 2025 10:29:12 +0100 Subject: [PATCH 1/6] Use calloc_or_fail whenever possible --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 9 +++------ openair2/RRC/NR/rrc_gNB_mobility.c | 12 ++++-------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index e3df557d3d..b3d9c2e9e4 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1416,15 +1416,12 @@ int do_NR_Paging(uint8_t Mod_id, uint8_t *buffer, uint32_t tmsi) * in encoded form which we decode + add to the handoverPreparationInformation */ int do_NR_HandoverPreparationInformation(const uint8_t *uecap_buf, int uecap_buf_size, uint8_t *buf, int buf_size) { - NR_HandoverPreparationInformation_t *hpi = calloc(1, sizeof(*hpi)); - AssertFatal(hpi != NULL, "out of memory\n"); + NR_HandoverPreparationInformation_t *hpi = calloc_or_fail(1, sizeof(*hpi)); hpi->criticalExtensions.present = NR_HandoverPreparationInformation__criticalExtensions_PR_c1; - hpi->criticalExtensions.choice.c1 = calloc(1, sizeof(*hpi->criticalExtensions.choice.c1)); - AssertFatal(hpi->criticalExtensions.choice.c1 != NULL, "out of memory\n"); + hpi->criticalExtensions.choice.c1 = calloc_or_fail(1, sizeof(*hpi->criticalExtensions.choice.c1)); hpi->criticalExtensions.choice.c1->present = NR_HandoverPreparationInformation__criticalExtensions__c1_PR_handoverPreparationInformation; - NR_HandoverPreparationInformation_IEs_t *hpi_ie = calloc(1, sizeof(*hpi_ie)); - AssertFatal(hpi_ie != NULL, "out of memory\n"); + NR_HandoverPreparationInformation_IEs_t *hpi_ie = calloc_or_fail(1, sizeof(*hpi_ie)); hpi->criticalExtensions.choice.c1->choice.handoverPreparationInformation = hpi_ie; NR_UE_CapabilityRAT_ContainerList_t *list = NULL; diff --git a/openair2/RRC/NR/rrc_gNB_mobility.c b/openair2/RRC/NR/rrc_gNB_mobility.c index e4c4e8b67e..548da5c19a 100644 --- a/openair2/RRC/NR/rrc_gNB_mobility.c +++ b/openair2/RRC/NR/rrc_gNB_mobility.c @@ -39,15 +39,12 @@ typedef enum { HO_CTX_BOTH, HO_CTX_SOURCE, HO_CTX_TARGET } ho_ctx_type_t; static nr_handover_context_t *alloc_ho_ctx(ho_ctx_type_t type) { - nr_handover_context_t *ho_ctx = calloc(1, sizeof(*ho_ctx)); - AssertFatal(ho_ctx != NULL, "out of memory\n"); + nr_handover_context_t *ho_ctx = calloc_or_fail(1, sizeof(*ho_ctx)); if (type == HO_CTX_SOURCE || type == HO_CTX_BOTH) { - ho_ctx->source = calloc(1, sizeof(*ho_ctx->source)); - AssertFatal(ho_ctx->source != NULL, "out of memory\n"); + ho_ctx->source = calloc_or_fail(1, sizeof(*ho_ctx->source)); } if (type == HO_CTX_TARGET || type == HO_CTX_BOTH) { - ho_ctx->target = calloc(1, sizeof(*ho_ctx->target)); - AssertFatal(ho_ctx->target != NULL, "out of memory\n"); + ho_ctx->target = calloc_or_fail(1, sizeof(*ho_ctx->target)); } return ho_ctx; } @@ -157,8 +154,7 @@ static void nr_initiate_handover(const gNB_RRC_INST *rrc, // this changes AssertFatal(pdu->param.nb_qos == 1, "only 1 Qos flow supported\n"); drb->drb_info.flows_to_be_setup_length = 1; - drb->drb_info.flows_mapped_to_drb = calloc(1, sizeof(f1ap_flows_mapped_to_drb_t)); - AssertFatal(drb->drb_info.flows_mapped_to_drb, "could not allocate memory\n"); + drb->drb_info.flows_mapped_to_drb = calloc_or_fail(1, sizeof(f1ap_flows_mapped_to_drb_t)); int qfi = rrc_drb->cnAssociation.sdap_config.mappedQoS_FlowsToAdd[0]; DevAssert(qfi > 0); drb->drb_info.flows_mapped_to_drb[0].qfi = qfi; From f5d8debdcbb1c2228aea78e3159d3c487f8d07b6 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 16 Jan 2025 10:29:57 +0100 Subject: [PATCH 2/6] Cleanup outdated comments --- openair2/RRC/NR/rrc_gNB_mobility.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/RRC/NR/rrc_gNB_mobility.c b/openair2/RRC/NR/rrc_gNB_mobility.c index 548da5c19a..174211487c 100644 --- a/openair2/RRC/NR/rrc_gNB_mobility.c +++ b/openair2/RRC/NR/rrc_gNB_mobility.c @@ -279,7 +279,7 @@ static void nr_rrc_f1_ho_complete(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE) f1ap_ue_context_release_cmd_t cmd = { .gNB_CU_ue_id = UE->rrc_ue_id, .gNB_DU_ue_id = source_ctx->du_ue_id, - .cause = F1AP_CAUSE_RADIO_NETWORK, // better + .cause = F1AP_CAUSE_RADIO_NETWORK, .cause_value = 5, // 5 = F1AP_CauseRadioNetwork_interaction_with_other_procedure .srb_id = DL_SCH_LCID_DCCH, }; From 89547f8a0cb51fb09c409d6b70107053d98c37fd Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 16 Jan 2025 11:47:57 +0100 Subject: [PATCH 3/6] Handle null pointers and improve logs in process_Event_Based_Measurement_Report --- openair2/RRC/NR/rrc_gNB.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 281af514fa..3ac7415a1f 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1276,7 +1276,11 @@ static void process_Event_Based_Measurement_Report(gNB_RRC_UE_t *ue, NR_ReportCo break; case NR_EventTriggerConfig__eventId_PR_eventA3: { - LOG_W(NR_RRC, "HO LOG: Event A3 Report - Neighbour Becomes Better than Serving!\n"); + LOG_W(NR_RRC, "HO LOG: Event A3 Report for UE %d - Neighbour Becomes Better than Serving!\n", ue->rrc_ue_id); + if (!measurementReport->criticalExtensions.choice.measurementReport) { + LOG_E(NR_RRC, "HO LOG: Event A3 Report: measurementReport is null\n"); + break; + } const NR_MeasResults_t *measResults = &measurementReport->criticalExtensions.choice.measurementReport->measResults; for (int serving_cell_idx = 0; serving_cell_idx < measResults->measResultServingMOList.list.count; serving_cell_idx++) { @@ -1290,11 +1294,11 @@ static void process_Event_Based_Measurement_Report(gNB_RRC_UE_t *ue, NR_ReportCo LOG_D(NR_RRC, "Serving Cell RSRP: %d\n", servingCellRSRP); } - if (measResults->measResultNeighCells == NULL) - break; - - if (measResults->measResultNeighCells->present != NR_MeasResults__measResultNeighCells_PR_measResultListNR) + if (measResults->measResultNeighCells == NULL || + measResults->measResultNeighCells->present != NR_MeasResults__measResultNeighCells_PR_measResultListNR) { + LOG_D(NR_RRC, "HO LOG: No neighbor cell measurements available\n"); break; + } const NR_MeasResultListNR_t *measResultListNR = measResults->measResultNeighCells->choice.measResultListNR; for (int neigh_meas_idx = 0; neigh_meas_idx < measResultListNR->list.count; neigh_meas_idx++) { @@ -1392,7 +1396,7 @@ static void rrc_gNB_process_MeasurementReport(gNB_RRC_UE_t *UE, NR_MeasurementRe } } - if (report_config == NULL) { + if (report_config == NULL || report_config->choice.reportConfigNR == NULL) { LOG_E(NR_RRC, "There is no related report configuration for this measId!\n"); return; } @@ -1741,7 +1745,11 @@ static int rrc_gNB_decode_dcch(gNB_RRC_INST *rrc, const f1ap_ul_rrc_message_t *m break; case NR_UL_DCCH_MessageType__c1_PR_measurementReport: - rrc_gNB_process_MeasurementReport(UE, ul_dcch_msg->message.choice.c1->choice.measurementReport); + if (ul_dcch_msg->message.choice.c1->choice.measurementReport != NULL) { + rrc_gNB_process_MeasurementReport(UE, ul_dcch_msg->message.choice.c1->choice.measurementReport); + } else { + LOG_E(NR_RRC, "UE %d: No measurementReport CHOICE is given\n", ue_context_p->ue_context.rrc_ue_id); + } break; case NR_UL_DCCH_MessageType__c1_PR_ulInformationTransfer: From e2369656a7bf28bd2098210a799feaa4b30e06b0 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Fri, 31 Jan 2025 17:42:49 +0100 Subject: [PATCH 4/6] Remove unused param in gnb-cu.sa.f1.conf --- targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-cu.sa.f1.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-cu.sa.f1.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-cu.sa.f1.conf index 08b72bf6c6..4acca69864 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-cu.sa.f1.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-cu.sa.f1.conf @@ -1,7 +1,6 @@ Active_gNBs = ( "cu-rfsim"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -Num_Threads_PUSCH = 8; gNBs = ( From d16de2aae46c162375cd5a8a594e2bc3dcc9341f Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 6 Feb 2025 15:08:00 +0100 Subject: [PATCH 5/6] Remove magic numbers and use MAX_DRBS_PER_UE in nr_initiate_handover --- openair2/RRC/NR/rrc_gNB_mobility.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_mobility.c b/openair2/RRC/NR/rrc_gNB_mobility.c index 174211487c..a6f4acb953 100644 --- a/openair2/RRC/NR/rrc_gNB_mobility.c +++ b/openair2/RRC/NR/rrc_gNB_mobility.c @@ -129,9 +129,9 @@ static void nr_initiate_handover(const gNB_RRC_INST *rrc, .handoverPreparationInfo_length = ho_prep_len, }; - f1ap_drb_to_be_setup_t drbs[32] = {0}; // maximum DRB can be 32 + f1ap_drb_to_be_setup_t drbs[MAX_DRBS_PER_UE] = {0}; int nb_drb = 0; - for (int i = 0; i < 32; ++i) { /* for each DRB */ + for (int i = 0; i < sizeofArray(drbs); ++i) { drb_t *rrc_drb = &ue->established_drbs[i]; if (rrc_drb->status == DRB_INACTIVE) continue; From 501ac2c7d2b410db1eb61f0b22bb1afce8bd361d Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 6 Feb 2025 15:06:39 +0100 Subject: [PATCH 6/6] Add handover to rfsim F1 CI test Added 3 way F1 handover test with data exchange in the F1 pipeline. The major change is that the UE is acting as a server in the handover scenarion, so it needs to comply with the changes in !3280. --- .../xml_files/container_5g_f1_rfsim.xml | 40 ++++++++++++++++- .../5g_f1_rfsimulator/docker-compose.yaml | 44 ++++++++++++++++--- 2 files changed, 77 insertions(+), 7 deletions(-) diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim.xml b/ci-scripts/xml_files/container_5g_f1_rfsim.xml index 3f3fc5aa3d..a9bd7b761e 100644 --- a/ci-scripts/xml_files/container_5g_f1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_f1_rfsim.xml @@ -45,6 +45,10 @@ 040023 020022 040024 + 000024 + 040025 + 000031 + 030021 100021 222222 @@ -73,9 +77,9 @@ Deploy_Object - Deploy OAI 5G CU+DU+UE RF sim SA + Deploy OAI 5G CU + DU-PCI0 + UE RF sim SA ci-scripts/yaml_files/5g_f1_rfsimulator - oai-cu oai-du oai-nr-ue + oai-cu oai-du-pci0 oai-nr-ue 0 0 @@ -86,6 +90,12 @@ 5 + + IdleSleep + Sleep + 2 + + Attach_UE Attach OAI UE (Wait for IP) @@ -93,6 +103,15 @@ cacofonix + + Deploy_Object + Deploy OAI 5G (target) DU-PCI1 RF sim SA + ci-scripts/yaml_files/5g_f1_rfsimulator + oai-du-pci1 + 0 + 0 + + Ping Ping ext-dn from all NR-UEs @@ -151,6 +170,15 @@ 80 + + Ping + Ping ext-dn from all NR-UEs + rfsim5g_ue + cacofonix + -c 5 192.168.72.135 -i0.5 -w25 + 80 + + Custom_Command Verify Reestablishment @@ -191,6 +219,14 @@ yes + + Custom_Command + Trigger Handover + cacofonix + echo ci trigger_f1_ho | nc 192.168.71.150 9090 + yes + + Undeploy_Object true diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml index df0a9f4b07..d36add6ec3 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -90,6 +90,7 @@ services: environment: USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time --rfsimulator.options chanmod + --gNBs.[0].remote_s_address 0.0.0.0 --telnetsrv --telnetsrv.listenaddr 192.168.71.150 --telnetsrv.shrmod ci ASAN_OPTIONS: detect_leaks=0:detect_odr_violation=0 @@ -106,9 +107,9 @@ services: timeout: 5s retries: 5 - oai-du: + oai-du-pci0: image: ${REGISTRY:-oaisoftwarealliance}/${GNB_IMG:-oai-gnb}:${TAG:-develop} - container_name: rfsim5g-oai-du + container_name: rfsim5g-oai-du-pci0 cap_drop: - ALL environment: @@ -117,9 +118,11 @@ services: --rfsimulator.options chanmod --telnetsrv --telnetsrv.listenaddr 192.168.71.171 --telnetsrv.shrmod ci + --rfsimulator.serveraddr 192.168.71.181 ASAN_OPTIONS: detect_leaks=0:detect_odr_violation=0 depends_on: - oai-cu + - oai-nr-ue networks: public_net: ipv4_address: 192.168.71.171 @@ -131,6 +134,37 @@ services: timeout: 5s retries: 5 + oai-du-pci1: + image: ${REGISTRY:-oaisoftwarealliance}/${GNB_IMG:-oai-gnb}:${TAG:-develop} + container_name: rfsim5g-oai-du-pci1 + cap_drop: + - ALL + environment: + USE_ADDITIONAL_OPTIONS: --rfsim + --log_config.global_log_options level,nocolor,time + --gNBs.[0].gNB_DU_ID 3585 + --gNBs.[0].nr_cellid 11111111 + --gNBs.[0].servingCellConfigCommon.[0].physCellId 1 + --gNBs.[0].servingCellConfigCommon.[0].absoluteFrequencySSB 643296 + --gNBs.[0].servingCellConfigCommon.[0].dl_absoluteFrequencyPointA 642024 + --gNBs.[0].servingCellConfigCommon.[0].ssb_PositionsInBurst_Bitmap 3 + --MACRLCs.[0].local_n_address 192.168.71.172 + --rfsimulator.serveraddr 192.168.71.181 + ASAN_OPTIONS: detect_leaks=0:detect_odr_violation=0 + depends_on: + - oai-cu + - oai-nr-ue + networks: + public_net: + ipv4_address: 192.168.71.172 + volumes: + - ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf + healthcheck: + test: /bin/bash -c "pgrep nr-softmodem" + interval: 10s + timeout: 5s + retries: 5 + oai-nr-ue: image: ${REGISTRY:-oaisoftwarealliance}/${NRUE_IMG:-oai-nr-ue}:${TAG:-develop} container_name: rfsim5g-oai-nr-ue @@ -143,12 +177,12 @@ services: USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001100 - --rfsimulator.serveraddr 192.168.71.171 --rfsimulator.options chanmod + --rfsimulator.serveraddr server --telnetsrv --telnetsrv.shrmod ciUE --telnetsrv.listenaddr 192.168.71.181 --telnetsrv.listenport 8091 + --channelmod.modellist_rfsimu_1.[0].model_name rfsimu_channel_ue0 + --channelmod.modellist_rfsimu_1.[1].model_name rfsimu_channel_ue1 ASAN_OPTIONS: detect_odr_violation=0 - depends_on: - - oai-du networks: public_net: ipv4_address: 192.168.71.181