diff --git a/tests/topotests/bgp_gr_notification/r1/bgpd.conf b/tests/topotests/bgp_gr_notification/r1/bgpd.conf index 0af042f6be59..790cd5dc91f9 100644 --- a/tests/topotests/bgp_gr_notification/r1/bgpd.conf +++ b/tests/topotests/bgp_gr_notification/r1/bgpd.conf @@ -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 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 7e39b83d8fd9..e7cffa0e7488 100644 --- a/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py +++ b/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py @@ -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( """ @@ -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)