Commit 78c1706593 for frr

commit 78c1706593e515c84079e08cae153b90fc78396e
Author: Nageswara Soma <nsoma@cisco.com>
Date:   Wed Nov 18 20:35:13 2026 -0800

    tests: cover same-RD IMET PMSI update

    Existing coverage does not exercise PMSI changes on
    the same IMET RD and NLRI. Such updates can leave
    zebra's flood mode stale even when BGP holds the new
    attributes.

    Discard PMSI from updates sent by the existing peer.
    Use detailed route output to verify PMSI is present
    before the update and absent afterward, with the same
    RDs and NLRIs. Check the flood mode and restore HER.

    Signed-off-by: Nageswara Soma <nsoma@cisco.com>

diff --git a/tests/topotests/bgp_evpn_pmsi_attr_intern/test_bgp_evpn_pmsi_attr_intern.py b/tests/topotests/bgp_evpn_pmsi_attr_intern/test_bgp_evpn_pmsi_attr_intern.py
index 3f4ca26542..a83432fb01 100644
--- a/tests/topotests/bgp_evpn_pmsi_attr_intern/test_bgp_evpn_pmsi_attr_intern.py
+++ b/tests/topotests/bgp_evpn_pmsi_attr_intern/test_bgp_evpn_pmsi_attr_intern.py
@@ -227,6 +227,89 @@ def test_evpn_flood_her_after_soft_clear():
         _check_flood_her(rname)


+def _imet_flood_mode(router, expected):
+    output = router.vtysh_cmd("show evpn vni 101 json", isjson=True)
+    for vtep in output.get("remoteVteps", []):
+        if vtep.get("ip") == "10.0.0.2":
+            return None if vtep.get("flood") == expected else vtep
+    return f"Remote VTEP 10.0.0.2 missing: {output}"
+
+
+def _remote_imet_routes(router):
+    routes = router.vtysh_cmd(
+        "show bgp l2vpn evpn route detail type multicast json", isjson=True
+    )
+    return {
+        (rd, prefix): paths
+        for rd, table in routes.items()
+        if isinstance(table, dict)
+        for prefix, paths in table.items()
+        if prefix.startswith("[3]:") and "[10.0.0.2]" in prefix
+    }
+
+
+def _contains_pmsi(value):
+    if isinstance(value, dict):
+        return "pmsi" in value or any(_contains_pmsi(v) for v in value.values())
+    if isinstance(value, list):
+        return any(_contains_pmsi(v) for v in value)
+    return False
+
+
+def test_same_imet_update_disables_her():
+    "A PMSI-only update on the same IMET RD and NLRI must reach zebra."
+    tgen = get_topogen()
+    if tgen.routers_have_failure():
+        pytest.skip(tgen.errors)
+
+    r1 = tgen.gears["r1"]
+    r2 = tgen.gears["r2"]
+    _check_flood_her("r1")
+    initial = _remote_imet_routes(r1)
+    assert initial and all(_contains_pmsi(paths) for paths in initial.values())
+
+    def same_routes_without_pmsi():
+        routes = _remote_imet_routes(r1)
+        if routes.keys() != initial.keys():
+            return f"IMET RDs or NLRIs changed: {routes.keys()}"
+        return (
+            "PMSI is still present" if _contains_pmsi(list(routes.values())) else None
+        )
+
+    try:
+        r1.vtysh_cmd(
+            """
+            configure terminal
+             router bgp 65000
+              neighbor 10.0.0.2 path-attribute discard 22
+            end
+            """
+        )
+        # Resend on the wire so discard applies even with soft-reconfig inbound.
+        r2.vtysh_cmd("clear bgp l2vpn evpn 10.0.0.1 soft out")
+
+        _, result = topotest.run_and_expect(
+            same_routes_without_pmsi, None, count=30, wait=1
+        )
+        assert result is None, f"Same-route PMSI update was not received: {result}"
+
+        check = partial(_imet_flood_mode, r1, "-")
+        _, result = topotest.run_and_expect(check, None, count=30, wait=1)
+        assert result is None, f"PMSI-only update did not disable flooding: {result}"
+    finally:
+        r1.vtysh_cmd(
+            """
+            configure terminal
+             router bgp 65000
+              no neighbor 10.0.0.2 path-attribute discard 22
+            end
+            """
+        )
+        r2.vtysh_cmd("clear bgp l2vpn evpn 10.0.0.1 soft out")
+
+    _check_flood_her("r1")
+
+
 def test_memory_leak():
     tgen = get_topogen()
     if not tgen.is_memleak_enabled():