]> git.puffer.fish Git - matthieu/frr.git/commitdiff
topotests: add bgp test to check the ADJ-RIB-OUT label value
authorPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 24 Feb 2023 10:22:14 +0000 (11:22 +0100)
committerLouis Scalbert <louis.scalbert@6wind.com>
Wed, 5 Jun 2024 11:11:29 +0000 (13:11 +0200)
This test ensures that when r1 changes the label value, then
the new value is automatically propagated to remote peer.
This demonstrates that the ADJ-RIB-OUT to r2 has been correctly
updated.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
tests/topotests/bgp_vpnv4_ebgp/r2/bgp_ipv4_vpn_route_1723101.json [new file with mode: 0644]
tests/topotests/bgp_vpnv4_ebgp/test_bgp_vpnv4_ebgp.py

diff --git a/tests/topotests/bgp_vpnv4_ebgp/r2/bgp_ipv4_vpn_route_1723101.json b/tests/topotests/bgp_vpnv4_ebgp/r2/bgp_ipv4_vpn_route_1723101.json
new file mode 100644 (file)
index 0000000..2ed7631
--- /dev/null
@@ -0,0 +1,50 @@
+{
+    "444:1":{
+        "prefix":"172.31.0.1/32",
+        "advertisedTo":{
+            "192.168.0.1":{
+            }
+        },
+        "paths":[
+            {
+                "aspath":{
+                    "string":"65500",
+                    "segments":[
+                        {
+                            "type":"as-sequence",
+                            "list":[
+                                65500
+                            ]
+                        }
+                    ],
+                    "length":1
+                },
+                "origin":"incomplete",
+                "metric":0,
+                "valid":true,
+                "bestpath":{
+                    "overall":true,
+                    "selectionReason":"First path received"
+                },
+                "extendedCommunity":{
+                    "string":"RT:52:101"
+                },
+                "remoteLabel":102,
+                "nexthops":[
+                    {
+                        "ip":"192.168.0.1",
+                        "afi":"ipv4",
+                        "metric":0,
+                        "accessible":true,
+                        "used":true
+                    }
+                ],
+                "peer":{
+                    "peerId":"192.168.0.1",
+                    "routerId":"192.0.2.1",
+                    "type":"external"
+                }
+            }
+        ]
+    }
+}
index 6746043aa53b9c0cc7439a39287c17480edffa6d..da7ac96e6035fce34cd936620b5bad2cf722f111 100644 (file)
@@ -404,6 +404,40 @@ route-map RMAP permit 1
     assert success, "{}, vpnv4 update {} still not present".format(router.name, prefix)
 
 
+def test_adj_rib_out_label_change():
+    """
+    Check that changing the VPN label on r1
+    is propagated on r2
+    """
+    tgen = get_topogen()
+    if tgen.routers_have_failure():
+        pytest.skip(tgen.errors)
+
+    logger.info("Changing VPN label value to export")
+    dump = tgen.gears["r1"].vtysh_cmd(
+        """
+configure terminal
+ router bgp 65500 vrf vrf1
+  address-family ipv4 unicast
+   label vpn export 102
+"""
+    )
+    # Check BGP IPv4 route entry for 172.31.0.1 on r1
+    logger.info("Checking BGP IPv4 routes for convergence on r1")
+    router = tgen.gears["r2"]
+    json_file = "{}/{}/bgp_ipv4_vpn_route_1723101.json".format(CWD, router.name)
+    expected = json.loads(open(json_file).read())
+    test_func = partial(
+        topotest.router_json_cmp,
+        router,
+        "show bgp ipv4 vpn 172.31.0.1/32 json",
+        expected,
+    )
+    _, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+    assertmsg = '"{}" JSON output mismatches'.format(router.name)
+    assert result is None, assertmsg
+
+
 def test_memory_leak():
     "Run the memory leak test and report results."
     tgen = get_topogen()