From 9945e42f3c6875f52b30452cf7ad470b3645a8c2 Mon Sep 17 00:00:00 2001 From: Chuck SmileyRekiere Date: Tue, 29 Jun 2021 10:33:52 -0600 Subject: [PATCH] py-json: cv_test_manager.py , cv_test_reports.py py-scripts: lf_dataplane_test.py lf_wifi_capacity_test.py local_path updated to local_lf_report_dir Signed-off-by: Chuck SmileyRekiere --- py-json/cv_test_manager.py | 22 +++++++++++----------- py-json/cv_test_reports.py | 4 ++-- py-scripts/lf_dataplane_test.py | 10 +++++----- py-scripts/lf_wifi_capacity_test.py | 10 +++++----- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/py-json/cv_test_manager.py b/py-json/cv_test_manager.py index 679a39dd..69cdc363 100644 --- a/py-json/cv_test_manager.py +++ b/py-json/cv_test_manager.py @@ -68,11 +68,11 @@ class cv_test(Realm): def __init__(self, lfclient_host="localhost", lfclient_port=8080, - report_dir="" + lf_report_dir="" ): super().__init__(lfclient_host=lfclient_host, lfclient_port=lfclient_port) - self.report_dir = report_dir + self.lf_report_dir = lf_report_dir self.report_name = None # Add a config line to a text blob. Will create new text blob @@ -287,7 +287,7 @@ class cv_test(Realm): # cv_cmds: Array of raw chamber-view commands, such as "cv click 'button-name'" # These (and the sets) are applied after the test is created and before it is started. def create_and_run_test(self, load_old_cfg, test_name, instance_name, config_name, sets, - pull_report, lf_host, lf_user, lf_password, cv_cmds, local_path="", ssh_port=22, + pull_report, lf_host, lf_user, lf_password, cv_cmds, local_lf_report_dir="", ssh_port=22, graph_groups_file=None): load_old = "false" if load_old_cfg: @@ -350,12 +350,12 @@ class cv_test(Realm): filelocation.write(location + '/kpi.csv\n') filelocation.close() print(location) - self.report_dir = location + self.lf_report_dir = location if pull_report: try: print(lf_host) report.pull_reports(hostname=lf_host, username=lf_user, password=lf_password, - port=ssh_port, local_path=local_path, + port=ssh_port, local_lf_report_dir=local_lf_report_dir, report_location=location) except Exception as e: print("SCP failed, user %s, password %s, dest %s", (lf_user, lf_password, lf_host)) @@ -386,7 +386,7 @@ class cv_test(Realm): # Takes cmd-line args struct or something that looks like it. # See csv_to_influx.py::influx_add_parser_args for options, or --help. def check_influx_kpi(self, args): - if self.report_dir == "": + if self.lf_report_dir == "": # Nothing to report on. print("Not submitting to influx, no report-dir.\n") return @@ -409,12 +409,12 @@ class cv_test(Realm): _influx_bucket=args.influx_bucket) # lf_wifi_capacity_test.py may be run / initiated by a remote system against a lanforge - # the local_path is data is stored, if there is no local_path then the test is run directly on lanforge - if self.local_path == "": - path = "%s/kpi.csv" % (self.report_dir) + # the local_lf_report_dir is data is stored, if there is no local_lf_report_dir then the test is run directly on lanforge + if self.local_lf_report_dir == "": + path = "%s/kpi.csv" % (self.lf_report_dir) else: - kpi_location = self.local_path + "/" + os.path.basename(self.report_dir) - # the local_path is the parent directory, need to get the directory name + kpi_location = self.local_lf_report_dir + "/" + os.path.basename(self.lf_report_dir) + # the local_lf_report_dir is the parent directory, need to get the directory name path = "%s/kpi.csv" % (kpi_location) print("Attempt to submit kpi: ", path) diff --git a/py-json/cv_test_reports.py b/py-json/cv_test_reports.py index 4589b18b..2a6a8df6 100644 --- a/py-json/cv_test_reports.py +++ b/py-json/cv_test_reports.py @@ -5,13 +5,13 @@ class lanforge_reports: def pull_reports(self, hostname="localhost", port=22, username="lanforge", password="lanforge", report_location="/home/lanforge/html-reports/", - local_path="../../../reports/"): + local_lf_report_dir="../../../reports/"): ssh = paramiko.SSHClient() ssh.load_system_host_keys() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(hostname=hostname, username=username, password=password, port=port, allow_agent=False, look_for_keys=False) with SCPClient(ssh.get_transport()) as scp: - scp.get(remote_path=report_location, local_path=local_path, recursive=True) + scp.get(remote_path=report_location, local_lf_report_dir=local_lf_report_dir, recursive=True) scp.close() diff --git a/py-scripts/lf_dataplane_test.py b/py-scripts/lf_dataplane_test.py index 851467d9..e76d6bc0 100755 --- a/py-scripts/lf_dataplane_test.py +++ b/py-scripts/lf_dataplane_test.py @@ -121,7 +121,7 @@ class DataplaneTest(cv_test): lf_user="lanforge", lf_password="lanforge", ssh_port=22, - local_path="", + local_lf_report_dir="", instance_name="dpt_instance", config_name="dpt_config", upstream="1.1.eth2", @@ -166,7 +166,7 @@ class DataplaneTest(cv_test): self.graph_groups = graph_groups self.report_dir = report_dir self.ssh_port = ssh_port - self.local_path = local_path + self.local_lf_report_dir = local_lf_report_dir self.test_rig = test_rig def setup(self): @@ -213,7 +213,7 @@ class DataplaneTest(cv_test): self.create_and_run_test(self.load_old_cfg, self.test_name, self.instance_name, self.config_name, self.sets, self.pull_report, self.lf_host, self.lf_user, self.lf_password, - cv_cmds, ssh_port=self.ssh_port, local_path=self.local_path, + cv_cmds, ssh_port=self.ssh_port, local_lf_report_dir=self.local_lf_report_dir, graph_groups_file=self.graph_groups) self.rm_text_blob(self.config_name, blob_test) # To delete old config with same name @@ -305,7 +305,7 @@ def main(): help="Specify duration of each traffic run") parser.add_argument("--graph_groups", help="File to save graph_groups to", default=None) parser.add_argument("--report_dir", default="") - parser.add_argument("--local_path", help="--local_path default '' put where dataplane script run from",default="") + parser.add_argument("--local_lf_report_dir", help="--local_lf_report_dir default '' put where dataplane script run from",default="") args = parser.parse_args() @@ -381,7 +381,7 @@ def main(): config_name = args.config_name, upstream = args.upstream, pull_report = args.pull_report, - local_path = args.local_path, + local_lf_report_dir = args.local_lf_report_dir, load_old_cfg = args.load_old_cfg, download_speed = args.download_speed, upload_speed = args.upload_speed, diff --git a/py-scripts/lf_wifi_capacity_test.py b/py-scripts/lf_wifi_capacity_test.py index fa3bb9dc..2f932374 100755 --- a/py-scripts/lf_wifi_capacity_test.py +++ b/py-scripts/lf_wifi_capacity_test.py @@ -355,7 +355,7 @@ class WiFiCapacityTest(cv_test): report_dir="", graph_groups=None, test_rig="", - local_path="" + local_lf_report_dir="" ): super().__init__(lfclient_host=lfclient_host, lfclient_port=lf_port) @@ -393,7 +393,7 @@ class WiFiCapacityTest(cv_test): self.report_dir = report_dir self.graph_groups = graph_groups self.test_rig = test_rig - self.local_path = local_path + self.local_lf_report_dir = local_lf_report_dir def setup(self): if self.create_stations and self.stations != "": @@ -471,7 +471,7 @@ class WiFiCapacityTest(cv_test): self.create_and_run_test(self.load_old_cfg, self.test_name, self.instance_name, self.config_name, self.sets, self.pull_report, self.lfclient_host, self.lf_user, self.lf_password, - cv_cmds, graph_groups_file=self.graph_groups, local_path=self.local_path) + cv_cmds, graph_groups_file=self.graph_groups, local_lf_report_dir=self.local_lf_report_dir) self.rm_text_blob(self.config_name, blob_test) # To delete old config with same name @@ -525,7 +525,7 @@ def main(): parser.add_argument("--report_dir", default="") parser.add_argument("--scenario", default="") parser.add_argument("--graph_groups", help="File to save graph groups to", default=None) - parser.add_argument("--local_path", help="--local_path default '' put where dataplane script run from",default="") + parser.add_argument("--local_lf_report_dir", help="--local_lf_report_dir default '' put where dataplane script run from",default="") args = parser.parse_args() @@ -560,7 +560,7 @@ def main(): sets=args.set, graph_groups=args.graph_groups, test_rig=args.test_rig, - local_path=args.local_path + local_lf_report_dir=args.local_lf_report_dir ) WFC_Test.setup() WFC_Test.run()