]>
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 "/frr-ripd:ripd/instance[vrf='default']"
57 "/state/routes/route[prefix='10.10.10.1/32']"
61 r1
.vtysh_cmd(f
"show yang operational-data {xpath} ripd")
67 output
= output
["frr-ripd:ripd"]["instance"][0]["state"]["routes"]
74 "prefix": "10.10.10.1/32",
81 "gateway": "192.168.1.2",
82 "from": "192.168.1.2",
89 "gateway": "192.168.1.3",
90 "from": "192.168.1.3",
99 return topotest
.json_cmp(output
, expected
)
101 test_func
= functools
.partial(_show_rip_routes
)
102 _
, result
= topotest
.run_and_expect(test_func
, None, count
=60, wait
=1)
103 assert result
is None, "Can't see 10.10.10.1/32 as multipath in `show ip rip`"
106 output
= json
.loads(r1
.vtysh_cmd("show ip route json"))
123 return topotest
.json_cmp(output
, expected
)
125 test_func
= functools
.partial(_show_routes
)
126 _
, result
= topotest
.run_and_expect(test_func
, None, count
=60, wait
=1)
127 assert result
is None, "Can't see 10.10.10.1/32 as multipath in `show ip route`"
130 if __name__
== "__main__":
131 args
= ["-s"] + sys
.argv
[1:]
132 sys
.exit(pytest
.main(args
))