lf_check.py lf_check_config.ini : replace \n \r with '' to read json correctly

Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
Chuck SmileyRekiere
2021-05-10 07:37:46 -06:00
parent d797a60cc7
commit 2ad439466e
2 changed files with 15 additions and 7 deletions

View File

@@ -76,7 +76,8 @@ class lf_check():
if 'TEST_DICTIONARY' in config_file.sections():
section = config_file['TEST_DICTIONARY']
self.test_dict = json.loads(section.get('TEST_DICT', self.test_dict))
# for json replace the \n and \r they are invalid json characters, allows for multiple line args
self.test_dict = json.loads(section.get('TEST_DICT', self.test_dict).replace('\n','').replace('\r',''))
#print("test_dict {}".format(self.test_dict))
def run_script_test(self):
@@ -99,7 +100,10 @@ class lf_check():
command = "./{} {}".format(self.test_dict[test]['command'],self.test_dict[test]['args'])
print("command: {}".format(command))
process = subprocess.run([command], check= True, stdout=subprocess.PIPE, universal_newlines=True)
try:
process = subprocess.run([command], check= True, stdout=subprocess.PIPE, universal_newlines=True)
except:
print("exception on command: {}".format(command))
def main():

View File

@@ -11,6 +11,7 @@ RADIO_DICT: {
"RADIO_1_CFG":{"KEY":"RADIO_1_CFG","RADIO":"wiphy1","STATIONS":"4","SSID":"jedway-wpa2-x2048-4-1","PASSWD":"jedway-wpa2-x2048-4-1","SECURITY":"wpa2"}
}
[TEST_IP]
HTTP_TEST_IP = "10.40.0.1"
FTP_TEST_IP = "10.40.0.1"
@@ -26,15 +27,15 @@ REPORT_DATA="/home/lanforge/report-data"
[TEST_DICTIONARY]
TEST_DICT: {
"example_security_connection":{"enabled":"FALSE","command":"example_security_connection.py","args":""},
"test_ipv4_connection":{"enabled":"FALSE","command":"test_generic.py","args":""},
"test_ipv4_connection":{"enabled":"FALSE","command":"test_ipv4_connection.py","args":"RADIO_0_CFG --debug"},
"test_generic":{"enabled":"FALSE","command":"test_generic.py","args":""},
"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":""},
"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"},
"create_l3":{"enabled":"FALSE","command":"create_l3.py","args":"RADIO_0_CFG --debug"},
"create_l4":{"enabled":"FALSE","command":"create_l4.py","args":"RADIO_1_CFG --debug"},
"create_macvlan":{"enabled":"FALSE","command":"create_macvlan.py","args":""},
"create_station":{"enabled":"FALSE","command":"create_station.py","args":""},
"create_vap":{"enabled":"FALSE","command":"create_vap.py","args":""},
@@ -43,7 +44,10 @@ TEST_DICT: {
"testgroup":{"enabled":"FALSE","command":"testgroup.py","args":""},
"test_ipv6_connection":{"enabled":"FALSE","command":"test_ipv6_connection.py","args":""},
"test_ipv6_variable_time":{"enabled":"FALSE","command":"test_ipv6_variable_time.py","args":""},
"test_l3_longevity":{"enabled":"FALSE","command":"test_l3_longevity.py","args":""},
"test_l3_longevity":{"enabled":"TRUE","command":"test_l3_longevity.py","args":"--test_duration 30s --polling_interval 10s --upstream_port eth1
--radio 'radio==wiphy0 stations==1 ssid==jedway-wpa2-x2048-5-3 ssid_pw==jedway-wpa2-x2048-5-3 security==wpa2'
--radio 'radio==wiphy1 stations==1 ssid==jedway-wpa2-x2048-4-1 ssid_pw==jedway-wpa2-x2048-4-1 security==wpa2'
--mgr '192.168.92.13' --ap_read --ap_test_mode --endp_type 'lf_udp lf_tcp' --rates_are_totals --side_a_min_bps=20000 --side_b_min_bps=300000000"},
"test_l3_powersave_traffic":{"enabled":"FALSE","command":"test_l3_powersave_traffic.py","args":""},
"test_l3_scenario_throughput":{"enabled":"FALSE","command":"test_l3_scenario_throughput.py","args":""},
"test_status_msg":{"enabled":"FALSE","command":"test_status_msg.py","args":""},
@@ -55,5 +59,5 @@ TEST_DICT: {
"test_generic":{"enabled":"FALSE","command":"test_generic.py","args":""},
"new_script":{"enabled":"FALSE","command":"new_script.py","args":""},
"sta_connect_example":{"enabled":"FALSE","command":"sta_connect_example.py","args":""},
"create_vr.py":{"enabled":"TRUE","command":"create_vr.py","args":"--vr_name 2.vr0 --ports 2.br0,2.vap2 --services"}
"create_vr.py":{"enabled":"FALSE","command":"create_vr.py","args":"--vr_name 2.vr0 --ports 2.br0,2.vap2 --services"}
}