From e784a60b174d329d1cca184c38cfd8426d32cd43 Mon Sep 17 00:00:00 2001 From: Sindhu Parvathi Gopinathan Date: Wed, 12 Jul 2023 03:45:26 -0700 Subject: [PATCH] bgpd: non pretty json output for neighbor routes Currently, json output of show BGP commands are no pretty format. This is an extremely expensive operation for huge scale (lots of routes with lots of paths). BGP json non-pretty commands support added: ``` show bgp neighbors advertised-routes json show bgp neighbors received-routes json show bgp neighbors advertised-routes detail json show bgp neighbors received-routes detail json ``` Ticket:#3513256 Issue:3513256 Testing: UT done Signed-off-by: Sindhu Parvathi Gopinathan's --- bgpd/bgp_route.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4e83b36fe0..5f923c598f 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -14639,8 +14639,12 @@ CPP_NOTICE("Drop `bgpOriginCodes` from JSON outputs") json_object_free(json_ocode); } - vty_json(vty, json); - } else if (output_count > 0) { + /* + * This is an extremely expensive operation at scale + * and non-pretty reduces memory footprint significantly. + */ + vty_json_no_pretty(vty, json); + } else if (output_count > 0) { if (!match && filtered_count > 0) vty_out(vty, "\nTotal number of prefixes %ld (%ld filtered)\n", -- 2.39.5