diff --git a/py-scripts/sandbox/lf_check.py b/py-scripts/sandbox/lf_check.py index b2e4e0e8..9b44c140 100755 --- a/py-scripts/sandbox/lf_check.py +++ b/py-scripts/sandbox/lf_check.py @@ -104,8 +104,8 @@ class lf_check(): config_file = configparser.ConfigParser() success = True success = config_file.read(CONFIG_FILE) - print("{}".format(success)) - print("{}".format(config_file)) + #print("{}".format(success)) + #print("{}".format(config_file)) if 'LF_MGR' in config_file.sections(): section = config_file['LF_MGR'] @@ -114,6 +114,13 @@ class lf_check(): print("lf_mgr_ip {}".format(self.lf_mgr_ip)) print("lf_mgr_port {}".format(self.lf_mgr_port)) + if 'TEST_IP' in config_file.sections(): + section = config_file['TEST_IP'] + self.http_test_ip = section['HTTP_TEST_IP'] + print("http_test_ip {}".format(self.http_test_ip)) + self.ftp_test_ip = section['FTP_TEST_IP'] + print("ftp_test_ip {}".format(self.ftp_test_ip)) + # NOTE: this may need to be a list for ssi if 'RADIO_DICTIONARY' in config_file.sections(): section = config_file['RADIO_DICTIONARY'] @@ -126,10 +133,10 @@ class lf_check(): #print("test_dict {}".format(self.test_dict)) def load_factory_default_db(self): - print("file_wd {}".format(self.scripts_wd)) + #print("file_wd {}".format(self.scripts_wd)) try: os.chdir(self.scripts_wd) - print("Current Working Directory {}".format(os.getcwd())) + #print("Current Working Directory {}".format(os.getcwd())) except: print("failed to change to {}".format(self.scripts_wd)) @@ -142,10 +149,10 @@ class lf_check(): # Not currently used def load_blank_db(self): - print("file_wd {}".format(self.scripts_wd)) + #print("file_wd {}".format(self.scripts_wd)) try: os.chdir(self.scripts_wd) - print("Current Working Directory {}".format(os.getcwd())) + #print("Current Working Directory {}".format(os.getcwd())) except: print("failed to change to {}".format(self.scripts_wd)) @@ -166,14 +173,20 @@ class lf_check(): 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'])) + + 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) + if 'FTP_TEST_IP' in self.test_dict[test]['args']: + self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('FTP_TEST_IP',self.ftp_test_ip) + 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)) + #print("file_wd {}".format(self.scripts_wd)) try: os.chdir(self.scripts_wd) - print("Current Working Directory {}".format(os.getcwd())) + #print("Current Working Directory {}".format(os.getcwd())) except: print("failed to change to {}".format(self.scripts_wd)) cmd_args = "{}".format(self.test_dict[test]['args']) @@ -184,22 +197,17 @@ class lf_check(): if self.outfile is not None: stdout_log_txt = self.outfile stdout_log_txt = stdout_log_txt + "-{}-stdout.txt".format(test) - print("stdout_log_txt: {}".format(stdout_log_txt)) + #print("stdout_log_txt: {}".format(stdout_log_txt)) stdout_log = open(stdout_log_txt, 'a') stderr_log_txt = self.outfile stderr_log_txt = stderr_log_txt + "-{}-stderr.txt".format(test) - print("stderr_log_txt: {}".format(stderr_log_txt)) + #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) - print(stdout_log_txt) + #print(stdout_log_txt) stdout_log_size = os.path.getsize(stdout_log_txt) - if stdout_log_size > 0: - print("File: {} is not empty: {}".format(stdout_log_txt,str(stdout_log_size))) - else: - print("File: {} is empty: {}".format(stdout_log_txt,str(stdout_log_size))) - - print(stderr_log_txt) + #print(stderr_log_txt) stderr_log_size = os.path.getsize(stderr_log_txt) if stderr_log_size > 0: print("File: {} is not empty: {}".format(stderr_log_txt,str(stderr_log_size))) @@ -220,9 +228,9 @@ class lf_check(): else: self.html_results += """