Commit 84c7a87fa5 for frr

commit 84c7a87fa51e8cf6e7ac7baf7f46ad063b8de67f
Author: Rajasekar Raja <rajasekarr@nvidia.com>
Date:   Sat Nov 14 09:02:02 2026 -0800

    tests: Unset the outbound route-map in bgp_updgrp_merge_race only when set

    Each reset unset the outbound route-map toward c, d and e even when it
    was not configured, which still schedules a re-announce to the whole
    subgroup 500 ms later. If a test had already started, that re-announce
    reached every peer instead of only the one the test split off, so the
    withdraw cases saw their subgroups merge.

    Unset it only when it is configured, and define it once in b's config.

    Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>

diff --git a/tests/topotests/bgp_updgrp_merge_race/b/frr.conf b/tests/topotests/bgp_updgrp_merge_race/b/frr.conf
index 0095a76fc9..15397b83ca 100644
--- a/tests/topotests/bgp_updgrp_merge_race/b/frr.conf
+++ b/tests/topotests/bgp_updgrp_merge_race/b/frr.conf
@@ -39,3 +39,7 @@ route-map FROM-A1 permit 10
  set local-preference 200
 exit
 !
+route-map TO-CD permit 10
+ set community none
+exit
+!
diff --git a/tests/topotests/bgp_updgrp_merge_race/test_bgp_updgrp_merge_race.py b/tests/topotests/bgp_updgrp_merge_race/test_bgp_updgrp_merge_race.py
index b7816f43e9..aba019092f 100644
--- a/tests/topotests/bgp_updgrp_merge_race/test_bgp_updgrp_merge_race.py
+++ b/tests/topotests/bgp_updgrp_merge_race/test_bgp_updgrp_merge_race.py
@@ -374,8 +374,6 @@ def _strip_community(tgen, enable):
     tgen.gears["b"].vtysh_cmd(
         """
         configure terminal
-         route-map TO-CD permit 10
-          set community none
          router bgp 65000
           address-family ipv4 unicast
            {0}neighbor {1} route-map TO-CD out
@@ -387,13 +385,24 @@ def _strip_community(tgen, enable):
     )


+def _route_map_out(b, nbr):
+    output = b.vtysh_cmd("show bgp neighbor {} json".format(nbr), isjson=True)
+    return output[nbr]["addressFamilyInfo"]["ipv4Unicast"].get(
+        "routeMapForOutgoingAdvertisements"
+    )
+
+
 def _reset(tgen):
     b = tgen.gears["b"]
     b.vtysh_cmd("no bgp test metaq disable")
     b.vtysh_cmd("no bgp test updates disable neighbor {}".format(D))
     for nbr in [C, E]:
         _shutdown(tgen, nbr, False)
-    _strip_community(tgen, False)
+    # Unsetting an outbound route-map schedules a re-announce even when none
+    # is set. If that is still pending when a test starts, it re-announces
+    # to the whole subgroup and the test's own split is lost.
+    if any(_route_map_out(b, nbr) for nbr in [C, D, E]):
+        _strip_community(tgen, False)
     _network(tgen, "a1", PFX, True)
     _network(tgen, "a1", BUSY, False)
     _a2_network(tgen, PFX, True)