run multiple number of stations

This commit is contained in:
anil-tegala
2021-05-27 19:54:30 +05:30
parent ea1416aef4
commit 2142ca10f5
2 changed files with 78 additions and 60 deletions

View File

@@ -179,6 +179,14 @@ class ThroughputQOS(Realm):
data = list(self.json_get('/cx/%s?fields=bps+rx+a,bps+rx+b' % sta).values())[2] data = list(self.json_get('/cx/%s?fields=bps+rx+a,bps+rx+b' % sta).values())[2]
tos_upload['_video'].append(data['bps rx a']) tos_upload['_video'].append(data['bps rx a'])
tos_download['_video'].append(data['bps rx b']) tos_download['_video'].append(data['bps rx b'])
tos_upload.update({"_video" : sum(tos_upload['_video'])})
tos_upload.update({"_voice": sum(tos_upload['_voice'])})
tos_upload.update({"_bk": sum(tos_upload['_bk'])})
tos_upload.update({"_be": sum(tos_upload['_be'])})
tos_download.update({"_video": sum(tos_download['_video'])})
tos_download.update({"_voice": sum(tos_download['_voice'])})
tos_download.update({"_bk": sum(tos_download['_bk'])})
tos_download.update({"_be": sum(tos_download['_be'])})
else: else:
print("no connections available to evaluate QOS") print("no connections available to evaluate QOS")
print(tos_upload, tos_download) print(tos_upload, tos_download)
@@ -249,69 +257,79 @@ python3 ./throughput_QOS.py
print("--------------------------------------------") print("--------------------------------------------")
print(args) print(args)
print("--------------------------------------------") print("--------------------------------------------")
results = [], load = {"a_min": [], "b_min": []}
# for multiple test conditions # # for multiple test conditions #
if args.num_stations is not None: if args.num_stations is not None:
if len(args.num_stations.split(',')) > 1: stations = args.num_stations.split(',')
num_stations = args.num_stations.split(',') if args.modes is not None:
if args.modes is not None: modes = args.mode.split(',')
modes = args.modes.split(',') if args.radio is not None:
if args.radio is not None: radios = args.radio.split(',')
radios = args.modes.split(',') if args.a_min is not None or args.b_min is not None:
# ---------------------------------------# args.a_min = args.a_min.split(',')
args.b_min = args.b_min.split(',')
load.update({"a_min": args.a_min})
load.update({"b_min": args.b_min})
if args.test_duration is not None:
args.test_duration = args.test_duration.strip('m')
for station in stations:
if args.create_sta:
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=int(station) - 1,
padding_number_=10000,
radio=args.radio)
else:
station_list = args.sta_names.split(",")
throughput_qos = ThroughputQOS(host=args.mgr,
port=args.mgr_port,
number_template="0000",
sta_list=station_list,
create_sta=args.create_sta,
name_prefix="TOS-",
upstream=args.upstream_port,
ssid=args.ssid,
password=args.passwd,
radio=args.radio,
security=args.security,
test_duration=args.test_duration,
use_ht160=False,
side_a_min_rate=args.a_min,
side_b_min_rate=args.b_min,
mode=args.mode,
ap=args.ap,
traffic_type=args.traffic_type,
tos=args.tos,
modes=args.modes,
_debug_on=args.debug)
if args.create_sta: throughput_qos.pre_cleanup()
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=int(args.num_stations) - 1, throughput_qos.build()
padding_number_=10000, # exit()
radio=args.radio) if args.create_sta:
else: if not throughput_qos.passes():
station_list = args.sta_names.split(",") print(throughput_qos.get_fail_message())
throughput_qos = ThroughputQOS(host=args.mgr, throughput_qos.exit_fail()
port=args.mgr_port, # try:
number_template="0000", # layer3connections = ','.join([[*x.keys()][0] for x in throughput_qos.json_get('endp')['endpoint']])
sta_list=station_list, # except:
create_sta=args.create_sta, # raise ValueError('Try setting the upstream port flag if your device does not have an eth1 port')
name_prefix="TOS-",
upstream=args.upstream_port,
ssid=args.ssid,
password=args.passwd,
radio=args.radio,
security=args.security,
test_duration=args.test_duration,
use_ht160=False,
side_a_min_rate=args.a_min,
side_b_min_rate=args.b_min,
mode=args.mode,
ap=args.ap,
traffic_type=args.traffic_type,
tos=args.tos,
modes=args.modes,
_debug_on=args.debug)
throughput_qos.pre_cleanup() throughput_qos.start(False, False)
throughput_qos.build() time.sleep(int(args.test_duration) * 60)
# exit() throughput_qos.stop()
if args.create_sta: results.append(throughput_qos.evaluate_throughput())
if not throughput_qos.passes(): if args.create_sta:
print(throughput_qos.get_fail_message()) if not throughput_qos.passes():
throughput_qos.exit_fail() print(throughput_qos.get_fail_message())
# try: throughput_qos.exit_fail()
# layer3connections = ','.join([[*x.keys()][0] for x in throughput_qos.json_get('endp')['endpoint']]) LFUtils.wait_until_ports_admin_up(port_list=station_list)
# except: if throughput_qos.passes():
# raise ValueError('Try setting the upstream port flag if your device does not have an eth1 port') throughput_qos.success()
throughput_qos.cleanup()
# ---------------------------------------#
print('+++++++++++++++++')
print(results)
print('+++++++++++++++++')
throughput_qos.start(False, False)
time.sleep(30)
throughput_qos.stop()
throughput_qos.evaluate_throughput()
if args.create_sta:
if not throughput_qos.passes():
print(throughput_qos.get_fail_message())
throughput_qos.exit_fail()
LFUtils.wait_until_ports_admin_up(port_list=station_list)
if throughput_qos.passes():
throughput_qos.success()
throughput_qos.cleanup()
if __name__ == "__main__": if __name__ == "__main__":

View File

@@ -117,12 +117,12 @@ def tos_report(util, sta_num, bps_rx_a, bps_rx_b, tbl_title, grp_title, upload=1
if download: if download:
grph(report, grph(report,
data_set=[[min(i) for i in bps_rx_a], [max(i) for i in bps_rx_a], [sum(i) / len(i) for i in bps_rx_a]], data_set=[[min(i) for i in bps_rx_a], [max(i) for i in bps_rx_a], [sum(i) / len(i) for i in bps_rx_a]],
xaxis_name="Utilizations", yaxis_name="Throughput (Mbps)", xaxis_name="Load", yaxis_name="Throughput (Mbps)",
xaxis_categories=util, label=["min", "max", 'avg'], graph_image_name="Throughput_download") xaxis_categories=util, label=["min", "max", 'avg'], graph_image_name="Throughput_download")
if upload: if upload:
grph(report, grph(report,
data_set=[[min(i) for i in bps_rx_b], [max(i) for i in bps_rx_b], [sum(i) / len(i) for i in bps_rx_b]], data_set=[[min(i) for i in bps_rx_b], [max(i) for i in bps_rx_b], [sum(i) / len(i) for i in bps_rx_b]],
xaxis_name="Utilizations", yaxis_name="Throughput (Mbps)", xaxis_name="Load", yaxis_name="Throughput (Mbps)",
xaxis_categories=util, label=["min", "max", 'avg'], graph_image_name="Throughput_upload") xaxis_categories=util, label=["min", "max", 'avg'], graph_image_name="Throughput_upload")
for i in range(len(util)): for i in range(len(util)):