Commit cf84a2703c for frr

commit cf84a2703c0219a16a97d2592ac06743779cbdaf
Author: Philippe Guibert <philippe.guibert@6wind.com>
Date:   Thu Oct 22 15:46:45 2026 +0200

    topotests: bgp_srv6_unicast, check locator after zebra restart

    Add a test that stops zebra on r1 while bgpd keeps running. The locator
    may no longer exist when zebra is started again: the stop of zebra must
    force bgp to forget it. The test checks that the locator is no longer
    displayed in 'show bgp segment-routing srv6' while zebra is stopped,
    then starts zebra again, and checks that bgp gets the locator again.

    Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>

diff --git a/tests/topotests/bgp_srv6_unicast/test_bgp_srv6_unicast.py b/tests/topotests/bgp_srv6_unicast/test_bgp_srv6_unicast.py
index 0e11610557..e41f78b44d 100644
--- a/tests/topotests/bgp_srv6_unicast/test_bgp_srv6_unicast.py
+++ b/tests/topotests/bgp_srv6_unicast/test_bgp_srv6_unicast.py
@@ -39,8 +39,10 @@ sys.path.append(os.path.join(CWD, "../"))

 from lib.common_config import (
     create_interface_in_kernel,
+    kill_router_daemons,
     retry,
     shutdown_bringup_interface_in_kernel,
+    start_router_daemons,
 )
 from lib import topotest
 from lib.topogen import Topogen, get_topogen
@@ -1323,6 +1325,42 @@ def test_bgp_srv6_vrf_instance_delete():
     )


+def test_bgp_srv6_locator_zebra_restart():
+    """
+    Stop zebra on r1 while bgpd keeps running: bgp must forget the 'default'
+    locator, which may no longer exist when zebra is started again. Then
+    start zebra again, and check that bgp gets the locator again.
+    """
+    tgen = get_topogen()
+
+    if tgen.routers_have_failure():
+        pytest.skip(tgen.errors)
+
+    r1 = tgen.gears["r1"]
+
+    @retry(retry_timeout=30)
+    def check_bgp_locator_prefix(expect_present):
+        output = r1.vtysh_cmd("show bgp segment-routing srv6")
+        if ("prefix: 2001:db8:1:1::/64" in output) != expect_present:
+            return f"unexpected locator prefix in:\n{output}"
+        return True
+
+    result = check_bgp_locator_prefix(True)
+    assert result is True, result
+
+    kill_router_daemons(tgen, "r1", ["zebra"])
+
+    output = r1.vtysh_cmd("show bgp segment-routing srv6")
+    logger.info(output)
+    result = check_bgp_locator_prefix(False)
+    assert result is True, result
+
+    start_router_daemons(tgen, "r1", ["zebra"])
+
+    result = check_bgp_locator_prefix(True)
+    assert result is True, result
+
+
 def teardown_module(mod):
     tgen = get_topogen()
     tgen.stop_topology()