mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-03 04:07:52 +00:00
generic webpage script
This commit is contained in:
@@ -3,27 +3,24 @@ This script will create 40 clients on 5Ghz , 2.4Ghz and Both and generate layer4
|
|||||||
webpage loading time meets the expectation when clients connected on single radio as well as dual radio.
|
webpage loading time meets the expectation when clients connected on single radio as well as dual radio.
|
||||||
|
|
||||||
how to run -
|
how to run -
|
||||||
sudo python3 web.py --upstream_port eth1 --num_stations 40 --security open --ssid ASUSAP --passwd [BLANK] --target_per_ten 1 --bands 5G --file_size 10Mb --fiveg_radio wiphy0 --twog_radio wiphy1 --duration 1
|
python3 lf_webpage.py --mgr 192.168.200.29 --mgr_port 8080 --upstream_port eth1 --num_stations 10 --security open --ssid testap210 --passwd [BLANK] --target_per_ten 1 --bands 5G --file_size 10MB --fiveg_radio wiphy0 --twog_radio wiphy1 --duration 1
|
||||||
Copyright 2021 Candela Technologies Inc
|
Copyright 2021 Candela Technologies Inc
|
||||||
04 - April - 2021
|
04 - April - 2021
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import paramiko
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import paramiko
|
||||||
|
|
||||||
if 'py-json' not in sys.path:
|
if 'py-json' not in sys.path:
|
||||||
sys.path.append('../py-json')
|
sys.path.append('../py-json')
|
||||||
from LANforge import LFUtils
|
from LANforge import LFUtils
|
||||||
from LANforge import lfcli_base
|
|
||||||
from LANforge.lfcli_base import LFCliBase
|
|
||||||
from LANforge.LFUtils import *
|
from LANforge.LFUtils import *
|
||||||
import realm
|
import realm
|
||||||
from realm import Realm
|
from realm import Realm
|
||||||
from realm import PortUtils
|
from realm import PortUtils
|
||||||
|
|
||||||
from webpage_report import *
|
|
||||||
from lf_report import *
|
from lf_report import *
|
||||||
from lf_graph import *
|
from lf_graph import *
|
||||||
|
|
||||||
@@ -35,12 +32,10 @@ class HttpDownload(Realm):
|
|||||||
self.port = lfclient_port
|
self.port = lfclient_port
|
||||||
self.upstream = upstream
|
self.upstream = upstream
|
||||||
self.num_sta = num_sta
|
self.num_sta = num_sta
|
||||||
#self.radio = radio
|
|
||||||
self.security = security
|
self.security = security
|
||||||
self.ssid = ssid
|
self.ssid = ssid
|
||||||
self.sta_start_id = start_id
|
self.sta_start_id = start_id
|
||||||
self.password = password
|
self.password = password
|
||||||
#self.url = url
|
|
||||||
self.twog_radio = twog_radio
|
self.twog_radio = twog_radio
|
||||||
self.fiveg_radio = fiveg_radio
|
self.fiveg_radio = fiveg_radio
|
||||||
self.target_per_ten = target_per_ten
|
self.target_per_ten = target_per_ten
|
||||||
@@ -66,18 +61,11 @@ class HttpDownload(Realm):
|
|||||||
self.radio = [self.twog_radio]
|
self.radio = [self.twog_radio]
|
||||||
elif self.bands == "Both":
|
elif self.bands == "Both":
|
||||||
self.radio = [self.fiveg_radio, self.twog_radio]
|
self.radio = [self.fiveg_radio, self.twog_radio]
|
||||||
print("hello", self.radio)
|
print( self.radio)
|
||||||
self.num_sta = self.num_sta // 2
|
self.num_sta = self.num_sta // 2
|
||||||
|
|
||||||
def precleanup(self):
|
def precleanup(self):
|
||||||
self.count = 0
|
self.count = 0
|
||||||
try:
|
|
||||||
self.local_realm.load("BLANK")
|
|
||||||
except:
|
|
||||||
print("couldn't load 'BLANK' Test Configuration")
|
|
||||||
|
|
||||||
#print("hi", self.radio)
|
|
||||||
|
|
||||||
for rad in self.radio:
|
for rad in self.radio:
|
||||||
print("radio", rad)
|
print("radio", rad)
|
||||||
if rad == self.fiveg_radio:
|
if rad == self.fiveg_radio:
|
||||||
@@ -119,23 +107,7 @@ class HttpDownload(Realm):
|
|||||||
def build(self):
|
def build(self):
|
||||||
# enable http on ethernet
|
# enable http on ethernet
|
||||||
self.port_util.set_http(port_name=self.local_realm.name_to_eid(self.upstream)[2], resource=1, on=True)
|
self.port_util.set_http(port_name=self.local_realm.name_to_eid(self.upstream)[2], resource=1, on=True)
|
||||||
|
|
||||||
# enable dhcp to ethernet
|
|
||||||
data = {
|
|
||||||
"shelf": 1,
|
|
||||||
"resource": 1,
|
|
||||||
"port": "eth1",
|
|
||||||
"current_flags": 2147483648,
|
|
||||||
"interest": 16384
|
|
||||||
|
|
||||||
}
|
|
||||||
url = "/cli-json/set_port"
|
|
||||||
self.local_realm.json_post(url, data, debug_=True)
|
|
||||||
time.sleep(10)
|
|
||||||
|
|
||||||
for rad in self.radio:
|
for rad in self.radio:
|
||||||
|
|
||||||
# station build
|
|
||||||
self.station_profile.use_security(self.security, self.ssid, self.password)
|
self.station_profile.use_security(self.security, self.ssid, self.password)
|
||||||
self.station_profile.set_command_flag("add_sta", "create_admin_down", 1)
|
self.station_profile.set_command_flag("add_sta", "create_admin_down", 1)
|
||||||
self.station_profile.set_command_param("set_port", "report_timer", 1500)
|
self.station_profile.set_command_param("set_port", "report_timer", 1500)
|
||||||
@@ -177,179 +149,86 @@ class HttpDownload(Realm):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
self.http_profile.stop_cx()
|
||||||
|
|
||||||
def my_monitor(self):
|
def my_monitor(self):
|
||||||
# data in json format
|
# data in json format
|
||||||
data = self.local_realm.json_get("layer4/list?fields=uc-avg")
|
data = self.local_realm.json_get("layer4/list?fields=uc-avg")
|
||||||
data1 = []
|
data1 = []
|
||||||
for i in range(len(data['endpoint'])):
|
for i in range(len(data['endpoint'])):
|
||||||
data1.append(str(list(data['endpoint'][i]))[2:-2])
|
data1.append(str(list(data['endpoint'][i]))[2:-2])
|
||||||
# print(data1)
|
|
||||||
data2 = []
|
data2 = []
|
||||||
for i in range(self.num_sta):
|
for i in range(self.num_sta):
|
||||||
data = self.local_realm.json_get("layer4/list?fields=uc-avg")
|
data = self.local_realm.json_get("layer4/list?fields=uc-avg")
|
||||||
# print(type(data['endpoint'][i][data1[i]]['uc-avg']))
|
# print(type(data['endpoint'][i][data1[i]]['uc-avg']))
|
||||||
data2.append((data['endpoint'][i][data1[i]]['uc-avg']))
|
data2.append((data['endpoint'][i][data1[i]]['uc-avg']))
|
||||||
|
return data2
|
||||||
|
|
||||||
# print("downloading time for all clients", data2)
|
def monitor_bytes(self):
|
||||||
|
# data in json format
|
||||||
|
data = self.local_realm.json_get("layer4/list?fields=bytes-rd")
|
||||||
|
data1 = []
|
||||||
|
for i in range(len(data['endpoint'])):
|
||||||
|
data1.append(str(list(data['endpoint'][i]))[2:-2])
|
||||||
|
data2 = []
|
||||||
|
for i in range(self.num_sta):
|
||||||
|
data = self.local_realm.json_get("layer4/list?fields=bytes-rd")
|
||||||
|
# print(type(data['endpoint'][i][data1[i]]['uc-avg']))
|
||||||
|
data2.append((data['endpoint'][i][data1[i]]['bytes-rd']))
|
||||||
|
return data2
|
||||||
|
|
||||||
|
def monitor_rx(self):
|
||||||
|
# data in json format
|
||||||
|
data = self.local_realm.json_get("layer4/list?fields=rx rate")
|
||||||
|
data1 = []
|
||||||
|
for i in range(len(data['endpoint'])):
|
||||||
|
data1.append(str(list(data['endpoint'][i]))[2:-2])
|
||||||
|
data2 = []
|
||||||
|
for i in range(self.num_sta):
|
||||||
|
data = self.local_realm.json_get("layer4/list?fields=rx rate")
|
||||||
|
# print(type(data['endpoint'][i][data1[i]]['uc-avg']))
|
||||||
|
data2.append((data['endpoint'][i][data1[i]]['rx rate']))
|
||||||
return data2
|
return data2
|
||||||
|
|
||||||
def postcleanup(self):
|
def postcleanup(self):
|
||||||
# for rad in self.radio
|
|
||||||
self.http_profile.cleanup()
|
self.http_profile.cleanup()
|
||||||
self.station_profile.cleanup()
|
self.station_profile.cleanup()
|
||||||
LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url, port_list=self.station_profile.station_names,
|
LFUtils.wait_until_ports_disappear(base_url=self.local_realm.lfclient_url, port_list=self.station_profile.station_names,
|
||||||
debug=self.debug)
|
debug=self.debug)
|
||||||
|
|
||||||
def file_create(self):
|
def file_create(self,ssh_port):
|
||||||
os.chdir('/usr/local/lanforge/nginx/html/')
|
ip = self.host
|
||||||
if os.path.isfile("/usr/local/lanforge/nginx/html/webpage.html"):
|
user = "root"
|
||||||
os.system("sudo rm /usr/local/lanforge/nginx/html/webpage.html")
|
pswd = "lanforge"
|
||||||
os.system("sudo fallocate -l " + self.file_size + " /usr/local/lanforge/nginx/html/webpage.html")
|
port = ssh_port
|
||||||
|
ssh = paramiko.SSHClient() # creating shh client object we use this object to connect to router
|
||||||
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # automatically adds the missing host key
|
||||||
|
ssh.connect(ip, port=port, username=user, password=pswd, banner_timeout=600)
|
||||||
|
cmd = '[ -f /usr/local/lanforge/nginx/html/webpage.html ] && echo "True" || echo "False"'
|
||||||
|
stdin, stdout, stderr = ssh.exec_command(str(cmd))
|
||||||
|
output = stdout.readlines()
|
||||||
|
print(output)
|
||||||
|
if output == ["True\n"]:
|
||||||
|
cmd1 = "rm /usr/local/lanforge/nginx/html/webpage.html"
|
||||||
|
stdin, stdout, stderr = ssh.exec_command(str(cmd1))
|
||||||
|
output = stdout.readlines()
|
||||||
|
time.sleep(10)
|
||||||
|
cmd2 = "sudo fallocate -l " + self.file_size + " /usr/local/lanforge/nginx/html/webpage.html"
|
||||||
|
stdin, stdout, stderr = ssh.exec_command(str(cmd2))
|
||||||
print("File creation done", self.file_size)
|
print("File creation done", self.file_size)
|
||||||
|
output = stdout.readlines()
|
||||||
|
else:
|
||||||
|
cmd2 = "sudo fallocate -l " + self.file_size + " /usr/local/lanforge/nginx/html/webpage.html"
|
||||||
|
stdin, stdout, stderr = ssh.exec_command(str(cmd2))
|
||||||
|
print("File creation done", self.file_size)
|
||||||
|
output = stdout.readlines()
|
||||||
|
ssh.close()
|
||||||
|
time.sleep(1)
|
||||||
|
return output
|
||||||
|
|
||||||
def main():
|
def download_time_in_sec(self,result_data):
|
||||||
parser = argparse.ArgumentParser(description="lanforge webpage download Test Script")
|
self.resullt_data = result_data
|
||||||
parser.add_argument('--mgr', help='hostname for where LANforge GUI is running', default='localhost')
|
|
||||||
parser.add_argument('--mgr_port', help='port LANforge GUI HTTP service is running on', default=8080)
|
|
||||||
parser.add_argument('--upstream_port', help='non-station port that generates traffic: eg: eth1', default='eth2')
|
|
||||||
parser.add_argument('--num_stations', type=int, help='number of stations to create', default=1)
|
|
||||||
parser.add_argument('--twog_radio', help='specify radio for 2.4G clients', default='wiphy3')
|
|
||||||
parser.add_argument('--fiveg_radio', help='specify radio for 5 GHz client', default='wiphy0')
|
|
||||||
parser.add_argument('--security', help='WiFi Security protocol: {open|wep|wpa2|wpa3')
|
|
||||||
parser.add_argument('--ssid', help='WiFi SSID for script object to associate to')
|
|
||||||
parser.add_argument('--passwd', help='WiFi passphrase/password/key')
|
|
||||||
parser.add_argument('--target_per_ten', help='number of request per 10 minutes', default=100)
|
|
||||||
parser.add_argument('--file_size', type=str, help='specify the size of file you want to download', default='5Mb')
|
|
||||||
parser.add_argument('--bands', nargs="+", help='--bands', default=["5G", "2.4G", "Both"])
|
|
||||||
parser.add_argument('--duration', type=int, help='time to run traffic')
|
|
||||||
parser.add_argument('--threshold_5g',help="Enter the threshold value for 5G Pass/Fail criteria", default="60")
|
|
||||||
parser.add_argument('--threshold_2g',help="Enter the threshold value for 2.4G Pass/Fail criteria",default="90")
|
|
||||||
parser.add_argument('--threshold_both',help="Enter the threshold value for Both Pass/Fail criteria" , default="50")
|
|
||||||
parser.add_argument('--ap_name', help="specify the ap model ", default="TestAP")
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
test_time = datetime.datetime.now()
|
|
||||||
test_time = test_time.strftime("%b %d %H:%M:%S")
|
|
||||||
print("Test started at ", test_time)
|
|
||||||
list5G = []
|
|
||||||
list2G = []
|
|
||||||
Both = []
|
|
||||||
dict_keys = []
|
|
||||||
dict_keys.extend(args.bands)
|
|
||||||
# print(dict_keys)
|
|
||||||
final_dict = dict.fromkeys(dict_keys)
|
|
||||||
# print(final_dict)
|
|
||||||
dict1_keys = ['dl_time', 'min', 'max', 'avg']
|
|
||||||
for i in final_dict:
|
|
||||||
final_dict[i] = dict.fromkeys(dict1_keys)
|
|
||||||
print(final_dict)
|
|
||||||
min5 = []
|
|
||||||
min2 = []
|
|
||||||
min_both = []
|
|
||||||
max5 = []
|
|
||||||
max2 = []
|
|
||||||
max_both = []
|
|
||||||
avg2 = []
|
|
||||||
avg5 = []
|
|
||||||
avg_both = []
|
|
||||||
|
|
||||||
#ap = AP_automate(args.ap_ip, args.user, args.pswd)
|
|
||||||
for bands in args.bands:
|
|
||||||
http = HttpDownload(lfclient_host=args.mgr, lfclient_port=args.mgr_port,
|
|
||||||
upstream=args.upstream_port, num_sta=args.num_stations,
|
|
||||||
security=args.security,
|
|
||||||
ssid=args.ssid, password=args.passwd,
|
|
||||||
target_per_ten=args.target_per_ten,
|
|
||||||
file_size=args.file_size, bands=bands,
|
|
||||||
twog_radio=args.twog_radio,
|
|
||||||
fiveg_radio=args.fiveg_radio
|
|
||||||
)
|
|
||||||
#chttp.file_create()
|
|
||||||
http.set_values()
|
|
||||||
http.precleanup()
|
|
||||||
http.build()
|
|
||||||
http.start()
|
|
||||||
duration = args.duration
|
|
||||||
duration = 60 * duration
|
|
||||||
print("time in seconds ", duration)
|
|
||||||
time.sleep(duration)
|
|
||||||
value = http.my_monitor()
|
|
||||||
|
|
||||||
if bands == "5G":
|
|
||||||
list5G.extend(value)
|
|
||||||
# print("5G", list5G)
|
|
||||||
final_dict['5G']['dl_time'] = list5G
|
|
||||||
min5.append(min(list5G))
|
|
||||||
final_dict['5G']['min'] = min5
|
|
||||||
max5.append(max(list5G))
|
|
||||||
final_dict['5G']['max'] = max5
|
|
||||||
avg5.append((sum(list5G) / args.num_stations))
|
|
||||||
final_dict['5G']['avg'] = avg5
|
|
||||||
elif bands == "2.4G":
|
|
||||||
list2G.extend(value)
|
|
||||||
print("2.4G", list2G)
|
|
||||||
final_dict['2.4G']['dl_time'] = list2G
|
|
||||||
min2.append(min(list2G))
|
|
||||||
final_dict['2.4G']['min'] = min2
|
|
||||||
max2.append(max(list2G))
|
|
||||||
final_dict['2.4G']['max'] = max2
|
|
||||||
avg2.append((sum(list2G) / args.num_stations))
|
|
||||||
final_dict['2.4G']['avg'] = avg2
|
|
||||||
elif bands == "Both":
|
|
||||||
Both.extend(value)
|
|
||||||
print("both", Both)
|
|
||||||
final_dict['Both']['dl_time'] = Both
|
|
||||||
min_both.append(min(Both))
|
|
||||||
final_dict['Both']['min'] = min_both
|
|
||||||
max_both.append(max(Both))
|
|
||||||
final_dict['Both']['max'] = max_both
|
|
||||||
avg_both.append((sum(Both) /args.num_stations))
|
|
||||||
final_dict['Both']['avg'] = avg_both
|
|
||||||
print("final list", final_dict)
|
|
||||||
result_data = final_dict
|
|
||||||
print("result", result_data)
|
|
||||||
print("Test Finished")
|
|
||||||
test_end = datetime.datetime.now()
|
|
||||||
test_end = test_end.strftime("%b %d %H:%M:%S")
|
|
||||||
print("Test ended at ", test_end)
|
|
||||||
s1 = test_time
|
|
||||||
s2 = test_end # for example
|
|
||||||
FMT = '%b %d %H:%M:%S'
|
|
||||||
test_duration = datetime.datetime.strptime(s2, FMT) - datetime.datetime.strptime(s1, FMT)
|
|
||||||
#test_duration = "2:04:34"
|
|
||||||
print("total test duration ", test_duration)
|
|
||||||
date = str(datetime.datetime.now()).split(",")[0].replace(" ", "-").split(".")[0]
|
|
||||||
test_setup_info = {
|
|
||||||
"DUT Name": args.ap_name,
|
|
||||||
"SSID": args.ssid,
|
|
||||||
"Test Duration": test_duration,
|
|
||||||
|
|
||||||
}
|
|
||||||
test_input_infor={
|
|
||||||
"File Size" : args.file_size,
|
|
||||||
"Bands" : args.bands,
|
|
||||||
"Upstream": args.upstream_port,
|
|
||||||
"Stations": args.num_stations,
|
|
||||||
"SSID" :args.ssid,
|
|
||||||
"Security": args.security,
|
|
||||||
"Duration" : args.duration,
|
|
||||||
"Contact": "support@candelatech.com"
|
|
||||||
}
|
|
||||||
|
|
||||||
report = lf_report(_results_dir_name="webpage_test")
|
|
||||||
report.set_title("WEBPAGE DOWNLOAD TEST")
|
|
||||||
report.set_date(date)
|
|
||||||
report.build_banner()
|
|
||||||
report.set_table_title("Test Setup Information")
|
|
||||||
report.build_table_title()
|
|
||||||
report.test_setup_table(value="Device under test",test_setup_data= test_setup_info)
|
|
||||||
|
|
||||||
report.set_obj_html("Objective",
|
|
||||||
"The Webpage Download Test is designed to test the performance of the Access Point.The goal is to check whether the webpage loading time meets the expectation when clients connected on single radio as well as dual radio")
|
|
||||||
report.build_objective()
|
|
||||||
report.set_obj_html("Download Time Graph","The below graph provides information about the average download time taken by each client for duration of "+ str(args.duration) + " min")
|
|
||||||
report.build_objective()
|
|
||||||
|
|
||||||
download_time = dict.fromkeys(result_data.keys())
|
download_time = dict.fromkeys(result_data.keys())
|
||||||
for i in download_time:
|
for i in download_time:
|
||||||
try:
|
try:
|
||||||
@@ -366,7 +245,7 @@ def main():
|
|||||||
if i == "5G":
|
if i == "5G":
|
||||||
for j in download_time[i]:
|
for j in download_time[i]:
|
||||||
x = (j / 1000)
|
x = (j / 1000)
|
||||||
y = round(x, 2)
|
y = round(x, 1)
|
||||||
lst.append(y)
|
lst.append(y)
|
||||||
print(lst)
|
print(lst)
|
||||||
dwnld_time["5G"] = lst
|
dwnld_time["5G"] = lst
|
||||||
@@ -374,7 +253,7 @@ def main():
|
|||||||
if i == "2.4G":
|
if i == "2.4G":
|
||||||
for j in download_time[i]:
|
for j in download_time[i]:
|
||||||
x = (j / 1000)
|
x = (j / 1000)
|
||||||
y = round(x, 2)
|
y = round(x, 1)
|
||||||
lst1.append(y)
|
lst1.append(y)
|
||||||
print(lst)
|
print(lst)
|
||||||
dwnld_time["2.4G"] = lst1
|
dwnld_time["2.4G"] = lst1
|
||||||
@@ -383,34 +262,57 @@ def main():
|
|||||||
# print("yes", download_time[i])
|
# print("yes", download_time[i])
|
||||||
for j in download_time[i]:
|
for j in download_time[i]:
|
||||||
x = (j / 1000)
|
x = (j / 1000)
|
||||||
y = round(x, 2)
|
y = round(x, 1)
|
||||||
lst2.append(y)
|
lst2.append(y)
|
||||||
# print(lst2)
|
# print(lst2)
|
||||||
dwnld_time["Both"] = lst2
|
dwnld_time["Both"] = lst2
|
||||||
dataset.append(dwnld_time["Both"])
|
dataset.append(dwnld_time["Both"])
|
||||||
|
return dataset
|
||||||
|
|
||||||
print("download time",dwnld_time)
|
def speed_in_Mbps(self,result_data):
|
||||||
#dataset = [dwnld_time['5G'], dwnld_time['2.4G'], dwnld_time['Both']]
|
self.resullt_data = result_data
|
||||||
lis = []
|
speed = dict.fromkeys(result_data.keys())
|
||||||
for i in range(1, args.num_stations + 1):
|
for i in speed:
|
||||||
print(i)
|
try:
|
||||||
lis.append(i)
|
speed[i] = result_data[i]['speed']
|
||||||
|
except:
|
||||||
|
speed[i] = []
|
||||||
|
print(speed)
|
||||||
|
lst = []
|
||||||
|
lst1 = []
|
||||||
|
lst2 = []
|
||||||
|
speed_ = dict.fromkeys(result_data.keys())
|
||||||
|
dataset = []
|
||||||
|
for i in speed:
|
||||||
|
if i == "5G":
|
||||||
|
for j in speed[i]:
|
||||||
|
x = (j / 1000000)
|
||||||
|
y = round(x, 1)
|
||||||
|
lst.append(y)
|
||||||
|
print("hi", lst)
|
||||||
|
speed_["5G"] = lst
|
||||||
|
dataset.append(speed_["5G"])
|
||||||
|
if i == "2.4G":
|
||||||
|
for j in speed[i]:
|
||||||
|
x = (j / 1000000)
|
||||||
|
y = round(x, 1)
|
||||||
|
lst1.append(y)
|
||||||
|
print("yes", lst1)
|
||||||
|
speed_["2.4G"] = lst1
|
||||||
|
dataset.append(speed_["2.4G"])
|
||||||
|
if i == "Both":
|
||||||
|
# print("yes", speed[i])
|
||||||
|
for j in speed[i]:
|
||||||
|
x = (j / 1000000)
|
||||||
|
y = round(x, 1)
|
||||||
|
lst2.append(y)
|
||||||
|
print(lst2)
|
||||||
|
speed_["Both"] = lst2
|
||||||
|
dataset.append(speed_["Both"])
|
||||||
|
return dataset
|
||||||
|
|
||||||
graph = lf_bar_graph(_data_set=dataset, _xaxis_name="Stations", _yaxis_name="Time in Seconds",
|
def summary_calculation(self, result_data, bands, threshold_5g, threshold_2g, threshold_both):
|
||||||
_xaxis_categories=lis, _label=args.bands, _xticks_font=7,
|
self.resullt_data = result_data
|
||||||
_graph_image_name="webpage",
|
|
||||||
_color=['forestgreen', 'darkorange', 'blueviolet'], _color_edge='black', _figsize=(10, 5),
|
|
||||||
_grp_title="Download time taken by each client", _xaxis_step=1, )
|
|
||||||
graph_png = graph.build_bar_graph()
|
|
||||||
print("graph name {}".format(graph_png))
|
|
||||||
report.set_graph_image(graph_png)
|
|
||||||
report.move_graph_image()
|
|
||||||
report.build_graph()
|
|
||||||
|
|
||||||
report.set_obj_html("Summary Table Description",
|
|
||||||
"This Table shows you the summary result of Webpage Download Test as PASS or FAIL criteria. If the average time taken by " + str(args.num_stations) + " clients to access the webpage is less than " + str(args.threshold_2g) + "s it's a PASS criteria for 2.4 ghz clients, If the average time taken by " + "" + str(args.num_stations) + " clients to access the webpage is less than " + str(args.threshold_5g) + "s it's a PASS criteria for 5 ghz clients and If the average time taken by " + str(args.num_stations) + " clients to access the webpage is less than " + str(args.threshold_both) + "s it's a PASS criteria for 2.4 ghz and 5ghz clients")
|
|
||||||
|
|
||||||
report.build_objective()
|
|
||||||
x1 = []
|
x1 = []
|
||||||
html_struct = dict.fromkeys(list(result_data.keys()))
|
html_struct = dict.fromkeys(list(result_data.keys()))
|
||||||
for fcc in list(result_data.keys()):
|
for fcc in list(result_data.keys()):
|
||||||
@@ -426,7 +328,7 @@ def main():
|
|||||||
# print(y)
|
# print(y)
|
||||||
z11 = []
|
z11 = []
|
||||||
for i in y11:
|
for i in y11:
|
||||||
i = str(round(i, 2))
|
i = str(round(i, 1))
|
||||||
z11.append(i)
|
z11.append(i)
|
||||||
print(z11)
|
print(z11)
|
||||||
pass_fail_list = []
|
pass_fail_list = []
|
||||||
@@ -435,132 +337,204 @@ def main():
|
|||||||
sumry5 = []
|
sumry5 = []
|
||||||
sumryB = []
|
sumryB = []
|
||||||
data = []
|
data = []
|
||||||
if args.bands == ["5G", "2.4G", "Both"]:
|
if bands == ["5G", "2.4G", "Both"]:
|
||||||
print("yes")
|
print("yes")
|
||||||
# 5G
|
# 5G
|
||||||
if float(z11[0]) < float(args.threshold_5g):
|
if float(z11[0]) == 0.0 or float(z11[0]) > float(threshold_5g):
|
||||||
print("PASS")
|
|
||||||
pass_fail_list.append("PASS")
|
|
||||||
sumry5.append("PASS")
|
|
||||||
elif float(z11[0]) == 0.0 or float(z11[0]) > float(args.threshold_5g):
|
|
||||||
print("FAIL")
|
print("FAIL")
|
||||||
pass_fail_list.append("FAIL")
|
pass_fail_list.append("FAIL")
|
||||||
sumry5.append("FAIL")
|
sumry5.append("FAIL")
|
||||||
|
elif float(z11[0]) < float(threshold_5g):
|
||||||
|
print("PASS")
|
||||||
|
pass_fail_list.append("PASS")
|
||||||
|
sumry5.append("PASS")
|
||||||
# 2.4g
|
# 2.4g
|
||||||
if float(z11[1]) < float(args.threshold_2g):
|
if float(z11[1]) == 0.0 or float(z11[1]) > float(threshold_2g):
|
||||||
var = "PASS"
|
var = "FAIL"
|
||||||
pass_fail_list.append(var)
|
pass_fail_list.append(var)
|
||||||
sumry2.append("PASS")
|
|
||||||
elif float(z11[1]) == 0.0 or float(z11[1]) > float(args.threshold_2g):
|
|
||||||
pass_fail_list.append("FAIL")
|
|
||||||
sumry2.append("FAIL")
|
sumry2.append("FAIL")
|
||||||
|
elif float(z11[1]) < float(threshold_2g):
|
||||||
|
pass_fail_list.append("PASS")
|
||||||
|
sumry2.append("PASS")
|
||||||
# BOTH
|
# BOTH
|
||||||
if float(z11[2]) < float(args.threshold_both):
|
if float(z11[2]) == 0.0 or float(z11[2]) > float(threshold_both) :
|
||||||
var = "PASS"
|
var = "FAIL"
|
||||||
pass_fail_list.append(var)
|
pass_fail_list.append(var)
|
||||||
sumryB.append("PASS")
|
|
||||||
elif float(z11[2]) == 0.0 or float(z11[2]) > float(args.threshold_both):
|
|
||||||
pass_fail_list.append("FAIL")
|
|
||||||
sumryB.append("FAIL")
|
sumryB.append("FAIL")
|
||||||
|
elif float(z11[2]) < float(threshold_both):
|
||||||
|
pass_fail_list.append("PASS")
|
||||||
|
sumryB.append("PASS")
|
||||||
|
|
||||||
data.append(','.join(sumry5))
|
data.append(','.join(sumry5))
|
||||||
data.append(','.join(sumry2))
|
data.append(','.join(sumry2))
|
||||||
data.append(','.join(sumryB))
|
data.append(','.join(sumryB))
|
||||||
|
|
||||||
elif args.bands == ['5G']:
|
elif bands == ['5G']:
|
||||||
if float(z11[0]) < float(args.threshold_5g):
|
if float(z11[0]) == 0.0 or float(z11[0]) > float(threshold_5g):
|
||||||
print("PASS")
|
|
||||||
pass_fail_list.append("PASS")
|
|
||||||
sumry5.append("PASS")
|
|
||||||
elif float(z11[0]) == 0.0 or float(z11[0]) > float(args.threshold_5g):
|
|
||||||
print("FAIL")
|
print("FAIL")
|
||||||
pass_fail_list.append("FAIL")
|
pass_fail_list.append("FAIL")
|
||||||
sumry5.append("FAIL")
|
sumry5.append("FAIL")
|
||||||
|
elif float(z11[0]) < float(threshold_5g):
|
||||||
|
print("PASS")
|
||||||
|
pass_fail_list.append("PASS")
|
||||||
|
sumry5.append("PASS")
|
||||||
data.append(','.join(sumry5))
|
data.append(','.join(sumry5))
|
||||||
|
|
||||||
elif args.bands == ['2.4G']:
|
elif bands == ['2.4G']:
|
||||||
if float(z11[0]) < float(args.threshold_2g):
|
if float(z11[0]) == 0.0 or float(z11[0]) > float(threshold_2g):
|
||||||
var = "PASS"
|
var = "FAIL"
|
||||||
pass_fail_list.append(var)
|
pass_fail_list.append(var)
|
||||||
sumry2.append("PASS")
|
|
||||||
elif float(z11[0]) == 0.0 or float(z11[0]) > float(args.threshold_2g):
|
|
||||||
pass_fail_list.append("FAIL")
|
|
||||||
sumry2.append("FAIL")
|
sumry2.append("FAIL")
|
||||||
data.append(','.join(sumry2))
|
elif float(z11[0]) < float(threshold_2g):
|
||||||
elif args.bands == ["Both"]:
|
|
||||||
if float(z11[0]) < float(args.threshold_both):
|
|
||||||
var = "PASS"
|
|
||||||
pass_fail_list.append(var)
|
|
||||||
sumryB.append("PASS")
|
|
||||||
elif float(z11[0]) == 0.0 or float(z11[0]) > float(args.threshold_both):
|
|
||||||
pass_fail_list.append("FAIL")
|
|
||||||
sumryB.append("FAIL")
|
|
||||||
data.append(','.join(sumryB))
|
|
||||||
elif args.bands == ['5G', '2.4G']:
|
|
||||||
if float(z11[0]) < float(args.threshold_5g):
|
|
||||||
print("PASS")
|
|
||||||
pass_fail_list.append("PASS")
|
pass_fail_list.append("PASS")
|
||||||
sumry5.append("PASS")
|
sumry2.append("PASS")
|
||||||
elif float(z11[0]) == 0.0 or float(z11[0]) > float(args.threshold_5g):
|
data.append(','.join(sumry2))
|
||||||
|
elif bands == ["Both"]:
|
||||||
|
if float(z11[0]) == 0.0 or float(z11[0]) > float(threshold_both):
|
||||||
|
var = "FAIL"
|
||||||
|
pass_fail_list.append(var)
|
||||||
|
sumryB.append("FAIL")
|
||||||
|
elif float(z11[0]) < float(threshold_both):
|
||||||
|
pass_fail_list.append("PASS")
|
||||||
|
sumryB.append("PASS")
|
||||||
|
data.append(','.join(sumryB))
|
||||||
|
elif bands == ['5G', '2.4G']:
|
||||||
|
if float(z11[0]) == 0.0 or float(z11[0]) > float(threshold_5g):
|
||||||
print("FAIL")
|
print("FAIL")
|
||||||
pass_fail_list.append("FAIL")
|
pass_fail_list.append("FAIL")
|
||||||
sumry5.append("FAIL")
|
sumry5.append("FAIL")
|
||||||
|
elif float(z11[0]) < float(threshold_5g):
|
||||||
|
print("PASS")
|
||||||
|
pass_fail_list.append("PASS")
|
||||||
|
sumry5.append("PASS")
|
||||||
# 2.4g
|
# 2.4g
|
||||||
if float(z11[1]) < float(args.threshold_2g):
|
if float(z11[1]) == 0.0 or float(z11[1]) > float(threshold_2g):
|
||||||
var = "PASS"
|
var = "FAIL"
|
||||||
pass_fail_list.append(var)
|
pass_fail_list.append(var)
|
||||||
sumry2.append("PASS")
|
|
||||||
elif float(z11[1]) == 0.0 or float(z11[1]) > float(args.threshold_2g):
|
|
||||||
pass_fail_list.append("FAIL")
|
|
||||||
sumry2.append("FAIL")
|
sumry2.append("FAIL")
|
||||||
|
elif float(z11[1]) < float(threshold_2g):
|
||||||
|
pass_fail_list.append("PASS")
|
||||||
|
sumry2.append("PASS")
|
||||||
data.append(','.join(sumry5))
|
data.append(','.join(sumry5))
|
||||||
data.append(','.join(sumry2))
|
data.append(','.join(sumry2))
|
||||||
|
|
||||||
elif args.bands == ['5G', 'Both']:
|
elif bands == ['5G', 'Both']:
|
||||||
if float(z11[0]) < float(args.threshold_5g):
|
if float(z11[0]) == 0.0 or float(z11[0]) > float(threshold_5g):
|
||||||
print("PASS")
|
|
||||||
pass_fail_list.append("PASS")
|
|
||||||
sumry5.append("PASS")
|
|
||||||
elif float(z11[0]) == 0.0 or float(z11[0]) > float(args.threshold_5g):
|
|
||||||
print("FAIL")
|
print("FAIL")
|
||||||
pass_fail_list.append("FAIL")
|
pass_fail_list.append("FAIL")
|
||||||
sumry5.append("FAIL")
|
sumry5.append("FAIL")
|
||||||
if float(z11[1]) < float(args.threshold_both):
|
elif float(z11[0]) < float(threshold_5g):
|
||||||
var = "PASS"
|
print("PASS")
|
||||||
|
pass_fail_list.append("PASS")
|
||||||
|
sumry5.append("PASS")
|
||||||
|
if float(z11[1]) == 0.0 or float(z11[1]) > float(threshold_both):
|
||||||
|
var = "FAIL"
|
||||||
pass_fail_list.append(var)
|
pass_fail_list.append(var)
|
||||||
sumryB.append("PASS")
|
|
||||||
elif float(z11[1]) == 0.0 or float(z11[1]) > float(args.threshold_both):
|
|
||||||
pass_fail_list.append("FAIL")
|
|
||||||
sumryB.append("FAIL")
|
sumryB.append("FAIL")
|
||||||
|
elif float(z11[1]) < float(threshold_both):
|
||||||
|
pass_fail_list.append("PASS")
|
||||||
|
sumryB.append("PASS")
|
||||||
|
|
||||||
data.append(','.join(sumry5))
|
data.append(','.join(sumry5))
|
||||||
data.append(','.join(sumryB))
|
data.append(','.join(sumryB))
|
||||||
|
|
||||||
elif args.bands == ['2.4G', 'Both']:
|
elif bands == ['2.4G', 'Both']:
|
||||||
if float(z11[0]) < float(args.threshold_2g):
|
if float(z11[0]) == 0.0 or float(z11[0]) > float(threshold_2g):
|
||||||
var = "PASS"
|
var = "FAIL"
|
||||||
pass_fail_list.append(var)
|
pass_fail_list.append(var)
|
||||||
sumry2.append("PASS")
|
|
||||||
elif float(z11[0]) == 0.0 or float(z11[0]) > float(args.threshold_2g):
|
|
||||||
pass_fail_list.append("FAIL")
|
|
||||||
sumry2.append("FAIL")
|
sumry2.append("FAIL")
|
||||||
if float(z11[1]) < float(args.threshold_both):
|
elif float(z11[0]) < float(threshold_2g):
|
||||||
var = "PASS"
|
pass_fail_list.append("PASS")
|
||||||
|
sumry2.append("PASS")
|
||||||
|
if float(z11[1]) == 0.0 or float(z11[1]) > float(threshold_both):
|
||||||
|
var = "FAIL"
|
||||||
pass_fail_list.append(var)
|
pass_fail_list.append(var)
|
||||||
sumryB.append("PASS")
|
|
||||||
elif float(z11[1]) == 0.0 or float(z11[1]) > float(args.threshold_both):
|
|
||||||
pass_fail_list.append("FAIL")
|
|
||||||
sumryB.append("FAIL")
|
sumryB.append("FAIL")
|
||||||
|
elif float(z11[1]) < float(threshold_both):
|
||||||
|
pass_fail_list.append("PASS")
|
||||||
|
sumryB.append("PASS")
|
||||||
data.append(','.join(sumry2))
|
data.append(','.join(sumry2))
|
||||||
data.append(','.join(sumryB))
|
data.append(','.join(sumryB))
|
||||||
|
return data
|
||||||
|
|
||||||
#print("SUMMARRY",sumry2, sumry5, sumryB)
|
def check_station_ip(self):
|
||||||
#print(data)
|
pass
|
||||||
#[result_data.keys()]
|
|
||||||
summary_table_value = {
|
def generate_graph(self, dataset, lis, bands):
|
||||||
"": args.bands,
|
graph = lf_bar_graph(_data_set=dataset, _xaxis_name="Stations", _yaxis_name="Time in Seconds",
|
||||||
"PASS/FAIL": data
|
_xaxis_categories=lis, _label=bands, _xticks_font=8,
|
||||||
}
|
_graph_image_name="webpage download time graph",
|
||||||
|
_color=['forestgreen', 'darkorange', 'blueviolet'], _color_edge='black', _figsize=(14, 5),
|
||||||
|
_grp_title="Download time taken by each client", _xaxis_step=1, _show_bar_value=True,
|
||||||
|
_text_font=6, _text_rotation=60,
|
||||||
|
_legend_loc="upper right",
|
||||||
|
_legend_box=(1, 1.15),
|
||||||
|
_enable_csv=True
|
||||||
|
)
|
||||||
|
graph_png = graph.build_bar_graph()
|
||||||
|
print("graph name {}".format(graph_png))
|
||||||
|
return graph_png
|
||||||
|
|
||||||
|
def graph_2(self,dataset2, lis, bands):
|
||||||
|
graph_2 = lf_bar_graph(_data_set=dataset2, _xaxis_name="Stations", _yaxis_name="Download Rate in Mbps",
|
||||||
|
_xaxis_categories=lis, _label=bands, _xticks_font=8,
|
||||||
|
_graph_image_name="webpage_speed_graph",
|
||||||
|
_color=['forestgreen', 'darkorange', 'blueviolet'], _color_edge='black',
|
||||||
|
_figsize=(14, 5),
|
||||||
|
_grp_title="Download rate for each client (Mbps)", _xaxis_step=1, _show_bar_value=True,
|
||||||
|
_text_font=6, _text_rotation=60,
|
||||||
|
_legend_loc="upper right",
|
||||||
|
_legend_box=(1, 1.15),
|
||||||
|
_enable_csv=True
|
||||||
|
)
|
||||||
|
graph_png = graph_2.build_bar_graph()
|
||||||
|
return graph_png
|
||||||
|
|
||||||
|
def generate_report(self,date, num_stations,duration, test_setup_info,dataset,lis,bands,threshold_2g,threshold_5g,threshold_both,dataset2,summary_table_value,result_data,test_input_infor):
|
||||||
|
report = lf_report(_results_dir_name="webpage_test", _output_html="Webpage.html", _output_pdf="Webpage.pdf")
|
||||||
|
report.set_title("WEBPAGE DOWNLOAD TEST")
|
||||||
|
report.set_date(date)
|
||||||
|
report.build_banner()
|
||||||
|
report.set_table_title("Test Setup Information")
|
||||||
|
report.build_table_title()
|
||||||
|
|
||||||
|
report.test_setup_table(value="Device under test", test_setup_data=test_setup_info)
|
||||||
|
|
||||||
|
report.set_obj_html("Objective",
|
||||||
|
"The Webpage Download Test is designed to test the performance of the Access Point.The goal is to check whether the webpage loading time of all the " + str(
|
||||||
|
num_stations) + " clients which are downloading at the same time meets the expectation when clients connected on single radio as well as dual radio")
|
||||||
|
report.build_objective()
|
||||||
|
report.set_obj_html("Download Time Graph",
|
||||||
|
"The below graph provides information about the download time taken by each client to download webpage for test duration of " + str(
|
||||||
|
duration) + " min")
|
||||||
|
report.build_objective()
|
||||||
|
graph = self.generate_graph(dataset=dataset, lis=lis, bands=bands)
|
||||||
|
report.set_graph_image(graph)
|
||||||
|
report.set_csv_filename(graph)
|
||||||
|
report.move_csv_file()
|
||||||
|
report.move_graph_image()
|
||||||
|
report.build_graph()
|
||||||
|
report.set_obj_html("Download Rate Graph",
|
||||||
|
"The below graph provides information about the download rate in Mbps of each client to download the webpage for test duration of " + str(
|
||||||
|
duration) + " min")
|
||||||
|
report.build_objective()
|
||||||
|
graph2 = self.graph_2(dataset2, lis=lis, bands=bands)
|
||||||
|
print("graph name {}".format(graph2))
|
||||||
|
report.set_graph_image(graph2)
|
||||||
|
report.set_csv_filename(graph2)
|
||||||
|
report.move_csv_file()
|
||||||
|
report.move_graph_image()
|
||||||
|
report.build_graph()
|
||||||
|
report.set_obj_html("Summary Table Description",
|
||||||
|
"This Table shows you the summary result of Webpage Download Test as PASS or FAIL criteria. If the average time taken by " + str(
|
||||||
|
num_stations) + " clients to access the webpage is less than " + str(
|
||||||
|
threshold_2g) + "s it's a PASS criteria for 2.4 ghz clients, If the average time taken by " + "" + str(
|
||||||
|
num_stations) + " clients to access the webpage is less than " + str(
|
||||||
|
threshold_5g) + "s it's a PASS criteria for 5 ghz clients and If the average time taken by " + str(
|
||||||
|
num_stations) + " clients to access the webpage is less than " + str(
|
||||||
|
threshold_both) + "s it's a PASS criteria for 2.4 ghz and 5ghz clients")
|
||||||
|
|
||||||
|
report.build_objective()
|
||||||
test_setup1 = pd.DataFrame(summary_table_value)
|
test_setup1 = pd.DataFrame(summary_table_value)
|
||||||
report.set_table_dataframe(test_setup1)
|
report.set_table_dataframe(test_setup1)
|
||||||
report.build_table()
|
report.build_table()
|
||||||
@@ -582,7 +556,7 @@ def main():
|
|||||||
y.append(i)
|
y.append(i)
|
||||||
z = []
|
z = []
|
||||||
for i in y:
|
for i in y:
|
||||||
i = str(round(i, 2))
|
i = str(round(i, 1))
|
||||||
z.append(i)
|
z.append(i)
|
||||||
# rint(z)
|
# rint(z)
|
||||||
x1 = []
|
x1 = []
|
||||||
@@ -599,7 +573,7 @@ def main():
|
|||||||
y1.append(i)
|
y1.append(i)
|
||||||
z1 = []
|
z1 = []
|
||||||
for i in y1:
|
for i in y1:
|
||||||
i = str(round(i, 2))
|
i = str(round(i, 1))
|
||||||
z1.append(i)
|
z1.append(i)
|
||||||
# print(z1)
|
# print(z1)
|
||||||
x2 = []
|
x2 = []
|
||||||
@@ -616,12 +590,11 @@ def main():
|
|||||||
y2.append(i)
|
y2.append(i)
|
||||||
z2 = []
|
z2 = []
|
||||||
for i in y2:
|
for i in y2:
|
||||||
i = str(round(i, 2))
|
i = str(round(i, 1))
|
||||||
z2.append(i)
|
z2.append(i)
|
||||||
#print(z2)
|
|
||||||
#[result_data.keys()]
|
|
||||||
download_table_value = {
|
download_table_value = {
|
||||||
"" : args.bands,
|
"": bands,
|
||||||
"Minimum": z,
|
"Minimum": z,
|
||||||
"Maximum": z1,
|
"Maximum": z1,
|
||||||
"Average": z2
|
"Average": z2
|
||||||
@@ -639,5 +612,187 @@ def main():
|
|||||||
print(html_file)
|
print(html_file)
|
||||||
report.write_pdf()
|
report.write_pdf()
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description="lanforge webpage download Test Script")
|
||||||
|
parser.add_argument('--mgr', help='hostname for where LANforge GUI is running', default='localhost')
|
||||||
|
parser.add_argument('--mgr_port', help='port LANforge GUI HTTP service is running on', default=8080)
|
||||||
|
parser.add_argument('--upstream_port', help='non-station port that generates traffic: eg: eth1', default='eth2')
|
||||||
|
parser.add_argument('--num_stations', type=int, help='number of stations to create', default=1)
|
||||||
|
parser.add_argument('--twog_radio', help='specify radio for 2.4G clients', default='wiphy3')
|
||||||
|
parser.add_argument('--fiveg_radio', help='specify radio for 5 GHz client', default='wiphy0')
|
||||||
|
parser.add_argument('--security', help='WiFi Security protocol: {open|wep|wpa2|wpa3')
|
||||||
|
parser.add_argument('--ssid', help='WiFi SSID for script object to associate to')
|
||||||
|
parser.add_argument('--passwd', help='WiFi passphrase/password/key')
|
||||||
|
parser.add_argument('--target_per_ten', help='number of request per 10 minutes', default=100)
|
||||||
|
parser.add_argument('--file_size', type=str, help='specify the size of file you want to download', default='5MB')
|
||||||
|
parser.add_argument('--bands', nargs="+", help='specify which band testing you want to run eg 5G OR 2.4G OR 5G 2.4G', default=["5G", "2.4G", "Both"])
|
||||||
|
parser.add_argument('--duration', type=int, help='time to run traffic')
|
||||||
|
parser.add_argument('--threshold_5g',help="Enter the threshold value for 5G Pass/Fail criteria", default="60")
|
||||||
|
parser.add_argument('--threshold_2g',help="Enter the threshold value for 2.4G Pass/Fail criteria",default="90")
|
||||||
|
parser.add_argument('--threshold_both',help="Enter the threshold value for Both Pass/Fail criteria" , default="50")
|
||||||
|
parser.add_argument('--ap_name', help="specify the ap model ", default="TestAP")
|
||||||
|
parser.add_argument('--ssh_port', type=int, help="specify the shh port eg 22",default=22)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
test_time = datetime.datetime.now()
|
||||||
|
test_time = test_time.strftime("%b %d %H:%M:%S")
|
||||||
|
print("Test started at ", test_time)
|
||||||
|
list5G = []
|
||||||
|
list5G_bytes = []
|
||||||
|
list5G_speed = []
|
||||||
|
list2G = []
|
||||||
|
list2G_bytes = []
|
||||||
|
list2G_speed = []
|
||||||
|
Both = []
|
||||||
|
Both_bytes =[]
|
||||||
|
Both_speed =[]
|
||||||
|
dict_keys = []
|
||||||
|
dict_keys.extend(args.bands)
|
||||||
|
# print(dict_keys)
|
||||||
|
final_dict = dict.fromkeys(dict_keys)
|
||||||
|
# print(final_dict)
|
||||||
|
dict1_keys = ['dl_time', 'min', 'max', 'avg','bytes_rd', 'speed']
|
||||||
|
for i in final_dict:
|
||||||
|
final_dict[i] = dict.fromkeys(dict1_keys)
|
||||||
|
print(final_dict)
|
||||||
|
min5 = []
|
||||||
|
min2 = []
|
||||||
|
min_both = []
|
||||||
|
max5 = []
|
||||||
|
max2 = []
|
||||||
|
max_both = []
|
||||||
|
avg2 = []
|
||||||
|
avg5 = []
|
||||||
|
avg_both = []
|
||||||
|
|
||||||
|
for bands in args.bands:
|
||||||
|
http = HttpDownload(lfclient_host=args.mgr, lfclient_port=args.mgr_port,
|
||||||
|
upstream=args.upstream_port, num_sta=args.num_stations,
|
||||||
|
security=args.security,
|
||||||
|
ssid=args.ssid, password=args.passwd,
|
||||||
|
target_per_ten=args.target_per_ten,
|
||||||
|
file_size=args.file_size, bands=bands,
|
||||||
|
twog_radio=args.twog_radio,
|
||||||
|
fiveg_radio=args.fiveg_radio
|
||||||
|
)
|
||||||
|
http.file_create(ssh_port=args.ssh_port)
|
||||||
|
http.set_values()
|
||||||
|
http.precleanup()
|
||||||
|
http.build()
|
||||||
|
http.start()
|
||||||
|
duration = args.duration
|
||||||
|
duration = 60 * duration
|
||||||
|
print("time in seconds ", duration)
|
||||||
|
time.sleep(duration)
|
||||||
|
http.stop()
|
||||||
|
value = http.my_monitor()
|
||||||
|
value2 = http.monitor_bytes()
|
||||||
|
value3 = http.monitor_rx()
|
||||||
|
http.postcleanup()
|
||||||
|
|
||||||
|
if bands == "5G":
|
||||||
|
print("yes")
|
||||||
|
list5G.extend(value)
|
||||||
|
list5G_bytes.extend(value2)
|
||||||
|
list5G_speed.extend(value3)
|
||||||
|
print(list5G)
|
||||||
|
print(list5G_bytes)
|
||||||
|
print(list5G_speed)
|
||||||
|
final_dict['5G']['dl_time'] = list5G
|
||||||
|
|
||||||
|
min5.append(min(list5G))
|
||||||
|
final_dict['5G']['min'] = min5
|
||||||
|
max5.append(max(list5G))
|
||||||
|
final_dict['5G']['max'] = max5
|
||||||
|
avg5.append((sum(list5G) / args.num_stations))
|
||||||
|
final_dict['5G']['avg'] = avg5
|
||||||
|
final_dict['5G']['bytes_rd'] = list5G_bytes
|
||||||
|
final_dict['5G']['speed'] = list5G_speed
|
||||||
|
elif bands == "2.4G":
|
||||||
|
print("no")
|
||||||
|
list2G.extend(value)
|
||||||
|
list2G_bytes.extend(value2)
|
||||||
|
list2G_speed.extend(value3)
|
||||||
|
print(list2G)
|
||||||
|
print(list2G_bytes)
|
||||||
|
print(list2G_speed)
|
||||||
|
final_dict['2.4G']['dl_time'] = list2G
|
||||||
|
min2.append(min(list2G))
|
||||||
|
final_dict['2.4G']['min'] = min2
|
||||||
|
max2.append(max(list2G))
|
||||||
|
final_dict['2.4G']['max'] = max2
|
||||||
|
avg2.append((sum(list2G) / args.num_stations))
|
||||||
|
final_dict['2.4G']['avg'] = avg2
|
||||||
|
final_dict['2.4G']['bytes_rd'] = list2G_bytes
|
||||||
|
final_dict['2.4G']['speed'] = list2G_speed
|
||||||
|
elif bands == "Both":
|
||||||
|
Both.extend(value)
|
||||||
|
Both_bytes.extend(value2)
|
||||||
|
Both_speed.extend(value3)
|
||||||
|
final_dict['Both']['dl_time'] = Both
|
||||||
|
min_both.append(min(Both))
|
||||||
|
final_dict['Both']['min'] = min_both
|
||||||
|
max_both.append(max(Both))
|
||||||
|
final_dict['Both']['max'] = max_both
|
||||||
|
avg_both.append((sum(Both) /args.num_stations))
|
||||||
|
final_dict['Both']['avg'] = avg_both
|
||||||
|
final_dict['Both']['bytes_rd'] = Both_bytes
|
||||||
|
final_dict['Both']['speed'] = Both_speed
|
||||||
|
|
||||||
|
result_data = final_dict
|
||||||
|
print("result", result_data)
|
||||||
|
print("Test Finished")
|
||||||
|
test_end = datetime.datetime.now()
|
||||||
|
test_end = test_end.strftime("%b %d %H:%M:%S")
|
||||||
|
print("Test ended at ", test_end)
|
||||||
|
s1 = test_time
|
||||||
|
s2 = test_end # for example
|
||||||
|
FMT = '%b %d %H:%M:%S'
|
||||||
|
test_duration = datetime.datetime.strptime(s2, FMT) - datetime.datetime.strptime(s1, FMT)
|
||||||
|
|
||||||
|
print("total test duration ", test_duration)
|
||||||
|
date = str(datetime.datetime.now()).split(",")[0].replace(" ", "-").split(".")[0]
|
||||||
|
test_setup_info = {
|
||||||
|
"DUT Name": args.ap_name,
|
||||||
|
"SSID": args.ssid,
|
||||||
|
"Test Duration": test_duration,
|
||||||
|
}
|
||||||
|
test_input_infor={
|
||||||
|
"LANforge ip":args.mgr,
|
||||||
|
"File Size" : args.file_size,
|
||||||
|
"Bands" : args.bands,
|
||||||
|
"Upstream": args.upstream_port,
|
||||||
|
"Stations": args.num_stations,
|
||||||
|
"SSID" :args.ssid,
|
||||||
|
"Security": args.security,
|
||||||
|
"Duration" : args.duration,
|
||||||
|
"Contact": "support@candelatech.com"
|
||||||
|
}
|
||||||
|
http1 = HttpDownload(lfclient_host=args.mgr, lfclient_port=args.mgr_port,
|
||||||
|
upstream=args.upstream_port, num_sta=args.num_stations,
|
||||||
|
security=args.security,
|
||||||
|
ssid=args.ssid, password=args.passwd,
|
||||||
|
target_per_ten=args.target_per_ten,
|
||||||
|
file_size=args.file_size, bands=args.bands,
|
||||||
|
twog_radio=args.twog_radio,
|
||||||
|
fiveg_radio=args.fiveg_radio)
|
||||||
|
dataset = http1.download_time_in_sec(result_data=result_data)
|
||||||
|
lis = []
|
||||||
|
for i in range(1, args.num_stations + 1):
|
||||||
|
lis.append(i)
|
||||||
|
|
||||||
|
dataset2= http1.speed_in_Mbps(result_data=result_data)
|
||||||
|
data = http1.summary_calculation(result_data=result_data, bands=args.bands, threshold_5g=args.threshold_5g , threshold_2g= args.threshold_2g, threshold_both=args.threshold_both)
|
||||||
|
|
||||||
|
summary_table_value = {
|
||||||
|
"": args.bands,
|
||||||
|
"PASS/FAIL": data
|
||||||
|
}
|
||||||
|
http1.generate_report(date, num_stations=args.num_stations,
|
||||||
|
duration=args.duration, test_setup_info=test_setup_info, dataset=dataset, lis=lis,
|
||||||
|
bands=args.bands, threshold_2g=args.threshold_2g, threshold_5g=args.threshold_5g,
|
||||||
|
threshold_both=args.threshold_both, dataset2=dataset2,
|
||||||
|
summary_table_value=summary_table_value, result_data=result_data, test_input_infor=test_input_infor)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user