mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-11-04 12:48:00 +00:00 
			
		
		
		
	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:
		@@ -86,6 +86,9 @@ class lf_check():
 | 
				
			|||||||
        self.csv_results_writer = ""
 | 
					        self.csv_results_writer = ""
 | 
				
			||||||
        self.csv_results_column_headers = ""
 | 
					        self.csv_results_column_headers = ""
 | 
				
			||||||
        self.logger = logging.getLogger(__name__)
 | 
					        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):
 | 
					    def get_csv_results(self):
 | 
				
			||||||
        return self.csv_file.name
 | 
					        return self.csv_file.name
 | 
				
			||||||
@@ -166,6 +169,11 @@ class lf_check():
 | 
				
			|||||||
            self.upstream_port = section['UPSTREAM_PORT']
 | 
					            self.upstream_port = section['UPSTREAM_PORT']
 | 
				
			||||||
            self.logger.info("upstream_port {}".format(self.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():
 | 
					        if 'RADIO_DICTIONARY' in config_file.sections():
 | 
				
			||||||
            section = config_file['RADIO_DICTIONARY']
 | 
					            section = config_file['RADIO_DICTIONARY']
 | 
				
			||||||
@@ -249,8 +257,11 @@ class lf_check():
 | 
				
			|||||||
                if 'UPSTREAM_PORT' in self.test_dict[test]['args']:
 | 
					                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.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
 | 
					                sleep(5) # the sleep is to allow for the database to stablize
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                try:
 | 
					                try:
 | 
				
			||||||
@@ -277,7 +288,7 @@ class lf_check():
 | 
				
			|||||||
                
 | 
					                
 | 
				
			||||||
                try:
 | 
					                try:
 | 
				
			||||||
                    #out, err = process.communicate()
 | 
					                    #out, err = process.communicate()
 | 
				
			||||||
                    process.wait(timeout=120)
 | 
					                    process.wait(timeout=int(self.test_timeout))
 | 
				
			||||||
                except subprocess.TimeoutExpired:
 | 
					                except subprocess.TimeoutExpired:
 | 
				
			||||||
                    process.terminate()
 | 
					                    process.terminate()
 | 
				
			||||||
                    self.test_result = "TIMEOUT"
 | 
					                    self.test_result = "TIMEOUT"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,14 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
# NAME : config.ini
 | 
					# 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: each test dictionary key must be unique 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# NOTE: { }  placement important, will cause parcing errors
 | 
					# NOTE: { }  placement important, will cause parcing errors
 | 
				
			||||||
# radio configuraiton used below for test arguments
 | 
					# radio configuraiton used below for test arguments
 | 
				
			||||||
# NOTE: KEY must match ELEMENT of the DICTIONARY (RADIO_0_CFG == "KEY":"RADIO_0_CFG")
 | 
					# 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"
 | 
					COL_NAMES = "name,tx_bytes,rx_bytes,dropped"
 | 
				
			||||||
UPSTREAM_PORT = "eth1"
 | 
					UPSTREAM_PORT = "eth1"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[TEST_PARAMETERS]
 | 
				
			||||||
 | 
					TEST_TIMEOUT = 120
 | 
				
			||||||
 | 
					LOAD_BLANK_DB = "False"
 | 
				
			||||||
 | 
					LOAD_FACTORY_DEFAULT_DB = "False"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[LF_MGR]
 | 
					[LF_MGR]
 | 
				
			||||||
LF_MGR_IP= localhost
 | 
					LF_MGR_IP= localhost
 | 
				
			||||||
LF_MGR_PORT=8080
 | 
					LF_MGR_PORT=8080
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[REPORTS]
 | 
					# REPORTS are in /home/lanforge/html-reports
 | 
				
			||||||
REPORT_DIR="/home/lanforge/html-reports"
 | 
					# if /home/lanforge/html-reports not present then reports stored in local directory
 | 
				
			||||||
REPORT_DATA="/home/lanforge/report-data"
 | 
					#[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
 | 
					# 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
 | 
					# USE TEST_DICTIONARY_NOT_RUN to ignore tests
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user