mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-06 01:59:57 +00:00
Merge pull request #16348 from opensourcerouting/feature/test_bgp_remote_as_unnumberred
tests: Extended bgp_remote_as_auto topotest with unnumbered case
This commit is contained in:
commit
f13f3cc76a
@ -2,6 +2,9 @@
|
|||||||
int r1-eth0
|
int r1-eth0
|
||||||
ip address 192.168.1.1/24
|
ip address 192.168.1.1/24
|
||||||
!
|
!
|
||||||
|
int r1-eth1
|
||||||
|
ip address 192.168.14.1/24
|
||||||
|
!
|
||||||
router bgp 65001
|
router bgp 65001
|
||||||
no bgp ebgp-requires-policy
|
no bgp ebgp-requires-policy
|
||||||
no bgp network import-check
|
no bgp network import-check
|
||||||
@ -11,6 +14,9 @@ router bgp 65001
|
|||||||
neighbor 192.168.1.3 remote-as auto
|
neighbor 192.168.1.3 remote-as auto
|
||||||
neighbor 192.168.1.3 timers 1 3
|
neighbor 192.168.1.3 timers 1 3
|
||||||
neighbor 192.168.1.3 timers connect 1
|
neighbor 192.168.1.3 timers connect 1
|
||||||
|
neighbor r1-eth1 interface remote-as auto
|
||||||
|
neighbor r1-eth1 timers 1 3
|
||||||
|
neighbor r1-eth1 timers connect 1
|
||||||
address-family ipv4 unicast
|
address-family ipv4 unicast
|
||||||
network 10.0.0.1/32
|
network 10.0.0.1/32
|
||||||
exit-address-family
|
exit-address-family
|
||||||
|
10
tests/topotests/bgp_remote_as_auto/r4/frr.conf
Normal file
10
tests/topotests/bgp_remote_as_auto/r4/frr.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
!
|
||||||
|
int r4-eth0
|
||||||
|
ip address 192.168.14.4/24
|
||||||
|
!
|
||||||
|
router bgp 65004
|
||||||
|
no bgp ebgp-requires-policy
|
||||||
|
neighbor r4-eth0 interface remote-as auto
|
||||||
|
neighbor r4-eth0 timers 1 3
|
||||||
|
neighbor r4-eth0 timers connect 1
|
||||||
|
!
|
@ -23,7 +23,7 @@ pytestmark = [pytest.mark.bgpd]
|
|||||||
|
|
||||||
|
|
||||||
def setup_module(mod):
|
def setup_module(mod):
|
||||||
topodef = {"s1": ("r1", "r2", "r3")}
|
topodef = {"s1": ("r1", "r2", "r3"), "s2": ("r1", "r4")}
|
||||||
tgen = Topogen(topodef, mod.__name__)
|
tgen = Topogen(topodef, mod.__name__)
|
||||||
tgen.start_topology()
|
tgen.start_topology()
|
||||||
|
|
||||||
@ -49,11 +49,18 @@ def test_bgp_remote_as_auto():
|
|||||||
r1 = tgen.gears["r1"]
|
r1 = tgen.gears["r1"]
|
||||||
r2 = tgen.gears["r2"]
|
r2 = tgen.gears["r2"]
|
||||||
r3 = tgen.gears["r3"]
|
r3 = tgen.gears["r3"]
|
||||||
|
r4 = tgen.gears["r4"]
|
||||||
|
|
||||||
def _bgp_converge():
|
def _bgp_converge():
|
||||||
output = json.loads(r1.vtysh_cmd("show bgp ipv4 unicast summary json"))
|
output = json.loads(r1.vtysh_cmd("show bgp ipv4 unicast summary json"))
|
||||||
expected = {
|
expected = {
|
||||||
"peers": {
|
"peers": {
|
||||||
|
"r1-eth1": {
|
||||||
|
"hostname": "r4",
|
||||||
|
"remoteAs": 65004,
|
||||||
|
"localAs": 65001,
|
||||||
|
"state": "Established",
|
||||||
|
},
|
||||||
"192.168.1.2": {
|
"192.168.1.2": {
|
||||||
"hostname": "r2",
|
"hostname": "r2",
|
||||||
"remoteAs": 65001,
|
"remoteAs": 65001,
|
||||||
@ -124,6 +131,30 @@ def test_bgp_remote_as_auto():
|
|||||||
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
|
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
|
||||||
assert result is None, "Can't see automatic eBGP peering"
|
assert result is None, "Can't see automatic eBGP peering"
|
||||||
|
|
||||||
|
def _bgp_converge_external_unnumbered():
|
||||||
|
output = json.loads(r4.vtysh_cmd("show bgp ipv4 unicast 10.0.0.1/32 json"))
|
||||||
|
expected = {
|
||||||
|
"paths": [
|
||||||
|
{
|
||||||
|
"aspath": {
|
||||||
|
"string": "65001",
|
||||||
|
},
|
||||||
|
"valid": True,
|
||||||
|
"peer": {
|
||||||
|
"hostname": "r1",
|
||||||
|
"type": "external",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
return topotest.json_cmp(output, expected)
|
||||||
|
|
||||||
|
test_func = functools.partial(
|
||||||
|
_bgp_converge_external_unnumbered,
|
||||||
|
)
|
||||||
|
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
|
||||||
|
assert result is None, "Can't see automatic unnumbered eBGP peering"
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
args = ["-s"] + sys.argv[1:]
|
args = ["-s"] + sys.argv[1:]
|
||||||
|
Loading…
Reference in New Issue
Block a user