]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: fix json output for show cmd for evpn routes 5311/head
authorChirag Shah <chirag@cumulusnetworks.com>
Mon, 4 Nov 2019 19:15:02 +0000 (11:15 -0800)
committerChirag Shah <chirag@cumulusnetworks.com>
Mon, 11 Nov 2019 15:57:57 +0000 (07:57 -0800)
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>
bgpd/bgp_evpn_vty.c

index 7dbeb8029accf9548fb030f4f8e301cd4b539625..3bc8345140381b86170948ea82ca33aabe3ec68d 100644 (file)
@@ -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;
                                }