]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: non pretty json output for show ip route
authorSindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
Wed, 19 Jul 2023 06:53:15 +0000 (23:53 -0700)
committerChirag Shah <chirag@nvidia.com>
Fri, 21 Jul 2023 17:15:11 +0000 (10:15 -0700)
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 <sgopinathan@nvidia.com>
zebra/zebra_vty.c

index 19366eb2c1c1b9720f526eded857f2859aff5901..291c2eb7e0caaf24aa78b90db99e4286bc52f51a 100644 (file)
@@ -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,