From 0224b3296c320e0b0c82b0377f44b1cbbb5582dd Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Fri, 18 Nov 2022 16:06:43 +0200 Subject: [PATCH] bgpd: Print empty JSON `{}` if no entries under `show bgp ipv4 vpn json` Before this, the application fails that is parsing JSON (expecting). Signed-off-by: Donatas Abraitis --- bgpd/bgp_route.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4997468ce2..c3cfcef502 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -11719,6 +11719,9 @@ int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi, vty_out(vty, "\nDisplayed %ld routes and %ld total paths\n", output_cum, total_cum); + } else { + if (use_json && output_cum == 0) + vty_out(vty, "{}\n"); } return CMD_SUCCESS; }