Skip to content
Open
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: 7 additions & 7 deletions tests/route/test_default_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def is_in_neighbor(neigh_types, neigh_name):
return False


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 @@ -73,14 +73,14 @@ def get_upstream_neigh(tb, device_neigh_metadata):
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 @@ -125,10 +125,10 @@ 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")

upstream_neigh = {k: v for k, v in upstream_neigh.items() if any(upstream_neigh.get(k))}
if af == 'ipv4':
upstream_neigh_ip = set([upstream_neigh[neigh][0]
for neigh in upstream_neigh])
Expand Down