summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChirag Shah <chirag@cumulusnetworks.com>2019-11-04 11:15:02 -0800
committerChirag Shah <chirag@cumulusnetworks.com>2019-11-11 07:57:57 -0800
commit90c31d71901664f237a5f26b6f4793cec4499b7c (patch)
treefdc60769ad73da2af01c532f0fc5da2151a864d1
parent527fd6dee52de356a6ef44b4291cf47a2dfef0c8 (diff)
bgpd: fix json output for show cmd for evpn routes
Fix json output where show command displayed "Route Distinguisher: " string in json output because NULL json object passed to bgp_evpn_show_route_rd_header() Testing Done: Route Distinguisher: ip 27.0.0.11:3 Route Distinguisher: ip 27.0.0.11:4 Route Distinguisher: ip 27.0.0.16:3 Route Distinguisher: ip 27.0.0.16:5 Route Distinguisher: ip 27.0.0.16:9 { "27.0.0.11:3":{ "rd":"27.0.0.11:3", "[2]:[0]:[48]:[00:02:00:00:00:02]":{ "prefix":"[2]:[0]:[48]:[00:02:00:00:00:02]", "prefixLen":288, ... } Post fix: { "27.0.0.11:3":{ "rd":"27.0.0.11:3", "[2]:[0]:[48]:[00:02:00:00:00:02]":{ "prefix":"[2]:[0]:[48]:[00:02:00:00:00:02]", "prefixLen":288, ... } Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
-rw-r--r--bgpd/bgp_evpn_vty.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index 7dbeb8029a..3bc8345140 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -2619,10 +2619,8 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type,
prefix_rd2str((struct prefix_rd *)&rd_rn->p, rd_str,
sizeof(rd_str));
- if (json) {
+ if (json)
json_rd = json_object_new_object();
- json_object_string_add(json_rd, "rd", rd_str);
- }
rd_header = 1;
@@ -2659,7 +2657,7 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type,
/* RD header - per RD. */
if (rd_header) {
bgp_evpn_show_route_rd_header(
- vty, rd_rn, NULL, rd_str,
+ vty, rd_rn, json_rd, rd_str,
RD_ADDRSTRLEN);
rd_header = 0;
}