From 1c67c0951bf39648ca6593449ec234aa6e046304 Mon Sep 17 00:00:00 2001 From: Sindhu Parvathi Gopinathan Date: Tue, 18 Jul 2023 23:53:15 -0700 Subject: [PATCH] zebra: non pretty json output for show ip route Currently, json output of show ip route command are no pretty format. This is an extremely expensive operation at high scale (with high number of routes with many paths). Zebra json non-pretty command support added: ``` show ip route json ``` Ticket:#3513256 Issue:3513256 Testing: UT done Signed-off-by: Sindhu Parvathi Gopinathan's --- zebra/zebra_vty.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 19366eb2c1..291c2eb7e0 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -962,8 +962,12 @@ static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf, } } + /* + * This is an extremely expensive operation at scale + * and non-pretty reduces memory footprint significantly. + */ if (use_json) - vty_json(vty, json); + vty_json_no_pretty(vty, json); } static void do_show_ip_route_all(struct vty *vty, struct zebra_vrf *zvrf, -- 2.39.5