lf_autogen rm

Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
shivamcandela
2021-07-15 13:14:01 +05:30
53 changed files with 6146 additions and 1645 deletions

View File

@@ -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",
@@ -138,7 +138,9 @@ class DataplaneTest(cv_test):
raw_lines_file="",
sets=[],
graph_groups=None,
report_dir=""
report_dir="",
test_rig="",
debug=False
):
super().__init__(lfclient_host=lf_host, lfclient_port=lf_port)
@@ -165,7 +167,9 @@ 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
self.debug = debug
def setup(self):
# Nothing to do at this time.
@@ -200,6 +204,8 @@ class DataplaneTest(cv_test):
cfg_options.append("duration: " + self.duration)
if self.dut != "":
cfg_options.append("selected_dut: " + self.dut)
if self.test_rig != "":
cfg_options.append("test_rig: " + self.test_rig)
# We deleted the scenario earlier, now re-build new one line at a time.
@@ -209,8 +215,8 @@ 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,
graph_groups_file=self.graph_groups)
cv_cmds, ssh_port=self.ssh_port, local_lf_report_dir=self.local_lf_report_dir,
graph_groups_file=self.graph_groups, debug=self.debug)
self.rm_text_blob(self.config_name, blob_test) # To delete old config with same name
@@ -239,6 +245,11 @@ def main():
cv_add_base_parser(parser) # see cv_test_manager.py
<<<<<<< HEAD
=======
parser.add_argument('--json', help="--json <config.json> json input file", default="")
parser.add_argument('--influx_json', help="--influx_json <influx_config.json> influx config json input file", default="")
>>>>>>> 0ef021e1165cbaa612e5128bc48d6abfbb7b887b
parser.add_argument("-u", "--upstream", type=str, default="",
help="Upstream port for wifi capacity test ex. 1.1.eth2")
parser.add_argument("--station", type=str, default="",
@@ -254,9 +265,76 @@ 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_lf_report_dir", help="--local_lf_report_dir <where to pull reports to> default '' put where dataplane script run from",default="")
parser.add_argument("--debug", default=False)
args = parser.parse_args()
<<<<<<< HEAD
=======
# use json config file
if args.json != "":
try:
with open(args.json, 'r') as json_config:
json_data = json.load(json_config)
except:
print("Error reading {}".format(args.json))
# json configuation takes presidence to command line
if "mgr" in json_data:
args.mgr = json_data["mgr"]
if "port" in json_data:
args.port = json_data["port"]
if "lf_user" in json_data:
args.lf_user = json_data["lf_user"]
if "lf_password" in json_data:
args.lf_password = json_data["lf_password"]
if "instance_name" in json_data:
args.instance_name = json_data["instance_name"]
if "config_name" in json_data:
args.config_name = json_data["config_name"]
if "upstream" in json_data:
args.upstream = json_data["upstream"]
if "dut" in json_data:
args.dut = json_data["dut"]
if "duration" in json_data:
args.duration = json_data["duration"]
if "station" in json_data:
args.station = json_data["station"]
if "download_speed" in json_data:
args.download_speed = json_data["download_speed"]
if "upload_speed" in json_data:
args.upload_speed = json_data["upload_speed"]
if "pull_report" in json_data:
args.pull_report = json_data["pull_report"]
if "raw_line" in json_data:
# the json_data is a list , need to make into a list of lists, to match command line raw_line paramaters
# https://www.tutorialspoint.com/convert-list-into-list-of-lists-in-python
json_data_tmp = [[x] for x in json_data["raw_line"]]
args.raw_line = json_data_tmp
# use influx json config file
if args.influx_json != "":
try:
with open(args.influx_json, 'r') as influx_json_config:
influx_json_data = json.load(influx_json_config)
except:
print("Error reading {}".format(args.influx_json))
# json configuation takes presidence to command line
# influx DB configuration
if "influx_host" in influx_json_data:
args.influx_host = influx_json_data["influx_host"]
if "influx_port" in influx_json_data:
args.influx_port = influx_json_data["influx_port"]
if "influx_org" in influx_json_data:
args.influx_org = influx_json_data["influx_org"]
if "influx_token" in influx_json_data:
args.influx_token = influx_json_data["influx_token"]
if "influx_bucket" in influx_json_data:
args.influx_bucket = influx_json_data["influx_bucket"]
>>>>>>> 0ef021e1165cbaa612e5128bc48d6abfbb7b887b
cv_base_adjust_parser(args)
CV_Test = DataplaneTest(lf_host = args.mgr,
@@ -267,6 +345,7 @@ def main():
config_name = args.config_name,
upstream = args.upstream,
pull_report = args.pull_report,
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,
@@ -278,7 +357,9 @@ def main():
raw_lines = args.raw_line,
raw_lines_file = args.raw_lines_file,
sets = args.set,
graph_groups = args.graph_groups
graph_groups = args.graph_groups,
test_rig=args.test_rig,
debug=args.debug
)
CV_Test.setup()
CV_Test.run()