Improve lf_ap_auto_test

Some untested changes to regression test script to allow passing more
info in on cmd line.

Use correct DUT name when starting ap-auto test.

Run connection test only at this time, it is fast when it works,
and proves basic ability to launch the test.

Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
Ben Greear
2022-02-05 20:56:29 -08:00
committed by shivam
parent 4129f01860
commit 548167d7af
5 changed files with 78 additions and 47 deletions

View File

@@ -167,9 +167,12 @@ import os
import importlib
import argparse
import time
import logging
logger = logging.getLogger(__name__)
if sys.version_info[0] != 3:
print("This script requires Python 3")
logger.critical("This script requires Python 3")
exit(1)
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../")))
@@ -179,7 +182,7 @@ cvtest = cv_test_manager.cv_test
cv_add_base_parser = cv_test_manager.cv_add_base_parser
cv_base_adjust_parser = cv_test_manager.cv_base_adjust_parser
LFUtils = importlib.import_module("py-json.LANforge.LFUtils")
lf_logger_config = importlib.import_module("py-scripts.lf_logger_config")
class ApAutoTest(cvtest):
def __init__(self,
@@ -208,9 +211,9 @@ class ApAutoTest(cvtest):
raw_lines_file="",
sets=None,
graph_groups=None,
test_tag=""
debug=False,
):
super().__init__(lfclient_host=lf_host, lfclient_port=lf_port)
super().__init__(lfclient_host=lf_host, lfclient_port=lf_port, debug_=debug)
if radio2 is None:
radio2 = []
@@ -250,7 +253,6 @@ class ApAutoTest(cvtest):
self.graph_groups = graph_groups
self.lf_report_dir = lf_report_dir
self.local_lf_report_dir = local_lf_report_dir
self.test_tag = test_tag
def setup(self):
# Nothing to do at this time.
@@ -283,7 +285,7 @@ class ApAutoTest(cvtest):
# Command line args take precedence.
if self.upstream:
cfg_options.append("upstream-port: %s" % self.upstream)
cfg_options.append("upstream_port: %s" % self.upstream)
if self.dut5_0 != "":
cfg_options.append("dut5-0: " + self.dut5_0)
if self.dut2_0 != "":
@@ -294,8 +296,6 @@ class ApAutoTest(cvtest):
cfg_options.append("max_stations_5: " + str(self.max_stations_5))
if self.max_stations_dual != -1:
cfg_options.append("max_stations_dual: " + str(self.max_stations_dual))
if self.test_tag != "":
cfg_options.append("test_tag: " + self.test_tag)
# We deleted the scenario earlier, now re-build new one line at a time.
self.build_cfg(self.config_name, blob_test, cfg_options)
@@ -364,8 +364,22 @@ def main():
help="--lf_report_dir <where to pull reports from> default '' put where dataplane script run from",
default="")
# TODO: Use lfcli_base for common arguments.
parser.add_argument('--debug', help='Enable debugging', default=False, action="store_true")
parser.add_argument('--log_level',
default=None,
help='Set logging level: debug | info | warning | error | critical')
parser.add_argument('--lf_logger_config_json',
help="--lf_logger_config_json <json file> , json configuration of logger")
args = parser.parse_args()
logger_config = lf_logger_config.lf_logger_config()
# set the logger level to requested value
logger_config.set_level(level=args.log_level)
logger_config.set_json(json_file=args.lf_logger_config_json)
cv_base_adjust_parser(args)
CV_Test = ApAutoTest(lf_host=args.mgr,
@@ -390,13 +404,18 @@ def main():
disables=args.disable,
raw_lines=args.raw_line,
raw_lines_file=args.raw_lines_file,
sets=args.set
sets=args.set,
debug=args.debug
)
CV_Test.setup()
CV_Test.run()
CV_Test.check_influx_kpi(args)
if CV_Test.passes():
CV_Test.exit_success()
else:
CV_Test.exit_fail()
if __name__ == "__main__":
main()