]>
git.proxmox.com Git - mirror_frr.git/blob - tests/topotests/bgp_dont_capability_negotiate/test_bgp_dont_capability_negotiate.py
3 # Copyright (c) 2021 by
4 # Donatas Abraitis <donatas.abraitis@gmail.com>
6 # Permission to use, copy, modify, and/or distribute this software
7 # for any purpose with or without fee is hereby granted, provided
8 # that the above copyright notice and this permission notice appear
11 # THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
12 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
14 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
15 # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
16 # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
17 # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22 Test if BGP connection is established if at least one peer
23 sets `dont-capability-negotiate`.
32 pytestmark
= pytest
.mark
.bgpd
34 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
35 sys
.path
.append(os
.path
.join(CWD
, "../"))
37 # pylint: disable=C0413
38 from lib
import topotest
39 from lib
.topogen
import Topogen
, TopoRouter
, get_topogen
41 pytestmark
= [pytest
.mark
.bgpd
]
44 def setup_module(mod
):
45 topodef
= {"s1": ("r1", "r2")}
46 tgen
= Topogen(topodef
, mod
.__name
__)
49 router_list
= tgen
.routers()
51 for i
, (rname
, router
) in enumerate(router_list
.items(), 1):
53 TopoRouter
.RD_ZEBRA
, os
.path
.join(CWD
, "{}/zebra.conf".format(rname
))
56 TopoRouter
.RD_BGP
, os
.path
.join(CWD
, "{}/bgpd.conf".format(rname
))
62 def teardown_module(mod
):
67 def test_bgp_dont_capability_negotiate():
70 if tgen
.routers_have_failure():
71 pytest
.skip(tgen
.errors
)
73 router
= tgen
.gears
["r1"]
75 def _bgp_converge(router
):
76 output
= json
.loads(router
.vtysh_cmd("show bgp ipv4 unicast summary json"))
82 "state": "Established",
87 return topotest
.json_cmp(output
, expected
)
89 test_func
= functools
.partial(_bgp_converge
, router
)
90 success
, result
= topotest
.run_and_expect(test_func
, None, count
=60, wait
=0.5)
91 assert result
is None, "Can't converge with dont-capability-negotiate"
94 if __name__
== "__main__":
95 args
= ["-s"] + sys
.argv
[1:]
96 sys
.exit(pytest
.main(args
))