Skip to content

Commit

Permalink
tests: Check if remote-as is not flushed once peer-group applied
Browse files Browse the repository at this point in the history
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 6f1ad10)
  • Loading branch information
ton31337 authored and mergify[bot] committed Dec 3, 2024
1 parent 877aad8 commit 73fd7b7
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tests/topotests/bgp_peer_group/r1/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ interface r1-eth0
interface r1-eth1
ip address 192.168.251.1/30
!
interface r1-eth2
ip address 192.168.252.1/30
!
ip forwarding
!
router bgp 65001
Expand All @@ -17,5 +20,9 @@ router bgp 65001
neighbor PG1 remote-as external
neighbor PG1 timers 3 20
neighbor PG1 graceful-restart-disable
neighbor PG2 peer-group
neighbor PG2 local-as 65554 no-prepend replace-as
neighbor 192.168.251.2 peer-group PG1
neighbor 192.168.252.2 remote-as 65004
neighbor 192.168.252.2 peer-group PG2
!
7 changes: 7 additions & 0 deletions tests/topotests/bgp_peer_group/r4/frr.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
!
interface r4-eth0
ip address 192.168.252.2/30
!
router bgp 65004
neighbor 192.168.252.1 remote-as external
!
29 changes: 28 additions & 1 deletion tests/topotests/bgp_peer_group/test_bgp_peer-group.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


def build_topo(tgen):
for routern in range(1, 4):
for routern in range(1, 5):
tgen.add_router("r{}".format(routern))

switch = tgen.add_switch("s1")
Expand All @@ -42,6 +42,10 @@ def build_topo(tgen):
switch.add_link(tgen.gears["r1"])
switch.add_link(tgen.gears["r2"])

switch = tgen.add_switch("s3")
switch.add_link(tgen.gears["r1"])
switch.add_link(tgen.gears["r4"])


def setup_module(mod):
tgen = Topogen(build_topo, mod.__name__)
Expand Down Expand Up @@ -84,6 +88,11 @@ def _bgp_peer_group_configured():
"bgpState": "Established",
"neighborCapabilities": {"gracefulRestart": "received"},
},
"192.168.252.2": {
"peerGroup": "PG2",
"bgpState": "Established",
"neighborCapabilities": {"gracefulRestart": "advertisedAndReceived"},
},
}
return topotest.json_cmp(output, expected)

Expand All @@ -110,6 +119,24 @@ def _bgp_peer_group_check_advertised_routes():
assert result is None, "Failed checking advertised routes from r3"


def test_show_running_remote_as_peer_group():
tgen = get_topogen()

if tgen.routers_have_failure():
pytest.skip(tgen.errors)

output = (
tgen.gears["r1"]
.cmd(
'vtysh -c "show running bgpd" | grep "^ neighbor 192.168.252.2 remote-as 65004"'
)
.rstrip()
)
assert (
output == " neighbor 192.168.252.2 remote-as 65004"
), "192.168.252.2 remote-as is flushed"


def test_bgp_peer_group_remote_as_del_readd():
tgen = get_topogen()

Expand Down

0 comments on commit 73fd7b7

Please sign in to comment.