cv_test_manager.py generic library for chamberview tests

cvtest_reports.py generic library to pull reports folder from lanforge
run_test.py to run chamberview test test

Signed-off-by: SushantBawiskar <sushant.bawiskar@candelatech.com>
This commit is contained in:
SushantBawiskar
2021-04-08 05:33:34 +05:30
parent 4d998463f6
commit 8be2e3908f
3 changed files with 89 additions and 41 deletions

View File

@@ -3,6 +3,7 @@ import os
import argparse
import time
import json
from os import path
if sys.version_info[0] != 3:
print("This script requires Python 3")
@@ -12,44 +13,42 @@ if 'py-json' not in sys.path:
sys.path.append(os.path.join(os.path.abspath('..'), 'py-json'))
from cv_test_manager import cv_test as cvtest
from chamberview import chamberview as cv
from cvtest_reports import lanforge_reports as lf_rpt
def main():
config_name = "WFC_scenario1" # Test Config Name (new)
instance_name = "wfc_instance" # Test Instance name
test_name = "WiFi Capacity" # Test name
#Test related settings
batch_size = "3"
loop_iter = "3"
protocol = "UDP-IPv4"
duration = " 7000"
dict = {"batch_size": "batch_size:"+" "+str(batch_size),
"loop_iter": "loop_iter:"+" "+str(loop_iter),
"protocol": "protocol:"+" "+str(protocol),
"duration": "duration:"+" "+str(duration)}
# Test related settings
batch_size = "5"
loop_iter = "1"
protocol = "TCP-IPv4"
duration = " 5000"
dict = {"batch_size": "batch_size:" + " " + str(batch_size),
"loop_iter": "loop_iter:" + " " + str(loop_iter),
"protocol": "protocol:" + " " + str(protocol),
"duration": "duration:" + " " + str(duration)}
config_name = "Test_29" #Test Config Name (new)
instance_name = "wifi_capacity_instance" #Test Instance name
test_name = "WiFi Capacity" #Test name
run_test = cvtest("192.168.200.15","8080")
run_test = cvtest("192.168.200.21", "8080")
createCV = cv("192.168.200.21", "8080"); # Create a object
port_list = []
response = run_test.check_ports();
print(response)
port_size = json.dumps(len(response["interfaces"]))
print(port_size)
print(response)
print((int(port_size)))
for i in range(int(port_size)):
list_val = json.dumps(response["interfaces"][i])
list_val_ = json.loads(list_val).keys()
list_val_ = str(list_val_).replace("dict_keys(['", "")
list_val_ = str(list_val_).replace("'])", "")
if (list_val_.__contains__("sta") or list_val_.__contains__("eth1")):
print(list_val_)
port_list.append(list_val_)
print("54",port_list)
for i in range(len(port_list)):
add_port = "sel_port-" + str(i) + ":" + " " + port_list[i]
@@ -60,19 +59,35 @@ def main():
run_test.create_test_config(config_name, value)
time.sleep(0.2)
run_test.create_test(test_name,instance_name)
run_test.load_test_config("DEFAULT",instance_name)
time.sleep(1)
run_test.load_test_config(config_name, instance_name)
time.sleep(1)
run_test.load_test_config(config_name, instance_name)
time.sleep(1)
run_test.load_test_config("DEFAULT", instance_name)
run_test.create_test(test_name, instance_name)
time.sleep(5)
createCV.sync_cv()
time.sleep(2)
run_test.load_test_config(config_name, instance_name)
time.sleep(2)
run_test.auto_save_report(instance_name)
time.sleep(4)
run_test.start_test(instance_name)
while (True):
check = run_test.get_report_location(instance_name)
location = json.dumps(check[0]["LAST"]["response"])
print("WiFi Capacity Test Running...")
if location != "\"Report Location:::\"":
location = location.replace("Report Location:::","")
print(location)
time.sleep(1)
run_test.close_instance(instance_name)
time.sleep(1)
run_test.cancel_instance(instance_name)
time.sleep(4)
break
time.sleep(60)
report = lf_rpt()
report.pull_reports(hostname="192.168.200.21", username="lanforge", password="lanforge",
report_location=location)
print(port_list)
if __name__ == "__main__":
main()