From 129b62e708cdcb0975f55ac4a49f74a8030e3258 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 4 Dec 2025 18:17:23 +0100 Subject: [PATCH] Telnet: improve fetch_du_by_ue_id to auto-detect connected UE Issue: sometimes it happens that an ul failure occurs in the handover pipeline, UE reconnects with different UE ID and fetch_du_by_ue_id fails. - Modified fetch_du_by_ue_id in telnetsrv_ci.c to automatically find the connected UE when no UE ID is provided, similar to other telnet commands like rrc_gNB_trigger_f1_ho - Updated test cases in container_sa_f1_ho_b210_quectel.xml to use the improved command without hardcoded UE ID parameter - This makes the command more robust and easier to use in CI tests --- ci-scripts/xml_files/container_5g_f1_rfsim.xml | 6 +++--- ci-scripts/xml_files/container_5g_rfsim_n2_ho.xml | 6 +++--- ci-scripts/xml_files/container_sa_f1_ho_b210_quectel.xml | 6 +++--- ci-scripts/xml_files/container_sa_n2_ho_b210_quectel.xml | 4 ++-- common/utils/telnetsrv/telnetsrv_ci.c | 9 ++++++++- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim.xml b/ci-scripts/xml_files/container_5g_f1_rfsim.xml index 1ffba40f77..7385daacfc 100644 --- a/ci-scripts/xml_files/container_5g_f1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_f1_rfsim.xml @@ -240,7 +240,7 @@ Custom_Command UE (1) connected to DU-PCI 1? localhost - echo ci fetch_du_by_ue_id 1 | ncat 192.168.71.150 9090 | grep "3585" + echo ci fetch_du_by_ue_id | ncat 192.168.71.150 9090 | grep "3585" @@ -271,7 +271,7 @@ Custom_Command UE (1) connected to DU-PCI 0? localhost - echo ci fetch_du_by_ue_id 1 | ncat 192.168.71.150 9090 | grep "3584" + echo ci fetch_du_by_ue_id | ncat 192.168.71.150 9090 | grep "3584" @@ -302,7 +302,7 @@ Custom_Command UE (1) connected to DU-PCI 1? localhost - echo ci fetch_du_by_ue_id 1 | ncat 192.168.71.150 9090 | grep "3585" + echo ci fetch_du_by_ue_id | ncat 192.168.71.150 9090 | grep "3585" diff --git a/ci-scripts/xml_files/container_5g_rfsim_n2_ho.xml b/ci-scripts/xml_files/container_5g_rfsim_n2_ho.xml index 6a4d43f93a..9ef14478b1 100644 --- a/ci-scripts/xml_files/container_5g_rfsim_n2_ho.xml +++ b/ci-scripts/xml_files/container_5g_rfsim_n2_ho.xml @@ -120,7 +120,7 @@ Custom_Command UE (1) connected to DU-PCI 1? localhost - echo ci fetch_du_by_ue_id 1 | ncat 192.168.71.180 9090 | grep "1234" + echo ci fetch_du_by_ue_id | ncat 192.168.71.180 9090 | grep "1234" @@ -181,7 +181,7 @@ Custom_Command UE (1) connected to DU-PCI 0? localhost - echo ci fetch_du_by_ue_id 1 | ncat 192.168.71.150 9090 | grep "3584" + echo ci fetch_du_by_ue_id | ncat 192.168.71.150 9090 | grep "3584" @@ -218,7 +218,7 @@ Custom_Command UE (1) connected to DU-PCI 1? localhost - echo ci fetch_du_by_ue_id 1 | ncat 192.168.71.180 9090 | grep "1234" + echo ci fetch_du_by_ue_id | ncat 192.168.71.180 9090 | grep "1234" diff --git a/ci-scripts/xml_files/container_sa_f1_ho_b210_quectel.xml b/ci-scripts/xml_files/container_sa_f1_ho_b210_quectel.xml index ff36947a57..2804e3c14e 100644 --- a/ci-scripts/xml_files/container_sa_f1_ho_b210_quectel.xml +++ b/ci-scripts/xml_files/container_sa_f1_ho_b210_quectel.xml @@ -129,7 +129,7 @@ Custom_Command UE connected to DU1? groot - echo ci fetch_du_by_ue_id 1 | ncat 127.0.0.1 9090 | grep "3585" + echo ci fetch_du_by_ue_id | ncat 127.0.0.1 9090 | grep "3585" @@ -152,7 +152,7 @@ Custom_Command UE connected to DU0? groot - echo ci fetch_du_by_ue_id 1 | ncat 127.0.0.1 9090 | grep "3584" + echo ci fetch_du_by_ue_id | ncat 127.0.0.1 9090 | grep "3584" @@ -175,7 +175,7 @@ Custom_Command UE connected to DU1? groot - echo ci fetch_du_by_ue_id 1 | ncat 127.0.0.1 9090 | grep "3585" + echo ci fetch_du_by_ue_id | ncat 127.0.0.1 9090 | grep "3585" diff --git a/ci-scripts/xml_files/container_sa_n2_ho_b210_quectel.xml b/ci-scripts/xml_files/container_sa_n2_ho_b210_quectel.xml index 84c5a5bea5..1f4c7c1981 100644 --- a/ci-scripts/xml_files/container_sa_n2_ho_b210_quectel.xml +++ b/ci-scripts/xml_files/container_sa_n2_ho_b210_quectel.xml @@ -121,7 +121,7 @@ Custom_Command UE connected to gNB-PCI1? rocket - echo ci fetch_du_by_ue_id 1 | ncat 127.0.0.1 9090 | grep "3585" + echo ci fetch_du_by_ue_id | ncat 127.0.0.1 9090 | grep "3585" @@ -144,7 +144,7 @@ Custom_Command UE connected to gNB-PCI0? groot - echo ci fetch_du_by_ue_id 1 | ncat 127.0.0.1 9090 | grep "3584" + echo ci fetch_du_by_ue_id | ncat 127.0.0.1 9090 | grep "3584" diff --git a/common/utils/telnetsrv/telnetsrv_ci.c b/common/utils/telnetsrv/telnetsrv_ci.c index 10f9626ef0..a2bcccd150 100644 --- a/common/utils/telnetsrv/telnetsrv_ci.c +++ b/common/utils/telnetsrv/telnetsrv_ci.c @@ -154,10 +154,17 @@ int fetch_du_by_ue_id(char *buf, int debug, telnet_printfunc_t prnt) if (!RC.nrrrc) ERROR_MSG_RET("no RRC present, cannot list counts\n"); - ue_id_t ue_id = 1; + ue_id_t ue_id; if (buf) { ue_id = strtol(buf, NULL, 10); + } else { + // No UE ID provided: find the connected UE first + rrc_gNB_ue_context_t *ue = get_single_rrc_ue(); + if (!ue) + ERROR_MSG_RET("no single UE in RRC present\n"); + ue_id = ue->ue_context.rrc_ue_id; } + nr_rrc_du_container_t *du = get_du_for_ue(RC.nrrrc[0], ue_id); if (du) {