]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Add advertsie-all-vni in show bgp neighbor
authorMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>
Mon, 7 Aug 2017 20:57:44 +0000 (13:57 -0700)
committerMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>
Thu, 17 Aug 2017 09:05:53 +0000 (02:05 -0700)
Ticket: CM-17249
Review: CCR-6558
Testing: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
bgpd/bgp_evpn.c
bgpd/bgp_evpn_vty.c
bgpd/bgp_vty.c

index 707728f9da7ae32179f5e282ba66068a1a31a874..5da773d7a3d3b986b753711298caa8c24f46801c 100644 (file)
@@ -2200,43 +2200,54 @@ bgp_evpn_route2json (struct prefix_evpn *p, json_object *json)
   if (!json)
     return;
 
-  if (p->prefix.route_type == BGP_EVPN_IMET_ROUTE)
-    {
-      json_object_int_add (json, "routeType", p->prefix.route_type);
-      json_object_int_add (json, "ethTag", 0);
-      json_object_int_add (json, "ipLen", IS_EVPN_PREFIX_IPADDR_V4 (p) ? IPV4_MAX_BITLEN : IPV6_MAX_BITLEN);
-      json_object_string_add (json, "ip", inet_ntoa (p->prefix.ip.ipaddr_v4));
-    }
-  else if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE)
-    {
-      if (IS_EVPN_PREFIX_IPADDR_NONE(p))
-        {
-          json_object_int_add (json, "routeType", p->prefix.route_type);
-          json_object_int_add (json, "esi", 0); /* TODO: we don't support esi yet */
-          json_object_int_add (json, "ethTag", 0);
-          json_object_int_add (json, "macLen", 8 * ETHER_ADDR_LEN);
-          json_object_string_add (json, "mac", prefix_mac2str (&p->prefix.mac, buf1, sizeof (buf1)));
-        }
-      else
-        {
-          u_char family;
-
-          family = IS_EVPN_PREFIX_IPADDR_V4(p) ? \
-                   AF_INET : AF_INET6;
-
-          json_object_int_add (json, "routeType", p->prefix.route_type);
-          json_object_int_add (json, "esi", 0); /* TODO: we don't support esi yet */
-          json_object_int_add (json, "ethTag", 0);
-          json_object_int_add (json, "macLen", 8 * ETHER_ADDR_LEN);
-          json_object_string_add (json, "mac", prefix_mac2str (&p->prefix.mac, buf1, sizeof (buf1)));
-          json_object_int_add (json, "ipLen", IS_EVPN_PREFIX_IPADDR_V4 (p) ? IPV4_MAX_BITLEN : IPV6_MAX_BITLEN);
-          json_object_string_add (json, "ip", inet_ntop (family, &p->prefix.ip.ip.addr, buf2, PREFIX2STR_BUFFER));
-        }
-    }
-  else
-    {
-      /* Currently, this is to cater to other AF_ETHERNET code. */
-    }
+       if (p->prefix.route_type == BGP_EVPN_IMET_ROUTE) {
+               json_object_int_add (json, "routeType", p->prefix.route_type);
+               json_object_int_add (json, "ethTag", 0);
+               json_object_int_add (json,
+                                    "ipLen",
+                                    IS_EVPN_PREFIX_IPADDR_V4 (p) ?
+                                       IPV4_MAX_BITLEN : IPV6_MAX_BITLEN);
+               json_object_string_add (json, "ip",
+                                       inet_ntoa (p->prefix.ip.ipaddr_v4));
+       }
+       else if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) {
+               if (IS_EVPN_PREFIX_IPADDR_NONE(p)) {
+                 json_object_int_add (json, "routeType", p->prefix.route_type);
+                 json_object_int_add (json, "esi", 0); /* TODO: we don't support esi yet */
+                 json_object_int_add (json, "ethTag", 0);
+                 json_object_int_add (json, "macLen", 8 * ETH_ALEN);
+                 json_object_string_add (json, "mac",
+                                         prefix_mac2str (&p->prefix.mac,
+                                                         buf1, sizeof (buf1)));
+               } else {
+                       u_char family;
+
+                       family = IS_EVPN_PREFIX_IPADDR_V4(p) ? \
+                          AF_INET : AF_INET6;
+
+                       json_object_int_add (json, "routeType",
+                                            p->prefix.route_type);
+                       json_object_int_add (json, "esi", 0); /* TODO: we don't support esi yet */
+                       json_object_int_add (json, "ethTag", 0);
+                       json_object_int_add (json, "macLen",
+                                            8 * ETH_ALEN);
+                       json_object_string_add (json, "mac",
+                                               prefix_mac2str (&p->prefix.mac,
+                                                               buf1,
+                                                               sizeof (buf1)));
+                       json_object_int_add (json, "ipLen",
+                                            IS_EVPN_PREFIX_IPADDR_V4 (p) ?
+                                               IPV4_MAX_BITLEN :
+                                               IPV6_MAX_BITLEN);
+                       json_object_string_add (json, "ip",
+                                               inet_ntop (family,
+                                                       &p->prefix.ip.ip.addr,
+                                                       buf2,
+                                                       PREFIX2STR_BUFFER));
+               }
+       } else {
+               /* Currently, this is to cater to other AF_ETHERNET code. */
+       }
 
   return;
 }
index 2ba8f29260fe972d499096153da1bb26931f4575..af34c3394611b90f08c03a74aa450557ca2506f6 100644 (file)
@@ -174,7 +174,7 @@ static void show_import_rt_entry(struct hash_backet *backet, void *args[])
        vty = args[0];
        json = args[1];
 
-       display_import_rt(vty, irt);
+       display_import_rt(vty, irt, json);
 
        return;
 }
index cabbade525f9159d1836de180158e3713c181981..80daac236de210e760df33251586db2a30c3bf9f 100644 (file)
@@ -7396,14 +7396,14 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
                              safi_t safi, u_char use_json,
                              json_object *json_neigh)
 {
-       struct bgp_filter *filter;
-       struct peer_af *paf;
-       char orf_pfx_name[BUFSIZ];
-       int orf_pfx_count;
-       json_object *json_af = NULL;
-       json_object *json_prefA = NULL;
-       json_object *json_prefB = NULL;
-       json_object *json_addr = NULL;
+       struct bgp_filter       *filter;
+       struct peer_af          *paf;
+       char                    orf_pfx_name[BUFSIZ];
+       int                     orf_pfx_count;
+       json_object             *json_af = NULL;
+       json_object             *json_prefA = NULL;
+       json_object             *json_prefB = NULL;
+       json_object             *json_addr = NULL;
 
        if (use_json) {
                json_addr = json_object_new_object();
@@ -7602,6 +7602,12 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
                                                             "defaultNotSent");
                }
 
+               if (afi == AFI_L2VPN && safi == SAFI_EVPN) {
+                       if (p->bgp->advertise_all_vni)
+                               json_object_boolean_true_add(json_addr,
+                                                            "advertiseAllVnis");
+               }
+
                if (filter->plist[FILTER_IN].name
                    || filter->dlist[FILTER_IN].name
                    || filter->aslist[FILTER_IN].name
@@ -7867,6 +7873,12 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
                                vty_out(vty, " default not sent\n");
                }
 
+               /* advertise-vni-all */
+               if (afi == AFI_L2VPN && safi == SAFI_EVPN) {
+                       if (p->bgp->advertise_all_vni)
+                               vty_out(vty, "  advertise-all-vni\n");
+               }
+
                if (filter->plist[FILTER_IN].name
                    || filter->dlist[FILTER_IN].name
                    || filter->aslist[FILTER_IN].name
@@ -9768,10 +9780,10 @@ static int bgp_show_neighbor(struct vty *vty, struct bgp *bgp,
 static void bgp_show_all_instances_neighbors_vty(struct vty *vty,
                                                 u_char use_json)
 {
-       struct listnode *node, *nnode;
-       struct bgp *bgp;
-       json_object *json = NULL;
-       int is_first = 1;
+       struct listnode                 *node, *nnode;
+       struct bgp                      *bgp;
+       json_object                     *json = NULL;
+       int                             is_first = 1;
 
        if (use_json)
                vty_out(vty, "{\n");