]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: non pretty json output for neighbor routes
authorSindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
Wed, 12 Jul 2023 10:45:26 +0000 (03:45 -0700)
committerChirag Shah <chirag@nvidia.com>
Mon, 24 Jul 2023 17:50:45 +0000 (10:50 -0700)
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 <nbr-id> advertised-routes json
show bgp neighbors <nbr-id> received-routes json
show bgp neighbors <nbr-id> advertised-routes detail json
show bgp neighbors <nbr-id> received-routes detail json
```

Ticket:#3513256
Issue:3513256

Testing: UT done

Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
bgpd/bgp_route.c

index 4e83b36fe0b87d38c0b7b2b2f6b8ad54b03343a4..5f923c598fb09d7478904cbd3614f00b1fd6dce0 100644 (file)
@@ -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",