]> git.puffer.fish Git - mirror/frr.git/commitdiff
topotests: raise an error if pinging from vrf is not possible
authorLouis Scalbert <louis.scalbert@6wind.com>
Fri, 27 May 2022 11:59:34 +0000 (13:59 +0200)
committerLouis Scalbert <louis.scalbert@6wind.com>
Fri, 16 Dec 2022 14:07:57 +0000 (15:07 +0100)
Because of the issue described in the above link, pinging from vrf with
the command "ip vrf exec <vrf> ping -I <src> <addr>" may fail.

> root@topo:~# ip vrf exec vrf1 ping -c1 -I 192.168.2.1 192.168.1.1
> bind: Cannot assign requested address

Raise an error if pinging its own IP from a VRF fails. This test should
always work unless in the condition of this issue.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=203483
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py
tests/topotests/bgp_vrf_route_leak_basic/test_bgp-vrf-route-leak-basic.py

index 762af94d3f9f89881ec8ffdf8888b3c2c2284ee8..e9647898ab927dbc4956f214461dcac38baab767 100644 (file)
@@ -72,6 +72,13 @@ luCommand(
     "wait",
     "CE4->PE4 ping",
 )
+ret = luCommand(
+    "r1",
+    "ip vrf exec r1-cust5 ping 29.0.0.1 -I 29.0.0.1 -c 1",
+    " 0. packet loss",
+    "pass",
+    "Ping its own IP. Check https://bugzilla.kernel.org/show_bug.cgi?id=203483 if it fails",
+)
 luCommand(
     "r1",
     "ip vrf exec r1-cust5 ping 192.168.1.1 -I 29.0.0.1 -c 1",
index 9c3a4bfdad8dcc037f88f0fa8c9f79f453860ede..be07c85997a504f21b64c01f43cf72216f1edcb5 100644 (file)
@@ -174,6 +174,20 @@ def check_bgp_ping(router, vrf):
     return result, output
 
 
+def check_bgp_ping_own_ip(router):
+    cmd = "ip vrf exec DONNA ping -c1 10.0.0.1 -I 10.0.0.1"
+
+    output = ""
+    try:
+        output = router.cmd_raises(cmd)
+        result = True
+    except:
+        result = False
+        pass
+
+    return result, output
+
+
 def test_vrf_route_leak_test1():
     logger.info("Ensure that routes are leaked back and forth")
     tgen = get_topogen()
@@ -183,6 +197,13 @@ def test_vrf_route_leak_test1():
 
     r1 = tgen.gears["r1"]
 
+    result, output = check_bgp_ping_own_ip(r1)
+    assert (
+        result
+    ), "Ping from VRF fails - check https://bugzilla.kernel.org/show_bug.cgi?id=203483\n:{}".format(
+        output
+    )
+
     for vrf in ["EVA", "DONNA"]:
         result, diff = check_bgp_rib(r1, vrf, True)
         assert result, "BGP RIB VRF {} check failed:\n{}".format(vrf, diff)