From a3ef6b48a7ffead4ec1c49052301f2a80bfcc234 Mon Sep 17 00:00:00 2001 From: anil-tegala Date: Fri, 11 Jun 2021 22:50:39 +0530 Subject: [PATCH] bands mode with multiple ssid added --- py-scripts/throughput_qos.py | 140 ++++++++++++++++++++++------------- 1 file changed, 90 insertions(+), 50 deletions(-) diff --git a/py-scripts/throughput_qos.py b/py-scripts/throughput_qos.py index d5aa04f4..7bd1e5d2 100644 --- a/py-scripts/throughput_qos.py +++ b/py-scripts/throughput_qos.py @@ -40,6 +40,12 @@ class ThroughputQOS(Realm): ssid=None, security=None, password=None, + ssid_2g=None, + security_2g=None, + password_2g=None, + ssid_5g=None, + security_5g=None, + password_5g=None, sta_list=[], create_sta=True, name_prefix=None, @@ -65,11 +71,17 @@ class ThroughputQOS(Realm): self.host = host self.port = port self.ssid = ssid - self.sta_list = sta_list - self.create_sta = create_sta self.security = security self.password = password + self.ssid_2g = ssid_2g + self.security_2g = security_2g + self.password_2g = password_2g + self.ssid_5g = ssid_5g + self.security_5g = security_5g + self.password_5g = password_5g self.radio = radio.split(",") + self.sta_list = sta_list + self.create_sta = create_sta self.mode = mode self.ap = ap self.traffic_type = traffic_type @@ -133,17 +145,30 @@ class ThroughputQOS(Realm): def build(self): for key in self.bands: if self.create_sta: - self.station_profile.use_security(self.security, self.ssid, self.password) + if key == "2.4G" or key == "2,4g": + if self.ssid is None: + self.station_profile.use_security(self.security_2g, self.ssid_2g, self.password_2g) + else: + self.station_profile.use_security(self.security, self.ssid, self.password) + elif key == "5G" or key == "5G": + if self.ssid is None: + self.station_profile.use_security(self.security_5g, self.ssid_5g, self.password_5g) + else: + self.station_profile.use_security(self.security, self.ssid, self.password) + else: + self.station_profile.use_security(self.security, self.ssid, self.password) self.station_profile.set_number_template(self.number_template) print("Creating stations") 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_flag("set_port", "rpt_timer", 1) if key == "BOTH" or key == "both": + if (self.ssid is None) and (self.password is None) and (self.security is None): + self.station_profile.use_security(self.security_2g, self.ssid_2g, self.password_2g) split = len(self.sta_list) // 2 - self.station_profile.mode = 9 + self.station_profile.mode = 2 self.station_profile.create(radio=self.radio[0], sta_names_=self.sta_list[:split], debug=self.debug) - self.station_profile.mode = 11 + self.station_profile.mode = 9 self.station_profile.create(radio=self.radio[1], sta_names_=self.sta_list[split:], debug=self.debug) else: self.station_profile.create(radio=self.radio[0], sta_names_=self.sta_list, debug=self.debug) @@ -258,13 +283,22 @@ python3 ./throughput_QOS.py default="Best Effort") parser.add_argument('--bands', help='used to run on multiple radio bands,can be used with multiple stations', default="2,4G, 5G, BOTH") + parser.add_argument('--ssid_2g', help="ssid for 2.4Ghz band") + parser.add_argument('--security_2g', help="security type for 2.4Ghz band") + parser.add_argument('--passwd_2g', help="password for 2.4Ghz band") + parser.add_argument('--ssid_5g', help="ssid for 5Ghz band") + parser.add_argument('--security_5g', help="security type for 5Ghz band") + parser.add_argument('--passwd_5g', help="password for 5Ghz band") args = parser.parse_args() print("--------------------------------------------") print(args) print("--------------------------------------------") test_results = [] test_cases = {} - + if (args.a_min is not None) and (args.b_min is not None): + args.a_min = args.a_min.split(',') + args.b_min = args.b_min.split(',') + loads = {"a_min": args.a_min, "b_min": args.b_min} if args.bands is not None: bands = args.bands.split(',') @@ -322,52 +356,58 @@ python3 ./throughput_QOS.py print(args.mode) print(station_list) print("-----------------") + for index in range(len(loads["a_min"])): + 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, + security=args.security, + ssid_2g=args.ssid_2g, + password_2g=args.passwd_2g, + security_2g=args.security_2g, + ssid_5g=args.ssid_5g, + password_5g=args.passwd_5g, + security_5g=args.security_5g, + radio=args.radio, + test_duration=args.test_duration, + use_ht160=False, + side_a_min_rate=loads['a_min'][index], + side_b_min_rate=loads['b_min'][index], + mode=args.mode, + bands=args.bands, + ap=args.ap, + traffic_type=args.traffic_type, + tos=args.tos, + _debug_on=args.debug) + throughput_qos.pre_cleanup() + throughput_qos.build() - 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, - bands=args.bands, - ap=args.ap, - traffic_type=args.traffic_type, - tos=args.tos, - _debug_on=args.debug) - throughput_qos.pre_cleanup() - throughput_qos.build() + if args.create_sta: + if not throughput_qos.passes(): + print(throughput_qos.get_fail_message()) + throughput_qos.exit_fail() + # try: + # layer3connections = ','.join([[*x.keys()][0] for x in throughput_qos.json_get('endp')['endpoint']]) + # except: + # raise ValueError('Try setting the upstream port flag if your device does not have an eth1 port') - if args.create_sta: - if not throughput_qos.passes(): - print(throughput_qos.get_fail_message()) - throughput_qos.exit_fail() - # try: - # layer3connections = ','.join([[*x.keys()][0] for x in throughput_qos.json_get('endp')['endpoint']]) - # except: - # raise ValueError('Try setting the upstream port flag if your device does not have an eth1 port') - - throughput_qos.start(False, False) - time.sleep(int(args.test_duration) * 60) - throughput_qos.stop() - test_results.append(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() + throughput_qos.start(False, False) + time.sleep(int(args.test_duration) * 60) + throughput_qos.stop() + test_results.append(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() # ---------------------------------------# print('+++++++++++++++++') print(test_results)