diff options
| author | Russ White <russ@riw.us> | 2025-04-01 10:20:44 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-01 10:20:44 -0400 |
| commit | 161e2746b7b4503236738ae5b2a66eb8484d6dfb (patch) | |
| tree | c0cddc7565edfa6fe961047e904780af16ec9dc9 /tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py | |
| parent | efa78f28ab0c156b76586bb427d49f5bdb600676 (diff) | |
| parent | 20de25e281fa705aa7b13a953cfab9e6093e91a2 (diff) | |
Merge pull request #18517 from opensourcerouting/fix/backport_18498_10.1stable/10.1
bgpd: Retain the routes if we do a clear with N-bit set for Graceful-Restart (backport)
Diffstat (limited to 'tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py')
| -rw-r--r-- | tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py b/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py index 2ffcb723ec..9e886771f9 100644 --- a/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py +++ b/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py @@ -165,8 +165,8 @@ def test_bgp_administrative_reset_gr(): } return topotest.json_cmp(output, expected) - def _bgp_check_gr_notification_stale(): - output = json.loads(r1.vtysh_cmd("show bgp ipv4 unicast 172.16.255.2/32 json")) + def _bgp_check_gr_notification_stale(router, prefix): + output = json.loads(router.vtysh_cmd(f"show bgp ipv4 unicast {prefix} json")) expected = { "paths": [ { @@ -177,34 +177,47 @@ def test_bgp_administrative_reset_gr(): } return topotest.json_cmp(output, expected) - def _bgp_clear_r1_and_shutdown(): - r2.vtysh_cmd( - """ - clear ip bgp 192.168.255.1 - configure terminal - router bgp - neighbor 192.168.255.1 shutdown - """ - ) - step("Initial BGP converge") test_func = functools.partial(_bgp_converge) _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) assert result is None, "Failed to see BGP convergence on R2" - step("Reset and shutdown R1") - _bgp_clear_r1_and_shutdown() + step("Reset and delay the session establishement for R1") + r1.vtysh_cmd( + """ + configure terminal" + router bgp + neighbor 192.168.255.2 timers delayopen 60 + """ + ) + r2.vtysh_cmd( + """ + configure terminal" + router bgp + neighbor 192.168.255.1 timers delayopen 60 + """ + ) + r2.vtysh_cmd("clear ip bgp 192.168.255.1") + + step("Check if stale routes are retained on R1") + test_func = functools.partial( + _bgp_check_gr_notification_stale, r1, "172.16.255.2/32" + ) + _, 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 on R2") + test_func = functools.partial( + _bgp_check_gr_notification_stale, r2, "172.16.255.1/32" + ) + _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) + assert result is None, "Failed to see retained stale routes on R2" 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) assert result is None, "Failed to send Administrative Reset notification from R2" - step("Check if stale routes are retained on R1") - test_func = functools.partial(_bgp_check_gr_notification_stale) - _, 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" - if __name__ == "__main__": args = ["-s"] + sys.argv[1:] |
