]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Add large community json support 1205/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 19 Sep 2017 17:57:35 +0000 (13:57 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 19 Sep 2017 17:57:35 +0000 (13:57 -0400)
Add the ability to display large commnunity json support

Fixes: 1191
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_route.c

index e3f63f11b6a4e8a5ddd045136b1c3e33b9870451..a12abd9fd037a4cf308162fb04cb121c740b07e5 100644 (file)
@@ -7328,6 +7328,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
        json_object *json_cluster_list = NULL;
        json_object *json_cluster_list_list = NULL;
        json_object *json_ext_community = NULL;
+       json_object *json_lcommunity = NULL;
        json_object *json_last_update = NULL;
        json_object *json_nexthop_global = NULL;
        json_object *json_nexthop_ll = NULL;
@@ -7900,9 +7901,20 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
                }
 
                /* Line 6 display Large community */
-               if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES))
-                       vty_out(vty, "      Large Community: %s\n",
-                               attr->lcommunity->str);
+               if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES)) {
+                       if (json_paths) {
+                               json_lcommunity = json_object_new_object();
+                               json_object_string_add(json_lcommunity,
+                                                      "string",
+                                                      attr->lcommunity->str);
+                               json_object_object_add(json_path,
+                                                      "largeCommunity",
+                                                      json_lcommunity);
+                       } else {
+                               vty_out(vty, "      Large Community: %s\n",
+                                       attr->lcommunity->str);
+                       }
+               }
 
                /* Line 7 display Originator, Cluster-id */
                if ((attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))