From c32f90a0c8108ae3525e5cf67a156dde3086ac55 Mon Sep 17 00:00:00 2001 From: Krishnasamy R Date: Fri, 15 Nov 2024 07:40:50 -0800 Subject: [PATCH] bgpd: add topotest for show bgp router json command This commit has changes to validate show bgp router json command Signed-off-by: Krishnasamy R --- .../test_bgp_gr_notification.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 5d8338d6eb2a..fd1b588a6aca 100644 --- a/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py +++ b/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py @@ -187,6 +187,16 @@ def _bgp_clear_r1_and_shutdown(): """ ) + def _bgp_verify_show_bgp_router_json(): + output = json.loads(r1.vtysh_cmd("show bgp router json")) + expected = { + "bgpStartedAt":"*", + "bgpStartedGracefully": False, + "bgpInMaintenanceMode": False, + "bgpInstanceCount":1 + } + return topotest.json_cmp(output, expected) + step("Initial BGP converge") test_func = functools.partial(_bgp_converge) _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) @@ -205,6 +215,11 @@ def _bgp_clear_r1_and_shutdown(): _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) assert result is None, "Failed to send Administrative Reset notification from R2" + step("Check show bgp router json") + test_func = functools.partial(_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 BGP router details" + if __name__ == "__main__": args = ["-s"] + sys.argv[1:]