From: Daniel Walton Date: Wed, 28 Sep 2016 04:52:36 +0000 (+0000) Subject: use JSON_C_TO_STRING_PRETTY for json_object_to_json_string X-Git-Tag: frr-2.0-rc1~216 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=2aac57679569485060a36bdee1dcf309198f07fd;p=matthieu%2Ffrr.git use JSON_C_TO_STRING_PRETTY for json_object_to_json_string Signed-off-by: Daniel Walton --- diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 5c1df6715c..4656f7502f 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -536,7 +536,7 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u if (use_json) { json_object_object_add(json, "routes", json_routes); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } return CMD_SUCCESS; @@ -743,7 +743,7 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd, if (use_json) { json_object_object_add(json, "routes", json_nroute); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 5b0cf8e225..cb2aec578c 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7543,6 +7543,9 @@ bgp_show_table (struct vty *vty, struct bgp_table *table, if (use_json) { + /* This can produce a LOT of text so do not use + * JSON_C_TO_STRING_PRETTY here + */ json_object_object_add(json, "routes", json_routes); vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); json_object_free(json); @@ -7873,7 +7876,7 @@ bgp_show_route_in_table (struct vty *vty, struct bgp *bgp, if (display) json_object_object_add(json, "paths", json_paths); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -11897,7 +11900,7 @@ bgp_peer_counts (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, u_c if (use_json) { json_object_string_add(json, "warning", "No such neighbor or address family"); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -11932,7 +11935,7 @@ bgp_peer_counts (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, u_c json_object_string_add(json, "pfxctDriftFor", peer->host); json_object_string_add(json, "recommended", "Please report this bug, with the above command output"); } - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -12169,7 +12172,7 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, if (use_json) { json_object_string_add(json, "alert", "no BGP"); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -12310,7 +12313,7 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, } if (use_json) { - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } @@ -12330,7 +12333,7 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, if (use_json) { json_object_string_add(json, "warning", "No such neighbor or address family"); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -12344,7 +12347,7 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, if (use_json) { json_object_string_add(json, "warning", "Inbound soft reconfiguration not enabled"); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 012d1d25a2..cf5ba1f6ec 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -10117,7 +10117,7 @@ DEFUN (show_bgp_vrfs, json_object_int_add(json, "totalVrfs", count); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -10561,7 +10561,7 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, json_object_int_add(json, "totalPeers", count); json_object_int_add(json, "dynamicPeers", dn_count); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -12674,7 +12674,7 @@ bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type, if (use_json) { - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -12705,7 +12705,7 @@ bgp_show_neighbor_vty (struct vty *vty, const char *name, if (use_json) { json_object_boolean_true_add(json, "bgpNoSuchInstance"); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else diff --git a/lib/plist.c b/lib/plist.c index eedb830c1a..336c55a084 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -2839,7 +2839,7 @@ prefix_bgp_show_prefix_list (struct vty *vty, afi_t afi, char *name, u_char use_ else json_object_object_add(json, "ipv6PrefixList", json_prefix); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 1b26c67866..d9a4289edf 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -3575,7 +3575,7 @@ show_ip_ospf_common (struct vty *vty, struct ospf *ospf, u_char use_json) if (use_json) { json_object_object_add(json, "areas", json_areas); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -3983,7 +3983,7 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc, if (use_json) { - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -4140,7 +4140,7 @@ show_ip_ospf_neighbor_common (struct vty *vty, struct ospf *ospf, u_char use_jso if (use_json) { - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -4251,7 +4251,7 @@ show_ip_ospf_neighbor_all_common (struct vty *vty, struct ospf *ospf, u_char use if (use_json) { - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -4345,7 +4345,7 @@ show_ip_ospf_neighbor_int_common (struct vty *vty, struct ospf *ospf, int arg_ba if (use_json) { - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -4711,7 +4711,7 @@ show_ip_ospf_neighbor_id_common (struct vty *vty, struct ospf *ospf, if (use_json) { - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -4802,7 +4802,7 @@ show_ip_ospf_neighbor_detail_common (struct vty *vty, struct ospf *ospf, u_char if (use_json) { - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -4897,7 +4897,7 @@ show_ip_ospf_neighbor_detail_all_common (struct vty *vty, struct ospf *ospf, u_c if (use_json) { - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -5001,7 +5001,7 @@ show_ip_ospf_neighbor_int_detail_common (struct vty *vty, struct ospf *ospf, if (use_json) { - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 185cddea64..977c84d4dd 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -1761,7 +1761,7 @@ zebra_mpls_print_lsp (struct vty *vty, struct zebra_vrf *zvrf, mpls_label_t labe if (use_json) { json = lsp_json(lsp); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -1791,7 +1791,7 @@ zebra_mpls_print_lsp_table (struct vty *vty, struct zebra_vrf *zvrf, json_object_object_add(json, label2str(lsp->ile.in_label, buf, BUFSIZ), lsp_json(lsp)); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index e76e4ab8fa..1a9fc2294e 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2487,7 +2487,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi, } } - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else @@ -4923,7 +4923,7 @@ DEFUN (show_ipv6_route, } } - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); json_object_free(json); } else