From 4972a6ee7f1bffad9afa9e0c167e32c0fdd90e98 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 4 May 2023 09:02:42 +0300 Subject: [PATCH] tests: Check if RIP `allow-ecmp` command can inject specified number of routes Signed-off-by: Donatas Abraitis --- tests/topotests/rip_allow_ecmp/r4/frr.conf | 13 ++++++++++++ tests/topotests/rip_allow_ecmp/r5/frr.conf | 13 ++++++++++++ .../rip_allow_ecmp/test_rip_allow_ecmp.py | 20 ++++++++++++++++++- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 tests/topotests/rip_allow_ecmp/r4/frr.conf create mode 100644 tests/topotests/rip_allow_ecmp/r5/frr.conf diff --git a/tests/topotests/rip_allow_ecmp/r4/frr.conf b/tests/topotests/rip_allow_ecmp/r4/frr.conf new file mode 100644 index 000000000..995c2beca --- /dev/null +++ b/tests/topotests/rip_allow_ecmp/r4/frr.conf @@ -0,0 +1,13 @@ +! +int lo + ip address 10.10.10.1/32 +! +int r4-eth0 + ip address 192.168.1.4/24 +! +router rip + network 192.168.1.0/24 + network 10.10.10.1/32 + timers basic 5 15 10 +exit + diff --git a/tests/topotests/rip_allow_ecmp/r5/frr.conf b/tests/topotests/rip_allow_ecmp/r5/frr.conf new file mode 100644 index 000000000..57a06ec0e --- /dev/null +++ b/tests/topotests/rip_allow_ecmp/r5/frr.conf @@ -0,0 +1,13 @@ +! +int lo + ip address 10.10.10.1/32 +! +int r5-eth0 + ip address 192.168.1.5/24 +! +router rip + network 192.168.1.0/24 + network 10.10.10.1/32 + timers basic 5 15 10 +exit + diff --git a/tests/topotests/rip_allow_ecmp/test_rip_allow_ecmp.py b/tests/topotests/rip_allow_ecmp/test_rip_allow_ecmp.py index acc0aea9e..c965c8748 100644 --- a/tests/topotests/rip_allow_ecmp/test_rip_allow_ecmp.py +++ b/tests/topotests/rip_allow_ecmp/test_rip_allow_ecmp.py @@ -21,12 +21,13 @@ sys.path.append(os.path.join(CWD, "../")) # pylint: disable=C0413 from lib import topotest from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.common_config import step pytestmark = [pytest.mark.ripd] def setup_module(mod): - topodef = {"s1": ("r1", "r2", "r3")} + topodef = {"s1": ("r1", "r2", "r3", "r4", "r5")} tgen = Topogen(topodef, mod.__name__) tgen.start_topology() @@ -126,6 +127,23 @@ def test_rip_allow_ecmp(): _, result = topotest.run_and_expect(test_func, None, count=60, wait=1) assert result is None, "Can't see 10.10.10.1/32 as multipath in `show ip route`" + step( + "Configure allow-ecmp 2, ECMP group routes SHOULD have next-hops with the lowest IPs" + ) + r1.vtysh_cmd( + """ + configure terminal + router rip + allow-ecmp 2 + """ + ) + + test_func = functools.partial(_show_rip_routes) + _, result = topotest.run_and_expect(test_func, None, count=60, wait=1) + assert ( + result is None + ), "Can't see 10.10.10.1/32 as ECMP with the lowest next-hop IPs" + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] -- 2.39.5