diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-05-02 16:20:10 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-05-03 04:34:21 +0200 |
commit | 5ce77b2b1e6a4ce110f86180da4371a21dadb56e (patch) | |
tree | 0dc321ac423c117081569da5dca59cee5d28c75b /bgpd | |
parent | Merge remote-tracking branch 'origin/stable/3.0' (diff) | |
download | frr-5ce77b2b1e6a4ce110f86180da4371a21dadb56e.tar.xz frr-5ce77b2b1e6a4ce110f86180da4371a21dadb56e.zip |
bgpd: Fix 'show bgp ... summary json' to have empty {}
When we have no output for a json command we should have
an empty {} displayed.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_vty.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 361ab3396..a30721715 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6759,6 +6759,7 @@ bgp_show_summary_afi_safi (struct vty *vty, struct bgp *bgp, int afi, int safi, int afi_wildcard = (afi == AFI_MAX); int safi_wildcard = (safi == SAFI_MAX); int is_wildcard = (afi_wildcard || safi_wildcard); + bool json_output = false; if (use_json && is_wildcard) vty_out (vty, "{%s", VTY_NEWLINE); @@ -6772,6 +6773,7 @@ bgp_show_summary_afi_safi (struct vty *vty, struct bgp *bgp, int afi, int safi, { if (bgp_show_summary_afi_safi_peer_exists (bgp, afi, safi)) { + json_output = true; if (is_wildcard) { /* @@ -6812,7 +6814,8 @@ bgp_show_summary_afi_safi (struct vty *vty, struct bgp *bgp, int afi, int safi, if (use_json && is_wildcard) vty_out (vty, "}%s", VTY_NEWLINE); - + else if (use_json && !json_output) + vty_out (vty, "{}%s", VTY_NEWLINE); } static void |