From: Louis Scalbert Date: Fri, 27 May 2022 11:59:34 +0000 (+0200) Subject: topotests: raise an error if pinging from vrf is not possible X-Git-Tag: base_8.5~109^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=767199c68368b04652824b64bdd580c4a44303c4;p=mirror%2Ffrr.git topotests: raise an error if pinging from vrf is not possible Because of the issue described in the above link, pinging from vrf with the command "ip vrf exec ping -I " 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 --- diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py index 762af94d3f..e9647898ab 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py @@ -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", diff --git a/tests/topotests/bgp_vrf_route_leak_basic/test_bgp-vrf-route-leak-basic.py b/tests/topotests/bgp_vrf_route_leak_basic/test_bgp-vrf-route-leak-basic.py index 9c3a4bfdad..be07c85997 100644 --- a/tests/topotests/bgp_vrf_route_leak_basic/test_bgp-vrf-route-leak-basic.py +++ b/tests/topotests/bgp_vrf_route_leak_basic/test_bgp-vrf-route-leak-basic.py @@ -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)