Skip to content

Commit

Permalink
bgpd: EVPN route type-5 gateway IP show command
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ameya Dharkar committed Jun 8, 2021
1 parent 6c99562 commit 8304dab
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand All @@ -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",
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 8304dab

Please sign in to comment.