lf_check.py : added configuraiton test timeout, load blank or factory default , 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-18 06:54:50 -06:00
parent 6e332860d5
commit 90a8847996
2 changed files with 26 additions and 8 deletions

View File

@@ -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"

View File

@@ -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