diff --git a/py-scripts/lf_mixed_traffic.py b/py-scripts/lf_mixed_traffic.py index fcea8b889..be84b0257 100755 --- a/py-scripts/lf_mixed_traffic.py +++ b/py-scripts/lf_mixed_traffic.py @@ -447,7 +447,7 @@ def __init__(self, multiplier = duration_suffixes[self.multicast_test_duration_suffix] self.multicast_test_duration = int(self.multicast_test_duration[:-1]) * multiplier else: - logger.info("Please provide the test duration for at least one single test scenario to run...") + logger.error("Mixed traffic run requires a duration for at least one test scenario") if self.qos_serial_run: self.total_all_test_duration = int(self.ping_test_duration + (self.qos_test_duration * len( self.qos_tos_list)) + self.ftp_test_duration + self.http_test_duration + self.multicast_test_duration) @@ -514,11 +514,11 @@ def filter_iOS_devices(self, device_list, rc_list, mac_list): shelf, resource = 1, device response_code, device_data = self.api_get('/resource/{}/{}'.format(shelf, resource)) if 'status' in device_data and device_data['status'] == 'NOT_FOUND': - logger.info('Device {} is not found.'.format(device)) + logger.info("Device {} is not found".format(device)) continue device_data = device_data['resource'] if 'Apple' in device_data['hw version'] and (device_data['app-id'] != '') and (device_data['app-id'] != '0' or device_data['kernel'] == ''): - logger.info('{} is an iOS device. Currently we do not support iOS devices.'.format(device)) + logger.info("{} is an iOS device and currently we do not support iOS devices".format(device)) else: filtered_list.append(device) for j in rc_list: @@ -554,7 +554,7 @@ def virtual_client_creation(self, ssid, password, security, band, radio, num_sta self.station_list = station_list self.num_staions = num_stations self.radio = radio - logger.info("Virtual station list for {band} : {station_list}".format(band=band, station_list=station_list)) + logger.info("List of virtual stations for {band} : {station_list}".format(band=band, station_list=station_list)) if "2.4G" in band: self.station_profile.mode = 13 elif "5G" in band: @@ -564,29 +564,29 @@ def virtual_client_creation(self, ssid, password, security, band, radio, num_sta # station build self.station_profile.use_security(security, ssid, password) self.station_profile.set_number_template("00") - logger.info("Creating Virtual Stations...") + logger.info("Creating virtual stations") self.station_profile.set_command_flag("add_sta", "create_admin_down", 1) self.station_profile.set_command_param("set_port", "report_timer", 1500) self.station_profile.set_command_flag("set_port", "rpt_timer", 1) if self.station_profile.create(radio=radio, sta_names_=station_list, debug=self.debug): - self._pass("Stations created.") + self._pass("Stations created successfully") else: - self._fail("Stations not properly created.") + self._fail("Stations not properly created") self.station_profile.admin_up() - logger.info("Waiting until the all station ports are up. Max time out is 300 seconds.") + logger.info("Waiting for all station ports to come up (timeout: 300 seconds)") if not LFUtils.wait_until_ports_admin_up(base_url=self.lfclient_url, port_list=station_list, debug_=self.debug): self._fail("Unable to bring all stations up") return - logger.info("Waiting to get IP for all stations...") + logger.info("Waiting for all stations to obtain IP addresses") if Realm.wait_for_ip(self=self, station_list=station_list, timeout_sec=-1): self._pass("All stations got IPs", print_=True) self._pass("Station build finished", print_=True) else: self._fail("Stations failed to get IPs", print_=True) - self._fail("FAIL: Station build failed", print_=True) - logger.info("Please re-check the configuration applied") + self._fail("Station build failed", print_=True) + logger.error("Please re-check the configuration applied") return station_list def convert_seconds(self, seconds): @@ -607,7 +607,7 @@ def convert_seconds(self, seconds): def selecting_devices_from_available(self): selected_serial_list = self.base_interop_profile.query_all_devices_to_configure_wifi() - logger.info(f"Selected Serial List: {selected_serial_list}") + logger.info("Selected device list: {}".format(selected_serial_list)) return selected_serial_list def select_real_devices(self, real_devices, real_sta_list=None, base_interop_obj=None): @@ -642,14 +642,14 @@ def select_real_devices(self, real_devices, real_sta_list=None, base_interop_obj # Need real stations to run interop test if (len(self.real_sta_list) == 0): - logger.error('There are no real devices in this testbed. Aborting test') + logger.error("The test cannot proceed because the testbed contains no real devices") exit(0) - logging.info('{}'.format(*self.real_sta_list)) + logging.info("Real Station List: {}".format(*self.real_sta_list)) for sta_name in self.real_sta_list: if sta_name not in real_devices.devices_data: - logger.error('Real station not in devices data') + logger.error("Real station not in devices data") raise ValueError('Real station not in devices data') self.real_sta_data_dict[sta_name] = real_devices.devices_data[sta_name] @@ -747,7 +747,7 @@ def ping_test(self, ssid='', password='', security='', target='', interval='', _ # creating generic endpoints self.ping_test_obj.create_generic_endp() logger.info("Generic Cross-Connection List: {}".format(self.ping_test_obj.generic_endps_profile.created_cx)) - logger.info('Starting Running the Ping Test for {} minutes'.format(ping_test_duration)) + logger.info("Starting running the Ping Test for {} minutes".format(ping_test_duration)) # start generate endpoint time.sleep(20) self.ping_test_obj.start_generic() @@ -804,11 +804,11 @@ def ping_test(self, ssid='', password='', security='', target='', interval='', _ logging.info('Test is stopped by the user') break except Exception: - logging.info("execption while reading running json in ping") + logging.info("Exception while reading running json in ping") time.sleep(3) else: time.sleep(ping_test_duration * 60) - logger.info('Stopping the PING Test...') + logger.info("Stopping the Ping Test") self.ping_test_obj.stop_generic() # getting result dict result_data = self.ping_test_obj.get_results() @@ -1234,7 +1234,7 @@ def ftp_test(self, ssid, password, security, bands, directions, file_sizes, ftp_ time1 = datetime.datetime.now() time.sleep(20) - logger.info("FTP Traffic started running at {}".format(time1)) + logger.info("FTP traffic started running at {}".format(time1)) if self.real: self.ftp_test_obj.monitor_cx() self.ftp_test_obj.start(False, False) @@ -1246,10 +1246,10 @@ def ftp_test(self, ssid, password, security, bands, directions, file_sizes, ftp_ self.ftp_test_obj.my_monitor() self.ftp_test_obj.stop() - logger.info("FTP Traffic stopped running") + logger.info("FTP traffic stopped running") self.ftp_test_obj.cx_profile.cleanup() time2 = datetime.datetime.now() - logger.info("FTP Test ended at {}".format(time2)) + logger.info("FTP test ended at {}".format(time2)) if all_bands: band = '' else: @@ -1337,7 +1337,7 @@ def http_test(self, ssid, password, security, http_file_size, target_per_ten, ht self.http_dev = self.http_obj.devices_list self.http_mac = self.http_obj.macid_list if (len(self.http_obj.port_list) == 0): - logger.info("No Device is available to run the test hence aborting the test") + logger.info("No device is available to run the test hence aborting the test") exit(0) self.http_obj.user_query = self.user_query self.http_obj.windows_ports = self.windows_ports @@ -1357,14 +1357,14 @@ def http_test(self, ssid, password, security, http_file_size, target_per_ten, ht # self.http_obj.station_list = [[self.station_list]] self.cleanup.layer4_endp_clean() self.station_profile.admin_up() - logger.info("Waiting until the all station ports are up. Max time out is 300 seconds.") + logger.info("Waiting for all station ports to come up (maximum wait: 300 seconds)") if not LFUtils.wait_until_ports_admin_up(base_url=self.lfclient_url, port_list=self.station_list, debug_=self.debug): self._fail("Unable to bring all stations up") return - logger.info("Waiting to get IP for all stations...") - logger.info("Admin up all the stations...") + logger.info("Waiting to get IP for all stations") + logger.info("Admin up all the stations") Realm.wait_for_ip(self=self, station_list=self.station_list, timeout_sec=-1) # building layer4 #Todo: Since the lf_webpage script itself only support "download", so need to add upload functionality in future @@ -1500,7 +1500,7 @@ def http_test(self, ssid, password, security, http_file_size, target_per_ten, ht self.dataset1 = [round(i / 1000000, 4) for i in self.bytes_rd] self.rx_rate = [round(x / 1000000, 4) for x in self.rx_rate] # converting bps to mbps - logger.info("data sets {} {}".format(self.dataset, self.dataset2)) + logger.debug("Data sets {} {}".format(self.dataset, self.dataset2)) if self.band == "Both": for i in range(1, len(http_sta_list) * 2 + 1): self.lis.append(i) @@ -1672,22 +1672,22 @@ def multicast_test(self, endp_types=None, mc_tos=None, side_a_min=0, side_b_min= result_dir=self.result_dir) if self.real: if self.user_query[0]: - logger.info("No station pre clean up any existing cxs on LANforge") + logger.info("No station pre clean up on any existing cxs on LANforge") else: - logger.info("clean up any existing cxs on LANforge") + logger.info("Cleaning up any existing cxs on LANforge") self.multicast_test_obj.pre_cleanup() # cleaning the existing layer4 endpoints self.cleanup.layer3_endp_clean() - logger.info("create stations or use passed in station_list, build the test") + logger.info("Create stations or use the provided station list to build the multicast cross connections") # building the endpoints self.multicast_test_obj.build() time.sleep(20) if not self.multicast_test_obj.passes(): - logger.critical("build step failed.") + logger.critical("build step failed") logger.critical(self.multicast_test_obj.get_fail_message()) exit(1) - logger.info("Start the test and run for a duration") + logger.info("Start the Multicast test") # TODO: Check return value of start() self.multicast_test_obj.start(False) # csv_results_file = self.multicast_test_obj.get_results_csv() @@ -1709,11 +1709,11 @@ def multicast_test(self, endp_types=None, mc_tos=None, side_a_min=0, side_b_min= report.write_pdf_with_timestamp(_page_size='A3', _orientation='Landscape') if not self.multicast_test_obj.passes(): - logger.warning("Test Ended: There were Failures in multicast test.") + logger.warning("Multicast test completed with failures") logger.warning(self.multicast_test_obj.get_fail_message()) self.cleanup.layer3_endp_clean() if self.multicast_test_obj.passes(): - logger.info("Full test PASSED, All connections increased rx bytes") + logger.info("Multicast Test passed. All connections showed an increase in received bytes") tos_list = ['VI', 'VO', 'BK', 'BE'] for tos in tos_list: if (tos != mc_tos): @@ -1745,7 +1745,7 @@ def multicast_test(self, endp_types=None, mc_tos=None, side_a_min=0, side_b_min= ) def generate_all_report(self, iot_summary=None): - logger.info("To generate the Mixed Traffic report with all tests") + logger.info("Generate the Mixed Traffic report with all tests") mode = "Parallel" if self.parallel else "Serial" title = "Mixed Traffic Test Including IoT Devices" if iot_summary else "Mixed Traffic Test" self.lf_report_mt.set_title(f"{title} ({mode})") @@ -1919,7 +1919,7 @@ def generate_all_report(self, iot_summary=None): _enable_csv=True, _color_name=['lightgrey', 'orange', 'steelblue']) graph_png = graph.build_bar_graph_horizontal() - logger.info('Ping Test Graph-1: {}'.format(graph_png)) + logger.debug("Ping Test Graph-1: {}".format(graph_png)) self.lf_report_mt.set_graph_image(graph_png) self.lf_report_mt.move_graph_image() self.lf_report_mt.set_csv_filename(graph_png) @@ -1988,7 +1988,7 @@ def generate_all_report(self, iot_summary=None): _enable_csv=True, _color_name=['lightgrey', 'orange', 'steelblue']) graph_png = graph.build_bar_graph_horizontal() - logger.info('Ping Test Graph-2: {}'.format(graph_png)) + logger.debug("Ping Test Graph-2: {}".format(graph_png)) self.lf_report_mt.set_graph_image(graph_png) self.lf_report_mt.move_graph_image() self.lf_report_mt.set_csv_filename(graph_png) @@ -2057,7 +2057,7 @@ def generate_all_report(self, iot_summary=None): _enable_csv=True, _color_name=['orange', 'lightcoral', 'steelblue', 'lightgrey']) graph_png = graph.build_bar_graph() - logger.info("QOS test name of the overall graph : {}".format(graph_png)) + logger.debug("QOS test name of the overall graph : {}".format(graph_png)) self.lf_report_mt.set_graph_image(graph_png) self.lf_report_mt.move_graph_image() self.lf_report_mt.set_csv_filename(graph_png) @@ -2110,7 +2110,7 @@ def generate_all_report(self, iot_summary=None): _color=['orange'], _label=[self.ftp_test_obj.direction]) ftp_graph1 = graph.build_bar_graph_horizontal() - logger.info("FTP Graph-1 Name: {}".format(ftp_graph1)) + logger.debug("FTP Graph-1: {}".format(ftp_graph1)) self.lf_report_mt.set_graph_image(ftp_graph1) self.lf_report_mt.move_graph_image() self.lf_report_mt.set_csv_filename(ftp_graph1) @@ -2140,7 +2140,7 @@ def generate_all_report(self, iot_summary=None): _color=['steelblue'], _label=[self.ftp_test_obj.direction]) ftp_graph2 = graph.build_bar_graph_horizontal() - logger.info("FTP Graph-2 Name: {}".format(ftp_graph2)) + logger.debug("FTP Graph-2: {}".format(ftp_graph2)) self.lf_report_mt.set_graph_image(ftp_graph2) self.lf_report_mt.move_graph_image() self.lf_report_mt.set_csv_filename(ftp_graph2) @@ -2197,7 +2197,7 @@ def generate_all_report(self, iot_summary=None): "Client names.") self.lf_report_mt.build_objective() http_graph1 = self.http_obj.graph_2(self.dataset2, lis=self.lis, bands=[self.band]) - logger.info("Http Graph-1 Name: {}".format(http_graph1)) + logger.debug("Http Graph-1: {}".format(http_graph1)) self.lf_report_mt.set_graph_image(http_graph1) self.lf_report_mt.set_csv_filename(http_graph1) self.lf_report_mt.move_csv_file() @@ -2209,7 +2209,7 @@ def generate_all_report(self, iot_summary=None): "Client names.") self.lf_report_mt.build_objective() http_graph2 = self.http_obj.generate_graph(dataset=self.dataset, lis=self.lis, bands=[self.band]) - logger.info("Http Graph-2 Name: {}".format(http_graph2)) + logger.debug("Http Graph-2: {}".format(http_graph2)) self.lf_report_mt.set_graph_image(http_graph2) self.lf_report_mt.set_csv_filename(http_graph2) self.lf_report_mt.move_csv_file() @@ -2342,7 +2342,7 @@ def generate_all_report(self, iot_summary=None): _legend_loc="best", _legend_box=(1.0, 1.0)) graph_png = graph.build_bar_graph_horizontal() - logger.info("Multicast Test Graph Name: {}".format(graph_png)) + logger.debug("Multicast Test Graph: {}".format(graph_png)) self.lf_report_mt.set_graph_image(graph_png) self.lf_report_mt.move_graph_image() self.lf_report_mt.build_graph() @@ -2589,7 +2589,7 @@ async def run_iot(ip: str = '127.0.0.1', try: if delay < 5: - logger.error('The minimum delay should be 5 seconds.') + logger.error("The minimum delay should be 5 seconds") exit(1) if device_list != '': @@ -2602,7 +2602,7 @@ async def run_iot(ip: str = '127.0.0.1', try: increment = list(map(int, increment.split(','))) if any(i < 1 for i in increment): - logger.error('Increment values must be positive integers') + logger.error("Increment values must be positive integers") exit(1) except ValueError: logger.error('Invalid increment format. Please provide comma-separated integers (e.g., "1,3,5")') @@ -2612,7 +2612,7 @@ async def run_iot(ip: str = '127.0.0.1', # Ensure test name is unique (avoid overwriting previous results) if testname in os.listdir('../../local/interop-webGUI/IoT/scripts/results/'): - logger.error('Test with same name already existing. Please give a different testname.') + logger.error("Test with same name already existing. Please use a different test name") exit(1) automation = Automation(ip=ip, port=port, @@ -2640,7 +2640,7 @@ async def run_iot(ip: str = '127.0.0.1', await automation.session.close() - logger.info('Iot Test Completed.') + logger.info("Iot Test Completed") def main(): @@ -3201,7 +3201,7 @@ def main(): mixed_obj.ssid = ssid mixed_obj.security = security - logger.info(f"Selected Tests List: {args.tests}") + logger.info(f"List of selected Tests: {args.tests}") if args.tests: if args.parallel: if "1" in args.tests: @@ -3372,7 +3372,7 @@ def __init__(self, client_dict_A, client_dict_B): start_id=args.sixg_start_id, all_sta=True) # updating num stations and station list virtual_station_list = sta_list_2g + sta_list_5g + sta_list_6g - logger.info("Selected Virtual Station List:", virtual_station_list) + logger.info("List of selected virtual stations:", virtual_station_list) mixed_obj.station_list = virtual_station_list mixed_obj.num_staions = args.twog_num_stations + args.fiveg_num_stations + args.sixg_num_stations if (args.use_default_config): @@ -3384,7 +3384,7 @@ def __init__(self, client_dict_A, client_dict_B): mixed_obj.ssid = ssid mixed_obj.security = security # tests will run with respect to bands - logger.info(f"Selected Tests List: {args.tests}") + logger.info(f"List of selected tests: {args.tests}") if args.tests: if args.parallel: if "1" in args.tests: @@ -3529,8 +3529,8 @@ def __init__(self, client_dict_A, client_dict_B): mixed_obj.ping_execution = True mixed_obj.ping_test(ssid=ssid, password=password, security=security, target=args.target, interval=args.ping_interval, all_bands=True) - except Exception: - logger.info("Error while running for webui during ping execution") + except Exception as e: + logger.info("Error while running for webui during ping execution: {}".format(e)) try: overall_status['ping'] = "stopped" overall_status["time"] = datetime.datetime.now().strftime("%Y %d %H:%M:%S") @@ -3561,8 +3561,8 @@ def __init__(self, client_dict_A, client_dict_B): upstream=args.upstream_port, tos=args.tos, traffic_type=args.traffic_type, side_a_min=args.side_a_min, side_b_min=args.side_b_min, side_a_max=args.side_a_max, side_b_max=args.side_b_min, all_bands=True) - except Exception: - logger.info("Error while running for webui during qos execution") + except Exception as e: + logger.info("Error while running for webui during qos execution: {}".format(e)) try: overall_status['qos'] = "stopped" overall_status["time"] = datetime.datetime.now().strftime("%Y %d %H:%M:%S") @@ -3593,8 +3593,8 @@ def __init__(self, client_dict_A, client_dict_B): mixed_obj.ftp_execution = True mixed_obj.ftp_test(ssid=ssid, password=password, security=security, bands=Bands, directions=args.direction, file_sizes=args.ftp_file_sizes, all_bands=True) - except Exception: - logger.info("Error while running for webui during ftp execution") + except Exception as e: + logger.info("Error while running for webui during ftp execution: {}".format(e)) try: overall_status['ftp'] = "stopped" overall_status["time"] = datetime.datetime.now().strftime("%Y %d %H:%M:%S") @@ -3624,8 +3624,8 @@ def __init__(self, client_dict_A, client_dict_B): mixed_obj.http_test(ssid=ssid, password=password, security=security, http_file_size=args.http_file_size, target_per_ten=args.target_per_ten, all_bands=True) - except Exception: - logger.info("Error while running for webui during http execution") + except Exception as e: + logger.info("Error while running for webui during http execution: {}".format(e)) try: overall_status['http'] = "stopped" overall_status["time"] = datetime.datetime.now().strftime("%Y %d %H:%M:%S")