mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 19:58:03 +00:00
upload download values can be generated
This commit is contained in:
@@ -53,7 +53,8 @@ class ThroughputQOS(Realm):
|
|||||||
side_a_min_rate=56, side_a_max_rate=0,
|
side_a_min_rate=56, side_a_max_rate=0,
|
||||||
side_b_min_rate=56, side_b_max_rate=0,
|
side_b_min_rate=56, side_b_max_rate=0,
|
||||||
number_template="00000",
|
number_template="00000",
|
||||||
test_duration="15m",
|
test_duration="2m",
|
||||||
|
modes="0",
|
||||||
use_ht160=False,
|
use_ht160=False,
|
||||||
_debug_on=False,
|
_debug_on=False,
|
||||||
_exit_on_error=False,
|
_exit_on_error=False,
|
||||||
@@ -73,6 +74,7 @@ class ThroughputQOS(Realm):
|
|||||||
self.ap = ap
|
self.ap = ap
|
||||||
self.traffic_type = traffic_type
|
self.traffic_type = traffic_type
|
||||||
self.tos = tos.split(",")
|
self.tos = tos.split(",")
|
||||||
|
self.modes = modes.split(",")
|
||||||
self.number_template = number_template
|
self.number_template = number_template
|
||||||
self.debug = _debug_on
|
self.debug = _debug_on
|
||||||
self.name_prefix = name_prefix
|
self.name_prefix = name_prefix
|
||||||
@@ -156,23 +158,30 @@ class ThroughputQOS(Realm):
|
|||||||
print("cross connections with TOS type created.")
|
print("cross connections with TOS type created.")
|
||||||
|
|
||||||
def evaluate_throughput(self):
|
def evaluate_throughput(self):
|
||||||
tos_upload, tos_download = {}, {}
|
tos_upload = {'_video': [], '_voice': [], '_bk': [], '_be': []}
|
||||||
tos_video, tos_voice, tos_bk, tos_be = [], [], [], []
|
tos_download = {'_video': [], '_voice': [], '_bk': [], '_be': []}
|
||||||
if self.cx_profile.get_cx_count() > 0:
|
if self.cx_profile.get_cx_count() > 0:
|
||||||
for sta in self.cx_profile.created_cx.keys():
|
for sta in self.cx_profile.created_cx.keys():
|
||||||
temp = int(sta[12:])
|
temp = int(sta[12:])
|
||||||
if temp % 4 == 0:
|
if temp % 4 == 0:
|
||||||
tos_bk.append(list(self.json_get('/cx/%s?fields=bps+rx+a,bps+rx+b,name' % sta).values())[2])
|
data = list(self.json_get('/cx/%s?fields=bps+rx+a,bps+rx+b' % sta).values())[2]
|
||||||
|
tos_upload['_bk'].append(data['bps rx a'])
|
||||||
|
tos_download['_bk'].append(data['bps rx b'])
|
||||||
elif temp % 4 == 1:
|
elif temp % 4 == 1:
|
||||||
tos_be.append(list(self.json_get('cx/%s?fields=bps+rx+a,bps+rx+b,name' % sta).values())[2])
|
data = list(self.json_get('/cx/%s?fields=bps+rx+a,bps+rx+b' % sta).values())[2]
|
||||||
|
tos_upload['_be'].append(data['bps rx a'])
|
||||||
|
tos_download['_be'].append(data['bps rx b'])
|
||||||
elif temp % 4 == 2:
|
elif temp % 4 == 2:
|
||||||
tos_voice.append(list(self.json_get('cx/%s?fields=bps+rx+a,bps+rx+b,name' % sta).values())[2])
|
data = list(self.json_get('/cx/%s?fields=bps+rx+a,bps+rx+b' % sta).values())[2]
|
||||||
|
tos_upload['_voice'].append(data['bps rx a'])
|
||||||
|
tos_download['_voice'].append(data['bps rx b'])
|
||||||
elif temp % 4 == 3:
|
elif temp % 4 == 3:
|
||||||
tos_video.append(list(self.json_get('cx/%s?fields=bps+rx+a,bps+rx+b,name' % 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_download['_video'].append(data['bps rx b'])
|
||||||
else:
|
else:
|
||||||
print("no connections available to evaluate QOS")
|
print("no connections available to evaluate QOS")
|
||||||
|
print(tos_upload, tos_download)
|
||||||
print(tos_bk, tos_be, tos_voice, tos_video)
|
|
||||||
return tos_upload, tos_download
|
return tos_upload, tos_download
|
||||||
|
|
||||||
|
|
||||||
@@ -181,7 +190,7 @@ def main():
|
|||||||
prog='throughput_QOS.py',
|
prog='throughput_QOS.py',
|
||||||
formatter_class=argparse.RawTextHelpFormatter,
|
formatter_class=argparse.RawTextHelpFormatter,
|
||||||
epilog='''\
|
epilog='''\
|
||||||
Create stations to test connection and traffic on VAPs of varying security types (WEP, WPA, WPA2, WPA3, Open)
|
Create stations and endpoints and runs L3 traffic with various IP types of service(BK | BE | Video | Voice)
|
||||||
''',
|
''',
|
||||||
description='''\
|
description='''\
|
||||||
throughput_QOS.py:
|
throughput_QOS.py:
|
||||||
@@ -215,15 +224,7 @@ python3 ./throughput_QOS.py
|
|||||||
--a_min 3000
|
--a_min 3000
|
||||||
--b_min 1000
|
--b_min 1000
|
||||||
--ap "00:0e:8e:78:e1:76"
|
--ap "00:0e:8e:78:e1:76"
|
||||||
--output_format csv
|
|
||||||
--traffic_type lf_udp
|
|
||||||
--report_file ~/Documents/results.csv (Example of csv file output - please use another extension for other file formats)
|
|
||||||
--compared_report ~/Documents/results_prev.csv (Example of csv file retrieval - please use another extension for other file formats) - UNDER CONSTRUCTION
|
|
||||||
--layer3_cols 'name','tx bytes','rx bytes','dropped' (column names from the GUI to print on report - please read below to know what to put here according to preferences)
|
|
||||||
--port_mgr_cols 'ap','ip' (column names from the GUI to print on report - please read below to know what to put here according to preferences)
|
|
||||||
--debug
|
--debug
|
||||||
|
|
||||||
python3 ./throughput_QOS.py
|
|
||||||
--upstream_port eth1 (upstream Port)
|
--upstream_port eth1 (upstream Port)
|
||||||
--traffic_type lf_udp (traffic type, lf_udp | lf_tcp)
|
--traffic_type lf_udp (traffic type, lf_udp | lf_tcp)
|
||||||
--test_duration 5m (duration to run traffic 5m --> 5 Minutes)
|
--test_duration 5m (duration to run traffic 5m --> 5 Minutes)
|
||||||
@@ -234,8 +235,6 @@ python3 ./throughput_QOS.py
|
|||||||
parser.add_argument('--mode', help='Used to force mode of stations')
|
parser.add_argument('--mode', help='Used to force mode of stations')
|
||||||
parser.add_argument('--ap', help='Used to force a connection to a particular AP')
|
parser.add_argument('--ap', help='Used to force a connection to a particular AP')
|
||||||
parser.add_argument('--traffic_type', help='Select the Traffic Type [lf_udp, lf_tcp]', required=True)
|
parser.add_argument('--traffic_type', help='Select the Traffic Type [lf_udp, lf_tcp]', required=True)
|
||||||
parser.add_argument('--output_format', help='choose either csv or xlsx')
|
|
||||||
parser.add_argument('--report_file', help='where you want to store results', default=None)
|
|
||||||
parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000)
|
parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000)
|
||||||
parser.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000)
|
parser.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000)
|
||||||
parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="2m")
|
parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="2m")
|
||||||
@@ -243,62 +242,69 @@ python3 ./throughput_QOS.py
|
|||||||
parser.add_argument('--sta_names', help='Used to force a connection to a particular AP', default="sta0000")
|
parser.add_argument('--sta_names', help='Used to force a connection to a particular AP', default="sta0000")
|
||||||
parser.add_argument('--tos', help='used to provide different ToS settings: BK | BE | VI | VO | numeric',
|
parser.add_argument('--tos', help='used to provide different ToS settings: BK | BE | VI | VO | numeric',
|
||||||
default="Best Effort")
|
default="Best Effort")
|
||||||
|
parser.add_argument('--modes', help='used to run on multiple radio modes,can be used with multiple stations',
|
||||||
|
default="0")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
create_sta = True
|
|
||||||
if args.create_sta == "False":
|
|
||||||
create_sta = False
|
|
||||||
|
|
||||||
num_sta = 2
|
print("--------------------------------------------")
|
||||||
if (args.num_stations is not None) and (int(args.num_stations) > 0):
|
print(args)
|
||||||
num_sta = int(args.num_stations)
|
print("--------------------------------------------")
|
||||||
|
|
||||||
if create_sta:
|
# for multiple test conditions #
|
||||||
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000,
|
if args.num_stations is not None:
|
||||||
|
if len(args.num_stations.split(',')) > 1:
|
||||||
|
num_stations = args.num_stations.split(',')
|
||||||
|
if args.modes is not None:
|
||||||
|
modes = args.modes.split(',')
|
||||||
|
if args.radio is not None:
|
||||||
|
radios = args.modes.split(',')
|
||||||
|
# ---------------------------------------#
|
||||||
|
|
||||||
|
if args.create_sta:
|
||||||
|
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=int(args.num_stations) - 1,
|
||||||
|
padding_number_=10000,
|
||||||
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,
|
throughput_qos = ThroughputQOS(host=args.mgr,
|
||||||
port=args.mgr_port,
|
port=args.mgr_port,
|
||||||
number_template="0000",
|
number_template="0000",
|
||||||
sta_list=station_list,
|
sta_list=station_list,
|
||||||
create_sta=create_sta,
|
create_sta=args.create_sta,
|
||||||
name_prefix="TOS-",
|
name_prefix="TOS-",
|
||||||
upstream=args.upstream_port,
|
upstream=args.upstream_port,
|
||||||
ssid=args.ssid,
|
ssid=args.ssid,
|
||||||
password=args.passwd,
|
password=args.passwd,
|
||||||
radio=args.radio,
|
radio=args.radio,
|
||||||
security=args.security,
|
security=args.security,
|
||||||
test_duration=args.test_duration,
|
test_duration=args.test_duration,
|
||||||
use_ht160=False,
|
use_ht160=False,
|
||||||
side_a_min_rate=args.a_min,
|
side_a_min_rate=args.a_min,
|
||||||
side_b_min_rate=args.b_min,
|
side_b_min_rate=args.b_min,
|
||||||
mode=args.mode,
|
mode=args.mode,
|
||||||
ap=args.ap,
|
ap=args.ap,
|
||||||
traffic_type=args.traffic_type,
|
traffic_type=args.traffic_type,
|
||||||
tos=args.tos,
|
tos=args.tos,
|
||||||
_debug_on=args.debug)
|
modes=args.modes,
|
||||||
|
_debug_on=args.debug)
|
||||||
|
|
||||||
throughput_qos.pre_cleanup()
|
throughput_qos.pre_cleanup()
|
||||||
|
|
||||||
throughput_qos.build()
|
throughput_qos.build()
|
||||||
# exit()
|
# exit()
|
||||||
if 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(30)
|
time.sleep(30)
|
||||||
throughput_qos.stop()
|
throughput_qos.stop()
|
||||||
throughput_qos.evaluate_throughput()
|
throughput_qos.evaluate_throughput()
|
||||||
if 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()
|
||||||
@@ -309,4 +315,4 @@ python3 ./throughput_QOS.py
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user