]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: EVPN route type-5 gateway IP show command
authorAmeya Dharkar <adharkar@vmware.com>
Mon, 11 Jan 2021 03:49:11 +0000 (19:49 -0800)
committerAmeya Dharkar <adharkar@vmware.com>
Tue, 8 Jun 2021 00:58:22 +0000 (17:58 -0700)
Display gateway IP attribute in show command

"show bgp l2vpn evpn route type prefix [json]"

dev# sh bgp l2vpn evpn 100.0.0.21
BGP routing table entry for 10.100.0.2:1000:[5]:[0]:[32]:[100.0.0.21]
Paths: (1 available, best #1)
  Advertised to non peer-group peers:
  10.0.1.1
  Route [5]:[0]:[32]:[100.0.0.21] VNI 1000 Gateway IP 50.0.2.21
  203
    10.100.0.2 from 0.0.0.0 (10.100.0.2)
      Origin IGP, metric 0, valid, sourced, local, best (First path received)
      Extended Community: ET:8 RT:102:1000 Rmac:72:48:54:da:7f:13
      Last update: Mon Jun 29 12:29:05 2020

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
bgpd/bgp_route.c

index c539bccb62930ce3c689920d94b43cfb521afde5..4ec8ac305a1dd85a10861c4367312739f9f1a35f 100644 (file)
@@ -9647,6 +9647,11 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
                json_nexthop_global = json_object_new_object();
        }
 
+       if (safi == SAFI_EVPN) {
+               if (!json_paths)
+                       vty_out(vty, "  Route %pRN", bn);
+       }
+
        if (path->extra) {
                char tag_buf[30];
 
@@ -9658,12 +9663,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
                }
                if (safi == SAFI_EVPN) {
                        if (!json_paths) {
-                               vty_out(vty, "  Route %pFX",
-                                       (struct prefix_evpn *)
-                                               bgp_dest_get_prefix(bn));
                                if (tag_buf[0] != '\0')
                                        vty_out(vty, " VNI %s", tag_buf);
-                               vty_out(vty, "\n");
                        } else {
                                if (tag_buf[0])
                                        json_object_string_add(json_path, "VNI",
@@ -9710,6 +9711,27 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
                }
        }
 
+       if (safi == SAFI_EVPN
+           && attr->evpn_overlay.type == OVERLAY_INDEX_GATEWAY_IP) {
+               char gwip_buf[INET6_ADDRSTRLEN];
+
+               if (is_evpn_prefix_ipaddr_v4((struct prefix_evpn *)&bn->p))
+                       inet_ntop(AF_INET, &attr->evpn_overlay.gw_ip.ipv4,
+                                 gwip_buf, sizeof(gwip_buf));
+               else
+                       inet_ntop(AF_INET6, &attr->evpn_overlay.gw_ip.ipv6,
+                                 gwip_buf, sizeof(gwip_buf));
+
+               if (json_paths)
+                       json_object_string_add(json_path, "gatewayIP",
+                                              gwip_buf);
+               else
+                       vty_out(vty, " Gateway IP %s", gwip_buf);
+       }
+
+       if (safi == SAFI_EVPN)
+               vty_out(vty, "\n");
+
        /* Line1 display AS-path, Aggregator */
        if (attr->aspath) {
                if (json_paths) {