mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 18:58:01 +00:00 
			
		
		
		
	Revert "Fix test_l3_longevity whitespace errors"
This reverts commit d16bdd9f7a.
			
			
This commit is contained in:
		| @@ -1,5 +1,5 @@ | ||||
| #!/usr/bin/env python3 | ||||
| """ | ||||
| ''' | ||||
| NAME: test_l3_longevity.py | ||||
|  | ||||
| PURPOSE: | ||||
| @@ -44,7 +44,7 @@ COPYRIGHT: | ||||
| Copyright 2021 Candela Technologies Inc | ||||
|  | ||||
| INCLUDE_IN_README | ||||
| """ | ||||
| ''' | ||||
| import argparse | ||||
| import csv | ||||
| import datetime | ||||
| @@ -63,6 +63,7 @@ if sys.version_info[0] != 3: | ||||
|     print("This script requires Python 3") | ||||
|     exit(1) | ||||
|  | ||||
|  | ||||
| sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../"))) | ||||
|  | ||||
| lf_report = importlib.import_module("py-scripts.lf_report") | ||||
| @@ -194,7 +195,7 @@ class L3VariableTime(Realm): | ||||
|  | ||||
|         self.attenuators = attenuators | ||||
|         self.atten_vals = atten_vals | ||||
|         if (len(self.atten_vals) > 0) and (self.atten_vals[0] != -1) and (len(self.attenuators) == 0): | ||||
|         if ((len(self.atten_vals) > 0) and (self.atten_vals[0] != -1) and (len(self.attenuators) == 0)): | ||||
|             print("ERROR:  Attenuation values configured, but no Attenuator EIDs specified.\n") | ||||
|             exit(1) | ||||
|  | ||||
| @@ -236,6 +237,7 @@ class L3VariableTime(Realm): | ||||
|         self.ul_port_csv_files = {} | ||||
|         self.ul_port_csv_writers = {} | ||||
|  | ||||
|  | ||||
|         # TODO:  cmd-line arg to enable/disable these stats. | ||||
|         self.ap_stats_col_titles = ["Station Address", "Dl-PHY-Mbps", "Dl-Data-Mbps", "Dl-Air-Use", "Dl-Data-Use", | ||||
|                                     "Dl-Retries", "Dl-BW", "Dl-MCS", "Dl-NSS", "Dl-OFDMA", "Dl-MU-MIMO",  | ||||
| @@ -245,9 +247,10 @@ class L3VariableTime(Realm): | ||||
|                                     "Ul-PHY-Mbps", "UL-BW", "Ul-MCS", "Ul-NSS", "Ul-OOW", "Ul-HOLES",  | ||||
|                                     "Ul-DUP", "Ul-Retries", "Ul-OFDMA", "Ul-Tones", "Ul-AIR"] | ||||
|  | ||||
|  | ||||
|         dur = self.duration_time_to_seconds(self.test_duration) | ||||
|  | ||||
|         if self.polling_interval_seconds > dur + 1: | ||||
|         if (self.polling_interval_seconds > dur + 1): | ||||
|             self.polling_interval_seconds = dur - 1 | ||||
|  | ||||
|         # Full spread-sheet data | ||||
| @@ -437,7 +440,6 @@ class L3VariableTime(Realm): | ||||
|  | ||||
|         #print("total-dl: ", total_dl, " total-ul: ", total_ul, "\n") | ||||
|         return endp_rx_map, endp_rx_drop_map, endps, total_dl, total_ul, total_dl_ll, total_ul_ll | ||||
|  | ||||
|  # This script supports resetting ports, allowing one to test AP/controller under data load | ||||
|     # while bouncing wifi stations.  Check here to see if we should reset ports. | ||||
|  | ||||
| @@ -462,7 +464,7 @@ class L3VariableTime(Realm): | ||||
|                         "radio: {} countdown seconds_till_reset {}".format( | ||||
|                             station_profile.add_sta_data['radio'], | ||||
|                             station_profile.reset_port_extra_data['seconds_till_reset'])) | ||||
|                     if station_profile.reset_port_extra_data['seconds_till_reset'] <= 0: | ||||
|                     if ((station_profile.reset_port_extra_data['seconds_till_reset'] <= 0)): | ||||
|                         station_profile.reset_port_extra_data['reset_port_timer_started'] = False | ||||
|                         port_to_reset = random.randint(0, len(station_profile.station_names) - 1) | ||||
|                         print( | ||||
| @@ -487,12 +489,12 @@ class L3VariableTime(Realm): | ||||
|  | ||||
|         # Make sure they are gone | ||||
|         count = 0 | ||||
|         while count < 10: | ||||
|         while (count < 10): | ||||
|             more = False | ||||
|             for station_list in self.station_lists: | ||||
|                 for sta in station_list: | ||||
|                     rv = self.rm_port(sta, check_exists=True) | ||||
|                     if rv: | ||||
|                     if (rv): | ||||
|                         more = True | ||||
|             if not more: | ||||
|                 break | ||||
| @@ -532,9 +534,9 @@ class L3VariableTime(Realm): | ||||
|                     # use brackes on [self.side_a] to make it a list | ||||
|                     these_cx, these_endp = self.cx_profile.create(endp_type=etype, side_a=[self.side_a], | ||||
|                                                                   side_b=self.side_b, sleep_time=0, tos=_tos) | ||||
|                     if etype == "lf_udp" or etype == "lf_udp6": | ||||
|                     if (etype == "lf_udp" or etype == "lf_udp6"): | ||||
|                         self.udp_endps = self.udp_endps + these_endp | ||||
|                     elif etype == "lf": | ||||
|                     elif(etype == "lf"): | ||||
|                         self.lf_endps = self.eth_endps + these_endp | ||||
|                     else: | ||||
|                         self.tcp_endps = self.tcp_endps + these_endp | ||||
| @@ -554,7 +556,7 @@ class L3VariableTime(Realm): | ||||
|                 # Build/update connection types | ||||
|                 for etype in self.endp_types: | ||||
|                     if etype == "mc_udp" or etype == "mc_udp6": | ||||
|                         print("Creating Multicast connections for endpoint type: %s" % etype) | ||||
|                         print("Creating Multicast connections for endpoint type: %s" % (etype)) | ||||
|                         self.multicast_profile.create_mc_tx(etype, self.side_b, etype) | ||||
|                         self.multicast_profile.create_mc_rx(etype, side_rx=station_profile.station_names) | ||||
|                     else: | ||||
| @@ -562,7 +564,7 @@ class L3VariableTime(Realm): | ||||
|                             print("Creating connections for endpoint type: %s TOS: %s  cx-count: %s" % (etype, _tos, self.cx_profile.get_cx_count())) | ||||
|                             these_cx, these_endp = self.cx_profile.create(endp_type=etype, side_a=station_profile.station_names, | ||||
|                                                                           side_b=self.side_b, sleep_time=0, tos=_tos) | ||||
|                             if etype == "lf_udp" or etype == "lf_udp6": | ||||
|                             if (etype == "lf_udp" or etype == "lf_udp6"): | ||||
|                                 self.udp_endps = self.udp_endps + these_endp | ||||
|                             else: | ||||
|                                 self.tcp_endps = self.tcp_endps + these_endp | ||||
| @@ -570,7 +572,7 @@ class L3VariableTime(Realm): | ||||
|         self.cx_count = self.cx_profile.get_cx_count() | ||||
|  | ||||
|         if self.dataplane == True: | ||||
|             self._pass("PASS: CX build finished: created/updated:  %s connections." % self.cx_count) | ||||
|             self._pass("PASS: CX build finished: created/updated:  %s connections." % (self.cx_count)) | ||||
|         else: | ||||
|             self._pass("PASS: Stations & CX build finished: created/updated: %s stations and %s connections." % (self.station_count, self.cx_count)) | ||||
|  | ||||
| @@ -742,6 +744,7 @@ class L3VariableTime(Realm): | ||||
|  | ||||
|         return ap_stats_ul_2g | ||||
|  | ||||
|  | ||||
|     # provide fake bs_data for testing without AP wl2 is the 6E interface, wl1 5G, wl0 2G | ||||
|  | ||||
|     def read_ap_rx_report_test_mode(self): | ||||
| @@ -780,7 +783,7 @@ class L3VariableTime(Realm): | ||||
|         self.admin_up(self.side_b) | ||||
|         for station_profile in self.station_profiles: | ||||
|             for sta in station_profile.station_names: | ||||
|                 print("Bringing up station %s" % sta) | ||||
|                 print("Bringing up station %s" % (sta)) | ||||
|                 self.admin_up(sta) | ||||
|  | ||||
|         temp_stations_list = [] | ||||
| @@ -814,6 +817,7 @@ class L3VariableTime(Realm): | ||||
|         for eid_name in port_eids: | ||||
|             self.csv_add_ul_port_column_headers(eid_name, self.csv_generate_ul_port_column_headers()) | ||||
|  | ||||
|  | ||||
|         # For each rate | ||||
|         rate_idx = 0 | ||||
|         for ul in self.side_a_min_rate: | ||||
| @@ -836,10 +840,10 @@ class L3VariableTime(Realm): | ||||
|                 dl_pdu_str = dl_pdu | ||||
|                 ul_pdu_str = ul_pdu | ||||
|  | ||||
|                 if ul_pdu == "AUTO" or ul_pdu == "MTU": | ||||
|                 if (ul_pdu == "AUTO" or ul_pdu == "MTU"): | ||||
|                     ul_pdu = "-1" | ||||
|  | ||||
|                 if dl_pdu == "AUTO" or dl_pdu == "MTU": | ||||
|                 if (dl_pdu == "AUTO" or dl_pdu == "MTU"): | ||||
|                     dl_pdu = "-1" | ||||
|  | ||||
|                 print("ul: %s  dl: %s  cx-count: %s  rates-are-totals: %s\n" % (ul, dl, self.cx_count, self.rates_are_totals)) | ||||
| @@ -881,7 +885,7 @@ class L3VariableTime(Realm): | ||||
|  | ||||
|                     end_time = self.parse_time(self.test_duration) + cur_time | ||||
|  | ||||
|                     print("Monitoring throughput for duration: %s" % self.test_duration) | ||||
|                     print("Monitoring throughput for duration: %s" % (self.test_duration)) | ||||
|  | ||||
|                     # Monitor test for the interval duration. | ||||
|                     passes = 0 | ||||
| @@ -948,6 +952,7 @@ class L3VariableTime(Realm): | ||||
|                                 ap_chanim_stats_6g = self.read_ap_chanim_stats_6g() | ||||
|                                 ap_stats_ul_6g = self.read_ap_stats_ul_6g() | ||||
|  | ||||
|  | ||||
|                             ap_stats_6g_rows = ap_stats_6g.splitlines() | ||||
|                             print("From AP stats: ap_stats_6g_rows {}".format(ap_stats_6g_rows)) | ||||
|  | ||||
| @@ -969,7 +974,7 @@ class L3VariableTime(Realm): | ||||
|                                 # read LANforge to get the mac | ||||
|                                 response = self.json_get(url) | ||||
|                                 if (response is None) or ("interface" not in response): | ||||
|                                     print("6g query-port: %s: incomplete response:" % url) | ||||
|                                     print("6g query-port: %s: incomplete response:" % (url)) | ||||
|                                     pprint(response) | ||||
|                                 else: | ||||
|                                     # print("response".format(response)) | ||||
| @@ -1036,6 +1041,7 @@ class L3VariableTime(Realm): | ||||
|                                         # ap information is passed with ap_row so all information needs to be contained in ap_row | ||||
|                                         ap_row.append(str(channel_utilization)) | ||||
|  | ||||
|  | ||||
|                             # work though the ul rx_data 6G | ||||
|                             for eid_name in port_eids: | ||||
|                                 eid = self.name_to_eid(eid_name) | ||||
| @@ -1043,7 +1049,7 @@ class L3VariableTime(Realm): | ||||
|                                 # read LANforge to get the mac | ||||
|                                 response = self.json_get(url) | ||||
|                                 if (response is None) or ("interface" not in response): | ||||
|                                     print("6g query-port: %s: incomplete response:" % url) | ||||
|                                     print("6g query-port: %s: incomplete response:" % (url)) | ||||
|                                     pprint(response) | ||||
|                                 else: | ||||
|                                     # print("response".format(response)) | ||||
| @@ -1119,7 +1125,7 @@ class L3VariableTime(Realm): | ||||
|                                 # read LANforge to get the mac | ||||
|                                 response = self.json_get(url) | ||||
|                                 if (response is None) or ("interface" not in response): | ||||
|                                     print("query-port 5g: %s: incomplete response:" % url) | ||||
|                                     print("query-port 5g: %s: incomplete response:" % (url)) | ||||
|                                     pprint(response) | ||||
|                                 else: | ||||
|                                     # print("response".format(response)) | ||||
| @@ -1199,7 +1205,7 @@ class L3VariableTime(Realm): | ||||
|                                 # read LANforge to get the mac | ||||
|                                 response = self.json_get(url) | ||||
|                                 if (response is None) or ("interface" not in response): | ||||
|                                     print("5g query-port: %s: incomplete response:" % url) | ||||
|                                     print("5g query-port: %s: incomplete response:" % (url)) | ||||
|                                     pprint(response) | ||||
|                                 else: | ||||
|                                     # print("response".format(response)) | ||||
| @@ -1273,7 +1279,7 @@ class L3VariableTime(Realm): | ||||
|                                 # read LANforge to get the mac | ||||
|                                 response = self.json_get(url) | ||||
|                                 if (response is None) or ("interface" not in response): | ||||
|                                     print("2g query-port: %s: incomplete response:" % url) | ||||
|                                     print("2g query-port: %s: incomplete response:" % (url)) | ||||
|                                     pprint(response) | ||||
|                                 else: | ||||
|                                     # print("response".format(response)) | ||||
| @@ -1352,7 +1358,7 @@ class L3VariableTime(Realm): | ||||
|                                 # read LANforge to get the mac | ||||
|                                 response = self.json_get(url) | ||||
|                                 if (response is None) or ("interface" not in response): | ||||
|                                     print("5g query-port: %s: incomplete response:" % url) | ||||
|                                     print("5g query-port: %s: incomplete response:" % (url)) | ||||
|                                     pprint(response) | ||||
|                                 else: | ||||
|                                     # print("response".format(response)) | ||||
| @@ -1403,7 +1409,7 @@ class L3VariableTime(Realm): | ||||
|                                 url = "/port/%s/%s/%s" % (eid[0], eid[1], eid[2]) | ||||
|                                 response = self.json_get(url) | ||||
|                                 if (response is None) or ("interface" not in response): | ||||
|                                     print("query-port: %s: incomplete response:" % url) | ||||
|                                     print("query-port: %s: incomplete response:" % (url)) | ||||
|                                     pprint(response) | ||||
|                                 else: | ||||
|                                     p = response['interface'] | ||||
| @@ -1427,6 +1433,7 @@ class L3VariableTime(Realm): | ||||
|                         total_dl_ll_bps, | ||||
|                         total_ul_ll_bps) | ||||
|  | ||||
|  | ||||
|                     # At end of test step, record KPI information. This is different the kpi.csv | ||||
|                     self.record_kpi( | ||||
|                         len(temp_stations_list), | ||||
| @@ -1538,6 +1545,7 @@ class L3VariableTime(Realm): | ||||
|         print("NOTE:  Adding kpi to kpi.csv, sta_count {sta_count}  total-download-bps:{total_dl_ll_bps}  upload: {total_ul_ll_bps}  bi-directional: {total_ll}\n".format( | ||||
|               sta_count=sta_count,total_dl_ll_bps=total_dl_ll_bps, total_ul_ll_bps=total_ul_ll_bps, total_ll=(total_ul_ll_bps + total_dl_ll_bps))) | ||||
|  | ||||
|  | ||||
|         # the short description will all for more data to show up in one test-tag graph | ||||
|  | ||||
|         results_dict = self.kpi_csv.kpi_csv_get_dict_update_time() | ||||
| @@ -1577,6 +1585,7 @@ class L3VariableTime(Realm): | ||||
|         results_dict['Units'] = "bps" | ||||
|         self.kpi_csv.kpi_csv_write_dict(results_dict) | ||||
|  | ||||
|  | ||||
|     # Submit data to the influx db if configured to do so. | ||||
|     # This is not the kpi.csv  | ||||
|     def record_kpi(self, sta_count, ul, dl, ul_pdu, dl_pdu, atten, total_dl_bps, total_ul_bps, total_dl_ll_bps, total_ul_ll_bps): | ||||
| @@ -1634,7 +1643,11 @@ class L3VariableTime(Realm): | ||||
|             station_profile.cleanup() | ||||
|  | ||||
|     def csv_generate_column_headers(self): | ||||
|         csv_rx_headers = ['Time epoch', 'Time', 'Monitor', 'UL-Min-Requested', 'UL-Max-Requested', 'DL-Min-Requested', 'DL-Max-Requested', 'UL-Min-PDU', 'UL-Max-PDU', 'DL-Min-PDU', 'DL-Max-PDU', "average_rx_data_bytes"] | ||||
|         csv_rx_headers = ['Time epoch', 'Time', 'Monitor', | ||||
|                           'UL-Min-Requested', 'UL-Max-Requested', 'DL-Min-Requested', 'DL-Max-Requested', | ||||
|                           'UL-Min-PDU', 'UL-Max-PDU', 'DL-Min-PDU', 'DL-Max-PDU', | ||||
|                           ] | ||||
|         csv_rx_headers.append("average_rx_data_bytes") | ||||
|         return csv_rx_headers | ||||
|  | ||||
|     def csv_generate_port_column_headers(self): | ||||
| @@ -1663,6 +1676,8 @@ class L3VariableTime(Realm): | ||||
|  | ||||
|         return csv_ul_rx_headers | ||||
|  | ||||
|  | ||||
|  | ||||
|     def csv_generate_kpi_column_headers(self): | ||||
|         csv_rx_headers = ['Time epoch', 'Time', 'Station-Count', | ||||
|                           'UL-Min-Requested', 'UL-Max-Requested', 'DL-Min-Requested', 'DL-Max-Requested', | ||||
| @@ -1706,6 +1721,7 @@ class L3VariableTime(Realm): | ||||
|         ul_port_csv_writer.writerow(headers) | ||||
|         pfile.flush() | ||||
|  | ||||
|  | ||||
|     def csv_validate_list(self, csv_list, length): | ||||
|         if len(csv_list) < length: | ||||
|             csv_list = csv_list + [('no data', 'no data')] * (length - len(csv_list)) | ||||
| @@ -1718,7 +1734,6 @@ class L3VariableTime(Realm): | ||||
|  | ||||
|     # End of the main class. | ||||
|  | ||||
|  | ||||
| # Check some input values. | ||||
|  | ||||
|  | ||||
| @@ -2132,14 +2147,14 @@ python3 .\\test_l3_longevity.py --test_duration 4m --endp_type \"lf_tcp lf_udp m | ||||
|         attenuators = [] | ||||
|     else: | ||||
|         attenuators = args.attenuators.split(",") | ||||
|     if args.atten_vals == "": | ||||
|     if (args.atten_vals == ""): | ||||
|         atten_vals = [-1] | ||||
|     else: | ||||
|         atten_vals = args.atten_vals.split(",") | ||||
|  | ||||
|     if len(ul_rates) != len(dl_rates): | ||||
|     if (len(ul_rates) != len(dl_rates)): | ||||
|         print("ERROR:  ul_rates %s and dl_rates %s arrays must be same length\n" % (len(ul_rates), len(dl_rates))) | ||||
|     if len(ul_pdus) != len(dl_pdus): | ||||
|     if (len(ul_pdus) != len(dl_pdus)): | ||||
|         print("ERROR:  ul_pdus %s and dl_pdus %s arrays must be same length\n" % (len(ul_rates), len(dl_rates))) | ||||
|  | ||||
|     ip_var_test = L3VariableTime( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Matthew Stidham
					Matthew Stidham