mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-03 04:07:52 +00:00
lf_check.py : saving meta data file
test_l3_longevity : adding per endpoint rx_rate rx_rate_ll rx_pkts_ll Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
@@ -289,7 +289,12 @@ class L3VariableTime(Realm):
|
|||||||
def get_endp_stats_for_port(self, eid_name, endps):
|
def get_endp_stats_for_port(self, eid_name, endps):
|
||||||
lat = 0
|
lat = 0
|
||||||
jit = 0
|
jit = 0
|
||||||
tput = 0
|
total_dl_rx_rate = 0
|
||||||
|
total_dl_rx_rate_ll = 0
|
||||||
|
total_dl_rx_pkts_ll = 0
|
||||||
|
total_ul_rx_rate = 0
|
||||||
|
total_ul_rx_rate_ll = 0
|
||||||
|
total_ul_rx_pkts_ll = 0
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
#print("endp-stats-for-port, port-eid: {}".format(eid_name))
|
#print("endp-stats-for-port, port-eid: {}".format(eid_name))
|
||||||
@@ -300,9 +305,9 @@ class L3VariableTime(Realm):
|
|||||||
eid[1] = str(eid[1])
|
eid[1] = str(eid[1])
|
||||||
eid[2] = str(eid[2])
|
eid[2] = str(eid[2])
|
||||||
|
|
||||||
for e in endps:
|
for endp in endps:
|
||||||
#pprint(e)
|
pprint(endp)
|
||||||
eid_endp = e["eid"].split(".")
|
eid_endp = endp["eid"].split(".")
|
||||||
print("Comparing eid: ", eid, " to endp-id: ", eid_endp)
|
print("Comparing eid: ", eid, " to endp-id: ", eid_endp)
|
||||||
# Look through all the endpoints (endps), to find the port the eid_name is using.
|
# Look through all the endpoints (endps), to find the port the eid_name is using.
|
||||||
# The eid_name that has the same Shelf, Resource, and Port as the eid_endp (looking at all the endps)
|
# The eid_name that has the same Shelf, Resource, and Port as the eid_endp (looking at all the endps)
|
||||||
@@ -310,9 +315,18 @@ class L3VariableTime(Realm):
|
|||||||
# Note: the endp eid is shelf.resource.port.endp-id, the eid can be treated somewhat as
|
# Note: the endp eid is shelf.resource.port.endp-id, the eid can be treated somewhat as
|
||||||
# child class of port-eid , and look up the port the eid is using.
|
# child class of port-eid , and look up the port the eid is using.
|
||||||
if eid[0] == eid_endp[0] and eid[1] == eid_endp[1] and eid[2] == eid_endp[2]:
|
if eid[0] == eid_endp[0] and eid[1] == eid_endp[1] and eid[2] == eid_endp[2]:
|
||||||
lat += int(e["delay"])
|
lat += int(endp["delay"])
|
||||||
jit += int(e["jitter"])
|
jit += int(endp["jitter"])
|
||||||
tput += int(e["rx rate"])
|
name = endp["name"]
|
||||||
|
if name.endswith("-A"):
|
||||||
|
total_dl_rx_rate += int(endp["rx rate"])
|
||||||
|
total_dl_rx_rate_ll += int(endp["rx rate ll"])
|
||||||
|
total_dl_rx_pkts_ll += int(endp["rx pkts ll"])
|
||||||
|
else:
|
||||||
|
total_ul_rx_rate += int(endp["rx rate"])
|
||||||
|
total_ul_rx_rate_ll += int(endp["rx rate ll"])
|
||||||
|
total_ul_rx_pkts_ll += int(endp["rx pkts ll"])
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
print("matched: ")
|
print("matched: ")
|
||||||
else:
|
else:
|
||||||
@@ -322,12 +336,12 @@ class L3VariableTime(Realm):
|
|||||||
lat = int(lat / count)
|
lat = int(lat / count)
|
||||||
jit = int(jit / count)
|
jit = int(jit / count)
|
||||||
|
|
||||||
return lat, jit, tput
|
return lat, jit, total_dl_rx_rate, total_dl_rx_rate_ll, total_dl_rx_pkts_ll, total_ul_rx_rate, total_ul_rx_rate_ll, total_ul_rx_pkts_ll
|
||||||
|
|
||||||
# Query all endpoints to generate rx and other stats, returned
|
# Query all endpoints to generate rx and other stats, returned
|
||||||
# as an array of objects.
|
# as an array of objects.
|
||||||
def __get_rx_values(self):
|
def __get_rx_values(self):
|
||||||
endp_list = self.json_get("endp?fields=name,eid,delay,jitter,rx+rate,rx+rate+ll,rx+bytes,rx+drop+%25", debug_=False)
|
endp_list = self.json_get("endp?fields=name,eid,delay,jitter,rx+rate,rx+rate+ll,rx+bytes,rx+drop+%25,rx+pkts+ll", debug_=False)
|
||||||
endp_rx_drop_map = {}
|
endp_rx_drop_map = {}
|
||||||
endp_rx_map = {}
|
endp_rx_map = {}
|
||||||
our_endps = {}
|
our_endps = {}
|
||||||
@@ -349,10 +363,16 @@ class L3VariableTime(Realm):
|
|||||||
endps.append(value)
|
endps.append(value)
|
||||||
print("endpoint: ", item, " value:\n")
|
print("endpoint: ", item, " value:\n")
|
||||||
pprint(value)
|
pprint(value)
|
||||||
|
|
||||||
for value_name, value in value.items():
|
for value_name, value in value.items():
|
||||||
if value_name == 'rx bytes':
|
if value_name == 'rx bytes':
|
||||||
endp_rx_map[item] = value
|
endp_rx_map[item] = value
|
||||||
|
if value_name == 'rx rate':
|
||||||
|
endp_rx_map[item] = value
|
||||||
|
if value_name == 'rx rate ll':
|
||||||
|
endp_rx_map[item] = value
|
||||||
|
if value_name == 'rx pkts ll':
|
||||||
|
endp_rx_map[item] = value
|
||||||
if value_name == 'rx drop %':
|
if value_name == 'rx drop %':
|
||||||
endp_rx_drop_map[item] = value
|
endp_rx_drop_map[item] = value
|
||||||
if value_name == 'rx rate':
|
if value_name == 'rx rate':
|
||||||
@@ -755,7 +775,7 @@ class L3VariableTime(Realm):
|
|||||||
print("selected ap_row (from split_row): {}".format(ap_row))
|
print("selected ap_row (from split_row): {}".format(ap_row))
|
||||||
|
|
||||||
# Find latency, jitter for connections using this port.
|
# Find latency, jitter for connections using this port.
|
||||||
latency, jitter, tput = self.get_endp_stats_for_port(p["port"], endps)
|
latency, jitter, total_ul_rx_rate, total_ul_rx_rate_ll, total_ul_rx_pkts_ll, total_dl_rx_rate, total_dl_rx_rate_ll, total_dl_rx_pkts_ll = self.get_endp_stats_for_port(p["port"], endps)
|
||||||
|
|
||||||
# now report the ap_chanim_stats along side of the ap_stats_5g
|
# now report the ap_chanim_stats along side of the ap_stats_5g
|
||||||
xtop_reported = False
|
xtop_reported = False
|
||||||
@@ -783,7 +803,8 @@ class L3VariableTime(Realm):
|
|||||||
ap_stats_5g_col_titles = ['Station Address','PHY Mbps','Data Mbps','Air Use','Data Use','Retries','bw','mcs','Nss','ofdma','mu-mimo','channel_utilization']
|
ap_stats_5g_col_titles = ['Station Address','PHY Mbps','Data Mbps','Air Use','Data Use','Retries','bw','mcs','Nss','ofdma','mu-mimo','channel_utilization']
|
||||||
|
|
||||||
self.write_port_csv(len(temp_stations_list), ul, dl, ul_pdu_str, dl_pdu_str, atten_val, eid_name, p,
|
self.write_port_csv(len(temp_stations_list), ul, dl, ul_pdu_str, dl_pdu_str, atten_val, eid_name, p,
|
||||||
latency, jitter, tput, ap_row, ap_stats_5g_col_titles) #ap_stats_5g_col_titles used as a length
|
latency, jitter, total_ul_rx_rate, total_ul_rx_rate_ll, total_ul_rx_pkts_ll,
|
||||||
|
total_dl_rx_rate, total_dl_rx_rate_ll, total_dl_rx_pkts_ll , ap_row, ap_stats_5g_col_titles) #ap_stats_5g_col_titles used as a length
|
||||||
if self.ap_test_mode:
|
if self.ap_test_mode:
|
||||||
# Create the test data as a continuous string
|
# Create the test data as a continuous string
|
||||||
ap_stats_2g="{}{}{}{}{}{}".format("root@Docsis-Gateway:~# wl -i wl1 bs_data\n",
|
ap_stats_2g="{}{}{}{}{}{}".format("root@Docsis-Gateway:~# wl -i wl1 bs_data\n",
|
||||||
@@ -855,7 +876,7 @@ class L3VariableTime(Realm):
|
|||||||
print("selected ap_row (from split_row): {}".format(ap_row))
|
print("selected ap_row (from split_row): {}".format(ap_row))
|
||||||
|
|
||||||
# Find latency, jitter for connections using this port.
|
# Find latency, jitter for connections using this port.
|
||||||
latency, jitter, tput = self.get_endp_stats_for_port(p["port"], endps)
|
latency, jitter, total_ul_rx_rate, total_ul_rx_rate_ll, total_ul_rx_pkts_ll, total_dl_rx_rate, total_dl_rx_rate_ll, total_dl_rx_pkts_ll = self.get_endp_stats_for_port(p["port"], endps)
|
||||||
|
|
||||||
# now report the ap_chanim_stats along side of the ap_stats_2g
|
# now report the ap_chanim_stats along side of the ap_stats_2g
|
||||||
xtop_reported = False
|
xtop_reported = False
|
||||||
@@ -883,7 +904,8 @@ class L3VariableTime(Realm):
|
|||||||
ap_stats_2g_col_titles = ['Station Address','PHY Mbps','Data Mbps','Air Use','Data Use','Retries','bw','mcs','Nss','ofdma','mu-mimo','channel_utilization']
|
ap_stats_2g_col_titles = ['Station Address','PHY Mbps','Data Mbps','Air Use','Data Use','Retries','bw','mcs','Nss','ofdma','mu-mimo','channel_utilization']
|
||||||
|
|
||||||
self.write_port_csv(len(temp_stations_list), ul, dl, ul_pdu_str, dl_pdu_str, atten_val, eid_name, p,
|
self.write_port_csv(len(temp_stations_list), ul, dl, ul_pdu_str, dl_pdu_str, atten_val, eid_name, p,
|
||||||
latency, jitter, tput, ap_row, ap_stats_2g_col_titles) #ap_stats_2g_col_titles used as a length
|
latency, jitter, total_ul_rx_rate, total_ul_rx_rate_ll, total_ul_rx_pkts_ll,
|
||||||
|
total_dl_rx_rate, total_dl_rx_rate_ll, total_dl_rx_pkts_ll, ap_row, ap_stats_2g_col_titles) #ap_stats_2g_col_titles used as a length
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
@@ -899,10 +921,11 @@ class L3VariableTime(Realm):
|
|||||||
pprint(response)
|
pprint(response)
|
||||||
else:
|
else:
|
||||||
p = response['interface']
|
p = response['interface']
|
||||||
latency, jitter, tput = self.get_endp_stats_for_port(p["port"], endps)
|
latency, jitter, total_ul_rx_rate, total_ul_rx_rate_ll, total_ul_rx_pkts_ll, total_dl_rx_rate, total_dl_rx_rate_ll, total_dl_rx_pkts_ll= self.get_endp_stats_for_port(p["port"], endps)
|
||||||
|
|
||||||
self.write_port_csv(len(temp_stations_list), ul, dl, ul_pdu_str, dl_pdu_str, atten_val, eid_name, p,
|
self.write_port_csv(len(temp_stations_list), ul, dl, ul_pdu_str, dl_pdu_str, atten_val, eid_name, p,
|
||||||
latency, jitter, tput, ap_row, ap_stats_col_titles) #ap_stats_col_titles used as a length
|
latency, jitter, total_ul_rx_rate, total_ul_rx_rate_ll, total_ul_rx_pkts_ll,
|
||||||
|
total_dl_rx_rate, total_dl_rx_rate_ll, total_dl_rx_pkts_ll, ap_row, ap_stats_col_titles) #ap_stats_col_titles used as a length
|
||||||
|
|
||||||
|
|
||||||
# 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
|
||||||
@@ -931,15 +954,15 @@ class L3VariableTime(Realm):
|
|||||||
if passes == expected_passes:
|
if passes == expected_passes:
|
||||||
self._pass("PASS: Requested-Rate: %s <-> %s PDU: %s <-> %s All tests passed" % (ul, dl, ul_pdu, dl_pdu), print_pass)
|
self._pass("PASS: Requested-Rate: %s <-> %s PDU: %s <-> %s All tests passed" % (ul, dl, ul_pdu, dl_pdu), print_pass)
|
||||||
|
|
||||||
def write_port_csv(self, sta_count, ul, dl, ul_pdu, dl_pdu, atten, eid_name, port_data, latency, jitter, tput,
|
def write_port_csv(self, sta_count, ul, dl, ul_pdu, dl_pdu, atten, eid_name, port_data, latency, jitter, total_ul_rx_rate, total_ul_rx_rate_ll, total_ul_rx_pkts_ll,
|
||||||
ap_row, ap_stats_col_titles):
|
total_dl_rx_rate, total_dl_rx_rate_ll, total_dl_rx_pkts_ll, ap_row, ap_stats_col_titles):
|
||||||
row = [self.epoch_time, self.time_stamp(), sta_count,
|
row = [self.epoch_time, self.time_stamp(), sta_count,
|
||||||
ul, ul, dl, dl, dl_pdu, dl_pdu, ul_pdu, ul_pdu,
|
ul, ul, dl, dl, dl_pdu, dl_pdu, ul_pdu, ul_pdu,
|
||||||
atten, eid_name
|
atten, eid_name
|
||||||
]
|
]
|
||||||
|
|
||||||
row = row + [port_data['bps rx'], port_data['bps tx'], port_data['rx-rate'], port_data['tx-rate'],
|
row = row + [port_data['bps rx'], port_data['bps tx'], port_data['rx-rate'], port_data['tx-rate'],
|
||||||
port_data['signal'], port_data['ap'], port_data['mode'], latency, jitter, tput]
|
port_data['signal'], port_data['ap'], port_data['mode'], latency, jitter, total_ul_rx_rate, total_ul_rx_rate_ll, total_ul_rx_pkts_ll, total_dl_rx_rate, total_dl_rx_rate_ll, total_dl_rx_pkts_ll]
|
||||||
|
|
||||||
#Add in info queried from AP. NOTE: do not need to pass in the ap_stats_col_titles
|
#Add in info queried from AP. NOTE: do not need to pass in the ap_stats_col_titles
|
||||||
#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)))
|
||||||
@@ -1023,7 +1046,7 @@ class L3VariableTime(Realm):
|
|||||||
'UL-Min-Requested','UL-Max-Requested','DL-Min-Requested','DL-Max-Requested',
|
'UL-Min-Requested','UL-Max-Requested','DL-Min-Requested','DL-Max-Requested',
|
||||||
'UL-Min-PDU','UL-Max-PDU','DL-Min-PDU','DL-Max-PDU','Attenuation',
|
'UL-Min-PDU','UL-Max-PDU','DL-Min-PDU','DL-Max-PDU','Attenuation',
|
||||||
'Name', 'Rx-Bps', 'Tx-Bps', 'Rx-Link-Rate', 'Tx-Link-Rate', 'RSSI', 'AP', 'Mode',
|
'Name', 'Rx-Bps', 'Tx-Bps', 'Rx-Link-Rate', 'Tx-Link-Rate', 'RSSI', 'AP', 'Mode',
|
||||||
'Rx-Latency', 'Rx-Jitter', 'Rx-Goodput-Bps'
|
'Rx-Latency', 'Rx-Jitter', 'Ul-Rx-Goodput-bps', 'Ul-Rx-Rate-ll', 'Ul-Rx-Pkts-ll', 'Dl-Rx-Goodput-bps', 'Dl-Rx-Rate-ll', 'Dl-Rx-Pkts-ll'
|
||||||
]
|
]
|
||||||
# Add in columns we are going to query from the AP
|
# Add in columns we are going to query from the AP
|
||||||
for col in self.ap_stats_col_titles:
|
for col in self.ap_stats_col_titles:
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ class lf_check():
|
|||||||
self.host_ip_test = None
|
self.host_ip_test = None
|
||||||
self.email_title_txt = ""
|
self.email_title_txt = ""
|
||||||
self.email_txt = ""
|
self.email_txt = ""
|
||||||
|
self.meta_data_path = ""
|
||||||
|
|
||||||
# lanforge configuration
|
# lanforge configuration
|
||||||
self.lf_mgr_ip = "192.168.0.102"
|
self.lf_mgr_ip = "192.168.0.102"
|
||||||
@@ -293,7 +294,6 @@ class lf_check():
|
|||||||
radio_status = self.json_get("/radiostatus/all")
|
radio_status = self.json_get("/radiostatus/all")
|
||||||
print("radio status {radio_status}".format(radio_status=radio_status))
|
print("radio status {radio_status}".format(radio_status=radio_status))
|
||||||
|
|
||||||
|
|
||||||
# NOT complete : will send the email results
|
# NOT complete : will send the email results
|
||||||
def send_results_email(self, report_file=None):
|
def send_results_email(self, report_file=None):
|
||||||
if (report_file is None):
|
if (report_file is None):
|
||||||
@@ -1016,6 +1016,35 @@ NOTE: Diagrams are links in dashboard""".format(ip_qa=ip,qa_url=qa_url)
|
|||||||
self.duration = "{day}d {seconds}s {msec} ms".format(
|
self.duration = "{day}d {seconds}s {msec} ms".format(
|
||||||
day=time_delta.days,seconds=time_delta.seconds,msec=time_delta.microseconds)
|
day=time_delta.days,seconds=time_delta.seconds,msec=time_delta.microseconds)
|
||||||
|
|
||||||
|
# If collect meta data is set
|
||||||
|
meta_data_path = ""
|
||||||
|
if self.test_result != "TIMEOUT":
|
||||||
|
stdout_log_size = os.path.getsize(stdout_log_txt)
|
||||||
|
if stdout_log_size > 0:
|
||||||
|
stdout_log_fd = open(stdout_log_txt)
|
||||||
|
#"Report Location:::/home/lanforge/html-reports/wifi-capacity-2021-08-17-04-02-56"
|
||||||
|
#
|
||||||
|
for line in stdout_log_fd:
|
||||||
|
if "Report Location" in line:
|
||||||
|
meta_data_path = line.replace('"','')
|
||||||
|
meta_data_path = meta_data_path.replace('Report Location:::','')
|
||||||
|
meta_data_path = meta_data_path.split('/')[-1]
|
||||||
|
meta_data_path = meta_data_path.strip()
|
||||||
|
meta_data_path = self.report_path + '/' + meta_data_path + '/meta.txt'
|
||||||
|
break
|
||||||
|
stdout_log_fd.close()
|
||||||
|
if meta_data_path != "":
|
||||||
|
meta_data = open(meta_data_path,'w')
|
||||||
|
meta_data.write('$Generated by Candela Technologies LANforge network testing tool \n')
|
||||||
|
meta_data.write('$meta.txt \n')
|
||||||
|
meta_data.write("file {path} \n".format(path=meta_data_path))
|
||||||
|
# split command at test-tag , at rest of string once at the actual test-tag value
|
||||||
|
test_tag = command.split('test-tag',maxsplit=1)[-1].split(maxsplit=1)[0]
|
||||||
|
meta_data.write("Test_Tag {test_tag} \n".format(test_tag=test_tag))
|
||||||
|
meta_data.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if self.test_result != "TIMEOUT":
|
if self.test_result != "TIMEOUT":
|
||||||
stderr_log_size = os.path.getsize(stderr_log_txt)
|
stderr_log_size = os.path.getsize(stderr_log_txt)
|
||||||
if stderr_log_size > 0:
|
if stderr_log_size > 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user