Skip to content
Open
Show file tree
Hide file tree
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
20 changes: 10 additions & 10 deletions test/case/routing/rip_multihop/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,21 +253,21 @@ def config_r3(target, link, data):
with test.step("Wait for RIP routes to be exchanged"):
print("Waiting for RIP routes to propagate...")
# R1 should learn R2's loopback
until(lambda: route.ipv4_route_exist(R1, "192.168.22.1/32", proto="ietf-rip:rip"), attempts=40)
until(lambda: route.ipv4_route_exist(R1, "192.168.22.1/32", proto="ietf-rip:rip", active_check=True), attempts=40)
# R1 should learn R3's loopback (via R2)
until(lambda: route.ipv4_route_exist(R1, "192.168.33.1/32", proto="ietf-rip:rip"), attempts=40)
until(lambda: route.ipv4_route_exist(R1, "192.168.33.1/32", proto="ietf-rip:rip", active_check=True), attempts=40)
# R2 should learn R1's loopback
until(lambda: route.ipv4_route_exist(R2, "192.168.11.1/32", proto="ietf-rip:rip"), attempts=40)
until(lambda: route.ipv4_route_exist(R2, "192.168.11.1/32", proto="ietf-rip:rip", active_check=True), attempts=40)
# R2 should learn R3's loopback
until(lambda: route.ipv4_route_exist(R2, "192.168.33.1/32", proto="ietf-rip:rip"), attempts=40)
until(lambda: route.ipv4_route_exist(R2, "192.168.33.1/32", proto="ietf-rip:rip", active_check=True), attempts=40)
# R3 should learn R2's loopback
until(lambda: route.ipv4_route_exist(R3, "192.168.22.1/32", proto="ietf-rip:rip"), attempts=40)
until(lambda: route.ipv4_route_exist(R3, "192.168.22.1/32", proto="ietf-rip:rip", active_check=True), attempts=40)
# R3 should learn R1's loopback (via R2)
until(lambda: route.ipv4_route_exist(R3, "192.168.11.1/32", proto="ietf-rip:rip"), attempts=40)
until(lambda: route.ipv4_route_exist(R2, "192.168.10.0/24", proto="ietf-rip:rip"), attempts=40)
until(lambda: route.ipv4_route_exist(R3, "192.168.10.0/24", proto="ietf-rip:rip"), attempts=40)
until(lambda: route.ipv4_route_exist(R2, "192.168.70.0/24", proto="ietf-rip:rip"), attempts=40)
until(lambda: route.ipv4_route_exist(R1, "192.168.70.0/24", proto="ietf-rip:rip"), attempts=40)
until(lambda: route.ipv4_route_exist(R3, "192.168.11.1/32", proto="ietf-rip:rip", active_check=True), attempts=40)
until(lambda: route.ipv4_route_exist(R2, "192.168.10.0/24", proto="ietf-rip:rip", active_check=True), attempts=40)
until(lambda: route.ipv4_route_exist(R3, "192.168.10.0/24", proto="ietf-rip:rip", active_check=True), attempts=40)
until(lambda: route.ipv4_route_exist(R2, "192.168.70.0/24", proto="ietf-rip:rip", active_check=True), attempts=40)
until(lambda: route.ipv4_route_exist(R1, "192.168.70.0/24", proto="ietf-rip:rip", active_check=True), attempts=40)

with test.step("Verify R2 has two RIP neighbors"):
print("Checking R2 has two RIP neighbors...")
Expand Down
9 changes: 8 additions & 1 deletion test/infamy/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ def _get_routes(target, protocol):
return r.get("routes", {}).get("route", {})
return {}

def _installed(route):
"""True if at least one next-hop of the route is installed in the FIB"""
nh = route.get("next-hop", {})
hops = nh.get("next-hop-list", {}).get("next-hop", [nh])
return any("installed" in h or "infix-routing:installed" in h for h in hops)


def _exist_route(target, dest, nexthop=None, ip=None, proto=None, pref=None, active_check=False):
routes = _get_routes(target, ip)
for r in routes:
Expand Down Expand Up @@ -41,7 +48,7 @@ def _exist_route(target, dest, nexthop=None, ip=None, proto=None, pref=None, act
if nh_addr != nexthop:
continue

if active_check and "active" not in r:
if active_check and ("active" not in r or not _installed(r)):
continue

return True
Expand Down
Loading