Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions tests/route/test_default_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def ignore_expected_loganalyzer_exception(loganalyzer, duthosts):
return None


def get_upstream_neigh(tb, device_neigh_metadata):
def get_upstream_neigh(tb, device_neigh_metadata, af, nexthops):
"""
Get the information for upstream neighbors present in the testbed

Expand All @@ -54,21 +54,19 @@ def get_upstream_neigh(tb, device_neigh_metadata):
for neigh_name, neigh_cfg in list(topo_cfg_facts.items()):
if neigh_type not in neigh_name:
continue
if neigh_type == 'T3' and device_neigh_metadata[neigh_name]['type'] == 'AZNGHub':
continue
interfaces = neigh_cfg.get('interfaces', {})
ipv4_addr = None
ipv6_addr = None
for intf, intf_cfg in list(interfaces.items()):
if 'Port-Channel' in intf:
if 'ipv4' in intf_cfg:
if 'ipv4' in intf_cfg and af in intf_cfg and interfaces[intf]['ipv4'].split('/')[0] in nexthops:
ipv4_addr = interfaces[intf]['ipv4'].split('/')[0]
if 'ipv6' in intf_cfg:
if 'ipv6' in intf_cfg and af in intf_cfg and interfaces[intf]['ipv6'].split('/')[0].lower() in nexthops:
ipv6_addr = interfaces[intf]['ipv6'].split('/')[0]
elif 'Ethernet' in intf:
if 'ipv4' in intf_cfg:
if 'ipv4' in intf_cfg and af in intf_cfg and interfaces[intf]['ipv4'].split('/')[0] in nexthops:
ipv4_addr = interfaces[intf]['ipv4']
if 'ipv6' in intf_cfg:
if 'ipv6' in intf_cfg and af in intf_cfg and interfaces[intf]['ipv6'].split('/')[0].lower() in nexthops:
ipv6_addr = interfaces[intf]['ipv6']
else:
continue
Expand Down Expand Up @@ -113,7 +111,7 @@ def verify_default_route_in_app_db(duthost, tbinfo, af, uplink_ns, device_neigh_
pytest_assert(nexthops is not None, "Default route has not nexthops")
logging.info("nexthops in app_db {}".format(nexthops))

upstream_neigh = get_upstream_neigh(tbinfo, device_neigh_metadata)
upstream_neigh = get_upstream_neigh(tbinfo, device_neigh_metadata, af, nexthops)
pytest_assert(upstream_neigh is not None,
"No upstream neighbors in the testbed")

Expand Down