From e0f585fcab3e5ab6c1bc6e2174262d4b18872068 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Mon, 3 Mar 2025 17:22:59 +0100 Subject: [PATCH] topotests: add a test to unconfigure aggregated prefix on VPN That test will ensure the VPN prefix associated is removed. Signed-off-by: Philippe Guibert --- .../bgp_vpnv4_ebgp/test_bgp_vpnv4_ebgp.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/topotests/bgp_vpnv4_ebgp/test_bgp_vpnv4_ebgp.py b/tests/topotests/bgp_vpnv4_ebgp/test_bgp_vpnv4_ebgp.py index e2727a3ed7..f6bfed5bb0 100644 --- a/tests/topotests/bgp_vpnv4_ebgp/test_bgp_vpnv4_ebgp.py +++ b/tests/topotests/bgp_vpnv4_ebgp/test_bgp_vpnv4_ebgp.py @@ -574,6 +574,40 @@ def test_aggregated_exported_route_on_r1(): assert result is None, assertmsg +def test_aggregated_suppress_aggregate_r1(): + """ + Check that only the suppressed networks are exported + """ + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + r1 = tgen.gears["r1"] + r1.vtysh_cmd( + """ + configure terminal + router bgp 65500 vrf vrf1 + address-family ipv4 unicast + no aggregate-address 172.31.1.0/24 + """ + ) + + r1 = tgen.gears["r1"] + logger.info("Checking 172.31.1.0/24 VPN prefix is hot present on R1") + + expected = {} + test_func = partial( + topotest.router_json_cmp, + r1, + "show bgp ipv4 vpn 172.31.1.0/24 json", + expected, + exact=True, + ) + _, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5) + assertmsg = '"{}" JSON output mismatches'.format(r1.name) + assert result is None, assertmsg + + def test_memory_leak(): "Run the memory leak test and report results." tgen = get_topogen() -- 2.39.5