]>
git.proxmox.com Git - mirror_frr.git/blob - tests/topotests/rip_allow_ecmp/test_rip_allow_ecmp.py
2 # SPDX-License-Identifier: ISC
4 # Copyright (c) 2023 by
5 # Donatas Abraitis <donatas@opensourcerouting.org>
9 Test if RIP `allow-ecmp` command works correctly.
18 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
19 sys
.path
.append(os
.path
.join(CWD
, "../"))
21 # pylint: disable=C0413
22 from lib
import topotest
23 from lib
.topogen
import Topogen
, TopoRouter
, get_topogen
25 pytestmark
= [pytest
.mark
.ripd
]
28 def setup_module(mod
):
29 topodef
= {"s1": ("r1", "r2", "r3")}
30 tgen
= Topogen(topodef
, mod
.__name
__)
33 router_list
= tgen
.routers()
35 for _
, (rname
, router
) in enumerate(router_list
.items(), 1):
36 router
.load_frr_config(os
.path
.join(CWD
, "{}/frr.conf".format(rname
)))
41 def teardown_module(mod
):
46 def test_rip_allow_ecmp():
49 if tgen
.routers_have_failure():
50 pytest
.skip(tgen
.errors
)
54 def _show_rip_routes():
56 r1
.vtysh_cmd("show yang operational-data /frr-ripd:ripd ripd")
59 output
= output
["frr-ripd:ripd"]["instance"][0]["state"]["routes"]
66 "prefix": "10.10.10.1/32",
73 "gateway": "192.168.1.2",
74 "from": "192.168.1.2",
81 "gateway": "192.168.1.3",
82 "from": "192.168.1.3",
91 return topotest
.json_cmp(output
, expected
)
93 test_func
= functools
.partial(_show_rip_routes
)
94 _
, result
= topotest
.run_and_expect(test_func
, None, count
=60, wait
=1)
95 assert result
is None, "Can't see 10.10.10.1/32 as multipath in `show ip rip`"
98 output
= json
.loads(r1
.vtysh_cmd("show ip route json"))
115 return topotest
.json_cmp(output
, expected
)
117 test_func
= functools
.partial(_show_routes
)
118 _
, result
= topotest
.run_and_expect(test_func
, None, count
=60, wait
=1)
119 assert result
is None, "Can't see 10.10.10.1/32 as multipath in `show ip route`"
122 if __name__
== "__main__":
123 args
= ["-s"] + sys
.argv
[1:]
124 sys
.exit(pytest
.main(args
))