]> git.puffer.fish Git - matthieu/frr.git/commitdiff
BGP: "show ip bgp json" should return empty "routes : {}" if the table
authorDaniel Walton <dwalton@cumulusnetworks.com>
Thu, 17 Sep 2015 14:54:20 +0000 (07:54 -0700)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Thu, 17 Sep 2015 14:54:20 +0000 (07:54 -0700)
is empty

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-7475
Reviewed By: Donald Sharp
Testing Done:

If the BGP table is empty, intead of returning

{'alert': 'No BGP network exists', 'routerId': '10.0.9.2',
'tableVersion': 180}

we should return

{'routerId': '10.0.9.2', 'routes': {}, 'tableVersion': 180}

This provides a more consistent json interface which is easier to script
against.

bgpd/bgp_route.c

index 7913867dfa3a3719174713af2035ba35a4e08647..2e35f15ec4c9126ecfa998489648240641a84432 100644 (file)
@@ -8084,15 +8084,7 @@ bgp_show_table (struct vty *vty, struct bgp_table *table, struct in_addr *router
 
   if (use_json)
     {
-      if (output_count == 0)
-        {
-          if (type == bgp_show_type_normal)
-            json_object_string_add(json, "alert", "No BGP network exists");
-          else
-            json_object_string_add(json, "alert", "No route output");
-        }
-      else
-        json_object_object_add(json, "routes", json_routes);
+      json_object_object_add(json, "routes", json_routes);
       vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
       json_object_free(json);
     }