diff --git a/py-scripts/tools/lf_check.py b/py-scripts/tools/lf_check.py index e26b1753..3b8b934e 100755 --- a/py-scripts/tools/lf_check.py +++ b/py-scripts/tools/lf_check.py @@ -86,6 +86,9 @@ class lf_check(): self.csv_results_writer = "" self.csv_results_column_headers = "" self.logger = logging.getLogger(__name__) + self.test_timeout = 20 + self.load_blank_db = "False" + self.load_factory_default_db = "False" def get_csv_results(self): return self.csv_file.name @@ -166,6 +169,11 @@ class lf_check(): self.upstream_port = section['UPSTREAM_PORT'] self.logger.info("upstream_port {}".format(self.upstream_port)) + if 'TEST_PARAMETERS' in config_file.sections(): + section = config_file['TEST_PARAMETERS'] + self.test_timeout = section['TEST_TIMEOUT'] + self.load_blank_db = section['LOAD_BLANK_DB'] + self.load_factory_default_db = section['LOAD_FACTORY_DEFAULT_DB'] if 'RADIO_DICTIONARY' in config_file.sections(): section = config_file['RADIO_DICTIONARY'] @@ -249,8 +257,11 @@ class lf_check(): 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) + if self.load_factory_default_db == "True": + self.load_factory_default_db() + elif self.load_blank_db == "True": + self.load_blank_db() - self.load_factory_default_db() sleep(5) # the sleep is to allow for the database to stablize try: @@ -277,7 +288,7 @@ class lf_check(): try: #out, err = process.communicate() - process.wait(timeout=120) + process.wait(timeout=int(self.test_timeout)) except subprocess.TimeoutExpired: process.terminate() self.test_result = "TIMEOUT" diff --git a/py-scripts/tools/lf_check_config.ini b/py-scripts/tools/lf_check_config.ini index fd2c2feb..1507f148 100755 --- a/py-scripts/tools/lf_check_config.ini +++ b/py-scripts/tools/lf_check_config.ini @@ -1,10 +1,14 @@ # # NAME : config.ini # -# PURPOSE : Configuration (config.ini) information for running lf_check.py +# PURPOSE : Configuration (lf_check_config.ini) information for running lf_check.py +# +# SETUP: copy lf_check_config_template.ini to lf_check_config.ini and update lf_check_config.ini # +# # NOTE: each test dictionary key must be unique + # NOTE: { } placement important, will cause parcing errors # radio configuraiton used below for test arguments # NOTE: KEY must match ELEMENT of the DICTIONARY (RADIO_0_CFG == "KEY":"RADIO_0_CFG") @@ -32,17 +36,20 @@ NUM_STA = "3" COL_NAMES = "name,tx_bytes,rx_bytes,dropped" UPSTREAM_PORT = "eth1" +[TEST_PARAMETERS] +TEST_TIMEOUT = 120 +LOAD_BLANK_DB = "False" +LOAD_FACTORY_DEFAULT_DB = "False" [LF_MGR] LF_MGR_IP= localhost LF_MGR_PORT=8080 -[REPORTS] -REPORT_DIR="/home/lanforge/html-reports" -REPORT_DATA="/home/lanforge/report-data" +# REPORTS are in /home/lanforge/html-reports +# if /home/lanforge/html-reports not present then reports stored in local directory +#[REPORTS] +#REPORT_DIR="/home/lanforge/html-reports" -[TEST_PARAMETERS] -TEST_TIMEOUT = "120" # TEST_DICTIONARY used by lf_check, Other section names will be ignored so can save other test lists # USE TEST_DICTIONARY_NOT_RUN to ignore tests