From 66e0f6c456cb2380f932c8f0dfef8897218359d7 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 4 May 2023 09:22:19 +0300 Subject: [PATCH] tests: Check RIP allow-ecmp an arbitrary number of paths Signed-off-by: Donatas Abraitis --- .../rip_allow_ecmp/test_rip_allow_ecmp.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 c965c87481..7d958fd496 100644 --- a/tests/topotests/rip_allow_ecmp/test_rip_allow_ecmp.py +++ b/tests/topotests/rip_allow_ecmp/test_rip_allow_ecmp.py @@ -103,11 +103,13 @@ 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 rip`" - def _show_routes(): + def _show_routes(nh_num): output = json.loads(r1.vtysh_cmd("show ip route json")) expected = { "10.10.10.1/32": [ { + "internalNextHopNum": nh_num, + "internalNextHopActiveNum": nh_num, "nexthops": [ { "ip": "192.168.1.2", @@ -117,15 +119,15 @@ def test_rip_allow_ecmp(): "ip": "192.168.1.3", "active": True, }, - ] + ], } ] } return topotest.json_cmp(output, expected) - test_func = functools.partial(_show_routes) + test_func = functools.partial(_show_routes, 4) _, 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`" + assert result is None, "Can't see 10.10.10.1/32 as multipath (4) in `show ip route`" step( "Configure allow-ecmp 2, ECMP group routes SHOULD have next-hops with the lowest IPs" @@ -144,6 +146,10 @@ def test_rip_allow_ecmp(): result is None ), "Can't see 10.10.10.1/32 as ECMP with the lowest next-hop IPs" + test_func = functools.partial(_show_routes, 2) + _, 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 (2) in `show ip route`" + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] -- 2.39.5