From a800abedffff9004bc8bfffebad0ffb935fe7ca2 Mon Sep 17 00:00:00 2001 From: Chuck SmileyRekiere Date: Tue, 1 Jun 2021 06:25:50 -0600 Subject: [PATCH] lf_check.py lf_check_config_template.ini : updated comments began adding additional configuration Signed-off-by: Chuck SmileyRekiere --- py-scripts/tools/lf_check.py | 29 +++++- py-scripts/tools/lf_check_config_template.ini | 89 +++++++++++-------- 2 files changed, 77 insertions(+), 41 deletions(-) diff --git a/py-scripts/tools/lf_check.py b/py-scripts/tools/lf_check.py index 07b039e4..0445395f 100755 --- a/py-scripts/tools/lf_check.py +++ b/py-scripts/tools/lf_check.py @@ -5,12 +5,17 @@ NAME: lf_check.py PURPOSE: -Configuration for lf_check.py , runs various tests +lf_check.py will run a series of tests based on the test TEST_DICTIONARY listed in lf_check_config.ini. +The lf_check_config.ini file is copied from lf_check_config_template.ini and local configuration is made +to the lf_check_config.ini. EXAMPLE: lf_check.py NOTES: +Before using lf_check.py +1. copy lf_check_config_template.ini to the lf_check_config.ini +2. update lf_check_config.ini to enable (TRUE) tests to be run in the TEST_DICTIONARY , the TEST_DICTIONARY needs to be passed in ''' @@ -75,6 +80,7 @@ class lf_check(): self.ftp_test_ip = "" self.test_ip = "" + # section TEST_GENERIC self.radio_lf = "" self.ssdi = "" self.ssid_pw = "" @@ -88,11 +94,23 @@ class lf_check(): self.csv_results_writer = "" self.csv_results_column_headers = "" self.logger = logging.getLogger(__name__) - self.test_timeout = 20 + self.test_timeout = 120 self.use_blank_db = "FALSE" self.use_factory_default_db = "FALSE" self.use_custom_db = "FALSE" + self.production_run = "FALSE" + self.email_list_production = "" + self.host_ip_production = None + self.email_list_test = "" + self.host_ip_test = None + + + def send_results_email(self): + # Following recommendation + # NOTE: https://stackoverflow.com/questions/24196932/how-can-i-get-the-ip-address-from-nic-in-python + pass + def get_csv_results(self): return self.csv_file.name @@ -132,6 +150,7 @@ class lf_check(): """ # Functions in this section are/can be overridden by descendants + # This code reads the lf_check_config.ini file to populate the test variables def read_config_contents(self): self.logger.info("read_config_contents {}".format(CONFIG_FILE)) config_file = configparser.ConfigParser() @@ -179,6 +198,11 @@ class lf_check(): self.use_factory_default_db = section['LOAD_FACTORY_DEFAULT_DB'] self.use_custom_db = section['LOAD_CUSTOM_DB'] self.custom_db = section['CUSTOM_DB'] + self.production_run = section['PRODUCTION_RUN'] + self.email_list_production = section['EMAIL_LIST_PRODUCTION'] + self.host_ip_production = section['HOST_IP_PRODUCTION'] + self.email_list_test = section['EMAIL_LIST_TEST'] + self.host_ip_test = section['HOST_IP_TEST'] if 'RADIO_DICTIONARY' in config_file.sections(): section = config_file['RADIO_DICTIONARY'] @@ -191,7 +215,6 @@ class lf_check(): self.test_dict = json.loads(section.get('TEST_DICT', self.test_dict).replace('\n',' ').replace('\r',' ')) #self.logger.info("test_dict {}".format(self.test_dict)) - def load_factory_default_db(self): #self.logger.info("file_wd {}".format(self.scripts_wd)) try: diff --git a/py-scripts/tools/lf_check_config_template.ini b/py-scripts/tools/lf_check_config_template.ini index fdbf82ad..3c01bd78 100755 --- a/py-scripts/tools/lf_check_config_template.ini +++ b/py-scripts/tools/lf_check_config_template.ini @@ -1,32 +1,44 @@ -# -# NAME : lf_check_config_template.ini -# -# 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 -# -# +''' + NAME : + lf_check_config_template.ini -# NOTE: each test dictionary key must be unique +PURPOSE : +The lf_check_config_template.ini is a template to be copied to the test configuration file : lf_check_config.ini which +is used by the lf_check.py. +The lf_check_config_template.in is devided into section that are used for test selection, test configuration or configuration of lanforge. +Test arguments for the test do not need to use the pre-defined values. The command arguments can be entered directly. + +SETUP: +Copy lf_check_config_template.ini to lf_check_config.ini -# NOTE: { } placement important, will cause parcing errors -# radio configuraiton used below for test arguments -# NOTE: KEY must match ELEMENT of the DICTIONARY (RADIO_1_CFG == "KEY":"RADIO_1_CFG") -[RADIO_DICTIONARY] -RADIO_DICT: { - "RADIO_0_CFG":{"KEY":"RADIO_0_CFG","RADIO":"wiphy0","STATIONS":"4","SSID":"ssid-wpa2","PASSWD":"ssidpw-wpa2","SECURITY":"wpa2"}, - "RADIO_1_CFG":{"KEY":"RADIO_1_CFG","RADIO":"wiphy1","STATIONS":"4","SSID":"ct523c-vap","PASSWD":"ct523c-vap","SECURITY":"wpa2"}, - "RADIO_2_CFG":{"KEY":"RADIO_2_CFG","RADIO":"wiphy1","STATIONS":"4","SSID":"ssid-wpa","PASSWD":"ssidpw-wpa","SECURITY":"wpa"}, - "RADIO_3_CFG":{"KEY":"RADIO_3_CFG","RADIO":"wiphy1","STATIONS":"4","SSID":"ssid-wep","PASSWD":"ssidpw-wep","SECURITY":"wep"}, - "RADIO_4_CFG":{"KEY":"RADIO_4_CFG","RADIO":"wiphy1","STATIONS":"4","SSID":"ssid-wpa3","PASSWD":"ssidpw-wpa3","SECURITY":"wpa3"} - } +1. Update the lf_check_config.ini with the tests to be run by setting the enable flag to TRUE +2. TEST_DICTIONARY contains the test list: test key, test name, test arguments +NOTE: each test dictionary key must be unique +NOTE: { } placement important, will cause parcing errors +''' +# NO quotes around parameters in TEST_PARAMETERS section +[TEST_PARAMETERS] +TEST_TIMEOUT = 200 +LOAD_BLANK_DB = FALSE +LOAD_FACTORY_DEFAULT_DB = TRUE +LOAD_CUSTOM_DB = FALSE +CUSTOM_DB = DFLT_ETH1_GEN +PRODUCTION_RUN = FALSE # determine whom to send emails to +EMAIL_LIST_PRODUCTION = chuck.rekiere@candelatech.com +HOST_IP_PRODUCTION = 192.168.95.6 +EMAIL_LIST_TEST = chuck.rekiere@candelatech.com +HOST_IP_TEST = 192.168.95.6 + +# Command line arguments: Configures network information used as inputs to test command line [TEST_NETWORK] HTTP_TEST_IP = "10.40.0.10" FTP_TEST_IP = "10.40.0.10" TEST_IP = "192.168.0.104" +# Command line arguments: LANForge configuration +# Also can use for single lanforge radio configuraiton , the RADIO_DICT may also be used for radio configuration [TEST_GENERIC] RADIO_USED = wiphy1 SSID_USED = ct523c-vap @@ -36,14 +48,17 @@ NUM_STA = 4 COL_NAMES = name,tx_bytes,rx_bytes,dropped UPSTREAM_PORT = eth1 -# NO quotes around test parameters -# Note: please copy lf_check_config_template.ini - values used for lf_check.py script verification -[TEST_PARAMETERS] -TEST_TIMEOUT = 200 -LOAD_BLANK_DB = FALSE -LOAD_FACTORY_DEFAULT_DB = TRUE -LOAD_CUSTOM_DB = FALSE -CUSTOM_DB = DFLT_ETH1_GEN +# Command line arguments +# radio configuraiton may also be done in the TEST_GENEERIC arguments +# NOTE: KEY must match ELEMENT of the DICTIONARY (RADIO_1_CFG == "KEY":"RADIO_1_CFG") +[RADIO_DICTIONARY] +RADIO_DICT: { + "RADIO_0_CFG":{"KEY":"RADIO_0_CFG","RADIO":"wiphy0","STATIONS":"4","SSID":"ssid-wpa2","PASSWD":"ssidpw-wpa2","SECURITY":"wpa2"}, + "RADIO_1_CFG":{"KEY":"RADIO_1_CFG","RADIO":"wiphy1","STATIONS":"4","SSID":"ct523c-vap","PASSWD":"ct523c-vap","SECURITY":"wpa2"}, + "RADIO_2_CFG":{"KEY":"RADIO_2_CFG","RADIO":"wiphy1","STATIONS":"4","SSID":"ssid-wpa","PASSWD":"ssidpw-wpa","SECURITY":"wpa"}, + "RADIO_3_CFG":{"KEY":"RADIO_3_CFG","RADIO":"wiphy1","STATIONS":"4","SSID":"ssid-wep","PASSWD":"ssidpw-wep","SECURITY":"wep"}, + "RADIO_4_CFG":{"KEY":"RADIO_4_CFG","RADIO":"wiphy1","STATIONS":"4","SSID":"ssid-wpa3","PASSWD":"ssidpw-wpa3","SECURITY":"wpa3"} + } # Not used [LF_MGR] @@ -55,9 +70,10 @@ LF_MGR_PORT=8080 #[REPORTS] #REPORT_DIR="/home/lanforge/html-reports" - # TEST_DICTIONARY used by lf_check, Other section names will be ignored so can save other test lists +# TEST_DICTIONARY_ENABLE_1 is an example, it will not run unless the name is changed to TEST_DICTIONARY [TEST_DICTIONARY_EXAMPLE_1] +#[TEST_DICTIONARY] TEST_DICT: { "test_ipv4_l4":{"enabled":"FALSE","command":"test_ipv4_l4.py","args":"--radio wiphy1 --ssid ct523c-vap --passwd ct523c-vap --security wpa2 --num_stations 4 --test_duration 15s --debug"}, "test_ipv4_variable_time2":{"enabled":"TRUE","command":"test_ipv4_variable_time.py","args":"--radio wiphy1 --ssid ct523c-vap --passwd ct523c-vap --security wpa2 --test_duration 15s --output_format excel --layer3_cols name,tx_bytes,rx_bytes,dropped --traffic_type lf_udp --debug"} @@ -65,19 +81,14 @@ TEST_DICT: { # TEST_DICTIONARY used by lf_check, Other section names will be ignored so can save other test lists [TEST_DICTIONARY_EXAMPLE_2] +#[TEST_DICTIONARY] TEST_DICT: { "create_l3":{"enabled":"TRUE","command":"create_l3.py","args":"RADIO_1_CFG --debug"}, "create_l4":{"enabled":"TRUE","command":"create_l4.py","args":"RADIO_1_CFG --debug"} } - - - # This is an EXAMPLE dictionary of tests that can be run, copy to TEST_DICTIONARY to test. # Feature update pass in the DICTIONARY name to be run -# NOTE: please do not edit this example it is used for lf_check.py script verification -# NOTE: generic tab needs to be enabled to allow for generic tests to pass -# Please enter addtional dictionaries after this one [TEST_DICTIONARY_EXAMPLE_3] #[TEST_DICTIONARY] TEST_DICT: { @@ -117,14 +128,16 @@ TEST_DICT: { "wlan_capacity_calculator3":{"enabled":"TRUE","command":"./wlan_capacity_calculator.py","args":"-sta 11ac -t Voice -d 9 -spa 3 -ch 20 -gu 800 -high 1 -e TKIP -q Yes -ip 3 -mc 0 -b 6 12 24 54 -m 1518 -co Greenfield -cw 15 -rc Yes"} } + +# This LISA is used currelty for facilitating getting testing on LISA [TEST_DICTIONARY_LISA_SHORT] #[TEST_DICTIONARY] TEST_DICT: { - "test_ipv4_l4":{"enabled":"FALSE","command":"test_ipv4_l4.py","args":"--radio wiphy1 --ssid jedway-wpa2-x2048-5-3 --passwd jedway-wpa2-x2048-5-3 --security wpa2 --num_stations 4 --test_duration 15s --debug"}, - "test_ipv4_variable_time2":{"enabled":"TRUE","command":"test_ipv4_variable_time.py","args":"--radio wiphy1 --ssid jedway-wpa2-x2048-5-3 --passwd jedway-wpa2-x2048-5-3 --security wpa2 --test_duration 15s --output_format excel --layer3_cols name,tx_bytes,rx_bytes,dropped --traffic_type lf_udp --debug"} + "create_l3":{"enabled":"TRUE","command":"create_l3.py","args":"--radio RADIO_USED --ssid SSID_USED --passwd SSID_PW_USED --security SECURITY_USED --debug"}, + "create_l4":{"enabled":"TRUE","command":"create_l4.py","args":"RADIO_1_CFG --debug"}, + "create_l4":{"enabled":"TRUE","command":"create_l4.py","args":"--radio wiphy1 --ssid jedway-wpa2-x2048-5-3 --passwd jedway-wpa2-x2048-5-3 --security wpa2 --debug"}, } - #[TEST_DICTIONARY] [TEST_DICTIONARY_LISA] TEST_DICT: {