Skip to content

Commit 83065b9

Browse files
Renusree-ctgoyalsaurabh06
authored andcommitted
lf_interop_throughput.py: Eliminate missing CXs before cleanup
VERIFIED_CLI : python3 lf_interop_throughput.py --mgr 192.168.245.117 --mgr_port 8080 --security wpa2 --upstream_port eth1 --test_duration 1m --download 1000000 --traffic_type lf_udp --incremental_capacity 1,2 Signed-off-by: Renusree-ct <renusree.rayavarapu@candelatech.com>
1 parent e7c5367 commit 83065b9

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

py-scripts/lf_interop_throughput.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,13 +1390,31 @@ def stop(self):
13901390
self.station_profile.admin_down()
13911391

13921392
def remove_missing_cx(self):
1393-
"""Drop CXs still marked missing out of created_cx so stop()/cleanup() skip them."""
1394-
if not self.missing_cx_logged or not self.cx_profile.created_cx:
1393+
"""Remove locally tracked CXs absent from the current Layer-3 CX list."""
1394+
# Refresh Layer-3 CX availability before modifying the local CX profile.
1395+
if not self.cx_profile.created_cx:
13951396
return
1396-
missing_cxs = set(self.missing_cx_logged).intersection(self.cx_profile.created_cx.keys())
1397+
try:
1398+
cx_response = self.json_get('/cx/all')
1399+
except Exception as error:
1400+
logger.warning("Unable to refresh the Layer-3 CX list before cleanup: %s", error)
1401+
return
1402+
if not isinstance(cx_response, dict) or not cx_response:
1403+
logger.warning("Unable to refresh the Layer-3 CX list before cleanup; unexpected response: %s", cx_response)
1404+
return
1405+
created_cxs = set(self.cx_profile.created_cx.keys())
1406+
metadata_keys = {'handler', 'uri', 'buttons', 'empty'}
1407+
available_cxs = set(cx_response.keys()) - metadata_keys
1408+
for value in cx_response.values():
1409+
entries = value if isinstance(value, list) else [value]
1410+
for entry in entries:
1411+
if isinstance(entry, dict) and entry.get('name'):
1412+
available_cxs.add(entry['name'])
1413+
available_cxs.intersection_update(created_cxs)
1414+
missing_cxs = created_cxs - available_cxs
13971415
if missing_cxs:
13981416
logger.warning(
1399-
"Excluding %s missing CX(s) because endpoints were unavailable: %s",
1417+
"Excluding %s CX(s) missing from the current Layer-3 response: %s",
14001418
len(missing_cxs), sorted(missing_cxs)
14011419
)
14021420
for cx in missing_cxs:

0 commit comments

Comments
 (0)