summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Scalbert <louis.scalbert@6wind.com>2024-02-09 15:47:40 +0100
committerLouis Scalbert <louis.scalbert@6wind.com>2024-02-14 16:39:51 +0100
commit5709e89f6c6a11154b8c89664a49d4d239b4fc8c (patch)
treec56b2a149d9e9aa3050e7968e453a5f1ab058490
parentb45c5cd959ecf859aa11673ab83d169b76988ba2 (diff)
tests: check route leak after changing vrf state
Check that local route leaks are set to "inactive" when the VRF interface is shutdown and, conversely, that they are set to "active" when the VRF interface is unshut. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
-rw-r--r--tests/topotests/bgp_vrf_route_leak_basic/test_bgp-vrf-route-leak-basic.py111
1 files changed, 110 insertions, 1 deletions
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 1915717ac5..4df799a5fd 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
@@ -214,7 +214,6 @@ def test_vrf_route_leak_eva():
assert result, "BGP VRF EVA check failed:\n{}".format(diff)
-
def test_vrf_route_leak_default():
logger.info("Ensure that routes are leaked back and forth")
tgen = get_topogen()
@@ -281,6 +280,116 @@ def test_ping():
check_ping("r1", "10.0.0.1", True, 10, 0.5, source_addr="10.0.4.1")
+def test_vrf_route_leak_donna_after_eva_down():
+ logger.info("Ensure that route states change after EVA interface goes down")
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ r1 = tgen.gears["r1"]
+ r1.vtysh_cmd(
+ """
+configure
+interface EVA
+ shutdown
+"""
+ )
+
+ # Test DONNA VRF.
+ expect = {
+ "10.0.1.0/24": [
+ {
+ "protocol": "bgp",
+ "selected": None,
+ "nexthops": [
+ {
+ "fib": None,
+ "interfaceName": "EVA",
+ "vrf": "EVA",
+ "active": None,
+ },
+ ],
+ },
+ ],
+ "10.0.3.0/24": [
+ {
+ "protocol": "bgp",
+ "selected": None,
+ "nexthops": [
+ {
+ "fib": None,
+ "interfaceName": "EVA",
+ "vrf": "EVA",
+ "active": None,
+ },
+ ],
+ },
+ ],
+ }
+
+ test_func = partial(
+ topotest.router_json_cmp, r1, "show ip route vrf DONNA json", expect
+ )
+ result, diff = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ assert result, "BGP VRF DONNA check failed:\n{}".format(diff)
+
+
+def test_vrf_route_leak_donna_after_eva_up():
+ logger.info("Ensure that route states change after EVA interface goes up")
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ r1 = tgen.gears["r1"]
+ r1.vtysh_cmd(
+ """
+configure
+interface EVA
+ no shutdown
+"""
+ )
+
+ # Test DONNA VRF.
+ expect = {
+ "10.0.1.0/24": [
+ {
+ "protocol": "bgp",
+ "selected": True,
+ "nexthops": [
+ {
+ "fib": True,
+ "interfaceName": "EVA",
+ "vrf": "EVA",
+ "active": True,
+ },
+ ],
+ },
+ ],
+ "10.0.3.0/24": [
+ {
+ "protocol": "bgp",
+ "selected": True,
+ "nexthops": [
+ {
+ "fib": True,
+ "interfaceName": "EVA",
+ "vrf": "EVA",
+ "active": True,
+ },
+ ],
+ },
+ ],
+ }
+
+ test_func = partial(
+ topotest.router_json_cmp, r1, "show ip route vrf DONNA json", expect
+ )
+ result, diff = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ assert result, "BGP VRF DONNA check failed:\n{}".format(diff)
+
+
def test_memory_leak():
"Run the memory leak test and report results."
tgen = get_topogen()