Commit e7334f98b3 for frr
commit e7334f98b32242cdce58f9b9fe527d4d4c263edf
Author: Akhilesh Akhade <aakhade@nvidia.com>
Date: Mon Nov 2 18:51:41 2026 +0200
tests: check the Explicit Wide LIB stays inside the Wide LIB
Verify that each of the four commands that move the Wide LIB or the
Explicit Wide LIB refuses to leave the latter starting below the former,
and that the rejected values never reach the running configuration.
Drive usid-f4816, which no locator in this topology is attached to, so
moving its ranges does not tear down and re-add the allocated SIDs.
Signed-off-by: Akhilesh Akhade <aakhade@nvidia.com>
diff --git a/tests/topotests/srv6_sid_manager/test_srv6_sid_manager.py b/tests/topotests/srv6_sid_manager/test_srv6_sid_manager.py
index c659092226..58e66d88c6 100644
--- a/tests/topotests/srv6_sid_manager/test_srv6_sid_manager.py
+++ b/tests/topotests/srv6_sid_manager/test_srv6_sid_manager.py
@@ -429,6 +429,97 @@ format usid-f3216
assert "wide-local-id-block start 401 end 400" not in output
+def test_usid_wide_lib_explicit_range():
+ """
+ Verify the Explicit Wide LIB is kept inside the Wide LIB.
+
+ The Explicit Wide LIB is the tail of the Wide LIB and has no end of its
+ own, so the only way to misconfigure it is to leave its start below the
+ Wide LIB start. The Wide LIB is an array indexed by the offset of a SID
+ function from that start, so a function in the gap would index outside
+ the array.
+
+ Use usid-f4816, which no locator in this topology is attached to, so
+ moving its ranges around does not disturb the allocated SIDs.
+ """
+ tgen = get_topogen()
+
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ router = tgen.gears["rt1"]
+
+ format_context = """configure terminal
+segment-routing
+srv6
+formats
+format usid-f4816
+"""
+
+ output = router.vtysh_cmd(format_context + "wide-local-id-block explicit start 0\n")
+ assert (
+ "Explicit Wide LIB start (0) cannot be less than Wide LIB start (65520)"
+ in output
+ )
+
+ # The Wide LIB cannot move up and leave the Explicit Wide LIB behind
+ output = router.vtysh_cmd(
+ format_context
+ + """wide-local-id-block start 0 end 2000
+wide-local-id-block explicit start 500
+wide-local-id-block start 1000 end 1010
+"""
+ )
+ assert (
+ "Wide LIB start (1000) cannot be greater than the Explicit Wide LIB start (500)"
+ in output
+ )
+
+ # Nor can it move back up by being reset to its default
+ output = router.vtysh_cmd(format_context + "no wide-local-id-block\n")
+ assert (
+ "Default Wide LIB start (65520) would be greater than the Explicit Wide LIB start (500)"
+ in output
+ )
+
+ output = router.vtysh_cmd("write terminal")
+ assert "wide-local-id-block explicit start 0" not in output
+ assert "wide-local-id-block start 1000 end 1010" not in output
+ assert "wide-local-id-block start 0 end 2000" in output
+ assert "wide-local-id-block explicit start 500" in output
+
+ # Removing the Explicit Wide LIB first is the way out
+ router.vtysh_cmd(
+ format_context
+ + """no wide-local-id-block explicit
+no wide-local-id-block
+"""
+ )
+
+ # Resetting the Explicit Wide LIB cannot drop it below the Wide LIB either
+ output = router.vtysh_cmd(
+ format_context
+ + """wide-local-id-block explicit start 70000
+wide-local-id-block start 70000 end 80000
+no wide-local-id-block explicit
+"""
+ )
+ assert (
+ "Default Explicit Wide LIB start (65527) would be less than the Wide LIB start (70000)"
+ in output
+ )
+
+ router.vtysh_cmd(
+ format_context
+ + """no wide-local-id-block
+no wide-local-id-block explicit
+"""
+ )
+
+ output = router.vtysh_cmd("write terminal")
+ assert "wide-local-id-block" not in output
+
+
# Memory leak test template
def test_memory_leak():
"Run the memory leak test and report results."