mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 18:58:01 +00:00 
			
		
		
		
	asus_ap.py : initial place holder
lf_check.py: fix meta.txt creation on interations added test_l3_longevity.py to ct_us_001_tests.json ct_us_004_tests.json Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
		
							
								
								
									
										180
									
								
								py-scripts/asus_ap.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										180
									
								
								py-scripts/asus_ap.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,180 @@ | ||||
| #!/usr/bin/python3 | ||||
|  | ||||
| ''' | ||||
| NAME: | ||||
| asus_ap.py | ||||
|  | ||||
| PURPOSE: | ||||
| Generic AP library that will work for the ASUS ap's | ||||
|  | ||||
| EXAMPLE: | ||||
|  | ||||
| ./asus_ap.py --ap_port '/dev/ttyUSB0' --ap_baud '115200' --ap_cmd "wl -i wl1 bs_data" | ||||
|  | ||||
| ./asus_ap.py --ap_port '/dev/ttyUSB0' --ap_baud '115200' --ap_cmd "wl -i wl1 bs_data" --ap_file 'ap_file.txt' | ||||
|  | ||||
|  | ||||
|  | ||||
| NOTES: | ||||
|  | ||||
|  | ||||
|  | ||||
| ''' | ||||
|  | ||||
| import sys | ||||
| if sys.version_info[0]  != 3: | ||||
|     print("This script requires Python3") | ||||
|     exit() | ||||
|  | ||||
| import argparse | ||||
| import pexpect | ||||
| import serial | ||||
| from pexpect_serial import SerialSpawn | ||||
|  | ||||
|  | ||||
| # see https://stackoverflow.com/a/13306095/11014343 | ||||
| class FileAdapter(object): | ||||
|     def __init__(self, logger): | ||||
|         self.logger = logger | ||||
|     def write(self, data): | ||||
|         # NOTE: data can be a partial line, multiple lines | ||||
|         data = data.strip() # ignore leading/trailing whitespace | ||||
|         if data: # non-blank | ||||
|            self.logger.info(data) | ||||
|     def flush(self): | ||||
|         pass  # leave it to logging to flush properly | ||||
|  | ||||
|  | ||||
| class lf_ap(): | ||||
|     def __init__(self,  | ||||
|                 _ap_test_mode = False, | ||||
|                 _ap_2G_interface = "wl0", | ||||
|                 _ap_5G_interface = "wl1", | ||||
|                 _ap_6G_interface = "wl2", | ||||
|                 _ap_scheme = 'serial', | ||||
|                 _ap_serial_port = '/dev/ttyUSB0',  | ||||
|                 _ap_ssh_port = "22", | ||||
|                 _ap_telnet_port = "23", | ||||
|                 _ap_serial_baud = '115200',  | ||||
|                 _ap_report_dir = "", | ||||
|                 _ap_log_file = ""): | ||||
|         self.ap_test_mode = _ap_test_mode | ||||
|         self.ap_2G_interface = _ap_2G_interface | ||||
|         self.ap_5G_interface = _ap_5G_interface | ||||
|         self.ap_6G_interface = _ap_6G_interface | ||||
|         self.ap_scheme = _ap_scheme | ||||
|         self.ap_serial_port = _ap_serial_port | ||||
|         self.ap_telnet_port = _ap_ssh_port | ||||
|         self.ap_telnet = _ap_telnet_port | ||||
|         self.ap_serial_baud = _ap_serial_baud | ||||
|         self.ap_report_dir = _ap_report_dir | ||||
|         self.ap_log_file = _ap_log_file | ||||
|      | ||||
|     def ap_action(self): | ||||
|  | ||||
|         print("ap_cmd: {}".format(self.ap_cmd)) | ||||
|         try: | ||||
|             ser = serial.Serial(self.ap_port, int(self.ap_baud), timeout=5) | ||||
|             ss = SerialSpawn(ser) | ||||
|             ss.sendline(str(self.ap_cmd)) | ||||
|             ss.expect([pexpect.TIMEOUT], timeout=2) # do not detete line, waits for output | ||||
|             ap_results = ss.before.decode('utf-8','ignore') | ||||
|             print("ap_results {}".format(ap_results)) | ||||
|         except: | ||||
|             ap_results = "exception on accessing {} Command: {}\r\n".format(self.ap_port,self.ap_cmd) | ||||
|             print("{}".format(ap_results)) | ||||
|  | ||||
|         if(self.ap_file != None): | ||||
|             ap_file = open(str(self.ap_file),"a") | ||||
|             ap_file.write(ap_results) | ||||
|             ap_file.close() | ||||
|             print("ap file written {}".format(str(self.ap_file))) | ||||
|  | ||||
|     # ASUS  | ||||
|     def ap_clear_stats(self,band): | ||||
|         pass | ||||
|  | ||||
|     # ASUS bs_data | ||||
|     def ap_ul_data(self,band): | ||||
|         pass | ||||
|  | ||||
|     # ASUS rx_report | ||||
|     def ap_dl_data(self,band): | ||||
|         pass | ||||
|  | ||||
|     # ASUS chanel info (channel utilization) | ||||
|     def ap_chanim(self,band): | ||||
|         pass | ||||
|  | ||||
|     def ap_ul_stats(self,band): | ||||
|         pass | ||||
|  | ||||
|     def ap_dl_stats(self,band): | ||||
|         pass | ||||
|  | ||||
|     def ap_store_dl_scheduler_stats(self,band): | ||||
|         if band is "6G": | ||||
|  | ||||
|         pass | ||||
|  | ||||
|     def ap_store_ul_scheduler_stats(self,band): | ||||
|         pass | ||||
|  | ||||
|  | ||||
|     def ap_ofdma_stats(self,band): | ||||
|         pass | ||||
|  | ||||
| def main(): | ||||
|  | ||||
|     parser = argparse.ArgumentParser( | ||||
|         prog='lf_ap.py', | ||||
|         #formatter_class=argparse.RawDescriptionHelpFormatter, | ||||
|         formatter_class=argparse.RawTextHelpFormatter, | ||||
|         epilog='''\ | ||||
|         Useful Information: | ||||
|             1. Useful Information goes here | ||||
|             ''', | ||||
|          | ||||
|         description='''\ | ||||
| lf_ap.py: | ||||
| -------------------- | ||||
| Summary :  | ||||
| ---------- | ||||
| This file is used for verification | ||||
|  | ||||
| Commands: (wl2 == 6GHz wl1 == 5GHz , wl0 == 24ghz) | ||||
|  | ||||
| read ap data:: 'wl -i wl1 bs_data' | ||||
| reset scheduler's counters:: 'wl -i wl1 dump_clear' | ||||
| UL scheduler statistics:: 'wl -i wl1 dump umsched' | ||||
| DL scheduler statistics:: 'wl -i wl1 dump msched' | ||||
|  | ||||
| Generic command layout: | ||||
| ----------------------- | ||||
|  | ||||
|         ''') | ||||
|     parser.add_argument('--ap_test_mode', help='--ap_mode ',default=False) | ||||
|     parser.add_argument('--ap_port', help='--ap_port \'/dev/ttyUSB0\'',default='/dev/ttyUSB0') | ||||
|     parser.add_argument('--ap_baud', help='--ap_baud  \'115200\'',default='115200') | ||||
|     parser.add_argument('--ap_cmd', help='--ap_cmd \'wl -i wl1 bs_data\'',default='wl -i wl1 bs_data') | ||||
|     parser.add_argument('--ap_file', help='--ap_file \'ap_file.txt\'') | ||||
|      | ||||
|     args = parser.parse_args() | ||||
|  | ||||
|     __ap_port = args.ap_port | ||||
|     __ap_baud = args.ap_baud | ||||
|     __ap_cmd  = args.ap_cmd | ||||
|     __ap_file = args.ap_file | ||||
|  | ||||
|     ap_dut = lf_ap( | ||||
|                 _ap_port = __ap_port, | ||||
|                 _ap_baud = __ap_baud, | ||||
|                 _ap_cmd = __ap_cmd , | ||||
|                 _ap_file = __ap_file) | ||||
|  | ||||
|     ap_dut.ap_action() | ||||
|  | ||||
| if __name__ == '__main__': | ||||
|     main() | ||||
|  | ||||
|  | ||||
| @@ -181,6 +181,18 @@ | ||||
|                     " " | ||||
|                 ] | ||||
|             }, | ||||
|             "test_l3_longevity":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
|                 "command":"test_l3_longevity.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
|                     " --lfmgr LF_MGR_IP --local_lf_report_dir REPORT_PATH --test_duration 15s --polling_interval 5s --upstream_port eth2 ", | ||||
|                     " use_ssid_idx=1 --radio 'radio==wiphy1,stations==4,ssid==SSID_USED,ssid_pw==SSID_PW_USED,security==SECURITY_USED' ", | ||||
|                     " --endp_type lf_udp --rates_are_totals --side_a_min_bps=20000 --side_b_min_bps=300000000", | ||||
|                     " --test_rig TEST_RIG --test_tag 'l3_longevity'" | ||||
|                 ] | ||||
|             }, | ||||
|             "create_chamberview_dut_ATH10K_9984__wc":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
| @@ -493,6 +505,18 @@ | ||||
|                     " " | ||||
|                 ] | ||||
|             }, | ||||
|             "test_l3_longevity":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
|                 "command":"test_l3_longevity.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
|                     " --lfmgr LF_MGR_IP --local_lf_report_dir REPORT_PATH --test_duration 15s --polling_interval 5s --upstream_port eth2 ", | ||||
|                     " use_ssid_idx=1 --radio 'radio==wiphy1,stations==4,ssid==SSID_USED,ssid_pw==SSID_PW_USED,security==SECURITY_USED' ", | ||||
|                     " --endp_type lf_udp --rates_are_totals --side_a_min_bps=20000 --side_b_min_bps=300000000", | ||||
|                     " --test_rig TEST_RIG --test_tag 'l3_longevity'" | ||||
|                 ] | ||||
|             }, | ||||
|             "create_chamberview_dut_ATH10K_9984__wc":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
| @@ -520,7 +544,7 @@ | ||||
|             "wifi_capacity_ATH10K_9984_":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "timeout":"600", | ||||
|                 "iterations":"3", | ||||
|                 "iterations":"1", | ||||
|                 "load_db":"skip", | ||||
|                 "command":"lf_wifi_capacity_test.py", | ||||
|                 "args":"", | ||||
| @@ -560,7 +584,7 @@ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
|                 "timeout":"600", | ||||
|                 "iterations":"3", | ||||
|                 "iterations":"1", | ||||
|                 "command":"lf_dataplane_test.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
| @@ -601,7 +625,7 @@ | ||||
|             "wifi_capacity_AX210":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "timeout":"600", | ||||
|                 "iterations":"3", | ||||
|                 "iterations":"1", | ||||
|                 "load_db":"skip", | ||||
|                 "command":"lf_wifi_capacity_test.py", | ||||
|                 "args":"", | ||||
| @@ -640,7 +664,7 @@ | ||||
|             "dataplane_AX210":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
|                 "iterations":"3", | ||||
|                 "iterations":"1", | ||||
|                 "command":"lf_dataplane_test.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
| @@ -720,7 +744,7 @@ | ||||
|             "dataplane_mt7915e":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
|                 "iterations":"3", | ||||
|                 "iterations":"1", | ||||
|                 "command":"lf_dataplane_test.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
|   | ||||
| @@ -20,12 +20,24 @@ | ||||
|             "test_l3_longevity":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
|                 "iterations":"2", | ||||
|                 "command":"test_l3_longevity.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
|                     " --lfmgr LF_MGR_IP --test_duration 15s --polling_interval 5s --upstream_port eth2 ", | ||||
|                     " --lfmgr LF_MGR_IP --local_lf_report_dir REPORT_PATH --test_duration 15s --polling_interval 5s --upstream_port eth2 ", | ||||
|                     " use_ssid_idx=1 --radio 'radio==wiphy1,stations==4,ssid==SSID_USED,ssid_pw==SSID_PW_USED,security==SECURITY_USED' ", | ||||
|                     " --endp_type lf_udp --rates_are_totals --side_a_min_bps=20000 --side_b_min_bps=300000000" | ||||
|                     " --endp_type lf_udp --rates_are_totals --side_a_min_bps=20000 --side_b_min_bps=300000000", | ||||
|                     " --test_rig TEST_RIG --test_tag 'l3_longevity'" | ||||
|                 ] | ||||
|             }, | ||||
|             "lf_qa":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "timeout":"600", | ||||
|                 "load_db":"skip", | ||||
|                 "command":"./tools/lf_qa.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
|                     " --path REPORT_PATH --store --png --database DATABASE_SQLITE" | ||||
|                 ] | ||||
|             } | ||||
|         }, | ||||
| @@ -33,14 +45,26 @@ | ||||
|             "test_l3_longevity":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
|                 "iterations":"1", | ||||
|                 "command":"test_l3_longevity.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
|                     " --lfmgr LF_MGR_IP --test_duration 15s --polling_interval 5s --upstream_port eth2 ", | ||||
|                     " --lfmgr LF_MGR_IP --local_lf_report_dir REPORT_PATH --test_duration 15s --polling_interval 5s --upstream_port eth2 ", | ||||
|                     " use_ssid_idx=1 --radio 'radio==wiphy1,stations==4,ssid==SSID_USED,ssid_pw==SSID_PW_USED,security==SECURITY_USED' ", | ||||
|                     " --endp_type lf_udp --rates_are_totals --side_a_min_bps=20000 --side_b_min_bps=300000000", | ||||
|                     " --test_rig TEST_RIG --test_tag 'l3_longevity'", | ||||
|                     " --ap_read --ap_test_mode" | ||||
|                 ] | ||||
|             }, | ||||
|             "lf_qa":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "timeout":"600", | ||||
|                 "load_db":"skip", | ||||
|                 "command":"./tools/lf_qa.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
|                     " --path REPORT_PATH --store --png --database DATABASE_SQLITE" | ||||
|                 ] | ||||
|             } | ||||
|         }, | ||||
|         "suite_wc_dp_shorter":{ | ||||
| @@ -145,6 +169,20 @@ | ||||
|                     " " | ||||
|                 ] | ||||
|             }, | ||||
|             "test_l3_longevity":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
|                 "iterations":"1", | ||||
|                 "command":"test_l3_longevity.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
|                     " --lfmgr LF_MGR_IP --local_lf_report_dir REPORT_PATH --test_duration 15s --polling_interval 5s --upstream_port eth2 ", | ||||
|                     " use_ssid_idx=1 --radio 'radio==wiphy1,stations==4,ssid==SSID_USED,ssid_pw==SSID_PW_USED,security==SECURITY_USED' ", | ||||
|                     " --endp_type lf_udp --rates_are_totals --side_a_min_bps=20000 --side_b_min_bps=300000000", | ||||
|                     " --test_rig TEST_RIG --test_tag 'l3_longevity'", | ||||
|                     " --ap_read --ap_test_mode" | ||||
|                 ] | ||||
|             }, | ||||
|             "create_chamberview_dut_ATH10K_9984_wc":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
| @@ -457,6 +495,20 @@ | ||||
|                     " " | ||||
|                 ] | ||||
|             }, | ||||
|             "test_l3_longevity":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
|                 "iterations":"1", | ||||
|                 "command":"test_l3_longevity.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
|                     " --lfmgr LF_MGR_IP --local_lf_report_dir REPORT_PATH --test_duration 15s --polling_interval 5s --upstream_port eth2 ", | ||||
|                     " use_ssid_idx=1 --radio 'radio==wiphy1,stations==4,ssid==SSID_USED,ssid_pw==SSID_PW_USED,security==SECURITY_USED' ", | ||||
|                     " --endp_type lf_udp --rates_are_totals --side_a_min_bps=20000 --side_b_min_bps=300000000", | ||||
|                     " --test_rig TEST_RIG --test_tag 'l3_longevity'", | ||||
|                     " --ap_read --ap_test_mode" | ||||
|                 ] | ||||
|             }, | ||||
|             "create_chamberview_dut_ATH10K_9984_wc":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
| @@ -484,7 +536,7 @@ | ||||
|             "wifi_capacity_ATH10K_9984":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "timeout":"600", | ||||
|                 "iterations":"3", | ||||
|                 "iterations":"1", | ||||
|                 "load_db":"skip", | ||||
|                 "command":"lf_wifi_capacity_test.py", | ||||
|                 "args":"", | ||||
| @@ -524,7 +576,7 @@ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
|                 "timeout":"600", | ||||
|                 "iterations":"3", | ||||
|                 "iterations":"1", | ||||
|                 "command":"lf_dataplane_test.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
| @@ -565,7 +617,7 @@ | ||||
|             "wifi_capacity_AX210":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "timeout":"600", | ||||
|                 "iterations":"3", | ||||
|                 "iterations":"1", | ||||
|                 "load_db":"skip", | ||||
|                 "command":"lf_wifi_capacity_test.py", | ||||
|                 "args":"", | ||||
| @@ -604,7 +656,7 @@ | ||||
|             "dataplane_AX210":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
|                 "iterations":"3", | ||||
|                 "iterations":"1", | ||||
|                 "command":"lf_dataplane_test.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
| @@ -645,7 +697,7 @@ | ||||
|             "wifi_capacity_mt7915e":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "timeout":"600", | ||||
|                 "iterations":"3", | ||||
|                 "iterations":"1", | ||||
|                 "load_db":"skip", | ||||
|                 "command":"lf_wifi_capacity_test.py", | ||||
|                 "args":"", | ||||
| @@ -684,7 +736,7 @@ | ||||
|             "dataplane_mt7915e":{ | ||||
|                 "enabled":"TRUE", | ||||
|                 "load_db":"skip", | ||||
|                 "iterations":"3", | ||||
|                 "iterations":"1", | ||||
|                 "command":"lf_dataplane_test.py", | ||||
|                 "args":"", | ||||
|                 "args_list":[ | ||||
|   | ||||
| @@ -619,6 +619,7 @@ NOTE: Diagrams are links in dashboard""".format(ip_qa=ip, qa_url=qa_url) | ||||
|                     self.test_iterations = self.test_iterations_default | ||||
|  | ||||
|                 iteration = 0 | ||||
|                 report_index = 0 # log may contain multiple runs - this helps put the meta.txt in right directory | ||||
|                 for iteration in range(self.test_iterations): | ||||
|                     iteration += 1 | ||||
|  | ||||
| @@ -783,14 +784,17 @@ NOTE: Diagrams are links in dashboard""".format(ip_qa=ip, qa_url=qa_url) | ||||
|                         stdout_log_fd = open(stdout_log_txt) | ||||
|                         # "Report Location:::/home/lanforge/html-reports/wifi-capacity-2021-08-17-04-02-56" | ||||
|                         # | ||||
|                          | ||||
|                         for line in stdout_log_fd: | ||||
|                             if "Report Location" in line: | ||||
|                                 meta_data_path = line.replace('"', '') | ||||
|                                 meta_data_path = meta_data_path.replace('Report Location:::', '') | ||||
|                                 meta_data_path = meta_data_path.split('/')[-1] | ||||
|                                 meta_data_path = meta_data_path.strip() | ||||
|                                 meta_data_path = self.report_path + '/' + meta_data_path + '/meta.txt' | ||||
|                                 break | ||||
|                                 report_index += 1 | ||||
|                                 if iteration == report_index: | ||||
|                                     meta_data_path = line.replace('"', '') | ||||
|                                     meta_data_path = meta_data_path.replace('Report Location:::', '') | ||||
|                                     meta_data_path = meta_data_path.split('/')[-1] | ||||
|                                     meta_data_path = meta_data_path.strip() | ||||
|                                     meta_data_path = self.report_path + '/' + meta_data_path + '/meta.txt' | ||||
|                                     break | ||||
|                         stdout_log_fd.close() | ||||
|                     if meta_data_path != "": | ||||
|                         meta_data_fd = open(meta_data_path, 'w+') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Chuck SmileyRekiere
					Chuck SmileyRekiere