From c2b3de190fc0a4d06c2747fed1237057e87dd830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Fri, 4 Sep 2026 13:21:25 +0200 Subject: [PATCH] infamy: route: Make more robust, check if the route is installed If the user set `active_check=True` to route_exist() it just checked if it was selected in zebra, not if it was installed in kernel. If this happens it is an indication of a FRR bug. --- test/case/routing/rip_multihop/test.py | 20 ++++++++++---------- test/infamy/route.py | 9 ++++++++- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/test/case/routing/rip_multihop/test.py b/test/case/routing/rip_multihop/test.py index 1380d72ea..c35d74494 100755 --- a/test/case/routing/rip_multihop/test.py +++ b/test/case/routing/rip_multihop/test.py @@ -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...") diff --git a/test/infamy/route.py b/test/infamy/route.py index b3774a3a4..4cf7b1db8 100644 --- a/test/infamy/route.py +++ b/test/infamy/route.py @@ -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: @@ -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