Fix test_l3_longevity whitespace errors

Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
Matthew Stidham
2021-11-09 17:17:38 -08:00
parent 8271e54714
commit d16bdd9f7a

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
''' """
NAME: test_l3_longevity.py NAME: test_l3_longevity.py
PURPOSE: PURPOSE:
@@ -44,7 +44,7 @@ COPYRIGHT:
Copyright 2021 Candela Technologies Inc Copyright 2021 Candela Technologies Inc
INCLUDE_IN_README INCLUDE_IN_README
''' """
import argparse import argparse
import csv import csv
import datetime import datetime
@@ -63,7 +63,6 @@ if sys.version_info[0] != 3:
print("This script requires Python 3") print("This script requires Python 3")
exit(1) exit(1)
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../"))) sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../")))
lf_report = importlib.import_module("py-scripts.lf_report") lf_report = importlib.import_module("py-scripts.lf_report")
@@ -165,7 +164,7 @@ class L3VariableTime(Realm):
self.test_duration = test_duration self.test_duration = test_duration
self.radio_name_list = radio_name_list self.radio_name_list = radio_name_list
self.number_of_stations_per_radio_list = number_of_stations_per_radio_list self.number_of_stations_per_radio_list = number_of_stations_per_radio_list
#self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port, debug_=debug_on) # self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port, debug_=debug_on)
self.polling_interval_seconds = self.duration_time_to_seconds(polling_interval) self.polling_interval_seconds = self.duration_time_to_seconds(polling_interval)
self.cx_profile = self.new_l3_cx_profile() self.cx_profile = self.new_l3_cx_profile()
self.multicast_profile = self.new_multicast_profile() self.multicast_profile = self.new_multicast_profile()
@@ -195,7 +194,7 @@ class L3VariableTime(Realm):
self.attenuators = attenuators self.attenuators = attenuators
self.atten_vals = atten_vals 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") print("ERROR: Attenuation values configured, but no Attenuator EIDs specified.\n")
exit(1) exit(1)
@@ -237,20 +236,18 @@ class L3VariableTime(Realm):
self.ul_port_csv_files = {} self.ul_port_csv_files = {}
self.ul_port_csv_writers = {} self.ul_port_csv_writers = {}
# TODO: cmd-line arg to enable/disable these stats. # 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", 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", "Dl-Retries", "Dl-BW", "Dl-MCS", "Dl-NSS", "Dl-OFDMA", "Dl-MU-MIMO",
"Dl-Channel-Utilization"] "Dl-Channel-Utilization"]
self.ap_stats_ul_col_titles = ["UL Station Address", "Ul-rssi", "Ul-tid", "Ul-ampdu","Ul-mpdu", "Ul-Data-Mbps", self.ap_stats_ul_col_titles = ["UL Station Address", "Ul-rssi", "Ul-tid", "Ul-ampdu", "Ul-mpdu", "Ul-Data-Mbps",
"Ul-PHY-Mbps", "UL-BW", "Ul-MCS", "Ul-NSS", "Ul-OOW", "Ul-HOLES", "Ul-PHY-Mbps", "UL-BW", "Ul-MCS", "Ul-NSS", "Ul-OOW", "Ul-HOLES",
"Ul-DUP", "Ul-Retries", "Ul-OFDMA", "Ul-Tones", "Ul-AIR"] "Ul-DUP", "Ul-Retries", "Ul-OFDMA", "Ul-Tones", "Ul-AIR"]
dur = self.duration_time_to_seconds(self.test_duration) 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 self.polling_interval_seconds = dur - 1
# Full spread-sheet data # Full spread-sheet data
@@ -318,7 +315,7 @@ class L3VariableTime(Realm):
return self.ap_ofdma_24g return self.ap_ofdma_24g
def get_kpi_csv(self): def get_kpi_csv(self):
#print("self.csv_kpi_file {}".format(self.csv_kpi_file.name)) # print("self.csv_kpi_file {}".format(self.csv_kpi_file.name))
return self.csv_kpi_file.name return self.csv_kpi_file.name
# Find avg latency, jitter for connections using specified port. # Find avg latency, jitter for connections using specified port.
@@ -334,7 +331,7 @@ class L3VariableTime(Realm):
count = 0 count = 0
sta_name = 'no_station' sta_name = 'no_station'
#print("endp-stats-for-port, port-eid: {}".format(eid_name)) # print("endp-stats-for-port, port-eid: {}".format(eid_name))
eid = self.name_to_eid(eid_name) eid = self.name_to_eid(eid_name)
print("eid_name: {eid_name} eid: {eid}".format(eid_name=eid_name, eid=eid)) print("eid_name: {eid_name} eid: {eid}".format(eid_name=eid_name, eid=eid))
@@ -426,7 +423,7 @@ class L3VariableTime(Realm):
endp_rx_drop_map[item] = value endp_rx_drop_map[item] = value
if value_name == 'rx rate': if value_name == 'rx rate':
# This hack breaks for mcast or if someone names endpoints weirdly. # This hack breaks for mcast or if someone names endpoints weirdly.
#print("item: ", item, " rx-bps: ", value_rx_bps) # print("item: ", item, " rx-bps: ", value_rx_bps)
if item.endswith("-A"): if item.endswith("-A"):
total_dl += int(value) total_dl += int(value)
else: else:
@@ -438,8 +435,9 @@ class L3VariableTime(Realm):
else: else:
total_ul_ll += int(value) total_ul_ll += int(value)
#print("total-dl: ", total_dl, " total-ul: ", total_ul, "\n") # 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 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 # 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. # while bouncing wifi stations. Check here to see if we should reset ports.
@@ -464,7 +462,7 @@ class L3VariableTime(Realm):
"radio: {} countdown seconds_till_reset {}".format( "radio: {} countdown seconds_till_reset {}".format(
station_profile.add_sta_data['radio'], station_profile.add_sta_data['radio'],
station_profile.reset_port_extra_data['seconds_till_reset'])) 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 station_profile.reset_port_extra_data['reset_port_timer_started'] = False
port_to_reset = random.randint(0, len(station_profile.station_names) - 1) port_to_reset = random.randint(0, len(station_profile.station_names) - 1)
print( print(
@@ -489,12 +487,12 @@ class L3VariableTime(Realm):
# Make sure they are gone # Make sure they are gone
count = 0 count = 0
while (count < 10): while count < 10:
more = False more = False
for station_list in self.station_lists: for station_list in self.station_lists:
for sta in station_list: for sta in station_list:
rv = self.rm_port(sta, check_exists=True) rv = self.rm_port(sta, check_exists=True)
if (rv): if rv:
more = True more = True
if not more: if not more:
break break
@@ -523,7 +521,7 @@ class L3VariableTime(Realm):
# stations, so allow skipping it. # stations, so allow skipping it.
# Do clean cx lists so that when we re-apply them we get same endp name # Do clean cx lists so that when we re-apply them we get same endp name
# as we had previously # as we had previously
#print("rebuild: Clearing cx profile lists.\n") # print("rebuild: Clearing cx profile lists.\n")
self.cx_profile.clean_cx_lists() self.cx_profile.clean_cx_lists()
self.multicast_profile.clean_mc_lists() self.multicast_profile.clean_mc_lists()
@@ -534,9 +532,9 @@ class L3VariableTime(Realm):
# use brackes on [self.side_a] to make it a list # 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], 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) 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 self.udp_endps = self.udp_endps + these_endp
elif(etype == "lf"): elif etype == "lf":
self.lf_endps = self.eth_endps + these_endp self.lf_endps = self.eth_endps + these_endp
else: else:
self.tcp_endps = self.tcp_endps + these_endp self.tcp_endps = self.tcp_endps + these_endp
@@ -556,7 +554,7 @@ class L3VariableTime(Realm):
# Build/update connection types # Build/update connection types
for etype in self.endp_types: for etype in self.endp_types:
if etype == "mc_udp" or etype == "mc_udp6": 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_tx(etype, self.side_b, etype)
self.multicast_profile.create_mc_rx(etype, side_rx=station_profile.station_names) self.multicast_profile.create_mc_rx(etype, side_rx=station_profile.station_names)
else: else:
@@ -564,7 +562,7 @@ class L3VariableTime(Realm):
print("Creating connections for endpoint type: %s TOS: %s cx-count: %s" % (etype, _tos, self.cx_profile.get_cx_count())) 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, 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) 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 self.udp_endps = self.udp_endps + these_endp
else: else:
self.tcp_endps = self.tcp_endps + these_endp self.tcp_endps = self.tcp_endps + these_endp
@@ -572,7 +570,7 @@ class L3VariableTime(Realm):
self.cx_count = self.cx_profile.get_cx_count() self.cx_count = self.cx_profile.get_cx_count()
if self.dataplane == True: 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: else:
self._pass("PASS: Stations & CX build finished: created/updated: %s stations and %s connections." % (self.station_count, self.cx_count)) self._pass("PASS: Stations & CX build finished: created/updated: %s stations and %s connections." % (self.station_count, self.cx_count))
@@ -744,7 +742,6 @@ class L3VariableTime(Realm):
return ap_stats_ul_2g return ap_stats_ul_2g
# provide fake bs_data for testing without AP wl2 is the 6E interface, wl1 5G, wl0 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): def read_ap_rx_report_test_mode(self):
@@ -753,7 +750,7 @@ class L3VariableTime(Realm):
"50:E0:85:87:5B:F4 (-43dBm) 0 2062 127078 32.5 571.9 80 11.0 2 0 0 64 0% 100% 483.3 6%\n", "50:E0:85:87:5B:F4 (-43dBm) 0 2062 127078 32.5 571.9 80 11.0 2 0 0 64 0% 100% 483.3 6%\n",
"50:E0:85:84:7A:E7 (-44dBm) 0 2334 144373 36.9 343.1 80 10.9 2 0 0 63 0% 100% 291.4 11%\n", "50:E0:85:84:7A:E7 (-44dBm) 0 2334 144373 36.9 343.1 80 10.9 2 0 0 63 0% 100% 291.4 11%\n",
"50:E0:85:88:F4:5F (-45dBm) 0 2296 142463 36.4 346.3 80 10.9 2 0 0 64 0% 100% 294.1 11%\n") "50:E0:85:88:F4:5F (-45dBm) 0 2296 142463 36.4 346.3 80 10.9 2 0 0 64 0% 100% 294.1 11%\n")
#Keep commented for testing "(overall) - 6692 413914 105.8 - - - - - - - - - - - -\n" # Keep commented for testing "(overall) - 6692 413914 105.8 - - - - - - - - - - - -\n"
return ap_rx_report_fake return ap_rx_report_fake
def read_ap_bs_data_test_mode(self): def read_ap_bs_data_test_mode(self):
@@ -763,7 +760,7 @@ class L3VariableTime(Realm):
"50:E0:85:84:7A:E7 880.9 52.2 7.7% 26.1% 20.0% 80 8.5 2 0.0% 0.0%\n", "50:E0:85:84:7A:E7 880.9 52.2 7.7% 26.1% 20.0% 80 8.5 2 0.0% 0.0%\n",
"50:E0:85:89:5D:00 840.0 47.6 6.4% 23.8% 2.3% 80 8.0 2 0.0% 0.0%\n", "50:E0:85:89:5D:00 840.0 47.6 6.4% 23.8% 2.3% 80 8.0 2 0.0% 0.0%\n",
"50:E0:85:87:5B:F4 960.7 51.5 5.9% 25.7% 0.0% 80 9 2 0.0% 0.0%\n") "50:E0:85:87:5B:F4 960.7 51.5 5.9% 25.7% 0.0% 80 9 2 0.0% 0.0%\n")
#Keep commented for testing "- note the MAC will match ap_stats.append((overall) - 200.2 26.5% - - \n") # Keep commented for testing "- note the MAC will match ap_stats.append((overall) - 200.2 26.5% - - \n")
# print("ap_stats_fake {}".format(ap_stats_fake)) # print("ap_stats_fake {}".format(ap_stats_fake))
return ap_stats_fake return ap_stats_fake
@@ -783,11 +780,11 @@ class L3VariableTime(Realm):
self.admin_up(self.side_b) self.admin_up(self.side_b)
for station_profile in self.station_profiles: for station_profile in self.station_profiles:
for sta in station_profile.station_names: for sta in station_profile.station_names:
print("Bringing up station %s" % (sta)) print("Bringing up station %s" % sta)
self.admin_up(sta) self.admin_up(sta)
temp_stations_list = [] temp_stations_list = []
#temp_stations_list.append(self.side_b) # temp_stations_list.append(self.side_b)
for station_profile in self.station_profiles: for station_profile in self.station_profiles:
temp_stations_list.extend(station_profile.station_names.copy()) temp_stations_list.extend(station_profile.station_names.copy())
@@ -817,7 +814,6 @@ class L3VariableTime(Realm):
for eid_name in port_eids: for eid_name in port_eids:
self.csv_add_ul_port_column_headers(eid_name, self.csv_generate_ul_port_column_headers()) self.csv_add_ul_port_column_headers(eid_name, self.csv_generate_ul_port_column_headers())
# For each rate # For each rate
rate_idx = 0 rate_idx = 0
for ul in self.side_a_min_rate: for ul in self.side_a_min_rate:
@@ -840,10 +836,10 @@ class L3VariableTime(Realm):
dl_pdu_str = dl_pdu dl_pdu_str = dl_pdu
ul_pdu_str = ul_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" ul_pdu = "-1"
if (dl_pdu == "AUTO" or dl_pdu == "MTU"): if dl_pdu == "AUTO" or dl_pdu == "MTU":
dl_pdu = "-1" 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)) print("ul: %s dl: %s cx-count: %s rates-are-totals: %s\n" % (ul, dl, self.cx_count, self.rates_are_totals))
@@ -885,7 +881,7 @@ class L3VariableTime(Realm):
end_time = self.parse_time(self.test_duration) + cur_time 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. # Monitor test for the interval duration.
passes = 0 passes = 0
@@ -913,9 +909,9 @@ class L3VariableTime(Realm):
total_dl_pkts_ll = 0 total_dl_pkts_ll = 0
while cur_time < end_time: while cur_time < end_time:
#interval_time = cur_time + datetime.timedelta(seconds=5) # interval_time = cur_time + datetime.timedelta(seconds=5)
interval_time = cur_time + datetime.timedelta(seconds=self.polling_interval_seconds) interval_time = cur_time + datetime.timedelta(seconds=self.polling_interval_seconds)
#print("polling_interval_seconds {}".format(self.polling_interval_seconds)) # print("polling_interval_seconds {}".format(self.polling_interval_seconds))
while cur_time < interval_time: while cur_time < interval_time:
cur_time = datetime.datetime.now() cur_time = datetime.datetime.now()
@@ -952,7 +948,6 @@ class L3VariableTime(Realm):
ap_chanim_stats_6g = self.read_ap_chanim_stats_6g() ap_chanim_stats_6g = self.read_ap_chanim_stats_6g()
ap_stats_ul_6g = self.read_ap_stats_ul_6g() ap_stats_ul_6g = self.read_ap_stats_ul_6g()
ap_stats_6g_rows = ap_stats_6g.splitlines() ap_stats_6g_rows = ap_stats_6g.splitlines()
print("From AP stats: ap_stats_6g_rows {}".format(ap_stats_6g_rows)) print("From AP stats: ap_stats_6g_rows {}".format(ap_stats_6g_rows))
@@ -974,7 +969,7 @@ class L3VariableTime(Realm):
# read LANforge to get the mac # read LANforge to get the mac
response = self.json_get(url) response = self.json_get(url)
if (response is None) or ("interface" not in response): 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) pprint(response)
else: else:
# print("response".format(response)) # print("response".format(response))
@@ -987,8 +982,8 @@ class L3VariableTime(Realm):
# Parse the ap stats to find the matching mac then use that row for reporting # Parse the ap stats to find the matching mac then use that row for reporting
for row in ap_stats_6g_rows: for row in ap_stats_6g_rows:
split_row = row.split() split_row = row.split()
#print("split_row {}".format(split_row)) # print("split_row {}".format(split_row))
#print("split_row[0] {} mac {}".format(split_row[0].lower(),mac.lower())) # print("split_row[0] {} mac {}".format(split_row[0].lower(),mac.lower()))
if self.ap_test_mode: if self.ap_test_mode:
if split_row[0].lower() != mac.lower(): if split_row[0].lower() != mac.lower():
ap_row = split_row ap_row = split_row
@@ -1041,7 +1036,6 @@ class L3VariableTime(Realm):
# ap information is passed with ap_row so all information needs to be contained in ap_row # ap information is passed with ap_row so all information needs to be contained in ap_row
ap_row.append(str(channel_utilization)) ap_row.append(str(channel_utilization))
# work though the ul rx_data 6G # work though the ul rx_data 6G
for eid_name in port_eids: for eid_name in port_eids:
eid = self.name_to_eid(eid_name) eid = self.name_to_eid(eid_name)
@@ -1049,7 +1043,7 @@ class L3VariableTime(Realm):
# read LANforge to get the mac # read LANforge to get the mac
response = self.json_get(url) response = self.json_get(url)
if (response is None) or ("interface" not in response): 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) pprint(response)
else: else:
# print("response".format(response)) # print("response".format(response))
@@ -1062,8 +1056,8 @@ class L3VariableTime(Realm):
# Parse the ap stats to find the matching mac then use that row for reporting # Parse the ap stats to find the matching mac then use that row for reporting
for row in ap_stats_ul_6g_rows: for row in ap_stats_ul_6g_rows:
split_ul_row = row.split() split_ul_row = row.split()
#print("split_row {}".format(split_row)) # print("split_row {}".format(split_row))
#print("split_row[0] {} mac {}".format(split_row[0].lower(),mac.lower())) # print("split_row[0] {} mac {}".format(split_row[0].lower(),mac.lower()))
if self.ap_test_mode: if self.ap_test_mode:
if split_ul_row[0].lower() != mac.lower(): if split_ul_row[0].lower() != mac.lower():
ap_ul_row = split_ul_row ap_ul_row = split_ul_row
@@ -1125,7 +1119,7 @@ class L3VariableTime(Realm):
# read LANforge to get the mac # read LANforge to get the mac
response = self.json_get(url) response = self.json_get(url)
if (response is None) or ("interface" not in response): 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) pprint(response)
else: else:
# print("response".format(response)) # print("response".format(response))
@@ -1138,8 +1132,8 @@ class L3VariableTime(Realm):
# Parse the ap stats to find the matching mac then use that row for reporting # Parse the ap stats to find the matching mac then use that row for reporting
for row in ap_stats_5g_rows: for row in ap_stats_5g_rows:
split_row = row.split() split_row = row.split()
#print("split_row {}".format(split_row)) # print("split_row {}".format(split_row))
#print("split_row[0] {} mac {}".format(split_row[0].lower(),mac.lower())) # print("split_row[0] {} mac {}".format(split_row[0].lower(),mac.lower()))
if self.ap_test_mode: if self.ap_test_mode:
if split_row[0].lower() != mac.lower(): if split_row[0].lower() != mac.lower():
ap_row = split_row ap_row = split_row
@@ -1205,7 +1199,7 @@ class L3VariableTime(Realm):
# read LANforge to get the mac # read LANforge to get the mac
response = self.json_get(url) response = self.json_get(url)
if (response is None) or ("interface" not in response): 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) pprint(response)
else: else:
# print("response".format(response)) # print("response".format(response))
@@ -1218,8 +1212,8 @@ class L3VariableTime(Realm):
# Parse the ap stats to find the matching mac then use that row for reporting # Parse the ap stats to find the matching mac then use that row for reporting
for row in ap_stats_ul_5g_rows: for row in ap_stats_ul_5g_rows:
split_ul_row = row.split() split_ul_row = row.split()
#print("split_row {}".format(split_row)) # print("split_row {}".format(split_row))
#print("split_row[0] {} mac {}".format(split_row[0].lower(),mac.lower())) # print("split_row[0] {} mac {}".format(split_row[0].lower(),mac.lower()))
if self.ap_test_mode: if self.ap_test_mode:
if split_ul_row[0].lower() != mac.lower(): if split_ul_row[0].lower() != mac.lower():
ap_ul_row = split_ul_row ap_ul_row = split_ul_row
@@ -1279,7 +1273,7 @@ class L3VariableTime(Realm):
# read LANforge to get the mac # read LANforge to get the mac
response = self.json_get(url) response = self.json_get(url)
if (response is None) or ("interface" not in response): 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) pprint(response)
else: else:
# print("response".format(response)) # print("response".format(response))
@@ -1292,8 +1286,8 @@ class L3VariableTime(Realm):
# Parse the ap stats to find the matching mac then use that row for reporting # Parse the ap stats to find the matching mac then use that row for reporting
for row in ap_stats_2g_rows: for row in ap_stats_2g_rows:
split_row = row.split() split_row = row.split()
#print("split_row {}".format(split_row)) # print("split_row {}".format(split_row))
#print("split_row[0] {} mac {}".format(split_row[0].lower(),mac.lower())) # print("split_row[0] {} mac {}".format(split_row[0].lower(),mac.lower()))
if self.ap_test_mode: if self.ap_test_mode:
if split_row[0].lower() != mac.lower(): if split_row[0].lower() != mac.lower():
ap_row = split_row ap_row = split_row
@@ -1358,7 +1352,7 @@ class L3VariableTime(Realm):
# read LANforge to get the mac # read LANforge to get the mac
response = self.json_get(url) response = self.json_get(url)
if (response is None) or ("interface" not in response): 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) pprint(response)
else: else:
# print("response".format(response)) # print("response".format(response))
@@ -1371,8 +1365,8 @@ class L3VariableTime(Realm):
# Parse the ap stats to find the matching mac then use that row for reporting # Parse the ap stats to find the matching mac then use that row for reporting
for row in ap_stats_ul_2g_rows: for row in ap_stats_ul_2g_rows:
split_ul_row = row.split() split_ul_row = row.split()
#print("split_row {}".format(split_row)) # print("split_row {}".format(split_row))
#print("split_row[0] {} mac {}".format(split_row[0].lower(),mac.lower())) # print("split_row[0] {} mac {}".format(split_row[0].lower(),mac.lower()))
if self.ap_test_mode: if self.ap_test_mode:
if split_ul_row[0].lower() != mac.lower(): if split_ul_row[0].lower() != mac.lower():
ap_ul_row = split_ul_row ap_ul_row = split_ul_row
@@ -1409,7 +1403,7 @@ class L3VariableTime(Realm):
url = "/port/%s/%s/%s" % (eid[0], eid[1], eid[2]) url = "/port/%s/%s/%s" % (eid[0], eid[1], eid[2])
response = self.json_get(url) response = self.json_get(url)
if (response is None) or ("interface" not in response): 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) pprint(response)
else: else:
p = response['interface'] p = response['interface']
@@ -1433,7 +1427,6 @@ class L3VariableTime(Realm):
total_dl_ll_bps, total_dl_ll_bps,
total_ul_ll_bps) total_ul_ll_bps)
# At end of test step, record KPI information. This is different the kpi.csv # At end of test step, record KPI information. This is different the kpi.csv
self.record_kpi( self.record_kpi(
len(temp_stations_list), len(temp_stations_list),
@@ -1494,12 +1487,12 @@ class L3VariableTime(Realm):
port_data['signal'], port_data['ap'], port_data['mode'], latency, jitter, total_ul_rate, total_ul_rate_ll, total_ul_pkts_ll, total_dl_rate, total_dl_rate_ll, total_dl_pkts_ll] port_data['signal'], port_data['ap'], port_data['mode'], latency, jitter, total_ul_rate, total_ul_rate_ll, total_ul_pkts_ll, total_dl_rate, total_dl_rate_ll, total_dl_pkts_ll]
# Add in info queried from AP. # Add in info queried from AP.
#print("ap_row length {} col_titles length {}".format(len(ap_row),len(self.ap_stats_col_titles))) # print("ap_row length {} col_titles length {}".format(len(ap_row),len(self.ap_stats_col_titles)))
#print("self.ap_stats_col_titles {} ap_stats_col_titles {}".format(self.ap_stats_col_titles,ap_stats_col_titles)) # print("self.ap_stats_col_titles {} ap_stats_col_titles {}".format(self.ap_stats_col_titles,ap_stats_col_titles))
if len(ap_row) == len(self.ap_stats_col_titles): if len(ap_row) == len(self.ap_stats_col_titles):
#print("ap_row {}".format(ap_row)) # print("ap_row {}".format(ap_row))
for col in ap_row: for col in ap_row:
#print("col {}".format(col)) # print("col {}".format(col))
row.append(col) row.append(col)
writer = self.port_csv_writers[eid_name] writer = self.port_csv_writers[eid_name]
@@ -1517,10 +1510,10 @@ class L3VariableTime(Realm):
port_data['signal'], port_data['ap'], port_data['mode'], latency, jitter, total_ul_rate, total_ul_rate_ll, total_ul_pkts_ll, total_dl_rate, total_dl_rate_ll, total_dl_pkts_ll] port_data['signal'], port_data['ap'], port_data['mode'], latency, jitter, total_ul_rate, total_ul_rate_ll, total_ul_pkts_ll, total_dl_rate, total_dl_rate_ll, total_dl_pkts_ll]
# Add in info queried from AP. # Add in info queried from AP.
#print("ap_row length {} col_titles length {}".format(len(ap_row),len(self.ap_stats_col_titles))) # print("ap_row length {} col_titles length {}".format(len(ap_row),len(self.ap_stats_col_titles)))
#print("self.ap_stats_col_titles {} ap_stats_col_titles {}".format(self.ap_stats_col_titles,ap_stats_col_titles)) # print("self.ap_stats_col_titles {} ap_stats_col_titles {}".format(self.ap_stats_col_titles,ap_stats_col_titles))
print("ap_ul_row len {} ap_stats_ul_col_titles len {} ap_ul_row {}".format(len(ap_ul_row),len(self.ap_stats_ul_col_titles),ap_ul_row)) print("ap_ul_row len {} ap_stats_ul_col_titles len {} ap_ul_row {}".format(len(ap_ul_row), len(self.ap_stats_ul_col_titles), ap_ul_row))
if len(ap_ul_row) == len(self.ap_stats_ul_col_titles): if len(ap_ul_row) == len(self.ap_stats_ul_col_titles):
print("ap_ul_row {}".format(ap_ul_row)) print("ap_ul_row {}".format(ap_ul_row))
for col in ap_ul_row: for col in ap_ul_row:
@@ -1540,52 +1533,50 @@ class L3VariableTime(Realm):
def record_kpi_csv(self, sta_count, ul, dl, ul_pdu, dl_pdu, atten, total_dl_bps, total_ul_bps, total_dl_ll_bps, total_ul_ll_bps): def record_kpi_csv(self, sta_count, ul, dl, ul_pdu, dl_pdu, atten, total_dl_bps, total_ul_bps, total_dl_ll_bps, total_ul_ll_bps):
print("NOTE: Adding kpi to kpi.csv, sta_count {sta_count} total-download-bps:{total_dl_bps} upload: {total_ul_bps} bi-directional: {total}\n".format( print("NOTE: Adding kpi to kpi.csv, sta_count {sta_count} total-download-bps:{total_dl_bps} upload: {total_ul_bps} bi-directional: {total}\n".format(
sta_count=sta_count,total_dl_bps=total_dl_bps, total_ul_bps=total_ul_bps, total=(total_ul_bps + total_dl_bps))) sta_count=sta_count, total_dl_bps=total_dl_bps, total_ul_bps=total_ul_bps, total=(total_ul_bps + total_dl_bps)))
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( 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))) 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 # 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() results_dict = self.kpi_csv.kpi_csv_get_dict_update_time()
results_dict['Graph-Group'] = "Per Stations Rate DL" results_dict['Graph-Group'] = "Per Stations Rate DL"
results_dict['short-description'] = "DL {dl} bps pdu {dl_pdu} {sta_count} STA".format(dl=dl,dl_pdu=dl_pdu,sta_count=sta_count) results_dict['short-description'] = "DL {dl} bps pdu {dl_pdu} {sta_count} STA".format(dl=dl, dl_pdu=dl_pdu, sta_count=sta_count)
results_dict['numeric-score'] = "{}".format(total_dl_bps) results_dict['numeric-score'] = "{}".format(total_dl_bps)
results_dict['Units'] = "bps" results_dict['Units'] = "bps"
self.kpi_csv.kpi_csv_write_dict(results_dict) self.kpi_csv.kpi_csv_write_dict(results_dict)
results_dict['Graph-Group'] = "Per Stations Rate UL" results_dict['Graph-Group'] = "Per Stations Rate UL"
results_dict['short-description'] = "UL {ul} bps pdu {ul_pdu} {sta_count} STA".format(ul=ul,ul_pdu=ul_pdu,sta_count=sta_count) results_dict['short-description'] = "UL {ul} bps pdu {ul_pdu} {sta_count} STA".format(ul=ul, ul_pdu=ul_pdu, sta_count=sta_count)
results_dict['numeric-score'] = "{}".format(total_ul_bps) results_dict['numeric-score'] = "{}".format(total_ul_bps)
results_dict['Units'] = "bps" results_dict['Units'] = "bps"
self.kpi_csv.kpi_csv_write_dict(results_dict) self.kpi_csv.kpi_csv_write_dict(results_dict)
results_dict['Graph-Group'] = "Per Stations Rate UL+DL" results_dict['Graph-Group'] = "Per Stations Rate UL+DL"
results_dict['short-description'] = "UL {ul} bps pdu {ul_pdu} + DL {dl} bps pud {dl_pdu}- {sta_count} STA".format(ul=ul,ul_pdu=ul_pdu,dl=dl,dl_pdu=dl_pdu,sta_count=sta_count) results_dict['short-description'] = "UL {ul} bps pdu {ul_pdu} + DL {dl} bps pud {dl_pdu}- {sta_count} STA".format(ul=ul, ul_pdu=ul_pdu, dl=dl, dl_pdu=dl_pdu, sta_count=sta_count)
results_dict['numeric-score'] = "{}".format((total_ul_bps + total_dl_bps)) results_dict['numeric-score'] = "{}".format((total_ul_bps + total_dl_bps))
results_dict['Units'] = "bps" results_dict['Units'] = "bps"
self.kpi_csv.kpi_csv_write_dict(results_dict) self.kpi_csv.kpi_csv_write_dict(results_dict)
results_dict['Graph-Group'] = "Per Stations Rate DL" results_dict['Graph-Group'] = "Per Stations Rate DL"
results_dict['short-description'] = "DL LL {dl} bps pdu {dl_pdu} {sta_count} STA".format(dl=dl,dl_pdu=dl_pdu,sta_count=sta_count) results_dict['short-description'] = "DL LL {dl} bps pdu {dl_pdu} {sta_count} STA".format(dl=dl, dl_pdu=dl_pdu, sta_count=sta_count)
results_dict['numeric-score'] = "{}".format(total_dl_ll_bps) results_dict['numeric-score'] = "{}".format(total_dl_ll_bps)
results_dict['Units'] = "bps" results_dict['Units'] = "bps"
self.kpi_csv.kpi_csv_write_dict(results_dict) self.kpi_csv.kpi_csv_write_dict(results_dict)
results_dict['Graph-Group'] = "Per Stations Rate UL" results_dict['Graph-Group'] = "Per Stations Rate UL"
results_dict['short-description'] = "UL LL {ul} bps pdu {ul_pdu} {sta_count} STA".format(ul=ul,ul_pdu=ul_pdu,sta_count=sta_count) results_dict['short-description'] = "UL LL {ul} bps pdu {ul_pdu} {sta_count} STA".format(ul=ul, ul_pdu=ul_pdu, sta_count=sta_count)
results_dict['numeric-score'] = "{}".format(total_ul_ll_bps) results_dict['numeric-score'] = "{}".format(total_ul_ll_bps)
results_dict['Units'] = "bps" results_dict['Units'] = "bps"
self.kpi_csv.kpi_csv_write_dict(results_dict) self.kpi_csv.kpi_csv_write_dict(results_dict)
results_dict['Graph-Group'] = "Per Stations Rate UL+DL" results_dict['Graph-Group'] = "Per Stations Rate UL+DL"
results_dict['short-description'] = "UL LL {ul} bps pdu {ul_pdu} + DL LL {dl} bps pud {dl_pdu}- {sta_count} STA".format(ul=ul,ul_pdu=ul_pdu,dl=dl,dl_pdu=dl_pdu,sta_count=sta_count) results_dict['short-description'] = "UL LL {ul} bps pdu {ul_pdu} + DL LL {dl} bps pud {dl_pdu}- {sta_count} STA".format(ul=ul, ul_pdu=ul_pdu, dl=dl, dl_pdu=dl_pdu, sta_count=sta_count)
results_dict['numeric-score'] = "{}".format((total_ul_ll_bps + total_dl_ll_bps)) results_dict['numeric-score'] = "{}".format((total_ul_ll_bps + total_dl_ll_bps))
results_dict['Units'] = "bps" results_dict['Units'] = "bps"
self.kpi_csv.kpi_csv_write_dict(results_dict) self.kpi_csv.kpi_csv_write_dict(results_dict)
# Submit data to the influx db if configured to do so. # Submit data to the influx db if configured to do so.
# This is not the kpi.csv # 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): 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):
@@ -1643,11 +1634,7 @@ class L3VariableTime(Realm):
station_profile.cleanup() station_profile.cleanup()
def csv_generate_column_headers(self): def csv_generate_column_headers(self):
csv_rx_headers = ['Time epoch', 'Time', 'Monitor', 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"]
'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 return csv_rx_headers
def csv_generate_port_column_headers(self): def csv_generate_port_column_headers(self):
@@ -1676,8 +1663,6 @@ class L3VariableTime(Realm):
return csv_ul_rx_headers return csv_ul_rx_headers
def csv_generate_kpi_column_headers(self): def csv_generate_kpi_column_headers(self):
csv_rx_headers = ['Time epoch', 'Time', 'Station-Count', csv_rx_headers = ['Time epoch', 'Time', 'Station-Count',
'UL-Min-Requested', 'UL-Max-Requested', 'DL-Min-Requested', 'DL-Max-Requested', 'UL-Min-Requested', 'UL-Max-Requested', 'DL-Min-Requested', 'DL-Max-Requested',
@@ -1721,7 +1706,6 @@ class L3VariableTime(Realm):
ul_port_csv_writer.writerow(headers) ul_port_csv_writer.writerow(headers)
pfile.flush() pfile.flush()
def csv_validate_list(self, csv_list, length): def csv_validate_list(self, csv_list, length):
if len(csv_list) < length: if len(csv_list) < length:
csv_list = csv_list + [('no data', 'no data')] * (length - len(csv_list)) csv_list = csv_list + [('no data', 'no data')] * (length - len(csv_list))
@@ -1734,6 +1718,7 @@ class L3VariableTime(Realm):
# End of the main class. # End of the main class.
# Check some input values. # Check some input values.
@@ -1870,7 +1855,7 @@ python3 .\\test_l3_longevity.py --test_duration 4m --endp_type \"lf_tcp lf_udp m
parser.add_argument('--tty', help='--tty \"/dev/ttyUSB2\" the serial interface to the AP', default="") parser.add_argument('--tty', help='--tty \"/dev/ttyUSB2\" the serial interface to the AP', default="")
parser.add_argument('--baud', help='--baud \"9600\" AP baud rate for the serial interface', default="9600") parser.add_argument('--baud', help='--baud \"9600\" AP baud rate for the serial interface', default="9600")
parser.add_argument('--mgr','--lfmgr', dest='lfmgr', help='--lfmgr <hostname for where LANforge GUI is running>', default='localhost') parser.add_argument('--mgr', '--lfmgr', dest='lfmgr', help='--lfmgr <hostname for where LANforge GUI is running>', default='localhost')
parser.add_argument( parser.add_argument(
'--test_duration', '--test_duration',
help='--test_duration <how long to run> example --time 5d (5 days) default: 3m options: number followed by d, h, m or s', help='--test_duration <how long to run> example --time 5d (5 days) default: 3m options: number followed by d, h, m or s',
@@ -1942,7 +1927,7 @@ python3 .\\test_l3_longevity.py --test_duration 4m --endp_type \"lf_tcp lf_udp m
args = parser.parse_args() args = parser.parse_args()
#print("args: {}".format(args)) # print("args: {}".format(args))
debug = args.debug debug = args.debug
# for kpi.csv generation # for kpi.csv generation
@@ -2113,7 +2098,7 @@ python3 .\\test_l3_longevity.py --test_duration 4m --endp_type \"lf_tcp lf_udp m
radio_reset_found = True radio_reset_found = True
for key in optional_radio_reset_keys: for key in optional_radio_reset_keys:
if key not in radio_info_dict: if key not in radio_info_dict:
#print("port reset test not enabled") # print("port reset test not enabled")
radio_reset_found = False radio_reset_found = False
break break
@@ -2137,7 +2122,7 @@ python3 .\\test_l3_longevity.py --test_duration 4m --endp_type \"lf_tcp lf_udp m
station_lists.append(station_list) station_lists.append(station_list)
index += 1 index += 1
#print("endp-types: %s"%(endp_types)) # print("endp-types: %s"%(endp_types))
ul_rates = args.side_a_min_bps.split(",") ul_rates = args.side_a_min_bps.split(",")
dl_rates = args.side_b_min_bps.split(",") dl_rates = args.side_b_min_bps.split(",")
@@ -2147,14 +2132,14 @@ python3 .\\test_l3_longevity.py --test_duration 4m --endp_type \"lf_tcp lf_udp m
attenuators = [] attenuators = []
else: else:
attenuators = args.attenuators.split(",") attenuators = args.attenuators.split(",")
if (args.atten_vals == ""): if args.atten_vals == "":
atten_vals = [-1] atten_vals = [-1]
else: else:
atten_vals = args.atten_vals.split(",") 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))) 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))) 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( ip_var_test = L3VariableTime(
@@ -2235,7 +2220,7 @@ python3 .\\test_l3_longevity.py --test_duration 4m --endp_type \"lf_tcp lf_udp m
report.set_table_dataframe_from_csv(csv_kpi_file) report.set_table_dataframe_from_csv(csv_kpi_file)
report.build_table() report.build_table()
report.write_html_with_timestamp() report.write_html_with_timestamp()
#report.write_pdf(_page_size = 'A3', _orientation='Landscape') # report.write_pdf(_page_size = 'A3', _orientation='Landscape')
report.write_pdf_with_timestamp(_page_size='A4', _orientation='Portrait') report.write_pdf_with_timestamp(_page_size='A4', _orientation='Portrait')
# ap scheduler results and write to a file # ap scheduler results and write to a file