From b809e1074766dd2a15c02ae1c4bc3219aff4fad5 Mon Sep 17 00:00:00 2001 From: Chuck SmileyRekiere Date: Fri, 27 Aug 2021 18:04:36 -0600 Subject: [PATCH] lf_check.py : initial work on getting radio information ct_us_001_tests.json : created a shorter test Signed-off-by: Chuck SmileyRekiere --- py-scripts/tools/ct_us_001_tests.json | 51 +++++++++++++++++++++++++ py-scripts/tools/lf_check.py | 55 +++++++++++++++++++++++++-- 2 files changed, 103 insertions(+), 3 deletions(-) diff --git a/py-scripts/tools/ct_us_001_tests.json b/py-scripts/tools/ct_us_001_tests.json index 33da3492..ad41538e 100644 --- a/py-scripts/tools/ct_us_001_tests.json +++ b/py-scripts/tools/ct_us_001_tests.json @@ -114,6 +114,57 @@ } }, + "suite_wc_dp_shorter":{ + "CT-US-001_create_chamberview_dut_0":{ + "enabled":"TRUE", + "load_db":"skip", + "command":"create_chamberview_dut.py", + "args":"", + "args_list":[ + " --lfmgr LF_MGR_IP --port LF_MGR_PORT --dut_name DUT_NAME", + " --ssid 'ssid_idx=0 ssid=asus11ax-5 security=WPA2 password=hello123 bssid=DUT_BSSID_5G'", + " --ssid 'ssid_idx=1 ssid=asus11ax-5 security=WPA2 password=hello123 bssid=DUT_BSSID_5G'", + " --sw_version DUT_SW --hw_version DUT_HW --serial_num DUT_SERIAL --model_num DUT_NAME" + ] + }, + "CT-US-001_create_chamberview_mt7915e_sta19":{ + "enabled":"TRUE", + "load_db":"skip", + "command":"create_chamberview.py", + "args":"", + "args_list":[ + " --lfmgr LF_MGR_IP --port LF_MGR_PORT --delete_scenario", + " --create_scenario ct-us-001-scenario ", + " --raw_line \"profile_link 1.1 STA-AC 19 'DUT: DUT_NAME Radio-1' NA wiphy7,AUTO -1 NA\" ", + " --raw_line \"profile_link 1.1 upstream-dhcp 1 NA NA UPSTREAM_PORT,AUTO -1 NA\"" + ] + }, + "CT-US-001_wifi_capacity_mt7915e":{ + "enabled":"TRUE", + "timeout":"600", + "iterations":"1", + "load_db":"skip", + "command":"lf_wifi_capacity_test.py", + "args":"", + "args_list":[ + " --mgr LF_MGR_IP --port LF_MGR_PORT --lf_user lanforge --lf_password lanforge --instance_name cicd-wct", + " --upstream 1.1.eth2 --batch_size 1,10,19 --loop_iter 1 --protocol UDP-IPv4 --duration 6000", + " --pull_report --local_lf_report_dir REPORT_PATH --test_tag 'mt7915e'", + " --test_rig TEST_RIG", + " --set DUT_SET_NAME" + ] + }, + "CT-US-001_QA":{ + "enabled":"TRUE", + "timeout":"600", + "load_db":"skip", + "command":"./tools/lf_qa.py", + "args":"", + "args_list":[ + " --path REPORT_PATH --store --png --database ./tools/qa_001_test_db" + ] + } + }, "suite_wc_dp_short":{ "CT-US-001_create_chamberview_dut_for_ATH10K":{ "enabled":"TRUE", diff --git a/py-scripts/tools/lf_check.py b/py-scripts/tools/lf_check.py index 70047664..2f817654 100755 --- a/py-scripts/tools/lf_check.py +++ b/py-scripts/tools/lf_check.py @@ -257,6 +257,27 @@ class lf_check(): scripts_git_sha = commit_hash.decode('utf-8', 'ignore') return scripts_git_sha + ''' + self.lf_mgr_ip = "192.168.0.102" + self.lf_mgr_port = "8080" + self.lf_mgr_user = "lanforge" + self.lf_mgr_pass = "lanforge" + ''' + def get_lanforge_radio_information(self): + # https://docs.python-requests.org/en/latest/ + # https://stackoverflow.com/questions/26000336/execute-curl-command-within-a-python-script - use requests + # curl --user "lanforge:lanforge" -H 'Accept: application/json' http://192.168.100.116:8080/radiostatus/all | json_pp , where --user "USERNAME:PASSWORD" + request_command = 'http://{lfmgr}:{port}/radiostatus/all'.format(lfmgr=self.lf_mgr_ip,port=self.lf_mgr_port) + request = requests.get(request_command, auth=(self.lf_mgr_user,self.lf_mgr_pass)) + print("radio request command: {request_command}".format(request_command=request_command)) + print("radio request status_code {status}".format(status=request.status_code)) + lanforge_radio_json = request.json() + print("radio request.json: {json}".format(json=lanforge_radio_json)) + lanforge_radio_text = request.text + print("radio request.test: {text}".format(text=lanforge_radio_text)) + return lanforge_radio_json, lanforge_radio_text + + def get_lanforge_system_node_version(self): ssh = paramiko.SSHClient() # creating shh client object we use this object to connect to router ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # automatically adds the missing host key @@ -330,10 +351,10 @@ class lf_check(): message_txt = """{email_txt} lanforge target {lf_mgr_ip} Results from {hostname}: http://{hostname}/{report} -""".format(email_txt=self.email_txt,lf_mgr_ip=self.lf_mgr_ip,hostname=hostname, ip=ip,report=report_url) +""".format(email_txt=self.email_txt,lf_mgr_ip=self.lf_mgr_ip,hostname=hostname,report=report_url) else: message_txt = """Results from {hostname}: -http://{hostname}/{report}""".format(hostname=hostname, ip=ip,report=report_url) +http://{hostname}/{report}""".format(hostname=hostname,report=report_url) # Put in report information current two methods supported, if(self.json_igg != "" ): @@ -1144,12 +1165,25 @@ NOTE: Diagrams are links in dashboard""".format(ip_qa=ip,qa_url=qa_url) self.html_results += """""" self.html_results += """""" + #TODO - plase copy button at end and selectable , so individual sections may be copied if command != short_cmd: - self.html_results += f""" + '''self.html_results += f""" Copy {command} """.format(command=command) + ''' + self.html_results += f""" + {command} + + """.format(command=command) + + ''' + self.html_results += f""" + {command} + + """.format(command=command) + ''' row = [test, command, self.test_result, stdout_log_txt, stderr_log_txt] self.csv_results_writer.writerow(row) @@ -1328,6 +1362,21 @@ Example : print("lanforge_gui_version exception, tests aborted check lanforge ip") exit(1) + #try: + lanforge_radio_json, lanforge_radio_text = check.get_lanforge_radio_information() + #lanforge_radio_obj = json.loads(lanforge_radio_json) + lanforge_radio_formatted_str = json.dumps(lanforge_radio_json, indent = 2) + print("lanforge_radio_json: {lanforge_radio_json}".format(lanforge_radio_json=lanforge_radio_formatted_str)) + + + for key in lanforge_radio_json: + if 'wiphy' in key: + print("key {}".format(key)) + print("lanforge_radio_json[{}]: {}".format(key,lanforge_radio_json[key])) + + #except: + # print("get_lanforge_radio_json excption, no radio data") + #check.get_radio_status() # LANforge and scripts config for results