From fd9db7fec66a0f09e30952087d3081e50eff86c5 Mon Sep 17 00:00:00 2001 From: durga-ct Date: Wed, 2 Sep 2026 20:58:34 +0530 Subject: [PATCH 1/2] test_l3.py: Sanitize signal and channel fields before CSV write - extract numeric RSSI from "-53 dBm" - extract channel number from "[channel: 36]", fall back to "NA" for 0/-1/empty Signed-off-by: durga-ct --- py-scripts/test_l3.py | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/py-scripts/test_l3.py b/py-scripts/test_l3.py index b3a403050..2908ff516 100755 --- a/py-scripts/test_l3.py +++ b/py-scripts/test_l3.py @@ -3424,15 +3424,27 @@ def write_dl_port_csv( atten, port_eid ] + # Normalize RSSI / Channel so the port CSV columns keep a single dtype. + sig_str = str(port_data.get('signal', '')).strip() + signal_val = sig_str.split(" ")[0] if "dBm" in sig_str else sig_str + + chan_str = str(port_data.get('channel', '')).strip() + if chan_str in ('', '0', '-1'): + channel_val = 'NA' + elif '[channel:' in chan_str: + channel_val = chan_str.split(':')[1].replace(']', '').strip() + else: + channel_val = chan_str + row = row + [port_data['bps rx'], port_data['bps tx'], port_data['rx-rate'], port_data['tx-rate'], - port_data['signal'], + signal_val, port_data['ap'], port_data['mode'], port_data['mac'], - port_data['channel'], + channel_val, latency, jitter, total_ul_rate, @@ -3486,15 +3498,27 @@ def write_ul_port_csv( atten, port_eid ] + # Normalize RSSI / Channel so the port CSV columns keep a single dtype. + sig_str = str(port_data.get('signal', '')).strip() + signal_val = sig_str.split(" ")[0] if "dBm" in sig_str else sig_str + + chan_str = str(port_data.get('channel', '')).strip() + if chan_str in ('', '0', '-1'): + channel_val = 'NA' + elif '[channel:' in chan_str: + channel_val = chan_str.split(':')[1].replace(']', '').strip() + else: + channel_val = chan_str + row = row + [port_data['bps rx'], port_data['bps tx'], port_data['rx-rate'], port_data['tx-rate'], - port_data['signal'], + signal_val, port_data['ap'], port_data['mode'], port_data['mac'], - port_data['channel'], + channel_val, latency, jitter, total_ul_rate, From eb187d553f3f487495b7bb66cf82587682ce1e3f Mon Sep 17 00:00:00 2001 From: durga-ct Date: Wed, 2 Sep 2026 23:15:14 +0530 Subject: [PATCH 2/2] test_l3.py: Replace repeated signal/channel parsing with a shared helper - make signal/channel normalization a single reusable function - call normalize_signal_channel() from write_dl_port_csv and write_ul_port_csv VERIFIED CLI For Virtual python3 test_l3.py --lfmgr 192.168.207.75 --endp_type mc_udp --tos BK --upstream_port eth1 --radio 'radio==wiphy0 stations==2 ssid==NETGEAR_2G_WAP2 ssid_pw==Password@123 security==wpa2' --test_duration 1m --polling_interval 5s --side_b_min_bps 102400000 --sta_start_offset 2000 For Real python3 test_l3.py --lfmgr 192.168.245.117 --test_duration 1m --polling_interval 5s --upstream_port eth2 --endp_type mc_udp --side_b_min_bps=10000000 --tos BE --real Signed-off-by: durga-ct --- py-scripts/test_l3.py | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/py-scripts/test_l3.py b/py-scripts/test_l3.py index 2908ff516..2ca8628b6 100755 --- a/py-scripts/test_l3.py +++ b/py-scripts/test_l3.py @@ -3397,6 +3397,22 @@ def monitor(self, ul, dl, ul_pdu_str, dl_pdu_str, atten_val, coordinate, rotatio return data return total_dl_bps, total_ul_bps, total_dl_ll_bps, total_ul_ll_bps + @staticmethod + def normalize_signal_channel(port_data): + # Normalize RSSI / Channel so the port CSV columns keep a single dtype. + sig_str = str(port_data.get('signal', '')).strip() + signal_val = sig_str.split(" ")[0] if "dBm" in sig_str else sig_str + + chan_str = str(port_data.get('channel', '')).strip() + if chan_str in ('', '0', '-1'): + channel_val = 'NA' + elif '[channel:' in chan_str: + channel_val = chan_str.split(':')[1].replace(']', '').strip() + else: + channel_val = chan_str + + return signal_val, channel_val + def write_dl_port_csv( self, sta_count, @@ -3424,17 +3440,7 @@ def write_dl_port_csv( atten, port_eid ] - # Normalize RSSI / Channel so the port CSV columns keep a single dtype. - sig_str = str(port_data.get('signal', '')).strip() - signal_val = sig_str.split(" ")[0] if "dBm" in sig_str else sig_str - - chan_str = str(port_data.get('channel', '')).strip() - if chan_str in ('', '0', '-1'): - channel_val = 'NA' - elif '[channel:' in chan_str: - channel_val = chan_str.split(':')[1].replace(']', '').strip() - else: - channel_val = chan_str + signal_val, channel_val = self.normalize_signal_channel(port_data) row = row + [port_data['bps rx'], port_data['bps tx'], @@ -3498,17 +3504,7 @@ def write_ul_port_csv( atten, port_eid ] - # Normalize RSSI / Channel so the port CSV columns keep a single dtype. - sig_str = str(port_data.get('signal', '')).strip() - signal_val = sig_str.split(" ")[0] if "dBm" in sig_str else sig_str - - chan_str = str(port_data.get('channel', '')).strip() - if chan_str in ('', '0', '-1'): - channel_val = 'NA' - elif '[channel:' in chan_str: - channel_val = chan_str.split(':')[1].replace(']', '').strip() - else: - channel_val = chan_str + signal_val, channel_val = self.normalize_signal_channel(port_data) row = row + [port_data['bps rx'], port_data['bps tx'],