Skip to content

Commit

Permalink
tests: Check if stale routes are preserved in the kernel if hard rese…
Browse files Browse the repository at this point in the history
…t is used

Signed-off-by: Donatas Abraitis <[email protected]>
  • Loading branch information
ton31337 committed Feb 24, 2025
1 parent c246a2f commit d8c36b2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/topotests/bgp_gr_notification/r1/bgpd.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
router bgp 65001
no bgp ebgp-requires-policy
bgp graceful-restart
bgp graceful-restart preserve-fw-state
neighbor 192.168.255.2 remote-as external
neighbor 192.168.255.2 timers 1 3
neighbor 192.168.255.2 timers delayopen 10
Expand Down
29 changes: 29 additions & 0 deletions tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,30 @@ def _bgp_check_gr_notification_stale():
}
return topotest.json_cmp(output, expected)

def _bgp_check_gr_notification_stale_kernel():
output = json.loads(r1.vtysh_cmd("show ip route 172.16.255.2/32 json"))
expected = {
"172.16.255.2/32": [
{
"protocol": "bgp",
"selected": True,
"distance": 20,
"metric": 0,
"installed": True,
"nexthops": [
{
"fib": True,
"ip": "192.168.255.2",
"afi": "ipv4",
"interfaceName": "r1-eth0",
"active": True,
}
],
}
]
}
return topotest.json_cmp(output, expected)

def _bgp_clear_r1_and_shutdown():
r2.vtysh_cmd(
"""
Expand Down Expand Up @@ -210,6 +234,11 @@ def _bgp_verify_show_bgp_router_json():
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Failed to see retained stale routes on R1"

step("Check if stale routes are retained in the kernel on R1")
test_func = functools.partial(_bgp_check_gr_notification_stale_kernel)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Failed to see retained stale routes in the kernel on R1"

step("Check if Hard Reset notification wasn't sent from R2")
test_func = functools.partial(_bgp_check_hard_reset)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
Expand Down

0 comments on commit d8c36b2

Please sign in to comment.