From 5b1ab8c23da1f071edd455d1c1c59dc0106b6e0f Mon Sep 17 00:00:00 2001 From: "John-Paul M. Powers" Date: Tue, 6 Jan 2026 18:03:27 -0800 Subject: [PATCH] lf_wifi_capacity_test.py: compatibility changes for WebGUI What it says on the tin, makes the WiFi Capacity Test py-json script work from WebGUI. Patch at customer request. CLI to run: ./lf_wifi_capacity_test.py --mgr localhost \ --port 8080 \ --instance_name wificap-webgui-inst \ --local_lf_report_dir /home/lanforge/Desktop \ --raw_lines_file /home/lanforge/wificap.txt CLI issued by WebGUI: ./lf_wifi_capacity_test.py --mgr 192.168.102.229 \ --logger_no_file \ --pull_report \ --raw_line rpt_path:/home/lanforge \ --instance_name 'WBGUIWCAPTEST' \ --raw_lines_file '/home/lanforge/local/interop-webGUI/media/uploads/chamber_tests/WBGUIWCAPTEST/wificap.txt' Signed-off-by: John-Paul M. Powers --- py-scripts/lf_wifi_capacity_test.py | 62 +++++++++++++++++------------ 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/py-scripts/lf_wifi_capacity_test.py b/py-scripts/lf_wifi_capacity_test.py index 45d80f803..05c101f26 100755 --- a/py-scripts/lf_wifi_capacity_test.py +++ b/py-scripts/lf_wifi_capacity_test.py @@ -195,32 +195,30 @@ def run(self): # Test related settings cfg_options = [] - eid = LFUtils.name_to_eid(self.upstream) - port = "%i.%i.%s" % (eid[0], eid[1], eid[2]) - - port_list = [port] - if self.stations != "" or self.stations_list != []: - stas = None - if self.stations: - stas = self.stations.split(",") - elif self.stations_list: - stas = self.stations_list - for s in stas: - port_list.append(s) - else: - stas = self.station_map() # See realm - for eid in stas.keys(): - port_list.append(eid) - logger.info(f"Selected Port list: {port_list}") - - idx = 0 - for eid in port_list: - add_port = "sel_port-" + str(idx) + ": " + eid - self.create_test_config(self.config_name, "Wifi-Capacity-", add_port) - idx += 1 - - self.apply_cfg_options(cfg_options, self.enables, self.disables, self.raw_lines, self.raw_lines_file) - + if self.upstream != "": + eid = LFUtils.name_to_eid(self.upstream) + port = "%i.%i.%s" % (eid[0], eid[1], eid[2]) + + port_list = [port] + if self.stations != "" or self.stations_list != []: + stas = None + if self.stations: + stas = self.stations.split(",") + elif self.stations_list: + stas = self.stations_list + for s in stas: + port_list.append(s) + else: + stas = self.station_map() # See realm + for eid in stas.keys(): + port_list.append(eid) + logger.info(f"Selected Port list: {port_list}") + + idx = 0 + for eid in port_list: + add_port = "sel_port-" + str(idx) + ": " + eid + self.create_test_config(self.config_name, "Wifi-Capacity-", add_port) + idx += 1 if self.batch_size != "": cfg_options.append("batch_size: " + self.batch_size) if self.loop_iter != "": @@ -240,6 +238,8 @@ def run(self): cfg_options.append("save_csv: 1") + self.apply_cfg_options(cfg_options, self.enables, self.disables, self.raw_lines, self.raw_lines_file) + blob_test = "Wifi-Capacity-" # We deleted the scenario earlier, now re-build new one line at a time. @@ -380,6 +380,10 @@ def main(): parser.add_argument('--log_level', default=None, help='Set logging level: debug | info | warning | error | critical') parser.add_argument('--help_summary', action="store_true", help='Show summary of what this script does') + parser.add_argument('--logger_no_file', + default=None, + action="store_true", + help='Show loggingout without the trailing file name and line') args = parser.parse_args() @@ -401,6 +405,12 @@ def main(): logger_config.lf_logger_config_json = args.lf_logger_config_json logger_config.load_lf_logger_config() + if args.logger_no_file: + f = '%(created)f %(levelname)-8s %(message)s' + ff = logging.Formatter(fmt=f) + for handler in logging.getLogger().handlers: + handler.setFormatter(ff) + # getting station list if number of stations provided. start_id = 0 if args.start_id != 0: