lf_check.py : added COL_NAMES for tests, updated lf_check_config.ini to support

Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
Chuck SmileyRekiere
2021-05-16 07:35:11 -06:00
parent 77e7df19d4
commit 7dfedb750d
2 changed files with 34 additions and 17 deletions

View File

@@ -80,6 +80,8 @@ class lf_check():
self.ssid_pw = ""
self.security = ""
self.num_sta = ""
self.col_names = ""
self.upstream_port = ""
def get_html_results(self):
return self.html_results
@@ -145,7 +147,12 @@ class lf_check():
print("secruity {}".format(self.security))
self.num_sta = section['NUM_STA']
print("num_sta {}".format(self.num_sta))
self.col_names = section['COL_NAMES']
print("col_names {}".format(self.col_names))
self.upstream_port = section['UPSTREAM_PORT']
print("upstream_port {}".format(self.upstream_port))
if 'RADIO_DICTIONARY' in config_file.sections():
section = config_file['RADIO_DICTIONARY']
self.radio_dict = json.loads(section.get('RADIO_DICT', self.radio_dict))
@@ -193,13 +200,15 @@ class lf_check():
print("test: {} skipped".format(test))
# load the default database
elif self.test_dict[test]['enabled'] == "TRUE":
# Make the command replace ment a separate method call.
# loop through radios
for radio in self.radio_dict:
# Replace RADIO, SSID, PASSWD, SECURITY with actual config values (e.g. RADIO_0_CFG to values)
# not "KEY" is just a word to refer to the RADIO define (e.g. RADIO_0_CFG) to get the vlaues
# --num_stations needs to be int not string (no double quotes)
if self.radio_dict[radio]["KEY"] in self.test_dict[test]['args']:
self.test_dict[test]['args'] = self.test_dict[test]['args'].replace(self.radio_dict[radio]["KEY"],'--radio "{}" --ssid "{}" --passwd "{}" --security "{}"'
.format(self.radio_dict[radio]['RADIO'],self.radio_dict[radio]['SSID'],self.radio_dict[radio]['PASSWD'],self.radio_dict[radio]['SECURITY']))
self.test_dict[test]['args'] = self.test_dict[test]['args'].replace(self.radio_dict[radio]["KEY"],'--radio "{}" --ssid "{}" --passwd "{}" --security "{}" --num_stations {}'
.format(self.radio_dict[radio]['RADIO'],self.radio_dict[radio]['SSID'],self.radio_dict[radio]['PASSWD'],self.radio_dict[radio]['SECURITY'],self.radio_dict[radio]['STATIONS']))
if 'HTTP_TEST_IP' in self.test_dict[test]['args']:
self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('HTTP_TEST_IP',self.http_test_ip)
@@ -218,12 +227,15 @@ class lf_check():
self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('SECURITY_USED',self.security)
if 'NUM_STA' in self.test_dict[test]['args']:
self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('NUM_STA',self.num_sta)
if 'COL_NAMES' in self.test_dict[test]['args']:
self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('COL_NAMES',self.col_names)
if 'UPSTREAM_PORT' in self.test_dict[test]['args']:
self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('UPSTREAM_PORT',self.col_names)
self.load_factory_default_db()
sleep(5) # the sleep is to allow for the database to stablize
# this is just to get the directory with the scripts to run.
#print("file_wd {}".format(self.scripts_wd))
try:
os.chdir(self.scripts_wd)
#print("Current Working Directory {}".format(os.getcwd()))
@@ -234,8 +246,6 @@ class lf_check():
print("command: {}".format(command))
print("cmd_args {}".format(cmd_args))
if self.outfile is not None:
stdout_log_txt = self.outfile
stdout_log_txt = stdout_log_txt + "-{}-stdout.txt".format(test)
@@ -245,6 +255,7 @@ class lf_check():
stderr_log_txt = stderr_log_txt + "-{}-stderr.txt".format(test)
#print("stderr_log_txt: {}".format(stderr_log_txt))
stderr_log = open(stderr_log_txt, 'a')
process = subprocess.Popen((command).split(' '), shell=False, stdout=stdout_log, stderr=stderr_log, universal_newlines=True)
try:
out, err = process.communicate(timeout=20)

View File

@@ -27,6 +27,7 @@ SSID_USED = "jedway-wpa2-x2048-4-1"
SSID_PW_USED = "jedway-wpa2-x2048-4-1"
SECURITY_USED = "wpa2"
NUM_STA = "3"
COL_NAMES = "name,tx_bytes,rx_bytes,dropped"
[LF_MGR]
@@ -37,23 +38,28 @@ LF_MGR_PORT=8080
REPORT_DIR="/home/lanforge/html-reports"
REPORT_DATA="/home/lanforge/report-data"
[TEST_PARAMETERS]
TEST_TIMEOUT = "120"
# NOTE: the
[TEST_DICTIONARY]
TEST_DICT: {
"example_security_connection0":{"enabled":"FALSE","command":"example_security_connection.py","args":"RADIO_0_CFG --debug"},
"example_security_connection1":{"enabled":"FALSE","command":"example_security_connection.py","args":"RADIO_2_CFG --debug"},
"example_security_connection2":{"enabled":"FALSE","command":"example_security_connection.py","args":"RADIO_3_CFG --debug"},
"example_security_connection3":{"enabled":"FALSE","command":"example_security_connection.py","args":"RADIO_4_CFG --debug"},
"sta_connect2":{"enabled":"TRUE","FALSE":"sta_connect2.py","args":"--dut_ssid jedway-wpa2-x2048-5-3 --dut_passwd jedway-wpa2-x2048-5-3 --dut_security wpa2"},
"test_generic0":{"enabled":"FALSE","command":"test_generic.py","args":"RADIO_1_CFG --type lfping --dest TEST_IP --debug"},
"example_security_connection0":{"enabled":"TRUE","command":"example_security_connection.py","args":"RADIO_0_CFG --debug"},
"example_security_connection1":{"enabled":"TRUE","command":"example_security_connection.py","args":"RADIO_2_CFG --debug"},
"example_security_connection2":{"enabled":"TRUE","command":"example_security_connection.py","args":"RADIO_3_CFG --debug"},
"example_security_connection3":{"enabled":"TRUE","command":"example_security_connection.py","args":"RADIO_4_CFG --debug"},
"sta_connect2":{"enabled":"TRUE","command":"sta_connect2.py","args":"--dut_ssid jedway-wpa2-x2048-5-3 --dut_passwd jedway-wpa2-x2048-5-3 --dut_security wpa2"},
"sta_connect_example":{"enabled":"TRUE","command":"sta_connect_example.py"},
"test_generic0":{"enabled":"TRUE","command":"test_generic.py","args":"RADIO_1_CFG --type lfping --dest TEST_IP --debug"},
"test_generic1":{"enabled":"TRUE","command":"test_generic.py","args":"RADIO_1_CFG --type speedtest --speedtest_min_up 20 --speedtest_min_dl 20 --speedtest_max_ping 150 --debug"},
"test_generic2":{"enabled":"TRUE","command":"test_generic.py","args":"RADIO_1_CFG --type lfping --dest TEST_IP --debug"},
"test_generic3":{"enabled":"TRUE","command":"test_generic.py","args":"RADIO_1_CFG --type lfping --dest TEST_IP --debug"},
"test_ipv4_connection":{"enabled":"TRUE","command":"test_ipv4_connection.py","args":"RADIO_0_CFG --debug"},
"test_ipv4_l4_urls_per_ten":{"enabled":"FALSE","command":"test_ipv4_l4_urls_per_ten.py","args":""},
"test_ipv4_l4_wifi":{"enabled":"FALSE","command":"test_ipv4_l4_wifi.py","args":""},
"test_ipv4_l4":{"enabled":"FALSE","command":"test_ipv4_l4.py","args":""},
"test_ipv4_variable_time":{"enabled":"FALSE","command":"test_ipv4_variable_time.py","args":""},
"test_ipv4_l4_urls_per_ten":{"enabled":"TRUE","command":"test_ipv4_l4_urls_per_ten.py","args":"RADIO_0_CFG --num_tests 1 --requests_per_ten 600 --target_per_ten 600 --debug"},
"test_ipv4_l4_wifi":{"enabled":"TRUE","command":"test_ipv4_l4_wifi.py","args":"RADIO_0_CFG --test_duration 15s --debug"},
"test_ipv4_l4":{"enabled":"TRUE","command":"test_ipv4_l4.py","args":"RADIO_0_CFG --test_duration 15s --debug"},
"test_ipv4_variable_time0":{"enabled":"TRUE","command":"test_ipv4_variable_time.py","args":"RADIO_0_CFG --test_duration 15s --output_format excel --layer3_cols COL_NAMES --traffic_type lf_udp --debug"},
"test_ipv4_variable_time1":{"enabled":"TRUE","command":"test_ipv4_variable_time.py","args":"RADIO_0_CFG --test_duration 15s --output_format csv --layer3_cols COL_NAMES --traffic_type lf_udp --debug"},
"create_bridge":{"enabled":"FALSE","command":"create_bridge.py","args":""},
"create_l3":{"enabled":"TRUE","command":"create_l3.py","args":"RADIO_0_CFG --debug"},
"create_l4":{"enabled":"TRUE","command":"create_l4.py","args":"RADIO_1_CFG --debug"},