mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 19:28:00 +00:00
cv-scripts: create tests with 'do not load old cfg' option.
This puts test in known state each time. Requires code I just committed to the GUI to function properly. Also, add a sleep after submitting and requesting text blobs (bad me, will have to find a better way to do this in the future so that we don't depend on sleep and races). Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
@@ -32,8 +32,8 @@ class cv_test(Realm):
|
|||||||
# time.sleep(1)
|
# time.sleep(1)
|
||||||
|
|
||||||
#create a test
|
#create a test
|
||||||
def create_test(self, test_name, instance):
|
def create_test(self, test_name, instance, load_old_cfg):
|
||||||
cmd = "cv create '{0}' '{1}'".format(test_name, instance)
|
cmd = "cv create '{0}' '{1}' '{2}'".format(test_name, instance, load_old_cfg)
|
||||||
return self.run_cv_cmd(str(cmd))
|
return self.run_cv_cmd(str(cmd))
|
||||||
|
|
||||||
|
|
||||||
@@ -104,15 +104,16 @@ class cv_test(Realm):
|
|||||||
response = self.json_get("/ports/")
|
response = self.json_get("/ports/")
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def show_text_blob(self, config_name, blob_test_name):
|
def show_text_blob(self, config_name, blob_test_name, brief):
|
||||||
req_url = "/cli-json/show_text_blob"
|
req_url = "/cli-json/show_text_blob"
|
||||||
data = {
|
data = {"type": "Plugin-Settings"}
|
||||||
"type": "Plugin-Settings",
|
if config_name and blob_test_name:
|
||||||
"name": str(blob_test_name + config_name), # config name
|
data["name"] = "%s%s"%(blob_test_name, config_name) # config name
|
||||||
"brief": "brief"
|
else:
|
||||||
}
|
data["name"] = "ALL"
|
||||||
rsp = self.json_post(req_url, data)
|
if brief:
|
||||||
|
data["brief"] = "brief"
|
||||||
|
return self.json_post(req_url, data)
|
||||||
|
|
||||||
def rm_text_blob(self, config_name, blob_test_name):
|
def rm_text_blob(self, config_name, blob_test_name):
|
||||||
req_url = "/cli-json/rm_text_blob"
|
req_url = "/cli-json/rm_text_blob"
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ def main():
|
|||||||
help="duration in ms. ex. 5000")
|
help="duration in ms. ex. 5000")
|
||||||
parser.add_argument("-r", "--pull_report", default=False, action='store_true',
|
parser.add_argument("-r", "--pull_report", default=False, action='store_true',
|
||||||
help="pull reports from lanforge (by default: False)")
|
help="pull reports from lanforge (by default: False)")
|
||||||
|
parser.add_argument("--load_old_cfg", default=False, action='store_true',
|
||||||
|
help="Should we first load defaults from previous run of the capacity test? Default is False")
|
||||||
parser.add_argument("--download_rate", type=str, default="1Gbps",
|
parser.add_argument("--download_rate", type=str, default="1Gbps",
|
||||||
help="Select requested download rate. Kbps, Mbps, Gbps units supported. Default is 1Gbps")
|
help="Select requested download rate. Kbps, Mbps, Gbps units supported. Default is 1Gbps")
|
||||||
parser.add_argument("--upload_rate", type=str, default="10Mbps",
|
parser.add_argument("--upload_rate", type=str, default="10Mbps",
|
||||||
@@ -94,10 +96,11 @@ def main():
|
|||||||
run_test = cvtest(lf_host, lf_hostport)
|
run_test = cvtest(lf_host, lf_hostport)
|
||||||
createCV = cv(lf_host, lf_hostport); # Create a object
|
createCV = cv(lf_host, lf_hostport); # Create a object
|
||||||
|
|
||||||
available_ports = []
|
createCV.sync_cv()
|
||||||
stripped_ports = []
|
time.sleep(2)
|
||||||
|
|
||||||
run_test.rm_text_blob(config_name, "Wifi-Capacity-") # To delete old config with same name
|
run_test.rm_text_blob(config_name, "Wifi-Capacity-") # To delete old config with same name
|
||||||
|
run_test.show_text_blob(None, None, False)
|
||||||
|
|
||||||
# Test related settings
|
# Test related settings
|
||||||
cfg_options = ["batch_size: " + str(args.batch_size),
|
cfg_options = ["batch_size: " + str(args.batch_size),
|
||||||
@@ -121,22 +124,32 @@ def main():
|
|||||||
idx = 0
|
idx = 0
|
||||||
for eid in port_list:
|
for eid in port_list:
|
||||||
add_port = "sel_port-" + str(idx) + ": " + eid
|
add_port = "sel_port-" + str(idx) + ": " + eid
|
||||||
run_test.create_test_config(config_name,"Wifi-Capacity-",add_port)
|
run_test.create_test_config(config_name, "Wifi-Capacity-",add_port)
|
||||||
idx += 1
|
idx += 1
|
||||||
|
|
||||||
for value in cfg_options:
|
for value in cfg_options:
|
||||||
run_test.create_test_config(config_name, "Wifi-Capacity-", value)
|
run_test.create_test_config(config_name, "Wifi-Capacity-", value)
|
||||||
|
|
||||||
|
# Request GUI update its text blob listing.
|
||||||
|
run_test.show_text_blob(config_name, "Wifi-Capacity-", False)
|
||||||
|
|
||||||
|
# Hack, not certain if the above show returns before the action has been completed
|
||||||
|
# or not, so we sleep here until we have better idea how to query if GUI knows about
|
||||||
|
# the text blob.
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
load_old = "false"
|
||||||
|
if args.load_old_cfg:
|
||||||
|
load_old = "true"
|
||||||
|
|
||||||
for i in range(60):
|
for i in range(60):
|
||||||
response = run_test.create_test(test_name, instance_name)
|
response = run_test.create_test(test_name, instance_name, load_old)
|
||||||
d1 = {k: v for e in response for (k, v) in e.items()}
|
d1 = {k: v for e in response for (k, v) in e.items()}
|
||||||
if d1["LAST"]["response"] == "OK":
|
if d1["LAST"]["response"] == "OK":
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
createCV.sync_cv()
|
|
||||||
time.sleep(2)
|
|
||||||
run_test.load_test_config(config_name, instance_name)
|
run_test.load_test_config(config_name, instance_name)
|
||||||
run_test.auto_save_report(instance_name)
|
run_test.auto_save_report(instance_name)
|
||||||
|
|
||||||
@@ -151,6 +164,8 @@ def main():
|
|||||||
response = run_test.start_test(instance_name)
|
response = run_test.start_test(instance_name)
|
||||||
d1 = {k: v for e in response for (k, v) in e.items()}
|
d1 = {k: v for e in response for (k, v) in e.items()}
|
||||||
if d1["LAST"]["response"].__contains__("Could not find instance:"):
|
if d1["LAST"]["response"].__contains__("Could not find instance:"):
|
||||||
|
print("ERROR: start_test failed: ", d1["LAST"]["response"], "\n");
|
||||||
|
#pprint(response)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
while (True):
|
while (True):
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class RunCvScenario(LFCliBase):
|
|||||||
"cv is_built",
|
"cv is_built",
|
||||||
"cv sync",
|
"cv sync",
|
||||||
"sleep 2",
|
"sleep 2",
|
||||||
"cv create '%s' test_ref" % self.cv_test,
|
"cv create '%s' 'test_ref' 'true'" % self.cv_test,
|
||||||
"sleep 2",
|
"sleep 2",
|
||||||
"cv load test_ref '%s'" % self.test_profile,
|
"cv load test_ref '%s'" % self.test_profile,
|
||||||
"sleep 1",
|
"sleep 1",
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class RunCvScenario(LFCliBase):
|
|||||||
"sleep 2",
|
"sleep 2",
|
||||||
"cv sync",
|
"cv sync",
|
||||||
"sleep 1",
|
"sleep 1",
|
||||||
"cv create '%s' test_ref" % self.cv_test,
|
"cv create '%s' test_ref 'true'" % self.cv_test,
|
||||||
"sleep 5",
|
"sleep 5",
|
||||||
"cv load test_ref '%s'" % self.test_profile,
|
"cv load test_ref '%s'" % self.test_profile,
|
||||||
"sleep 2",
|
"sleep 2",
|
||||||
|
|||||||
Reference in New Issue
Block a user