]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tests: Check if routes are marked as stale and retained with N-bit for GR
authorDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 25 Mar 2025 15:35:41 +0000 (17:35 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Wed, 26 Mar 2025 20:26:40 +0000 (22:26 +0200)
Related-to: b7c657d4e065f310fcf6454abae1a963c208c3b8 ("bgpd: Retain the routes if we do a clear with N-bit set for Graceful-Restart")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
tests/topotests/bgp_gr_notification/r1/bgpd.conf
tests/topotests/bgp_gr_notification/r2/bgpd.conf
tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py

index 0af042f6be592a3314d93ba144f7b6cd186b325a..bca5c33bc3631f1270efb1efd422d99273f94cb9 100644 (file)
@@ -3,7 +3,6 @@ router bgp 65001
  bgp graceful-restart
  neighbor 192.168.255.2 remote-as external
  neighbor 192.168.255.2 timers 1 3
- neighbor 192.168.255.2 timers delayopen 10
  address-family ipv4
   redistribute connected
  exit-address-family
index 8325e21d2c1e8fd4c212876406b214872545bdd7..5e47f9dee39f7c6b3b050c7ccde15299a4989428 100644 (file)
@@ -4,7 +4,6 @@ router bgp 65002
  bgp graceful-restart
  neighbor 192.168.255.1 remote-as external
  neighbor 192.168.255.1 timers 1 3
- neighbor 192.168.255.1 timers delayopen 10
  address-family ipv4
   redistribute connected
  exit-address-family
index 5d8338d6eb2a5f31908fb6eb8e97b1908572ab04..45e8da94c33df8ad599de530b91eadd93dfd7bcf 100644 (file)
@@ -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,29 +177,42 @@ 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)
+    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)