summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-09-30 09:46:00 +0300
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2022-11-07 19:26:41 +0000
commit28f5cfb51eeab3fbe181e1c751c2c8264197357b (patch)
tree3e39afd97f50209b360e590dcd2b10ffa6216994
parent54acee45bd60bd06662f9551db500d584a9c73b1 (diff)
tests: Check if the routes in the kernel are retained for GR as well
Not only in BGP table. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org> (cherry picked from commit 18e427bc598879110860fd198808300e991ad146)
-rw-r--r--tests/topotests/bgp_gr_restart_retain_routes/r1/zebra.conf2
-rw-r--r--tests/topotests/bgp_gr_restart_retain_routes/r2/bgpd.conf3
-rw-r--r--tests/topotests/bgp_gr_restart_retain_routes/r2/zebra.conf5
-rw-r--r--tests/topotests/bgp_gr_restart_retain_routes/test_bgp_gr_restart_retain_routes.py23
4 files changed, 20 insertions, 13 deletions
diff --git a/tests/topotests/bgp_gr_restart_retain_routes/r1/zebra.conf b/tests/topotests/bgp_gr_restart_retain_routes/r1/zebra.conf
index 091794f475..e65bfb2c3a 100644
--- a/tests/topotests/bgp_gr_restart_retain_routes/r1/zebra.conf
+++ b/tests/topotests/bgp_gr_restart_retain_routes/r1/zebra.conf
@@ -5,5 +5,3 @@ interface lo
interface r1-eth0
ip address 192.168.255.1/24
!
-ip forwarding
-!
diff --git a/tests/topotests/bgp_gr_restart_retain_routes/r2/bgpd.conf b/tests/topotests/bgp_gr_restart_retain_routes/r2/bgpd.conf
index bc59311fc3..97418ca9a0 100644
--- a/tests/topotests/bgp_gr_restart_retain_routes/r2/bgpd.conf
+++ b/tests/topotests/bgp_gr_restart_retain_routes/r2/bgpd.conf
@@ -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
!
diff --git a/tests/topotests/bgp_gr_restart_retain_routes/r2/zebra.conf b/tests/topotests/bgp_gr_restart_retain_routes/r2/zebra.conf
index 1fcccbe161..c03dd7e197 100644
--- a/tests/topotests/bgp_gr_restart_retain_routes/r2/zebra.conf
+++ b/tests/topotests/bgp_gr_restart_retain_routes/r2/zebra.conf
@@ -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
-!
diff --git a/tests/topotests/bgp_gr_restart_retain_routes/test_bgp_gr_restart_retain_routes.py b/tests/topotests/bgp_gr_restart_retain_routes/test_bgp_gr_restart_retain_routes.py
index 63ae8dd366..52ce0d5b57 100644
--- a/tests/topotests/bgp_gr_restart_retain_routes/test_bgp_gr_restart_retain_routes.py
+++ b/tests/topotests/bgp_gr_restart_retain_routes/test_bgp_gr_restart_retain_routes.py
@@ -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:]