]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tests: Check if the routes in the kernel are retained for GR as well
authorDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 30 Sep 2022 06:46:00 +0000 (09:46 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 30 Sep 2022 06:51:07 +0000 (09:51 +0300)
Not only in BGP table.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
tests/topotests/bgp_gr_restart_retain_routes/r1/zebra.conf
tests/topotests/bgp_gr_restart_retain_routes/r2/bgpd.conf
tests/topotests/bgp_gr_restart_retain_routes/r2/zebra.conf
tests/topotests/bgp_gr_restart_retain_routes/test_bgp_gr_restart_retain_routes.py

index 091794f4752f60cdc2090764901bd0c9f05ac2c0..e65bfb2c3ad4bf4df0f167bb2afe0e056d3724d7 100644 (file)
@@ -5,5 +5,3 @@ interface lo
 interface r1-eth0
  ip address 192.168.255.1/24
 !
-ip forwarding
-!
index bc59311fc3e0568d7b67ca788ee1d0eb3a08472a..97418ca9a042ec3903da10c32e33da5747fef238 100644 (file)
@@ -5,7 +5,4 @@ router bgp 65002
  neighbor 192.168.255.1 remote-as external
  neighbor 192.168.255.1 timers 1 3
  neighbor 192.168.255.1 timers connect 1
- address-family ipv4
-  redistribute connected
- exit-address-family
 !
index 1fcccbe1614eaf4c3740f8ce31528ff783106386..c03dd7e197af29dc1d4ee6a1c8a837e097140340 100644 (file)
@@ -1,9 +1,4 @@
 !
-interface lo
- ip address 172.16.255.2/32
-!
 interface r2-eth0
  ip address 192.168.255.2/24
 !
-ip forwarding
-!
index 63ae8dd366da1d816aaa4cba9c6966d7ecbacde5..52ce0d5b57ed12388162994a2c96242c5d779942 100644 (file)
@@ -90,11 +90,25 @@ def test_bgp_gr_restart_retain_routes():
         }
         return topotest.json_cmp(output, expected)
 
-    def _bgp_check_retained_routes():
+    def _bgp_check_bgp_retained_routes():
         output = json.loads(r2.vtysh_cmd("show bgp ipv4 unicast 172.16.255.1/32 json"))
         expected = {"paths": [{"stale": True}]}
         return topotest.json_cmp(output, expected)
 
+    def _bgp_check_kernel_retained_routes():
+        output = (
+            r2.cmd("ip route show 172.16.255.1/32 proto bgp dev r2-eth0")
+            .replace("\n", "")
+            .rstrip()
+        )
+        expected = "172.16.255.1 via 192.168.255.1 metric 20"
+        diff = topotest.get_textdiff(
+            output, expected, "Actual IP Routing Table", "Expected IP RoutingTable"
+        )
+        if diff:
+            return False
+        return True
+
     step("Initial BGP converge")
     test_func = functools.partial(_bgp_converge)
     _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
@@ -103,11 +117,14 @@ def test_bgp_gr_restart_retain_routes():
     step("Restart R1")
     stop_router(tgen, "r1")
 
-    step("Check if routes are retained at R2")
-    test_func = functools.partial(_bgp_check_retained_routes)
+    step("Check if routes (BGP) are retained at R2")
+    test_func = functools.partial(_bgp_check_bgp_retained_routes)
     _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
     assert result is None, "Failed to see BGP retained routes on R2"
 
+    step("Check if routes (Kernel) are retained at R2")
+    assert _bgp_check_kernel_retained_routes() == True
+
 
 if __name__ == "__main__":
     args = ["-s"] + sys.argv[1:]