Skip to content

Commit 0d8d5e3

Browse files
committed
Push before Code review-1
1 parent 2068080 commit 0d8d5e3

1 file changed

Lines changed: 94 additions & 22 deletions

File tree

py-scripts/lf_interop_qos.py

Lines changed: 94 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,13 @@ def __init__(self,
325325
mac_list = []
326326

327327

328-
self.ssid_list = []
328+
self.ssid_list = [] # We will be using these for report generation.
329+
self.macid_list = []
330+
self.mode_list = []
331+
self.bssid_list = []
332+
self.channels_list = []
333+
self.rssi_list = []
334+
329335
self.upstream = upstream
330336
self.host = host
331337
self.port = port
@@ -1657,13 +1663,15 @@ def resolve_client_key(cx_name):
16571663
mode = pdata.get("mode", "-")
16581664
channel = pdata.get("channel", "-")
16591665
bssid = pdata.get("ap", "-")
1666+
ssid = pdata.get("ssid","-")
16601667
port_stats[eid] = {
16611668
"rx": rx, "tx": tx, "rssi": rssi,
16621669
"mode": mode, "channel": channel, "bssid": bssid,
16631670
}
16641671
rates_data[f"{eid} rx_rate"].append(rx)
16651672
rates_data[f"{eid} tx_rate"].append(tx)
16661673
rates_data[f"{eid} RSSI"].append(rssi)
1674+
16671675
except Exception:
16681676
logger.warning("Failed /ports/all/ for Real devices")
16691677

@@ -2299,6 +2307,31 @@ def get_ssid_list(self, station_names):
22992307
print("SSID_List : ",ssid_list)
23002308
return ssid_list
23012309

2310+
def get_portmgr_data(self, device_list):
2311+
ssid_list, mac_list, mode_list, bssid_list, channel_list, rssi_list = [], [], [], [], [], []
2312+
port_json = self.json_get('/port/all')['interfaces']
2313+
for block in port_json:
2314+
for dev, data in block.items():
2315+
if dev not in (device_list):
2316+
continue
2317+
ssid = data.get("ssid","-")
2318+
mode = data.get("mode","-")
2319+
channel = data.get("channel", "-")
2320+
bssid = data.get("ap","-")
2321+
print("Prt mgr ",port_json)
2322+
print("--------------------------------------")
2323+
print("BSSID : ",bssid)
2324+
mac = data.get("mac","-")
2325+
rssi = data.get("signal","-")
2326+
if dev in device_list:
2327+
ssid_list.append(ssid)
2328+
mac_list.append(mac)
2329+
bssid_list.append(bssid)
2330+
channel_list.append(channel)
2331+
mode_list.append(mode)
2332+
rssi_list.append(rssi)
2333+
return ssid_list, mac_list, mode_list, bssid_list, channel_list, rssi_list
2334+
23022335
def generate_report(self, data, input_setup_info,
23032336
connections_download_avg=None, connections_upload_avg=None,
23042337
avg_drop_a=None, avg_drop_b=None,
@@ -2321,19 +2354,8 @@ def generate_report(self, data, input_setup_info,
23212354

23222355
_client_type = getattr(self, '_client_type', 'Real')
23232356

2324-
# SSID list: source depends on client type
2325-
if _client_type == "Both":
2326-
total_devices_list = self.sta_list + self.input_devices_list
2327-
print("We are printing Total Test Devices : ",total_devices_list)
2328-
self.ssid_list = self.get_ssid_list(total_devices_list)
2329-
elif _client_type == 'Virtual':
2330-
print("Station List : ",self.sta_list)
2331-
self.ssid_list = self.get_ssid_list(self.sta_list)
2332-
else:
2333-
print("Input Real Device List : ",self.input_devices_list)
2334-
self.ssid_list = self.get_ssid_list(self.input_devices_list)
2335-
2336-
print("SELF SSID LIST : ", self.ssid_list)
2357+
print("We are printing Port Manager Tab Data : ")
2358+
print(f"{self.ssid_list} --- {self.macid_list} --- {self.mode_list} --- {self.bssid_list} --- {self.channels_list} --- {self.rssi_list}")
23372359

23382360
if selected_real_clients_names is not None: # for real scenario only.
23392361
self.num_stations = selected_real_clients_names
@@ -2746,14 +2768,16 @@ def generate_dataframe(self, groupdevlist, clients_list, mac, ssid, tos, upload,
27462768
if len(clients) != 0:
27472769
bk_dataframe = {
27482770
" Client Name ": clients,
2749-
" MAC ": macids,
2750-
" SSID ": ssids,
2771+
" MAC " : self.macid_list,
2772+
" SSID " : self.ssid_list,
2773+
" BSSID " : self.bssid_list,
2774+
" Channel " : self.channels_list,
2775+
" RSSI " : self.rssi_list,
27512776
" Type of traffic ": tos_a,
27522777
" Offered upload rate(Mbps) ": uploads,
27532778
" Offered download rate(Mbps) ": downloads,
27542779
" Observed average upload rate(Mbps) ": individual_uploads,
27552780
" Observed average download rate(Mbps)": individual_downloads,
2756-
27572781
}
27582782
if self.direction == "Bi-direction":
27592783
bk_dataframe[" Observed Upload Drop (%)"] = individual_b_drop
@@ -2841,8 +2865,8 @@ def generate_individual_graph(self, res, report, connections_download_avg, conne
28412865

28422866
print(f"{_client_list} : {_client_list1} : {_mac_list} : {_n_clients} : {_n_ports}")
28432867
elif _client_type == "Both":
2844-
_client_list = self.real_client_list + self.sta_list
2845-
_client_list1 = self.real_client_list1 + self.sta_list
2868+
_client_list = self.sta_list + self.real_client_list
2869+
_client_list1 = self.sta_list + self.real_client_list1
28462870
_mac_list = self.mac_id_list
28472871
_n_clients = len(_client_list)
28482872
_n_ports = len(self.input_devices_list) + len(self.sta_list)
@@ -3091,6 +3115,11 @@ def generate_individual_graph(self, res, report, connections_download_avg, conne
30913115
else:
30923116
bk_dataframe = {
30933117
" Client Name ": _client_list,
3118+
" MAC " : self.macid_list,
3119+
" SSID " : self.ssid_list,
3120+
" BSSID " : self.bssid_list,
3121+
" Channel " : self.channels_list,
3122+
" RSSI " : self.rssi_list,
30943123
" Type of traffic ": bk_tos_list,
30953124
" Offered upload rate ": upload_list,
30963125
" Offered download rate ": download_list,
@@ -3216,6 +3245,11 @@ def generate_individual_graph(self, res, report, connections_download_avg, conne
32163245
else:
32173246
be_dataframe = {
32183247
" Client Name ": _client_list,
3248+
" MAC " : self.macid_list,
3249+
" SSID " : self.ssid_list,
3250+
" BSSID " : self.bssid_list,
3251+
" Channel " : self.channels_list,
3252+
" RSSI " : self.rssi_list,
32193253
" Type of traffic ": be_tos_list,
32203254
" Offered upload rate ": upload_list,
32213255
" Offered download rate ": download_list,
@@ -3339,6 +3373,11 @@ def generate_individual_graph(self, res, report, connections_download_avg, conne
33393373
else:
33403374
vi_dataframe = {
33413375
" Client Name ": _client_list,
3376+
" MAC " : self.macid_list,
3377+
" SSID " : self.ssid_list,
3378+
" BSSID " : self.bssid_list,
3379+
" Channel " : self.channels_list,
3380+
" RSSI " : self.rssi_list,
33423381
" Type of traffic ": vi_tos_list,
33433382
" Offered upload rate ": upload_list,
33443383
" Offered download rate ": download_list,
@@ -3463,6 +3502,11 @@ def generate_individual_graph(self, res, report, connections_download_avg, conne
34633502
else:
34643503
vo_dataframe = {
34653504
" Client Name ": _client_list,
3505+
" MAC " : self.macid_list,
3506+
" SSID " : self.ssid_list,
3507+
" BSSID " : self.bssid_list,
3508+
" Channel " : self.channels_list,
3509+
" RSSI " : self.rssi_list,
34663510
" Type of traffic ": vo_tos_list,
34673511
" Offered upload rate ": upload_list,
34683512
" Offered download rate ": download_list,
@@ -3515,7 +3559,6 @@ def generate_individual_graph(self, res, report, connections_download_avg, conne
35153559
logger.info(f'failed cx {cx} tos {tos}')
35163560
logger.info(f"Overall Data : {self.real_time_data}")
35173561

3518-
35193562
def _generate_individual_graph_virtual(self, res, report):
35203563
"""
35213564
Individual per-TOS graphs and tables for Virtual stations.
@@ -3558,9 +3601,12 @@ def _safe(lst, fill='-'):
35583601
lst = list(lst) if lst else []
35593602
return (lst + [fill] * n)[:n]
35603603

3561-
mac_list_n = _safe(self.mac_list)
3562-
channel_list_n = _safe(self.channel_list)
3604+
mac_list_n = _safe(self.macid_list)
3605+
channel_list_n = _safe(self.channels_list)
35633606
ssid_list_n = _safe(self.ssid_list)
3607+
rssi_list_n = _safe(self.rssi_list)
3608+
mode_list_n = _safe(self.mode_list)
3609+
bssid_list_n = _safe(self.bssid_list)
35643610

35653611
# Bi-direction running totals — flat lists: [dl_total, ul_total]
35663612
# Matches throughput_qos.py list[0..3] exactly
@@ -3733,6 +3779,10 @@ def _tos_section(tos_key, tos_list):
37333779
" Client Name ": list(self.sta_list),
37343780
" Mac ": mac_list_n,
37353781
" SSID ": ssid_list_n,
3782+
" BSSID ": bssid_list_n,
3783+
" Mode " : mode_list_n,
3784+
" Channel" : channel_list_n,
3785+
" RSSI ": rssi_list_n,
37363786
" Type of traffic ": tos_list,
37373787
" Traffic Direction ": traffic_direction_list,
37383788
" Traffic Protocol ": traffic_type_list,
@@ -5097,6 +5147,28 @@ def any_sta_count():
50975147

50985148
logger.info("connections download {}".format(connections_download))
50995149
logger.info("connections upload {}".format(connections_upload))
5150+
5151+
ssid_list = []
5152+
mac_list = []
5153+
mode_list = []
5154+
bssid_list = []
5155+
channel_list = []
5156+
rssi_list = []
5157+
5158+
if args.client_type == "Both":
5159+
total_devices_list = throughput_qos.sta_list + throughput_qos.input_devices_list
5160+
ssid_list, mac_list, mode_list, bssid_list, channel_list, rssi_list = throughput_qos.get_portmgr_data(total_devices_list)
5161+
throughput_qos.ssid_list, throughput_qos.macid_list, throughput_qos.mode_list, throughput_qos.bssid_list, throughput_qos.channels_list, throughput_qos.rssi_list = ssid_list, mac_list, mode_list, bssid_list, channel_list, rssi_list
5162+
print("We are printing Total Test Devices : ",total_devices_list)
5163+
elif args.client_type == 'Virtual':
5164+
print("Station List : ",throughput_qos.sta_list)
5165+
ssid_list, mac_list, mode_list, bssid_list, channel_list, rssi_list = throughput_qos.get_portmgr_data(throughput_qos.sta_list)
5166+
throughput_qos.ssid_list, throughput_qos.macid_list, throughput_qos.mode_list, throughput_qos.bssid_list, throughput_qos.channels_list, throughput_qos.rssi_list = ssid_list, mac_list, mode_list, bssid_list, channel_list, rssi_list
5167+
else:
5168+
print("Input Real Device List : ",throughput_qos.input_devices_list)
5169+
ssid_list, mac_list, mode_list, bssid_list, channel_list, rssi_list = throughput_qos.get_portmgr_data(throughput_qos.input_devices_list)
5170+
throughput_qos.ssid_list, throughput_qos.macid_list, throughput_qos.mode_list, throughput_qos.bssid_list, throughput_qos.channels_list, throughput_qos.rssi_list = ssid_list, mac_list, mode_list, bssid_list, channel_list, rssi_list
5171+
51005172
throughput_qos.stop()
51015173
time.sleep(5)
51025174
qos_eval = throughput_qos.evaluate_qos(

0 commit comments

Comments
 (0)