Skip to content

Commit

Permalink
bgpd: add topotest for show bgp router json command
Browse files Browse the repository at this point in the history
This commit has changes to validate show bgp router json command

Signed-off-by: Krishnasamy R <[email protected]>
  • Loading branch information
krishna-samy committed Nov 16, 2024
1 parent 5fb2090 commit 819db39
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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, "Invalid BGP router details"


if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
Expand Down

0 comments on commit 819db39

Please sign in to comment.