multiple stations list with multiple speeds added

This commit is contained in:
anil-tegala
2021-06-02 22:57:46 +05:30
parent 2142ca10f5
commit 13f8e9755b

View File

@@ -179,14 +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({"_videoQOS": sum(tos_upload['_video'])})
tos_upload.update({"_voice": sum(tos_upload['_voice'])}) tos_upload.update({"_voiceQOS": sum(tos_upload['_voice'])})
tos_upload.update({"_bk": sum(tos_upload['_bk'])}) tos_upload.update({"_bkQOS": sum(tos_upload['_bk'])})
tos_upload.update({"_be": sum(tos_upload['_be'])}) tos_upload.update({"_beQOS": sum(tos_upload['_be'])})
tos_download.update({"_video": sum(tos_download['_video'])}) tos_download.update({"_videoQOS": sum(tos_download['_video'])})
tos_download.update({"_voice": sum(tos_download['_voice'])}) tos_download.update({"_voiceQOS": sum(tos_download['_voice'])})
tos_download.update({"_bk": sum(tos_download['_bk'])}) tos_download.update({"_bkQOS": sum(tos_download['_bk'])})
tos_download.update({"_be": sum(tos_download['_be'])}) tos_download.update({"_beQOS": 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)
@@ -257,19 +257,23 @@ python3 ./throughput_QOS.py
print("--------------------------------------------") print("--------------------------------------------")
print(args) print(args)
print("--------------------------------------------") print("--------------------------------------------")
results = [], load = {"a_min": [], "b_min": []} results = []
# for multiple test conditions # # for multiple test conditions #
if args.num_stations is not None: if args.num_stations is not None:
stations = args.num_stations.split(',') stations = args.num_stations.split(',')
if args.modes is not None: if args.mode is not None:
modes = args.mode.split(',') modes = args.mode.split(',')
if args.radio is not None: if args.radio is not None:
radios = args.radio.split(',') radios = args.radio.split(',')
if args.a_min is not None or args.b_min is not None: if args.a_min is not None or args.b_min is not None:
args.a_min = args.a_min.split(',') args.a_min = args.a_min.split(',')
args.b_min = args.b_min.split(',') args.b_min = args.b_min.split(',')
load.update({"a_min": args.a_min}) loads = {"a_min": args.a_min, "b_min": args.b_min}
load.update({"b_min": args.b_min}) # try:
# if len(args.a_min) != len(args.b_min):
# raise print("The values of a_min and b_min should be same.")
# finally:
# print("")
if args.test_duration is not None: if args.test_duration is not None:
args.test_duration = args.test_duration.strip('m') args.test_duration = args.test_duration.strip('m')
for station in stations: for station in stations:
@@ -279,53 +283,53 @@ python3 ./throughput_QOS.py
radio=args.radio) radio=args.radio)
else: else:
station_list = args.sta_names.split(",") station_list = args.sta_names.split(",")
throughput_qos = ThroughputQOS(host=args.mgr, for index in range(len(loads["a_min"])):
port=args.mgr_port, throughput_qos = ThroughputQOS(host=args.mgr,
number_template="0000", port=args.mgr_port,
sta_list=station_list, number_template="0000",
create_sta=args.create_sta, sta_list=station_list,
name_prefix="TOS-", create_sta=args.create_sta,
upstream=args.upstream_port, name_prefix="TOS-",
ssid=args.ssid, upstream=args.upstream_port,
password=args.passwd, ssid=args.ssid,
radio=args.radio, password=args.passwd,
security=args.security, radio=args.radio,
test_duration=args.test_duration, security=args.security,
use_ht160=False, test_duration=args.test_duration,
side_a_min_rate=args.a_min, use_ht160=False,
side_b_min_rate=args.b_min, side_a_min_rate=loads["a_min"][index],
mode=args.mode, side_b_min_rate=loads["b_min"][index],
ap=args.ap, mode=args.mode,
traffic_type=args.traffic_type, ap=args.ap,
tos=args.tos, traffic_type=args.traffic_type,
modes=args.modes, tos=args.tos,
_debug_on=args.debug) _debug_on=args.debug)
throughput_qos.pre_cleanup() throughput_qos.pre_cleanup()
throughput_qos.build() throughput_qos.build()
# exit() # exit()
if args.create_sta: if args.create_sta:
if not throughput_qos.passes(): if not throughput_qos.passes():
print(throughput_qos.get_fail_message()) print(throughput_qos.get_fail_message())
throughput_qos.exit_fail() throughput_qos.exit_fail()
# try: # try:
# layer3connections = ','.join([[*x.keys()][0] for x in throughput_qos.json_get('endp')['endpoint']]) # layer3connections = ','.join([[*x.keys()][0] for x in throughput_qos.json_get('endp')['endpoint']])
# except: # except:
# raise ValueError('Try setting the upstream port flag if your device does not have an eth1 port') # raise ValueError('Try setting the upstream port flag if your device does not have an eth1 port')
throughput_qos.start(False, False) throughput_qos.start(False, False)
time.sleep(int(args.test_duration) * 60) time.sleep(int(args.test_duration) * 60)
throughput_qos.stop() throughput_qos.stop()
results.append(throughput_qos.evaluate_throughput()) results.append(throughput_qos.evaluate_throughput())
if args.create_sta: if args.create_sta:
if not throughput_qos.passes(): if not throughput_qos.passes():
print(throughput_qos.get_fail_message()) print(throughput_qos.get_fail_message())
throughput_qos.exit_fail() throughput_qos.exit_fail()
LFUtils.wait_until_ports_admin_up(port_list=station_list) LFUtils.wait_until_ports_admin_up(port_list=station_list)
if throughput_qos.passes(): if throughput_qos.passes():
throughput_qos.success() throughput_qos.success()
throughput_qos.cleanup() throughput_qos.cleanup()
# ---------------------------------------# # ---------------------------------------#
print('+++++++++++++++++') print('+++++++++++++++++')
print(results) print(results)
print('+++++++++++++++++') print('+++++++++++++++++')
@@ -333,4 +337,4 @@ python3 ./throughput_QOS.py
if __name__ == "__main__": if __name__ == "__main__":
main() main()