diff options
author | vivek <vivek@cumulusnetworks.com> | 2017-05-15 23:53:31 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-07-12 21:04:41 +0200 |
commit | 520d5d768b996e96c375562d2b92c37801f9081b (patch) | |
tree | 6c6aeafdcea791e22ad3b19c45fb946ef2b33dab /bgpd/bgp_evpn.c | |
parent | bgpd: Debug logging updates for EVPN (diff) | |
download | frr-520d5d768b996e96c375562d2b92c37801f9081b.tar.xz frr-520d5d768b996e96c375562d2b92c37801f9081b.zip |
bgpd: Display (show) commands for EVPN
Implement various operational/display commands for EVPN:
- show bgp evpn summary
- show bgp evpn vni [<vni>]
- show bgp evpn route [type <macip|multicast>]
- show bgp evpn route [rd <rd> [type <macip|multicast>]]
- show bgp evpn route [rd <rd> [mac <mac> [ip <ip>]]]
- show bgp evpn route vni <vni> [type <macip|multicast> | vtep <ip>]
- show bgp evpn route vni <vni> [mac <mac> [ip <ip>]]]
- show bgp evpn route vni <vni> [multicast <ip>]
- show bgp evpn route vni all [vtep <ip>]
- show bgp evpn import-rt
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_evpn.c')
-rw-r--r-- | bgpd/bgp_evpn.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 5bff85723..f17bcfab1 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -1982,6 +1982,51 @@ bgp_evpn_label2str (mpls_label_t *label, char *buf, int len) } /* + * Function to convert evpn route to string. + * NOTE: We don't use prefix2str as the output here is a bit different. + */ +char * +bgp_evpn_route2str (struct prefix_evpn *p, char *buf, int len) +{ + char buf1[ETHER_ADDR_STRLEN]; + char buf2[PREFIX2STR_BUFFER]; + + if (p->prefix.route_type == BGP_EVPN_IMET_ROUTE) + { + snprintf (buf, len, "[%d]:[0]:[%d]:[%s]", + p->prefix.route_type, IS_EVPN_PREFIX_IPADDR_V4(p) ? \ + IPV4_MAX_BITLEN : IPV6_MAX_BITLEN, + 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)) + snprintf (buf, len, "[%d]:[0]:[0]:[%d]:[%s]", + p->prefix.route_type, 8*ETHER_ADDR_LEN, + prefix_mac2str (&p->prefix.mac, buf1, sizeof(buf1))); + else + { + u_char family; + + family = IS_EVPN_PREFIX_IPADDR_V4(p) ? \ + AF_INET : AF_INET6; + snprintf (buf, len, "[%d]:[0]:[0]:[%d]:[%s]:[%d]:[%s]", + p->prefix.route_type, 8*ETHER_ADDR_LEN, + prefix_mac2str (&p->prefix.mac, buf1, sizeof(buf1)), + family == AF_INET ? IPV4_MAX_BITLEN : IPV6_MAX_BITLEN, + inet_ntop (family, &p->prefix.ip.ip.addr, + buf2, PREFIX2STR_BUFFER)); + } + } + else + { + /* Currently, this is to cater to other AF_ETHERNET code. */ + } + + return(buf); +} + +/* * Encode EVPN prefix in Update (MP_REACH) */ void |