Commit 73b94ff56b for frr
commit 73b94ff56b71f93199e031ee2f5848e44b808da1
Author: Donald Sharp <sharpd@nvidia.com>
Date: Thu Oct 15 10:32:54 2026 -0400
tests: Ensure NHG is in kernel before proceeding
I am getting occassional failures where the test
ensures that the NHG is in the zebra rib and then
immediately attempts to manually delete the kernel
version, but the kernel version hasn't arrived yet
due to load. Ensure that the nhg is in the kernel
too.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
diff --git a/tests/topotests/zebra_kernel_nhg/test_zebra_kernel_nhg.py b/tests/topotests/zebra_kernel_nhg/test_zebra_kernel_nhg.py
index ff85da2108..61cdc3399a 100644
--- a/tests/topotests/zebra_kernel_nhg/test_zebra_kernel_nhg.py
+++ b/tests/topotests/zebra_kernel_nhg/test_zebra_kernel_nhg.py
@@ -99,6 +99,11 @@ def _get_frr_owned_nhg_ids(r1, prefix):
carrying the gateway. Kernel replace/delete of the group id as a
`via` object is rejected (Invalid argument), so tests that mutate
the kernel object must target the singleton.
+
+ Both IDs must already exist in the kernel. Zebra's RIB exposes them
+ while the dataplane install is still queued, and `ip nexthop del`
+ of a missing id fails with ENOENT. `ip nexthop show id` returns
+ that same netlink error when the id is absent.
"""
group_id = _get_route_nhg_id(r1, prefix)
if group_id is None:
@@ -141,6 +146,16 @@ def _get_frr_owned_nhg_ids(r1, prefix):
)
return None
+ for nhg_id in (group_id, singleton_id):
+ rc, _, err = r1.net.cmd_status(f"ip nexthop show id {nhg_id}", warn=False)
+ if rc:
+ logger.info(
+ "Kernel NHG %s is not installed: %s",
+ nhg_id,
+ (err or "").strip(),
+ )
+ return None
+
return (group_id, singleton_id)