diff options
Diffstat (limited to 'tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_graceful_restart.py')
-rw-r--r-- | tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_graceful_restart.py | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_graceful_restart.py b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_graceful_restart.py index 75c712e..4644ef3 100644 --- a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_graceful_restart.py +++ b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_graceful_restart.py @@ -70,7 +70,7 @@ def test_bgp_dynamic_capability_graceful_restart(): }, "addressFamilyInfo": { "ipv4Unicast": { - "acceptedPrefixCounter": 2, + "acceptedPrefixCounter": 3, } }, "gracefulRestartInfo": { @@ -123,7 +123,7 @@ def test_bgp_dynamic_capability_graceful_restart(): }, "addressFamilyInfo": { "ipv4Unicast": { - "acceptedPrefixCounter": 2, + "acceptedPrefixCounter": 3, } }, "gracefulRestartInfo": { @@ -159,7 +159,7 @@ def test_bgp_dynamic_capability_graceful_restart(): ) # Clear message stats to check if we receive a notification or not after we - # change the settings fo LLGR. + # disable graceful-restart notification support. r1.vtysh_cmd("clear bgp 192.168.1.2 message-stats") r2.vtysh_cmd( """ @@ -207,6 +207,40 @@ def test_bgp_dynamic_capability_graceful_restart(): result is None ), "Session was reset after changing Graceful-Restart notification support" + # Clear message stats to check if we receive a notification or not after we + # disable GR. + r1.vtysh_cmd("clear bgp 192.168.1.2 message-stats") + r1.vtysh_cmd( + """ + configure terminal + router bgp + bgp graceful-restart-disable + """ + ) + + def _bgp_check_if_gr_llgr_capability_is_absent(): + output = json.loads(r1.vtysh_cmd("show bgp neighbor json")) + expected = { + "192.168.1.2": { + "bgpState": "Established", + "neighborCapabilities": { + "dynamic": "advertisedAndReceived", + "gracefulRestartCapability": "received", + "longLivedGracefulRestart": "received", + }, + "messageStats": { + "notificationsRecv": 0, + }, + } + } + return topotest.json_cmp(output, expected) + + test_func = functools.partial( + _bgp_check_if_gr_llgr_capability_is_absent, + ) + _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) + assert result is None, "Failed to disable GR/LLGR capabilities" + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] |