2023-02-08 13:17:09 +01:00
// SPDX-License-Identifier: GPL-2.0-or-later
2017-01-09 18:26:24 +01:00
/* Ethernet-VPN Packet and vty Processing File
2017-05-13 10:25:29 +02:00
* Copyright ( C ) 2017 6 WIND
*
* This file is part of FRRouting
*/
2017-01-09 18:26:24 +01:00
# include <zebra.h>
# include "command.h"
# include "prefix.h"
# include "lib/json.h"
2020-10-15 21:33:09 +02:00
# include "lib/printfrr.h"
2020-05-09 01:35:09 +02:00
# include "lib/vxlan.h"
2017-09-07 15:58:18 +02:00
# include "stream.h"
2017-01-09 18:26:24 +01:00
# include "bgpd/bgpd.h"
# include "bgpd/bgp_table.h"
# include "bgpd/bgp_attr.h"
# include "bgpd/bgp_route.h"
# include "bgpd/bgp_mplsvpn.h"
# include "bgpd/bgp_vpn.h"
# include "bgpd/bgp_evpn_vty.h"
2016-10-27 08:02:36 +02:00
# include "bgpd/bgp_evpn.h"
2017-05-15 23:30:19 +02:00
# include "bgpd/bgp_evpn_private.h"
2020-03-27 14:39:51 +01:00
# include "bgpd/bgp_evpn_mh.h"
2017-05-15 23:30:19 +02:00
# include "bgpd/bgp_zebra.h"
2017-05-15 23:53:31 +02:00
# include "bgpd/bgp_vty.h"
2018-06-15 23:08:53 +02:00
# include "bgpd/bgp_errors.h"
2017-09-13 17:18:51 +02:00
# include "bgpd/bgp_ecommunity.h"
2019-10-07 23:58:39 +02:00
# include "bgpd/bgp_lcommunity.h"
# include "bgpd/bgp_community.h"
2017-01-09 18:26:24 +01:00
# define SHOW_DISPLAY_STANDARD 0
# define SHOW_DISPLAY_TAGS 1
# define SHOW_DISPLAY_OVERLAY 2
2017-08-30 17:23:01 +02:00
# define VNI_STR_LEN 32
2017-01-09 18:26:24 +01:00
2017-05-15 23:53:31 +02:00
/*
* Context for VNI hash walk - used by callbacks .
*/
struct vni_walk_ctx {
struct bgp * bgp ;
struct vty * vty ;
struct in_addr vtep_ip ;
2017-07-21 02:42:20 +02:00
json_object * json ;
2019-03-28 06:49:03 +01:00
int detail ;
2021-10-26 23:55:54 +02:00
int type ;
bool mac_table ;
2017-05-15 23:53:31 +02:00
} ;
2021-01-05 03:31:11 +01:00
int argv_find_and_parse_oly_idx ( struct cmd_token * * argv , int argc , int * oly_idx ,
enum overlay_index_type * oly )
{
* oly = OVERLAY_INDEX_TYPE_NONE ;
2021-06-30 21:37:33 +02:00
if ( argv_find ( argv , argc , " gateway-ip " , oly_idx ) )
* oly = OVERLAY_INDEX_GATEWAY_IP ;
2021-01-05 03:31:11 +01:00
return 1 ;
}
2017-10-10 03:12:05 +02:00
static void display_vrf_import_rt ( struct vty * vty , struct vrf_irt_node * irt ,
json_object * json )
{
2020-03-23 13:41:17 +01:00
const uint8_t * pnt ;
2018-03-27 21:13:34 +02:00
uint8_t type , sub_type ;
2017-10-10 03:12:05 +02:00
struct ecommunity_as eas ;
struct ecommunity_ip eip ;
struct listnode * node , * nnode ;
struct bgp * tmp_bgp_vrf = NULL ;
json_object * json_rt = NULL ;
json_object * json_vrfs = NULL ;
char rt_buf [ RT_ADDRSTRLEN ] ;
if ( json ) {
json_rt = json_object_new_object ( ) ;
json_vrfs = json_object_new_array ( ) ;
}
2018-03-27 21:13:34 +02:00
pnt = ( uint8_t * ) & irt - > rt . val ;
2017-10-10 03:12:05 +02:00
type = * pnt + + ;
sub_type = * pnt + + ;
if ( sub_type ! = ECOMMUNITY_ROUTE_TARGET )
return ;
memset ( & eas , 0 , sizeof ( eas ) ) ;
switch ( type ) {
case ECOMMUNITY_ENCODE_AS :
eas . as = ( * pnt + + < < 8 ) ;
eas . as | = ( * pnt + + ) ;
2018-02-17 20:59:32 +01:00
ptr_get_be32 ( pnt , & eas . val ) ;
2017-10-10 03:12:05 +02:00
2020-04-20 20:12:38 +02:00
snprintf ( rt_buf , sizeof ( rt_buf ) , " %u:%u " , eas . as , eas . val ) ;
2017-10-10 03:12:05 +02:00
if ( json )
json_object_string_add ( json_rt , " rt " , rt_buf ) ;
else
vty_out ( vty , " Route-target: %s " , rt_buf ) ;
break ;
case ECOMMUNITY_ENCODE_IP :
memcpy ( & eip . ip , pnt , 4 ) ;
pnt + = 4 ;
eip . val = ( * pnt + + < < 8 ) ;
eip . val | = ( * pnt + + ) ;
2020-10-15 21:33:09 +02:00
snprintfrr ( rt_buf , sizeof ( rt_buf ) , " %pI4:%u " , & eip . ip , eip . val ) ;
2017-10-10 03:12:05 +02:00
if ( json )
json_object_string_add ( json_rt , " rt " , rt_buf ) ;
else
vty_out ( vty , " Route-target: %s " , rt_buf ) ;
break ;
case ECOMMUNITY_ENCODE_AS4 :
2025-02-11 20:35:28 +01:00
pnt = ptr_get_be32 ( pnt , & eas . as ) ;
2017-10-10 03:12:05 +02:00
eas . val = ( * pnt + + < < 8 ) ;
eas . val | = ( * pnt + + ) ;
2020-04-20 20:12:38 +02:00
snprintf ( rt_buf , sizeof ( rt_buf ) , " %u:%u " , eas . as , eas . val ) ;
2017-10-10 03:12:05 +02:00
if ( json )
json_object_string_add ( json_rt , " rt " , rt_buf ) ;
else
vty_out ( vty , " Route-target: %s " , rt_buf ) ;
break ;
default :
return ;
}
if ( ! json ) {
vty_out ( vty ,
" \n List of VRFs importing routes with this route-target: \n " ) ;
}
for ( ALL_LIST_ELEMENTS ( irt - > vrfs , node , nnode , tmp_bgp_vrf ) ) {
if ( json )
json_object_array_add (
json_vrfs ,
json_object_new_string (
vrf_id_to_name ( tmp_bgp_vrf - > vrf_id ) ) ) ;
else
vty_out ( vty , " %s \n " ,
vrf_id_to_name ( tmp_bgp_vrf - > vrf_id ) ) ;
}
if ( json ) {
json_object_object_add ( json_rt , " vrfs " , json_vrfs ) ;
json_object_object_add ( json , rt_buf , json_rt ) ;
}
}
2019-02-19 16:46:52 +01:00
static void show_vrf_import_rt_entry ( struct hash_bucket * bucket , void * args [ ] )
2017-10-10 03:12:05 +02:00
{
json_object * json = NULL ;
struct vty * vty = NULL ;
2019-02-19 16:46:52 +01:00
struct vrf_irt_node * irt = ( struct vrf_irt_node * ) bucket - > data ;
2017-10-10 03:12:05 +02:00
2017-10-17 10:33:24 +02:00
vty = ( struct vty * ) args [ 0 ] ;
json = ( struct json_object * ) args [ 1 ] ;
2017-10-10 03:12:05 +02:00
display_vrf_import_rt ( vty , irt , json ) ;
}
2017-07-21 02:42:20 +02:00
static void display_import_rt ( struct vty * vty , struct irt_node * irt ,
json_object * json )
2017-07-17 14:03:14 +02:00
{
2020-03-23 13:41:17 +01:00
const uint8_t * pnt ;
2018-03-27 21:13:34 +02:00
uint8_t type , sub_type ;
2017-09-13 17:18:51 +02:00
struct ecommunity_as eas ;
struct ecommunity_ip eip ;
2017-05-15 23:53:31 +02:00
struct listnode * node , * nnode ;
struct bgpevpn * tmp_vpn ;
2017-07-21 02:42:20 +02:00
json_object * json_rt = NULL ;
json_object * json_vnis = NULL ;
char rt_buf [ RT_ADDRSTRLEN ] ;
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
if ( json ) {
2017-08-14 06:52:04 +02:00
json_rt = json_object_new_object ( ) ;
json_vnis = json_object_new_array ( ) ;
2017-07-21 02:42:20 +02:00
}
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
/* TODO: This needs to go into a function */
2017-07-17 14:03:14 +02:00
2018-03-27 21:13:34 +02:00
pnt = ( uint8_t * ) & irt - > rt . val ;
2017-05-15 23:53:31 +02:00
type = * pnt + + ;
sub_type = * pnt + + ;
if ( sub_type ! = ECOMMUNITY_ROUTE_TARGET )
2017-07-17 14:03:14 +02:00
return ;
2017-09-13 15:14:46 +02:00
memset ( & eas , 0 , sizeof ( eas ) ) ;
2017-05-15 23:53:31 +02:00
switch ( type ) {
case ECOMMUNITY_ENCODE_AS :
eas . as = ( * pnt + + < < 8 ) ;
eas . as | = ( * pnt + + ) ;
2018-02-17 20:59:32 +01:00
ptr_get_be32 ( pnt , & eas . val ) ;
2017-07-17 14:03:14 +02:00
2020-04-20 20:12:38 +02:00
snprintf ( rt_buf , sizeof ( rt_buf ) , " %u:%u " , eas . as , eas . val ) ;
2017-07-21 02:42:20 +02:00
if ( json )
json_object_string_add ( json_rt , " rt " , rt_buf ) ;
else
vty_out ( vty , " Route-target: %s " , rt_buf ) ;
2017-07-17 14:03:14 +02:00
break ;
2017-05-15 23:53:31 +02:00
case ECOMMUNITY_ENCODE_IP :
memcpy ( & eip . ip , pnt , 4 ) ;
pnt + = 4 ;
eip . val = ( * pnt + + < < 8 ) ;
eip . val | = ( * pnt + + ) ;
2017-07-17 14:03:14 +02:00
2020-10-15 21:33:09 +02:00
snprintfrr ( rt_buf , sizeof ( rt_buf ) , " %pI4:%u " , & eip . ip , eip . val ) ;
2017-07-21 02:42:20 +02:00
if ( json )
json_object_string_add ( json_rt , " rt " , rt_buf ) ;
else
vty_out ( vty , " Route-target: %s " , rt_buf ) ;
2017-07-17 14:03:14 +02:00
break ;
2017-05-15 23:53:31 +02:00
case ECOMMUNITY_ENCODE_AS4 :
2025-02-11 20:35:28 +01:00
pnt = ptr_get_be32 ( pnt , & eas . as ) ;
2017-05-15 23:53:31 +02:00
eas . val = ( * pnt + + < < 8 ) ;
eas . val | = ( * pnt + + ) ;
2017-07-17 14:03:14 +02:00
2020-04-20 20:12:38 +02:00
snprintf ( rt_buf , sizeof ( rt_buf ) , " %u:%u " , eas . as , eas . val ) ;
2017-07-21 02:42:20 +02:00
if ( json )
json_object_string_add ( json_rt , " rt " , rt_buf ) ;
else
vty_out ( vty , " Route-target: %s " , rt_buf ) ;
2017-07-17 14:03:14 +02:00
break ;
default :
return ;
}
2017-07-21 02:42:20 +02:00
if ( ! json ) {
vty_out ( vty ,
" \n List of VNIs importing routes with this route-target: \n " ) ;
}
for ( ALL_LIST_ELEMENTS ( irt - > vnis , node , nnode , tmp_vpn ) ) {
if ( json )
json_object_array_add (
2018-06-29 02:45:32 +02:00
json_vnis , json_object_new_int ( tmp_vpn - > vni ) ) ;
2017-07-21 02:42:20 +02:00
else
vty_out ( vty , " %u \n " , tmp_vpn - > vni ) ;
}
if ( json ) {
json_object_object_add ( json_rt , " vnis " , json_vnis ) ;
json_object_object_add ( json , rt_buf , json_rt ) ;
}
2017-07-17 14:03:14 +02:00
}
2019-02-19 16:46:52 +01:00
static void show_import_rt_entry ( struct hash_bucket * bucket , void * args [ ] )
2017-05-15 23:53:31 +02:00
{
2017-07-21 02:42:20 +02:00
json_object * json = NULL ;
struct vty * vty = NULL ;
2019-02-19 16:46:52 +01:00
struct irt_node * irt = ( struct irt_node * ) bucket - > data ;
2017-07-21 02:42:20 +02:00
vty = args [ 0 ] ;
json = args [ 1 ] ;
2017-08-07 22:57:44 +02:00
display_import_rt ( vty , irt , json ) ;
2017-07-21 02:42:20 +02:00
return ;
2017-07-17 14:03:14 +02:00
}
2017-05-15 23:53:31 +02:00
static void bgp_evpn_show_route_rd_header ( struct vty * vty ,
2020-03-27 00:11:58 +01:00
struct bgp_dest * rd_dest ,
json_object * json , char * rd_str ,
int len )
2017-07-17 14:03:14 +02:00
{
2018-03-27 21:13:34 +02:00
uint16_t type ;
2017-05-15 23:53:31 +02:00
struct rd_as rd_as ;
struct rd_ip rd_ip ;
2020-03-22 05:02:18 +01:00
const uint8_t * pnt ;
2020-03-27 00:11:58 +01:00
const struct prefix * p = bgp_dest_get_prefix ( rd_dest ) ;
2017-05-15 23:53:31 +02:00
2020-03-22 05:02:18 +01:00
pnt = p - > u . val ;
2017-05-15 23:53:31 +02:00
/* Decode RD type. */
type = decode_rd_type ( pnt ) ;
2019-10-07 23:20:02 +02:00
if ( ! json )
vty_out ( vty , " Route Distinguisher: " ) ;
2017-05-15 23:53:31 +02:00
switch ( type ) {
case RD_TYPE_AS :
decode_rd_as ( pnt + 2 , & rd_as ) ;
2019-10-07 23:20:02 +02:00
snprintf ( rd_str , len , " %u:%d " , rd_as . as , rd_as . val ) ;
if ( json )
json_object_string_add ( json , " rd " , rd_str ) ;
else
2019-11-04 20:15:02 +01:00
vty_out ( vty , " %s \n " , rd_str ) ;
2019-10-07 23:20:02 +02:00
break ;
case RD_TYPE_AS4 :
decode_rd_as4 ( pnt + 2 , & rd_as ) ;
snprintf ( rd_str , len , " %u:%d " , rd_as . as , rd_as . val ) ;
if ( json )
json_object_string_add ( json , " rd " , rd_str ) ;
else
2019-11-04 20:15:02 +01:00
vty_out ( vty , " %s \n " , rd_str ) ;
2017-05-15 23:53:31 +02:00
break ;
case RD_TYPE_IP :
decode_rd_ip ( pnt + 2 , & rd_ip ) ;
2020-10-15 21:33:09 +02:00
snprintfrr ( rd_str , len , " %pI4:%d " , & rd_ip . ip , rd_ip . val ) ;
2019-10-07 23:20:02 +02:00
if ( json )
json_object_string_add ( json , " rd " , rd_str ) ;
else
2019-11-04 20:15:02 +01:00
vty_out ( vty , " %s \n " , rd_str ) ;
2017-05-15 23:53:31 +02:00
break ;
default :
2019-10-07 23:20:02 +02:00
if ( json ) {
snprintf ( rd_str , len , " Unknown " ) ;
json_object_string_add ( json , " rd " , rd_str ) ;
} else {
snprintf ( rd_str , len , " Unknown RD type " ) ;
2019-11-04 20:15:02 +01:00
vty_out ( vty , " %s \n " , rd_str ) ;
2019-10-07 23:20:02 +02:00
}
2017-07-17 14:03:14 +02:00
break ;
}
}
2017-07-21 02:42:20 +02:00
static void bgp_evpn_show_route_header ( struct vty * vty , struct bgp * bgp ,
2017-11-02 00:57:55 +01:00
uint64_t tbl_ver , json_object * json )
2017-07-17 14:03:14 +02:00
{
2017-05-15 23:53:31 +02:00
char ri_header [ ] =
" Network Next Hop Metric LocPrf Weight Path \n " ;
2017-07-21 02:42:20 +02:00
if ( json )
return ;
2020-10-15 21:33:09 +02:00
vty_out ( vty ,
" BGP table version is % " PRIu64 " , local router ID is %pI4 \n " ,
tbl_ver , & bgp - > router_id ) ;
2017-05-15 23:53:31 +02:00
vty_out ( vty ,
2020-03-27 12:35:23 +01:00
" Status codes: s suppressed, d damped, h history, * valid, > best, i - internal \n " ) ;
2017-05-15 23:53:31 +02:00
vty_out ( vty , " Origin codes: i - IGP, e - EGP, ? - incomplete \n " ) ;
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
vty_out ( vty ,
lib, bgpd: changes for EAD-per-ES fragmentation
The EAD-per-ES route carries ECs for all the ES-EVI RTs. As the number of VNIs
increase all RTs do not fit into a standard BGP UPDATE (4K) so the route needs
to be fragmented.
Each fragment is associated with a separate RD and frag-id -
1. Local ES-per-EAD -
ES route table - {ES-frag-ID, ESI, ET=0xffffffff, VTEP-IP}
global route table - {RD-=ES-frag-RD, ESI, ET=0xffffffff}
2. Remote ES-per-EAD -
VNI route table - {ESI, ET=0xffffffff, VTEP-IP}
global route table - {RD-=ES-frag-RD, ESI, ET=0xffffffff}
Note: The fragment ID is abandoned in the per-VNI routing table. At this
point that is acceptable as we dont expect more than one-ES-per-EAD fragment
to be imported into the per-VNI routing table. But that may need to be
re-worked at a later point.
CLI changes (sample with 4 VNIs per-fragment for experimental pruposes) -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root@torm-11:mgmt:~# vtysh -c "show bgp l2vpn evpn es 03:44:38:39:ff:ff:01:00:00:01"
ESI: 03:44:38:39:ff:ff:01:00:00:01
Type: LR
RD: 27.0.0.21:3
Originator-IP: 27.0.0.21
Local ES DF preference: 50000
VNI Count: 10
Remote VNI Count: 10
VRF Count: 3
MACIP EVI Path Count: 33
MACIP Global Path Count: 198
Inconsistent VNI VTEP Count: 0
Inconsistencies: -
Fragments: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
27.0.0.21:3 EVIs: 4
27.0.0.21:13 EVIs: 4
27.0.0.21:22 EVIs: 2
VTEPs:
27.0.0.22 flags: EA df_alg: preference df_pref: 32767
27.0.0.23 flags: EA df_alg: preference df_pref: 32767
root@torm-11:mgmt:~# vtysh -c "show bgp l2vpn evpn es-evi vni 1002 detail"
VNI: 1002 ESI: 03:44:38:39:ff:ff:01:00:00:01
Type: LR
ES fragment RD: 27.0.0.21:13 >>>>>>>>>>>>>>>>>>>>>>>>>
Inconsistencies: -
VTEPs: 27.0.0.22(EV),27.0.0.23(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
PS: The number of EVIs per-fragment has been set to 128 and may need further
tuning.
Ticket: #2632967
Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2021-06-04 02:28:43 +02:00
" EVPN type-1 prefix: [1]:[EthTag]:[ESI]:[IPlen]:[VTEP-IP]:[Frag-id] \n " ) ;
2017-05-15 23:53:31 +02:00
vty_out ( vty ,
2018-04-06 15:52:48 +02:00
" EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP] \n " ) ;
2018-01-05 02:58:29 +01:00
vty_out ( vty , " EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP] \n " ) ;
2018-04-14 00:01:12 +02:00
vty_out ( vty , " EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP] \n " ) ;
2018-04-06 15:52:48 +02:00
vty_out ( vty , " EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP] \n \n " ) ;
2017-05-15 23:53:31 +02:00
vty_out ( vty , " %s " , ri_header ) ;
2017-07-17 14:03:14 +02:00
}
2017-05-15 23:53:31 +02:00
2017-11-15 10:01:00 +01:00
static void display_l3vni ( struct vty * vty , struct bgp * bgp_vrf ,
json_object * json )
{
char * ecom_str ;
struct listnode * node , * nnode ;
2021-02-17 22:11:49 +01:00
struct vrf_route_target * l3rt ;
2023-05-08 05:11:01 +02:00
struct bgp * bgp_evpn = NULL ;
2017-11-15 10:01:00 +01:00
json_object * json_import_rtl = NULL ;
json_object * json_export_rtl = NULL ;
2023-05-08 05:11:01 +02:00
bgp_evpn = bgp_get_evpn ( ) ;
2017-11-15 10:01:00 +01:00
json_import_rtl = json_export_rtl = 0 ;
if ( json ) {
json_import_rtl = json_object_new_array ( ) ;
json_export_rtl = json_object_new_array ( ) ;
json_object_int_add ( json , " vni " , bgp_vrf - > l3vni ) ;
json_object_string_add ( json , " type " , " L3 " ) ;
bgpd: readjust fields in evpn vni json cmd
1) Keep consistant field name, such as
"inKernel".
2) Keep fields order same for both outputs.
Testing Done:
TORS1# show bgp l2vpn evpn vni json
{
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"advertiseAllVnis":"Enabled",
"flooding":"Head-end replication",
"numVnis":8,
"numL2Vnis":5,
"numL3Vnis":3,
"1002":{
"vni":1002,
"type":"L2",
"inKernel":"True",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRTs":[
"5550:1002"
],
"exportRTs":[
"5550:1002"
]
},
}
TORS1# show bgp l2vpn evpn vni 1002 json
{
"vni":1002,
"type":"L2",
"inKernel":"True",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRts":[
"5550:1002"
],
"exportRts":[
"5550:1002"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 01:50:19 +01:00
json_object_string_add ( json , " inKernel " , " True " ) ;
2022-11-22 09:57:10 +01:00
json_object_string_addf ( json , " rd " ,
BGP_RD_AS_FORMAT ( bgp_vrf - > asnotation ) ,
& bgp_vrf - > vrf_prd ) ;
2021-11-18 09:55:47 +01:00
json_object_string_addf ( json , " originatorIp " , " %pI4 " ,
& bgp_vrf - > originator_ip ) ;
2023-05-08 05:11:01 +02:00
if ( bgp_evpn & & bgp_evpn - > evpn_info ) {
ecom_str = ecommunity_ecom2str (
bgp_evpn - > evpn_info - > soo ,
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
json_object_string_add ( json , " siteOfOrigin " , ecom_str ) ;
ecommunity_strfree ( & ecom_str ) ;
}
2017-11-15 10:01:00 +01:00
json_object_string_add ( json , " advertiseGatewayMacip " , " n/a " ) ;
2020-02-11 20:35:53 +01:00
json_object_string_add ( json , " advertiseSviMacIp " , " n/a " ) ;
2023-08-07 21:11:05 +02:00
if ( bgp_vrf - > evpn_info ) {
2023-05-08 05:11:01 +02:00
json_object_string_add ( json , " advertisePip " ,
bgp_vrf - > evpn_info - > advertise_pip
? " Enabled "
: " Disabled " ) ;
json_object_string_addf ( json , " sysIP " , " %pI4 " ,
& bgp_vrf - > evpn_info - > pip_ip ) ;
json_object_string_addf ( json , " sysMac " , " %pEA " ,
& bgp_vrf - > evpn_info - > pip_rmac ) ;
}
json_object_string_addf ( json , " rmac " , " %pEA " , & bgp_vrf - > rmac ) ;
2017-11-15 10:01:00 +01:00
} else {
vty_out ( vty , " VNI: %d " , bgp_vrf - > l3vni ) ;
vty_out ( vty , " (known to the kernel) " ) ;
vty_out ( vty , " \n " ) ;
vty_out ( vty , " Type: %s \n " , " L3 " ) ;
vty_out ( vty , " Tenant VRF: %s \n " ,
vrf_id_to_name ( bgp_vrf - > vrf_id ) ) ;
2022-11-22 09:57:10 +01:00
vty_out ( vty , " RD: " ) ;
vty_out ( vty , BGP_RD_AS_FORMAT ( bgp_vrf - > asnotation ) ,
& bgp_vrf - > vrf_prd ) ;
vty_out ( vty , " \n " ) ;
2020-10-15 21:33:09 +02:00
vty_out ( vty , " Originator IP: %pI4 \n " ,
& bgp_vrf - > originator_ip ) ;
2023-05-08 05:11:01 +02:00
if ( bgp_evpn & & bgp_evpn - > evpn_info ) {
ecom_str = ecommunity_ecom2str (
bgp_evpn - > evpn_info - > soo ,
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
vty_out ( vty , " MAC-VRF Site-of-Origin: %s \n " ,
ecom_str ) ;
ecommunity_strfree ( & ecom_str ) ;
}
2017-11-15 10:01:00 +01:00
vty_out ( vty , " Advertise-gw-macip : %s \n " , " n/a " ) ;
2019-09-20 00:15:45 +02:00
vty_out ( vty , " Advertise-svi-macip : %s \n " , " n/a " ) ;
2023-07-03 19:00:07 +02:00
if ( bgp_vrf - > evpn_info ) {
2023-05-08 05:11:01 +02:00
vty_out ( vty , " Advertise-pip: %s \n " ,
bgp_vrf - > evpn_info - > advertise_pip ? " Yes "
: " No " ) ;
vty_out ( vty , " System-IP: %pI4 \n " ,
& bgp_vrf - > evpn_info - > pip_ip ) ;
vty_out ( vty , " System-MAC: %pEA \n " ,
& bgp_vrf - > evpn_info - > pip_rmac ) ;
}
vty_out ( vty , " Router-MAC: %pEA \n " , & bgp_vrf - > rmac ) ;
2017-11-15 10:01:00 +01:00
}
if ( ! json )
vty_out ( vty , " Import Route Target: \n " ) ;
2021-02-17 22:11:49 +01:00
for ( ALL_LIST_ELEMENTS ( bgp_vrf - > vrf_import_rtl , node , nnode , l3rt ) ) {
ecom_str = ecommunity_ecom2str ( l3rt - > ecom ,
2017-11-15 10:01:00 +01:00
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
if ( json )
json_object_array_add ( json_import_rtl ,
json_object_new_string ( ecom_str ) ) ;
else
vty_out ( vty , " %s \n " , ecom_str ) ;
2023-05-08 05:11:01 +02:00
ecommunity_strfree ( & ecom_str ) ;
2017-11-15 10:01:00 +01:00
}
if ( json )
json_object_object_add ( json , " importRts " , json_import_rtl ) ;
else
vty_out ( vty , " Export Route Target: \n " ) ;
2021-02-17 22:11:49 +01:00
for ( ALL_LIST_ELEMENTS ( bgp_vrf - > vrf_export_rtl , node , nnode , l3rt ) ) {
ecom_str = ecommunity_ecom2str ( l3rt - > ecom ,
2017-11-15 10:01:00 +01:00
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
if ( json )
json_object_array_add ( json_export_rtl ,
json_object_new_string ( ecom_str ) ) ;
else
vty_out ( vty , " %s \n " , ecom_str ) ;
2023-05-08 05:11:01 +02:00
ecommunity_strfree ( & ecom_str ) ;
2017-11-15 10:01:00 +01:00
}
if ( json )
json_object_object_add ( json , " exportRts " , json_export_rtl ) ;
}
2017-07-21 02:42:20 +02:00
static void display_vni ( struct vty * vty , struct bgpevpn * vpn , json_object * json )
2017-07-17 14:03:14 +02:00
{
2017-05-15 23:53:31 +02:00
char * ecom_str ;
struct listnode * node , * nnode ;
struct ecommunity * ecom ;
2017-10-19 00:39:04 +02:00
json_object * json_import_rtl = NULL ;
json_object * json_export_rtl = NULL ;
bgpd: fix global and per vni knobs display
Not just per vni knobs but when the global
knobs are enabled, display
per vni advertise-svi-ip and advertise-gw-macip
as active.
Ticket:CM-26381
Reviewed By:
Testing Done:
TOR1#show running-config bgpd
router bgp 5587
...
address-family l2vpn evpn
advertise-all-vni
advertise-svi-ip
...
TORC11# show bgp l2vpn evpn vni 1004 json
{
"vni":1004,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.11:7",
"originatorIp":"36.0.0.11",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Active",
"importRts":[
"5546:1004"
],
"exportRts":[
"5546:1004"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-09-20 01:11:55 +02:00
struct bgp * bgp_evpn ;
2022-11-22 09:57:10 +01:00
enum asnotation_mode asnotation ;
bgpd: fix global and per vni knobs display
Not just per vni knobs but when the global
knobs are enabled, display
per vni advertise-svi-ip and advertise-gw-macip
as active.
Ticket:CM-26381
Reviewed By:
Testing Done:
TOR1#show running-config bgpd
router bgp 5587
...
address-family l2vpn evpn
advertise-all-vni
advertise-svi-ip
...
TORC11# show bgp l2vpn evpn vni 1004 json
{
"vni":1004,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.11:7",
"originatorIp":"36.0.0.11",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Active",
"importRts":[
"5546:1004"
],
"exportRts":[
"5546:1004"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-09-20 01:11:55 +02:00
bgp_evpn = bgp_get_evpn ( ) ;
2022-11-22 09:57:10 +01:00
asnotation = bgp_get_asnotation ( bgp_evpn ) ;
2017-07-21 02:42:20 +02:00
if ( json ) {
json_import_rtl = json_object_new_array ( ) ;
json_export_rtl = json_object_new_array ( ) ;
json_object_int_add ( json , " vni " , vpn - > vni ) ;
2017-11-15 10:01:00 +01:00
json_object_string_add ( json , " type " , " L2 " ) ;
bgpd: readjust fields in evpn vni json cmd
1) Keep consistant field name, such as
"inKernel".
2) Keep fields order same for both outputs.
Testing Done:
TORS1# show bgp l2vpn evpn vni json
{
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"advertiseAllVnis":"Enabled",
"flooding":"Head-end replication",
"numVnis":8,
"numL2Vnis":5,
"numL3Vnis":3,
"1002":{
"vni":1002,
"type":"L2",
"inKernel":"True",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRTs":[
"5550:1002"
],
"exportRTs":[
"5550:1002"
]
},
}
TORS1# show bgp l2vpn evpn vni 1002 json
{
"vni":1002,
"type":"L2",
"inKernel":"True",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRts":[
"5550:1002"
],
"exportRts":[
"5550:1002"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 01:50:19 +01:00
json_object_string_add ( json , " inKernel " ,
is_vni_live ( vpn ) ? " True " : " False " ) ;
2022-11-22 09:57:10 +01:00
json_object_string_addf (
json , " rd " , BGP_RD_AS_FORMAT ( asnotation ) , & vpn - > prd ) ;
2021-11-18 09:55:47 +01:00
json_object_string_addf ( json , " originatorIp " , " %pI4 " ,
& vpn - > originator_ip ) ;
json_object_string_addf ( json , " mcastGroup " , " %pI4 " ,
& vpn - > mcast_grp ) ;
2023-05-08 05:11:01 +02:00
if ( bgp_evpn & & bgp_evpn - > evpn_info ) {
ecom_str = ecommunity_ecom2str (
bgp_evpn - > evpn_info - > soo ,
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
json_object_string_add ( json , " siteOfOrigin " , ecom_str ) ;
ecommunity_strfree ( & ecom_str ) ;
}
bgpd: fix global and per vni knobs display
Not just per vni knobs but when the global
knobs are enabled, display
per vni advertise-svi-ip and advertise-gw-macip
as active.
Ticket:CM-26381
Reviewed By:
Testing Done:
TOR1#show running-config bgpd
router bgp 5587
...
address-family l2vpn evpn
advertise-all-vni
advertise-svi-ip
...
TORC11# show bgp l2vpn evpn vni 1004 json
{
"vni":1004,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.11:7",
"originatorIp":"36.0.0.11",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Active",
"importRts":[
"5546:1004"
],
"exportRts":[
"5546:1004"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-09-20 01:11:55 +02:00
/* per vni knob is enabled -- Enabled
* Global knob is enabled - - Active
* default - - Disabled
*/
if ( ! vpn - > advertise_gw_macip & &
bgp_evpn & & bgp_evpn - > advertise_gw_macip )
json_object_string_add ( json , " advertiseGatewayMacip " ,
" Active " ) ;
else if ( vpn - > advertise_gw_macip )
json_object_string_add ( json , " advertiseGatewayMacip " ,
" Enabled " ) ;
else
json_object_string_add ( json , " advertiseGatewayMacip " ,
" Disabled " ) ;
if ( ! vpn - > advertise_svi_macip & & bgp_evpn & &
2023-05-20 20:19:20 +02:00
bgp_evpn - > evpn_info & &
bgpd: fix global and per vni knobs display
Not just per vni knobs but when the global
knobs are enabled, display
per vni advertise-svi-ip and advertise-gw-macip
as active.
Ticket:CM-26381
Reviewed By:
Testing Done:
TOR1#show running-config bgpd
router bgp 5587
...
address-family l2vpn evpn
advertise-all-vni
advertise-svi-ip
...
TORC11# show bgp l2vpn evpn vni 1004 json
{
"vni":1004,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.11:7",
"originatorIp":"36.0.0.11",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Active",
"importRts":[
"5546:1004"
],
"exportRts":[
"5546:1004"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-09-20 01:11:55 +02:00
bgp_evpn - > evpn_info - > advertise_svi_macip )
2020-02-11 20:35:53 +01:00
json_object_string_add ( json , " advertiseSviMacIp " ,
bgpd: fix global and per vni knobs display
Not just per vni knobs but when the global
knobs are enabled, display
per vni advertise-svi-ip and advertise-gw-macip
as active.
Ticket:CM-26381
Reviewed By:
Testing Done:
TOR1#show running-config bgpd
router bgp 5587
...
address-family l2vpn evpn
advertise-all-vni
advertise-svi-ip
...
TORC11# show bgp l2vpn evpn vni 1004 json
{
"vni":1004,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.11:7",
"originatorIp":"36.0.0.11",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Active",
"importRts":[
"5546:1004"
],
"exportRts":[
"5546:1004"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-09-20 01:11:55 +02:00
" Active " ) ;
else if ( vpn - > advertise_svi_macip )
2020-02-11 20:35:53 +01:00
json_object_string_add ( json , " advertiseSviMacIp " ,
bgpd: fix global and per vni knobs display
Not just per vni knobs but when the global
knobs are enabled, display
per vni advertise-svi-ip and advertise-gw-macip
as active.
Ticket:CM-26381
Reviewed By:
Testing Done:
TOR1#show running-config bgpd
router bgp 5587
...
address-family l2vpn evpn
advertise-all-vni
advertise-svi-ip
...
TORC11# show bgp l2vpn evpn vni 1004 json
{
"vni":1004,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.11:7",
"originatorIp":"36.0.0.11",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Active",
"importRts":[
"5546:1004"
],
"exportRts":[
"5546:1004"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-09-20 01:11:55 +02:00
" Enabled " ) ;
else
2020-02-11 20:35:53 +01:00
json_object_string_add ( json , " advertiseSviMacIp " ,
bgpd: fix global and per vni knobs display
Not just per vni knobs but when the global
knobs are enabled, display
per vni advertise-svi-ip and advertise-gw-macip
as active.
Ticket:CM-26381
Reviewed By:
Testing Done:
TOR1#show running-config bgpd
router bgp 5587
...
address-family l2vpn evpn
advertise-all-vni
advertise-svi-ip
...
TORC11# show bgp l2vpn evpn vni 1004 json
{
"vni":1004,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.11:7",
"originatorIp":"36.0.0.11",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Active",
"importRts":[
"5546:1004"
],
"exportRts":[
"5546:1004"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-09-20 01:11:55 +02:00
" Disabled " ) ;
2021-01-11 09:14:05 +01:00
json_object_string_add (
json , " sviInterface " ,
ifindex2ifname ( vpn - > svi_ifindex , vpn - > tenant_vrf_id ) ) ;
2017-07-21 02:42:20 +02:00
} else {
2022-11-01 19:33:36 +01:00
vty_out ( vty , " VNI: %u " , vpn - > vni ) ;
2017-07-21 02:42:20 +02:00
if ( is_vni_live ( vpn ) )
vty_out ( vty , " (known to the kernel) " ) ;
vty_out ( vty , " \n " ) ;
2017-11-15 10:01:00 +01:00
vty_out ( vty , " Type: %s \n " , " L2 " ) ;
2017-10-08 05:26:16 +02:00
vty_out ( vty , " Tenant-Vrf: %s \n " ,
vrf_id_to_name ( vpn - > tenant_vrf_id ) ) ;
2022-11-22 09:57:10 +01:00
vty_out ( vty , " RD: " ) ;
vty_out ( vty , BGP_RD_AS_FORMAT ( asnotation ) , & vpn - > prd ) ;
vty_out ( vty , " \n " ) ;
2020-10-15 21:33:09 +02:00
vty_out ( vty , " Originator IP: %pI4 \n " , & vpn - > originator_ip ) ;
vty_out ( vty , " Mcast group: %pI4 \n " , & vpn - > mcast_grp ) ;
2023-05-08 05:11:01 +02:00
if ( bgp_evpn & & bgp_evpn - > evpn_info ) {
ecom_str = ecommunity_ecom2str (
bgp_evpn - > evpn_info - > soo ,
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
vty_out ( vty , " MAC-VRF Site-of-Origin: %s \n " ,
ecom_str ) ;
ecommunity_strfree ( & ecom_str ) ;
}
bgpd: fix global and per vni knobs display
Not just per vni knobs but when the global
knobs are enabled, display
per vni advertise-svi-ip and advertise-gw-macip
as active.
Ticket:CM-26381
Reviewed By:
Testing Done:
TOR1#show running-config bgpd
router bgp 5587
...
address-family l2vpn evpn
advertise-all-vni
advertise-svi-ip
...
TORC11# show bgp l2vpn evpn vni 1004 json
{
"vni":1004,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.11:7",
"originatorIp":"36.0.0.11",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Active",
"importRts":[
"5546:1004"
],
"exportRts":[
"5546:1004"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-09-20 01:11:55 +02:00
if ( ! vpn - > advertise_gw_macip & &
bgp_evpn & & bgp_evpn - > advertise_gw_macip )
vty_out ( vty , " Advertise-gw-macip : %s \n " ,
" Active " ) ;
else if ( vpn - > advertise_gw_macip )
vty_out ( vty , " Advertise-gw-macip : %s \n " ,
" Enabled " ) ;
else
vty_out ( vty , " Advertise-gw-macip : %s \n " ,
" Disabled " ) ;
if ( ! vpn - > advertise_svi_macip & & bgp_evpn & &
2023-05-20 20:19:20 +02:00
bgp_evpn - > evpn_info & &
bgpd: fix global and per vni knobs display
Not just per vni knobs but when the global
knobs are enabled, display
per vni advertise-svi-ip and advertise-gw-macip
as active.
Ticket:CM-26381
Reviewed By:
Testing Done:
TOR1#show running-config bgpd
router bgp 5587
...
address-family l2vpn evpn
advertise-all-vni
advertise-svi-ip
...
TORC11# show bgp l2vpn evpn vni 1004 json
{
"vni":1004,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.11:7",
"originatorIp":"36.0.0.11",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Active",
"importRts":[
"5546:1004"
],
"exportRts":[
"5546:1004"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-09-20 01:11:55 +02:00
bgp_evpn - > evpn_info - > advertise_svi_macip )
vty_out ( vty , " Advertise-svi-macip : %s \n " ,
" Active " ) ;
else if ( vpn - > advertise_svi_macip )
vty_out ( vty , " Advertise-svi-macip : %s \n " ,
" Enabled " ) ;
else
vty_out ( vty , " Advertise-svi-macip : %s \n " ,
" Disabled " ) ;
2021-01-11 09:14:05 +01:00
vty_out ( vty , " SVI interface : %s \n " ,
ifindex2ifname ( vpn - > svi_ifindex , vpn - > tenant_vrf_id ) ) ;
2017-07-21 02:42:20 +02:00
}
2017-05-15 23:53:31 +02:00
2017-07-21 02:42:20 +02:00
if ( ! json )
vty_out ( vty , " Import Route Target: \n " ) ;
2017-05-15 23:53:31 +02:00
2017-07-14 14:52:45 +02:00
for ( ALL_LIST_ELEMENTS ( vpn - > import_rtl , node , nnode , ecom ) ) {
2017-05-15 23:53:31 +02:00
ecom_str = ecommunity_ecom2str ( ecom ,
2017-07-14 14:52:45 +02:00
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
2017-07-21 02:42:20 +02:00
if ( json )
json_object_array_add ( json_import_rtl ,
json_object_new_string ( ecom_str ) ) ;
else
vty_out ( vty , " %s \n " , ecom_str ) ;
2023-05-08 05:11:01 +02:00
ecommunity_strfree ( & ecom_str ) ;
2017-07-17 14:03:14 +02:00
}
2017-05-15 23:53:31 +02:00
2017-07-21 02:42:20 +02:00
if ( json )
json_object_object_add ( json , " importRts " , json_import_rtl ) ;
else
vty_out ( vty , " Export Route Target: \n " ) ;
2017-05-15 23:53:31 +02:00
for ( ALL_LIST_ELEMENTS ( vpn - > export_rtl , node , nnode , ecom ) ) {
ecom_str = ecommunity_ecom2str ( ecom ,
2017-07-14 14:52:45 +02:00
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
2017-07-21 02:42:20 +02:00
if ( json )
json_object_array_add ( json_export_rtl ,
json_object_new_string ( ecom_str ) ) ;
else
vty_out ( vty , " %s \n " , ecom_str ) ;
2023-05-08 05:11:01 +02:00
ecommunity_strfree ( & ecom_str ) ;
2017-07-17 14:03:14 +02:00
}
2017-07-21 02:42:20 +02:00
if ( json )
json_object_object_add ( json , " exportRts " , json_export_rtl ) ;
2017-05-15 23:53:31 +02:00
}
2017-07-17 14:03:14 +02:00
2018-04-14 00:01:12 +02:00
static void show_esi_routes ( struct bgp * bgp ,
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
struct bgp_evpn_es * es ,
2018-04-14 00:01:12 +02:00
struct vty * vty ,
json_object * json )
{
int header = 1 ;
2020-03-27 00:11:58 +01:00
struct bgp_dest * dest ;
2018-10-03 02:43:07 +02:00
struct bgp_path_info * pi ;
2018-04-14 00:01:12 +02:00
uint32_t prefix_cnt , path_cnt ;
uint64_t tbl_ver ;
prefix_cnt = path_cnt = 0 ;
tbl_ver = es - > route_table - > version ;
2020-03-27 00:11:58 +01:00
for ( dest = bgp_table_top ( es - > route_table ) ; dest ;
dest = bgp_route_next ( dest ) ) {
2018-04-14 00:01:12 +02:00
int add_prefix_to_json = 0 ;
json_object * json_paths = NULL ;
json_object * json_prefix = NULL ;
2020-03-27 00:11:58 +01:00
const struct prefix * p = bgp_dest_get_prefix ( dest ) ;
2018-04-14 00:01:12 +02:00
if ( json )
json_prefix = json_object_new_object ( ) ;
2020-03-27 00:11:58 +01:00
pi = bgp_dest_get_bgp_path_info ( dest ) ;
2018-07-30 17:40:02 +02:00
if ( pi ) {
2018-04-14 00:01:12 +02:00
/* Overall header/legend displayed once. */
if ( header ) {
bgp_evpn_show_route_header ( vty , bgp ,
tbl_ver , json ) ;
header = 0 ;
}
prefix_cnt + + ;
}
if ( json )
json_paths = json_object_new_array ( ) ;
/* For EVPN, the prefix is displayed for each path (to fit in
* with code that already exists ) .
*/
2018-07-30 17:40:02 +02:00
for ( ; pi ; pi = pi - > next ) {
2018-04-14 00:01:12 +02:00
json_object * json_path = NULL ;
if ( json )
json_path = json_object_new_array ( ) ;
2020-07-23 11:20:52 +02:00
route_vty_out ( vty , p , pi , 0 , SAFI_EVPN , json_path ,
false ) ;
2018-04-14 00:01:12 +02:00
if ( json )
json_object_array_add ( json_paths , json_path ) ;
path_cnt + + ;
add_prefix_to_json = 1 ;
}
2020-01-27 19:41:22 +01:00
if ( json ) {
if ( add_prefix_to_json ) {
2022-08-25 12:46:58 +02:00
json_object_string_addf ( json_prefix , " prefix " ,
" %pFX " , p ) ;
2020-01-27 19:41:22 +01:00
json_object_int_add ( json_prefix , " prefixLen " ,
2020-03-22 05:02:18 +01:00
p - > prefixlen ) ;
2020-01-27 19:41:22 +01:00
json_object_object_add ( json_prefix , " paths " ,
json_paths ) ;
2022-08-25 12:46:58 +02:00
json_object_object_addf ( json , json_prefix ,
" %pFX " , p ) ;
2020-01-27 19:41:22 +01:00
} else {
json_object_free ( json_paths ) ;
json_object_free ( json_prefix ) ;
json_paths = NULL ;
json_prefix = NULL ;
}
2018-04-14 00:01:12 +02:00
}
}
if ( json ) {
json_object_int_add ( json , " numPrefix " , prefix_cnt ) ;
json_object_int_add ( json , " numPaths " , path_cnt ) ;
} else {
if ( prefix_cnt = = 0 )
2018-06-02 02:52:14 +02:00
vty_out ( vty , " No EVPN prefixes exist for this ESI \n " ) ;
2018-04-14 00:01:12 +02:00
else
vty_out ( vty , " \n Displayed %u prefixes (%u paths) \n " ,
prefix_cnt , path_cnt ) ;
}
}
2020-05-09 04:49:33 +02:00
/* Display all MAC-IP VNI routes linked to an ES */
2020-08-18 01:24:50 +02:00
static void bgp_evpn_show_routes_mac_ip_es ( struct vty * vty , esi_t * esi ,
json_object * json , int detail ,
bool global_table )
2020-05-09 04:49:33 +02:00
{
2023-07-31 14:34:48 +02:00
struct bgp_dest * bd ;
2020-05-09 04:49:33 +02:00
struct bgp_path_info * pi ;
int header = detail ? 0 : 1 ;
uint32_t path_cnt ;
struct listnode * node ;
struct bgp_evpn_es * es ;
struct bgp_path_es_info * es_info ;
struct bgp * bgp = bgp_get_evpn ( ) ;
json_object * json_paths = NULL ;
if ( ! bgp )
return ;
path_cnt = 0 ;
if ( json )
json_paths = json_object_new_array ( ) ;
RB_FOREACH ( es , bgp_es_rb_head , & bgp_mh_info - > es_rb_tree ) {
2020-08-18 01:24:50 +02:00
struct list * es_list ;
2020-05-09 04:49:33 +02:00
if ( esi & & memcmp ( esi , & es - > esi , sizeof ( * esi ) ) )
continue ;
2020-08-18 01:24:50 +02:00
if ( global_table )
es_list = es - > macip_global_path_list ;
else
es_list = es - > macip_evi_path_list ;
for ( ALL_LIST_ELEMENTS_RO ( es_list , node , es_info ) ) {
2020-05-09 04:49:33 +02:00
json_object * json_path = NULL ;
pi = es_info - > pi ;
2023-07-31 14:34:48 +02:00
bd = pi - > net ;
2020-05-09 04:49:33 +02:00
if ( ! CHECK_FLAG ( pi - > flags , BGP_PATH_VALID ) )
continue ;
/* Overall header/legend displayed once. */
if ( header ) {
bgp_evpn_show_route_header ( vty , bgp , 0 , json ) ;
header = 0 ;
}
path_cnt + + ;
if ( json )
json_path = json_object_new_array ( ) ;
if ( detail )
bgpd: Show applied route-map attributes for `neighbor X advertised-routes detail`
If we have a route-map that sets some attributes e.g. community or large-community,
and the route-map is applied for outgoing direction, everything is fine, but
we missed the point that `advertised-routes detail` was not using the applied
attributes to display and instead it uses what is received from the peer (original).
Let's fix this, and use what's already applied (advertise attributes), and
we can now see:
```
route-map r3 permit 10
match ip address prefix-list p1
set community 65001:65002
set extcommunity bandwidth 100
set large-community 65001:65002:65003
exit
!
...
address-family ipv4 unicast
neighbor 192.168.2.3 route-map r3 out
exit-address-family
...
```
The output:
```
r2# show bgp ipv4 neighbors 192.168.2.3 advertised-routes detail
BGP table version is 1, local router ID is 192.168.2.2, vrf id 0
Default local pref 100, local AS 65002
BGP routing table entry for 10.10.10.1/32, version 1
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
192.168.1.1 192.168.2.3
65001
0.0.0.0 from 192.168.1.1 (192.168.1.1)
Origin IGP, valid, external, best (First path received)
Community: 65001:65002
Extended Community: LB:65002:12500000 (100.000 Mbps)
Large Community: 65001:65002:65003
Last update: Thu Dec 19 17:00:40 2024
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-12-19 15:59:47 +01:00
route_vty_out_detail ( vty , bgp , bd , bgp_dest_get_prefix ( bd ) , pi ,
AFI_L2VPN , SAFI_EVPN , RPKI_NOT_BEING_USED ,
bgpd: Show internal data for BGP routes
Sometimes it's very useful to compare pointers from the gdb (and/or from the
logs) or just do some quick adhoc analysis.
```
donatas# sh ip bgp 1.1.1.0/24 internal
BGP routing table entry for 1.1.1.0/24, version 0
Paths: (1 available, no best path)
Not advertised to any peer
65002
127.0.0.1 (inaccessible, import-check enabled) from 127.0.0.1 (127.0.0.2)
Origin IGP, invalid, external
Last update: Thu Jan 16 16:49:53 2025
net: 0x63f3e6fc2ea0, path: 0x63f3e6fc2f50, pathext: 0x63f3e6faed00, attr: 0x63f3e6e8c550
flags net: 0x0, path: 0x1024, attr: 0x7
donatas#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-16 15:50:14 +01:00
json_path , NULL , 0 ) ;
2020-05-09 04:49:33 +02:00
else
2023-07-31 14:34:48 +02:00
route_vty_out ( vty , & bd - > rn - > p , pi , 0 , SAFI_EVPN ,
2020-05-09 04:49:33 +02:00
json_path , false ) ;
if ( json )
json_object_array_add ( json_paths , json_path ) ;
}
}
if ( json ) {
json_object_object_add ( json , " paths " , json_paths ) ;
json_object_int_add ( json , " numPaths " , path_cnt ) ;
} else {
if ( path_cnt = = 0 )
vty_out ( vty , " There are no MAC-IP ES paths " ) ;
else
vty_out ( vty , " \n Displayed %u paths \n " , path_cnt ) ;
vty_out ( vty , " \n " ) ;
}
}
2020-08-18 01:24:50 +02:00
static void bgp_evpn_show_routes_mac_ip_evi_es ( struct vty * vty , esi_t * esi ,
json_object * json , int detail )
{
2021-06-11 17:58:21 +02:00
bgp_evpn_show_routes_mac_ip_es ( vty , esi , json , detail , false ) ;
2020-08-18 01:24:50 +02:00
}
static void bgp_evpn_show_routes_mac_ip_global_es ( struct vty * vty , esi_t * esi ,
json_object * json , int detail )
{
2021-06-11 17:58:21 +02:00
bgp_evpn_show_routes_mac_ip_es ( vty , esi , json , detail , true ) ;
2020-08-18 01:24:50 +02:00
}
2021-10-26 23:55:54 +02:00
static void show_vni_routes ( struct bgp * bgp , struct bgpevpn * vpn ,
struct vty * vty , int type , bool mac_table ,
struct in_addr vtep_ip , json_object * json ,
int detail )
2017-05-15 23:53:31 +02:00
{
2020-03-27 00:11:58 +01:00
struct bgp_dest * dest ;
2018-10-03 02:43:07 +02:00
struct bgp_path_info * pi ;
2017-11-02 00:57:55 +01:00
struct bgp_table * table ;
2019-03-28 06:49:03 +01:00
int header = detail ? 0 : 1 ;
2017-11-02 00:57:55 +01:00
uint64_t tbl_ver ;
2018-03-27 21:13:34 +02:00
uint32_t prefix_cnt , path_cnt ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
prefix_cnt = path_cnt = 0 ;
2017-07-17 14:03:14 +02:00
2021-10-26 23:55:54 +02:00
if ( mac_table )
table = vpn - > mac_table ;
else
table = vpn - > ip_table ;
2017-11-02 00:57:55 +01:00
tbl_ver = table - > version ;
2020-03-27 00:11:58 +01:00
for ( dest = bgp_table_top ( table ) ; dest ; dest = bgp_route_next ( dest ) ) {
2020-03-22 05:02:18 +01:00
const struct prefix_evpn * evp =
2020-03-27 00:11:58 +01:00
( const struct prefix_evpn * ) bgp_dest_get_prefix ( dest ) ;
2017-07-21 02:42:20 +02:00
int add_prefix_to_json = 0 ;
json_object * json_paths = NULL ;
json_object * json_prefix = NULL ;
2020-03-27 00:11:58 +01:00
const struct prefix * p = bgp_dest_get_prefix ( dest ) ;
2017-07-21 02:42:20 +02:00
2017-05-15 23:53:31 +02:00
if ( type & & evp - > prefix . route_type ! = type )
continue ;
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
if ( json )
json_prefix = json_object_new_object ( ) ;
2020-03-27 00:11:58 +01:00
pi = bgp_dest_get_bgp_path_info ( dest ) ;
2018-07-30 17:40:02 +02:00
if ( pi ) {
2017-05-15 23:53:31 +02:00
/* Overall header/legend displayed once. */
2017-01-27 08:25:27 +01:00
if ( header ) {
2017-11-02 00:57:55 +01:00
bgp_evpn_show_route_header ( vty , bgp ,
tbl_ver , json ) ;
2017-05-15 23:53:31 +02:00
header = 0 ;
2017-07-17 14:03:14 +02:00
}
2017-05-15 23:53:31 +02:00
prefix_cnt + + ;
2017-07-17 14:03:14 +02:00
}
2017-07-21 02:42:20 +02:00
if ( json )
json_paths = json_object_new_array ( ) ;
2017-05-15 23:53:31 +02:00
/* For EVPN, the prefix is displayed for each path (to fit in
* with code that already exists ) .
2017-07-17 14:03:14 +02:00
*/
2018-07-30 17:40:02 +02:00
for ( ; pi ; pi = pi - > next ) {
2021-07-23 19:35:14 +02:00
struct prefix tmp_p ;
2017-07-21 02:42:20 +02:00
json_object * json_path = NULL ;
2020-02-06 07:49:02 +01:00
if ( vtep_ip . s_addr ! = INADDR_ANY
2017-05-15 23:53:31 +02:00
& & ! IPV4_ADDR_SAME ( & ( vtep_ip ) ,
2018-10-03 02:43:07 +02:00
& ( pi - > attr - > nexthop ) ) )
2017-05-15 23:53:31 +02:00
continue ;
2017-07-17 14:03:14 +02:00
2021-07-23 19:35:14 +02:00
if ( evp - > prefix . route_type = = BGP_EVPN_MAC_IP_ROUTE ) {
/*
2021-10-26 23:55:54 +02:00
* VNI IP / MAC table prefixes don ' t have MAC / IP
* respectively so make sure it ' s set from path
* info here .
2021-07-23 19:35:14 +02:00
*/
2021-10-26 23:55:54 +02:00
if ( is_evpn_prefix_ipaddr_none ( evp ) ) {
/* VNI MAC -> Global */
evpn_type2_prefix_global_copy (
( struct prefix_evpn * ) & tmp_p ,
evp , NULL /* mac */ ,
evpn_type2_path_info_get_ip (
pi ) ) ;
} else {
/* VNI IP -> Global */
evpn_type2_prefix_global_copy (
( struct prefix_evpn * ) & tmp_p ,
evp ,
evpn_type2_path_info_get_mac (
pi ) ,
NULL /* ip */ ) ;
}
2021-07-23 19:35:14 +02:00
} else
memcpy ( & tmp_p , p , sizeof ( tmp_p ) ) ;
2017-07-21 02:42:20 +02:00
if ( json )
json_path = json_object_new_array ( ) ;
2019-03-28 06:49:03 +01:00
if ( detail )
bgpd: Show applied route-map attributes for `neighbor X advertised-routes detail`
If we have a route-map that sets some attributes e.g. community or large-community,
and the route-map is applied for outgoing direction, everything is fine, but
we missed the point that `advertised-routes detail` was not using the applied
attributes to display and instead it uses what is received from the peer (original).
Let's fix this, and use what's already applied (advertise attributes), and
we can now see:
```
route-map r3 permit 10
match ip address prefix-list p1
set community 65001:65002
set extcommunity bandwidth 100
set large-community 65001:65002:65003
exit
!
...
address-family ipv4 unicast
neighbor 192.168.2.3 route-map r3 out
exit-address-family
...
```
The output:
```
r2# show bgp ipv4 neighbors 192.168.2.3 advertised-routes detail
BGP table version is 1, local router ID is 192.168.2.2, vrf id 0
Default local pref 100, local AS 65002
BGP routing table entry for 10.10.10.1/32, version 1
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
192.168.1.1 192.168.2.3
65001
0.0.0.0 from 192.168.1.1 (192.168.1.1)
Origin IGP, valid, external, best (First path received)
Community: 65001:65002
Extended Community: LB:65002:12500000 (100.000 Mbps)
Large Community: 65001:65002:65003
Last update: Thu Dec 19 17:00:40 2024
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-12-19 15:59:47 +01:00
route_vty_out_detail ( vty , bgp , dest , & tmp_p , pi , AFI_L2VPN ,
SAFI_EVPN , RPKI_NOT_BEING_USED , json_path ,
bgpd: Show internal data for BGP routes
Sometimes it's very useful to compare pointers from the gdb (and/or from the
logs) or just do some quick adhoc analysis.
```
donatas# sh ip bgp 1.1.1.0/24 internal
BGP routing table entry for 1.1.1.0/24, version 0
Paths: (1 available, no best path)
Not advertised to any peer
65002
127.0.0.1 (inaccessible, import-check enabled) from 127.0.0.1 (127.0.0.2)
Origin IGP, invalid, external
Last update: Thu Jan 16 16:49:53 2025
net: 0x63f3e6fc2ea0, path: 0x63f3e6fc2f50, pathext: 0x63f3e6faed00, attr: 0x63f3e6e8c550
flags net: 0x0, path: 0x1024, attr: 0x7
donatas#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-16 15:50:14 +01:00
NULL , 0 ) ;
2021-10-26 23:55:54 +02:00
2019-03-28 06:49:03 +01:00
else
2021-07-23 19:35:14 +02:00
route_vty_out ( vty , & tmp_p , pi , 0 , SAFI_EVPN ,
2020-07-23 11:20:52 +02:00
json_path , false ) ;
2017-07-21 02:42:20 +02:00
if ( json )
json_object_array_add ( json_paths , json_path ) ;
2017-05-15 23:53:31 +02:00
path_cnt + + ;
2017-07-21 02:42:20 +02:00
add_prefix_to_json = 1 ;
}
2020-01-27 19:41:22 +01:00
if ( json ) {
if ( add_prefix_to_json ) {
2022-08-25 12:46:58 +02:00
json_object_string_addf ( json_prefix , " prefix " ,
" %pFX " , p ) ;
2020-01-27 19:41:22 +01:00
json_object_int_add ( json_prefix , " prefixLen " ,
2020-03-22 05:02:18 +01:00
p - > prefixlen ) ;
2020-01-27 19:41:22 +01:00
json_object_object_add ( json_prefix , " paths " ,
json_paths ) ;
2022-08-25 12:46:58 +02:00
json_object_object_addf ( json , json_prefix ,
" %pFX " , p ) ;
2020-01-27 19:41:22 +01:00
} else {
json_object_free ( json_paths ) ;
json_object_free ( json_prefix ) ;
json_paths = NULL ;
json_prefix = NULL ;
}
2017-07-17 14:03:14 +02:00
}
}
2017-07-21 02:42:20 +02:00
if ( json ) {
json_object_int_add ( json , " numPrefix " , prefix_cnt ) ;
json_object_int_add ( json , " numPaths " , path_cnt ) ;
} else {
if ( prefix_cnt = = 0 )
vty_out ( vty , " No EVPN prefixes %sexist for this VNI " ,
type ? " (of requested type) " : " " ) ;
else
2018-04-14 00:01:12 +02:00
vty_out ( vty , " \n Displayed %u prefixes (%u paths)%s \n " ,
2017-07-21 02:42:20 +02:00
prefix_cnt , path_cnt ,
type ? " (of requested type) " : " " ) ;
2019-03-28 06:49:03 +01:00
vty_out ( vty , " \n " ) ;
2017-07-21 02:42:20 +02:00
}
2017-05-15 23:53:31 +02:00
}
2019-02-19 16:46:52 +01:00
static void show_vni_routes_hash ( struct hash_bucket * bucket , void * arg )
2017-05-15 23:53:31 +02:00
{
2019-02-19 16:46:52 +01:00
struct bgpevpn * vpn = ( struct bgpevpn * ) bucket - > data ;
2017-05-15 23:53:31 +02:00
struct vni_walk_ctx * wctx = arg ;
struct vty * vty = wctx - > vty ;
2017-07-21 02:42:20 +02:00
json_object * json = wctx - > json ;
json_object * json_vni = NULL ;
char vni_str [ VNI_STR_LEN ] ;
2022-11-01 19:33:36 +01:00
snprintf ( vni_str , sizeof ( vni_str ) , " %u " , vpn - > vni ) ;
2017-07-21 02:42:20 +02:00
if ( json ) {
json_vni = json_object_new_object ( ) ;
json_object_int_add ( json_vni , " vni " , vpn - > vni ) ;
} else {
2022-11-01 19:33:36 +01:00
vty_out ( vty , " \n VNI: %u \n \n " , vpn - > vni ) ;
2017-07-21 02:42:20 +02:00
}
2021-10-26 23:55:54 +02:00
show_vni_routes ( wctx - > bgp , vpn , wctx - > vty , wctx - > type , wctx - > mac_table ,
wctx - > vtep_ip , json_vni , wctx - > detail ) ;
if ( json )
json_object_object_add ( json , vni_str , json_vni ) ;
}
static void show_vni_routes_all_hash ( struct hash_bucket * bucket , void * arg )
{
struct bgpevpn * vpn = ( struct bgpevpn * ) bucket - > data ;
struct vni_walk_ctx * wctx = arg ;
struct vty * vty = wctx - > vty ;
json_object * json = wctx - > json ;
json_object * json_vni = NULL ;
json_object * json_vni_mac = NULL ;
char vni_str [ VNI_STR_LEN ] ;
2022-11-01 19:33:36 +01:00
snprintf ( vni_str , sizeof ( vni_str ) , " %u " , vpn - > vni ) ;
2017-07-21 02:42:20 +02:00
if ( json ) {
json_vni = json_object_new_object ( ) ;
json_object_int_add ( json_vni , " vni " , vpn - > vni ) ;
} else {
2022-11-01 19:33:36 +01:00
vty_out ( vty , " \n VNI: %u \n \n " , vpn - > vni ) ;
2017-07-21 02:42:20 +02:00
}
2021-10-26 23:55:54 +02:00
show_vni_routes ( wctx - > bgp , vpn , wctx - > vty , 0 , false , wctx - > vtep_ip ,
json_vni , wctx - > detail ) ;
2017-05-15 23:53:31 +02:00
2017-07-21 02:42:20 +02:00
if ( json )
json_object_object_add ( json , vni_str , json_vni ) ;
2021-10-26 23:55:54 +02:00
if ( json )
json_vni_mac = json_object_new_object ( ) ;
else
2022-11-01 19:33:36 +01:00
vty_out ( vty , " \n VNI: %u MAC Table \n \n " , vpn - > vni ) ;
2021-10-26 23:55:54 +02:00
show_vni_routes ( wctx - > bgp , vpn , wctx - > vty , 0 , true , wctx - > vtep_ip ,
json_vni_mac , wctx - > detail ) ;
if ( json )
json_object_object_add ( json_vni , " macTable " , json_vni_mac ) ;
2017-05-15 23:53:31 +02:00
}
2017-11-15 10:01:00 +01:00
static void show_l3vni_entry ( struct vty * vty , struct bgp * bgp ,
json_object * json )
{
2018-01-24 16:34:52 +01:00
json_object * json_vni = NULL ;
json_object * json_import_rtl = NULL ;
json_object * json_export_rtl = NULL ;
2017-11-15 10:01:00 +01:00
char buf1 [ 10 ] ;
char buf2 [ INET6_ADDRSTRLEN ] ;
char rt_buf [ 25 ] ;
char * ecom_str ;
struct listnode * node , * nnode ;
2021-02-17 22:11:49 +01:00
struct vrf_route_target * l3rt ;
2023-05-08 05:11:01 +02:00
struct bgp * bgp_evpn ;
2017-11-15 10:01:00 +01:00
if ( ! bgp - > l3vni )
return ;
2023-05-08 05:11:01 +02:00
bgp_evpn = bgp_get_evpn ( ) ;
2017-11-15 10:01:00 +01:00
if ( json ) {
json_vni = json_object_new_object ( ) ;
json_import_rtl = json_object_new_array ( ) ;
json_export_rtl = json_object_new_array ( ) ;
}
/* if an l3vni is present in bgp it is live */
buf1 [ 0 ] = ' \0 ' ;
2020-04-20 20:12:38 +02:00
snprintf ( buf1 , sizeof ( buf1 ) , " * " ) ;
2017-11-15 10:01:00 +01:00
if ( json ) {
json_object_int_add ( json_vni , " vni " , bgp - > l3vni ) ;
json_object_string_add ( json_vni , " type " , " L3 " ) ;
json_object_string_add ( json_vni , " inKernel " , " True " ) ;
2021-11-18 09:55:47 +01:00
json_object_string_addf ( json_vni , " originatorIp " , " %pI4 " ,
& bgp - > originator_ip ) ;
2022-11-22 09:57:10 +01:00
json_object_string_addf ( json_vni , " rd " ,
BGP_RD_AS_FORMAT ( bgp - > asnotation ) ,
& bgp - > vrf_prd ) ;
bgpd: add fields to bgp evpn vni json cmd
Bring 'show bgp l2vpn evpn vni json' inline
with 'show bgp l2vpn evpn vni <id> json' in
terms of fields.
Ticket:CM-28328
Reviewed By:
Testing Done:
TORS1# show bgp l2vpn evpn vni json
{
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"advertiseAllVnis":"Enabled",
"flooding":"Head-end replication",
"numVnis":8,
"numL2Vnis":5,
"numL3Vnis":3,
"1002":{
"vni":1002,
"type":"L2",
"inKernel":"True",
"originatorIp":"27.0.0.15",
"rd":"27.0.0.15:8",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRTs":[
"5550:1002"
],
"exportRTs":[
"5550:1002"
]
},
}
TORS1# show bgp l2vpn evpn vni 1002 json
{
"vni":1002,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRts":[
"5550:1002"
],
"exportRts":[
"5550:1002"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 00:34:54 +01:00
json_object_string_add ( json_vni , " advertiseGatewayMacip " ,
" n/a " ) ;
2020-02-11 20:35:53 +01:00
json_object_string_add ( json_vni , " advertiseSviMacIp " , " n/a " ) ;
bgpd: add fields to bgp evpn vni json cmd
Bring 'show bgp l2vpn evpn vni json' inline
with 'show bgp l2vpn evpn vni <id> json' in
terms of fields.
Ticket:CM-28328
Reviewed By:
Testing Done:
TORS1# show bgp l2vpn evpn vni json
{
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"advertiseAllVnis":"Enabled",
"flooding":"Head-end replication",
"numVnis":8,
"numL2Vnis":5,
"numL3Vnis":3,
"1002":{
"vni":1002,
"type":"L2",
"inKernel":"True",
"originatorIp":"27.0.0.15",
"rd":"27.0.0.15:8",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRTs":[
"5550:1002"
],
"exportRTs":[
"5550:1002"
]
},
}
TORS1# show bgp l2vpn evpn vni 1002 json
{
"vni":1002,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRts":[
"5550:1002"
],
"exportRts":[
"5550:1002"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 00:34:54 +01:00
json_object_string_add (
json_vni , " advertisePip " ,
bgp - > evpn_info - > advertise_pip ? " Enabled " : " Disabled " ) ;
2021-11-18 09:55:47 +01:00
json_object_string_addf ( json_vni , " sysIP " , " %pI4 " ,
& bgp - > evpn_info - > pip_ip ) ;
bgpd: add fields to bgp evpn vni json cmd
Bring 'show bgp l2vpn evpn vni json' inline
with 'show bgp l2vpn evpn vni <id> json' in
terms of fields.
Ticket:CM-28328
Reviewed By:
Testing Done:
TORS1# show bgp l2vpn evpn vni json
{
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"advertiseAllVnis":"Enabled",
"flooding":"Head-end replication",
"numVnis":8,
"numL2Vnis":5,
"numL3Vnis":3,
"1002":{
"vni":1002,
"type":"L2",
"inKernel":"True",
"originatorIp":"27.0.0.15",
"rd":"27.0.0.15:8",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRTs":[
"5550:1002"
],
"exportRTs":[
"5550:1002"
]
},
}
TORS1# show bgp l2vpn evpn vni 1002 json
{
"vni":1002,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRts":[
"5550:1002"
],
"exportRts":[
"5550:1002"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 00:34:54 +01:00
json_object_string_add ( json_vni , " sysMAC " ,
prefix_mac2str ( & bgp - > evpn_info - > pip_rmac ,
buf2 , sizeof ( buf2 ) ) ) ;
json_object_string_add (
json_vni , " rmac " ,
prefix_mac2str ( & bgp - > rmac , buf2 , sizeof ( buf2 ) ) ) ;
2017-11-15 10:01:00 +01:00
} else {
2022-11-22 09:57:10 +01:00
vty_out ( vty , " %-1s %-10u %-4s " , buf1 , bgp - > l3vni , " L3 " ) ;
vty_out ( vty , BGP_RD_AS_FORMAT_SPACE ( bgp - > asnotation ) ,
2022-09-22 10:17:49 +02:00
& bgp - > vrf_prd ) ;
2017-11-15 10:01:00 +01:00
}
2021-02-17 22:11:49 +01:00
for ( ALL_LIST_ELEMENTS ( bgp - > vrf_import_rtl , node , nnode , l3rt ) ) {
ecom_str = ecommunity_ecom2str ( l3rt - > ecom ,
2017-11-15 10:01:00 +01:00
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
if ( json ) {
json_object_array_add ( json_import_rtl ,
json_object_new_string ( ecom_str ) ) ;
} else {
if ( listcount ( bgp - > vrf_import_rtl ) > 1 )
2020-04-20 20:12:38 +02:00
snprintf ( rt_buf , sizeof ( rt_buf ) , " %s, ... " ,
ecom_str ) ;
2017-11-15 10:01:00 +01:00
else
2020-04-20 20:12:38 +02:00
snprintf ( rt_buf , sizeof ( rt_buf ) , " %s " ,
ecom_str ) ;
2017-11-15 10:01:00 +01:00
vty_out ( vty , " %-25s " , rt_buf ) ;
}
2023-05-08 05:11:01 +02:00
ecommunity_strfree ( & ecom_str ) ;
2017-11-15 10:01:00 +01:00
/* If there are multiple import RTs we break here and show only
* one */
if ( ! json )
break ;
}
if ( json )
json_object_object_add ( json_vni , " importRTs " , json_import_rtl ) ;
2021-02-17 22:11:49 +01:00
for ( ALL_LIST_ELEMENTS ( bgp - > vrf_export_rtl , node , nnode , l3rt ) ) {
ecom_str = ecommunity_ecom2str ( l3rt - > ecom ,
2017-11-15 10:01:00 +01:00
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
if ( json ) {
json_object_array_add ( json_export_rtl ,
json_object_new_string ( ecom_str ) ) ;
} else {
if ( listcount ( bgp - > vrf_export_rtl ) > 1 )
2020-04-20 20:12:38 +02:00
snprintf ( rt_buf , sizeof ( rt_buf ) , " %s, ... " ,
ecom_str ) ;
2017-11-15 10:01:00 +01:00
else
2020-04-20 20:12:38 +02:00
snprintf ( rt_buf , sizeof ( rt_buf ) , " %s " ,
ecom_str ) ;
2017-11-15 10:01:00 +01:00
vty_out ( vty , " %-25s " , rt_buf ) ;
}
2023-05-08 05:11:01 +02:00
ecommunity_strfree ( & ecom_str ) ;
2017-11-15 10:01:00 +01:00
/* If there are multiple export RTs we break here and show only
* one */
2022-08-30 10:46:00 +02:00
if ( ! json ) {
2023-05-08 05:11:01 +02:00
if ( bgp_evpn & & bgp_evpn - > evpn_info ) {
ecom_str = ecommunity_ecom2str (
bgp_evpn - > evpn_info - > soo ,
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
vty_out ( vty , " %-25s " , ecom_str ) ;
ecommunity_strfree ( & ecom_str ) ;
}
vty_out ( vty , " %-37s " , vrf_id_to_name ( bgp - > vrf_id ) ) ;
2017-11-15 10:01:00 +01:00
break ;
2022-08-30 10:46:00 +02:00
}
2017-11-15 10:01:00 +01:00
}
if ( json ) {
char vni_str [ VNI_STR_LEN ] ;
json_object_object_add ( json_vni , " exportRTs " , json_export_rtl ) ;
2023-05-08 05:11:01 +02:00
if ( bgp_evpn & & bgp_evpn - > evpn_info ) {
ecom_str = ecommunity_ecom2str (
bgp_evpn - > evpn_info - > soo ,
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
json_object_string_add ( json_vni , " siteOfOrigin " ,
ecom_str ) ;
ecommunity_strfree ( & ecom_str ) ;
}
2020-04-20 20:12:38 +02:00
snprintf ( vni_str , sizeof ( vni_str ) , " %u " , bgp - > l3vni ) ;
2017-11-15 10:01:00 +01:00
json_object_object_add ( json , vni_str , json_vni ) ;
2023-05-08 05:11:01 +02:00
} else
2017-11-15 10:01:00 +01:00
vty_out ( vty , " \n " ) ;
}
2019-02-19 16:46:52 +01:00
static void show_vni_entry ( struct hash_bucket * bucket , void * args [ ] )
2017-05-15 23:53:31 +02:00
{
2017-07-21 02:42:20 +02:00
struct vty * vty ;
json_object * json ;
2017-12-17 16:53:34 +01:00
json_object * json_vni = NULL ;
json_object * json_import_rtl = NULL ;
json_object * json_export_rtl = NULL ;
2019-02-19 16:46:52 +01:00
struct bgpevpn * vpn = ( struct bgpevpn * ) bucket - > data ;
2017-05-15 23:53:31 +02:00
char buf1 [ 10 ] ;
char rt_buf [ 25 ] ;
char * ecom_str ;
struct listnode * node , * nnode ;
struct ecommunity * ecom ;
bgpd: add fields to bgp evpn vni json cmd
Bring 'show bgp l2vpn evpn vni json' inline
with 'show bgp l2vpn evpn vni <id> json' in
terms of fields.
Ticket:CM-28328
Reviewed By:
Testing Done:
TORS1# show bgp l2vpn evpn vni json
{
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"advertiseAllVnis":"Enabled",
"flooding":"Head-end replication",
"numVnis":8,
"numL2Vnis":5,
"numL3Vnis":3,
"1002":{
"vni":1002,
"type":"L2",
"inKernel":"True",
"originatorIp":"27.0.0.15",
"rd":"27.0.0.15:8",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRTs":[
"5550:1002"
],
"exportRTs":[
"5550:1002"
]
},
}
TORS1# show bgp l2vpn evpn vni 1002 json
{
"vni":1002,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRts":[
"5550:1002"
],
"exportRts":[
"5550:1002"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 00:34:54 +01:00
struct bgp * bgp_evpn ;
2022-11-22 09:57:10 +01:00
enum asnotation_mode asnotation ;
2017-05-15 23:53:31 +02:00
2017-07-21 02:42:20 +02:00
vty = args [ 0 ] ;
json = args [ 1 ] ;
bgpd: add fields to bgp evpn vni json cmd
Bring 'show bgp l2vpn evpn vni json' inline
with 'show bgp l2vpn evpn vni <id> json' in
terms of fields.
Ticket:CM-28328
Reviewed By:
Testing Done:
TORS1# show bgp l2vpn evpn vni json
{
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"advertiseAllVnis":"Enabled",
"flooding":"Head-end replication",
"numVnis":8,
"numL2Vnis":5,
"numL3Vnis":3,
"1002":{
"vni":1002,
"type":"L2",
"inKernel":"True",
"originatorIp":"27.0.0.15",
"rd":"27.0.0.15:8",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRTs":[
"5550:1002"
],
"exportRTs":[
"5550:1002"
]
},
}
TORS1# show bgp l2vpn evpn vni 1002 json
{
"vni":1002,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRts":[
"5550:1002"
],
"exportRts":[
"5550:1002"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 00:34:54 +01:00
bgp_evpn = bgp_get_evpn ( ) ;
2022-11-22 09:57:10 +01:00
asnotation = bgp_get_asnotation ( bgp_evpn ) ;
bgpd: add fields to bgp evpn vni json cmd
Bring 'show bgp l2vpn evpn vni json' inline
with 'show bgp l2vpn evpn vni <id> json' in
terms of fields.
Ticket:CM-28328
Reviewed By:
Testing Done:
TORS1# show bgp l2vpn evpn vni json
{
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"advertiseAllVnis":"Enabled",
"flooding":"Head-end replication",
"numVnis":8,
"numL2Vnis":5,
"numL3Vnis":3,
"1002":{
"vni":1002,
"type":"L2",
"inKernel":"True",
"originatorIp":"27.0.0.15",
"rd":"27.0.0.15:8",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRTs":[
"5550:1002"
],
"exportRTs":[
"5550:1002"
]
},
}
TORS1# show bgp l2vpn evpn vni 1002 json
{
"vni":1002,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRts":[
"5550:1002"
],
"exportRts":[
"5550:1002"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 00:34:54 +01:00
2017-07-21 02:42:20 +02:00
if ( json ) {
json_vni = json_object_new_object ( ) ;
json_import_rtl = json_object_new_array ( ) ;
json_export_rtl = json_object_new_array ( ) ;
}
2017-05-15 23:53:31 +02:00
buf1 [ 0 ] = ' \0 ' ;
if ( is_vni_live ( vpn ) )
2020-04-20 20:12:38 +02:00
snprintf ( buf1 , sizeof ( buf1 ) , " * " ) ;
2017-05-15 23:53:31 +02:00
2017-07-21 02:42:20 +02:00
if ( json ) {
json_object_int_add ( json_vni , " vni " , vpn - > vni ) ;
2017-11-15 10:01:00 +01:00
json_object_string_add ( json_vni , " type " , " L2 " ) ;
2017-07-21 02:42:20 +02:00
json_object_string_add ( json_vni , " inKernel " ,
is_vni_live ( vpn ) ? " True " : " False " ) ;
2022-11-22 09:57:10 +01:00
json_object_string_addf ( json_vni , " rd " ,
BGP_RD_AS_FORMAT ( asnotation ) ,
& vpn - > prd ) ;
2021-11-18 09:55:47 +01:00
json_object_string_addf ( json_vni , " originatorIp " , " %pI4 " ,
& vpn - > originator_ip ) ;
json_object_string_addf ( json_vni , " mcastGroup " , " %pI4 " ,
& vpn - > mcast_grp ) ;
bgpd: add fields to bgp evpn vni json cmd
Bring 'show bgp l2vpn evpn vni json' inline
with 'show bgp l2vpn evpn vni <id> json' in
terms of fields.
Ticket:CM-28328
Reviewed By:
Testing Done:
TORS1# show bgp l2vpn evpn vni json
{
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"advertiseAllVnis":"Enabled",
"flooding":"Head-end replication",
"numVnis":8,
"numL2Vnis":5,
"numL3Vnis":3,
"1002":{
"vni":1002,
"type":"L2",
"inKernel":"True",
"originatorIp":"27.0.0.15",
"rd":"27.0.0.15:8",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRTs":[
"5550:1002"
],
"exportRTs":[
"5550:1002"
]
},
}
TORS1# show bgp l2vpn evpn vni 1002 json
{
"vni":1002,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRts":[
"5550:1002"
],
"exportRts":[
"5550:1002"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 00:34:54 +01:00
/* per vni knob is enabled -- Enabled
* Global knob is enabled - - Active
* default - - Disabled
*/
if ( ! vpn - > advertise_gw_macip & & bgp_evpn
& & bgp_evpn - > advertise_gw_macip )
json_object_string_add (
json_vni , " advertiseGatewayMacip " , " Active " ) ;
else if ( vpn - > advertise_gw_macip )
json_object_string_add (
json_vni , " advertiseGatewayMacip " , " Enabled " ) ;
else
json_object_string_add (
json_vni , " advertiseGatewayMacip " , " Disabled " ) ;
if ( ! vpn - > advertise_svi_macip & & bgp_evpn
& & bgp_evpn - > evpn_info - > advertise_svi_macip )
2020-02-11 20:35:53 +01:00
json_object_string_add ( json_vni , " advertiseSviMacIp " ,
bgpd: add fields to bgp evpn vni json cmd
Bring 'show bgp l2vpn evpn vni json' inline
with 'show bgp l2vpn evpn vni <id> json' in
terms of fields.
Ticket:CM-28328
Reviewed By:
Testing Done:
TORS1# show bgp l2vpn evpn vni json
{
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"advertiseAllVnis":"Enabled",
"flooding":"Head-end replication",
"numVnis":8,
"numL2Vnis":5,
"numL3Vnis":3,
"1002":{
"vni":1002,
"type":"L2",
"inKernel":"True",
"originatorIp":"27.0.0.15",
"rd":"27.0.0.15:8",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRTs":[
"5550:1002"
],
"exportRTs":[
"5550:1002"
]
},
}
TORS1# show bgp l2vpn evpn vni 1002 json
{
"vni":1002,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRts":[
"5550:1002"
],
"exportRts":[
"5550:1002"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 00:34:54 +01:00
" Active " ) ;
else if ( vpn - > advertise_svi_macip )
2020-02-11 20:35:53 +01:00
json_object_string_add ( json_vni , " advertiseSviMacIp " ,
bgpd: add fields to bgp evpn vni json cmd
Bring 'show bgp l2vpn evpn vni json' inline
with 'show bgp l2vpn evpn vni <id> json' in
terms of fields.
Ticket:CM-28328
Reviewed By:
Testing Done:
TORS1# show bgp l2vpn evpn vni json
{
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"advertiseAllVnis":"Enabled",
"flooding":"Head-end replication",
"numVnis":8,
"numL2Vnis":5,
"numL3Vnis":3,
"1002":{
"vni":1002,
"type":"L2",
"inKernel":"True",
"originatorIp":"27.0.0.15",
"rd":"27.0.0.15:8",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRTs":[
"5550:1002"
],
"exportRTs":[
"5550:1002"
]
},
}
TORS1# show bgp l2vpn evpn vni 1002 json
{
"vni":1002,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRts":[
"5550:1002"
],
"exportRts":[
"5550:1002"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 00:34:54 +01:00
" Enabled " ) ;
else
2020-02-11 20:35:53 +01:00
json_object_string_add ( json_vni , " advertiseSviMacIp " ,
bgpd: add fields to bgp evpn vni json cmd
Bring 'show bgp l2vpn evpn vni json' inline
with 'show bgp l2vpn evpn vni <id> json' in
terms of fields.
Ticket:CM-28328
Reviewed By:
Testing Done:
TORS1# show bgp l2vpn evpn vni json
{
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"advertiseAllVnis":"Enabled",
"flooding":"Head-end replication",
"numVnis":8,
"numL2Vnis":5,
"numL3Vnis":3,
"1002":{
"vni":1002,
"type":"L2",
"inKernel":"True",
"originatorIp":"27.0.0.15",
"rd":"27.0.0.15:8",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRTs":[
"5550:1002"
],
"exportRTs":[
"5550:1002"
]
},
}
TORS1# show bgp l2vpn evpn vni 1002 json
{
"vni":1002,
"type":"L2",
"kernelFlag":"Yes",
"rd":"27.0.0.15:8",
"originatorIp":"27.0.0.15",
"mcastGroup":"0.0.0.0",
"advertiseGatewayMacip":"Disabled",
"advertiseSviMacip":"Disabled",
"importRts":[
"5550:1002"
],
"exportRts":[
"5550:1002"
]
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 00:34:54 +01:00
" Disabled " ) ;
2017-07-21 02:42:20 +02:00
} else {
2022-11-22 09:57:10 +01:00
vty_out ( vty , " %-1s %-10u %-4s " , buf1 , vpn - > vni , " L2 " ) ;
vty_out ( vty , BGP_RD_AS_FORMAT_SPACE ( asnotation ) , & vpn - > prd ) ;
2017-07-21 02:42:20 +02:00
}
2017-05-15 23:53:31 +02:00
for ( ALL_LIST_ELEMENTS ( vpn - > import_rtl , node , nnode , ecom ) ) {
ecom_str = ecommunity_ecom2str ( ecom ,
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
2017-07-21 02:42:20 +02:00
if ( json ) {
json_object_array_add ( json_import_rtl ,
json_object_new_string ( ecom_str ) ) ;
} else {
if ( listcount ( vpn - > import_rtl ) > 1 )
2020-04-20 20:12:38 +02:00
snprintf ( rt_buf , sizeof ( rt_buf ) , " %s, ... " ,
ecom_str ) ;
2017-07-21 02:42:20 +02:00
else
2020-04-20 20:12:38 +02:00
snprintf ( rt_buf , sizeof ( rt_buf ) , " %s " ,
ecom_str ) ;
2017-07-21 02:42:20 +02:00
vty_out ( vty , " %-25s " , rt_buf ) ;
}
2017-05-15 23:53:31 +02:00
XFREE ( MTYPE_ECOMMUNITY_STR , ecom_str ) ;
2017-07-21 02:42:20 +02:00
/* If there are multiple import RTs we break here and show only
* one */
if ( ! json )
break ;
2017-07-17 14:03:14 +02:00
}
2017-07-21 02:42:20 +02:00
if ( json )
json_object_object_add ( json_vni , " importRTs " , json_import_rtl ) ;
2017-05-15 23:53:31 +02:00
for ( ALL_LIST_ELEMENTS ( vpn - > export_rtl , node , nnode , ecom ) ) {
ecom_str = ecommunity_ecom2str ( ecom ,
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
if ( json ) {
json_object_array_add ( json_export_rtl ,
json_object_new_string ( ecom_str ) ) ;
} else {
if ( listcount ( vpn - > export_rtl ) > 1 )
2020-04-20 20:12:38 +02:00
snprintf ( rt_buf , sizeof ( rt_buf ) , " %s, ... " ,
ecom_str ) ;
2017-07-21 02:42:20 +02:00
else
2020-04-20 20:12:38 +02:00
snprintf ( rt_buf , sizeof ( rt_buf ) , " %s " ,
ecom_str ) ;
2017-07-21 02:42:20 +02:00
vty_out ( vty , " %-25s " , rt_buf ) ;
}
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
XFREE ( MTYPE_ECOMMUNITY_STR , ecom_str ) ;
2017-07-21 02:42:20 +02:00
/* If there are multiple export RTs we break here and show only
* one */
2022-08-30 10:46:00 +02:00
if ( ! json ) {
2023-05-08 05:11:01 +02:00
if ( bgp_evpn & & bgp_evpn - > evpn_info ) {
ecom_str = ecommunity_ecom2str (
bgp_evpn - > evpn_info - > soo ,
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
vty_out ( vty , " %-25s " , ecom_str ) ;
ecommunity_strfree ( & ecom_str ) ;
}
vty_out ( vty , " %-37s " ,
2022-08-30 10:46:00 +02:00
vrf_id_to_name ( vpn - > tenant_vrf_id ) ) ;
2017-07-21 02:42:20 +02:00
break ;
2022-08-30 10:46:00 +02:00
}
2017-07-21 02:42:20 +02:00
}
if ( json ) {
char vni_str [ VNI_STR_LEN ] ;
2017-08-14 06:52:04 +02:00
2017-07-21 02:42:20 +02:00
json_object_object_add ( json_vni , " exportRTs " , json_export_rtl ) ;
2023-05-08 05:11:01 +02:00
if ( bgp_evpn & & bgp_evpn - > evpn_info ) {
ecom_str = ecommunity_ecom2str (
bgp_evpn - > evpn_info - > soo ,
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
json_object_string_add ( json_vni , " siteOfOrigin " ,
ecom_str ) ;
ecommunity_strfree ( & ecom_str ) ;
}
2020-04-20 20:12:38 +02:00
snprintf ( vni_str , sizeof ( vni_str ) , " %u " , vpn - > vni ) ;
2017-07-21 02:42:20 +02:00
json_object_object_add ( json , vni_str , json_vni ) ;
2023-05-08 05:11:01 +02:00
} else
2017-07-21 02:42:20 +02:00
vty_out ( vty , " \n " ) ;
2017-05-15 23:53:31 +02:00
}
2017-01-27 08:25:27 +01:00
static int bgp_show_ethernet_vpn ( struct vty * vty , struct prefix_rd * prd ,
enum bgp_show_type type , void * output_arg ,
2018-08-29 14:19:54 +02:00
int option , bool use_json )
2017-01-09 18:26:24 +01:00
{
2017-01-27 08:25:27 +01:00
afi_t afi = AFI_L2VPN ;
struct bgp * bgp ;
struct bgp_table * table ;
2020-03-27 00:11:58 +01:00
struct bgp_dest * dest ;
struct bgp_dest * rm ;
2018-10-03 02:43:07 +02:00
struct bgp_path_info * pi ;
2017-01-27 08:25:27 +01:00
int rd_header ;
int header = 1 ;
2019-10-07 23:20:02 +02:00
char rd_str [ RD_ADDRSTRLEN ] ;
2019-09-19 05:35:04 +02:00
int no_display ;
2017-01-27 08:25:27 +01:00
unsigned long output_count = 0 ;
unsigned long total_count = 0 ;
json_object * json = NULL ;
json_object * json_array = NULL ;
bgpd: Evpn json cli output missing
Issue1: The following json cli commands are broken (they dont display
anything):
1. show [ip] bgp l2vpn evpn json
2. show [ip] bgp l2vpn evpn all neighbors <IP> routes json
3. show [ip] bgp l2vpn evpn rd <RD> json
4. show [ip] bgp l2vpn evpn rd <RD> neighbors <IP> routes json
RCA1: The existing json_object was partially filled.
Some fields like "prefix", "prefixLen", etc were not
filled in the json_object.
RCA2: Code missing to display the constructed json_object.
Issue2: Column header not shown on bgp evpn commands.
Fix: turned on the flag to display header
Output after fix:
The above commands have been made to follow the existing output style of
"show bgp l2vpn evpn routes json"
leaf-1# sh bgp l2vpn evpn json
{
"bgpTableVersion":1,
"bgpLocalRouterId":"10.100.0.1",
"defaultLocPrf":100,
"localAS":65000,
"10.100.0.1:3":{
"rd":"10.100.0.1:3",
"[3]:[0]:[32]:[10.100.0.1]":{
"prefix":"[3]:[0]:[32]:[10.100.0.1]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.1",
"weight":32768,
"peerId":"(unspec)",
"aspath":"",
"path":"",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.1",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
..........
..........
"10.100.0.2:2":{
"rd":"10.100.0.2:2",
"[3]:[0]:[32]:[10.100.0.2]":{
"prefix":"[3]:[0]:[32]:[10.100.0.2]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"205.0.113.2",
"aspath":"65002",
"path":"65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
},
{
"valid":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"203.0.113.4",
"aspath":"65001 65002",
"path":"65001 65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
....
....
"numPrefix":10,
"totalPrefix":10
}
leaf-1# sh bgp l2vpn evpn
BGP table version is 1, local router ID is 10.100.0.1
Status codes:s suppressed, d damped, h history, * valid, > best, i - int
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: ip 10.100.0.1:3
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:4
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:5
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:6
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.2:2
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:3
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:4
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Displayed 10 out of 10 total prefixes
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-07 23:07:35 +02:00
json_object * json_prefix_info = NULL ;
2019-10-07 23:20:02 +02:00
memset ( rd_str , 0 , RD_ADDRSTRLEN ) ;
2017-01-27 08:25:27 +01:00
2019-03-06 19:15:10 +01:00
bgp = bgp_get_evpn ( ) ;
2017-01-27 08:25:27 +01:00
if ( bgp = = NULL ) {
if ( ! use_json )
2017-07-13 17:49:13 +02:00
vty_out ( vty , " No BGP process is configured \n " ) ;
2017-07-26 17:27:37 +02:00
else
vty_out ( vty , " {} \n " ) ;
2017-01-27 08:25:27 +01:00
return CMD_WARNING ;
}
bgpd: Evpn json cli output missing
Issue1: The following json cli commands are broken (they dont display
anything):
1. show [ip] bgp l2vpn evpn json
2. show [ip] bgp l2vpn evpn all neighbors <IP> routes json
3. show [ip] bgp l2vpn evpn rd <RD> json
4. show [ip] bgp l2vpn evpn rd <RD> neighbors <IP> routes json
RCA1: The existing json_object was partially filled.
Some fields like "prefix", "prefixLen", etc were not
filled in the json_object.
RCA2: Code missing to display the constructed json_object.
Issue2: Column header not shown on bgp evpn commands.
Fix: turned on the flag to display header
Output after fix:
The above commands have been made to follow the existing output style of
"show bgp l2vpn evpn routes json"
leaf-1# sh bgp l2vpn evpn json
{
"bgpTableVersion":1,
"bgpLocalRouterId":"10.100.0.1",
"defaultLocPrf":100,
"localAS":65000,
"10.100.0.1:3":{
"rd":"10.100.0.1:3",
"[3]:[0]:[32]:[10.100.0.1]":{
"prefix":"[3]:[0]:[32]:[10.100.0.1]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.1",
"weight":32768,
"peerId":"(unspec)",
"aspath":"",
"path":"",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.1",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
..........
..........
"10.100.0.2:2":{
"rd":"10.100.0.2:2",
"[3]:[0]:[32]:[10.100.0.2]":{
"prefix":"[3]:[0]:[32]:[10.100.0.2]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"205.0.113.2",
"aspath":"65002",
"path":"65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
},
{
"valid":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"203.0.113.4",
"aspath":"65001 65002",
"path":"65001 65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
....
....
"numPrefix":10,
"totalPrefix":10
}
leaf-1# sh bgp l2vpn evpn
BGP table version is 1, local router ID is 10.100.0.1
Status codes:s suppressed, d damped, h history, * valid, > best, i - int
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: ip 10.100.0.1:3
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:4
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:5
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:6
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.2:2
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:3
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:4
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Displayed 10 out of 10 total prefixes
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-07 23:07:35 +02:00
if ( use_json )
2017-01-27 08:25:27 +01:00
json = json_object_new_object ( ) ;
2020-03-27 00:11:58 +01:00
for ( dest = bgp_table_top ( bgp - > rib [ afi ] [ SAFI_EVPN ] ) ; dest ;
dest = bgp_route_next ( dest ) ) {
2017-11-02 00:57:55 +01:00
uint64_t tbl_ver ;
2019-10-07 23:20:02 +02:00
json_object * json_nroute = NULL ;
2020-03-27 00:11:58 +01:00
const struct prefix * p = bgp_dest_get_prefix ( dest ) ;
2017-11-02 00:57:55 +01:00
2020-03-22 05:02:18 +01:00
if ( prd & & memcmp ( p - > u . val , prd - > val , 8 ) ! = 0 )
2017-01-27 08:25:27 +01:00
continue ;
2020-03-27 00:11:58 +01:00
table = bgp_dest_get_bgp_table_info ( dest ) ;
2018-09-26 02:37:16 +02:00
if ( ! table )
2017-08-27 22:51:35 +02:00
continue ;
2017-01-27 08:25:27 +01:00
2017-08-27 22:51:35 +02:00
rd_header = 1 ;
2017-11-02 00:57:55 +01:00
tbl_ver = table - > version ;
2017-01-27 08:25:27 +01:00
2019-05-11 18:33:10 +02:00
for ( rm = bgp_table_top ( table ) ; rm ; rm = bgp_route_next ( rm ) ) {
2020-03-27 00:11:58 +01:00
pi = bgp_dest_get_bgp_path_info ( rm ) ;
2019-09-19 05:35:04 +02:00
if ( pi = = NULL )
continue ;
no_display = 0 ;
for ( ; pi ; pi = pi - > next ) {
2022-02-23 08:05:47 +01:00
struct community * picomm = NULL ;
picomm = bgp_attr_get_community ( pi - > attr ) ;
2017-08-27 22:51:35 +02:00
total_count + + ;
if ( type = = bgp_show_type_neighbor ) {
2019-08-08 04:58:18 +02:00
struct peer * peer = output_arg ;
2017-08-27 22:51:35 +02:00
2019-08-08 04:58:18 +02:00
if ( peer_cmp ( peer , pi - > peer ) ! = 0 )
2017-08-27 22:51:35 +02:00
continue ;
}
2019-10-07 23:58:39 +02:00
if ( type = = bgp_show_type_lcommunity_exact ) {
struct lcommunity * lcom = output_arg ;
2022-02-09 12:44:25 +01:00
if ( ! bgp_attr_get_lcommunity (
pi - > attr ) | |
! lcommunity_cmp (
bgp_attr_get_lcommunity (
pi - > attr ) ,
lcom ) )
2019-10-07 23:58:39 +02:00
continue ;
}
if ( type = = bgp_show_type_lcommunity ) {
struct lcommunity * lcom = output_arg ;
2022-02-09 12:44:25 +01:00
if ( ! bgp_attr_get_lcommunity (
pi - > attr ) | |
! lcommunity_match (
bgp_attr_get_lcommunity (
pi - > attr ) ,
lcom ) )
2019-10-07 23:58:39 +02:00
continue ;
}
if ( type = = bgp_show_type_community ) {
struct community * com = output_arg ;
2022-02-23 08:05:47 +01:00
if ( ! picomm | |
! community_match ( picomm , com ) )
2019-10-07 23:58:39 +02:00
continue ;
}
if ( type = = bgp_show_type_community_exact ) {
struct community * com = output_arg ;
2022-02-23 08:05:47 +01:00
if ( ! picomm | |
! community_cmp ( picomm , com ) )
2019-10-07 23:58:39 +02:00
continue ;
}
bgpd: Evpn json cli output missing
Issue1: The following json cli commands are broken (they dont display
anything):
1. show [ip] bgp l2vpn evpn json
2. show [ip] bgp l2vpn evpn all neighbors <IP> routes json
3. show [ip] bgp l2vpn evpn rd <RD> json
4. show [ip] bgp l2vpn evpn rd <RD> neighbors <IP> routes json
RCA1: The existing json_object was partially filled.
Some fields like "prefix", "prefixLen", etc were not
filled in the json_object.
RCA2: Code missing to display the constructed json_object.
Issue2: Column header not shown on bgp evpn commands.
Fix: turned on the flag to display header
Output after fix:
The above commands have been made to follow the existing output style of
"show bgp l2vpn evpn routes json"
leaf-1# sh bgp l2vpn evpn json
{
"bgpTableVersion":1,
"bgpLocalRouterId":"10.100.0.1",
"defaultLocPrf":100,
"localAS":65000,
"10.100.0.1:3":{
"rd":"10.100.0.1:3",
"[3]:[0]:[32]:[10.100.0.1]":{
"prefix":"[3]:[0]:[32]:[10.100.0.1]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.1",
"weight":32768,
"peerId":"(unspec)",
"aspath":"",
"path":"",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.1",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
..........
..........
"10.100.0.2:2":{
"rd":"10.100.0.2:2",
"[3]:[0]:[32]:[10.100.0.2]":{
"prefix":"[3]:[0]:[32]:[10.100.0.2]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"205.0.113.2",
"aspath":"65002",
"path":"65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
},
{
"valid":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"203.0.113.4",
"aspath":"65001 65002",
"path":"65001 65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
....
....
"numPrefix":10,
"totalPrefix":10
}
leaf-1# sh bgp l2vpn evpn
BGP table version is 1, local router ID is 10.100.0.1
Status codes:s suppressed, d damped, h history, * valid, > best, i - int
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: ip 10.100.0.1:3
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:4
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:5
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:6
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.2:2
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:3
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:4
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Displayed 10 out of 10 total prefixes
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-07 23:07:35 +02:00
if ( header ) {
2017-08-27 22:51:35 +02:00
if ( use_json ) {
bgpd: Evpn json cli output missing
Issue1: The following json cli commands are broken (they dont display
anything):
1. show [ip] bgp l2vpn evpn json
2. show [ip] bgp l2vpn evpn all neighbors <IP> routes json
3. show [ip] bgp l2vpn evpn rd <RD> json
4. show [ip] bgp l2vpn evpn rd <RD> neighbors <IP> routes json
RCA1: The existing json_object was partially filled.
Some fields like "prefix", "prefixLen", etc were not
filled in the json_object.
RCA2: Code missing to display the constructed json_object.
Issue2: Column header not shown on bgp evpn commands.
Fix: turned on the flag to display header
Output after fix:
The above commands have been made to follow the existing output style of
"show bgp l2vpn evpn routes json"
leaf-1# sh bgp l2vpn evpn json
{
"bgpTableVersion":1,
"bgpLocalRouterId":"10.100.0.1",
"defaultLocPrf":100,
"localAS":65000,
"10.100.0.1:3":{
"rd":"10.100.0.1:3",
"[3]:[0]:[32]:[10.100.0.1]":{
"prefix":"[3]:[0]:[32]:[10.100.0.1]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.1",
"weight":32768,
"peerId":"(unspec)",
"aspath":"",
"path":"",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.1",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
..........
..........
"10.100.0.2:2":{
"rd":"10.100.0.2:2",
"[3]:[0]:[32]:[10.100.0.2]":{
"prefix":"[3]:[0]:[32]:[10.100.0.2]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"205.0.113.2",
"aspath":"65002",
"path":"65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
},
{
"valid":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"203.0.113.4",
"aspath":"65001 65002",
"path":"65001 65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
....
....
"numPrefix":10,
"totalPrefix":10
}
leaf-1# sh bgp l2vpn evpn
BGP table version is 1, local router ID is 10.100.0.1
Status codes:s suppressed, d damped, h history, * valid, > best, i - int
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: ip 10.100.0.1:3
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:4
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:5
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:6
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.2:2
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:3
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:4
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Displayed 10 out of 10 total prefixes
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-07 23:07:35 +02:00
json_object_int_add (
json , " bgpTableVersion " ,
tbl_ver ) ;
2021-11-18 09:55:47 +01:00
json_object_string_addf (
bgpd: Evpn json cli output missing
Issue1: The following json cli commands are broken (they dont display
anything):
1. show [ip] bgp l2vpn evpn json
2. show [ip] bgp l2vpn evpn all neighbors <IP> routes json
3. show [ip] bgp l2vpn evpn rd <RD> json
4. show [ip] bgp l2vpn evpn rd <RD> neighbors <IP> routes json
RCA1: The existing json_object was partially filled.
Some fields like "prefix", "prefixLen", etc were not
filled in the json_object.
RCA2: Code missing to display the constructed json_object.
Issue2: Column header not shown on bgp evpn commands.
Fix: turned on the flag to display header
Output after fix:
The above commands have been made to follow the existing output style of
"show bgp l2vpn evpn routes json"
leaf-1# sh bgp l2vpn evpn json
{
"bgpTableVersion":1,
"bgpLocalRouterId":"10.100.0.1",
"defaultLocPrf":100,
"localAS":65000,
"10.100.0.1:3":{
"rd":"10.100.0.1:3",
"[3]:[0]:[32]:[10.100.0.1]":{
"prefix":"[3]:[0]:[32]:[10.100.0.1]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.1",
"weight":32768,
"peerId":"(unspec)",
"aspath":"",
"path":"",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.1",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
..........
..........
"10.100.0.2:2":{
"rd":"10.100.0.2:2",
"[3]:[0]:[32]:[10.100.0.2]":{
"prefix":"[3]:[0]:[32]:[10.100.0.2]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"205.0.113.2",
"aspath":"65002",
"path":"65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
},
{
"valid":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"203.0.113.4",
"aspath":"65001 65002",
"path":"65001 65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
....
....
"numPrefix":10,
"totalPrefix":10
}
leaf-1# sh bgp l2vpn evpn
BGP table version is 1, local router ID is 10.100.0.1
Status codes:s suppressed, d damped, h history, * valid, > best, i - int
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: ip 10.100.0.1:3
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:4
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:5
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:6
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.2:2
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:3
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:4
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Displayed 10 out of 10 total prefixes
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-07 23:07:35 +02:00
json ,
" bgpLocalRouterId " ,
2021-11-18 09:55:47 +01:00
" %pI4 " ,
& bgp - > router_id ) ;
bgpd: Evpn json cli output missing
Issue1: The following json cli commands are broken (they dont display
anything):
1. show [ip] bgp l2vpn evpn json
2. show [ip] bgp l2vpn evpn all neighbors <IP> routes json
3. show [ip] bgp l2vpn evpn rd <RD> json
4. show [ip] bgp l2vpn evpn rd <RD> neighbors <IP> routes json
RCA1: The existing json_object was partially filled.
Some fields like "prefix", "prefixLen", etc were not
filled in the json_object.
RCA2: Code missing to display the constructed json_object.
Issue2: Column header not shown on bgp evpn commands.
Fix: turned on the flag to display header
Output after fix:
The above commands have been made to follow the existing output style of
"show bgp l2vpn evpn routes json"
leaf-1# sh bgp l2vpn evpn json
{
"bgpTableVersion":1,
"bgpLocalRouterId":"10.100.0.1",
"defaultLocPrf":100,
"localAS":65000,
"10.100.0.1:3":{
"rd":"10.100.0.1:3",
"[3]:[0]:[32]:[10.100.0.1]":{
"prefix":"[3]:[0]:[32]:[10.100.0.1]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.1",
"weight":32768,
"peerId":"(unspec)",
"aspath":"",
"path":"",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.1",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
..........
..........
"10.100.0.2:2":{
"rd":"10.100.0.2:2",
"[3]:[0]:[32]:[10.100.0.2]":{
"prefix":"[3]:[0]:[32]:[10.100.0.2]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"205.0.113.2",
"aspath":"65002",
"path":"65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
},
{
"valid":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"203.0.113.4",
"aspath":"65001 65002",
"path":"65001 65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
....
....
"numPrefix":10,
"totalPrefix":10
}
leaf-1# sh bgp l2vpn evpn
BGP table version is 1, local router ID is 10.100.0.1
Status codes:s suppressed, d damped, h history, * valid, > best, i - int
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: ip 10.100.0.1:3
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:4
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:5
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:6
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.2:2
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:3
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:4
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Displayed 10 out of 10 total prefixes
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-07 23:07:35 +02:00
json_object_int_add (
json ,
" defaultLocPrf " ,
bgp - > default_local_pref ) ;
2022-11-18 13:49:53 +01:00
asn_asn2json ( json , " localAS " ,
bgp - > as ,
bgp - > asnotation ) ;
2017-08-27 22:51:35 +02:00
} else {
2017-08-30 17:23:01 +02:00
if ( option = = SHOW_DISPLAY_TAGS )
2017-08-27 22:51:35 +02:00
vty_out ( vty ,
V4_HEADER_TAG ) ;
else if (
option
= = SHOW_DISPLAY_OVERLAY )
vty_out ( vty ,
V4_HEADER_OVERLAY ) ;
else {
2019-09-19 05:35:04 +02:00
bgp_evpn_show_route_header ( vty , bgp , tbl_ver , NULL ) ;
2017-01-27 08:25:27 +01:00
}
}
2017-08-27 22:51:35 +02:00
header = 0 ;
2017-01-27 08:25:27 +01:00
}
2017-08-27 22:51:35 +02:00
if ( rd_header ) {
2019-10-07 23:20:02 +02:00
if ( use_json )
json_nroute =
json_object_new_object ( ) ;
2020-03-27 00:11:58 +01:00
bgp_evpn_show_route_rd_header (
vty , dest , json_nroute , rd_str ,
2019-10-07 23:20:02 +02:00
RD_ADDRSTRLEN ) ;
2017-08-27 22:51:35 +02:00
rd_header = 0 ;
}
2019-10-07 23:20:02 +02:00
if ( use_json & & ! json_array )
json_array = json_object_new_array ( ) ;
2019-05-11 18:33:10 +02:00
2017-08-27 22:51:35 +02:00
if ( option = = SHOW_DISPLAY_TAGS )
2020-03-22 05:02:18 +01:00
route_vty_out_tag (
2020-03-27 00:11:58 +01:00
vty , bgp_dest_get_prefix ( rm ) ,
2020-03-22 05:02:18 +01:00
pi , no_display , SAFI_EVPN ,
json_array ) ;
2017-08-27 22:51:35 +02:00
else if ( option = = SHOW_DISPLAY_OVERLAY )
2020-03-22 05:02:18 +01:00
route_vty_out_overlay (
2020-03-27 00:11:58 +01:00
vty , bgp_dest_get_prefix ( rm ) ,
2020-03-22 05:02:18 +01:00
pi , no_display , json_array ) ;
2017-08-27 22:51:35 +02:00
else
2020-03-22 05:02:18 +01:00
route_vty_out ( vty ,
2020-03-27 00:11:58 +01:00
bgp_dest_get_prefix ( rm ) ,
2020-03-22 05:02:18 +01:00
pi , no_display , SAFI_EVPN ,
2020-07-23 11:20:52 +02:00
json_array , false ) ;
2019-09-19 05:35:04 +02:00
no_display = 1 ;
2017-08-27 22:51:35 +02:00
}
2019-09-19 05:35:04 +02:00
if ( no_display )
output_count + + ;
2019-10-07 23:20:02 +02:00
if ( use_json & & json_array ) {
2020-03-22 05:02:18 +01:00
const struct prefix * p =
2020-03-27 00:11:58 +01:00
bgp_dest_get_prefix ( rm ) ;
2020-03-22 05:02:18 +01:00
2019-10-07 23:20:02 +02:00
json_prefix_info = json_object_new_object ( ) ;
2022-08-25 12:46:58 +02:00
json_object_string_addf ( json_prefix_info ,
" prefix " , " %pFX " , p ) ;
2019-10-07 23:20:02 +02:00
json_object_int_add ( json_prefix_info ,
2020-03-22 05:02:18 +01:00
" prefixLen " , p - > prefixlen ) ;
2019-10-07 23:20:02 +02:00
2019-05-11 18:33:10 +02:00
json_object_object_add ( json_prefix_info ,
" paths " , json_array ) ;
2022-08-25 12:46:58 +02:00
json_object_object_addf ( json_nroute ,
json_prefix_info ,
" %pFX " , p ) ;
2019-10-07 23:20:02 +02:00
json_array = NULL ;
2019-05-11 18:33:10 +02:00
}
}
bgpd: Evpn json cli output missing
Issue1: The following json cli commands are broken (they dont display
anything):
1. show [ip] bgp l2vpn evpn json
2. show [ip] bgp l2vpn evpn all neighbors <IP> routes json
3. show [ip] bgp l2vpn evpn rd <RD> json
4. show [ip] bgp l2vpn evpn rd <RD> neighbors <IP> routes json
RCA1: The existing json_object was partially filled.
Some fields like "prefix", "prefixLen", etc were not
filled in the json_object.
RCA2: Code missing to display the constructed json_object.
Issue2: Column header not shown on bgp evpn commands.
Fix: turned on the flag to display header
Output after fix:
The above commands have been made to follow the existing output style of
"show bgp l2vpn evpn routes json"
leaf-1# sh bgp l2vpn evpn json
{
"bgpTableVersion":1,
"bgpLocalRouterId":"10.100.0.1",
"defaultLocPrf":100,
"localAS":65000,
"10.100.0.1:3":{
"rd":"10.100.0.1:3",
"[3]:[0]:[32]:[10.100.0.1]":{
"prefix":"[3]:[0]:[32]:[10.100.0.1]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.1",
"weight":32768,
"peerId":"(unspec)",
"aspath":"",
"path":"",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.1",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
..........
..........
"10.100.0.2:2":{
"rd":"10.100.0.2:2",
"[3]:[0]:[32]:[10.100.0.2]":{
"prefix":"[3]:[0]:[32]:[10.100.0.2]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"205.0.113.2",
"aspath":"65002",
"path":"65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
},
{
"valid":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"203.0.113.4",
"aspath":"65001 65002",
"path":"65001 65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
....
....
"numPrefix":10,
"totalPrefix":10
}
leaf-1# sh bgp l2vpn evpn
BGP table version is 1, local router ID is 10.100.0.1
Status codes:s suppressed, d damped, h history, * valid, > best, i - int
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: ip 10.100.0.1:3
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:4
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:5
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:6
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.2:2
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:3
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:4
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Displayed 10 out of 10 total prefixes
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-07 23:07:35 +02:00
2019-10-07 23:20:02 +02:00
if ( use_json & & json_nroute )
bgpd: Evpn json cli output missing
Issue1: The following json cli commands are broken (they dont display
anything):
1. show [ip] bgp l2vpn evpn json
2. show [ip] bgp l2vpn evpn all neighbors <IP> routes json
3. show [ip] bgp l2vpn evpn rd <RD> json
4. show [ip] bgp l2vpn evpn rd <RD> neighbors <IP> routes json
RCA1: The existing json_object was partially filled.
Some fields like "prefix", "prefixLen", etc were not
filled in the json_object.
RCA2: Code missing to display the constructed json_object.
Issue2: Column header not shown on bgp evpn commands.
Fix: turned on the flag to display header
Output after fix:
The above commands have been made to follow the existing output style of
"show bgp l2vpn evpn routes json"
leaf-1# sh bgp l2vpn evpn json
{
"bgpTableVersion":1,
"bgpLocalRouterId":"10.100.0.1",
"defaultLocPrf":100,
"localAS":65000,
"10.100.0.1:3":{
"rd":"10.100.0.1:3",
"[3]:[0]:[32]:[10.100.0.1]":{
"prefix":"[3]:[0]:[32]:[10.100.0.1]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.1",
"weight":32768,
"peerId":"(unspec)",
"aspath":"",
"path":"",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.1",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
..........
..........
"10.100.0.2:2":{
"rd":"10.100.0.2:2",
"[3]:[0]:[32]:[10.100.0.2]":{
"prefix":"[3]:[0]:[32]:[10.100.0.2]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"205.0.113.2",
"aspath":"65002",
"path":"65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
},
{
"valid":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"203.0.113.4",
"aspath":"65001 65002",
"path":"65001 65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
....
....
"numPrefix":10,
"totalPrefix":10
}
leaf-1# sh bgp l2vpn evpn
BGP table version is 1, local router ID is 10.100.0.1
Status codes:s suppressed, d damped, h history, * valid, > best, i - int
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: ip 10.100.0.1:3
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:4
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:5
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:6
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.2:2
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:3
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:4
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Displayed 10 out of 10 total prefixes
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-07 23:07:35 +02:00
json_object_object_add ( json , rd_str , json_nroute ) ;
}
if ( use_json ) {
json_object_int_add ( json , " numPrefix " , output_count ) ;
json_object_int_add ( json , " totalPrefix " , total_count ) ;
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
bgpd: Evpn json cli output missing
Issue1: The following json cli commands are broken (they dont display
anything):
1. show [ip] bgp l2vpn evpn json
2. show [ip] bgp l2vpn evpn all neighbors <IP> routes json
3. show [ip] bgp l2vpn evpn rd <RD> json
4. show [ip] bgp l2vpn evpn rd <RD> neighbors <IP> routes json
RCA1: The existing json_object was partially filled.
Some fields like "prefix", "prefixLen", etc were not
filled in the json_object.
RCA2: Code missing to display the constructed json_object.
Issue2: Column header not shown on bgp evpn commands.
Fix: turned on the flag to display header
Output after fix:
The above commands have been made to follow the existing output style of
"show bgp l2vpn evpn routes json"
leaf-1# sh bgp l2vpn evpn json
{
"bgpTableVersion":1,
"bgpLocalRouterId":"10.100.0.1",
"defaultLocPrf":100,
"localAS":65000,
"10.100.0.1:3":{
"rd":"10.100.0.1:3",
"[3]:[0]:[32]:[10.100.0.1]":{
"prefix":"[3]:[0]:[32]:[10.100.0.1]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.1",
"weight":32768,
"peerId":"(unspec)",
"aspath":"",
"path":"",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.1",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
..........
..........
"10.100.0.2:2":{
"rd":"10.100.0.2:2",
"[3]:[0]:[32]:[10.100.0.2]":{
"prefix":"[3]:[0]:[32]:[10.100.0.2]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"205.0.113.2",
"aspath":"65002",
"path":"65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
},
{
"valid":true,
"pathFrom":"external",
"routeType":3,
"ethTag":0,
"ipLen":32,
"ip":"10.100.0.2",
"weight":0,
"peerId":"203.0.113.4",
"aspath":"65001 65002",
"path":"65001 65002",
"origin":"IGP",
"nexthops":[
{
"ip":"10.100.0.2",
"afi":"ipv4",
"used":true
}
]
}
]
}
},
....
....
"numPrefix":10,
"totalPrefix":10
}
leaf-1# sh bgp l2vpn evpn
BGP table version is 1, local router ID is 10.100.0.1
Status codes:s suppressed, d damped, h history, * valid, > best, i - int
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: ip 10.100.0.1:3
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:4
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:5
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.1:6
*> [3]:[0]:[32]:[10.100.0.1]
10.100.0.1 32768 i
Route Distinguisher: ip 10.100.0.2:2
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:3
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Route Distinguisher: ip 10.100.0.2:4
*> [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65002 i
* [3]:[0]:[32]:[10.100.0.2]
10.100.0.2 0 65001 65002
Displayed 10 out of 10 total prefixes
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-07 23:07:35 +02:00
} else {
if ( output_count = = 0 )
vty_out ( vty , " No prefixes displayed, %ld exist \n " ,
total_count ) ;
else
vty_out ( vty ,
" \n Displayed %ld out of %ld total prefixes \n " ,
output_count , total_count ) ;
2017-01-27 08:25:27 +01:00
}
return CMD_SUCCESS ;
2017-01-09 18:26:24 +01:00
}
2017-01-27 08:25:27 +01:00
DEFUN ( show_ip_bgp_l2vpn_evpn ,
show_ip_bgp_l2vpn_evpn_cmd ,
" show [ip] bgp l2vpn evpn [json] " ,
SHOW_STR IP_STR BGP_STR L2VPN_HELP_STR EVPN_HELP_STR JSON_STR )
2017-01-09 18:26:24 +01:00
{
2021-03-09 05:28:04 +01:00
return bgp_show_ethernet_vpn ( vty , NULL , bgp_show_type_normal , NULL ,
SHOW_DISPLAY_STANDARD ,
2017-01-27 08:25:27 +01:00
use_json ( argc , argv ) ) ;
2017-01-09 18:26:24 +01:00
}
2017-01-27 08:25:27 +01:00
DEFUN ( show_ip_bgp_l2vpn_evpn_rd ,
show_ip_bgp_l2vpn_evpn_rd_cmd ,
2021-03-09 05:28:04 +01:00
" show [ip] bgp l2vpn evpn rd <ASN:NN_OR_IP-ADDRESS:NN|all> [json] " ,
2017-01-27 08:25:27 +01:00
SHOW_STR
IP_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Display information for a route distinguisher \n "
2021-03-09 05:28:04 +01:00
" VPN Route Distinguisher \n "
" All VPN Route Distinguishers \n "
JSON_STR )
2017-01-09 18:26:24 +01:00
{
2017-05-04 04:49:50 +02:00
int idx_ext_community = 0 ;
2017-01-27 08:25:27 +01:00
int ret ;
struct prefix_rd prd ;
2021-03-09 05:28:04 +01:00
int rd_all = 0 ;
2017-05-04 04:49:50 +02:00
2022-05-12 09:23:28 +02:00
if ( argv_find ( argv , argc , " all " , & rd_all ) )
2021-03-09 05:28:04 +01:00
return bgp_show_ethernet_vpn ( vty , NULL , bgp_show_type_normal ,
NULL , SHOW_DISPLAY_STANDARD ,
use_json ( argc , argv ) ) ;
2021-03-30 17:27:07 +02:00
2021-03-09 05:28:04 +01:00
argv_find ( argv , argc , " ASN:NN_OR_IP-ADDRESS:NN " , & idx_ext_community ) ;
2017-01-27 08:25:27 +01:00
ret = str2prefix_rd ( argv [ idx_ext_community ] - > arg , & prd ) ;
if ( ! ret ) {
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %% Malformed Route Distinguisher \n " ) ;
2017-01-27 08:25:27 +01:00
return CMD_WARNING ;
}
2021-03-09 05:28:04 +01:00
return bgp_show_ethernet_vpn ( vty , & prd , bgp_show_type_normal , NULL ,
SHOW_DISPLAY_STANDARD ,
2017-01-27 08:25:27 +01:00
use_json ( argc , argv ) ) ;
2017-01-09 18:26:24 +01:00
}
2017-01-27 08:25:27 +01:00
DEFUN ( show_ip_bgp_l2vpn_evpn_all_tags ,
show_ip_bgp_l2vpn_evpn_all_tags_cmd ,
" show [ip] bgp l2vpn evpn all tags " ,
SHOW_STR
IP_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Display information about all EVPN NLRIs \n "
" Display BGP tags for prefixes \n " )
2017-01-09 18:26:24 +01:00
{
2021-03-09 05:28:04 +01:00
return bgp_show_ethernet_vpn ( vty , NULL , bgp_show_type_normal , NULL ,
SHOW_DISPLAY_TAGS , 0 ) ;
2017-01-09 18:26:24 +01:00
}
2017-01-27 08:25:27 +01:00
DEFUN ( show_ip_bgp_l2vpn_evpn_rd_tags ,
show_ip_bgp_l2vpn_evpn_rd_tags_cmd ,
2021-03-09 05:28:04 +01:00
" show [ip] bgp l2vpn evpn rd <ASN:NN_OR_IP-ADDRESS:NN|all> tags " ,
2017-01-27 08:25:27 +01:00
SHOW_STR
IP_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Display information for a route distinguisher \n "
2021-03-09 05:28:04 +01:00
" VPN Route Distinguisher \n "
" All VPN Route Distinguishers \n "
" Display BGP tags for prefixes \n " )
2017-01-09 18:26:24 +01:00
{
2017-05-04 04:49:50 +02:00
int idx_ext_community = 0 ;
2017-01-27 08:25:27 +01:00
int ret ;
struct prefix_rd prd ;
2021-03-09 05:28:04 +01:00
int rd_all = 0 ;
2017-05-04 04:49:50 +02:00
2022-05-12 09:23:28 +02:00
if ( argv_find ( argv , argc , " all " , & rd_all ) )
2021-03-09 05:28:04 +01:00
return bgp_show_ethernet_vpn ( vty , NULL , bgp_show_type_normal ,
NULL , SHOW_DISPLAY_TAGS , 0 ) ;
2021-03-30 17:27:07 +02:00
2021-03-09 05:28:04 +01:00
argv_find ( argv , argc , " ASN:NN_OR_IP-ADDRESS:NN " , & idx_ext_community ) ;
2017-01-27 08:25:27 +01:00
ret = str2prefix_rd ( argv [ idx_ext_community ] - > arg , & prd ) ;
if ( ! ret ) {
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %% Malformed Route Distinguisher \n " ) ;
2017-01-27 08:25:27 +01:00
return CMD_WARNING ;
}
2021-03-09 05:28:04 +01:00
return bgp_show_ethernet_vpn ( vty , & prd , bgp_show_type_normal , NULL ,
SHOW_DISPLAY_TAGS , 0 ) ;
2017-01-09 18:26:24 +01:00
}
2019-08-08 04:58:18 +02:00
DEFUN ( show_ip_bgp_l2vpn_evpn_neighbor_routes ,
show_ip_bgp_l2vpn_evpn_neighbor_routes_cmd ,
" show [ip] bgp l2vpn evpn neighbors <A.B.C.D|X:X::X:X|WORD> routes [json] " ,
2017-01-27 08:25:27 +01:00
SHOW_STR
IP_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Detailed information on TCP and BGP neighbor connections \n "
2019-08-08 04:58:18 +02:00
" IPv4 Neighbor to display information about \n "
" IPv6 Neighbor to display information about \n "
" Neighbor on BGP configured interface \n "
2017-01-27 08:25:27 +01:00
" Display routes learned from neighbor \n " JSON_STR )
2017-01-09 18:26:24 +01:00
{
2019-08-08 04:58:18 +02:00
int idx = 0 ;
2017-01-27 08:25:27 +01:00
struct peer * peer ;
2019-08-08 04:58:18 +02:00
char * peerstr = NULL ;
2018-08-29 14:19:54 +02:00
bool uj = use_json ( argc , argv ) ;
2019-08-08 04:58:18 +02:00
afi_t afi = AFI_L2VPN ;
safi_t safi = SAFI_EVPN ;
struct bgp * bgp = NULL ;
2017-01-27 08:25:27 +01:00
2019-08-08 04:58:18 +02:00
bgp_vty_find_and_parse_afi_safi_bgp ( vty , argv , argc , & idx , & afi , & safi ,
& bgp , uj ) ;
if ( ! idx ) {
vty_out ( vty , " No index \n " ) ;
return CMD_WARNING ;
}
/* neighbors <A.B.C.D|X:X::X:X|WORD> */
argv_find ( argv , argc , " neighbors " , & idx ) ;
peerstr = argv [ + + idx ] - > arg ;
2017-05-04 04:49:50 +02:00
2019-08-08 04:58:18 +02:00
peer = peer_lookup_in_view ( vty , bgp , peerstr , uj ) ;
if ( ! peer ) {
2017-01-27 08:25:27 +01:00
if ( uj ) {
json_object * json_no = NULL ;
json_no = json_object_new_object ( ) ;
json_object_string_add ( json_no , " warning " ,
" Malformed address " ) ;
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %s \n " ,
2017-06-21 05:10:57 +02:00
json_object_to_json_string ( json_no ) ) ;
2017-01-27 08:25:27 +01:00
json_object_free ( json_no ) ;
} else
2017-07-13 17:49:13 +02:00
vty_out ( vty , " Malformed address: %s \n " ,
2019-08-08 04:58:18 +02:00
argv [ idx ] - > arg ) ;
2017-01-27 08:25:27 +01:00
return CMD_WARNING ;
}
if ( ! peer | | ! peer - > afc [ AFI_L2VPN ] [ SAFI_EVPN ] ) {
if ( uj ) {
json_object * json_no = NULL ;
json_no = json_object_new_object ( ) ;
json_object_string_add (
json_no , " warning " ,
" No such neighbor or address family " ) ;
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %s \n " ,
2017-06-21 05:10:57 +02:00
json_object_to_json_string ( json_no ) ) ;
2017-01-27 08:25:27 +01:00
json_object_free ( json_no ) ;
} else
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %% No such neighbor or address family \n " ) ;
2017-01-27 08:25:27 +01:00
return CMD_WARNING ;
}
2021-03-09 05:28:04 +01:00
return bgp_show_ethernet_vpn ( vty , NULL , bgp_show_type_neighbor , peer ,
SHOW_DISPLAY_STANDARD , uj ) ;
2017-01-09 18:26:24 +01:00
}
2017-01-27 08:25:27 +01:00
DEFUN ( show_ip_bgp_l2vpn_evpn_rd_neighbor_routes ,
show_ip_bgp_l2vpn_evpn_rd_neighbor_routes_cmd ,
2021-03-09 05:28:04 +01:00
" show [ip] bgp l2vpn evpn rd <ASN:NN_OR_IP-ADDRESS:NN|all> neighbors <A.B.C.D|X:X::X:X|WORD> routes [json] " ,
2017-01-27 08:25:27 +01:00
SHOW_STR
IP_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Display information for a route distinguisher \n "
" VPN Route Distinguisher \n "
2021-03-09 05:28:04 +01:00
" All VPN Route Distinguishers \n "
2017-01-27 08:25:27 +01:00
" Detailed information on TCP and BGP neighbor connections \n "
2019-08-08 04:58:18 +02:00
" IPv4 Neighbor to display information about \n "
" IPv6 Neighbor to display information about \n "
" Neighbor on BGP configured interface \n "
2017-01-27 08:25:27 +01:00
" Display routes learned from neighbor \n " JSON_STR )
2017-01-09 18:26:24 +01:00
{
2017-05-04 04:49:50 +02:00
int idx_ext_community = 0 ;
2019-08-08 04:58:18 +02:00
int idx = 0 ;
2017-01-27 08:25:27 +01:00
int ret ;
struct peer * peer ;
2019-08-08 04:58:18 +02:00
char * peerstr = NULL ;
bgpd: Initialize prd for show_ip_bgp_l2vpn_evpn_rd_neighbor_routes()
*** CID 1517751: Uninitialized variables (UNINIT)
/bgpd/bgp_evpn_vty.c: 1648 in show_ip_bgp_l2vpn_evpn_rd_neighbor_routes()
1642
1643
1644 if (rd_all)
1645 return bgp_show_ethernet_vpn(vty, NULL, bgp_show_type_neighbor,
1646 peer, SHOW_DISPLAY_STANDARD, uj);
1647 else
>>> CID 1517751: Uninitialized variables (UNINIT)
>>> Using uninitialized element of array "prd.val" when calling "bgp_show_ethernet_vpn".
1648 return bgp_show_ethernet_vpn(vty, &prd, bgp_show_type_neighbor,
1649 peer, SHOW_DISPLAY_STANDARD, uj);
1650 }
1651
1652 DEFUN(show_ip_bgp_l2vpn_evpn_neighbor_advertised_routes,
1653 show_ip_bgp_l2vpn_evpn_neighbor_advertised_routes_cmd,
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-13 14:41:16 +02:00
struct prefix_rd prd = { } ;
2018-08-29 14:19:54 +02:00
bool uj = use_json ( argc , argv ) ;
2019-08-08 04:58:18 +02:00
afi_t afi = AFI_L2VPN ;
safi_t safi = SAFI_EVPN ;
struct bgp * bgp = NULL ;
2021-03-09 05:28:04 +01:00
int rd_all = 0 ;
2017-01-27 08:25:27 +01:00
2019-08-08 04:58:18 +02:00
bgp_vty_find_and_parse_afi_safi_bgp ( vty , argv , argc , & idx , & afi , & safi ,
& bgp , uj ) ;
if ( ! idx ) {
vty_out ( vty , " No index \n " ) ;
return CMD_WARNING ;
}
2017-05-04 04:49:50 +02:00
2022-05-12 09:23:28 +02:00
if ( argv_find ( argv , argc , " all " , & rd_all ) ) {
2021-03-09 05:28:04 +01:00
argv_find ( argv , argc , " ASN:NN_OR_IP-ADDRESS:NN " ,
& idx_ext_community ) ;
ret = str2prefix_rd ( argv [ idx_ext_community ] - > arg , & prd ) ;
if ( ! ret ) {
if ( uj ) {
json_object * json_no = NULL ;
json_no = json_object_new_object ( ) ;
json_object_string_add (
json_no , " warning " ,
" Malformed Route Distinguisher " ) ;
vty_out ( vty , " %s \n " ,
json_object_to_json_string ( json_no ) ) ;
json_object_free ( json_no ) ;
} else
vty_out ( vty ,
" %% Malformed Route Distinguisher \n " ) ;
return CMD_WARNING ;
}
2017-01-27 08:25:27 +01:00
}
2019-08-08 04:58:18 +02:00
/* neighbors <A.B.C.D|X:X::X:X|WORD> */
argv_find ( argv , argc , " neighbors " , & idx ) ;
peerstr = argv [ + + idx ] - > arg ;
peer = peer_lookup_in_view ( vty , bgp , peerstr , uj ) ;
if ( ! peer ) {
2017-01-27 08:25:27 +01:00
if ( uj ) {
json_object * json_no = NULL ;
json_no = json_object_new_object ( ) ;
json_object_string_add ( json_no , " warning " ,
" Malformed address " ) ;
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %s \n " ,
2017-06-21 05:10:57 +02:00
json_object_to_json_string ( json_no ) ) ;
2017-01-27 08:25:27 +01:00
json_object_free ( json_no ) ;
} else
2017-07-13 17:49:13 +02:00
vty_out ( vty , " Malformed address: %s \n " ,
2019-08-08 04:58:18 +02:00
argv [ idx ] - > arg ) ;
2017-01-27 08:25:27 +01:00
return CMD_WARNING ;
}
if ( ! peer | | ! peer - > afc [ AFI_L2VPN ] [ SAFI_EVPN ] ) {
if ( uj ) {
json_object * json_no = NULL ;
json_no = json_object_new_object ( ) ;
json_object_string_add (
json_no , " warning " ,
" No such neighbor or address family " ) ;
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %s \n " ,
2017-06-21 05:10:57 +02:00
json_object_to_json_string ( json_no ) ) ;
2017-01-27 08:25:27 +01:00
json_object_free ( json_no ) ;
} else
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %% No such neighbor or address family \n " ) ;
2017-01-27 08:25:27 +01:00
return CMD_WARNING ;
}
2021-03-09 05:28:04 +01:00
if ( rd_all )
return bgp_show_ethernet_vpn ( vty , NULL , bgp_show_type_neighbor ,
peer , SHOW_DISPLAY_STANDARD , uj ) ;
else
return bgp_show_ethernet_vpn ( vty , & prd , bgp_show_type_neighbor ,
peer , SHOW_DISPLAY_STANDARD , uj ) ;
2017-01-09 18:26:24 +01:00
}
2019-08-08 04:58:18 +02:00
DEFUN ( show_ip_bgp_l2vpn_evpn_neighbor_advertised_routes ,
show_ip_bgp_l2vpn_evpn_neighbor_advertised_routes_cmd ,
" show [ip] bgp l2vpn evpn neighbors <A.B.C.D|X:X::X:X|WORD> advertised-routes [json] " ,
2017-01-27 08:25:27 +01:00
SHOW_STR
IP_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Detailed information on TCP and BGP neighbor connections \n "
2019-08-08 04:58:18 +02:00
" IPv4 Neighbor to display information about \n "
" IPv6 Neighbor to display information about \n "
" Neighbor on BGP configured interface \n "
2017-01-27 08:25:27 +01:00
" Display the routes advertised to a BGP neighbor \n " JSON_STR )
2017-01-09 18:26:24 +01:00
{
2019-08-08 04:58:18 +02:00
int idx = 0 ;
2017-01-27 08:25:27 +01:00
struct peer * peer ;
2018-08-29 14:19:54 +02:00
bool uj = use_json ( argc , argv ) ;
2019-08-08 04:58:18 +02:00
struct bgp * bgp = NULL ;
afi_t afi = AFI_L2VPN ;
safi_t safi = SAFI_EVPN ;
char * peerstr = NULL ;
if ( uj )
argc - - ;
2017-01-27 08:25:27 +01:00
2019-08-08 04:58:18 +02:00
bgp_vty_find_and_parse_afi_safi_bgp ( vty , argv , argc , & idx , & afi , & safi ,
& bgp , uj ) ;
if ( ! idx ) {
vty_out ( vty , " No index \n " ) ;
return CMD_WARNING ;
}
/* neighbors <A.B.C.D|X:X::X:X|WORD> */
argv_find ( argv , argc , " neighbors " , & idx ) ;
peerstr = argv [ + + idx ] - > arg ;
2017-05-04 04:49:50 +02:00
2019-08-08 04:58:18 +02:00
peer = peer_lookup_in_view ( vty , bgp , peerstr , uj ) ;
if ( ! peer ) {
2017-01-27 08:25:27 +01:00
if ( uj ) {
json_object * json_no = NULL ;
json_no = json_object_new_object ( ) ;
json_object_string_add ( json_no , " warning " ,
" Malformed address " ) ;
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %s \n " ,
2017-06-21 05:10:57 +02:00
json_object_to_json_string ( json_no ) ) ;
2017-01-27 08:25:27 +01:00
json_object_free ( json_no ) ;
} else
2017-07-13 17:49:13 +02:00
vty_out ( vty , " Malformed address: %s \n " ,
2019-08-08 04:58:18 +02:00
argv [ idx ] - > arg ) ;
2017-01-27 08:25:27 +01:00
return CMD_WARNING ;
}
if ( ! peer | | ! peer - > afc [ AFI_L2VPN ] [ SAFI_EVPN ] ) {
if ( uj ) {
json_object * json_no = NULL ;
json_no = json_object_new_object ( ) ;
json_object_string_add (
json_no , " warning " ,
" No such neighbor or address family " ) ;
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %s \n " ,
2017-06-21 05:10:57 +02:00
json_object_to_json_string ( json_no ) ) ;
2017-01-27 08:25:27 +01:00
json_object_free ( json_no ) ;
} else
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %% No such neighbor or address family \n " ) ;
2017-01-27 08:25:27 +01:00
return CMD_WARNING ;
}
return show_adj_route_vpn ( vty , peer , NULL , AFI_L2VPN , SAFI_EVPN , uj ) ;
2017-01-09 18:26:24 +01:00
}
2017-01-27 08:25:27 +01:00
DEFUN ( show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes ,
show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes_cmd ,
2021-03-09 05:28:04 +01:00
" show [ip] bgp l2vpn evpn rd <ASN:NN_OR_IP-ADDRESS:NN|all> neighbors <A.B.C.D|X:X::X:X|WORD> advertised-routes [json] " ,
2017-01-27 08:25:27 +01:00
SHOW_STR
IP_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Display information for a route distinguisher \n "
" VPN Route Distinguisher \n "
2021-03-09 05:28:04 +01:00
" All VPN Route Distinguishers \n "
2017-01-27 08:25:27 +01:00
" Detailed information on TCP and BGP neighbor connections \n "
2019-08-08 04:58:18 +02:00
" IPv4 Neighbor to display information about \n "
" IPv6 Neighbor to display information about \n "
" Neighbor on BGP configured interface \n "
2017-01-27 08:25:27 +01:00
" Display the routes advertised to a BGP neighbor \n " JSON_STR )
2017-01-09 18:26:24 +01:00
{
2017-05-04 04:49:50 +02:00
int idx_ext_community = 0 ;
2019-08-08 04:58:18 +02:00
int idx = 0 ;
2017-01-27 08:25:27 +01:00
int ret ;
struct peer * peer ;
struct prefix_rd prd ;
2019-08-08 04:58:18 +02:00
struct bgp * bgp = NULL ;
2018-08-29 14:19:54 +02:00
bool uj = use_json ( argc , argv ) ;
2019-08-08 04:58:18 +02:00
char * peerstr = NULL ;
afi_t afi = AFI_L2VPN ;
safi_t safi = SAFI_EVPN ;
2021-03-09 05:28:04 +01:00
int rd_all = 0 ;
2019-08-08 04:58:18 +02:00
if ( uj )
argc - - ;
if ( uj )
argc - - ;
bgp_vty_find_and_parse_afi_safi_bgp ( vty , argv , argc , & idx , & afi , & safi ,
& bgp , uj ) ;
if ( ! idx ) {
vty_out ( vty , " No index \n " ) ;
return CMD_WARNING ;
}
2017-01-27 08:25:27 +01:00
2019-08-08 04:58:18 +02:00
/* neighbors <A.B.C.D|X:X::X:X|WORD> */
argv_find ( argv , argc , " neighbors " , & idx ) ;
peerstr = argv [ + + idx ] - > arg ;
peer = peer_lookup_in_view ( vty , bgp , peerstr , uj ) ;
if ( ! peer ) {
2017-01-27 08:25:27 +01:00
if ( uj ) {
json_object * json_no = NULL ;
json_no = json_object_new_object ( ) ;
json_object_string_add ( json_no , " warning " ,
" Malformed address " ) ;
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %s \n " ,
2017-06-21 05:10:57 +02:00
json_object_to_json_string ( json_no ) ) ;
2017-01-27 08:25:27 +01:00
json_object_free ( json_no ) ;
} else
2017-07-13 17:49:13 +02:00
vty_out ( vty , " Malformed address: %s \n " ,
2019-08-08 04:58:18 +02:00
argv [ idx ] - > arg ) ;
2017-01-27 08:25:27 +01:00
return CMD_WARNING ;
}
if ( ! peer | | ! peer - > afc [ AFI_L2VPN ] [ SAFI_EVPN ] ) {
if ( uj ) {
json_object * json_no = NULL ;
json_no = json_object_new_object ( ) ;
json_object_string_add (
json_no , " warning " ,
" No such neighbor or address family " ) ;
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %s \n " ,
2017-06-21 05:10:57 +02:00
json_object_to_json_string ( json_no ) ) ;
2017-01-27 08:25:27 +01:00
json_object_free ( json_no ) ;
} else
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %% No such neighbor or address family \n " ) ;
2017-01-27 08:25:27 +01:00
return CMD_WARNING ;
}
2022-05-12 09:23:28 +02:00
if ( argv_find ( argv , argc , " all " , & rd_all ) )
2021-03-09 05:28:04 +01:00
return show_adj_route_vpn ( vty , peer , NULL , AFI_L2VPN , SAFI_EVPN ,
uj ) ;
else {
argv_find ( argv , argc , " ASN:NN_OR_IP-ADDRESS:NN " ,
& idx_ext_community ) ;
ret = str2prefix_rd ( argv [ idx_ext_community ] - > arg , & prd ) ;
if ( ! ret ) {
if ( uj ) {
json_object * json_no = NULL ;
json_no = json_object_new_object ( ) ;
json_object_string_add (
json_no , " warning " ,
" Malformed Route Distinguisher " ) ;
vty_out ( vty , " %s \n " ,
json_object_to_json_string ( json_no ) ) ;
json_object_free ( json_no ) ;
} else
vty_out ( vty ,
" %% Malformed Route Distinguisher \n " ) ;
return CMD_WARNING ;
}
2017-01-27 08:25:27 +01:00
}
return show_adj_route_vpn ( vty , peer , & prd , AFI_L2VPN , SAFI_EVPN , uj ) ;
2017-01-09 18:26:24 +01:00
}
2017-01-27 08:25:27 +01:00
DEFUN ( show_ip_bgp_l2vpn_evpn_all_overlay ,
show_ip_bgp_l2vpn_evpn_all_overlay_cmd ,
bgpd: json cli output for bgp evpn overlay
This diff provides implementation for the cli:
"show bgp l2vpn evpn all overlay json"
Sample output after this change:
leaf-1# sh bgp l2vpn evpn all overlay json
{
"bgpTableVersion":1,
"bgpLocalRouterId":"10.100.0.1",
"defaultLocPrf":100,
"localAS":65000,
"10.101.1.4:5":{
"rd":"10.101.1.4:5",
"[5]:[0]:[32]:[101.101.101.101]":{
"prefix":"[5]:[0]:[32]:[101.101.101.101]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"nexthop":{
"ip":"10.100.0.2",
"afi":"ipv4"
},
"overlay":{
"esi":"00:00:00:00:00:00:00:00:00:00",
"gw":"0.0.0.0",
"rmac":"ea:47:79:75:22:1b"
}
},
{
"valid":true,
"pathFrom":"external",
"nexthop":{
"ip":"10.100.0.2",
"afi":"ipv4"
},
"overlay":{
"esi":"00:00:00:00:00:00:00:00:00:00",
"gw":"0.0.0.0",
"rmac":"ea:47:79:75:22:1b"
}
}
]
}
},
...
...
}
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-11 18:47:10 +02:00
" show [ip] bgp l2vpn evpn all overlay [json] " ,
2017-01-27 08:25:27 +01:00
SHOW_STR
IP_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Display information about all EVPN NLRIs \n "
bgpd: json cli output for bgp evpn overlay
This diff provides implementation for the cli:
"show bgp l2vpn evpn all overlay json"
Sample output after this change:
leaf-1# sh bgp l2vpn evpn all overlay json
{
"bgpTableVersion":1,
"bgpLocalRouterId":"10.100.0.1",
"defaultLocPrf":100,
"localAS":65000,
"10.101.1.4:5":{
"rd":"10.101.1.4:5",
"[5]:[0]:[32]:[101.101.101.101]":{
"prefix":"[5]:[0]:[32]:[101.101.101.101]",
"prefixLen":288,
"paths":[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"nexthop":{
"ip":"10.100.0.2",
"afi":"ipv4"
},
"overlay":{
"esi":"00:00:00:00:00:00:00:00:00:00",
"gw":"0.0.0.0",
"rmac":"ea:47:79:75:22:1b"
}
},
{
"valid":true,
"pathFrom":"external",
"nexthop":{
"ip":"10.100.0.2",
"afi":"ipv4"
},
"overlay":{
"esi":"00:00:00:00:00:00:00:00:00:00",
"gw":"0.0.0.0",
"rmac":"ea:47:79:75:22:1b"
}
}
]
}
},
...
...
}
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-11 18:47:10 +02:00
" Display BGP Overlay Information for prefixes \n "
JSON_STR )
2017-01-09 18:26:24 +01:00
{
2017-01-27 08:25:27 +01:00
return bgp_show_ethernet_vpn ( vty , NULL , bgp_show_type_normal , NULL ,
SHOW_DISPLAY_OVERLAY ,
use_json ( argc , argv ) ) ;
2017-01-09 18:26:24 +01:00
}
2017-01-27 08:25:27 +01:00
DEFUN ( show_ip_bgp_evpn_rd_overlay ,
show_ip_bgp_evpn_rd_overlay_cmd ,
2021-03-09 05:28:04 +01:00
" show [ip] bgp l2vpn evpn rd <ASN:NN_OR_IP-ADDRESS:NN|all> overlay " ,
2017-01-27 08:25:27 +01:00
SHOW_STR
IP_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Display information for a route distinguisher \n "
" VPN Route Distinguisher \n "
2021-03-09 05:28:04 +01:00
" All VPN Route Distinguishers \n "
2017-01-27 08:25:27 +01:00
" Display BGP Overlay Information for prefixes \n " )
2017-01-09 18:26:24 +01:00
{
2017-05-04 04:49:50 +02:00
int idx_ext_community = 0 ;
2017-01-27 08:25:27 +01:00
int ret ;
struct prefix_rd prd ;
2021-03-09 05:28:04 +01:00
int rd_all = 0 ;
2017-05-04 04:49:50 +02:00
2022-05-12 09:23:28 +02:00
if ( argv_find ( argv , argc , " all " , & rd_all ) )
2021-03-09 05:28:04 +01:00
return bgp_show_ethernet_vpn ( vty , NULL , bgp_show_type_normal ,
NULL , SHOW_DISPLAY_OVERLAY ,
use_json ( argc , argv ) ) ;
2021-03-30 17:27:07 +02:00
2021-03-09 05:28:04 +01:00
argv_find ( argv , argc , " ASN:NN_OR_IP-ADDRESS:NN " , & idx_ext_community ) ;
2017-01-27 08:25:27 +01:00
ret = str2prefix_rd ( argv [ idx_ext_community ] - > arg , & prd ) ;
if ( ! ret ) {
2017-07-13 17:49:13 +02:00
vty_out ( vty , " %% Malformed Route Distinguisher \n " ) ;
2017-01-27 08:25:27 +01:00
return CMD_WARNING ;
}
return bgp_show_ethernet_vpn ( vty , & prd , bgp_show_type_normal , NULL ,
SHOW_DISPLAY_OVERLAY ,
use_json ( argc , argv ) ) ;
2017-01-09 18:26:24 +01:00
}
2019-10-07 23:58:39 +02:00
DEFUN ( show_bgp_l2vpn_evpn_com ,
show_bgp_l2vpn_evpn_com_cmd ,
" show bgp l2vpn evpn \
< community AA : NN | large - community AA : BB : CC > \
[ exact - match ] [ json ] " ,
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Display routes matching the community \n "
" Community number where AA and NN are (0-65535) \n "
" Display routes matching the large-community \n "
" List of large-community numbers \n "
" Exact match of the communities \n "
JSON_STR )
{
int idx = 0 ;
int ret = 0 ;
const char * clist_number_or_name ;
int show_type = bgp_show_type_normal ;
struct community * com ;
struct lcommunity * lcom ;
if ( argv_find ( argv , argc , " large-community " , & idx ) ) {
clist_number_or_name = argv [ + + idx ] - > arg ;
show_type = bgp_show_type_lcommunity ;
if ( + + idx < argc & & strmatch ( argv [ idx ] - > text , " exact-match " ) )
show_type = bgp_show_type_lcommunity_exact ;
lcom = lcommunity_str2com ( clist_number_or_name ) ;
if ( ! lcom ) {
vty_out ( vty , " %% Large-community malformed \n " ) ;
return CMD_WARNING ;
}
ret = bgp_show_ethernet_vpn ( vty , NULL , show_type , lcom ,
SHOW_DISPLAY_STANDARD ,
use_json ( argc , argv ) ) ;
lcommunity_free ( & lcom ) ;
} else if ( argv_find ( argv , argc , " community " , & idx ) ) {
clist_number_or_name = argv [ + + idx ] - > arg ;
show_type = bgp_show_type_community ;
if ( + + idx < argc & & strmatch ( argv [ idx ] - > text , " exact-match " ) )
show_type = bgp_show_type_community_exact ;
com = community_str2com ( clist_number_or_name ) ;
if ( ! com ) {
vty_out ( vty , " %% Community malformed: %s \n " ,
clist_number_or_name ) ;
return CMD_WARNING ;
}
ret = bgp_show_ethernet_vpn ( vty , NULL , show_type , com ,
SHOW_DISPLAY_STANDARD ,
use_json ( argc , argv ) ) ;
community_free ( & com ) ;
}
return ret ;
}
2019-08-08 04:58:18 +02:00
/* For testing purpose, static route of EVPN RT-5. */
2017-01-27 08:25:27 +01:00
DEFUN ( evpnrt5_network ,
evpnrt5_network_cmd ,
2022-06-13 11:18:36 +02:00
" network <A.B.C.D/M|X:X::X:X/M> rd ASN:NN_OR_IP-ADDRESS:NN ethtag WORD label WORD esi WORD gwip <A.B.C.D|X:X::X:X> routermac WORD [route-map RMAP_NAME] " ,
2017-01-27 08:25:27 +01:00
" Specify a network to announce via BGP \n "
" IP prefix \n "
" IPv6 prefix \n "
" Specify Route Distinguisher \n "
" VPN Route Distinguisher \n "
" Ethernet Tag \n "
" Ethernet Tag Value \n "
" BGP label \n "
" label value \n "
" Ethernet Segment Identifier \n "
" ESI value ( 00:11:22:33:44:55:66:77:88:99 format) \n "
" Gateway IP \n "
" Gateway IP ( A.B.C.D ) \n "
" Gateway IPv6 ( X:X::X:X ) \n "
" Router Mac Ext Comm \n "
2017-02-24 21:08:48 +01:00
" Router Mac address Value ( aa:bb:cc:dd:ee:ff format) \n "
" Route-map to modify the attributes \n "
" Name of the route map \n " )
2016-10-27 08:02:36 +02:00
{
2017-01-27 08:25:27 +01:00
int idx_ipv4_prefixlen = 1 ;
2017-09-25 18:28:01 +02:00
int idx_route_distinguisher = 3 ;
int idx_label = 7 ;
2017-01-27 08:25:27 +01:00
int idx_esi = 9 ;
int idx_gwip = 11 ;
int idx_ethtag = 5 ;
int idx_routermac = 13 ;
2017-09-25 18:28:01 +02:00
2023-08-10 10:37:40 +02:00
return bgp_static_set ( vty , false , argv [ idx_ipv4_prefixlen ] - > arg ,
argv [ idx_route_distinguisher ] - > arg ,
argv [ idx_label ] - > arg , AFI_L2VPN , SAFI_EVPN , NULL ,
0 , 0 , BGP_EVPN_IP_PREFIX_ROUTE ,
argv [ idx_esi ] - > arg , argv [ idx_gwip ] - > arg ,
argv [ idx_ethtag ] - > arg , argv [ idx_routermac ] - > arg ) ;
2016-10-27 08:02:36 +02:00
}
2019-08-08 04:58:18 +02:00
/* For testing purpose, static route of EVPN RT-5. */
2017-01-27 08:25:27 +01:00
DEFUN ( no_evpnrt5_network ,
no_evpnrt5_network_cmd ,
2017-09-14 20:07:30 +02:00
" no network <A.B.C.D/M|X:X::X:X/M> rd ASN:NN_OR_IP-ADDRESS:NN ethtag WORD label WORD esi WORD gwip <A.B.C.D|X:X::X:X> " ,
2017-01-27 08:25:27 +01:00
NO_STR
" Specify a network to announce via BGP \n "
" IP prefix \n "
" IPv6 prefix \n "
" Specify Route Distinguisher \n "
" VPN Route Distinguisher \n "
" Ethernet Tag \n "
" Ethernet Tag Value \n "
" BGP label \n "
" label value \n "
" Ethernet Segment Identifier \n "
" ESI value ( 00:11:22:33:44:55:66:77:88:99 format) \n "
" Gateway IP \n " " Gateway IP ( A.B.C.D ) \n " " Gateway IPv6 ( X:X::X:X ) \n " )
2016-10-27 08:02:36 +02:00
{
2017-01-27 08:25:27 +01:00
int idx_ipv4_prefixlen = 2 ;
int idx_ext_community = 4 ;
int idx_label = 8 ;
int idx_ethtag = 6 ;
int idx_esi = 10 ;
int idx_gwip = 12 ;
2023-08-10 10:37:40 +02:00
return bgp_static_set ( vty , true , argv [ idx_ipv4_prefixlen ] - > arg ,
argv [ idx_ext_community ] - > arg ,
argv [ idx_label ] - > arg , AFI_L2VPN , SAFI_EVPN , NULL ,
0 , 0 , BGP_EVPN_IP_PREFIX_ROUTE , argv [ idx_esi ] - > arg ,
argv [ idx_gwip ] - > arg , argv [ idx_ethtag ] - > arg , NULL ) ;
2016-10-27 08:02:36 +02:00
}
2017-05-16 00:01:57 +02:00
static void evpn_import_rt_delete_auto ( struct bgp * bgp , struct bgpevpn * vpn )
{
2021-02-17 22:11:49 +01:00
evpn_rt_delete_auto ( bgp , vpn - > vni , vpn - > import_rtl , false ) ;
2017-05-16 00:01:57 +02:00
}
static void evpn_export_rt_delete_auto ( struct bgp * bgp , struct bgpevpn * vpn )
{
2021-02-17 22:11:49 +01:00
evpn_rt_delete_auto ( bgp , vpn - > vni , vpn - > export_rtl , false ) ;
2017-05-16 00:01:57 +02:00
}
/*
* Configure the Import RTs for a VNI ( vty handler ) . Caller expected to
* check that this is a change .
*/
static void evpn_configure_import_rt ( struct bgp * bgp , struct bgpevpn * vpn ,
struct ecommunity * ecomadd )
{
/* If the VNI is "live", we need to uninstall routes using the current
* import RT ( s ) first before we update the import RT , and subsequently
* install routes .
*/
if ( is_vni_live ( vpn ) )
bgp_evpn_uninstall_routes ( bgp , vpn ) ;
/* Cleanup the RT to VNI mapping and get rid of existing import RT. */
bgp_evpn_unmap_vni_from_its_rts ( bgp , vpn ) ;
/* If the auto route-target is in use we must remove it */
evpn_import_rt_delete_auto ( bgp , vpn ) ;
/* Add new RT and rebuild the RT to VNI mapping */
listnode_add_sort ( vpn - > import_rtl , ecomadd ) ;
SET_FLAG ( vpn - > flags , VNI_FLAG_IMPRT_CFGD ) ;
bgp_evpn_map_vni_to_its_rts ( bgp , vpn ) ;
/* Install routes that match new import RT */
if ( is_vni_live ( vpn ) )
bgp_evpn_install_routes ( bgp , vpn ) ;
}
/*
* Unconfigure Import RT ( s ) for a VNI ( vty handler ) .
*/
static void evpn_unconfigure_import_rt ( struct bgp * bgp , struct bgpevpn * vpn ,
struct ecommunity * ecomdel )
{
struct listnode * node , * nnode , * node_to_del ;
struct ecommunity * ecom ;
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
/* Along the lines of "configure" except we have to reset to the
* automatic value .
*/
if ( is_vni_live ( vpn ) )
bgp_evpn_uninstall_routes ( bgp , vpn ) ;
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
/* Cleanup the RT to VNI mapping and get rid of existing import RT. */
bgp_evpn_unmap_vni_from_its_rts ( bgp , vpn ) ;
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
/* Delete all import RTs */
if ( ecomdel = = NULL ) {
2018-11-21 01:15:56 +01:00
for ( ALL_LIST_ELEMENTS ( vpn - > import_rtl , node , nnode , ecom ) ) {
2017-05-16 00:01:57 +02:00
ecommunity_free ( & ecom ) ;
2018-11-21 01:15:56 +01:00
list_delete_node ( vpn - > import_rtl , node ) ;
}
2017-05-16 00:01:57 +02:00
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
/* Delete a specific import RT */
else {
node_to_del = NULL ;
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
for ( ALL_LIST_ELEMENTS ( vpn - > import_rtl , node , nnode , ecom ) ) {
if ( ecommunity_match ( ecom , ecomdel ) ) {
ecommunity_free ( & ecom ) ;
node_to_del = node ;
break ;
2017-07-17 14:03:14 +02:00
}
2017-05-16 00:01:57 +02:00
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
if ( node_to_del )
list_delete_node ( vpn - > import_rtl , node_to_del ) ;
}
2017-07-17 14:03:14 +02:00
2018-06-29 04:33:35 +02:00
assert ( vpn - > import_rtl ) ;
2017-05-16 00:01:57 +02:00
/* Reset to auto RT - this also rebuilds the RT to VNI mapping */
if ( list_isempty ( vpn - > import_rtl ) ) {
UNSET_FLAG ( vpn - > flags , VNI_FLAG_IMPRT_CFGD ) ;
bgp_evpn_derive_auto_rt_import ( bgp , vpn ) ;
}
/* Rebuild the RT to VNI mapping */
else
bgp_evpn_map_vni_to_its_rts ( bgp , vpn ) ;
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
/* Install routes that match new import RT */
if ( is_vni_live ( vpn ) )
bgp_evpn_install_routes ( bgp , vpn ) ;
}
/*
* Configure the Export RT for a VNI ( vty handler ) . Caller expected to
* check that this is a change . Note that only a single export RT is
* allowed for a VNI and any change to configuration is implemented as
* a " replace " ( similar to other configuration ) .
*/
static void evpn_configure_export_rt ( struct bgp * bgp , struct bgpevpn * vpn ,
struct ecommunity * ecomadd )
{
/* If the auto route-target is in use we must remove it */
evpn_export_rt_delete_auto ( bgp , vpn ) ;
listnode_add_sort ( vpn - > export_rtl , ecomadd ) ;
SET_FLAG ( vpn - > flags , VNI_FLAG_EXPRT_CFGD ) ;
if ( is_vni_live ( vpn ) )
bgp_evpn_handle_export_rt_change ( bgp , vpn ) ;
}
/*
* Unconfigure the Export RT for a VNI ( vty handler )
*/
static void evpn_unconfigure_export_rt ( struct bgp * bgp , struct bgpevpn * vpn ,
struct ecommunity * ecomdel )
{
struct listnode * node , * nnode , * node_to_del ;
struct ecommunity * ecom ;
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
/* Delete all export RTs */
if ( ecomdel = = NULL ) {
/* Reset to default and process all routes. */
2018-11-21 01:15:56 +01:00
for ( ALL_LIST_ELEMENTS ( vpn - > export_rtl , node , nnode , ecom ) ) {
2017-05-16 00:01:57 +02:00
ecommunity_free ( & ecom ) ;
2018-11-21 01:15:56 +01:00
list_delete_node ( vpn - > export_rtl , node ) ;
}
2017-05-16 00:01:57 +02:00
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
/* Delete a specific export RT */
else {
node_to_del = NULL ;
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
for ( ALL_LIST_ELEMENTS ( vpn - > export_rtl , node , nnode , ecom ) ) {
if ( ecommunity_match ( ecom , ecomdel ) ) {
ecommunity_free ( & ecom ) ;
node_to_del = node ;
break ;
2017-07-17 14:03:14 +02:00
}
2017-05-16 00:01:57 +02:00
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
if ( node_to_del )
list_delete_node ( vpn - > export_rtl , node_to_del ) ;
}
2017-07-17 14:03:14 +02:00
2018-06-29 04:33:35 +02:00
assert ( vpn - > export_rtl ) ;
2017-05-16 00:01:57 +02:00
if ( list_isempty ( vpn - > export_rtl ) ) {
UNSET_FLAG ( vpn - > flags , VNI_FLAG_EXPRT_CFGD ) ;
bgp_evpn_derive_auto_rt_export ( bgp , vpn ) ;
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
if ( is_vni_live ( vpn ) )
bgp_evpn_handle_export_rt_change ( bgp , vpn ) ;
}
2017-10-26 01:49:18 +02:00
/*
* Configure RD for VRF
*/
2022-11-22 11:20:51 +01:00
static void evpn_configure_vrf_rd ( struct bgp * bgp_vrf , struct prefix_rd * rd ,
const char * rd_pretty )
2017-10-26 01:49:18 +02:00
{
/* If we have already advertise type-5 routes with a diffrent RD, we
2017-12-27 20:47:10 +01:00
* have to delete and withdraw them firs
*/
2017-11-03 22:54:20 +01:00
bgp_evpn_handle_vrf_rd_change ( bgp_vrf , 1 ) ;
2017-10-26 01:49:18 +02:00
2023-07-04 11:35:10 +02:00
if ( bgp_vrf - > vrf_prd_pretty )
2023-11-15 20:52:10 +01:00
XFREE ( MTYPE_BGP_NAME , bgp_vrf - > vrf_prd_pretty ) ;
2023-07-04 11:35:10 +02:00
2017-10-26 01:49:18 +02:00
/* update RD */
memcpy ( & bgp_vrf - > vrf_prd , rd , sizeof ( struct prefix_rd ) ) ;
2023-11-15 20:52:10 +01:00
bgp_vrf - > vrf_prd_pretty = XSTRDUP ( MTYPE_BGP_NAME , rd_pretty ) ;
2017-10-26 01:49:18 +02:00
SET_FLAG ( bgp_vrf - > vrf_flags , BGP_VRF_RD_CFGD ) ;
/* We have a new RD for VRF.
2017-12-27 20:47:10 +01:00
* Advertise all type - 5 routes again with the new RD
*/
2017-11-03 22:54:20 +01:00
bgp_evpn_handle_vrf_rd_change ( bgp_vrf , 0 ) ;
2017-10-26 01:49:18 +02:00
}
/*
* Unconfigure RD for VRF
*/
static void evpn_unconfigure_vrf_rd ( struct bgp * bgp_vrf )
{
/* If we have already advertise type-5 routes with a diffrent RD, we
2017-12-27 20:47:10 +01:00
* have to delete and withdraw them firs
*/
2017-11-03 22:54:20 +01:00
bgp_evpn_handle_vrf_rd_change ( bgp_vrf , 1 ) ;
2017-10-26 01:49:18 +02:00
/* fall back to default RD */
bgp_evpn_derive_auto_rd_for_vrf ( bgp_vrf ) ;
2018-06-16 06:11:16 +02:00
UNSET_FLAG ( bgp_vrf - > vrf_flags , BGP_VRF_RD_CFGD ) ;
2022-11-22 11:20:51 +01:00
if ( bgp_vrf - > vrf_prd_pretty )
2023-11-15 20:52:10 +01:00
XFREE ( MTYPE_BGP_NAME , bgp_vrf - > vrf_prd_pretty ) ;
2017-10-26 01:49:18 +02:00
/* We have a new RD for VRF.
2017-12-27 20:47:10 +01:00
* Advertise all type - 5 routes again with the new RD
*/
2017-11-03 22:54:20 +01:00
bgp_evpn_handle_vrf_rd_change ( bgp_vrf , 0 ) ;
2017-10-26 01:49:18 +02:00
}
2017-05-16 00:01:57 +02:00
/*
* Configure RD for a VNI ( vty handler )
*/
static void evpn_configure_rd ( struct bgp * bgp , struct bgpevpn * vpn ,
2022-11-22 11:20:51 +01:00
struct prefix_rd * rd , const char * rd_pretty )
2017-05-16 00:01:57 +02:00
{
/* If the VNI is "live", we need to delete and withdraw this VNI's
* local routes with the prior RD first . Then , after updating RD ,
* need to re - advertise .
*/
if ( is_vni_live ( vpn ) )
bgp_evpn_handle_rd_change ( bgp , vpn , 1 ) ;
/* update RD */
memcpy ( & vpn - > prd , rd , sizeof ( struct prefix_rd ) ) ;
2023-11-15 20:52:10 +01:00
vpn - > prd_pretty = XSTRDUP ( MTYPE_BGP_NAME , rd_pretty ) ;
2017-05-16 00:01:57 +02:00
SET_FLAG ( vpn - > flags , VNI_FLAG_RD_CFGD ) ;
if ( is_vni_live ( vpn ) )
bgp_evpn_handle_rd_change ( bgp , vpn , 0 ) ;
}
/*
* Unconfigure RD for a VNI ( vty handler )
*/
static void evpn_unconfigure_rd ( struct bgp * bgp , struct bgpevpn * vpn )
{
/* If the VNI is "live", we need to delete and withdraw this VNI's
* local routes with the prior RD first . Then , after resetting RD
* to automatic value , need to re - advertise .
*/
if ( is_vni_live ( vpn ) )
bgp_evpn_handle_rd_change ( bgp , vpn , 1 ) ;
/* reset RD to default */
bgp_evpn_derive_auto_rd ( bgp , vpn ) ;
if ( is_vni_live ( vpn ) )
bgp_evpn_handle_rd_change ( bgp , vpn , 0 ) ;
}
/*
* Create VNI , if not already present ( VTY handler ) . Mark as configured .
*/
static struct bgpevpn * evpn_create_update_vni ( struct bgp * bgp , vni_t vni )
{
struct bgpevpn * vpn ;
2019-03-19 19:08:24 +01:00
struct in_addr mcast_grp = { INADDR_ANY } ;
2017-05-16 00:01:57 +02:00
vpn = bgp_evpn_lookup_vni ( bgp , vni ) ;
if ( ! vpn ) {
2018-08-01 03:45:39 +02:00
/* Check if this L2VNI is already configured as L3VNI */
if ( bgp_evpn_lookup_l3vni_l2vni_table ( vni ) ) {
2018-09-13 21:38:57 +02:00
flog_err (
EC_BGP_VNI ,
" %u: Failed to create L2VNI %u, it is configured as L3VNI " ,
bgp - > vrf_id , vni ) ;
2018-08-01 03:45:39 +02:00
return NULL ;
}
2017-10-08 05:26:16 +02:00
/* tenant vrf will be updated when we get local_vni_add from
2017-12-27 20:47:10 +01:00
* zebra
*/
2021-01-11 09:14:05 +01:00
vpn = bgp_evpn_new ( bgp , vni , bgp - > router_id , 0 , mcast_grp , 0 ) ;
2017-05-16 00:01:57 +02:00
}
/* Mark as configured. */
SET_FLAG ( vpn - > flags , VNI_FLAG_CFGD ) ;
return vpn ;
}
/*
* Delete VNI . If VNI does not exist in the system ( i . e . , just
* configuration ) , all that is needed is to free it . Otherwise ,
* any parameters configured for the VNI need to be reset ( with
* appropriate action ) and the VNI marked as unconfigured ; the
* VNI will continue to exist , purely as a " learnt " entity .
*/
2020-03-20 10:57:54 +01:00
static void evpn_delete_vni ( struct bgp * bgp , struct bgpevpn * vpn )
2017-05-16 00:01:57 +02:00
{
if ( ! is_vni_live ( vpn ) ) {
bgp_evpn_free ( bgp , vpn ) ;
2020-03-20 10:57:54 +01:00
return ;
2017-05-16 00:01:57 +02:00
}
/* We need to take the unconfigure action for each parameter of this VNI
* that is configured . Some optimization is possible , but not worth the
* additional code for an operation that should be pretty rare .
*/
UNSET_FLAG ( vpn - > flags , VNI_FLAG_CFGD ) ;
/* First, deal with the export side - RD and export RT changes. */
if ( is_rd_configured ( vpn ) )
evpn_unconfigure_rd ( bgp , vpn ) ;
if ( is_export_rt_configured ( vpn ) )
evpn_unconfigure_export_rt ( bgp , vpn , NULL ) ;
/* Next, deal with the import side. */
if ( is_import_rt_configured ( vpn ) )
evpn_unconfigure_import_rt ( bgp , vpn , NULL ) ;
}
2017-10-10 03:12:05 +02:00
/*
* Display import RT mapping to VRFs ( vty handler )
2019-03-06 19:10:02 +01:00
* bgp_evpn : evpn bgp instance
2017-10-10 03:12:05 +02:00
*/
2019-03-06 19:10:02 +01:00
static void evpn_show_vrf_import_rts ( struct vty * vty , struct bgp * bgp_evpn ,
2017-10-10 03:12:05 +02:00
json_object * json )
{
void * args [ 2 ] ;
args [ 0 ] = vty ;
args [ 1 ] = json ;
2019-03-06 19:10:02 +01:00
hash_iterate ( bgp_evpn - > vrf_import_rt_hash ,
2019-02-19 16:46:52 +01:00
( void ( * ) ( struct hash_bucket * ,
2017-10-10 03:12:05 +02:00
void * ) ) show_vrf_import_rt_entry ,
args ) ;
}
2017-05-15 23:53:31 +02:00
/*
* Display import RT mapping to VNIs ( vty handler )
*/
2017-07-21 02:42:20 +02:00
static void evpn_show_import_rts ( struct vty * vty , struct bgp * bgp ,
json_object * json )
2017-05-15 23:53:31 +02:00
{
2017-07-21 02:42:20 +02:00
void * args [ 2 ] ;
args [ 0 ] = vty ;
args [ 1 ] = json ;
2017-05-15 23:53:31 +02:00
hash_iterate (
bgp - > import_rt_hash ,
2019-02-19 16:46:52 +01:00
( void ( * ) ( struct hash_bucket * , void * ) ) show_import_rt_entry ,
2017-07-21 02:42:20 +02:00
args ) ;
2017-05-15 23:53:31 +02:00
}
/*
* Display EVPN routes for all VNIs - vty handler .
*/
2021-10-26 23:55:54 +02:00
static void evpn_show_routes_vni_all ( struct vty * vty , struct bgp * bgp , int type ,
bool mac_table , struct in_addr vtep_ip ,
json_object * json , int detail )
2017-05-15 23:53:31 +02:00
{
2018-03-27 21:13:34 +02:00
uint32_t num_vnis ;
2017-05-15 23:53:31 +02:00
struct vni_walk_ctx wctx ;
num_vnis = hashcount ( bgp - > vnihash ) ;
if ( ! num_vnis )
return ;
2022-05-11 12:16:44 +02:00
memset ( & wctx , 0 , sizeof ( wctx ) ) ;
2017-05-15 23:53:31 +02:00
wctx . bgp = bgp ;
wctx . vty = vty ;
2021-10-26 23:55:54 +02:00
wctx . type = type ;
wctx . mac_table = mac_table ;
2017-05-15 23:53:31 +02:00
wctx . vtep_ip = vtep_ip ;
2017-07-21 02:42:20 +02:00
wctx . json = json ;
2019-03-28 06:49:03 +01:00
wctx . detail = detail ;
2019-02-19 16:46:52 +01:00
hash_iterate ( bgp - > vnihash , ( void ( * ) ( struct hash_bucket * ,
2017-07-22 14:52:33 +02:00
void * ) ) show_vni_routes_hash ,
& wctx ) ;
2017-05-15 23:53:31 +02:00
}
2021-10-26 23:55:54 +02:00
/*
* Display EVPN routes for all VNIs & all types - vty handler .
*/
static void evpn_show_routes_vni_all_type_all ( struct vty * vty , struct bgp * bgp ,
struct in_addr vtep_ip ,
json_object * json , int detail )
{
uint32_t num_vnis ;
struct vni_walk_ctx wctx ;
num_vnis = hashcount ( bgp - > vnihash ) ;
if ( ! num_vnis )
return ;
memset ( & wctx , 0 , sizeof ( struct vni_walk_ctx ) ) ;
wctx . bgp = bgp ;
wctx . vty = vty ;
wctx . vtep_ip = vtep_ip ;
wctx . json = json ;
wctx . detail = detail ;
hash_iterate ( bgp - > vnihash ,
( void ( * ) ( struct hash_bucket * ,
void * ) ) show_vni_routes_all_hash ,
& wctx ) ;
}
2017-05-15 23:53:31 +02:00
/*
* Display EVPN routes for a VNI - - for specific type - 3 route ( vty handler ) .
*/
static void evpn_show_route_vni_multicast ( struct vty * vty , struct bgp * bgp ,
2017-07-21 02:42:20 +02:00
vni_t vni , struct in_addr orig_ip ,
json_object * json )
2017-05-15 23:53:31 +02:00
{
struct bgpevpn * vpn ;
struct prefix_evpn p ;
2020-03-27 00:11:58 +01:00
struct bgp_dest * dest ;
2018-10-03 02:43:07 +02:00
struct bgp_path_info * pi ;
2018-03-27 21:13:34 +02:00
uint32_t path_cnt = 0 ;
2017-05-15 23:53:31 +02:00
afi_t afi ;
safi_t safi ;
2017-07-21 02:42:20 +02:00
json_object * json_paths = NULL ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
afi = AFI_L2VPN ;
safi = SAFI_EVPN ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
/* Locate VNI. */
vpn = bgp_evpn_lookup_vni ( bgp , vni ) ;
if ( ! vpn ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " VNI not found \n " ) ;
2017-05-15 23:53:31 +02:00
return ;
}
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
/* See if route exists. */
build_evpn_type3_prefix ( & p , orig_ip ) ;
2021-10-26 23:55:54 +02:00
dest = bgp_evpn_vni_node_lookup ( vpn , & p , NULL ) ;
2020-03-27 00:11:58 +01:00
if ( ! dest | | ! bgp_dest_has_bgp_path_info_data ( dest ) ) {
2017-07-21 02:42:20 +02:00
if ( ! json )
vty_out ( vty , " %% Network not in table \n " ) ;
2021-06-22 22:14:47 +02:00
if ( dest )
bgp_dest_unlock_node ( dest ) ;
2017-05-15 23:53:31 +02:00
return ;
}
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
if ( json )
json_paths = json_object_new_array ( ) ;
2017-05-15 23:53:31 +02:00
/* Prefix and num paths displayed once per prefix. */
2021-07-23 19:35:14 +02:00
route_vty_out_detail_header ( vty , bgp , dest , bgp_dest_get_prefix ( dest ) ,
2024-03-22 21:04:19 +01:00
NULL , afi , safi , json , false , true ) ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
/* Display each path for this prefix. */
2020-03-27 00:11:58 +01:00
for ( pi = bgp_dest_get_bgp_path_info ( dest ) ; pi ; pi = pi - > next ) {
2017-07-21 02:42:20 +02:00
json_object * json_path = NULL ;
if ( json )
json_path = json_object_new_array ( ) ;
bgpd: Show applied route-map attributes for `neighbor X advertised-routes detail`
If we have a route-map that sets some attributes e.g. community or large-community,
and the route-map is applied for outgoing direction, everything is fine, but
we missed the point that `advertised-routes detail` was not using the applied
attributes to display and instead it uses what is received from the peer (original).
Let's fix this, and use what's already applied (advertise attributes), and
we can now see:
```
route-map r3 permit 10
match ip address prefix-list p1
set community 65001:65002
set extcommunity bandwidth 100
set large-community 65001:65002:65003
exit
!
...
address-family ipv4 unicast
neighbor 192.168.2.3 route-map r3 out
exit-address-family
...
```
The output:
```
r2# show bgp ipv4 neighbors 192.168.2.3 advertised-routes detail
BGP table version is 1, local router ID is 192.168.2.2, vrf id 0
Default local pref 100, local AS 65002
BGP routing table entry for 10.10.10.1/32, version 1
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
192.168.1.1 192.168.2.3
65001
0.0.0.0 from 192.168.1.1 (192.168.1.1)
Origin IGP, valid, external, best (First path received)
Community: 65001:65002
Extended Community: LB:65002:12500000 (100.000 Mbps)
Large Community: 65001:65002:65003
Last update: Thu Dec 19 17:00:40 2024
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-12-19 15:59:47 +01:00
route_vty_out_detail ( vty , bgp , dest , bgp_dest_get_prefix ( dest ) , pi , afi , safi ,
bgpd: Show internal data for BGP routes
Sometimes it's very useful to compare pointers from the gdb (and/or from the
logs) or just do some quick adhoc analysis.
```
donatas# sh ip bgp 1.1.1.0/24 internal
BGP routing table entry for 1.1.1.0/24, version 0
Paths: (1 available, no best path)
Not advertised to any peer
65002
127.0.0.1 (inaccessible, import-check enabled) from 127.0.0.1 (127.0.0.2)
Origin IGP, invalid, external
Last update: Thu Jan 16 16:49:53 2025
net: 0x63f3e6fc2ea0, path: 0x63f3e6fc2f50, pathext: 0x63f3e6faed00, attr: 0x63f3e6e8c550
flags net: 0x0, path: 0x1024, attr: 0x7
donatas#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-16 15:50:14 +01:00
RPKI_NOT_BEING_USED , json_path , NULL , 0 ) ;
2017-07-21 02:42:20 +02:00
if ( json )
json_object_array_add ( json_paths , json_path ) ;
2017-05-15 23:53:31 +02:00
path_cnt + + ;
}
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
if ( json ) {
if ( path_cnt )
json_object_object_add ( json , " paths " , json_paths ) ;
json_object_int_add ( json , " numPaths " , path_cnt ) ;
} else {
vty_out ( vty , " \n Displayed %u paths for requested prefix \n " ,
path_cnt ) ;
}
2021-06-22 22:14:47 +02:00
bgp_dest_unlock_node ( dest ) ;
2017-05-15 23:53:31 +02:00
}
/*
* Display EVPN routes for a VNI - - for specific MAC and / or IP ( vty handler ) .
* By definition , only matching type - 2 route will be displayed .
*/
static void evpn_show_route_vni_macip ( struct vty * vty , struct bgp * bgp ,
vni_t vni , struct ethaddr * mac ,
2017-07-21 02:42:20 +02:00
struct ipaddr * ip , json_object * json )
2017-05-15 23:53:31 +02:00
{
struct bgpevpn * vpn ;
struct prefix_evpn p ;
2021-07-23 19:35:14 +02:00
struct prefix_evpn tmp_p ;
2020-03-27 00:11:58 +01:00
struct bgp_dest * dest ;
2018-10-03 02:43:07 +02:00
struct bgp_path_info * pi ;
2018-03-27 21:13:34 +02:00
uint32_t path_cnt = 0 ;
2017-05-15 23:53:31 +02:00
afi_t afi ;
safi_t safi ;
2017-07-21 02:42:20 +02:00
json_object * json_paths = NULL ;
2021-10-26 23:55:54 +02:00
struct ethaddr empty_mac = { } ;
2022-11-18 14:48:16 +01:00
struct ipaddr empty_ip = { } ;
2021-10-26 23:55:54 +02:00
const struct prefix_evpn * evp ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
afi = AFI_L2VPN ;
safi = SAFI_EVPN ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
/* Locate VNI. */
vpn = bgp_evpn_lookup_vni ( bgp , vni ) ;
if ( ! vpn ) {
2017-07-21 02:42:20 +02:00
if ( ! json )
vty_out ( vty , " VNI not found \n " ) ;
2017-05-15 23:53:31 +02:00
return ;
}
2017-07-17 14:03:14 +02:00
2022-11-18 14:48:16 +01:00
build_evpn_type2_prefix ( & p , mac ? mac : & empty_mac ,
ip ? ip : & empty_ip ) ;
2021-10-26 23:55:54 +02:00
2017-05-15 23:53:31 +02:00
/* See if route exists. Look for both non-sticky and sticky. */
2021-10-26 23:55:54 +02:00
dest = bgp_evpn_vni_node_lookup ( vpn , & p , NULL ) ;
2020-03-27 00:11:58 +01:00
if ( ! dest | | ! bgp_dest_has_bgp_path_info_data ( dest ) ) {
2017-07-21 02:42:20 +02:00
if ( ! json )
vty_out ( vty , " %% Network not in table \n " ) ;
2021-06-22 22:14:47 +02:00
if ( dest )
bgp_dest_unlock_node ( dest ) ;
2017-05-15 23:53:31 +02:00
return ;
}
2017-07-17 14:03:14 +02:00
2021-07-23 19:35:14 +02:00
/*
* MAC is per - path , we have to walk the path_info ' s and look for it
* first here .
*/
2021-10-26 23:55:54 +02:00
if ( ip & & mac ) {
for ( pi = bgp_dest_get_bgp_path_info ( dest ) ; pi ; pi = pi - > next ) {
if ( memcmp ( mac , evpn_type2_path_info_get_mac ( pi ) ,
sizeof ( * mac ) ) = = 0 )
break ;
}
2021-07-23 19:35:14 +02:00
2021-10-26 23:55:54 +02:00
if ( ! pi ) {
if ( ! json )
vty_out ( vty , " %% Network not in table \n " ) ;
return ;
}
2021-07-23 19:35:14 +02:00
}
2017-07-21 02:42:20 +02:00
if ( json )
json_paths = json_object_new_array ( ) ;
2017-05-15 23:53:31 +02:00
/* Prefix and num paths displayed once per prefix. */
2021-07-23 19:35:14 +02:00
route_vty_out_detail_header ( vty , bgp , dest , ( struct prefix * ) & p , NULL ,
2024-03-22 21:04:19 +01:00
afi , safi , json , false , true ) ;
2017-07-17 14:03:14 +02:00
2021-10-26 23:55:54 +02:00
evp = ( const struct prefix_evpn * ) bgp_dest_get_prefix ( dest ) ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
/* Display each path for this prefix. */
2020-03-27 00:11:58 +01:00
for ( pi = bgp_dest_get_bgp_path_info ( dest ) ; pi ; pi = pi - > next ) {
2017-07-21 02:42:20 +02:00
json_object * json_path = NULL ;
2021-07-23 19:35:14 +02:00
/* skip non-matching MACs */
2021-10-26 23:55:54 +02:00
if ( ip & & mac & &
memcmp ( mac , evpn_type2_path_info_get_mac ( pi ) ,
2021-07-23 19:35:14 +02:00
sizeof ( * mac ) ) ! = 0 )
continue ;
2017-07-21 02:42:20 +02:00
if ( json )
json_path = json_object_new_array ( ) ;
2021-07-23 19:35:14 +02:00
/*
* VNI table MAC - IP prefixes don ' t have MAC so
* make sure it ' s set from path info
* here .
*/
2021-10-26 23:55:54 +02:00
if ( is_evpn_prefix_ipaddr_none ( evp ) ) {
/* VNI MAC -> Global */
2023-09-29 08:17:56 +02:00
evpn_type2_prefix_global_copy ( & tmp_p , evp ,
NULL /* mac */ ,
evpn_type2_path_info_get_ip (
pi ) ) ;
2021-10-26 23:55:54 +02:00
} else {
/* VNI IP -> Global */
2023-09-29 08:17:56 +02:00
evpn_type2_prefix_global_copy ( & tmp_p , evp ,
evpn_type2_path_info_get_mac (
pi ) ,
NULL /* ip */ ) ;
2021-10-26 23:55:54 +02:00
}
2021-07-23 19:35:14 +02:00
bgpd: Show applied route-map attributes for `neighbor X advertised-routes detail`
If we have a route-map that sets some attributes e.g. community or large-community,
and the route-map is applied for outgoing direction, everything is fine, but
we missed the point that `advertised-routes detail` was not using the applied
attributes to display and instead it uses what is received from the peer (original).
Let's fix this, and use what's already applied (advertise attributes), and
we can now see:
```
route-map r3 permit 10
match ip address prefix-list p1
set community 65001:65002
set extcommunity bandwidth 100
set large-community 65001:65002:65003
exit
!
...
address-family ipv4 unicast
neighbor 192.168.2.3 route-map r3 out
exit-address-family
...
```
The output:
```
r2# show bgp ipv4 neighbors 192.168.2.3 advertised-routes detail
BGP table version is 1, local router ID is 192.168.2.2, vrf id 0
Default local pref 100, local AS 65002
BGP routing table entry for 10.10.10.1/32, version 1
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
192.168.1.1 192.168.2.3
65001
0.0.0.0 from 192.168.1.1 (192.168.1.1)
Origin IGP, valid, external, best (First path received)
Community: 65001:65002
Extended Community: LB:65002:12500000 (100.000 Mbps)
Large Community: 65001:65002:65003
Last update: Thu Dec 19 17:00:40 2024
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-12-19 15:59:47 +01:00
route_vty_out_detail ( vty , bgp , dest , ( struct prefix * ) & tmp_p , pi , afi , safi ,
bgpd: Show internal data for BGP routes
Sometimes it's very useful to compare pointers from the gdb (and/or from the
logs) or just do some quick adhoc analysis.
```
donatas# sh ip bgp 1.1.1.0/24 internal
BGP routing table entry for 1.1.1.0/24, version 0
Paths: (1 available, no best path)
Not advertised to any peer
65002
127.0.0.1 (inaccessible, import-check enabled) from 127.0.0.1 (127.0.0.2)
Origin IGP, invalid, external
Last update: Thu Jan 16 16:49:53 2025
net: 0x63f3e6fc2ea0, path: 0x63f3e6fc2f50, pathext: 0x63f3e6faed00, attr: 0x63f3e6e8c550
flags net: 0x0, path: 0x1024, attr: 0x7
donatas#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-16 15:50:14 +01:00
RPKI_NOT_BEING_USED , json_path , NULL , 0 ) ;
2017-07-21 02:42:20 +02:00
if ( json )
json_object_array_add ( json_paths , json_path ) ;
2017-05-15 23:53:31 +02:00
path_cnt + + ;
}
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
if ( json ) {
if ( path_cnt )
json_object_object_add ( json , " paths " , json_paths ) ;
json_object_int_add ( json , " numPaths " , path_cnt ) ;
} else {
vty_out ( vty , " \n Displayed %u paths for requested prefix \n " ,
path_cnt ) ;
}
2021-06-22 22:14:47 +02:00
bgp_dest_unlock_node ( dest ) ;
2017-05-15 23:53:31 +02:00
}
2018-04-14 00:01:12 +02:00
/* Disaplay EVPN routes for a ESI - VTY handler */
static void evpn_show_routes_esi ( struct vty * vty , struct bgp * bgp ,
esi_t * esi , json_object * json )
{
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
struct bgp_evpn_es * es = NULL ;
2018-04-14 00:01:12 +02:00
/* locate the ES */
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
es = bgp_evpn_es_find ( esi ) ;
2018-04-14 00:01:12 +02:00
if ( ! es ) {
if ( ! json )
vty_out ( vty , " ESI not found \n " ) ;
return ;
}
show_esi_routes ( bgp , es , vty , json ) ;
}
2017-05-15 23:53:31 +02:00
/*
* Display EVPN routes for a VNI - vty handler .
* If ' type ' is non - zero , only routes matching that type are shown .
* If the vtep_ip is non zero , only routes behind that vtep are shown
*/
static void evpn_show_routes_vni ( struct vty * vty , struct bgp * bgp , vni_t vni ,
2021-10-26 23:55:54 +02:00
int type , bool mac_table ,
struct in_addr vtep_ip , json_object * json )
2017-05-15 23:53:31 +02:00
{
struct bgpevpn * vpn ;
/* Locate VNI. */
vpn = bgp_evpn_lookup_vni ( bgp , vni ) ;
if ( ! vpn ) {
2017-07-21 02:42:20 +02:00
if ( ! json )
vty_out ( vty , " VNI not found \n " ) ;
2017-05-15 23:53:31 +02:00
return ;
}
/* Walk this VNI's route table and display appropriate routes. */
2021-10-26 23:55:54 +02:00
show_vni_routes ( bgp , vpn , vty , type , mac_table , vtep_ip , json , 0 ) ;
2017-05-15 23:53:31 +02:00
}
/*
* Display BGP EVPN routing table - - for specific RD and MAC and / or
* IP ( vty handler ) . By definition , only matching type - 2 route will be
* displayed .
*/
static void evpn_show_route_rd_macip ( struct vty * vty , struct bgp * bgp ,
struct prefix_rd * prd , struct ethaddr * mac ,
2017-07-21 02:42:20 +02:00
struct ipaddr * ip , json_object * json )
2017-05-15 23:53:31 +02:00
{
struct prefix_evpn p ;
2020-03-27 00:11:58 +01:00
struct bgp_dest * dest ;
2018-10-03 02:43:07 +02:00
struct bgp_path_info * pi ;
2017-05-15 23:53:31 +02:00
afi_t afi ;
safi_t safi ;
2018-03-27 21:13:34 +02:00
uint32_t path_cnt = 0 ;
2017-07-21 02:42:20 +02:00
json_object * json_paths = NULL ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
afi = AFI_L2VPN ;
safi = SAFI_EVPN ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
/* See if route exists. Look for both non-sticky and sticky. */
build_evpn_type2_prefix ( & p , mac , ip ) ;
2023-03-14 11:01:56 +01:00
dest = bgp_safi_node_lookup ( bgp - > rib [ afi ] [ safi ] , safi ,
( struct prefix * ) & p , prd ) ;
2020-03-27 00:11:58 +01:00
if ( ! dest | | ! bgp_dest_has_bgp_path_info_data ( dest ) ) {
2017-07-21 02:42:20 +02:00
if ( ! json )
vty_out ( vty , " %% Network not in table \n " ) ;
2021-06-22 22:14:47 +02:00
if ( dest )
bgp_dest_unlock_node ( dest ) ;
2017-05-15 23:53:31 +02:00
return ;
}
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
/* Prefix and num paths displayed once per prefix. */
2021-07-23 19:35:14 +02:00
route_vty_out_detail_header ( vty , bgp , dest , bgp_dest_get_prefix ( dest ) ,
2024-03-22 21:04:19 +01:00
prd , afi , safi , json , false , false ) ;
2017-07-21 02:42:20 +02:00
if ( json )
json_paths = json_object_new_array ( ) ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
/* Display each path for this prefix. */
2020-03-27 00:11:58 +01:00
for ( pi = bgp_dest_get_bgp_path_info ( dest ) ; pi ; pi = pi - > next ) {
2017-07-21 02:42:20 +02:00
json_object * json_path = NULL ;
if ( json )
json_path = json_object_new_array ( ) ;
bgpd: Show applied route-map attributes for `neighbor X advertised-routes detail`
If we have a route-map that sets some attributes e.g. community or large-community,
and the route-map is applied for outgoing direction, everything is fine, but
we missed the point that `advertised-routes detail` was not using the applied
attributes to display and instead it uses what is received from the peer (original).
Let's fix this, and use what's already applied (advertise attributes), and
we can now see:
```
route-map r3 permit 10
match ip address prefix-list p1
set community 65001:65002
set extcommunity bandwidth 100
set large-community 65001:65002:65003
exit
!
...
address-family ipv4 unicast
neighbor 192.168.2.3 route-map r3 out
exit-address-family
...
```
The output:
```
r2# show bgp ipv4 neighbors 192.168.2.3 advertised-routes detail
BGP table version is 1, local router ID is 192.168.2.2, vrf id 0
Default local pref 100, local AS 65002
BGP routing table entry for 10.10.10.1/32, version 1
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
192.168.1.1 192.168.2.3
65001
0.0.0.0 from 192.168.1.1 (192.168.1.1)
Origin IGP, valid, external, best (First path received)
Community: 65001:65002
Extended Community: LB:65002:12500000 (100.000 Mbps)
Large Community: 65001:65002:65003
Last update: Thu Dec 19 17:00:40 2024
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-12-19 15:59:47 +01:00
route_vty_out_detail ( vty , bgp , dest , bgp_dest_get_prefix ( dest ) , pi , afi , safi ,
bgpd: Show internal data for BGP routes
Sometimes it's very useful to compare pointers from the gdb (and/or from the
logs) or just do some quick adhoc analysis.
```
donatas# sh ip bgp 1.1.1.0/24 internal
BGP routing table entry for 1.1.1.0/24, version 0
Paths: (1 available, no best path)
Not advertised to any peer
65002
127.0.0.1 (inaccessible, import-check enabled) from 127.0.0.1 (127.0.0.2)
Origin IGP, invalid, external
Last update: Thu Jan 16 16:49:53 2025
net: 0x63f3e6fc2ea0, path: 0x63f3e6fc2f50, pathext: 0x63f3e6faed00, attr: 0x63f3e6e8c550
flags net: 0x0, path: 0x1024, attr: 0x7
donatas#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-16 15:50:14 +01:00
RPKI_NOT_BEING_USED , json_path , NULL , 0 ) ;
2017-07-21 02:42:20 +02:00
if ( json )
json_object_array_add ( json_paths , json_path ) ;
2017-05-15 23:53:31 +02:00
path_cnt + + ;
}
2017-07-17 14:03:14 +02:00
bgpd: EVPN fix per rd specific type-2 json output
Current Issue:
paths key is not there for
'show bgp l2vpn evpn route rd <rd-id> mac <mac> json' uses
evpn prefix as key for each path.
Replace the evpn prefix with "paths".
This aligned with overall EVPN RIB json output like
'show bgp l2vpn evpn route json'
'show bgp l2vpn evpn route rd <> type 2 json'
Fix:
paths key is added instead of prefix info.
Ticket:#4087461
Issue:4087461
Testing:
Before fix:
leaf22# show bgp l2vpn evpn route rd 6.0.0.17:2 mac 00:02:00:00:00:12 json
{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:12]",
"prefixLen":352,
"rd":"6.0.0.17:2",
"routeType":2,
"ethTag":0,
"macLen":48,
"mac":"00:02:00:00:00:12",
"advertisedTo":{
"220.20.0.33":{
"hostname":"spine21"
},
"220.21.0.33":{
"hostname":"spine22"
}
},
"[2]:[0]:[48]:[00:02:00:00:00:12]":[ <===== Prefix info instead of "paths" key
[
{
"vni":"101101",
"aspath":{
"string":"65202 65024",
"segments":[
{
"type":"as-sequence",
"list":[
65202,
65024
]
}
],
"length":2
},
"esi":"03:00:00:00:77:02:04:00:00:18",
"es_info":{
"localEs":true
},
"origin":"IGP",
"valid":true,
"version":5,
"bestpath":{
"bestpathFromAs":65202,
"overall":true,
"selectionReason":"Older Path"
},
"extendedCommunity":{
"string":"RT:65024:101101 ET:8"
},
"lastUpdate":{
"epoch":1726803218,
"string":"Fri Sep 20 03:33:38 2024\n"
},
"nexthops":[
{
"ip":"6.0.0.17",
"hostname":"spine21",
"afi":"ipv4",
"metric":0,
"accessible":true,
"used":true
}
],
"peer":{
"peerId":"220.20.0.33",
"routerId":"6.0.0.20",
"hostname":"spine21",
"type":"external"
}
}
],
[
{
"vni":"101101",
"aspath":{
"string":"65202 65024",
"segments":[
{
"type":"as-sequence",
"list":[
65202,
65024
]
}
],
"length":2
},
"esi":"03:00:00:00:77:02:04:00:00:18",
"es_info":{
"localEs":true
},
"origin":"IGP",
"valid":true,
"version":5,
"extendedCommunity":{
"string":"RT:65024:101101 ET:8"
},
"lastUpdate":{
"epoch":1726803218,
"string":"Fri Sep 20 03:33:38 2024\n"
},
"nexthops":[
{
"ip":"6.0.0.17",
"hostname":"spine22",
"afi":"ipv4",
"metric":0,
"accessible":true,
"used":true
}
],
"peer":{
"peerId":"220.21.0.33",
"routerId":"6.0.0.21",
"hostname":"spine22",
"type":"external"
}
}
]
],
"numPaths":2
}
After fix:
eaf22# show bgp l2vpn evpn route rd 6.0.0.17:2 mac 00:02:00:00:00:12 json
{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:12]",
"prefixLen":352,
"rd":"6.0.0.17:2",
"routeType":2,
"ethTag":0,
"macLen":48,
"mac":"00:02:00:00:00:12",
"advertisedTo":{
"220.20.0.33":{
"hostname":"spine21"
},
"220.21.0.33":{
"hostname":"spine22"
}
},
"paths":[
[
{
"vni":"101101",
"aspath":{
"string":"65202 65024",
"segments":[
{
"type":"as-sequence",
"list":[
65202,
65024
]
}
],
"length":2
},
"esi":"03:00:00:00:77:02:04:00:00:18",
"es_info":{
"localEs":true
},
"origin":"IGP",
"valid":true,
"version":3,
"bestpath":{
"bestpathFromAs":65202,
"overall":true,
"selectionReason":"Router ID"
},
"extendedCommunity":{
"string":"RT:65024:101101 ET:8"
},
"lastUpdate":{
"epoch":1727175046,
"string":"Tue Sep 24 10:50:46 2024\n"
},
"nexthops":[
{
"ip":"6.0.0.17",
"hostname":"spine21",
"afi":"ipv4",
"metric":0,
"accessible":true,
"used":true
}
],
"peer":{
"peerId":"220.20.0.33",
"routerId":"6.0.0.20",
"hostname":"spine21",
"type":"external"
}
}
],
[
{
"vni":"101101",
"aspath":{
"string":"65202 65024",
"segments":[
{
"type":"as-sequence",
"list":[
65202,
65024
]
}
],
"length":2
},
"esi":"03:00:00:00:77:02:04:00:00:18",
"es_info":{
"localEs":true
},
"origin":"IGP",
"valid":true,
"version":3,
"extendedCommunity":{
"string":"RT:65024:101101 ET:8"
},
"lastUpdate":{
"epoch":1727175046,
"string":"Tue Sep 24 10:50:46 2024\n"
},
"nexthops":[
{
"ip":"6.0.0.17",
"hostname":"spine22",
"afi":"ipv4",
"metric":0,
"accessible":true,
"used":true
}
],
"peer":{
"peerId":"220.21.0.33",
"routerId":"6.0.0.21",
"hostname":"spine22",
"type":"external"
}
}
]
],
"numPaths":2
}
Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
2024-09-24 19:55:09 +02:00
if ( json ) {
2017-07-21 02:42:20 +02:00
if ( path_cnt )
bgpd: EVPN fix per rd specific type-2 json output
Current Issue:
paths key is not there for
'show bgp l2vpn evpn route rd <rd-id> mac <mac> json' uses
evpn prefix as key for each path.
Replace the evpn prefix with "paths".
This aligned with overall EVPN RIB json output like
'show bgp l2vpn evpn route json'
'show bgp l2vpn evpn route rd <> type 2 json'
Fix:
paths key is added instead of prefix info.
Ticket:#4087461
Issue:4087461
Testing:
Before fix:
leaf22# show bgp l2vpn evpn route rd 6.0.0.17:2 mac 00:02:00:00:00:12 json
{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:12]",
"prefixLen":352,
"rd":"6.0.0.17:2",
"routeType":2,
"ethTag":0,
"macLen":48,
"mac":"00:02:00:00:00:12",
"advertisedTo":{
"220.20.0.33":{
"hostname":"spine21"
},
"220.21.0.33":{
"hostname":"spine22"
}
},
"[2]:[0]:[48]:[00:02:00:00:00:12]":[ <===== Prefix info instead of "paths" key
[
{
"vni":"101101",
"aspath":{
"string":"65202 65024",
"segments":[
{
"type":"as-sequence",
"list":[
65202,
65024
]
}
],
"length":2
},
"esi":"03:00:00:00:77:02:04:00:00:18",
"es_info":{
"localEs":true
},
"origin":"IGP",
"valid":true,
"version":5,
"bestpath":{
"bestpathFromAs":65202,
"overall":true,
"selectionReason":"Older Path"
},
"extendedCommunity":{
"string":"RT:65024:101101 ET:8"
},
"lastUpdate":{
"epoch":1726803218,
"string":"Fri Sep 20 03:33:38 2024\n"
},
"nexthops":[
{
"ip":"6.0.0.17",
"hostname":"spine21",
"afi":"ipv4",
"metric":0,
"accessible":true,
"used":true
}
],
"peer":{
"peerId":"220.20.0.33",
"routerId":"6.0.0.20",
"hostname":"spine21",
"type":"external"
}
}
],
[
{
"vni":"101101",
"aspath":{
"string":"65202 65024",
"segments":[
{
"type":"as-sequence",
"list":[
65202,
65024
]
}
],
"length":2
},
"esi":"03:00:00:00:77:02:04:00:00:18",
"es_info":{
"localEs":true
},
"origin":"IGP",
"valid":true,
"version":5,
"extendedCommunity":{
"string":"RT:65024:101101 ET:8"
},
"lastUpdate":{
"epoch":1726803218,
"string":"Fri Sep 20 03:33:38 2024\n"
},
"nexthops":[
{
"ip":"6.0.0.17",
"hostname":"spine22",
"afi":"ipv4",
"metric":0,
"accessible":true,
"used":true
}
],
"peer":{
"peerId":"220.21.0.33",
"routerId":"6.0.0.21",
"hostname":"spine22",
"type":"external"
}
}
]
],
"numPaths":2
}
After fix:
eaf22# show bgp l2vpn evpn route rd 6.0.0.17:2 mac 00:02:00:00:00:12 json
{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:12]",
"prefixLen":352,
"rd":"6.0.0.17:2",
"routeType":2,
"ethTag":0,
"macLen":48,
"mac":"00:02:00:00:00:12",
"advertisedTo":{
"220.20.0.33":{
"hostname":"spine21"
},
"220.21.0.33":{
"hostname":"spine22"
}
},
"paths":[
[
{
"vni":"101101",
"aspath":{
"string":"65202 65024",
"segments":[
{
"type":"as-sequence",
"list":[
65202,
65024
]
}
],
"length":2
},
"esi":"03:00:00:00:77:02:04:00:00:18",
"es_info":{
"localEs":true
},
"origin":"IGP",
"valid":true,
"version":3,
"bestpath":{
"bestpathFromAs":65202,
"overall":true,
"selectionReason":"Router ID"
},
"extendedCommunity":{
"string":"RT:65024:101101 ET:8"
},
"lastUpdate":{
"epoch":1727175046,
"string":"Tue Sep 24 10:50:46 2024\n"
},
"nexthops":[
{
"ip":"6.0.0.17",
"hostname":"spine21",
"afi":"ipv4",
"metric":0,
"accessible":true,
"used":true
}
],
"peer":{
"peerId":"220.20.0.33",
"routerId":"6.0.0.20",
"hostname":"spine21",
"type":"external"
}
}
],
[
{
"vni":"101101",
"aspath":{
"string":"65202 65024",
"segments":[
{
"type":"as-sequence",
"list":[
65202,
65024
]
}
],
"length":2
},
"esi":"03:00:00:00:77:02:04:00:00:18",
"es_info":{
"localEs":true
},
"origin":"IGP",
"valid":true,
"version":3,
"extendedCommunity":{
"string":"RT:65024:101101 ET:8"
},
"lastUpdate":{
"epoch":1727175046,
"string":"Tue Sep 24 10:50:46 2024\n"
},
"nexthops":[
{
"ip":"6.0.0.17",
"hostname":"spine22",
"afi":"ipv4",
"metric":0,
"accessible":true,
"used":true
}
],
"peer":{
"peerId":"220.21.0.33",
"routerId":"6.0.0.21",
"hostname":"spine22",
"type":"external"
}
}
]
],
"numPaths":2
}
Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
2024-09-24 19:55:09 +02:00
json_object_object_add ( json , " paths " , json_paths ) ;
2017-07-21 02:42:20 +02:00
json_object_int_add ( json , " numPaths " , path_cnt ) ;
} else {
vty_out ( vty , " \n Displayed %u paths for requested prefix \n " ,
path_cnt ) ;
}
2021-06-22 22:14:47 +02:00
bgp_dest_unlock_node ( dest ) ;
2017-05-15 23:53:31 +02:00
}
/*
* Display BGP EVPN routing table - - for specific RD ( vty handler )
* If ' type ' is non - zero , only routes matching that type are shown .
*/
static void evpn_show_route_rd ( struct vty * vty , struct bgp * bgp ,
2017-07-21 02:42:20 +02:00
struct prefix_rd * prd , int type ,
json_object * json )
2017-05-15 23:53:31 +02:00
{
2020-03-27 00:11:58 +01:00
struct bgp_dest * rd_dest ;
2017-05-15 23:53:31 +02:00
struct bgp_table * table ;
2020-03-27 00:11:58 +01:00
struct bgp_dest * dest ;
2018-10-03 02:43:07 +02:00
struct bgp_path_info * pi ;
2017-05-15 23:53:31 +02:00
int rd_header = 1 ;
afi_t afi ;
safi_t safi ;
2018-03-27 21:13:34 +02:00
uint32_t prefix_cnt , path_cnt ;
2017-07-21 02:42:20 +02:00
json_object * json_rd = NULL ;
int add_rd_to_json = 0 ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
afi = AFI_L2VPN ;
safi = SAFI_EVPN ;
prefix_cnt = path_cnt = 0 ;
2017-07-17 14:03:14 +02:00
2020-03-27 00:11:58 +01:00
rd_dest = bgp_node_lookup ( bgp - > rib [ afi ] [ safi ] , ( struct prefix * ) prd ) ;
if ( ! rd_dest )
2017-05-15 23:53:31 +02:00
return ;
2017-07-21 02:42:20 +02:00
2020-03-27 00:11:58 +01:00
table = bgp_dest_get_bgp_table_info ( rd_dest ) ;
2021-06-22 22:14:47 +02:00
if ( table = = NULL ) {
bgp_dest_unlock_node ( rd_dest ) ;
2017-05-15 23:53:31 +02:00
return ;
2021-06-22 22:14:47 +02:00
}
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
if ( json ) {
json_rd = json_object_new_object ( ) ;
2022-11-22 09:57:10 +01:00
json_object_string_addf ( json_rd , " rd " ,
BGP_RD_AS_FORMAT ( bgp - > asnotation ) , prd ) ;
2017-07-21 02:42:20 +02:00
}
2021-06-22 22:14:47 +02:00
bgp_dest_unlock_node ( rd_dest ) ;
2017-05-15 23:53:31 +02:00
/* Display all prefixes with this RD. */
2020-03-27 00:11:58 +01:00
for ( dest = bgp_table_top ( table ) ; dest ; dest = bgp_route_next ( dest ) ) {
2020-03-22 05:02:18 +01:00
const struct prefix_evpn * evp =
2020-03-27 00:11:58 +01:00
( const struct prefix_evpn * ) bgp_dest_get_prefix ( dest ) ;
2017-07-21 02:42:20 +02:00
json_object * json_prefix = NULL ;
json_object * json_paths = NULL ;
int add_prefix_to_json = 0 ;
2017-05-15 23:53:31 +02:00
if ( type & & evp - > prefix . route_type ! = type )
continue ;
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
if ( json )
json_prefix = json_object_new_object ( ) ;
2020-03-27 00:11:58 +01:00
pi = bgp_dest_get_bgp_path_info ( dest ) ;
2018-07-30 17:40:02 +02:00
if ( pi ) {
2017-05-15 23:53:31 +02:00
/* RD header and legend - once overall. */
2017-07-21 02:42:20 +02:00
if ( rd_header & & ! json ) {
bgpd: add missing type-1 and type-4 route descriptions to the legend
Sample output -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root@torm-11:mgmt:~# net show bgp l2vpn evpn route rd 27.0.0.16:3
EVPN type-1 prefix: [1]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
BGP routing table entry for 27.0.0.16:3:[1]:[0]:[03:44:38:39:ff:ff:01:00:00:01]:[32]:[0.0.0.0]
Paths: (4 available, best #2)
Advertised to non peer-group peers:
spine-1(swp1) spine-1(swp2) spine-2(swp3) spine-2(swp4)
4435 5551
27.0.0.16 from spine-1(swp2) (27.0.0.13)
Origin IGP, valid, external
Extended Community: RT:5551:1009 ET:8
Last update: Thu Sep 3 21:01:53 2020
4435 5551
27.0.0.16 from spine-1(swp1) (27.0.0.13)
Origin IGP, valid, external, bestpath-from-AS 4435, best (Router ID)
Extended Community: RT:5551:1009 ET:8
Last update: Thu Sep 3 21:01:53 2020
4435 5551
27.0.0.16 from spine-2(swp3) (27.0.0.14)
Origin IGP, valid, external
Extended Community: RT:5551:1009 ET:8
Last update: Thu Sep 3 21:01:53 2020
4435 5551
27.0.0.16 from spine-2(swp4) (27.0.0.14)
Origin IGP, valid, external
Extended Community: RT:5551:1009 ET:8
Last update: Thu Sep 3 21:01:53 2020
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2020-09-03 22:35:19 +02:00
vty_out ( vty ,
lib, bgpd: changes for EAD-per-ES fragmentation
The EAD-per-ES route carries ECs for all the ES-EVI RTs. As the number of VNIs
increase all RTs do not fit into a standard BGP UPDATE (4K) so the route needs
to be fragmented.
Each fragment is associated with a separate RD and frag-id -
1. Local ES-per-EAD -
ES route table - {ES-frag-ID, ESI, ET=0xffffffff, VTEP-IP}
global route table - {RD-=ES-frag-RD, ESI, ET=0xffffffff}
2. Remote ES-per-EAD -
VNI route table - {ESI, ET=0xffffffff, VTEP-IP}
global route table - {RD-=ES-frag-RD, ESI, ET=0xffffffff}
Note: The fragment ID is abandoned in the per-VNI routing table. At this
point that is acceptable as we dont expect more than one-ES-per-EAD fragment
to be imported into the per-VNI routing table. But that may need to be
re-worked at a later point.
CLI changes (sample with 4 VNIs per-fragment for experimental pruposes) -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root@torm-11:mgmt:~# vtysh -c "show bgp l2vpn evpn es 03:44:38:39:ff:ff:01:00:00:01"
ESI: 03:44:38:39:ff:ff:01:00:00:01
Type: LR
RD: 27.0.0.21:3
Originator-IP: 27.0.0.21
Local ES DF preference: 50000
VNI Count: 10
Remote VNI Count: 10
VRF Count: 3
MACIP EVI Path Count: 33
MACIP Global Path Count: 198
Inconsistent VNI VTEP Count: 0
Inconsistencies: -
Fragments: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
27.0.0.21:3 EVIs: 4
27.0.0.21:13 EVIs: 4
27.0.0.21:22 EVIs: 2
VTEPs:
27.0.0.22 flags: EA df_alg: preference df_pref: 32767
27.0.0.23 flags: EA df_alg: preference df_pref: 32767
root@torm-11:mgmt:~# vtysh -c "show bgp l2vpn evpn es-evi vni 1002 detail"
VNI: 1002 ESI: 03:44:38:39:ff:ff:01:00:00:01
Type: LR
ES fragment RD: 27.0.0.21:13 >>>>>>>>>>>>>>>>>>>>>>>>>
Inconsistencies: -
VTEPs: 27.0.0.22(EV),27.0.0.23(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
PS: The number of EVIs per-fragment has been set to 128 and may need further
tuning.
Ticket: #2632967
Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2021-06-04 02:28:43 +02:00
" EVPN type-1 prefix: [1]:[EthTag]:[ESI]:[IPlen]:[VTEP-IP]:[Frag-id] \n " ) ;
2017-05-15 23:53:31 +02:00
vty_out ( vty ,
2018-04-06 15:52:48 +02:00
" EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC] \n " ) ;
2017-05-15 23:53:31 +02:00
vty_out ( vty ,
2017-10-27 23:15:45 +02:00
" EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP] \n " ) ;
bgpd: add missing type-1 and type-4 route descriptions to the legend
Sample output -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root@torm-11:mgmt:~# net show bgp l2vpn evpn route rd 27.0.0.16:3
EVPN type-1 prefix: [1]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
BGP routing table entry for 27.0.0.16:3:[1]:[0]:[03:44:38:39:ff:ff:01:00:00:01]:[32]:[0.0.0.0]
Paths: (4 available, best #2)
Advertised to non peer-group peers:
spine-1(swp1) spine-1(swp2) spine-2(swp3) spine-2(swp4)
4435 5551
27.0.0.16 from spine-1(swp2) (27.0.0.13)
Origin IGP, valid, external
Extended Community: RT:5551:1009 ET:8
Last update: Thu Sep 3 21:01:53 2020
4435 5551
27.0.0.16 from spine-1(swp1) (27.0.0.13)
Origin IGP, valid, external, bestpath-from-AS 4435, best (Router ID)
Extended Community: RT:5551:1009 ET:8
Last update: Thu Sep 3 21:01:53 2020
4435 5551
27.0.0.16 from spine-2(swp3) (27.0.0.14)
Origin IGP, valid, external
Extended Community: RT:5551:1009 ET:8
Last update: Thu Sep 3 21:01:53 2020
4435 5551
27.0.0.16 from spine-2(swp4) (27.0.0.14)
Origin IGP, valid, external
Extended Community: RT:5551:1009 ET:8
Last update: Thu Sep 3 21:01:53 2020
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2020-09-03 22:35:19 +02:00
vty_out ( vty ,
" EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP] \n " ) ;
2017-10-27 23:15:45 +02:00
vty_out ( vty ,
2018-04-06 15:52:48 +02:00
" EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP] \n \n " ) ;
2017-05-15 23:53:31 +02:00
rd_header = 0 ;
}
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
/* Prefix and num paths displayed once per prefix. */
2024-03-22 21:04:19 +01:00
route_vty_out_detail_header ( vty , bgp , dest ,
bgp_dest_get_prefix ( dest ) ,
prd , afi , safi , json_prefix ,
false , false ) ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
prefix_cnt + + ;
}
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
if ( json )
json_paths = json_object_new_array ( ) ;
2017-05-15 23:53:31 +02:00
/* Display each path for this prefix. */
2018-07-30 17:40:02 +02:00
for ( ; pi ; pi = pi - > next ) {
2017-07-21 02:42:20 +02:00
json_object * json_path = NULL ;
if ( json )
json_path = json_object_new_array ( ) ;
bgpd: Show applied route-map attributes for `neighbor X advertised-routes detail`
If we have a route-map that sets some attributes e.g. community or large-community,
and the route-map is applied for outgoing direction, everything is fine, but
we missed the point that `advertised-routes detail` was not using the applied
attributes to display and instead it uses what is received from the peer (original).
Let's fix this, and use what's already applied (advertise attributes), and
we can now see:
```
route-map r3 permit 10
match ip address prefix-list p1
set community 65001:65002
set extcommunity bandwidth 100
set large-community 65001:65002:65003
exit
!
...
address-family ipv4 unicast
neighbor 192.168.2.3 route-map r3 out
exit-address-family
...
```
The output:
```
r2# show bgp ipv4 neighbors 192.168.2.3 advertised-routes detail
BGP table version is 1, local router ID is 192.168.2.2, vrf id 0
Default local pref 100, local AS 65002
BGP routing table entry for 10.10.10.1/32, version 1
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
192.168.1.1 192.168.2.3
65001
0.0.0.0 from 192.168.1.1 (192.168.1.1)
Origin IGP, valid, external, best (First path received)
Community: 65001:65002
Extended Community: LB:65002:12500000 (100.000 Mbps)
Large Community: 65001:65002:65003
Last update: Thu Dec 19 17:00:40 2024
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-12-19 15:59:47 +01:00
route_vty_out_detail ( vty , bgp , dest , bgp_dest_get_prefix ( dest ) , pi , afi ,
bgpd: Show internal data for BGP routes
Sometimes it's very useful to compare pointers from the gdb (and/or from the
logs) or just do some quick adhoc analysis.
```
donatas# sh ip bgp 1.1.1.0/24 internal
BGP routing table entry for 1.1.1.0/24, version 0
Paths: (1 available, no best path)
Not advertised to any peer
65002
127.0.0.1 (inaccessible, import-check enabled) from 127.0.0.1 (127.0.0.2)
Origin IGP, invalid, external
Last update: Thu Jan 16 16:49:53 2025
net: 0x63f3e6fc2ea0, path: 0x63f3e6fc2f50, pathext: 0x63f3e6faed00, attr: 0x63f3e6e8c550
flags net: 0x0, path: 0x1024, attr: 0x7
donatas#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-16 15:50:14 +01:00
safi , RPKI_NOT_BEING_USED , json_path , NULL , 0 ) ;
2017-07-21 02:42:20 +02:00
if ( json )
json_object_array_add ( json_paths , json_path ) ;
2017-05-15 23:53:31 +02:00
path_cnt + + ;
2017-07-21 02:42:20 +02:00
add_prefix_to_json = 1 ;
add_rd_to_json = 1 ;
}
2020-01-22 21:22:27 +01:00
if ( json ) {
if ( add_prefix_to_json ) {
json_object_object_add ( json_prefix , " paths " ,
json_paths ) ;
2022-08-25 12:46:58 +02:00
json_object_object_addf ( json_rd , json_prefix ,
" %pFX " , evp ) ;
2020-01-22 21:22:27 +01:00
} else {
json_object_free ( json_paths ) ;
json_object_free ( json_prefix ) ;
json_paths = NULL ;
json_prefix = NULL ;
}
2017-07-17 14:03:14 +02:00
}
2017-05-15 23:53:31 +02:00
}
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
if ( json ) {
2020-01-22 21:22:27 +01:00
if ( add_rd_to_json )
2022-11-22 09:57:10 +01:00
json_object_object_addf (
json , json_rd ,
BGP_RD_AS_FORMAT ( bgp - > asnotation ) , prd ) ;
2020-01-22 21:22:27 +01:00
else {
json_object_free ( json_rd ) ;
json_rd = NULL ;
}
2017-07-21 02:42:20 +02:00
json_object_int_add ( json , " numPrefix " , prefix_cnt ) ;
json_object_int_add ( json , " numPaths " , path_cnt ) ;
} else {
if ( prefix_cnt = = 0 )
vty_out ( vty , " No prefixes exist with this RD%s \n " ,
type ? " (of requested type) " : " " ) ;
else
vty_out ( vty ,
" \n Displayed %u prefixes (%u paths) with this RD%s \n " ,
prefix_cnt , path_cnt ,
type ? " (of requested type) " : " " ) ;
}
2017-05-15 23:53:31 +02:00
}
2021-03-09 05:28:04 +01:00
/*
* Display BGP EVPN routing table - - all RDs and MAC and / or IP
* ( vty handler ) . Only matching type - 2 routes will be displayed .
*/
static void evpn_show_route_rd_all_macip ( struct vty * vty , struct bgp * bgp ,
struct ethaddr * mac , struct ipaddr * ip ,
json_object * json )
{
struct bgp_dest * rd_dest ;
struct bgp_table * table ;
struct bgp_dest * dest ;
struct bgp_path_info * pi ;
afi_t afi = AFI_L2VPN ;
safi_t safi = SAFI_EVPN ;
uint32_t prefix_cnt , path_cnt ;
prefix_cnt = path_cnt = 0 ;
/* EVPN routing table is a 2-level table with the first level being
* the RD . We need to look in every RD we know about .
*/
for ( rd_dest = bgp_table_top ( bgp - > rib [ afi ] [ safi ] ) ; rd_dest ;
rd_dest = bgp_route_next ( rd_dest ) ) {
json_object * json_paths = NULL ; /* paths array for prefix */
json_object * json_prefix = NULL ; /* prefix within an RD */
json_object * json_rd = NULL ; /* holds all prefixes for RD */
char rd_str [ RD_ADDRSTRLEN ] ;
int add_rd_to_json = 0 ;
struct prefix_evpn ep ;
const struct prefix * rd_destp = bgp_dest_get_prefix ( rd_dest ) ;
table = bgp_dest_get_bgp_table_info ( rd_dest ) ;
if ( table = = NULL )
continue ;
prefix_rd2str ( ( struct prefix_rd * ) rd_destp , rd_str ,
2022-11-22 09:57:10 +01:00
sizeof ( rd_str ) , bgp - > asnotation ) ;
2021-03-09 05:28:04 +01:00
/* Construct an RT-2 from the user-supplied mac(ip),
* then search the l2vpn evpn table for it .
*/
build_evpn_type2_prefix ( & ep , mac , ip ) ;
2023-03-14 11:01:56 +01:00
dest = bgp_safi_node_lookup ( bgp - > rib [ afi ] [ safi ] , safi ,
( struct prefix * ) & ep ,
( struct prefix_rd * ) rd_destp ) ;
2021-03-09 05:28:04 +01:00
if ( ! dest )
continue ;
if ( json )
json_rd = json_object_new_object ( ) ;
const struct prefix * p = bgp_dest_get_prefix ( dest ) ;
pi = bgp_dest_get_bgp_path_info ( dest ) ;
if ( pi ) {
/* RD header - per RD. */
bgp_evpn_show_route_rd_header ( vty , rd_dest , json_rd ,
rd_str , RD_ADDRSTRLEN ) ;
prefix_cnt + + ;
}
if ( json ) {
json_prefix = json_object_new_object ( ) ;
json_paths = json_object_new_array ( ) ;
2022-08-25 12:46:58 +02:00
json_object_string_addf ( json_prefix , " prefix " , " %pFX " ,
p ) ;
2021-03-09 05:28:04 +01:00
json_object_int_add ( json_prefix , " prefixLen " ,
p - > prefixlen ) ;
} else
/* Prefix and num paths displayed once per prefix. */
2024-03-22 21:04:19 +01:00
route_vty_out_detail_header ( vty , bgp , dest , p ,
( struct prefix_rd * ) rd_destp ,
AFI_L2VPN , SAFI_EVPN ,
json_prefix , false , false ) ;
2021-03-09 05:28:04 +01:00
/* For EVPN, the prefix is displayed for each path (to
* fit in with code that already exists ) .
*/
for ( ; pi ; pi = pi - > next ) {
json_object * json_path = NULL ;
add_rd_to_json = 1 ;
path_cnt + + ;
if ( json )
json_path = json_object_new_array ( ) ;
bgpd: Show applied route-map attributes for `neighbor X advertised-routes detail`
If we have a route-map that sets some attributes e.g. community or large-community,
and the route-map is applied for outgoing direction, everything is fine, but
we missed the point that `advertised-routes detail` was not using the applied
attributes to display and instead it uses what is received from the peer (original).
Let's fix this, and use what's already applied (advertise attributes), and
we can now see:
```
route-map r3 permit 10
match ip address prefix-list p1
set community 65001:65002
set extcommunity bandwidth 100
set large-community 65001:65002:65003
exit
!
...
address-family ipv4 unicast
neighbor 192.168.2.3 route-map r3 out
exit-address-family
...
```
The output:
```
r2# show bgp ipv4 neighbors 192.168.2.3 advertised-routes detail
BGP table version is 1, local router ID is 192.168.2.2, vrf id 0
Default local pref 100, local AS 65002
BGP routing table entry for 10.10.10.1/32, version 1
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
192.168.1.1 192.168.2.3
65001
0.0.0.0 from 192.168.1.1 (192.168.1.1)
Origin IGP, valid, external, best (First path received)
Community: 65001:65002
Extended Community: LB:65002:12500000 (100.000 Mbps)
Large Community: 65001:65002:65003
Last update: Thu Dec 19 17:00:40 2024
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-12-19 15:59:47 +01:00
route_vty_out_detail ( vty , bgp , dest , p , pi , AFI_L2VPN , SAFI_EVPN ,
bgpd: Show internal data for BGP routes
Sometimes it's very useful to compare pointers from the gdb (and/or from the
logs) or just do some quick adhoc analysis.
```
donatas# sh ip bgp 1.1.1.0/24 internal
BGP routing table entry for 1.1.1.0/24, version 0
Paths: (1 available, no best path)
Not advertised to any peer
65002
127.0.0.1 (inaccessible, import-check enabled) from 127.0.0.1 (127.0.0.2)
Origin IGP, invalid, external
Last update: Thu Jan 16 16:49:53 2025
net: 0x63f3e6fc2ea0, path: 0x63f3e6fc2f50, pathext: 0x63f3e6faed00, attr: 0x63f3e6e8c550
flags net: 0x0, path: 0x1024, attr: 0x7
donatas#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-16 15:50:14 +01:00
RPKI_NOT_BEING_USED , json_path , NULL , 0 ) ;
2021-03-09 05:28:04 +01:00
if ( json )
json_object_array_add ( json_paths , json_path ) ;
else
vty_out ( vty , " \n " ) ;
}
if ( json ) {
json_object_object_add ( json_prefix , " paths " ,
json_paths ) ;
2022-08-25 12:46:58 +02:00
json_object_object_addf ( json_rd , json_prefix , " %pFX " ,
p ) ;
2021-03-09 05:28:04 +01:00
if ( add_rd_to_json )
json_object_object_add ( json , rd_str , json_rd ) ;
else {
json_object_free ( json_rd ) ;
json_rd = NULL ;
}
}
2021-06-22 22:14:47 +02:00
bgp_dest_unlock_node ( dest ) ;
2021-03-09 05:28:04 +01:00
}
if ( json ) {
json_object_int_add ( json , " numPrefix " , prefix_cnt ) ;
json_object_int_add ( json , " numPaths " , path_cnt ) ;
} else {
if ( prefix_cnt = = 0 ) {
vty_out ( vty , " No Matching EVPN prefixes exist \n " ) ;
} else {
vty_out ( vty , " Displayed %u prefixes (%u paths) \n " ,
prefix_cnt , path_cnt ) ;
}
}
}
2017-05-15 23:53:31 +02:00
/*
* Display BGP EVPN routing table - all routes ( vty handler ) .
* If ' type ' is non - zero , only routes matching that type are shown .
*/
2017-07-21 02:42:20 +02:00
static void evpn_show_all_routes ( struct vty * vty , struct bgp * bgp , int type ,
2023-02-14 16:54:59 +01:00
json_object * json , int detail , bool self_orig )
2017-05-15 23:53:31 +02:00
{
2020-03-27 00:11:58 +01:00
struct bgp_dest * rd_dest ;
2017-05-15 23:53:31 +02:00
struct bgp_table * table ;
2020-03-27 00:11:58 +01:00
struct bgp_dest * dest ;
2018-10-03 02:43:07 +02:00
struct bgp_path_info * pi ;
2019-04-10 08:13:51 +02:00
int header = detail ? 0 : 1 ;
2017-05-15 23:53:31 +02:00
int rd_header ;
afi_t afi ;
safi_t safi ;
2018-03-27 21:13:34 +02:00
uint32_t prefix_cnt , path_cnt ;
2023-11-02 02:46:08 +01:00
int first = true ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
afi = AFI_L2VPN ;
safi = SAFI_EVPN ;
prefix_cnt = path_cnt = 0 ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
/* EVPN routing table is a 2-level table with the first level being
* the RD .
*/
2020-03-27 00:11:58 +01:00
for ( rd_dest = bgp_table_top ( bgp - > rib [ afi ] [ safi ] ) ; rd_dest ;
rd_dest = bgp_route_next ( rd_dest ) ) {
2017-07-21 02:42:20 +02:00
char rd_str [ RD_ADDRSTRLEN ] ;
json_object * json_rd = NULL ; /* contains routes for an RD */
int add_rd_to_json = 0 ;
2017-11-02 00:57:55 +01:00
uint64_t tbl_ver ;
2020-03-27 00:11:58 +01:00
const struct prefix * rd_destp = bgp_dest_get_prefix ( rd_dest ) ;
2017-07-21 02:42:20 +02:00
2020-03-27 00:11:58 +01:00
table = bgp_dest_get_bgp_table_info ( rd_dest ) ;
2017-05-15 23:53:31 +02:00
if ( table = = NULL )
continue ;
2017-07-17 14:03:14 +02:00
2017-11-02 00:57:55 +01:00
tbl_ver = table - > version ;
2020-03-27 00:11:58 +01:00
prefix_rd2str ( ( struct prefix_rd * ) rd_destp , rd_str ,
2022-11-22 09:57:10 +01:00
sizeof ( rd_str ) , bgp - > asnotation ) ;
2017-07-21 02:42:20 +02:00
2023-11-02 02:46:08 +01:00
if ( json ) {
if ( first ) {
vty_out ( vty , " \" %s \" : " , rd_str ) ;
first = false ;
} else {
vty_out ( vty , " , \" %s \" : " , rd_str ) ;
}
2017-07-21 02:42:20 +02:00
json_rd = json_object_new_object ( ) ;
2023-11-02 02:46:08 +01:00
}
2017-07-21 02:42:20 +02:00
2017-05-15 23:53:31 +02:00
rd_header = 1 ;
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
/* Display all prefixes for an RD */
2020-03-27 00:11:58 +01:00
for ( dest = bgp_table_top ( table ) ; dest ;
dest = bgp_route_next ( dest ) ) {
2017-07-21 02:42:20 +02:00
json_object * json_prefix =
NULL ; /* contains prefix under a RD */
json_object * json_paths =
NULL ; /* array of paths under a prefix*/
2020-03-22 05:02:18 +01:00
const struct prefix_evpn * evp =
2020-03-27 00:11:58 +01:00
( const struct prefix_evpn * ) bgp_dest_get_prefix (
dest ) ;
2017-07-21 02:42:20 +02:00
int add_prefix_to_json = 0 ;
2020-03-27 00:11:58 +01:00
const struct prefix * p = bgp_dest_get_prefix ( dest ) ;
2017-07-21 02:42:20 +02:00
2017-05-15 23:53:31 +02:00
if ( type & & evp - > prefix . route_type ! = type )
continue ;
2017-07-17 14:03:14 +02:00
2020-03-27 00:11:58 +01:00
pi = bgp_dest_get_bgp_path_info ( dest ) ;
2018-07-30 17:40:02 +02:00
if ( pi ) {
2023-02-14 16:54:59 +01:00
if ( self_orig & & ( pi - > peer ! = bgp - > peer_self ) )
continue ;
2017-05-15 23:53:31 +02:00
/* Overall header/legend displayed once. */
if ( header ) {
2017-07-21 02:42:20 +02:00
bgp_evpn_show_route_header ( vty , bgp ,
2017-11-02 00:57:55 +01:00
tbl_ver ,
2017-07-21 02:42:20 +02:00
json ) ;
bgpd: fix show bgp l2vpn evpn route json
PR-4544 has introduced a new filed extended community
in show bgp l2vpn evpn route command.
The header has missed checking json is enabled.
Ticket:CM-25581
Reviewed By:
Testing Done:
TORS1# show bgp l2vpn evpn route json
{
"27.0.0.15:8":{
"rd":"27.0.0.15:8",
"[2]:[0]:[48]:[00:02:00:00:00:0a]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:0a]",
"prefixLen":288,
"paths":[
[
{
"valid":true,
"bestpath":true,
"pathFrom":"external",
"routeType":2,
"ethTag":0,
"macLen":48,
"mac":"00:02:00:00:00:0a",
"weight":32768,
"peerId":"(unspec)",
"aspath":"",
"path":"",
"origin":"IGP",
"extendedCommunity":{
"string":"ET:8 RT:5550:1002"
},
"nexthops":[
{
"ip":"27.0.0.15",
"afi":"ipv4",
"used":true
}
]
}
]
]
},
...
},
"numPrefix":187,
"numPaths":343
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-07-09 20:51:46 +02:00
if ( ! json )
vty_out ( vty ,
" %19s Extended Community \n "
2019-06-14 02:55:38 +02:00
, " " ) ;
2017-05-15 23:53:31 +02:00
header = 0 ;
}
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
/* RD header - per RD. */
if ( rd_header ) {
2017-07-21 02:42:20 +02:00
bgp_evpn_show_route_rd_header (
2020-03-27 00:11:58 +01:00
vty , rd_dest , json_rd , rd_str ,
2019-10-07 23:20:02 +02:00
RD_ADDRSTRLEN ) ;
2017-05-15 23:53:31 +02:00
rd_header = 0 ;
}
2017-07-17 14:03:14 +02:00
2017-05-15 23:53:31 +02:00
prefix_cnt + + ;
}
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
if ( json ) {
json_prefix = json_object_new_object ( ) ;
json_paths = json_object_new_array ( ) ;
2022-08-25 12:46:58 +02:00
json_object_string_addf ( json_prefix , " prefix " ,
" %pFX " , p ) ;
2017-07-21 02:42:20 +02:00
json_object_int_add ( json_prefix , " prefixLen " ,
2020-03-22 05:02:18 +01:00
p - > prefixlen ) ;
2017-07-21 02:42:20 +02:00
}
2019-04-10 08:13:51 +02:00
/* Prefix and num paths displayed once per prefix. */
if ( detail )
2024-03-22 21:04:19 +01:00
route_vty_out_detail_header ( vty , bgp , dest ,
bgp_dest_get_prefix (
dest ) ,
( struct prefix_rd * )
rd_destp ,
AFI_L2VPN , SAFI_EVPN ,
json_prefix , false ,
false ) ;
2019-04-10 08:13:51 +02:00
2017-05-15 23:53:31 +02:00
/* For EVPN, the prefix is displayed for each path (to
* fit in
* with code that already exists ) .
*/
2018-07-30 17:40:02 +02:00
for ( ; pi ; pi = pi - > next ) {
2017-07-21 02:42:20 +02:00
json_object * json_path = NULL ;
2021-03-09 05:28:04 +01:00
2017-05-15 23:53:31 +02:00
path_cnt + + ;
2017-07-21 02:42:20 +02:00
add_prefix_to_json = 1 ;
add_rd_to_json = 1 ;
if ( json )
json_path = json_object_new_array ( ) ;
2019-04-10 08:13:51 +02:00
if ( detail ) {
bgpd: Show applied route-map attributes for `neighbor X advertised-routes detail`
If we have a route-map that sets some attributes e.g. community or large-community,
and the route-map is applied for outgoing direction, everything is fine, but
we missed the point that `advertised-routes detail` was not using the applied
attributes to display and instead it uses what is received from the peer (original).
Let's fix this, and use what's already applied (advertise attributes), and
we can now see:
```
route-map r3 permit 10
match ip address prefix-list p1
set community 65001:65002
set extcommunity bandwidth 100
set large-community 65001:65002:65003
exit
!
...
address-family ipv4 unicast
neighbor 192.168.2.3 route-map r3 out
exit-address-family
...
```
The output:
```
r2# show bgp ipv4 neighbors 192.168.2.3 advertised-routes detail
BGP table version is 1, local router ID is 192.168.2.2, vrf id 0
Default local pref 100, local AS 65002
BGP routing table entry for 10.10.10.1/32, version 1
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
192.168.1.1 192.168.2.3
65001
0.0.0.0 from 192.168.1.1 (192.168.1.1)
Origin IGP, valid, external, best (First path received)
Community: 65001:65002
Extended Community: LB:65002:12500000 (100.000 Mbps)
Large Community: 65001:65002:65003
Last update: Thu Dec 19 17:00:40 2024
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-12-19 15:59:47 +01:00
route_vty_out_detail ( vty , bgp , dest ,
bgp_dest_get_prefix ( dest ) , pi ,
AFI_L2VPN , SAFI_EVPN ,
bgpd: Show internal data for BGP routes
Sometimes it's very useful to compare pointers from the gdb (and/or from the
logs) or just do some quick adhoc analysis.
```
donatas# sh ip bgp 1.1.1.0/24 internal
BGP routing table entry for 1.1.1.0/24, version 0
Paths: (1 available, no best path)
Not advertised to any peer
65002
127.0.0.1 (inaccessible, import-check enabled) from 127.0.0.1 (127.0.0.2)
Origin IGP, invalid, external
Last update: Thu Jan 16 16:49:53 2025
net: 0x63f3e6fc2ea0, path: 0x63f3e6fc2f50, pathext: 0x63f3e6faed00, attr: 0x63f3e6e8c550
flags net: 0x0, path: 0x1024, attr: 0x7
donatas#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-16 15:50:14 +01:00
RPKI_NOT_BEING_USED , json_path , NULL ,
0 ) ;
2019-04-10 08:13:51 +02:00
} else
2020-03-22 05:02:18 +01:00
route_vty_out ( vty , p , pi , 0 , SAFI_EVPN ,
2020-07-23 11:20:52 +02:00
json_path , false ) ;
2017-07-21 02:42:20 +02:00
if ( json )
json_object_array_add ( json_paths ,
json_path ) ;
}
2020-01-22 21:22:27 +01:00
if ( json ) {
if ( add_prefix_to_json ) {
json_object_object_add ( json_prefix ,
" paths " ,
json_paths ) ;
2022-08-25 12:46:58 +02:00
json_object_object_addf ( json_rd ,
json_prefix ,
" %pFX " , p ) ;
2020-01-22 21:22:27 +01:00
} else {
json_object_free ( json_prefix ) ;
json_object_free ( json_paths ) ;
json_prefix = NULL ;
json_paths = NULL ;
}
2017-07-17 14:03:14 +02:00
}
2017-05-15 23:53:31 +02:00
}
2017-07-21 02:42:20 +02:00
2020-01-22 21:22:27 +01:00
if ( json ) {
2023-11-02 02:46:08 +01:00
if ( add_rd_to_json ) {
vty_json_no_pretty ( vty , json_rd ) ;
} else {
vty_out ( vty , " {} " ) ;
2020-01-22 21:22:27 +01:00
json_object_free ( json_rd ) ;
}
}
2017-05-15 23:53:31 +02:00
}
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
if ( json ) {
2023-11-02 02:46:08 +01:00
vty_out ( vty , " , \" numPrefix \" :%u " , prefix_cnt ) ;
vty_out ( vty , " , \" numPaths \" :%u " , path_cnt ) ;
2017-07-21 02:42:20 +02:00
} else {
if ( prefix_cnt = = 0 ) {
vty_out ( vty , " No EVPN prefixes %sexist \n " ,
type ? " (of requested type) " : " " ) ;
} else {
vty_out ( vty , " \n Displayed %u prefixes (%u paths)%s \n " ,
prefix_cnt , path_cnt ,
type ? " (of requested type) " : " " ) ;
}
}
2017-05-15 23:53:31 +02:00
}
bgpd: fix show bgp all with evpn
Fix crash on "show bgp all" when BGP EVPN is set.
> #0 raise (sig=11) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1 0x00007fdfe03cf53c in core_handler (signo=11, siginfo=0x7ffdebbffe30, context=0x7ffdebbffd00) at lib/sigevent.c:261
> #2 <signal handler called>
> #3 0x00000000004d4fec in bgp_attr_get_community (attr=0x41) at bgpd/bgp_attr.h:553
> #4 0x00000000004eee84 in bgp_show_table (vty=0x1a790d0, bgp=0x19d0a00, safi=SAFI_EVPN, table=0x19f6010, type=bgp_show_type_normal, output_arg=0x0, rd=0x0, is_last=1, output_cum=0x0,
> total_cum=0x0, json_header_depth=0x7ffdebc00bf8, show_flags=4, rpki_target_state=RPKI_NOT_BEING_USED) at bgpd/bgp_route.c:11329
> #5 0x00000000004f7765 in bgp_show (vty=0x1a790d0, bgp=0x19d0a00, afi=AFI_L2VPN, safi=SAFI_EVPN, type=bgp_show_type_normal, output_arg=0x0, show_flags=4,
> rpki_target_state=RPKI_NOT_BEING_USED) at bgpd/bgp_route.c:11814
> #6 0x00000000004fb53b in show_ip_bgp_magic (self=0x6752b0 <show_ip_bgp_cmd>, vty=0x1a790d0, argc=3, argv=0x19cb050, viewvrfname=0x0, all=0x1395390 "all", aa_nn=0x0, community_list=0,
> community_list_str=0x0, community_list_name=0x0, as_path_filter_name=0x0, prefix_list=0x0, accesslist_name=0x0, rmap_name=0x0, version=0, version_str=0x0, alias_name=0x0,
> orr_group_name=0x0, detail_routes=0x0, uj=0x0, detail_json=0x0, wide=0x0) at bgpd/bgp_route.c:13040
> #7 0x00000000004fa322 in show_ip_bgp (self=0x6752b0 <show_ip_bgp_cmd>, vty=0x1a790d0, argc=3, argv=0x19cb050) at ./bgpd/bgp_route_clippy.c:519
> #8 0x00007fdfe033ccc8 in cmd_execute_command_real (vline=0x19c9300, filter=FILTER_RELAXED, vty=0x1a790d0, cmd=0x0, up_level=0) at lib/command.c:996
> #9 0x00007fdfe033c739 in cmd_execute_command (vline=0x19c9300, vty=0x1a790d0, cmd=0x0, vtysh=0) at lib/command.c:1056
> #10 0x00007fdfe033cdf5 in cmd_execute (vty=0x1a790d0, cmd=0x19c9eb0 "show bgp all", matched=0x0, vtysh=0) at lib/command.c:1223
> #11 0x00007fdfe03f65c6 in vty_command (vty=0x1a790d0, buf=0x19c9eb0 "show bgp all") at lib/vty.c:486
> #12 0x00007fdfe03f603b in vty_execute (vty=0x1a790d0) at lib/vty.c:1249
> #13 0x00007fdfe03f533b in vtysh_read (thread=0x7ffdebc03838) at lib/vty.c:2148
> #14 0x00007fdfe03e815d in thread_call (thread=0x7ffdebc03838) at lib/thread.c:2006
> #15 0x00007fdfe0379b54 in frr_run (master=0x1246880) at lib/libfrr.c:1198
> #16 0x000000000042b2a8 in main (argc=7, argv=0x7ffdebc03af8) at bgpd/bgp_main.c:520
Link: https://github.com/FRRouting/frr/issues/12576
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-12-29 16:50:54 +01:00
int bgp_evpn_show_all_routes ( struct vty * vty , struct bgp * bgp , int type ,
bool use_json , int detail )
{
json_object * json = NULL ;
2023-11-02 02:46:08 +01:00
if ( use_json ) {
bgpd: fix show bgp all with evpn
Fix crash on "show bgp all" when BGP EVPN is set.
> #0 raise (sig=11) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1 0x00007fdfe03cf53c in core_handler (signo=11, siginfo=0x7ffdebbffe30, context=0x7ffdebbffd00) at lib/sigevent.c:261
> #2 <signal handler called>
> #3 0x00000000004d4fec in bgp_attr_get_community (attr=0x41) at bgpd/bgp_attr.h:553
> #4 0x00000000004eee84 in bgp_show_table (vty=0x1a790d0, bgp=0x19d0a00, safi=SAFI_EVPN, table=0x19f6010, type=bgp_show_type_normal, output_arg=0x0, rd=0x0, is_last=1, output_cum=0x0,
> total_cum=0x0, json_header_depth=0x7ffdebc00bf8, show_flags=4, rpki_target_state=RPKI_NOT_BEING_USED) at bgpd/bgp_route.c:11329
> #5 0x00000000004f7765 in bgp_show (vty=0x1a790d0, bgp=0x19d0a00, afi=AFI_L2VPN, safi=SAFI_EVPN, type=bgp_show_type_normal, output_arg=0x0, show_flags=4,
> rpki_target_state=RPKI_NOT_BEING_USED) at bgpd/bgp_route.c:11814
> #6 0x00000000004fb53b in show_ip_bgp_magic (self=0x6752b0 <show_ip_bgp_cmd>, vty=0x1a790d0, argc=3, argv=0x19cb050, viewvrfname=0x0, all=0x1395390 "all", aa_nn=0x0, community_list=0,
> community_list_str=0x0, community_list_name=0x0, as_path_filter_name=0x0, prefix_list=0x0, accesslist_name=0x0, rmap_name=0x0, version=0, version_str=0x0, alias_name=0x0,
> orr_group_name=0x0, detail_routes=0x0, uj=0x0, detail_json=0x0, wide=0x0) at bgpd/bgp_route.c:13040
> #7 0x00000000004fa322 in show_ip_bgp (self=0x6752b0 <show_ip_bgp_cmd>, vty=0x1a790d0, argc=3, argv=0x19cb050) at ./bgpd/bgp_route_clippy.c:519
> #8 0x00007fdfe033ccc8 in cmd_execute_command_real (vline=0x19c9300, filter=FILTER_RELAXED, vty=0x1a790d0, cmd=0x0, up_level=0) at lib/command.c:996
> #9 0x00007fdfe033c739 in cmd_execute_command (vline=0x19c9300, vty=0x1a790d0, cmd=0x0, vtysh=0) at lib/command.c:1056
> #10 0x00007fdfe033cdf5 in cmd_execute (vty=0x1a790d0, cmd=0x19c9eb0 "show bgp all", matched=0x0, vtysh=0) at lib/command.c:1223
> #11 0x00007fdfe03f65c6 in vty_command (vty=0x1a790d0, buf=0x19c9eb0 "show bgp all") at lib/vty.c:486
> #12 0x00007fdfe03f603b in vty_execute (vty=0x1a790d0) at lib/vty.c:1249
> #13 0x00007fdfe03f533b in vtysh_read (thread=0x7ffdebc03838) at lib/vty.c:2148
> #14 0x00007fdfe03e815d in thread_call (thread=0x7ffdebc03838) at lib/thread.c:2006
> #15 0x00007fdfe0379b54 in frr_run (master=0x1246880) at lib/libfrr.c:1198
> #16 0x000000000042b2a8 in main (argc=7, argv=0x7ffdebc03af8) at bgpd/bgp_main.c:520
Link: https://github.com/FRRouting/frr/issues/12576
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-12-29 16:50:54 +01:00
json = json_object_new_object ( ) ;
2023-11-02 02:46:08 +01:00
vty_out ( vty , " { \n " ) ;
}
bgpd: fix show bgp all with evpn
Fix crash on "show bgp all" when BGP EVPN is set.
> #0 raise (sig=11) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1 0x00007fdfe03cf53c in core_handler (signo=11, siginfo=0x7ffdebbffe30, context=0x7ffdebbffd00) at lib/sigevent.c:261
> #2 <signal handler called>
> #3 0x00000000004d4fec in bgp_attr_get_community (attr=0x41) at bgpd/bgp_attr.h:553
> #4 0x00000000004eee84 in bgp_show_table (vty=0x1a790d0, bgp=0x19d0a00, safi=SAFI_EVPN, table=0x19f6010, type=bgp_show_type_normal, output_arg=0x0, rd=0x0, is_last=1, output_cum=0x0,
> total_cum=0x0, json_header_depth=0x7ffdebc00bf8, show_flags=4, rpki_target_state=RPKI_NOT_BEING_USED) at bgpd/bgp_route.c:11329
> #5 0x00000000004f7765 in bgp_show (vty=0x1a790d0, bgp=0x19d0a00, afi=AFI_L2VPN, safi=SAFI_EVPN, type=bgp_show_type_normal, output_arg=0x0, show_flags=4,
> rpki_target_state=RPKI_NOT_BEING_USED) at bgpd/bgp_route.c:11814
> #6 0x00000000004fb53b in show_ip_bgp_magic (self=0x6752b0 <show_ip_bgp_cmd>, vty=0x1a790d0, argc=3, argv=0x19cb050, viewvrfname=0x0, all=0x1395390 "all", aa_nn=0x0, community_list=0,
> community_list_str=0x0, community_list_name=0x0, as_path_filter_name=0x0, prefix_list=0x0, accesslist_name=0x0, rmap_name=0x0, version=0, version_str=0x0, alias_name=0x0,
> orr_group_name=0x0, detail_routes=0x0, uj=0x0, detail_json=0x0, wide=0x0) at bgpd/bgp_route.c:13040
> #7 0x00000000004fa322 in show_ip_bgp (self=0x6752b0 <show_ip_bgp_cmd>, vty=0x1a790d0, argc=3, argv=0x19cb050) at ./bgpd/bgp_route_clippy.c:519
> #8 0x00007fdfe033ccc8 in cmd_execute_command_real (vline=0x19c9300, filter=FILTER_RELAXED, vty=0x1a790d0, cmd=0x0, up_level=0) at lib/command.c:996
> #9 0x00007fdfe033c739 in cmd_execute_command (vline=0x19c9300, vty=0x1a790d0, cmd=0x0, vtysh=0) at lib/command.c:1056
> #10 0x00007fdfe033cdf5 in cmd_execute (vty=0x1a790d0, cmd=0x19c9eb0 "show bgp all", matched=0x0, vtysh=0) at lib/command.c:1223
> #11 0x00007fdfe03f65c6 in vty_command (vty=0x1a790d0, buf=0x19c9eb0 "show bgp all") at lib/vty.c:486
> #12 0x00007fdfe03f603b in vty_execute (vty=0x1a790d0) at lib/vty.c:1249
> #13 0x00007fdfe03f533b in vtysh_read (thread=0x7ffdebc03838) at lib/vty.c:2148
> #14 0x00007fdfe03e815d in thread_call (thread=0x7ffdebc03838) at lib/thread.c:2006
> #15 0x00007fdfe0379b54 in frr_run (master=0x1246880) at lib/libfrr.c:1198
> #16 0x000000000042b2a8 in main (argc=7, argv=0x7ffdebc03af8) at bgpd/bgp_main.c:520
Link: https://github.com/FRRouting/frr/issues/12576
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-12-29 16:50:54 +01:00
2023-02-14 16:54:59 +01:00
evpn_show_all_routes ( vty , bgp , type , json , detail , false ) ;
bgpd: fix show bgp all with evpn
Fix crash on "show bgp all" when BGP EVPN is set.
> #0 raise (sig=11) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1 0x00007fdfe03cf53c in core_handler (signo=11, siginfo=0x7ffdebbffe30, context=0x7ffdebbffd00) at lib/sigevent.c:261
> #2 <signal handler called>
> #3 0x00000000004d4fec in bgp_attr_get_community (attr=0x41) at bgpd/bgp_attr.h:553
> #4 0x00000000004eee84 in bgp_show_table (vty=0x1a790d0, bgp=0x19d0a00, safi=SAFI_EVPN, table=0x19f6010, type=bgp_show_type_normal, output_arg=0x0, rd=0x0, is_last=1, output_cum=0x0,
> total_cum=0x0, json_header_depth=0x7ffdebc00bf8, show_flags=4, rpki_target_state=RPKI_NOT_BEING_USED) at bgpd/bgp_route.c:11329
> #5 0x00000000004f7765 in bgp_show (vty=0x1a790d0, bgp=0x19d0a00, afi=AFI_L2VPN, safi=SAFI_EVPN, type=bgp_show_type_normal, output_arg=0x0, show_flags=4,
> rpki_target_state=RPKI_NOT_BEING_USED) at bgpd/bgp_route.c:11814
> #6 0x00000000004fb53b in show_ip_bgp_magic (self=0x6752b0 <show_ip_bgp_cmd>, vty=0x1a790d0, argc=3, argv=0x19cb050, viewvrfname=0x0, all=0x1395390 "all", aa_nn=0x0, community_list=0,
> community_list_str=0x0, community_list_name=0x0, as_path_filter_name=0x0, prefix_list=0x0, accesslist_name=0x0, rmap_name=0x0, version=0, version_str=0x0, alias_name=0x0,
> orr_group_name=0x0, detail_routes=0x0, uj=0x0, detail_json=0x0, wide=0x0) at bgpd/bgp_route.c:13040
> #7 0x00000000004fa322 in show_ip_bgp (self=0x6752b0 <show_ip_bgp_cmd>, vty=0x1a790d0, argc=3, argv=0x19cb050) at ./bgpd/bgp_route_clippy.c:519
> #8 0x00007fdfe033ccc8 in cmd_execute_command_real (vline=0x19c9300, filter=FILTER_RELAXED, vty=0x1a790d0, cmd=0x0, up_level=0) at lib/command.c:996
> #9 0x00007fdfe033c739 in cmd_execute_command (vline=0x19c9300, vty=0x1a790d0, cmd=0x0, vtysh=0) at lib/command.c:1056
> #10 0x00007fdfe033cdf5 in cmd_execute (vty=0x1a790d0, cmd=0x19c9eb0 "show bgp all", matched=0x0, vtysh=0) at lib/command.c:1223
> #11 0x00007fdfe03f65c6 in vty_command (vty=0x1a790d0, buf=0x19c9eb0 "show bgp all") at lib/vty.c:486
> #12 0x00007fdfe03f603b in vty_execute (vty=0x1a790d0) at lib/vty.c:1249
> #13 0x00007fdfe03f533b in vtysh_read (thread=0x7ffdebc03838) at lib/vty.c:2148
> #14 0x00007fdfe03e815d in thread_call (thread=0x7ffdebc03838) at lib/thread.c:2006
> #15 0x00007fdfe0379b54 in frr_run (master=0x1246880) at lib/libfrr.c:1198
> #16 0x000000000042b2a8 in main (argc=7, argv=0x7ffdebc03af8) at bgpd/bgp_main.c:520
Link: https://github.com/FRRouting/frr/issues/12576
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-12-29 16:50:54 +01:00
2023-11-02 02:46:08 +01:00
if ( use_json ) {
vty_out ( vty , " } \n " ) ;
json_object_free ( json ) ;
}
bgpd: fix show bgp all with evpn
Fix crash on "show bgp all" when BGP EVPN is set.
> #0 raise (sig=11) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1 0x00007fdfe03cf53c in core_handler (signo=11, siginfo=0x7ffdebbffe30, context=0x7ffdebbffd00) at lib/sigevent.c:261
> #2 <signal handler called>
> #3 0x00000000004d4fec in bgp_attr_get_community (attr=0x41) at bgpd/bgp_attr.h:553
> #4 0x00000000004eee84 in bgp_show_table (vty=0x1a790d0, bgp=0x19d0a00, safi=SAFI_EVPN, table=0x19f6010, type=bgp_show_type_normal, output_arg=0x0, rd=0x0, is_last=1, output_cum=0x0,
> total_cum=0x0, json_header_depth=0x7ffdebc00bf8, show_flags=4, rpki_target_state=RPKI_NOT_BEING_USED) at bgpd/bgp_route.c:11329
> #5 0x00000000004f7765 in bgp_show (vty=0x1a790d0, bgp=0x19d0a00, afi=AFI_L2VPN, safi=SAFI_EVPN, type=bgp_show_type_normal, output_arg=0x0, show_flags=4,
> rpki_target_state=RPKI_NOT_BEING_USED) at bgpd/bgp_route.c:11814
> #6 0x00000000004fb53b in show_ip_bgp_magic (self=0x6752b0 <show_ip_bgp_cmd>, vty=0x1a790d0, argc=3, argv=0x19cb050, viewvrfname=0x0, all=0x1395390 "all", aa_nn=0x0, community_list=0,
> community_list_str=0x0, community_list_name=0x0, as_path_filter_name=0x0, prefix_list=0x0, accesslist_name=0x0, rmap_name=0x0, version=0, version_str=0x0, alias_name=0x0,
> orr_group_name=0x0, detail_routes=0x0, uj=0x0, detail_json=0x0, wide=0x0) at bgpd/bgp_route.c:13040
> #7 0x00000000004fa322 in show_ip_bgp (self=0x6752b0 <show_ip_bgp_cmd>, vty=0x1a790d0, argc=3, argv=0x19cb050) at ./bgpd/bgp_route_clippy.c:519
> #8 0x00007fdfe033ccc8 in cmd_execute_command_real (vline=0x19c9300, filter=FILTER_RELAXED, vty=0x1a790d0, cmd=0x0, up_level=0) at lib/command.c:996
> #9 0x00007fdfe033c739 in cmd_execute_command (vline=0x19c9300, vty=0x1a790d0, cmd=0x0, vtysh=0) at lib/command.c:1056
> #10 0x00007fdfe033cdf5 in cmd_execute (vty=0x1a790d0, cmd=0x19c9eb0 "show bgp all", matched=0x0, vtysh=0) at lib/command.c:1223
> #11 0x00007fdfe03f65c6 in vty_command (vty=0x1a790d0, buf=0x19c9eb0 "show bgp all") at lib/vty.c:486
> #12 0x00007fdfe03f603b in vty_execute (vty=0x1a790d0) at lib/vty.c:1249
> #13 0x00007fdfe03f533b in vtysh_read (thread=0x7ffdebc03838) at lib/vty.c:2148
> #14 0x00007fdfe03e815d in thread_call (thread=0x7ffdebc03838) at lib/thread.c:2006
> #15 0x00007fdfe0379b54 in frr_run (master=0x1246880) at lib/libfrr.c:1198
> #16 0x000000000042b2a8 in main (argc=7, argv=0x7ffdebc03af8) at bgpd/bgp_main.c:520
Link: https://github.com/FRRouting/frr/issues/12576
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-12-29 16:50:54 +01:00
return CMD_SUCCESS ;
}
2017-05-15 23:53:31 +02:00
/*
* Display specified VNI ( vty handler )
*/
2017-07-21 02:42:20 +02:00
static void evpn_show_vni ( struct vty * vty , struct bgp * bgp , vni_t vni ,
json_object * json )
2017-05-15 23:53:31 +02:00
{
2018-03-27 21:13:34 +02:00
uint8_t found = 0 ;
2017-05-15 23:53:31 +02:00
struct bgpevpn * vpn ;
vpn = bgp_evpn_lookup_vni ( bgp , vni ) ;
2017-11-15 10:01:00 +01:00
if ( vpn ) {
found = 1 ;
display_vni ( vty , vpn , json ) ;
} else {
struct bgp * bgp_temp ;
struct listnode * node = NULL ;
for ( ALL_LIST_ELEMENTS_RO ( bm - > bgp , node , bgp_temp ) ) {
if ( bgp_temp - > l3vni = = vni ) {
found = 1 ;
display_l3vni ( vty , bgp_temp , json ) ;
}
}
}
if ( ! found ) {
2017-07-21 02:42:20 +02:00
if ( json ) {
vty_out ( vty , " {} \n " ) ;
} else {
vty_out ( vty , " VNI not found \n " ) ;
return ;
}
2017-05-15 23:53:31 +02:00
}
}
/*
* Display a VNI ( upon user query ) .
*/
2017-07-21 02:42:20 +02:00
static void evpn_show_all_vnis ( struct vty * vty , struct bgp * bgp ,
json_object * json )
2017-05-15 23:53:31 +02:00
{
2017-07-21 02:42:20 +02:00
void * args [ 2 ] ;
2017-11-15 10:01:00 +01:00
struct bgp * bgp_temp = NULL ;
struct listnode * node ;
2017-05-15 23:53:31 +02:00
2017-07-21 02:42:20 +02:00
2017-11-15 10:01:00 +01:00
if ( ! json ) {
2017-07-21 02:42:20 +02:00
vty_out ( vty , " Flags: * - Kernel \n " ) ;
2023-05-08 05:11:01 +02:00
vty_out ( vty , " %-10s %-4s %-21s %-25s %-25s %-25s %-37s \n " ,
" VNI " , " Type " , " RD " , " Import RT " , " Export RT " ,
" MAC-VRF Site-of-Origin " , " Tenant VRF " ) ;
2017-07-21 02:42:20 +02:00
}
2017-11-15 10:01:00 +01:00
/* print all L2 VNIS */
2017-07-21 02:42:20 +02:00
args [ 0 ] = vty ;
args [ 1 ] = json ;
2017-05-15 23:53:31 +02:00
hash_iterate ( bgp - > vnihash ,
2019-02-19 16:46:52 +01:00
( void ( * ) ( struct hash_bucket * , void * ) ) show_vni_entry ,
2017-07-21 02:42:20 +02:00
args ) ;
2017-11-15 10:01:00 +01:00
/* print all L3 VNIs */
for ( ALL_LIST_ELEMENTS_RO ( bm - > bgp , node , bgp_temp ) )
show_l3vni_entry ( vty , bgp_temp , json ) ;
2017-05-15 23:53:31 +02:00
}
2019-02-04 03:08:46 +01:00
/*
* evpn - enable advertisement of svi MAC - IP
*/
static void evpn_set_advertise_svi_macip ( struct bgp * bgp , struct bgpevpn * vpn ,
uint32_t set )
{
if ( ! vpn ) {
if ( set & & bgp - > evpn_info - > advertise_svi_macip )
return ;
else if ( ! set & & ! bgp - > evpn_info - > advertise_svi_macip )
return ;
bgp - > evpn_info - > advertise_svi_macip = set ;
bgp_zebra_advertise_svi_macip ( bgp ,
bgp - > evpn_info - > advertise_svi_macip , 0 ) ;
} else {
if ( set & & vpn - > advertise_svi_macip )
return ;
else if ( ! set & & ! vpn - > advertise_svi_macip )
return ;
vpn - > advertise_svi_macip = set ;
bgp_zebra_advertise_svi_macip ( bgp , vpn - > advertise_svi_macip ,
vpn - > vni ) ;
}
}
2017-06-28 10:51:10 +02:00
/*
* evpn - enable advertisement of default g / w
*/
static void evpn_set_advertise_default_gw ( struct bgp * bgp , struct bgpevpn * vpn )
{
if ( ! vpn ) {
if ( bgp - > advertise_gw_macip )
return ;
bgp - > advertise_gw_macip = 1 ;
bgp_zebra_advertise_gw_macip ( bgp , bgp - > advertise_gw_macip , 0 ) ;
} else {
if ( vpn - > advertise_gw_macip )
return ;
vpn - > advertise_gw_macip = 1 ;
bgp_zebra_advertise_gw_macip ( bgp , vpn - > advertise_gw_macip ,
vpn - > vni ) ;
}
return ;
}
/*
* evpn - disable advertisement of default g / w
*/
static void evpn_unset_advertise_default_gw ( struct bgp * bgp ,
struct bgpevpn * vpn )
{
if ( ! vpn ) {
if ( ! bgp - > advertise_gw_macip )
return ;
bgp - > advertise_gw_macip = 0 ;
bgp_zebra_advertise_gw_macip ( bgp , bgp - > advertise_gw_macip , 0 ) ;
} else {
if ( ! vpn - > advertise_gw_macip )
return ;
vpn - > advertise_gw_macip = 0 ;
bgp_zebra_advertise_gw_macip ( bgp , vpn - > advertise_gw_macip ,
vpn - > vni ) ;
}
return ;
}
2018-02-16 02:20:27 +01:00
/*
* evpn - enable advertisement of default g / w
*/
static void evpn_process_default_originate_cmd ( struct bgp * bgp_vrf ,
2018-11-29 04:18:08 +01:00
afi_t afi , bool add )
2018-02-16 02:20:27 +01:00
{
safi_t safi = SAFI_UNICAST ; /* ipv4/ipv6 unicast */
if ( add ) {
/* bail if we are already advertising default route */
if ( evpn_default_originate_set ( bgp_vrf , afi , safi ) )
return ;
if ( afi = = AFI_IP )
SET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4 ) ;
else if ( afi = = AFI_IP6 )
SET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6 ) ;
} else {
/* bail out if we havent advertised the default route */
if ( ! evpn_default_originate_set ( bgp_vrf , afi , safi ) )
return ;
if ( afi = = AFI_IP )
UNSET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4 ) ;
else if ( afi = = AFI_IP6 )
UNSET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6 ) ;
}
2018-11-29 04:18:08 +01:00
2021-06-09 22:56:22 +02:00
if ( is_l3vni_live ( bgp_vrf ) )
bgp_evpn_install_uninstall_default_route ( bgp_vrf ,
afi , safi , add ) ;
2018-02-16 02:20:27 +01:00
}
2017-11-20 06:47:04 +01:00
/*
* evpn - enable advertisement of default g / w
*/
static void evpn_set_advertise_subnet ( struct bgp * bgp ,
struct bgpevpn * vpn )
{
if ( vpn - > advertise_subnet )
return ;
vpn - > advertise_subnet = 1 ;
bgp_zebra_advertise_subnet ( bgp , vpn - > advertise_subnet , vpn - > vni ) ;
}
/*
* evpn - disable advertisement of default g / w
*/
static void evpn_unset_advertise_subnet ( struct bgp * bgp , struct bgpevpn * vpn )
{
if ( ! vpn - > advertise_subnet )
return ;
vpn - > advertise_subnet = 0 ;
bgp_zebra_advertise_subnet ( bgp , vpn - > advertise_subnet , vpn - > vni ) ;
}
2017-05-15 23:30:19 +02:00
/*
* EVPN ( VNI advertisement ) enabled . Register with zebra .
*/
static void evpn_set_advertise_all_vni ( struct bgp * bgp )
{
bgp - > advertise_all_vni = 1 ;
2019-03-06 19:09:25 +01:00
bgp_set_evpn ( bgp ) ;
2017-05-15 23:30:19 +02:00
bgp_zebra_advertise_all_vni ( bgp , bgp - > advertise_all_vni ) ;
}
/*
* EVPN ( VNI advertisement ) disabled . De - register with zebra . Cleanup VNI
* cache , EVPN routes ( delete and withdraw from peers ) .
*/
static void evpn_unset_advertise_all_vni ( struct bgp * bgp )
{
bgp - > advertise_all_vni = 0 ;
2019-03-06 19:09:25 +01:00
bgp_set_evpn ( bgp_get_default ( ) ) ;
2017-05-15 23:30:19 +02:00
bgp_zebra_advertise_all_vni ( bgp , bgp - > advertise_all_vni ) ;
bgp_evpn_cleanup_on_disable ( bgp ) ;
}
2017-04-12 11:24:07 +02:00
2021-05-12 00:26:29 +02:00
/* Set resolve overlay index flag */
static void bgp_evpn_set_unset_resolve_overlay_index ( struct bgp * bgp , bool set )
{
if ( set = = bgp - > resolve_overlay_index )
return ;
if ( set ) {
bgp - > resolve_overlay_index = true ;
hash_iterate ( bgp - > vnihash ,
( void ( * ) ( struct hash_bucket * , void * ) )
bgp_evpn_handle_resolve_overlay_index_set ,
NULL ) ;
} else {
hash_iterate (
bgp - > vnihash ,
( void ( * ) ( struct hash_bucket * , void * ) )
bgp_evpn_handle_resolve_overlay_index_unset ,
NULL ) ;
bgp - > resolve_overlay_index = false ;
}
}
2017-04-12 11:24:07 +02:00
/*
* EVPN - use RFC8365 to auto - derive RT
*/
static void evpn_set_advertise_autort_rfc8365 ( struct bgp * bgp )
{
bgp - > advertise_autort_rfc8365 = 1 ;
bgp_evpn_handle_autort_change ( bgp ) ;
}
/*
* EVPN - don ' t use RFC8365 to auto - derive RT
*/
static void evpn_unset_advertise_autort_rfc8365 ( struct bgp * bgp )
{
bgp - > advertise_autort_rfc8365 = 0 ;
bgp_evpn_handle_autort_change ( bgp ) ;
}
2017-05-15 23:30:19 +02:00
2017-08-27 22:18:32 +02:00
static void write_vni_config ( struct vty * vty , struct bgpevpn * vpn )
2017-05-16 00:01:57 +02:00
{
char * ecom_str ;
struct listnode * node , * nnode ;
struct ecommunity * ecom ;
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
if ( is_vni_configured ( vpn ) ) {
2022-11-01 19:33:36 +01:00
vty_out ( vty , " vni %u \n " , vpn - > vni ) ;
2017-05-16 00:01:57 +02:00
if ( is_rd_configured ( vpn ) )
2022-11-22 11:20:51 +01:00
vty_out ( vty , " rd %s \n " , vpn - > prd_pretty ) ;
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
if ( is_import_rt_configured ( vpn ) ) {
for ( ALL_LIST_ELEMENTS ( vpn - > import_rtl , node , nnode ,
ecom ) ) {
ecom_str = ecommunity_ecom2str (
ecom , ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
2017-07-14 14:52:45 +02:00
vty_out ( vty , " route-target import %s \n " ,
ecom_str ) ;
2017-05-16 00:01:57 +02:00
XFREE ( MTYPE_ECOMMUNITY_STR , ecom_str ) ;
}
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
if ( is_export_rt_configured ( vpn ) ) {
for ( ALL_LIST_ELEMENTS ( vpn - > export_rtl , node , nnode ,
ecom ) ) {
ecom_str = ecommunity_ecom2str (
ecom , ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
2017-06-30 15:29:37 +02:00
vty_out ( vty , " route-target export %s \n " ,
2017-07-14 14:52:45 +02:00
ecom_str ) ;
2017-05-16 00:01:57 +02:00
XFREE ( MTYPE_ECOMMUNITY_STR , ecom_str ) ;
}
2017-07-17 14:03:14 +02:00
}
2017-06-28 10:51:10 +02:00
if ( vpn - > advertise_gw_macip )
vty_out ( vty , " advertise-default-gw \n " ) ;
2019-02-04 03:08:46 +01:00
if ( vpn - > advertise_svi_macip )
vty_out ( vty , " advertise-svi-ip \n " ) ;
2017-11-20 06:47:04 +01:00
if ( vpn - > advertise_subnet )
vty_out ( vty , " advertise-subnet \n " ) ;
2017-07-14 14:52:45 +02:00
vty_out ( vty , " exit-vni \n " ) ;
2017-05-16 00:01:57 +02:00
}
2017-07-17 14:03:14 +02:00
}
2018-10-05 01:20:12 +02:00
# include "bgpd/bgp_evpn_vty_clippy.c"
DEFPY ( bgp_evpn_flood_control ,
bgp_evpn_flood_control_cmd ,
" [no$no] flooding <disable$disable|head-end-replication$her> " ,
NO_STR
" Specify handling for BUM packets \n "
" Do not flood any BUM packets \n "
" Flood BUM packets using head-end replication \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
enum vxlan_flood_control flood_ctrl ;
if ( ! bgp )
return CMD_WARNING ;
if ( disable & & ! no )
flood_ctrl = VXLAN_FLOOD_DISABLED ;
else if ( her | | no )
flood_ctrl = VXLAN_FLOOD_HEAD_END_REPL ;
else
return CMD_WARNING ;
if ( bgp - > vxlan_flood_ctrl = = flood_ctrl )
return CMD_SUCCESS ;
bgp - > vxlan_flood_ctrl = flood_ctrl ;
bgp_evpn_flood_control_change ( bgp ) ;
return CMD_SUCCESS ;
}
2017-06-28 10:51:10 +02:00
DEFUN ( bgp_evpn_advertise_default_gw_vni ,
bgp_evpn_advertise_default_gw_vni_cmd ,
" advertise-default-gw " ,
2017-10-04 21:25:12 +02:00
" Advertise default g/w mac-ip routes in EVPN for a VNI \n " )
2017-06-28 10:51:10 +02:00
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
VTY_DECLVAR_CONTEXT_SUB ( bgpevpn , vpn ) ;
if ( ! bgp )
return CMD_WARNING ;
evpn_set_advertise_default_gw ( bgp , vpn ) ;
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_advertise_default_vni_gw ,
no_bgp_evpn_advertise_default_gw_vni_cmd ,
" no advertise-default-gw " ,
NO_STR
" Withdraw default g/w mac-ip routes from EVPN for a VNI \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
VTY_DECLVAR_CONTEXT_SUB ( bgpevpn , vpn ) ;
if ( ! bgp )
return CMD_WARNING ;
evpn_unset_advertise_default_gw ( bgp , vpn ) ;
return CMD_SUCCESS ;
}
DEFUN ( bgp_evpn_advertise_default_gw ,
bgp_evpn_advertise_default_gw_cmd ,
" advertise-default-gw " ,
2017-10-04 21:25:12 +02:00
" Advertise All default g/w mac-ip routes in EVPN \n " )
2017-06-28 10:51:10 +02:00
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
if ( ! bgp )
return CMD_WARNING ;
2019-03-22 13:37:06 +01:00
if ( ! EVPN_ENABLED ( bgp ) ) {
2018-12-31 22:18:21 +01:00
vty_out ( vty ,
2019-03-06 19:15:10 +01:00
" This command is only supported under the EVPN VRF \n " ) ;
2018-12-31 22:18:21 +01:00
return CMD_WARNING ;
}
2017-06-28 10:51:10 +02:00
evpn_set_advertise_default_gw ( bgp , NULL ) ;
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_advertise_default_gw ,
no_bgp_evpn_advertise_default_gw_cmd ,
" no advertise-default-gw " ,
NO_STR
" Withdraw All default g/w mac-ip routes from EVPN \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
if ( ! bgp )
return CMD_WARNING ;
evpn_unset_advertise_default_gw ( bgp , NULL ) ;
return CMD_SUCCESS ;
}
2017-05-15 23:30:19 +02:00
DEFUN ( bgp_evpn_advertise_all_vni ,
bgp_evpn_advertise_all_vni_cmd ,
" advertise-all-vni " ,
" Advertise All local VNIs \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
2019-03-06 19:09:25 +01:00
struct bgp * bgp_evpn = NULL ;
2017-05-15 23:30:19 +02:00
if ( ! bgp )
return CMD_WARNING ;
2019-03-06 19:09:25 +01:00
bgp_evpn = bgp_get_evpn ( ) ;
if ( bgp_evpn & & bgp_evpn ! = bgp ) {
2022-02-05 22:36:54 +01:00
vty_out ( vty , " %% Please unconfigure EVPN in %s \n " ,
bgp_evpn - > name_pretty ) ;
2019-03-06 19:09:25 +01:00
return CMD_WARNING_CONFIG_FAILED ;
}
2017-05-15 23:30:19 +02:00
evpn_set_advertise_all_vni ( bgp ) ;
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_advertise_all_vni ,
no_bgp_evpn_advertise_all_vni_cmd ,
" no advertise-all-vni " ,
NO_STR
" Advertise All local VNIs \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
if ( ! bgp )
return CMD_WARNING ;
evpn_unset_advertise_all_vni ( bgp ) ;
return CMD_SUCCESS ;
}
2017-04-12 11:24:07 +02:00
DEFUN ( bgp_evpn_advertise_autort_rfc8365 ,
bgp_evpn_advertise_autort_rfc8365_cmd ,
" autort rfc8365-compatible " ,
" Auto-derivation of RT \n "
" Auto-derivation of RT using RFC8365 \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
if ( ! bgp )
return CMD_WARNING ;
evpn_set_advertise_autort_rfc8365 ( bgp ) ;
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_advertise_autort_rfc8365 ,
no_bgp_evpn_advertise_autort_rfc8365_cmd ,
" no autort rfc8365-compatible " ,
NO_STR
" Auto-derivation of RT \n "
" Auto-derivation of RT using RFC8365 \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
if ( ! bgp )
return CMD_WARNING ;
evpn_unset_advertise_autort_rfc8365 ( bgp ) ;
return CMD_SUCCESS ;
}
2018-02-16 02:20:27 +01:00
DEFUN ( bgp_evpn_default_originate ,
bgp_evpn_default_originate_cmd ,
" default-originate <ipv4 | ipv6> " ,
" originate a default route \n "
" ipv4 address family \n "
" ipv6 address family \n " )
{
afi_t afi = 0 ;
int idx_afi = 0 ;
struct bgp * bgp_vrf = VTY_GET_CONTEXT ( bgp ) ;
if ( ! bgp_vrf )
return CMD_WARNING ;
argv_find_and_parse_afi ( argv , argc , & idx_afi , & afi ) ;
2018-11-29 04:18:08 +01:00
evpn_process_default_originate_cmd ( bgp_vrf , afi , true ) ;
2018-02-16 02:20:27 +01:00
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_default_originate ,
no_bgp_evpn_default_originate_cmd ,
" no default-originate <ipv4 | ipv6> " ,
NO_STR
" withdraw a default route \n "
" ipv4 address family \n "
" ipv6 address family \n " )
{
afi_t afi = 0 ;
int idx_afi = 0 ;
struct bgp * bgp_vrf = VTY_GET_CONTEXT ( bgp ) ;
if ( ! bgp_vrf )
return CMD_WARNING ;
argv_find_and_parse_afi ( argv , argc , & idx_afi , & afi ) ;
2018-11-29 04:18:08 +01:00
evpn_process_default_originate_cmd ( bgp_vrf , afi , false ) ;
2018-02-16 02:20:27 +01:00
return CMD_SUCCESS ;
}
2018-11-01 16:28:08 +01:00
DEFPY ( dup_addr_detection ,
dup_addr_detection_cmd ,
" dup-addr-detection [max-moves (2-1000)$max_moves_val time (2-1800)$time_val] " ,
" Duplicate address detection \n "
2018-11-17 02:30:15 +01:00
" Max allowed moves before address detected as duplicate \n "
2018-11-01 16:28:08 +01:00
" Num of max allowed moves (2-1000) default 5 \n "
" Duplicate address detection time \n "
" Time in seconds (2-1800) default 180 \n " )
{
struct bgp * bgp_vrf = VTY_GET_CONTEXT ( bgp ) ;
if ( ! bgp_vrf )
return CMD_WARNING ;
2019-03-22 13:37:06 +01:00
if ( ! EVPN_ENABLED ( bgp_vrf ) ) {
2018-12-31 22:18:21 +01:00
vty_out ( vty ,
2019-03-06 19:15:10 +01:00
" This command is only supported under the EVPN VRF \n " ) ;
2018-12-31 22:18:21 +01:00
return CMD_WARNING ;
}
2018-11-01 16:28:08 +01:00
bgp_vrf - > evpn_info - > dup_addr_detect = true ;
if ( time_val )
bgp_vrf - > evpn_info - > dad_time = time_val ;
if ( max_moves_val )
bgp_vrf - > evpn_info - > dad_max_moves = max_moves_val ;
bgp_zebra_dup_addr_detection ( bgp_vrf ) ;
return CMD_SUCCESS ;
}
DEFPY ( dup_addr_detection_auto_recovery ,
dup_addr_detection_auto_recovery_cmd ,
" dup-addr-detection freeze <permanent |(30-3600)$freeze_time_val> " ,
" Duplicate address detection \n "
" Duplicate address detection freeze \n "
" Duplicate address detection permanent freeze \n "
" Duplicate address detection freeze time (30-3600) \n " )
{
struct bgp * bgp_vrf = VTY_GET_CONTEXT ( bgp ) ;
uint32_t freeze_time = freeze_time_val ;
if ( ! bgp_vrf )
return CMD_WARNING ;
2019-03-22 13:37:06 +01:00
if ( ! EVPN_ENABLED ( bgp_vrf ) ) {
2018-12-31 22:18:21 +01:00
vty_out ( vty ,
2019-03-06 19:15:10 +01:00
" This command is only supported under the EVPN VRF \n " ) ;
2018-12-31 22:18:21 +01:00
return CMD_WARNING ;
}
2018-11-01 16:28:08 +01:00
bgp_vrf - > evpn_info - > dup_addr_detect = true ;
bgp_vrf - > evpn_info - > dad_freeze = true ;
bgp_vrf - > evpn_info - > dad_freeze_time = freeze_time ;
bgp_zebra_dup_addr_detection ( bgp_vrf ) ;
return CMD_SUCCESS ;
}
DEFPY ( no_dup_addr_detection ,
no_dup_addr_detection_cmd ,
" no dup-addr-detection [max-moves (2-1000)$max_moves_val time (2-1800)$time_val | freeze <permanent$permanent_val | (30-3600)$freeze_time_val>] " ,
NO_STR
" Duplicate address detection \n "
2018-11-17 02:30:15 +01:00
" Max allowed moves before address detected as duplicate \n "
2018-11-01 16:28:08 +01:00
" Num of max allowed moves (2-1000) default 5 \n "
" Duplicate address detection time \n "
" Time in seconds (2-1800) default 180 \n "
" Duplicate address detection freeze \n "
" Duplicate address detection permanent freeze \n "
" Duplicate address detection freeze time (30-3600) \n " )
{
struct bgp * bgp_vrf = VTY_GET_CONTEXT ( bgp ) ;
uint32_t max_moves = ( uint32_t ) max_moves_val ;
uint32_t freeze_time = ( uint32_t ) freeze_time_val ;
if ( ! bgp_vrf )
return CMD_WARNING ;
2019-03-22 13:37:06 +01:00
if ( ! EVPN_ENABLED ( bgp_vrf ) ) {
2018-12-31 22:18:21 +01:00
vty_out ( vty ,
2019-03-06 19:15:10 +01:00
" This command is only supported under the EVPN VRF \n " ) ;
2018-12-31 22:18:21 +01:00
return CMD_WARNING ;
}
2018-11-01 16:28:08 +01:00
if ( argc = = 2 ) {
if ( ! bgp_vrf - > evpn_info - > dup_addr_detect )
return CMD_SUCCESS ;
/* Reset all parameters to default. */
bgp_vrf - > evpn_info - > dup_addr_detect = false ;
bgp_vrf - > evpn_info - > dad_time = EVPN_DAD_DEFAULT_TIME ;
bgp_vrf - > evpn_info - > dad_max_moves = EVPN_DAD_DEFAULT_MAX_MOVES ;
bgp_vrf - > evpn_info - > dad_freeze = false ;
bgp_vrf - > evpn_info - > dad_freeze_time = 0 ;
} else {
if ( max_moves ) {
if ( bgp_vrf - > evpn_info - > dad_max_moves ! = max_moves ) {
vty_out ( vty ,
" %% Value does not match with config \n " ) ;
return CMD_SUCCESS ;
}
bgp_vrf - > evpn_info - > dad_max_moves =
EVPN_DAD_DEFAULT_MAX_MOVES ;
}
if ( time_val ) {
if ( bgp_vrf - > evpn_info - > dad_time ! = time_val ) {
vty_out ( vty ,
" %% Value does not match with config \n " ) ;
return CMD_SUCCESS ;
}
bgp_vrf - > evpn_info - > dad_time = EVPN_DAD_DEFAULT_TIME ;
}
if ( freeze_time ) {
if ( bgp_vrf - > evpn_info - > dad_freeze_time
! = freeze_time ) {
vty_out ( vty ,
" %% Value does not match with config \n " ) ;
return CMD_SUCCESS ;
}
bgp_vrf - > evpn_info - > dad_freeze_time = 0 ;
bgp_vrf - > evpn_info - > dad_freeze = false ;
}
if ( permanent_val ) {
if ( bgp_vrf - > evpn_info - > dad_freeze_time ) {
vty_out ( vty ,
" %% Value does not match with config \n " ) ;
return CMD_SUCCESS ;
}
bgp_vrf - > evpn_info - > dad_freeze = false ;
}
}
bgp_zebra_dup_addr_detection ( bgp_vrf ) ;
return CMD_SUCCESS ;
}
2019-02-04 03:08:46 +01:00
DEFPY ( bgp_evpn_advertise_svi_ip ,
bgp_evpn_advertise_svi_ip_cmd ,
" [no$no] advertise-svi-ip " ,
NO_STR
" Advertise svi mac-ip routes in EVPN \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
if ( ! bgp )
return CMD_WARNING ;
if ( no )
evpn_set_advertise_svi_macip ( bgp , NULL , 0 ) ;
2021-04-08 09:25:22 +02:00
else {
if ( ! EVPN_ENABLED ( bgp ) ) {
vty_out ( vty ,
" This command is only supported under EVPN VRF \n " ) ;
return CMD_WARNING ;
}
2019-02-04 03:08:46 +01:00
evpn_set_advertise_svi_macip ( bgp , NULL , 1 ) ;
2021-04-08 09:25:22 +02:00
}
2019-02-04 03:08:46 +01:00
return CMD_SUCCESS ;
}
DEFPY ( bgp_evpn_advertise_svi_ip_vni ,
bgp_evpn_advertise_svi_ip_vni_cmd ,
" [no$no] advertise-svi-ip " ,
NO_STR
" Advertise svi mac-ip routes in EVPN for a VNI \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
VTY_DECLVAR_CONTEXT_SUB ( bgpevpn , vpn ) ;
if ( ! bgp )
return CMD_WARNING ;
if ( no )
evpn_set_advertise_svi_macip ( bgp , vpn , 0 ) ;
else
evpn_set_advertise_svi_macip ( bgp , vpn , 1 ) ;
return CMD_SUCCESS ;
}
2023-05-08 04:51:28 +02:00
DEFPY ( macvrf_soo_global , macvrf_soo_global_cmd ,
" mac-vrf soo ASN:NN_OR_IP-ADDRESS:NN$soo " ,
" EVPN MAC-VRF \n "
" Site-of-Origin extended community \n "
" VPN extended community \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
struct bgp * bgp_evpn = bgp_get_evpn ( ) ;
struct ecommunity * ecomm_soo ;
if ( ! bgp | | ! bgp_evpn | | ! bgp_evpn - > evpn_info )
return CMD_WARNING ;
if ( bgp ! = bgp_evpn ) {
vty_out ( vty ,
" %% Please configure MAC-VRF SoO in the EVPN underlay: %s \n " ,
bgp_evpn - > name_pretty ) ;
return CMD_WARNING_CONFIG_FAILED ;
}
ecomm_soo = ecommunity_str2com ( soo , ECOMMUNITY_SITE_ORIGIN , 0 ) ;
if ( ! ecomm_soo ) {
vty_out ( vty , " %% Malformed SoO extended community \n " ) ;
2023-03-31 19:13:01 +02:00
return CMD_WARNING_CONFIG_FAILED ;
2023-05-08 04:51:28 +02:00
}
ecommunity_str ( ecomm_soo ) ;
bgp_evpn_handle_global_macvrf_soo_change ( bgp_evpn , ecomm_soo ) ;
return CMD_SUCCESS ;
}
DEFPY ( no_macvrf_soo_global , no_macvrf_soo_global_cmd ,
" no mac-vrf soo [ASN:NN_OR_IP-ADDRESS:NN$soo] " ,
NO_STR
" EVPN MAC-VRF \n "
" Site-of-Origin extended community \n "
" VPN extended community \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
struct bgp * bgp_evpn = bgp_get_evpn ( ) ;
if ( ! bgp | | ! bgp_evpn | | ! bgp_evpn - > evpn_info )
return CMD_WARNING ;
if ( bgp_evpn )
bgp_evpn_handle_global_macvrf_soo_change ( bgp_evpn ,
NULL /* new_soo */ ) ;
return CMD_SUCCESS ;
}
2018-03-15 11:29:50 +01:00
DEFUN_HIDDEN ( bgp_evpn_advertise_vni_subnet ,
bgp_evpn_advertise_vni_subnet_cmd ,
" advertise-subnet " ,
" Advertise the subnet corresponding to VNI \n " )
2017-11-20 06:47:04 +01:00
{
struct bgp * bgp_vrf = NULL ;
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
VTY_DECLVAR_CONTEXT_SUB ( bgpevpn , vpn ) ;
if ( ! bgp )
return CMD_WARNING ;
bgp_vrf = bgp_lookup_by_vrf_id ( vpn - > tenant_vrf_id ) ;
if ( ! bgp_vrf )
return CMD_WARNING ;
evpn_set_advertise_subnet ( bgp , vpn ) ;
return CMD_SUCCESS ;
}
2018-03-15 11:29:50 +01:00
DEFUN_HIDDEN ( no_bgp_evpn_advertise_vni_subnet ,
no_bgp_evpn_advertise_vni_subnet_cmd ,
" no advertise-subnet " ,
NO_STR
" Advertise All local VNIs \n " )
2017-11-20 06:47:04 +01:00
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
VTY_DECLVAR_CONTEXT_SUB ( bgpevpn , vpn ) ;
if ( ! bgp )
return CMD_WARNING ;
evpn_unset_advertise_subnet ( bgp , vpn ) ;
return CMD_SUCCESS ;
}
2017-10-27 23:15:45 +02:00
DEFUN ( bgp_evpn_advertise_type5 ,
bgp_evpn_advertise_type5_cmd ,
2022-06-13 11:18:36 +02:00
" advertise " BGP_AFI_CMD_STR " " BGP_SAFI_CMD_STR " [gateway-ip] [route-map RMAP_NAME] " ,
2017-10-27 23:15:45 +02:00
" Advertise prefix routes \n "
2017-11-05 02:24:02 +01:00
BGP_AFI_HELP_STR
2018-02-09 10:09:20 +01:00
BGP_SAFI_HELP_STR
2021-01-05 03:31:11 +01:00
" advertise gateway IP overlay index \n "
2018-02-09 10:09:20 +01:00
" route-map for filtering specific routes \n "
" Name of the route map \n " )
2017-10-27 23:15:45 +02:00
{
struct bgp * bgp_vrf = VTY_GET_CONTEXT ( bgp ) ; /* bgp vrf instance */
2017-11-05 02:24:02 +01:00
int idx_afi = 0 ;
int idx_safi = 0 ;
2018-02-09 10:09:20 +01:00
int idx_rmap = 0 ;
2017-11-05 02:24:02 +01:00
afi_t afi = 0 ;
safi_t safi = 0 ;
2018-02-09 10:09:20 +01:00
int ret = 0 ;
int rmap_changed = 0 ;
2021-01-05 03:31:11 +01:00
enum overlay_index_type oly = OVERLAY_INDEX_TYPE_NONE ;
int idx_oly = 0 ;
bool adv_flag_changed = false ;
2017-11-05 02:24:02 +01:00
argv_find_and_parse_afi ( argv , argc , & idx_afi , & afi ) ;
argv_find_and_parse_safi ( argv , argc , & idx_safi , & safi ) ;
2021-01-05 03:31:11 +01:00
argv_find_and_parse_oly_idx ( argv , argc , & idx_oly , & oly ) ;
2018-02-09 10:09:20 +01:00
ret = argv_find ( argv , argc , " route-map " , & idx_rmap ) ;
if ( ret ) {
if ( ! bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . name )
rmap_changed = 1 ;
else if ( strcmp ( argv [ idx_rmap + 1 ] - > arg ,
bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . name )
! = 0 )
rmap_changed = 1 ;
} else if ( bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . name ) {
rmap_changed = 1 ;
}
2017-11-05 02:24:02 +01:00
2018-03-17 00:25:29 +01:00
if ( ! ( afi = = AFI_IP | | afi = = AFI_IP6 ) ) {
2017-11-05 02:24:02 +01:00
vty_out ( vty ,
2022-04-01 09:21:07 +02:00
" %% Only ipv4 or ipv6 address families are supported \n " ) ;
2017-10-27 23:15:45 +02:00
return CMD_WARNING ;
}
2017-11-05 02:24:02 +01:00
if ( safi ! = SAFI_UNICAST ) {
vty_out ( vty ,
2022-04-01 09:21:07 +02:00
" %% Only ipv4 unicast or ipv6 unicast are supported \n " ) ;
2017-11-05 02:24:02 +01:00
return CMD_WARNING ;
}
2021-01-05 03:31:11 +01:00
if ( ( oly ! = OVERLAY_INDEX_TYPE_NONE )
& & ( oly ! = OVERLAY_INDEX_GATEWAY_IP ) ) {
2022-04-01 09:21:07 +02:00
vty_out ( vty , " %% Unknown overlay-index type specified \n " ) ;
2021-01-05 03:31:11 +01:00
return CMD_WARNING ;
}
2017-11-05 02:24:02 +01:00
if ( afi = = AFI_IP ) {
2021-01-05 03:31:11 +01:00
if ( ( ! CHECK_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST ) )
& & ( ! CHECK_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST_GW_IP ) ) ) {
/*
* this is the case for first time ever configuration
* adv ipv4 unicast is enabled for the first time .
* So no need to reset any flag
*/
if ( oly = = OVERLAY_INDEX_TYPE_NONE )
SET_FLAG (
bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST ) ;
else if ( oly = = OVERLAY_INDEX_GATEWAY_IP )
SET_FLAG (
bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST_GW_IP ) ;
} else if ( ( oly = = OVERLAY_INDEX_TYPE_NONE )
& & ( ! CHECK_FLAG (
bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST ) ) ) {
/*
* This is modify case from gateway - ip
* to no overlay index
*/
adv_flag_changed = true ;
UNSET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST_GW_IP ) ;
SET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST ) ;
} else if ( ( oly = = OVERLAY_INDEX_GATEWAY_IP )
& & ( ! CHECK_FLAG (
bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST_GW_IP ) ) ) {
/*
* This is modify case from no overlay index
* to gateway - ip
*/
adv_flag_changed = true ;
UNSET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST ) ;
SET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST_GW_IP ) ;
} else {
2017-10-27 23:15:45 +02:00
2021-01-05 03:31:11 +01:00
/*
* Command is issued with the same option
* ( no overlay index or gateway - ip ) which was
* already configured . So nothing to do .
* However , route - map may have been modified .
* check if route - map has been modified .
* If not , return an error
*/
if ( ! rmap_changed )
return CMD_WARNING ;
}
2017-10-27 23:15:45 +02:00
} else {
2021-01-05 03:31:11 +01:00
if ( ( ! CHECK_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST ) )
& & ( ! CHECK_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST_GW_IP ) ) ) {
/*
* this is the case for first time ever configuration
* adv ipv6 unicast is enabled for the first time .
* So no need to reset any flag
*/
if ( oly = = OVERLAY_INDEX_TYPE_NONE )
SET_FLAG (
bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST ) ;
else if ( oly = = OVERLAY_INDEX_GATEWAY_IP )
SET_FLAG (
bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST_GW_IP ) ;
} else if ( ( oly = = OVERLAY_INDEX_TYPE_NONE )
& & ( ! CHECK_FLAG (
bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST ) ) ) {
/*
* This is modify case from gateway - ip
* to no overlay index
*/
adv_flag_changed = true ;
UNSET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST_GW_IP ) ;
SET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST ) ;
} else if ( ( oly = = OVERLAY_INDEX_GATEWAY_IP )
& & ( ! CHECK_FLAG (
bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST_GW_IP ) ) ) {
/*
* This is modify case from no overlay index
* to gateway - ip
*/
adv_flag_changed = true ;
UNSET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST ) ;
SET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST_GW_IP ) ;
} else {
2017-10-27 23:15:45 +02:00
2021-01-05 03:31:11 +01:00
/*
* Command is issued with the same option
* ( no overlay index or gateway - ip ) which was
* already configured . So nothing to do .
* However , route - map may have been modified .
* check if route - map has been modified .
* If not , return an error
*/
if ( ! rmap_changed )
return CMD_WARNING ;
}
2018-02-09 10:09:20 +01:00
}
2021-01-05 03:31:11 +01:00
if ( ( rmap_changed ) | | ( adv_flag_changed ) ) {
/* If either of these are changed, then FRR needs to
* withdraw already advertised type5 routes .
*/
2018-02-09 10:09:20 +01:00
bgp_evpn_withdraw_type5_routes ( bgp_vrf , afi , safi ) ;
2021-01-05 03:31:11 +01:00
if ( rmap_changed ) {
if ( bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . name ) {
XFREE ( MTYPE_ROUTE_MAP_NAME ,
bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . name ) ;
route_map_counter_decrement (
2019-02-04 14:27:56 +01:00
bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . map ) ;
2021-01-05 03:31:11 +01:00
bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . name = NULL ;
bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . map = NULL ;
}
2017-10-27 23:15:45 +02:00
}
}
2018-02-09 10:09:20 +01:00
/* set the route-map for advertise command */
if ( ret & & argv [ idx_rmap + 1 ] - > arg ) {
bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . name =
XSTRDUP ( MTYPE_ROUTE_MAP_NAME , argv [ idx_rmap + 1 ] - > arg ) ;
bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . map =
route_map_lookup_by_name ( argv [ idx_rmap + 1 ] - > arg ) ;
2019-02-04 14:27:56 +01:00
route_map_counter_increment (
bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . map ) ;
2018-02-09 10:09:20 +01:00
}
/* advertise type-5 routes */
2019-03-05 19:40:26 +01:00
if ( advertise_type5_routes ( bgp_vrf , afi ) )
bgp_evpn_advertise_type5_routes ( bgp_vrf , afi , safi ) ;
2017-10-27 23:15:45 +02:00
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_advertise_type5 ,
no_bgp_evpn_advertise_type5_cmd ,
2021-03-03 18:56:27 +01:00
" no advertise " BGP_AFI_CMD_STR " " BGP_SAFI_CMD_STR " [route-map WORD] " ,
2017-10-27 23:15:45 +02:00
NO_STR
" Advertise prefix routes \n "
2017-11-05 02:24:02 +01:00
BGP_AFI_HELP_STR
2021-03-03 18:56:27 +01:00
BGP_SAFI_HELP_STR
" route-map for filtering specific routes \n "
" Name of the route map \n " )
2017-10-27 23:15:45 +02:00
{
struct bgp * bgp_vrf = VTY_GET_CONTEXT ( bgp ) ; /* bgp vrf instance */
2017-11-05 02:24:02 +01:00
int idx_afi = 0 ;
int idx_safi = 0 ;
afi_t afi = 0 ;
safi_t safi = 0 ;
2022-08-15 17:24:42 +02:00
if ( ! bgp_vrf )
return CMD_WARNING ;
2017-11-05 02:24:02 +01:00
argv_find_and_parse_afi ( argv , argc , & idx_afi , & afi ) ;
argv_find_and_parse_safi ( argv , argc , & idx_safi , & safi ) ;
2018-02-28 03:07:23 +01:00
if ( ! ( afi = = AFI_IP | | afi = = AFI_IP6 ) ) {
2017-11-05 02:24:02 +01:00
vty_out ( vty ,
2022-04-01 09:21:07 +02:00
" %% Only ipv4 or ipv6 address families are supported \n " ) ;
2017-11-05 02:24:02 +01:00
return CMD_WARNING ;
}
if ( safi ! = SAFI_UNICAST ) {
vty_out ( vty ,
2022-04-01 09:21:07 +02:00
" %% Only ipv4 unicast or ipv6 unicast are supported \n " ) ;
2017-10-27 23:15:45 +02:00
return CMD_WARNING ;
}
2017-11-05 02:24:02 +01:00
if ( afi = = AFI_IP ) {
2017-10-27 23:15:45 +02:00
2018-02-20 09:23:06 +01:00
/* if we are not advertising ipv4 prefix as type-5
2017-12-27 20:47:10 +01:00
* nothing to do
*/
2021-01-05 03:31:11 +01:00
if ( ( CHECK_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST ) ) | |
( CHECK_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST_GW_IP ) ) ) {
2017-11-05 02:24:02 +01:00
bgp_evpn_withdraw_type5_routes ( bgp_vrf , afi , safi ) ;
2018-02-20 09:46:22 +01:00
UNSET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
2021-01-05 03:31:11 +01:00
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST ) ;
UNSET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST_GW_IP ) ;
2017-10-27 23:15:45 +02:00
}
} else {
2018-02-20 09:23:06 +01:00
/* if we are not advertising ipv6 prefix as type-5
2017-12-27 20:47:10 +01:00
* nothing to do
*/
2021-01-05 03:31:11 +01:00
if ( ( CHECK_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST ) ) | |
( CHECK_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST_GW_IP ) ) ) {
2017-11-05 02:24:02 +01:00
bgp_evpn_withdraw_type5_routes ( bgp_vrf , afi , safi ) ;
2018-04-10 12:31:05 +02:00
UNSET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
2021-01-05 03:31:11 +01:00
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST ) ;
UNSET_FLAG ( bgp_vrf - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST_GW_IP ) ;
2017-10-27 23:15:45 +02:00
}
}
2018-02-09 10:09:20 +01:00
/* clear the route-map information for advertise ipv4/ipv6 unicast */
if ( bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . name ) {
XFREE ( MTYPE_ROUTE_MAP_NAME ,
bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . name ) ;
bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . name = NULL ;
bgp_vrf - > adv_cmd_rmap [ afi ] [ safi ] . map = NULL ;
}
2017-10-27 23:15:45 +02:00
return CMD_SUCCESS ;
}
2020-05-19 00:55:39 +02:00
DEFPY ( bgp_evpn_use_es_l3nhg ,
bgp_evpn_use_es_l3nhg_cmd ,
" [no$no] use-es-l3nhg " ,
NO_STR
" use L3 nexthop group for host routes with ES destination \n " )
{
bgp_mh_info - > host_routes_use_l3nhg = no ? false : true ;
return CMD_SUCCESS ;
}
2020-08-26 03:31:29 +02:00
DEFPY ( bgp_evpn_ead_evi_rx_disable ,
bgp_evpn_ead_evi_rx_disable_cmd ,
" [no$no] disable-ead-evi-rx " ,
NO_STR
" Activate PE on EAD-ES even if EAD-EVI is not received \n " )
{
2021-03-10 01:37:52 +01:00
bool ead_evi_rx = no ? true : false ;
if ( ead_evi_rx ! = bgp_mh_info - > ead_evi_rx ) {
bgp_mh_info - > ead_evi_rx = ead_evi_rx ;
bgp_evpn_switch_ead_evi_rx ( ) ;
}
2020-08-26 03:31:29 +02:00
return CMD_SUCCESS ;
}
DEFPY ( bgp_evpn_ead_evi_tx_disable ,
bgp_evpn_ead_evi_tx_disable_cmd ,
" [no$no] disable-ead-evi-tx " ,
NO_STR
" Don't advertise EAD-EVI for local ESs \n " )
{
bgp_mh_info - > ead_evi_tx = no ? true : false ;
return CMD_SUCCESS ;
}
2021-05-12 00:26:29 +02:00
DEFPY ( bgp_evpn_enable_resolve_overlay_index ,
bgp_evpn_enable_resolve_overlay_index_cmd ,
" [no$no] enable-resolve-overlay-index " ,
NO_STR
" Enable Recursive Resolution of type-5 route overlay index \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
if ( bgp ! = bgp_get_evpn ( ) ) {
vty_out ( vty , " This command is only supported under EVPN VRF \n " ) ;
return CMD_WARNING ;
}
bgp_evpn_set_unset_resolve_overlay_index ( bgp , no ? false : true ) ;
return CMD_SUCCESS ;
}
2019-04-18 09:17:57 +02:00
DEFPY ( bgp_evpn_advertise_pip_ip_mac ,
bgp_evpn_advertise_pip_ip_mac_cmd ,
" [no$no] advertise-pip [ip <A.B.C.D> [mac <X:X:X:X:X:X|X:X:X:X:X:X/M>]] " ,
NO_STR
" evpn system primary IP \n "
IP_STR
" ip address \n "
MAC_STR MAC_STR MAC_STR )
{
struct bgp * bgp_vrf = VTY_GET_CONTEXT ( bgp ) ; /* bgp vrf instance */
struct bgp * bgp_evpn = NULL ;
2023-04-21 14:04:06 +02:00
if ( ! bgp_vrf | | EVPN_ENABLED ( bgp_vrf ) ) {
2019-04-18 09:17:57 +02:00
vty_out ( vty ,
" This command is supported under L3VNI BGP EVPN VRF \n " ) ;
2019-10-28 23:05:05 +01:00
return CMD_WARNING_CONFIG_FAILED ;
2019-04-18 09:17:57 +02:00
}
bgp_evpn = bgp_get_evpn ( ) ;
if ( ! no ) {
/* pip is already enabled */
if ( argc = = 1 & & bgp_vrf - > evpn_info - > advertise_pip )
return CMD_SUCCESS ;
bgp_vrf - > evpn_info - > advertise_pip = true ;
if ( ip . s_addr ! = INADDR_ANY ) {
/* Already configured with same IP */
if ( IPV4_ADDR_SAME ( & ip ,
& bgp_vrf - > evpn_info - > pip_ip_static ) )
return CMD_SUCCESS ;
bgp_vrf - > evpn_info - > pip_ip_static = ip ;
bgp_vrf - > evpn_info - > pip_ip = ip ;
} else {
bgp_vrf - > evpn_info - > pip_ip_static . s_addr
= INADDR_ANY ;
/* default instance router-id assignemt */
if ( bgp_evpn )
bgp_vrf - > evpn_info - > pip_ip =
bgp_evpn - > router_id ;
}
/* parse sys mac */
if ( ! is_zero_mac ( & mac - > eth_addr ) ) {
/* Already configured with same MAC */
if ( memcmp ( & bgp_vrf - > evpn_info - > pip_rmac_static ,
& mac - > eth_addr , ETH_ALEN ) = = 0 )
return CMD_SUCCESS ;
memcpy ( & bgp_vrf - > evpn_info - > pip_rmac_static ,
& mac - > eth_addr , ETH_ALEN ) ;
memcpy ( & bgp_vrf - > evpn_info - > pip_rmac ,
& bgp_vrf - > evpn_info - > pip_rmac_static ,
ETH_ALEN ) ;
} else {
/* Copy zebra sys mac */
if ( ! is_zero_mac ( & bgp_vrf - > evpn_info - > pip_rmac_zebra ) )
memcpy ( & bgp_vrf - > evpn_info - > pip_rmac ,
& bgp_vrf - > evpn_info - > pip_rmac_zebra ,
ETH_ALEN ) ;
}
} else {
if ( argc = = 2 ) {
if ( ! bgp_vrf - > evpn_info - > advertise_pip )
return CMD_SUCCESS ;
/* Disable PIP feature */
bgp_vrf - > evpn_info - > advertise_pip = false ;
/* copy anycast mac */
memcpy ( & bgp_vrf - > evpn_info - > pip_rmac ,
& bgp_vrf - > rmac , ETH_ALEN ) ;
} else {
/* remove MAC-IP option retain PIP knob. */
if ( ( ip . s_addr ! = INADDR_ANY ) & &
! IPV4_ADDR_SAME ( & ip ,
& bgp_vrf - > evpn_info - > pip_ip_static ) ) {
vty_out ( vty ,
" %% BGP EVPN PIP IP does not match \n " ) ;
return CMD_WARNING_CONFIG_FAILED ;
}
if ( ! is_zero_mac ( & mac - > eth_addr ) & &
memcmp ( & bgp_vrf - > evpn_info - > pip_rmac_static ,
& mac - > eth_addr , ETH_ALEN ) ! = 0 ) {
vty_out ( vty ,
" %% BGP EVPN PIP MAC does not match \n " ) ;
return CMD_WARNING_CONFIG_FAILED ;
}
/* pip_rmac can carry vrr_rmac reset only if it matches
* with static value .
*/
if ( memcmp ( & bgp_vrf - > evpn_info - > pip_rmac ,
& bgp_vrf - > evpn_info - > pip_rmac_static ,
ETH_ALEN ) = = 0 ) {
/* Copy zebra sys mac */
if ( ! is_zero_mac (
& bgp_vrf - > evpn_info - > pip_rmac_zebra ) )
memcpy ( & bgp_vrf - > evpn_info - > pip_rmac ,
& bgp_vrf - > evpn_info - > pip_rmac_zebra ,
ETH_ALEN ) ;
else {
/* copy anycast mac */
memcpy ( & bgp_vrf - > evpn_info - > pip_rmac ,
& bgp_vrf - > rmac , ETH_ALEN ) ;
}
}
}
/* reset user configured sys MAC */
memset ( & bgp_vrf - > evpn_info - > pip_rmac_static , 0 , ETH_ALEN ) ;
/* reset user configured sys IP */
bgp_vrf - > evpn_info - > pip_ip_static . s_addr = INADDR_ANY ;
/* Assign default PIP IP (bgp instance router-id) */
if ( bgp_evpn )
bgp_vrf - > evpn_info - > pip_ip = bgp_evpn - > router_id ;
else
bgp_vrf - > evpn_info - > pip_ip . s_addr = INADDR_ANY ;
}
if ( is_evpn_enabled ( ) ) {
2019-08-09 03:58:03 +02:00
struct listnode * node = NULL ;
struct bgpevpn * vpn = NULL ;
2020-07-27 13:10:41 +02:00
/*
* At this point if bgp_evpn is NULL and evpn is enabled
* something stupid has gone wrong
*/
assert ( bgp_evpn ) ;
2019-04-18 09:17:57 +02:00
update_advertise_vrf_routes ( bgp_vrf ) ;
2019-08-09 03:58:03 +02:00
/* Update (svi) type-2 routes */
for ( ALL_LIST_ELEMENTS_RO ( bgp_vrf - > l2vnis , node , vpn ) ) {
if ( ! bgp_evpn_is_svi_macip_enabled ( vpn ) )
continue ;
update_routes_for_vni ( bgp_evpn , vpn ) ;
}
2019-04-18 09:17:57 +02:00
}
return CMD_SUCCESS ;
}
2017-06-08 07:43:19 +02:00
/*
* Display VNI information - for all or a specific VNI
*/
2017-07-21 02:42:20 +02:00
DEFUN ( show_bgp_l2vpn_evpn_vni ,
show_bgp_l2vpn_evpn_vni_cmd ,
2018-10-19 02:44:52 +02:00
" show bgp l2vpn evpn vni [ " CMD_VNI_RANGE " ] [json] " ,
2017-07-21 02:42:20 +02:00
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Show VNI \n "
" VNI number \n "
JSON_STR )
2017-05-15 23:53:31 +02:00
{
2019-03-06 19:10:02 +01:00
struct bgp * bgp_evpn ;
2017-06-08 07:43:19 +02:00
vni_t vni ;
int idx = 0 ;
2018-08-29 14:19:54 +02:00
bool uj = false ;
2017-07-21 02:42:20 +02:00
json_object * json = NULL ;
2018-03-27 21:13:34 +02:00
uint32_t num_l2vnis = 0 ;
uint32_t num_l3vnis = 0 ;
2017-12-07 17:28:04 +01:00
uint32_t num_vnis = 0 ;
2017-11-15 10:01:00 +01:00
struct listnode * node = NULL ;
struct bgp * bgp_temp = NULL ;
2017-07-21 02:42:20 +02:00
uj = use_json ( argc , argv ) ;
2017-05-15 23:53:31 +02:00
2019-03-06 19:10:02 +01:00
bgp_evpn = bgp_get_evpn ( ) ;
if ( ! bgp_evpn )
2017-05-15 23:53:31 +02:00
return CMD_WARNING ;
2017-06-08 07:43:19 +02:00
if ( ! argv_find ( argv , argc , " evpn " , & idx ) )
return CMD_WARNING ;
2017-07-21 02:42:20 +02:00
if ( uj )
json = json_object_new_object ( ) ;
2017-06-28 10:51:10 +02:00
2017-07-21 02:42:20 +02:00
if ( ( uj & & argc = = ( ( idx + 1 ) + 2 ) ) | | ( ! uj & & argc = = ( idx + 1 ) + 1 ) ) {
2017-11-15 10:01:00 +01:00
2019-03-06 19:10:02 +01:00
num_l2vnis = hashcount ( bgp_evpn - > vnihash ) ;
2017-11-15 10:01:00 +01:00
for ( ALL_LIST_ELEMENTS_RO ( bm - > bgp , node , bgp_temp ) ) {
if ( bgp_temp - > l3vni )
num_l3vnis + + ;
}
2017-12-07 17:28:04 +01:00
num_vnis = num_l2vnis + num_l3vnis ;
2017-07-21 02:42:20 +02:00
if ( uj ) {
json_object_string_add ( json , " advertiseGatewayMacip " ,
2019-03-06 19:10:02 +01:00
bgp_evpn - > advertise_gw_macip
2017-07-21 02:42:20 +02:00
? " Enabled "
: " Disabled " ) ;
2020-02-11 20:35:53 +01:00
json_object_string_add ( json , " advertiseSviMacIp " ,
2019-09-20 00:15:45 +02:00
bgp_evpn - > evpn_info - > advertise_svi_macip
? " Enabled " : " Disabled " ) ;
2017-07-21 02:42:20 +02:00
json_object_string_add ( json , " advertiseAllVnis " ,
2017-11-02 11:38:01 +01:00
is_evpn_enabled ( ) ? " Enabled "
2017-07-21 02:42:20 +02:00
: " Disabled " ) ;
2018-10-05 01:20:12 +02:00
json_object_string_add (
json , " flooding " ,
2022-08-04 20:28:33 +02:00
bgp_evpn - > vxlan_flood_ctrl = =
VXLAN_FLOOD_HEAD_END_REPL
2018-10-05 01:20:12 +02:00
? " Head-end replication "
: " Disabled " ) ;
2022-08-04 20:28:33 +02:00
json_object_string_add (
json , " vxlanFlooding " ,
2022-08-03 00:16:14 +02:00
bgp_evpn - > vxlan_flood_ctrl = =
VXLAN_FLOOD_HEAD_END_REPL
? " Enabled "
2018-10-05 01:20:12 +02:00
: " Disabled " ) ;
2017-12-07 17:28:04 +01:00
json_object_int_add ( json , " numVnis " , num_vnis ) ;
2017-11-15 10:01:00 +01:00
json_object_int_add ( json , " numL2Vnis " , num_l2vnis ) ;
json_object_int_add ( json , " numL3Vnis " , num_l3vnis ) ;
2017-07-21 02:42:20 +02:00
} else {
vty_out ( vty , " Advertise Gateway Macip: %s \n " ,
2019-03-06 19:10:02 +01:00
bgp_evpn - > advertise_gw_macip ? " Enabled "
2017-07-21 02:42:20 +02:00
: " Disabled " ) ;
2019-02-04 03:08:46 +01:00
vty_out ( vty , " Advertise SVI Macip: %s \n " ,
2019-03-06 19:10:02 +01:00
bgp_evpn - > evpn_info - > advertise_svi_macip ? " Enabled "
2019-02-04 03:08:46 +01:00
: " Disabled " ) ;
2017-07-21 02:42:20 +02:00
vty_out ( vty , " Advertise All VNI flag: %s \n " ,
2017-11-02 11:38:01 +01:00
is_evpn_enabled ( ) ? " Enabled " : " Disabled " ) ;
2018-10-05 01:20:12 +02:00
vty_out ( vty , " BUM flooding: %s \n " ,
2022-08-04 20:28:33 +02:00
bgp_evpn - > vxlan_flood_ctrl = =
VXLAN_FLOOD_HEAD_END_REPL
2018-10-05 01:20:12 +02:00
? " Head-end replication "
: " Disabled " ) ;
2022-08-04 20:28:33 +02:00
vty_out ( vty , " VXLAN flooding: %s \n " ,
2022-08-03 00:16:14 +02:00
bgp_evpn - > vxlan_flood_ctrl = =
VXLAN_FLOOD_HEAD_END_REPL
? " Enabled "
2018-10-05 01:20:12 +02:00
: " Disabled " ) ;
2017-11-15 10:01:00 +01:00
vty_out ( vty , " Number of L2 VNIs: %u \n " , num_l2vnis ) ;
vty_out ( vty , " Number of L3 VNIs: %u \n " , num_l3vnis ) ;
2017-07-21 02:42:20 +02:00
}
2019-03-06 19:10:02 +01:00
evpn_show_all_vnis ( vty , bgp_evpn , json ) ;
2017-06-08 07:43:19 +02:00
} else {
2017-07-21 02:42:20 +02:00
int vni_idx = 0 ;
if ( ! argv_find ( argv , argc , " vni " , & vni_idx ) )
return CMD_WARNING ;
2017-06-08 07:43:19 +02:00
/* Display specific VNI */
2017-07-21 02:42:20 +02:00
vni = strtoul ( argv [ vni_idx + 1 ] - > arg , NULL , 10 ) ;
2019-03-06 19:10:02 +01:00
evpn_show_vni ( vty , bgp_evpn , vni , json ) ;
2017-07-21 02:42:20 +02:00
}
2021-11-25 23:02:37 +01:00
if ( uj )
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2017-05-15 23:53:31 +02:00
return CMD_SUCCESS ;
}
bgpd: EVPN route type-5 to type-2 recursive resolution using gateway IP
When EVPN prefix route with a gateway IP overlay index is imported into the IP
vrf at the ingress PE, BGP nexthop of this route is set to the gateway IP.
For this vrf route to be valid, following conditions must be met.
- Gateway IP nexthop of this route should be L3 reachable, i.e., this route
should be resolved in RIB.
- A remote MAC/IP route should be present for the gateway IP address in the
EVI(L2VPN table).
To check for the first condition, gateway IP is registered with nht (nexthop
tracking) to receive the reachability notifications for this IP from zebra RIB.
If the gateway IP is reachable, zebra sends the reachability information (i.e.,
nexthop interface) for the gateway IP.
This nexthop interface should be the SVI interface.
Now, to find out type-2 route corresponding to the gateway IP, we need to fetch
the VNI for the above SVI.
To do this VNI lookup effitiently, define a hashtable of struct bgpevpn with
svi_ifindex as key.
struct hash *vni_svi_hash;
An EVI instance is added to vni_svi_hash if its svi_ifindex is nonzero.
Using this hash, we obtain struct bgpevpn corresponding to the gateway IP.
For gateway IP overlay index recursive lookup, once we find the correct EVI, we
have to lookup its route table for a MAC/IP prefix. As we have to iterate the
entire route table for every lookup, this lookup is expensive. We can optimize
this lookup by adding all the remote IP addresses in a hash table.
Following hash table is defined for this purpose in struct bgpevpn
Struct hash *remote_ip_hash;
When a MAC/IP route is installed in the EVI table, it is also added to
remote_ip_hash.
It is possible to have multiple MAC/IP routes with the same IP address because
of host move scenarios. Thus, for every address addr in remote_ip_hash, we
maintain list of all the MAC/IP routes having addr as their IP address.
Following structure defines an address in remote_ip_hash.
struct evpn_remote_ip {
struct ipaddr addr;
struct list *macip_path_list;
};
A Boolean field is added to struct bgp_nexthop_cache to indicate that the
nexthop is EVPN gateway IP overlay index.
bool is_evpn_gwip_nexthop;
A flag BGP_NEXTHOP_EVPN_INCOMPLETE is added to struct bgp_nexthop_cache.
This flag is set when the gateway IP is L3 reachable but not yet resolved by a
MAC/IP route.
Following table explains the combination of L3 and L2 reachability w.r.t.
BGP_NEXTHOP_VALID and BGP_NEXTHOP_EVPN_INCOMPLETE flags
* | MACIP resolved | MACIP unresolved
*----------------|----------------|------------------
* L3 reachable | VALID = 1 | VALID = 0
* | INCOMPLETE = 0 | INCOMPLETE = 1
* ---------------|----------------|--------------------
* L3 unreachable | VALID = 0 | VALID = 0
* | INCOMPLETE = 0 | INCOMPLETE = 0
Procedure that we use to check if the gateway IP is resolvable by a MAC/IP
route:
- Find the EVI/L2VRF that belongs to the nexthop SVI using vni_svi_hash.
- Check if the gateway IP is present in remote_ip_hash in this EVI.
When the gateway IP is L3 reachable and it is also resolved by a MAC/IP route,
unset BGP_NEXTHOP_EVPN_INCOMPLETE flag and set BGP_NEXTHOP_VALID flag.
Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2021-01-11 12:51:56 +01:00
DEFUN_HIDDEN ( show_bgp_l2vpn_evpn_vni_remote_ip_hash ,
show_bgp_l2vpn_evpn_vni_remote_ip_hash_cmd ,
" show bgp l2vpn evpn vni remote-ip-hash " ,
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Show VNI \n "
" Remote IP hash \n " )
{
struct bgp * bgp_evpn ;
int idx = 0 ;
bgp_evpn = bgp_get_evpn ( ) ;
if ( ! bgp_evpn )
return CMD_WARNING ;
if ( ! argv_find ( argv , argc , " evpn " , & idx ) )
return CMD_WARNING ;
hash_iterate ( bgp_evpn - > vnihash ,
( void ( * ) ( struct hash_bucket * ,
void * ) ) bgp_evpn_show_remote_ip_hash ,
vty ) ;
return CMD_SUCCESS ;
}
DEFUN_HIDDEN ( show_bgp_l2vpn_evpn_vni_svi_hash ,
show_bgp_l2vpn_evpn_vni_svi_hash_cmd ,
" show bgp l2vpn evpn vni-svi-hash " ,
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Show vni-svi-hash \n " )
{
struct bgp * bgp_evpn ;
int idx = 0 ;
bgp_evpn = bgp_get_evpn ( ) ;
if ( ! bgp_evpn )
return CMD_WARNING ;
if ( ! argv_find ( argv , argc , " evpn " , & idx ) )
return CMD_WARNING ;
hash_iterate ( bgp_evpn - > vni_svi_hash ,
( void ( * ) ( struct hash_bucket * ,
void * ) ) bgp_evpn_show_vni_svi_hash ,
vty ) ;
return CMD_SUCCESS ;
}
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
DEFPY ( show_bgp_l2vpn_evpn_es_evi ,
show_bgp_l2vpn_evpn_es_evi_cmd ,
" show bgp l2vpn evpn es-evi [vni (1-16777215)$vni] [json$uj] [detail$detail] " ,
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" ES per EVI \n "
" VxLAN Network Identifier \n "
" VNI \n "
JSON_STR
" Detailed information \n " )
{
if ( vni )
bgp_evpn_es_evi_show_vni ( vty , vni , ! ! uj , ! ! detail ) ;
else
bgp_evpn_es_evi_show ( vty , ! ! uj , ! ! detail ) ;
return CMD_SUCCESS ;
}
DEFPY ( show_bgp_l2vpn_evpn_es ,
2018-04-14 00:01:12 +02:00
show_bgp_l2vpn_evpn_es_cmd ,
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
" show bgp l2vpn evpn es [NAME$esi_str|detail$detail] [json$uj] " ,
2018-04-14 00:01:12 +02:00
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
" Ethernet Segment \n "
" ES ID \n "
" Detailed information \n "
2018-06-04 23:51:07 +02:00
JSON_STR )
2018-04-14 00:01:12 +02:00
{
2018-06-29 02:57:36 +02:00
esi_t esi ;
2018-04-14 00:01:12 +02:00
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
if ( esi_str ) {
if ( ! str_to_esi ( esi_str , & esi ) ) {
2022-04-01 09:21:07 +02:00
vty_out ( vty , " %% Malformed ESI \n " ) ;
2018-04-14 00:01:12 +02:00
return CMD_WARNING ;
}
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
bgp_evpn_es_show_esi ( vty , & esi , uj ) ;
} else {
2018-04-14 00:01:12 +02:00
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
bgp_evpn_es_show ( vty , uj , ! ! detail ) ;
2018-04-14 00:01:12 +02:00
}
return CMD_SUCCESS ;
}
2020-05-09 04:49:33 +02:00
DEFPY ( show_bgp_l2vpn_evpn_es_vrf , show_bgp_l2vpn_evpn_es_vrf_cmd ,
" show bgp l2vpn evpn es-vrf [NAME$esi_str] [json$uj] " ,
SHOW_STR BGP_STR L2VPN_HELP_STR EVPN_HELP_STR
" Ethernet Segment \n "
" ES ID \n " JSON_STR )
{
esi_t esi ;
if ( esi_str ) {
if ( ! str_to_esi ( esi_str , & esi ) ) {
2022-04-01 09:21:07 +02:00
vty_out ( vty , " %% Malformed ESI \n " ) ;
2020-05-09 04:49:33 +02:00
return CMD_WARNING ;
}
bgp_evpn_es_vrf_show_esi ( vty , & esi , uj ) ;
} else {
bgp_evpn_es_vrf_show ( vty , uj , NULL ) ;
}
return CMD_SUCCESS ;
}
2020-09-12 19:36:01 +02:00
DEFPY ( show_bgp_l2vpn_evpn_nh ,
show_bgp_l2vpn_evpn_nh_cmd ,
" show bgp l2vpn evpn next-hops [json$uj] " ,
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Nexthops \n "
JSON_STR )
{
bgp_evpn_nh_show ( vty , uj ) ;
return CMD_SUCCESS ;
}
2017-06-08 07:43:19 +02:00
/*
* Display EVPN neighbor summary .
*/
2021-05-12 17:17:56 +02:00
DEFUN ( show_bgp_l2vpn_evpn_summary , show_bgp_l2vpn_evpn_summary_cmd ,
bgpd: add terse display option on show bgp summary
Add a terse option to show bgp summary to shorten output.
Do not show the following information about the BGP
instances: the number of RIB entries, the table version and the used memory.
The "terse" option can be used in combination with the "remote-as", "neighbor",
"failed" and "established" filters, and with the "wide" option as well.
Before patch:
ubuntu# show bgp summary remote-as 123456
IPv4 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 0
BGP table version 0
RIB entries 3, using 552 bytes of memory
Peers 5, using 3635 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
10.200.200.2 4 123456 81432 4 0 56092 0 00:00:13 572106 0 N/A
Displayed neighbors 1
Total number of neighbors 4
IPv6 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 0
BGP table version 0
RIB entries 3, using 552 bytes of memory
Peers 5, using 3635 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
% No matching neighbor
Total number of neighbors 5
After patch:
ubuntu# show bgp summary remote-as 123456 terse
IPv4 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 0
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
10.200.200.2 4 123456 81432 4 0 56092 0 00:00:13 572106 0 N/A
Displayed neighbors 1
Total number of neighbors 4
IPv6 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 1
% No matching neighbor
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2021-05-12 18:54:11 +02:00
" show bgp [vrf VRFNAME] l2vpn evpn summary [established|failed] [<neighbor <A.B.C.D|X:X::X:X|WORD>|remote-as <(1-4294967295)|internal|external>>] [terse] [wide] [json] " ,
2021-05-12 17:17:56 +02:00
SHOW_STR BGP_STR
2018-02-19 09:57:54 +01:00
" bgp vrf \n "
2021-05-12 17:17:56 +02:00
" vrf name \n " L2VPN_HELP_STR EVPN_HELP_STR
2017-07-21 02:42:20 +02:00
" Summary of BGP neighbor status \n "
2020-07-09 15:00:27 +02:00
" Show only sessions in Established state \n "
bgpd: Add a new command to only show failed peerings
In a data center, having 32-128 peers is not uncommon. In such a situation, to find a
peer that has failed and why is several commands. This hinders both the automatability of
failure detection and the ease/speed with which the reason can be found. To simplify this
process of catching a failure and its cause quicker, this patch does the following:
1. Created a new function, bgp_show_failed_summary to display the
failed summary output for JSON and vty
2. Created a new function to display the reset code/subcode. This is now used in the
failed summary code and in the show neighbors code
3. Added a new variable failedPeers in all the JSON outputs, including the vanilla
"show bgp summary" family. This lists the failed session count.
4. Display peer, dropped count, estd count, uptime and the reason for failure as the
output of "show bgp summary failed" family of commands
5. Added three resset codes for the case where we're waiting for NHT, waiting for peer
IPv6 addr, waiting for VRF to init.
This also counts the case where only one peer has advertised an AFI/SAFI.
The new command has the optional keyword "failed" added to the classical summary command.
The changes affect only one existing output, that of "show [ip] bgp neighbors <nbr>". As
we track the lack of NHT resolution for a peer or the lack of knowing a peer IPv6 addr,
the output of that command will show a "waiting for NHT" etc. as the last reset reason.
This patch includes update to the documentation too.
Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
2019-08-31 18:24:49 +02:00
" Show only sessions not in Established state \n "
2021-05-12 17:17:56 +02:00
" Show only the specified neighbor session \n "
" Neighbor to display information about \n "
" Neighbor to display information about \n "
" Neighbor on BGP configured interface \n "
" Show only the specified remote AS sessions \n "
" AS number \n "
" Internal (iBGP) AS sessions \n "
" External (eBGP) AS sessions \n "
bgpd: add terse display option on show bgp summary
Add a terse option to show bgp summary to shorten output.
Do not show the following information about the BGP
instances: the number of RIB entries, the table version and the used memory.
The "terse" option can be used in combination with the "remote-as", "neighbor",
"failed" and "established" filters, and with the "wide" option as well.
Before patch:
ubuntu# show bgp summary remote-as 123456
IPv4 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 0
BGP table version 0
RIB entries 3, using 552 bytes of memory
Peers 5, using 3635 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
10.200.200.2 4 123456 81432 4 0 56092 0 00:00:13 572106 0 N/A
Displayed neighbors 1
Total number of neighbors 4
IPv6 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 0
BGP table version 0
RIB entries 3, using 552 bytes of memory
Peers 5, using 3635 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
% No matching neighbor
Total number of neighbors 5
After patch:
ubuntu# show bgp summary remote-as 123456 terse
IPv4 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 0
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
10.200.200.2 4 123456 81432 4 0 56092 0 00:00:13 572106 0 N/A
Displayed neighbors 1
Total number of neighbors 4
IPv6 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 1
% No matching neighbor
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2021-05-12 18:54:11 +02:00
" Shorten the information on BGP instances \n "
2021-05-12 17:17:56 +02:00
" Increase table width for longer output \n " JSON_STR )
2017-05-15 23:53:31 +02:00
{
2018-02-19 09:57:54 +01:00
int idx_vrf = 0 ;
2021-01-28 12:00:40 +01:00
int idx = 0 ;
2018-02-19 09:57:54 +01:00
char * vrf = NULL ;
2021-05-12 17:17:56 +02:00
char * neighbor = NULL ;
as_t as = 0 ; /* 0 means AS filter not set */
2024-07-04 22:07:01 +02:00
enum peer_asn_type as_type = AS_UNSPECIFIED ;
bgpd: add terse display option on show bgp summary
Add a terse option to show bgp summary to shorten output.
Do not show the following information about the BGP
instances: the number of RIB entries, the table version and the used memory.
The "terse" option can be used in combination with the "remote-as", "neighbor",
"failed" and "established" filters, and with the "wide" option as well.
Before patch:
ubuntu# show bgp summary remote-as 123456
IPv4 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 0
BGP table version 0
RIB entries 3, using 552 bytes of memory
Peers 5, using 3635 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
10.200.200.2 4 123456 81432 4 0 56092 0 00:00:13 572106 0 N/A
Displayed neighbors 1
Total number of neighbors 4
IPv6 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 0
BGP table version 0
RIB entries 3, using 552 bytes of memory
Peers 5, using 3635 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
% No matching neighbor
Total number of neighbors 5
After patch:
ubuntu# show bgp summary remote-as 123456 terse
IPv4 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 0
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
10.200.200.2 4 123456 81432 4 0 56092 0 00:00:13 572106 0 N/A
Displayed neighbors 1
Total number of neighbors 4
IPv6 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 1
% No matching neighbor
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2021-05-12 18:54:11 +02:00
uint16_t show_flags = 0 ;
2018-02-19 09:57:54 +01:00
if ( argv_find ( argv , argc , " vrf " , & idx_vrf ) )
vrf = argv [ + + idx_vrf ] - > arg ;
2020-07-09 15:00:27 +02:00
2021-01-28 12:00:40 +01:00
if ( argv_find ( argv , argc , " failed " , & idx ) )
SET_FLAG ( show_flags , BGP_SHOW_OPT_FAILED ) ;
if ( argv_find ( argv , argc , " established " , & idx ) )
SET_FLAG ( show_flags , BGP_SHOW_OPT_ESTABLISHED ) ;
2021-05-12 17:17:56 +02:00
if ( argv_find ( argv , argc , " neighbor " , & idx ) )
neighbor = argv [ idx + 1 ] - > arg ;
if ( argv_find ( argv , argc , " remote-as " , & idx ) ) {
if ( argv [ idx + 1 ] - > arg [ 0 ] = = ' i ' )
as_type = AS_INTERNAL ;
else if ( argv [ idx + 1 ] - > arg [ 0 ] = = ' e ' )
as_type = AS_EXTERNAL ;
else
as = ( as_t ) atoi ( argv [ idx + 1 ] - > arg ) ;
}
bgpd: add terse display option on show bgp summary
Add a terse option to show bgp summary to shorten output.
Do not show the following information about the BGP
instances: the number of RIB entries, the table version and the used memory.
The "terse" option can be used in combination with the "remote-as", "neighbor",
"failed" and "established" filters, and with the "wide" option as well.
Before patch:
ubuntu# show bgp summary remote-as 123456
IPv4 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 0
BGP table version 0
RIB entries 3, using 552 bytes of memory
Peers 5, using 3635 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
10.200.200.2 4 123456 81432 4 0 56092 0 00:00:13 572106 0 N/A
Displayed neighbors 1
Total number of neighbors 4
IPv6 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 0
BGP table version 0
RIB entries 3, using 552 bytes of memory
Peers 5, using 3635 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
% No matching neighbor
Total number of neighbors 5
After patch:
ubuntu# show bgp summary remote-as 123456 terse
IPv4 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 0
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
10.200.200.2 4 123456 81432 4 0 56092 0 00:00:13 572106 0 N/A
Displayed neighbors 1
Total number of neighbors 4
IPv6 Unicast Summary (VRF default):
BGP router identifier X.X.X.X, local AS number XXX vrf-id 1
% No matching neighbor
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2021-05-12 18:54:11 +02:00
if ( argv_find ( argv , argc , " terse " , & idx ) )
SET_FLAG ( show_flags , BGP_SHOW_OPT_TERSE ) ;
2021-01-28 12:00:40 +01:00
if ( argv_find ( argv , argc , " wide " , & idx ) )
SET_FLAG ( show_flags , BGP_SHOW_OPT_WIDE ) ;
if ( use_json ( argc , argv ) )
SET_FLAG ( show_flags , BGP_SHOW_OPT_JSON ) ;
2021-05-12 17:17:56 +02:00
return bgp_show_summary_vty ( vty , vrf , AFI_L2VPN , SAFI_EVPN , neighbor ,
as_type , as , show_flags ) ;
2017-05-15 23:53:31 +02:00
}
2021-10-26 23:55:54 +02:00
static int bgp_evpn_cli_parse_type_cmp ( int * type , const char * type_str )
{
if ( ( strncmp ( type_str , " ma " , 2 ) = = 0 ) | | ( strmatch ( type_str , " 2 " ) ) )
* type = BGP_EVPN_MAC_IP_ROUTE ;
else if ( ( strncmp ( type_str , " mu " , 2 ) = = 0 ) | | ( strmatch ( type_str , " 3 " ) ) )
* type = BGP_EVPN_IMET_ROUTE ;
else if ( ( strncmp ( type_str , " es " , 2 ) = = 0 ) | | ( strmatch ( type_str , " 4 " ) ) )
* type = BGP_EVPN_ES_ROUTE ;
else if ( ( strncmp ( type_str , " ea " , 2 ) = = 0 ) | | ( strmatch ( type_str , " 1 " ) ) )
* type = BGP_EVPN_AD_ROUTE ;
else if ( ( strncmp ( type_str , " p " , 1 ) = = 0 ) | | ( strmatch ( type_str , " 5 " ) ) )
* type = BGP_EVPN_IP_PREFIX_ROUTE ;
else
return - 1 ;
return 0 ;
}
2020-10-13 22:09:48 +02:00
int bgp_evpn_cli_parse_type ( int * type , struct cmd_token * * argv , int argc )
2020-10-07 22:23:09 +02:00
{
int type_idx = 0 ;
if ( argv_find ( argv , argc , " type " , & type_idx ) ) {
/* Specific type is requested */
2021-10-26 23:55:54 +02:00
if ( bgp_evpn_cli_parse_type_cmp ( type ,
argv [ type_idx + 1 ] - > arg ) ! = 0 )
2020-10-07 22:23:09 +02:00
return - 1 ;
}
return 0 ;
}
2017-06-08 07:43:19 +02:00
/*
* Display global EVPN routing table .
*/
2017-08-30 17:23:01 +02:00
DEFUN ( show_bgp_l2vpn_evpn_route ,
show_bgp_l2vpn_evpn_route_cmd ,
2023-02-14 16:54:59 +01:00
" show bgp l2vpn evpn route [detail] [type " EVPN_TYPE_ALL_LIST " ] [ " BGP_SELF_ORIG_CMD_STR " ] [json] " ,
2017-07-21 02:42:20 +02:00
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
2019-04-10 08:13:51 +02:00
" Display Detailed Information \n "
2020-10-06 21:58:12 +02:00
EVPN_TYPE_HELP_STR
2020-10-07 22:23:09 +02:00
EVPN_TYPE_ALL_LIST_HELP_STR
2023-02-14 16:54:59 +01:00
BGP_SELF_ORIG_HELP_STR
2017-07-21 02:42:20 +02:00
JSON_STR )
2017-05-15 23:53:31 +02:00
{
struct bgp * bgp ;
2019-04-10 08:13:51 +02:00
int detail = 0 ;
2017-05-15 23:53:31 +02:00
int type = 0 ;
2018-08-29 14:19:54 +02:00
bool uj = false ;
2023-02-14 16:54:59 +01:00
int arg_idx = 0 ;
bool self_orig = false ;
2017-07-21 02:42:20 +02:00
json_object * json = NULL ;
uj = use_json ( argc , argv ) ;
2017-05-15 23:53:31 +02:00
2019-03-06 19:15:10 +01:00
bgp = bgp_get_evpn ( ) ;
2017-05-15 23:53:31 +02:00
if ( ! bgp )
return CMD_WARNING ;
2023-11-02 02:46:08 +01:00
if ( uj ) {
2017-07-21 02:42:20 +02:00
json = json_object_new_object ( ) ;
2023-11-02 02:46:08 +01:00
vty_out ( vty , " { \n " ) ;
}
2017-06-08 07:43:19 +02:00
2020-10-13 22:09:48 +02:00
if ( bgp_evpn_cli_parse_type ( & type , argv , argc ) < 0 )
2020-10-07 22:23:09 +02:00
return CMD_WARNING ;
2017-05-15 23:53:31 +02:00
2019-04-10 08:13:51 +02:00
if ( argv_find ( argv , argc , " detail " , & detail ) )
detail = 1 ;
2023-02-14 16:54:59 +01:00
if ( argv_find ( argv , argc , BGP_SELF_ORIG_CMD_STR , & arg_idx ) )
self_orig = true ;
evpn_show_all_routes ( vty , bgp , type , json , detail , self_orig ) ;
2017-07-21 02:42:20 +02:00
2023-11-02 02:46:08 +01:00
if ( uj ) {
vty_out ( vty , " } \n " ) ;
json_object_free ( json ) ;
}
2023-01-24 07:18:24 +01:00
2017-05-15 23:53:31 +02:00
return CMD_SUCCESS ;
}
2017-06-08 07:43:19 +02:00
/*
* Display global EVPN routing table for specific RD .
*/
2017-08-30 17:23:01 +02:00
DEFUN ( show_bgp_l2vpn_evpn_route_rd ,
show_bgp_l2vpn_evpn_route_rd_cmd ,
2021-03-09 05:28:04 +01:00
" show bgp l2vpn evpn route rd <ASN:NN_OR_IP-ADDRESS:NN|all> [type " EVPN_TYPE_ALL_LIST " ] [json] " ,
2017-07-21 02:42:20 +02:00
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
EVPN_RT_DIST_HELP_STR
2021-03-30 17:27:07 +02:00
EVPN_ASN_IP_HELP_STR
2021-03-09 05:28:04 +01:00
" All VPN Route Distinguishers \n "
2020-10-06 21:58:12 +02:00
EVPN_TYPE_HELP_STR
2020-10-07 22:23:09 +02:00
EVPN_TYPE_ALL_LIST_HELP_STR
2017-07-21 02:42:20 +02:00
JSON_STR )
2017-05-15 23:53:31 +02:00
{
struct bgp * bgp ;
2022-05-12 09:23:28 +02:00
int ret = 0 ;
2017-05-15 23:53:31 +02:00
struct prefix_rd prd ;
int type = 0 ;
2018-08-29 14:19:54 +02:00
bool uj = false ;
2017-07-21 02:42:20 +02:00
json_object * json = NULL ;
2021-03-09 05:28:04 +01:00
int idx_ext_community = 0 ;
int rd_all = 0 ;
2017-05-15 23:53:31 +02:00
2019-03-06 19:15:10 +01:00
bgp = bgp_get_evpn ( ) ;
2017-05-15 23:53:31 +02:00
if ( ! bgp )
return CMD_WARNING ;
2017-07-21 02:42:20 +02:00
/* check if we need json output */
uj = use_json ( argc , argv ) ;
if ( uj )
json = json_object_new_object ( ) ;
2017-06-08 07:43:19 +02:00
2022-08-04 03:43:31 +02:00
if ( ! argv_find ( argv , argc , " all " , & rd_all ) ) {
2021-03-09 05:28:04 +01:00
/* get the RD */
2022-05-12 09:23:28 +02:00
if ( argv_find ( argv , argc , " ASN:NN_OR_IP-ADDRESS:NN " ,
& idx_ext_community ) ) {
ret = str2prefix_rd ( argv [ idx_ext_community ] - > arg , & prd ) ;
if ( ! ret ) {
vty_out ( vty ,
" %% Malformed Route Distinguisher \n " ) ;
return CMD_WARNING ;
}
2017-07-21 02:42:20 +02:00
}
2017-05-15 23:53:31 +02:00
}
2020-10-13 22:09:48 +02:00
if ( bgp_evpn_cli_parse_type ( & type , argv , argc ) < 0 )
2020-10-07 22:23:09 +02:00
return CMD_WARNING ;
2017-05-15 23:53:31 +02:00
2023-11-02 02:46:08 +01:00
if ( rd_all ) {
if ( uj )
vty_out ( vty , " { \n " ) ;
2023-02-14 16:54:59 +01:00
evpn_show_all_routes ( vty , bgp , type , json , 1 , false ) ;
2023-11-02 02:46:08 +01:00
if ( uj ) {
vty_out ( vty , " } \n " ) ;
json_object_free ( json ) ;
return CMD_SUCCESS ;
}
} else {
2021-03-09 05:28:04 +01:00
evpn_show_route_rd ( vty , bgp , & prd , type , json ) ;
2023-11-02 02:46:08 +01:00
}
2017-07-21 02:42:20 +02:00
2021-11-25 23:02:37 +01:00
if ( uj )
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2017-07-21 02:42:20 +02:00
2017-05-15 23:53:31 +02:00
return CMD_SUCCESS ;
}
2017-06-08 07:43:19 +02:00
/*
* Display global EVPN routing table for specific RD and MACIP .
*/
2017-07-21 02:42:20 +02:00
DEFUN ( show_bgp_l2vpn_evpn_route_rd_macip ,
show_bgp_l2vpn_evpn_route_rd_macip_cmd ,
2021-03-09 05:28:04 +01:00
" show bgp l2vpn evpn route rd <ASN:NN_OR_IP-ADDRESS:NN|all> mac WORD [ip WORD] [json] " ,
2017-07-21 02:42:20 +02:00
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
EVPN_RT_DIST_HELP_STR
2021-03-30 17:27:07 +02:00
EVPN_ASN_IP_HELP_STR
2021-03-09 05:28:04 +01:00
" All VPN Route Distinguishers \n "
2017-07-21 02:42:20 +02:00
" MAC \n "
" MAC address (e.g., 00:e0:ec:20:12:62) \n "
" IP \n "
" IP address (IPv4 or IPv6) \n "
JSON_STR )
{
2017-08-19 07:43:09 +02:00
struct bgp * bgp ;
2022-05-12 09:23:28 +02:00
int ret = 0 ;
2017-08-19 07:43:09 +02:00
struct prefix_rd prd ;
struct ethaddr mac ;
struct ipaddr ip ;
2021-03-09 05:28:04 +01:00
int idx_ext_community = 0 ;
2017-08-19 07:43:09 +02:00
int mac_idx = 0 ;
int ip_idx = 0 ;
2018-08-29 14:19:54 +02:00
bool uj = false ;
2017-08-19 07:43:09 +02:00
json_object * json = NULL ;
2021-03-09 05:28:04 +01:00
int rd_all = 0 ;
2017-07-21 02:42:20 +02:00
memset ( & mac , 0 , sizeof ( struct ethaddr ) ) ;
memset ( & ip , 0 , sizeof ( struct ipaddr ) ) ;
2017-07-17 14:03:14 +02:00
2019-03-06 19:15:10 +01:00
bgp = bgp_get_evpn ( ) ;
2017-05-15 23:53:31 +02:00
if ( ! bgp )
return CMD_WARNING ;
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
/* check if we need json output */
uj = use_json ( argc , argv ) ;
if ( uj )
json = json_object_new_object ( ) ;
2017-06-08 07:43:19 +02:00
2017-07-21 02:42:20 +02:00
/* get the prd */
2022-08-04 03:43:31 +02:00
if ( ! argv_find ( argv , argc , " all " , & rd_all ) ) {
2022-05-12 09:23:28 +02:00
if ( argv_find ( argv , argc , " ASN:NN_OR_IP-ADDRESS:NN " ,
& idx_ext_community ) ) {
ret = str2prefix_rd ( argv [ idx_ext_community ] - > arg , & prd ) ;
if ( ! ret ) {
vty_out ( vty ,
" %% Malformed Route Distinguisher \n " ) ;
return CMD_WARNING ;
}
2017-07-21 02:42:20 +02:00
}
2017-05-15 23:53:31 +02:00
}
2017-07-21 02:42:20 +02:00
/* get the mac */
if ( argv_find ( argv , argc , " mac " , & mac_idx ) ) {
if ( ! prefix_str2mac ( argv [ mac_idx + 1 ] - > arg , & mac ) ) {
vty_out ( vty , " %% Malformed MAC address \n " ) ;
return CMD_WARNING ;
}
2017-05-15 23:53:31 +02:00
}
2017-07-21 02:42:20 +02:00
/* get the ip if specified */
if ( argv_find ( argv , argc , " ip " , & ip_idx ) ) {
if ( str2ipaddr ( argv [ ip_idx + 1 ] - > arg , & ip ) ! = 0 ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Malformed IP address \n " ) ;
2017-05-15 23:53:31 +02:00
return CMD_WARNING ;
}
}
2017-07-17 14:03:14 +02:00
2021-03-09 05:28:04 +01:00
if ( rd_all )
evpn_show_route_rd_all_macip ( vty , bgp , & mac , & ip , json ) ;
else
evpn_show_route_rd_macip ( vty , bgp , & prd , & mac , & ip , json ) ;
2017-07-21 02:42:20 +02:00
2021-11-25 23:02:37 +01:00
if ( uj )
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2017-07-21 02:42:20 +02:00
2017-05-15 23:53:31 +02:00
return CMD_SUCCESS ;
}
2018-04-14 00:01:12 +02:00
/* Display per ESI routing table */
DEFUN ( show_bgp_l2vpn_evpn_route_esi ,
show_bgp_l2vpn_evpn_route_esi_cmd ,
" show bgp l2vpn evpn route esi ESI [json] " ,
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
2018-04-14 00:01:12 +02:00
" Ethernet Segment Identifier \n "
" ESI ID \n "
JSON_STR )
{
2018-08-29 14:19:54 +02:00
bool uj = false ;
2018-06-29 02:57:36 +02:00
esi_t esi ;
2018-04-14 00:01:12 +02:00
struct bgp * bgp = NULL ;
json_object * json = NULL ;
2018-06-29 02:57:36 +02:00
memset ( & esi , 0 , sizeof ( esi ) ) ;
2019-03-06 19:15:10 +01:00
bgp = bgp_get_evpn ( ) ;
2018-04-14 00:01:12 +02:00
if ( ! bgp )
return CMD_WARNING ;
uj = use_json ( argc , argv ) ;
if ( uj )
json = json_object_new_object ( ) ;
/* get the ESI - ESI-ID is at argv[6] */
if ( ! str_to_esi ( argv [ 6 ] - > arg , & esi ) ) {
vty_out ( vty , " %% Malformed ESI \n " ) ;
return CMD_WARNING ;
}
evpn_show_routes_esi ( vty , bgp , & esi , json ) ;
2021-11-25 23:02:37 +01:00
if ( uj )
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2018-04-14 00:01:12 +02:00
return CMD_SUCCESS ;
}
2017-06-08 07:43:19 +02:00
/*
* Display per - VNI EVPN routing table .
*/
2017-07-21 02:42:20 +02:00
DEFUN ( show_bgp_l2vpn_evpn_route_vni , show_bgp_l2vpn_evpn_route_vni_cmd ,
2020-10-07 22:23:09 +02:00
" show bgp l2vpn evpn route vni " CMD_VNI_RANGE " [<type <ead|1|macip|2|multicast|3> | vtep A.B.C.D>] [json] " ,
2017-07-21 02:42:20 +02:00
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
2017-07-21 02:42:20 +02:00
" VXLAN Network Identifier \n "
" VNI number \n "
2020-10-06 21:58:12 +02:00
EVPN_TYPE_HELP_STR
EVPN_TYPE_1_HELP_STR
2020-10-07 22:23:09 +02:00
EVPN_TYPE_1_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_TYPE_2_HELP_STR
2020-10-07 22:23:09 +02:00
EVPN_TYPE_2_HELP_STR
EVPN_TYPE_3_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_TYPE_3_HELP_STR
2017-07-21 02:42:20 +02:00
" Remote VTEP \n "
" Remote VTEP IP address \n "
JSON_STR )
2017-05-15 23:53:31 +02:00
{
vni_t vni ;
struct bgp * bgp ;
struct in_addr vtep_ip ;
int type = 0 ;
2017-06-08 07:43:19 +02:00
int idx = 0 ;
2020-10-07 22:23:09 +02:00
int vtep_idx = 0 ;
2018-08-29 14:19:54 +02:00
bool uj = false ;
2017-07-21 02:42:20 +02:00
json_object * json = NULL ;
2017-07-17 14:03:14 +02:00
2019-03-06 19:15:10 +01:00
bgp = bgp_get_evpn ( ) ;
2017-05-15 23:53:31 +02:00
if ( ! bgp )
return CMD_WARNING ;
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
/* check if we need json output */
uj = use_json ( argc , argv ) ;
if ( uj )
json = json_object_new_object ( ) ;
2017-06-08 07:43:19 +02:00
if ( ! argv_find ( argv , argc , " evpn " , & idx ) )
return CMD_WARNING ;
2017-05-15 23:53:31 +02:00
vtep_ip . s_addr = 0 ;
2017-07-17 14:03:14 +02:00
2017-06-08 07:43:19 +02:00
vni = strtoul ( argv [ idx + 3 ] - > arg , NULL , 10 ) ;
2017-07-17 14:03:14 +02:00
2020-10-13 22:09:48 +02:00
if ( bgp_evpn_cli_parse_type ( & type , argv , argc ) < 0 )
2020-10-07 22:23:09 +02:00
return CMD_WARNING ;
if ( argv_find ( argv , argc , " vtep " , & vtep_idx ) ) {
if ( ! inet_aton ( argv [ vtep_idx + 1 ] - > arg , & vtep_ip ) ) {
vty_out ( vty , " %% Malformed VTEP IP address \n " ) ;
2017-05-15 23:53:31 +02:00
return CMD_WARNING ;
2020-10-07 22:23:09 +02:00
}
2017-05-15 23:53:31 +02:00
}
2017-07-17 14:03:14 +02:00
2021-10-26 23:55:54 +02:00
evpn_show_routes_vni ( vty , bgp , vni , type , false , vtep_ip , json ) ;
2017-07-21 02:42:20 +02:00
2021-11-25 23:02:37 +01:00
if ( uj )
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2017-07-21 02:42:20 +02:00
2017-05-15 23:53:31 +02:00
return CMD_SUCCESS ;
}
2017-06-08 07:43:19 +02:00
/*
* Display per - VNI EVPN routing table for specific MACIP .
*/
2017-07-21 02:42:20 +02:00
DEFUN ( show_bgp_l2vpn_evpn_route_vni_macip ,
show_bgp_l2vpn_evpn_route_vni_macip_cmd ,
2018-10-19 02:44:52 +02:00
" show bgp l2vpn evpn route vni " CMD_VNI_RANGE " mac WORD [ip WORD] [json] " ,
2017-07-21 02:42:20 +02:00
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
2017-07-21 02:42:20 +02:00
" VXLAN Network Identifier \n "
" VNI number \n "
" MAC \n "
" MAC address (e.g., 00:e0:ec:20:12:62) \n "
" IP \n "
" IP address (IPv4 or IPv6) \n "
JSON_STR )
2017-05-15 23:53:31 +02:00
{
vni_t vni ;
struct bgp * bgp ;
struct ethaddr mac ;
struct ipaddr ip ;
2017-06-08 07:43:19 +02:00
int idx = 0 ;
2018-08-29 14:19:54 +02:00
bool uj = false ;
2017-07-21 02:42:20 +02:00
json_object * json = NULL ;
2017-07-17 14:03:14 +02:00
2019-03-06 19:15:10 +01:00
bgp = bgp_get_evpn ( ) ;
2017-05-15 23:53:31 +02:00
if ( ! bgp )
return CMD_WARNING ;
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
/* check if we need json output */
uj = use_json ( argc , argv ) ;
if ( uj )
json = json_object_new_object ( ) ;
2017-06-08 07:43:19 +02:00
if ( ! argv_find ( argv , argc , " evpn " , & idx ) )
return CMD_WARNING ;
2017-07-21 02:42:20 +02:00
/* get the VNI */
2017-06-08 07:43:19 +02:00
vni = strtoul ( argv [ idx + 3 ] - > arg , NULL , 10 ) ;
2017-07-21 02:42:20 +02:00
/* get the mac */
2017-06-08 07:43:19 +02:00
if ( ! prefix_str2mac ( argv [ idx + 5 ] - > arg , & mac ) ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Malformed MAC address \n " ) ;
2017-05-15 23:53:31 +02:00
return CMD_WARNING ;
}
2017-07-21 02:42:20 +02:00
/* get the ip */
2017-05-15 23:53:31 +02:00
memset ( & ip , 0 , sizeof ( ip ) ) ;
2017-07-21 02:42:20 +02:00
if ( ( ! uj & & ( ( argc = = ( idx + 1 + 7 ) ) & & argv [ idx + 7 ] - > arg ! = NULL ) )
| | ( uj
& & ( ( argc = = ( idx + 1 + 8 ) ) & & argv [ idx + 7 ] - > arg ! = NULL ) ) ) {
2017-06-08 07:43:19 +02:00
if ( str2ipaddr ( argv [ idx + 7 ] - > arg , & ip ) ! = 0 ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Malformed IP address \n " ) ;
2017-05-15 23:53:31 +02:00
return CMD_WARNING ;
}
}
2017-07-17 14:03:14 +02:00
2017-07-21 02:42:20 +02:00
evpn_show_route_vni_macip ( vty , bgp , vni , & mac , & ip , json ) ;
2021-11-25 23:02:37 +01:00
if ( uj )
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2017-07-21 02:42:20 +02:00
2017-05-15 23:53:31 +02:00
return CMD_SUCCESS ;
}
2017-06-08 07:43:19 +02:00
/*
* Display per - VNI EVPN routing table for specific multicast IP ( remote VTEP ) .
*/
2017-07-21 02:42:20 +02:00
DEFUN ( show_bgp_l2vpn_evpn_route_vni_multicast ,
show_bgp_l2vpn_evpn_route_vni_multicast_cmd ,
2018-10-19 02:44:52 +02:00
" show bgp l2vpn evpn route vni " CMD_VNI_RANGE " multicast A.B.C.D [json] " ,
2017-07-21 02:42:20 +02:00
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
2017-07-21 02:42:20 +02:00
" VXLAN Network Identifier \n "
" VNI number \n "
2020-10-06 21:58:12 +02:00
EVPN_TYPE_3_HELP_STR
2017-07-21 02:42:20 +02:00
" Originating Router IP address \n "
JSON_STR )
2017-05-15 23:53:31 +02:00
{
vni_t vni ;
struct bgp * bgp ;
int ret ;
struct in_addr orig_ip ;
2017-06-08 07:43:19 +02:00
int idx = 0 ;
2018-08-29 14:19:54 +02:00
bool uj = false ;
2017-07-21 02:42:20 +02:00
json_object * json = NULL ;
2017-05-15 23:53:31 +02:00
2019-03-06 19:15:10 +01:00
bgp = bgp_get_evpn ( ) ;
2017-05-15 23:53:31 +02:00
if ( ! bgp )
return CMD_WARNING ;
2017-07-21 02:42:20 +02:00
/* check if we need json output */
uj = use_json ( argc , argv ) ;
if ( uj )
json = json_object_new_object ( ) ;
2017-06-08 07:43:19 +02:00
if ( ! argv_find ( argv , argc , " evpn " , & idx ) )
return CMD_WARNING ;
2017-07-21 02:42:20 +02:00
/* get the VNI */
2017-06-08 07:43:19 +02:00
vni = strtoul ( argv [ idx + 3 ] - > arg , NULL , 10 ) ;
2017-07-21 02:42:20 +02:00
/* get the ip */
2017-06-08 07:43:19 +02:00
ret = inet_aton ( argv [ idx + 5 ] - > arg , & orig_ip ) ;
2017-05-15 23:53:31 +02:00
if ( ! ret ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Malformed Originating Router IP address \n " ) ;
2017-05-15 23:53:31 +02:00
return CMD_WARNING ;
}
2017-07-21 02:42:20 +02:00
evpn_show_route_vni_multicast ( vty , bgp , vni , orig_ip , json ) ;
2021-11-25 23:02:37 +01:00
if ( uj )
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2017-07-21 02:42:20 +02:00
2017-05-15 23:53:31 +02:00
return CMD_SUCCESS ;
}
2017-06-08 07:43:19 +02:00
/*
* Display per - VNI EVPN routing table - for all VNIs .
*/
2017-08-30 17:23:01 +02:00
DEFUN ( show_bgp_l2vpn_evpn_route_vni_all ,
show_bgp_l2vpn_evpn_route_vni_all_cmd ,
2019-03-28 06:49:03 +01:00
" show bgp l2vpn evpn route vni all [detail] [vtep A.B.C.D] [json] " ,
2017-07-21 02:42:20 +02:00
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
2017-07-21 02:42:20 +02:00
" VXLAN Network Identifier \n "
" All VNIs \n "
2019-03-28 06:49:03 +01:00
" Print Detailed Output \n "
2017-07-21 02:42:20 +02:00
" Remote VTEP \n "
" Remote VTEP IP address \n "
JSON_STR )
2017-05-15 23:53:31 +02:00
{
struct bgp * bgp ;
struct in_addr vtep_ip ;
2017-06-08 07:43:19 +02:00
int idx = 0 ;
2018-08-29 14:19:54 +02:00
bool uj = false ;
2017-07-21 02:42:20 +02:00
json_object * json = NULL ;
2019-03-28 06:49:03 +01:00
/* Detail Adjust. Adjust indexes according to detail option */
int da = 0 ;
2017-05-15 23:53:31 +02:00
2019-03-06 19:15:10 +01:00
bgp = bgp_get_evpn ( ) ;
2017-05-15 23:53:31 +02:00
if ( ! bgp )
return CMD_WARNING ;
2017-07-21 02:42:20 +02:00
/* check if we need json output */
uj = use_json ( argc , argv ) ;
if ( uj )
json = json_object_new_object ( ) ;
2017-06-08 07:43:19 +02:00
if ( ! argv_find ( argv , argc , " evpn " , & idx ) )
return CMD_WARNING ;
2019-03-28 06:49:03 +01:00
if ( argv_find ( argv , argc , " detail " , & da ) )
da = 1 ;
/* vtep-ip position depends on detail option */
2017-05-15 23:53:31 +02:00
vtep_ip . s_addr = 0 ;
2019-03-28 06:49:03 +01:00
if ( ( ! uj & & ( argc = = ( idx + 1 + 5 + da ) & & argv [ idx + 5 + da ] - > arg ) )
| | ( uj
& & ( argc = = ( idx + 1 + 6 + da ) & & argv [ idx + 5 + da ] - > arg ) ) ) {
if ( ! inet_aton ( argv [ idx + 5 + da ] - > arg , & vtep_ip ) ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Malformed VTEP IP address \n " ) ;
2017-05-15 23:53:31 +02:00
return CMD_WARNING ;
}
}
2021-10-26 23:55:54 +02:00
evpn_show_routes_vni_all ( vty , bgp , 0 , false , vtep_ip , json , da ) ;
2017-07-21 02:42:20 +02:00
2021-10-26 23:55:54 +02:00
if ( uj ) {
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2021-10-26 23:55:54 +02:00
json_object_free ( json ) ;
}
return CMD_SUCCESS ;
}
/*
* Display per - VNI EVPN ALL routing tables - for all VNIs .
*/
DEFPY ( show_bgp_vni_all ,
show_bgp_vni_all_cmd ,
bgpd: add show bgp vni <VNI|all> json commands
Add add show bgp vni <VNI|all> json commands.
This is very similar to the old `show bgp evpn l2vpn vni route json`
commands but adds a new `macTable` object under the normal output.
This may change in the future but doing it like this for now
VNI ALL:
```
{
"1002":{
"vni":1002,
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
VNI 1002:
```
{
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
Signed-off-by: Stephen Worley <sworley@nvidia.com>
2021-11-09 23:52:03 +01:00
" show bgp vni all [vtep A.B.C.D$addr] [detail$detail] [json$uj] " ,
2021-10-26 23:55:54 +02:00
SHOW_STR
BGP_STR
VNI_HELP_STR
VNI_ALL_HELP_STR
VTEP_HELP_STR
VTEP_IP_HELP_STR
bgpd: add show bgp vni <VNI|all> json commands
Add add show bgp vni <VNI|all> json commands.
This is very similar to the old `show bgp evpn l2vpn vni route json`
commands but adds a new `macTable` object under the normal output.
This may change in the future but doing it like this for now
VNI ALL:
```
{
"1002":{
"vni":1002,
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
VNI 1002:
```
{
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
Signed-off-by: Stephen Worley <sworley@nvidia.com>
2021-11-09 23:52:03 +01:00
DETAIL_HELP_STR
JSON_STR )
2021-10-26 23:55:54 +02:00
{
struct bgp * bgp ;
json_object * json = NULL ;
bgp = bgp_get_evpn ( ) ;
if ( ! bgp )
return CMD_WARNING ;
/* check if we need json output */
if ( uj )
json = json_object_new_object ( ) ;
evpn_show_routes_vni_all_type_all ( vty , bgp , addr , json , ! ! detail ) ;
2022-11-01 19:46:51 +01:00
if ( uj )
vty_json ( vty , json ) ;
2021-10-26 23:55:54 +02:00
return CMD_SUCCESS ;
}
/*
* Display per - VNI EVPN EAD routing table - for all VNIs .
*/
DEFPY ( show_bgp_vni_all_ead ,
show_bgp_vni_all_ead_cmd ,
" show bgp vni all type <1|ead> [vtep A.B.C.D$addr] [<detail$detail|json$uj>] " ,
SHOW_STR
BGP_STR
VNI_HELP_STR
VNI_ALL_HELP_STR
EVPN_TYPE_HELP_STR
EVPN_TYPE_1_HELP_STR
EVPN_TYPE_1_HELP_STR
VTEP_HELP_STR
VTEP_IP_HELP_STR
DETAIL_HELP_STR
JSON_STR )
{
struct bgp * bgp ;
json_object * json = NULL ;
bgp = bgp_get_evpn ( ) ;
if ( ! bgp )
return CMD_WARNING ;
/* check if we need json output */
if ( uj )
json = json_object_new_object ( ) ;
evpn_show_routes_vni_all ( vty , bgp , BGP_EVPN_AD_ROUTE , false , addr , json ,
! ! detail ) ;
2022-11-01 19:46:51 +01:00
if ( uj )
vty_json ( vty , json ) ;
2021-10-26 23:55:54 +02:00
return CMD_SUCCESS ;
}
/*
* Display per - VNI EVPN MAC routing table - for all VNIs .
*/
DEFPY ( show_bgp_vni_all_macip_mac ,
show_bgp_vni_all_macip_mac_cmd ,
" show bgp vni all type <2|macip> mac [vtep A.B.C.D$addr] [<detail$detail|json$uj>] " ,
SHOW_STR
BGP_STR
VNI_HELP_STR
VNI_ALL_HELP_STR
EVPN_TYPE_HELP_STR
EVPN_TYPE_2_HELP_STR
EVPN_TYPE_2_HELP_STR
" MAC Table \n "
VTEP_HELP_STR
VTEP_IP_HELP_STR
DETAIL_HELP_STR
JSON_STR )
{
struct bgp * bgp ;
json_object * json = NULL ;
bgp = bgp_get_evpn ( ) ;
if ( ! bgp )
return CMD_WARNING ;
/* check if we need json output */
if ( uj )
json = json_object_new_object ( ) ;
evpn_show_routes_vni_all ( vty , bgp , BGP_EVPN_MAC_IP_ROUTE , true , addr ,
json , ! ! detail ) ;
2022-11-01 19:46:51 +01:00
if ( uj )
vty_json ( vty , json ) ;
2021-10-26 23:55:54 +02:00
return CMD_SUCCESS ;
}
/*
* Display per - VNI EVPN IP routing table - for all VNIs .
*/
DEFPY ( show_bgp_vni_all_macip_ip ,
show_bgp_vni_all_macip_ip_cmd ,
" show bgp vni all type <2|macip> ip [vtep A.B.C.D$addr] [<detail$detail|json$uj>] " ,
SHOW_STR
BGP_STR
VNI_HELP_STR
VNI_ALL_HELP_STR
EVPN_TYPE_HELP_STR
EVPN_TYPE_2_HELP_STR
EVPN_TYPE_2_HELP_STR
" IP Table \n "
VTEP_HELP_STR
VTEP_IP_HELP_STR
DETAIL_HELP_STR
JSON_STR )
{
struct bgp * bgp ;
json_object * json = NULL ;
bgp = bgp_get_evpn ( ) ;
if ( ! bgp )
return CMD_WARNING ;
/* check if we need json output */
if ( uj )
json = json_object_new_object ( ) ;
evpn_show_routes_vni_all ( vty , bgp , BGP_EVPN_MAC_IP_ROUTE , false , addr ,
json , ! ! detail ) ;
2022-11-01 19:46:51 +01:00
if ( uj )
vty_json ( vty , json ) ;
2021-10-26 23:55:54 +02:00
return CMD_SUCCESS ;
}
/*
* Display per - VNI EVPN Multicast routing table - for all VNIs .
*/
DEFPY ( show_bgp_vni_all_imet ,
show_bgp_vni_all_imet_cmd ,
" show bgp vni all type <3|multicast> [vtep A.B.C.D$addr] [<detail$detail|json$uj>] " ,
SHOW_STR
BGP_STR
VNI_HELP_STR
VNI_ALL_HELP_STR
EVPN_TYPE_HELP_STR
EVPN_TYPE_3_HELP_STR
EVPN_TYPE_3_HELP_STR
VTEP_HELP_STR
VTEP_IP_HELP_STR
DETAIL_HELP_STR
JSON_STR )
{
struct bgp * bgp ;
json_object * json = NULL ;
bgp = bgp_get_evpn ( ) ;
if ( ! bgp )
return CMD_WARNING ;
/* check if we need json output */
if ( uj )
json = json_object_new_object ( ) ;
evpn_show_routes_vni_all ( vty , bgp , BGP_EVPN_IMET_ROUTE , false , addr ,
json , ! ! detail ) ;
2022-11-01 19:46:51 +01:00
if ( uj )
vty_json ( vty , json ) ;
2021-10-26 23:55:54 +02:00
return CMD_SUCCESS ;
}
/*
* Display per - VNI EVPN ALL routing tables - for select VNI
*/
DEFPY ( show_bgp_vni ,
show_bgp_vni_cmd ,
bgpd: add show bgp vni <VNI|all> json commands
Add add show bgp vni <VNI|all> json commands.
This is very similar to the old `show bgp evpn l2vpn vni route json`
commands but adds a new `macTable` object under the normal output.
This may change in the future but doing it like this for now
VNI ALL:
```
{
"1002":{
"vni":1002,
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
VNI 1002:
```
{
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
Signed-off-by: Stephen Worley <sworley@nvidia.com>
2021-11-09 23:52:03 +01:00
" show bgp vni " CMD_VNI_RANGE " $vni [vtep A.B.C.D$addr] [json$uj] " ,
2021-10-26 23:55:54 +02:00
SHOW_STR
BGP_STR
VNI_HELP_STR
VNI_NUM_HELP_STR
VTEP_HELP_STR
bgpd: add show bgp vni <VNI|all> json commands
Add add show bgp vni <VNI|all> json commands.
This is very similar to the old `show bgp evpn l2vpn vni route json`
commands but adds a new `macTable` object under the normal output.
This may change in the future but doing it like this for now
VNI ALL:
```
{
"1002":{
"vni":1002,
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
VNI 1002:
```
{
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
Signed-off-by: Stephen Worley <sworley@nvidia.com>
2021-11-09 23:52:03 +01:00
VTEP_IP_HELP_STR
JSON_STR )
2021-10-26 23:55:54 +02:00
{
struct bgp * bgp ;
bgpd: add show bgp vni <VNI|all> json commands
Add add show bgp vni <VNI|all> json commands.
This is very similar to the old `show bgp evpn l2vpn vni route json`
commands but adds a new `macTable` object under the normal output.
This may change in the future but doing it like this for now
VNI ALL:
```
{
"1002":{
"vni":1002,
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
VNI 1002:
```
{
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
Signed-off-by: Stephen Worley <sworley@nvidia.com>
2021-11-09 23:52:03 +01:00
json_object * json = NULL ;
json_object * json_mac = NULL ;
2021-10-26 23:55:54 +02:00
bgp = bgp_get_evpn ( ) ;
if ( ! bgp )
return CMD_WARNING ;
bgpd: add show bgp vni <VNI|all> json commands
Add add show bgp vni <VNI|all> json commands.
This is very similar to the old `show bgp evpn l2vpn vni route json`
commands but adds a new `macTable` object under the normal output.
This may change in the future but doing it like this for now
VNI ALL:
```
{
"1002":{
"vni":1002,
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
VNI 1002:
```
{
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
Signed-off-by: Stephen Worley <sworley@nvidia.com>
2021-11-09 23:52:03 +01:00
/* check if we need json output */
if ( uj ) {
json = json_object_new_object ( ) ;
json_mac = json_object_new_object ( ) ;
}
evpn_show_routes_vni ( vty , bgp , vni , 0 , false , addr , json ) ;
if ( ! uj )
vty_out ( vty , " \n \n MAC Table: \n \n " ) ;
evpn_show_routes_vni ( vty , bgp , vni , 0 , true , addr , json_mac ) ;
if ( uj ) {
json_object_object_add ( json , " macTable " , json_mac ) ;
2022-11-01 19:46:51 +01:00
vty_json ( vty , json ) ;
bgpd: add show bgp vni <VNI|all> json commands
Add add show bgp vni <VNI|all> json commands.
This is very similar to the old `show bgp evpn l2vpn vni route json`
commands but adds a new `macTable` object under the normal output.
This may change in the future but doing it like this for now
VNI ALL:
```
{
"1002":{
"vni":1002,
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
VNI 1002:
```
{
"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]":{
"prefix":"[2]:[0]:[48]:[00:00:00:00:00:00]:[128]:[fe80::202:ff:fe00:9]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
...
...
...
"numPrefix":4,
"numPaths":7,
"macTable":{
"[2]:[0]:[48]:[00:02:00:00:00:09]":{
"prefix":"[2]:[0]:[48]:[00:02:00:00:00:09]",
"prefixLen":352,
"paths":[
[
{
"valid":true,
"pathFrom":"external",
```
Signed-off-by: Stephen Worley <sworley@nvidia.com>
2021-11-09 23:52:03 +01:00
}
2021-10-26 23:55:54 +02:00
return CMD_SUCCESS ;
}
/*
* Display per - VNI EVPN EAD routing table - for select VNI
*/
DEFPY ( show_bgp_vni_ead ,
show_bgp_vni_ead_cmd ,
" show bgp vni " CMD_VNI_RANGE " $vni type <1|ead> [vtep A.B.C.D$addr] [json$uj] " ,
SHOW_STR
BGP_STR
VNI_HELP_STR
VNI_NUM_HELP_STR
EVPN_TYPE_HELP_STR
EVPN_TYPE_1_HELP_STR
EVPN_TYPE_1_HELP_STR
VTEP_HELP_STR
VTEP_IP_HELP_STR
JSON_STR )
{
struct bgp * bgp ;
json_object * json = NULL ;
bgp = bgp_get_evpn ( ) ;
if ( ! bgp )
return CMD_WARNING ;
/* check if we need json output */
if ( uj )
json = json_object_new_object ( ) ;
evpn_show_routes_vni ( vty , bgp , vni , BGP_EVPN_AD_ROUTE , false , addr ,
json ) ;
2022-11-01 19:46:51 +01:00
if ( uj )
vty_json ( vty , json ) ;
2021-10-26 23:55:54 +02:00
return CMD_SUCCESS ;
}
/*
* Display per - VNI EVPN MAC - IP MAC routing table - for select VNI
*/
DEFPY ( show_bgp_vni_macip_mac ,
show_bgp_vni_macip_mac_cmd ,
" show bgp vni " CMD_VNI_RANGE " $vni type <2|macip> mac [vtep A.B.C.D$addr] [json$uj] " ,
SHOW_STR
BGP_STR
VNI_HELP_STR
VNI_NUM_HELP_STR
EVPN_TYPE_HELP_STR
EVPN_TYPE_2_HELP_STR
EVPN_TYPE_2_HELP_STR
" MAC Table \n "
VTEP_HELP_STR
VTEP_IP_HELP_STR
JSON_STR )
{
struct bgp * bgp ;
json_object * json = NULL ;
bgp = bgp_get_evpn ( ) ;
if ( ! bgp )
return CMD_WARNING ;
/* check if we need json output */
if ( uj )
json = json_object_new_object ( ) ;
evpn_show_routes_vni ( vty , bgp , vni , BGP_EVPN_MAC_IP_ROUTE , true , addr ,
json ) ;
2022-11-01 19:46:51 +01:00
if ( uj )
vty_json ( vty , json ) ;
2021-10-26 23:55:54 +02:00
return CMD_SUCCESS ;
}
/*
* Display per - VNI EVPN MAC - IP IP routing table - for select VNI
*/
DEFPY ( show_bgp_vni_macip_ip ,
show_bgp_vni_macip_ip_cmd ,
" show bgp vni " CMD_VNI_RANGE " $vni type <2|macip> ip [vtep A.B.C.D$addr] [json$uj] " ,
SHOW_STR
BGP_STR
VNI_HELP_STR
VNI_NUM_HELP_STR
EVPN_TYPE_HELP_STR
EVPN_TYPE_2_HELP_STR
EVPN_TYPE_2_HELP_STR
" IP Table \n "
VTEP_HELP_STR
VTEP_IP_HELP_STR
JSON_STR )
{
struct bgp * bgp ;
json_object * json = NULL ;
bgp = bgp_get_evpn ( ) ;
if ( ! bgp )
return CMD_WARNING ;
/* check if we need json output */
if ( uj )
json = json_object_new_object ( ) ;
evpn_show_routes_vni ( vty , bgp , vni , BGP_EVPN_MAC_IP_ROUTE , false , addr ,
json ) ;
2022-11-01 19:46:51 +01:00
if ( uj )
vty_json ( vty , json ) ;
2021-10-26 23:55:54 +02:00
return CMD_SUCCESS ;
}
/*
* Display per - VNI EVPN Multicast routing table - for select VNI
*/
DEFPY ( show_bgp_vni_imet ,
show_bgp_vni_imet_cmd ,
" show bgp vni " CMD_VNI_RANGE " $vni type <3|multicast> [vtep A.B.C.D$addr] [json$uj] " ,
SHOW_STR
BGP_STR
VNI_HELP_STR
VNI_NUM_HELP_STR
EVPN_TYPE_HELP_STR
EVPN_TYPE_3_HELP_STR
EVPN_TYPE_3_HELP_STR
VTEP_HELP_STR
VTEP_IP_HELP_STR
JSON_STR )
{
struct bgp * bgp ;
json_object * json = NULL ;
bgp = bgp_get_evpn ( ) ;
if ( ! bgp )
return CMD_WARNING ;
/* check if we need json output */
if ( uj )
json = json_object_new_object ( ) ;
evpn_show_routes_vni ( vty , bgp , vni , BGP_EVPN_IMET_ROUTE , false , addr ,
json ) ;
2022-11-01 19:46:51 +01:00
if ( uj )
vty_json ( vty , json ) ;
2021-10-26 23:55:54 +02:00
return CMD_SUCCESS ;
}
/*
* Display per - VNI EVPN MACIP MAC routing table - for select VNI & MAC
*/
DEFPY ( show_bgp_vni_macip_mac_addr ,
show_bgp_vni_macip_mac_addr_cmd ,
" show bgp vni " CMD_VNI_RANGE " $vni type <2|macip> mac X:X:X:X:X:X [json$uj] " ,
SHOW_STR
BGP_STR
VNI_HELP_STR
VNI_NUM_HELP_STR
EVPN_TYPE_HELP_STR
EVPN_TYPE_2_HELP_STR
EVPN_TYPE_2_HELP_STR
" MAC Table \n "
MAC_STR
JSON_STR )
{
struct bgp * bgp ;
json_object * json = NULL ;
bgp = bgp_get_evpn ( ) ;
if ( ! bgp )
return CMD_WARNING ;
/* check if we need json output */
if ( uj )
json = json_object_new_object ( ) ;
evpn_show_route_vni_macip ( vty , bgp , vni , & mac - > eth_addr , NULL , json ) ;
2022-11-01 19:46:51 +01:00
if ( uj )
vty_json ( vty , json ) ;
2021-10-26 23:55:54 +02:00
return CMD_SUCCESS ;
}
/*
* Display per - VNI EVPN MACIP IP routing table - for select VNI & IP
*/
DEFPY ( show_bgp_vni_macip_ip_addr , show_bgp_vni_macip_ip_addr_cmd ,
" show bgp vni " CMD_VNI_RANGE
" $vni type <2|macip> ip <A.B.C.D|X:X::X:X> [json$uj] " ,
SHOW_STR BGP_STR VNI_HELP_STR VNI_NUM_HELP_STR EVPN_TYPE_HELP_STR
EVPN_TYPE_2_HELP_STR EVPN_TYPE_2_HELP_STR
" IP Table \n " IP_ADDR_STR IP6_ADDR_STR JSON_STR )
{
struct bgp * bgp ;
json_object * json = NULL ;
struct ipaddr ip_addr = { . ipa_type = IPADDR_NONE } ;
bgp = bgp_get_evpn ( ) ;
if ( ! bgp )
return CMD_WARNING ;
/* check if we need json output */
if ( uj )
json = json_object_new_object ( ) ;
if ( sockunion_family ( ip ) = = AF_INET ) {
ip_addr . ipa_type = IPADDR_V4 ;
ip_addr . ipaddr_v4 . s_addr = sockunion2ip ( ip ) ;
} else {
ip_addr . ipa_type = IPADDR_V6 ;
memcpy ( & ip_addr . ipaddr_v6 , & ip - > sin6 . sin6_addr ,
sizeof ( struct in6_addr ) ) ;
}
evpn_show_route_vni_macip ( vty , bgp , vni , NULL , & ip_addr , json ) ;
2017-07-21 02:42:20 +02:00
2021-11-25 23:02:37 +01:00
if ( uj )
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2017-07-21 02:42:20 +02:00
2017-05-15 23:53:31 +02:00
return CMD_SUCCESS ;
}
2020-05-09 04:49:33 +02:00
DEFPY_HIDDEN (
2020-08-18 15:52:40 +02:00
show_bgp_l2vpn_evpn_route_mac_ip_evi_es ,
show_bgp_l2vpn_evpn_route_mac_ip_evi_es_cmd ,
" show bgp l2vpn evpn route mac-ip-evi-es [NAME$esi_str|detail$detail] [json$uj] " ,
2020-05-09 04:49:33 +02:00
SHOW_STR BGP_STR L2VPN_HELP_STR EVPN_HELP_STR
" EVPN route information \n "
2020-08-18 15:52:40 +02:00
" MAC IP routes in the EVI tables linked to the ES \n "
2020-05-09 04:49:33 +02:00
" ES ID \n "
" Detailed information \n " JSON_STR )
{
esi_t esi ;
esi_t * esi_p ;
json_object * json = NULL ;
if ( esi_str ) {
if ( ! str_to_esi ( esi_str , & esi ) ) {
2022-04-01 09:21:07 +02:00
vty_out ( vty , " %% Malformed ESI \n " ) ;
2020-05-09 04:49:33 +02:00
return CMD_WARNING ;
}
esi_p = & esi ;
} else {
esi_p = NULL ;
}
if ( uj )
json = json_object_new_object ( ) ;
2020-08-18 15:52:40 +02:00
bgp_evpn_show_routes_mac_ip_evi_es ( vty , esi_p , json , ! ! detail ) ;
2021-11-25 23:02:37 +01:00
if ( uj )
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2020-05-09 04:49:33 +02:00
return CMD_SUCCESS ;
}
2020-08-18 01:24:50 +02:00
DEFPY_HIDDEN (
show_bgp_l2vpn_evpn_route_mac_ip_global_es ,
show_bgp_l2vpn_evpn_route_mac_ip_global_es_cmd ,
" show bgp l2vpn evpn route mac-ip-global-es [NAME$esi_str|detail$detail] [json$uj] " ,
SHOW_STR BGP_STR L2VPN_HELP_STR EVPN_HELP_STR
" EVPN route information \n "
" MAC IP routes in the global table linked to the ES \n "
" ES ID \n "
" Detailed information \n " JSON_STR )
{
esi_t esi ;
esi_t * esi_p ;
json_object * json = NULL ;
if ( esi_str ) {
if ( ! str_to_esi ( esi_str , & esi ) ) {
2022-04-01 09:21:07 +02:00
vty_out ( vty , " %% Malformed ESI \n " ) ;
2020-08-18 01:24:50 +02:00
return CMD_WARNING ;
}
esi_p = & esi ;
} else {
esi_p = NULL ;
}
if ( uj )
json = json_object_new_object ( ) ;
bgp_evpn_show_routes_mac_ip_global_es ( vty , esi_p , json , ! ! detail ) ;
2021-11-25 23:02:37 +01:00
if ( uj )
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2020-08-18 01:24:50 +02:00
return CMD_SUCCESS ;
}
2017-10-10 03:12:05 +02:00
/*
* Display EVPN import route - target hash table
*/
DEFUN ( show_bgp_l2vpn_evpn_vrf_import_rt ,
show_bgp_l2vpn_evpn_vrf_import_rt_cmd ,
" show bgp l2vpn evpn vrf-import-rt [json] " ,
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Show vrf import route target \n "
JSON_STR )
{
2018-08-29 14:19:54 +02:00
bool uj = false ;
2019-03-06 19:10:02 +01:00
struct bgp * bgp_evpn = NULL ;
2017-10-10 03:12:05 +02:00
json_object * json = NULL ;
2019-03-06 19:10:02 +01:00
bgp_evpn = bgp_get_evpn ( ) ;
if ( ! bgp_evpn )
2017-10-10 03:12:05 +02:00
return CMD_WARNING ;
uj = use_json ( argc , argv ) ;
if ( uj )
json = json_object_new_object ( ) ;
2019-03-06 19:10:02 +01:00
evpn_show_vrf_import_rts ( vty , bgp_evpn , json ) ;
2017-10-10 03:12:05 +02:00
2021-11-25 23:02:37 +01:00
if ( uj )
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2017-10-10 03:12:05 +02:00
return CMD_SUCCESS ;
}
2017-06-08 07:43:19 +02:00
/*
* Display EVPN import route - target hash table
*/
2017-08-30 17:23:01 +02:00
DEFUN ( show_bgp_l2vpn_evpn_import_rt ,
show_bgp_l2vpn_evpn_import_rt_cmd ,
2017-07-21 02:42:20 +02:00
" show bgp l2vpn evpn import-rt [json] " ,
SHOW_STR
BGP_STR
L2VPN_HELP_STR
EVPN_HELP_STR
" Show import route target \n "
JSON_STR )
2017-05-15 23:53:31 +02:00
{
struct bgp * bgp ;
2018-08-29 14:19:54 +02:00
bool uj = false ;
2017-07-21 02:42:20 +02:00
json_object * json = NULL ;
2017-05-15 23:53:31 +02:00
2019-03-06 19:15:10 +01:00
bgp = bgp_get_evpn ( ) ;
2017-05-15 23:53:31 +02:00
if ( ! bgp )
return CMD_WARNING ;
2017-07-21 02:42:20 +02:00
uj = use_json ( argc , argv ) ;
if ( uj )
json = json_object_new_object ( ) ;
evpn_show_import_rts ( vty , bgp , json ) ;
2021-11-25 23:02:37 +01:00
if ( uj )
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2017-07-21 02:42:20 +02:00
2017-05-15 23:53:31 +02:00
return CMD_SUCCESS ;
}
2020-10-08 10:03:25 +02:00
DEFPY_HIDDEN ( test_es_add ,
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
test_es_add_cmd ,
" [no$no] test es NAME$esi_str [state NAME$state_str] " ,
NO_STR
" Test \n "
2018-04-14 00:01:12 +02:00
" Ethernet-segment \n "
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
" Ethernet-Segment Identifier \n "
" ES link state \n "
" up|down \n "
)
2018-04-14 00:01:12 +02:00
{
int ret = 0 ;
esi_t esi ;
struct bgp * bgp ;
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
struct in_addr vtep_ip ;
bool oper_up ;
2018-04-14 00:01:12 +02:00
2019-03-06 19:15:10 +01:00
bgp = bgp_get_evpn ( ) ;
2018-04-14 00:01:12 +02:00
if ( ! bgp ) {
2022-04-01 09:21:07 +02:00
vty_out ( vty , " %% EVPN BGP instance not yet created \n " ) ;
2018-04-14 00:01:12 +02:00
return CMD_WARNING ;
}
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
if ( ! str_to_esi ( esi_str , & esi ) ) {
2022-04-01 09:21:07 +02:00
vty_out ( vty , " %% Malformed ESI \n " ) ;
2018-04-14 00:01:12 +02:00
return CMD_WARNING ;
}
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
if ( no ) {
ret = bgp_evpn_local_es_del ( bgp , & esi ) ;
if ( ret = = - 1 ) {
2022-04-01 09:21:07 +02:00
vty_out ( vty , " %% Failed to delete ES \n " ) ;
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
return CMD_WARNING ;
}
} else {
if ( state_str & & ! strcmp ( state_str , " up " ) )
oper_up = true ;
else
oper_up = false ;
vtep_ip = bgp - > router_id ;
2018-04-14 00:01:12 +02:00
2020-05-09 01:35:09 +02:00
ret = bgp_evpn_local_es_add ( bgp , & esi , vtep_ip , oper_up ,
2020-08-11 02:46:09 +02:00
EVPN_MH_DF_PREF_MIN , false ) ;
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
if ( ret = = - 1 ) {
2022-04-01 09:21:07 +02:00
vty_out ( vty , " %% Failed to add ES \n " ) ;
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
return CMD_WARNING ;
}
2018-04-14 00:01:12 +02:00
}
return CMD_SUCCESS ;
}
2020-10-08 10:03:25 +02:00
DEFPY_HIDDEN ( test_es_vni_add ,
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
test_es_vni_add_cmd ,
" [no$no] test es NAME$esi_str vni (1-16777215)$vni " ,
NO_STR
" Test \n "
2018-04-14 00:01:12 +02:00
" Ethernet-segment \n "
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
" Ethernet-Segment Identifier \n "
" VNI \n "
" 1-16777215 \n "
)
2018-04-14 00:01:12 +02:00
{
int ret = 0 ;
esi_t esi ;
struct bgp * bgp ;
2019-03-06 19:15:10 +01:00
bgp = bgp_get_evpn ( ) ;
2018-04-14 00:01:12 +02:00
if ( ! bgp ) {
2022-04-01 09:21:07 +02:00
vty_out ( vty , " %% EVPN BGP instance not yet created \n " ) ;
2018-04-14 00:01:12 +02:00
return CMD_WARNING ;
}
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
if ( ! str_to_esi ( esi_str , & esi ) ) {
2022-04-01 09:21:07 +02:00
vty_out ( vty , " %% Malformed ESI \n " ) ;
2018-04-14 00:01:12 +02:00
return CMD_WARNING ;
}
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
if ( no ) {
ret = bgp_evpn_local_es_evi_del ( bgp , & esi , vni ) ;
if ( ret = = - 1 ) {
2022-04-01 09:21:07 +02:00
vty_out ( vty , " %% Failed to deref ES VNI \n " ) ;
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
return CMD_WARNING ;
}
} else {
ret = bgp_evpn_local_es_evi_add ( bgp , & esi , vni ) ;
if ( ret = = - 1 ) {
2022-04-01 09:21:07 +02:00
vty_out ( vty , " %% Failed to ref ES VNI \n " ) ;
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
return CMD_WARNING ;
}
2018-04-14 00:01:12 +02:00
}
return CMD_SUCCESS ;
}
2017-06-28 20:30:36 +02:00
ALIAS_HIDDEN ( show_bgp_l2vpn_evpn_vni , show_bgp_evpn_vni_cmd ,
2018-10-19 02:44:52 +02:00
" show bgp evpn vni [ " CMD_VNI_RANGE " ] " , SHOW_STR BGP_STR EVPN_HELP_STR
2017-06-28 20:30:36 +02:00
" Show VNI \n "
" VNI number \n " )
ALIAS_HIDDEN ( show_bgp_l2vpn_evpn_summary , show_bgp_evpn_summary_cmd ,
" show bgp evpn summary [json] " , SHOW_STR BGP_STR EVPN_HELP_STR
" Summary of BGP neighbor status \n " JSON_STR )
ALIAS_HIDDEN ( show_bgp_l2vpn_evpn_route , show_bgp_evpn_route_cmd ,
2020-10-07 22:23:09 +02:00
" show bgp evpn route [detail] [type <macip|2|multicast|3>] " ,
2017-06-28 20:30:36 +02:00
SHOW_STR BGP_STR EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
2019-04-10 08:13:51 +02:00
" Display Detailed Information \n "
2020-10-06 21:58:12 +02:00
EVPN_TYPE_HELP_STR
EVPN_TYPE_2_HELP_STR
2020-10-07 22:23:09 +02:00
EVPN_TYPE_2_HELP_STR
EVPN_TYPE_3_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_TYPE_3_HELP_STR )
2017-06-28 20:30:36 +02:00
ALIAS_HIDDEN (
show_bgp_l2vpn_evpn_route_rd , show_bgp_evpn_route_rd_cmd ,
2020-10-07 22:23:09 +02:00
" show bgp evpn route rd ASN:NN_OR_IP-ADDRESS:NN [type <macip|2|multicast|3>] " ,
2017-06-28 20:30:36 +02:00
SHOW_STR BGP_STR EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
EVPN_RT_DIST_HELP_STR
EVPN_ASN_IP_HELP_STR
EVPN_TYPE_HELP_STR
EVPN_TYPE_2_HELP_STR
2020-10-07 22:23:09 +02:00
EVPN_TYPE_2_HELP_STR
EVPN_TYPE_3_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_TYPE_3_HELP_STR )
2017-06-28 20:30:36 +02:00
ALIAS_HIDDEN (
show_bgp_l2vpn_evpn_route_rd_macip , show_bgp_evpn_route_rd_macip_cmd ,
2017-09-14 20:07:30 +02:00
" show bgp evpn route rd ASN:NN_OR_IP-ADDRESS:NN mac WORD [ip WORD] " ,
2017-06-28 20:30:36 +02:00
SHOW_STR BGP_STR EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
EVPN_RT_DIST_HELP_STR
EVPN_ASN_IP_HELP_STR
2017-06-28 20:30:36 +02:00
" MAC \n "
" MAC address (e.g., 00:e0:ec:20:12:62) \n "
" IP \n "
" IP address (IPv4 or IPv6) \n " )
ALIAS_HIDDEN (
show_bgp_l2vpn_evpn_route_vni , show_bgp_evpn_route_vni_cmd ,
2020-10-07 22:23:09 +02:00
" show bgp evpn route vni " CMD_VNI_RANGE " [<type <macip|2|multicast|3> | vtep A.B.C.D>] " ,
2017-06-28 20:30:36 +02:00
SHOW_STR BGP_STR EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
2017-06-28 20:30:36 +02:00
" VXLAN Network Identifier \n "
" VNI number \n "
2020-10-06 21:58:12 +02:00
EVPN_TYPE_HELP_STR
EVPN_TYPE_2_HELP_STR
2020-10-07 22:23:09 +02:00
EVPN_TYPE_2_HELP_STR
EVPN_TYPE_3_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_TYPE_3_HELP_STR
2017-06-28 20:30:36 +02:00
" Remote VTEP \n "
" Remote VTEP IP address \n " )
ALIAS_HIDDEN ( show_bgp_l2vpn_evpn_route_vni_macip ,
show_bgp_evpn_route_vni_macip_cmd ,
2018-10-19 02:44:52 +02:00
" show bgp evpn route vni " CMD_VNI_RANGE " mac WORD [ip WORD] " ,
2017-06-28 20:30:36 +02:00
SHOW_STR BGP_STR EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
2017-06-28 20:30:36 +02:00
" VXLAN Network Identifier \n "
" VNI number \n "
" MAC \n "
" MAC address (e.g., 00:e0:ec:20:12:62) \n "
" IP \n "
" IP address (IPv4 or IPv6) \n " )
ALIAS_HIDDEN ( show_bgp_l2vpn_evpn_route_vni_multicast ,
show_bgp_evpn_route_vni_multicast_cmd ,
2018-10-19 02:44:52 +02:00
" show bgp evpn route vni " CMD_VNI_RANGE " multicast A.B.C.D " ,
2017-06-28 20:30:36 +02:00
SHOW_STR BGP_STR EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
2017-06-28 20:30:36 +02:00
" VXLAN Network Identifier \n "
" VNI number \n "
2020-10-06 21:58:12 +02:00
EVPN_TYPE_3_HELP_STR
2017-06-28 20:30:36 +02:00
" Originating Router IP address \n " )
ALIAS_HIDDEN ( show_bgp_l2vpn_evpn_route_vni_all , show_bgp_evpn_route_vni_all_cmd ,
2019-03-28 06:49:03 +01:00
" show bgp evpn route vni all [detail] [vtep A.B.C.D] " ,
2017-06-28 20:30:36 +02:00
SHOW_STR BGP_STR EVPN_HELP_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_HELP_STR
2017-06-28 20:30:36 +02:00
" VXLAN Network Identifier \n "
" All VNIs \n "
2019-03-28 06:49:03 +01:00
" Print Detailed Output \n "
2017-06-28 20:30:36 +02:00
" Remote VTEP \n "
" Remote VTEP IP address \n " )
ALIAS_HIDDEN ( show_bgp_l2vpn_evpn_import_rt , show_bgp_evpn_import_rt_cmd ,
" show bgp evpn import-rt " ,
SHOW_STR BGP_STR EVPN_HELP_STR " Show import route target \n " )
2017-05-16 00:01:57 +02:00
DEFUN_NOSH ( bgp_evpn_vni ,
bgp_evpn_vni_cmd ,
2018-10-19 02:44:52 +02:00
" vni " CMD_VNI_RANGE ,
2017-05-16 00:01:57 +02:00
" VXLAN Network Identifier \n "
" VNI number \n " )
{
vni_t vni ;
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
struct bgpevpn * vpn ;
if ( ! bgp )
return CMD_WARNING ;
2017-07-14 14:52:45 +02:00
vni = strtoul ( argv [ 1 ] - > arg , NULL , 10 ) ;
2017-05-16 00:01:57 +02:00
/* Create VNI, or mark as configured. */
vpn = evpn_create_update_vni ( bgp , vni ) ;
if ( ! vpn ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Failed to create VNI \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
VTY_PUSH_CONTEXT_SUB ( BGP_EVPN_VNI_NODE , vpn ) ;
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_vni ,
no_bgp_evpn_vni_cmd ,
2018-10-19 02:44:52 +02:00
" no vni " CMD_VNI_RANGE ,
2017-05-16 00:01:57 +02:00
NO_STR
" VXLAN Network Identifier \n "
" VNI number \n " )
{
vni_t vni ;
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
struct bgpevpn * vpn ;
if ( ! bgp )
return CMD_WARNING ;
2017-07-14 14:52:45 +02:00
vni = strtoul ( argv [ 2 ] - > arg , NULL , 10 ) ;
2017-05-16 00:01:57 +02:00
/* Check if we should disallow. */
vpn = bgp_evpn_lookup_vni ( bgp , vni ) ;
if ( ! vpn ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Specified VNI does not exist \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
if ( ! is_vni_configured ( vpn ) ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Specified VNI is not configured \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
evpn_delete_vni ( bgp , vpn ) ;
return CMD_SUCCESS ;
}
DEFUN_NOSH ( exit_vni ,
exit_vni_cmd ,
" exit-vni " ,
" Exit from VNI mode \n " )
{
if ( vty - > node = = BGP_EVPN_VNI_NODE )
vty - > node = BGP_EVPN_NODE ;
return CMD_SUCCESS ;
}
2017-10-26 01:49:18 +02:00
DEFUN ( bgp_evpn_vrf_rd ,
bgp_evpn_vrf_rd_cmd ,
" rd ASN:NN_OR_IP-ADDRESS:NN " ,
2020-10-06 21:58:12 +02:00
EVPN_RT_DIST_HELP_STR
EVPN_ASN_IP_HELP_STR )
2017-10-26 01:49:18 +02:00
{
int ret ;
struct prefix_rd prd ;
struct bgp * bgp_vrf = VTY_GET_CONTEXT ( bgp ) ;
if ( ! bgp_vrf )
return CMD_WARNING ;
ret = str2prefix_rd ( argv [ 1 ] - > arg , & prd ) ;
if ( ! ret ) {
vty_out ( vty , " %% Malformed Route Distinguisher \n " ) ;
return CMD_WARNING ;
}
/* If same as existing value, there is nothing more to do. */
if ( bgp_evpn_vrf_rd_matches_existing ( bgp_vrf , & prd ) )
return CMD_SUCCESS ;
/* Configure or update the RD. */
2022-11-22 11:20:51 +01:00
evpn_configure_vrf_rd ( bgp_vrf , & prd , argv [ 1 ] - > arg ) ;
2017-10-26 01:49:18 +02:00
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_vrf_rd ,
no_bgp_evpn_vrf_rd_cmd ,
" no rd ASN:NN_OR_IP-ADDRESS:NN " ,
NO_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_DIST_HELP_STR
EVPN_ASN_IP_HELP_STR )
2017-10-26 01:49:18 +02:00
{
int ret ;
struct prefix_rd prd ;
struct bgp * bgp_vrf = VTY_GET_CONTEXT ( bgp ) ;
if ( ! bgp_vrf )
return CMD_WARNING ;
ret = str2prefix_rd ( argv [ 2 ] - > arg , & prd ) ;
if ( ! ret ) {
vty_out ( vty , " %% Malformed Route Distinguisher \n " ) ;
return CMD_WARNING ;
}
/* Check if we should disallow. */
if ( ! is_vrf_rd_configured ( bgp_vrf ) ) {
vty_out ( vty , " %% RD is not configured for this VRF \n " ) ;
return CMD_WARNING ;
}
if ( ! bgp_evpn_vrf_rd_matches_existing ( bgp_vrf , & prd ) ) {
vty_out ( vty ,
" %% RD specified does not match configuration for this VRF \n " ) ;
return CMD_WARNING ;
}
evpn_unconfigure_vrf_rd ( bgp_vrf ) ;
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_vrf_rd_without_val ,
no_bgp_evpn_vrf_rd_without_val_cmd ,
" no rd " ,
NO_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_DIST_HELP_STR )
2017-10-26 01:49:18 +02:00
{
struct bgp * bgp_vrf = VTY_GET_CONTEXT ( bgp ) ;
if ( ! bgp_vrf )
return CMD_WARNING ;
/* Check if we should disallow. */
if ( ! is_vrf_rd_configured ( bgp_vrf ) ) {
vty_out ( vty , " %% RD is not configured for this VRF \n " ) ;
return CMD_WARNING ;
}
evpn_unconfigure_vrf_rd ( bgp_vrf ) ;
return CMD_SUCCESS ;
}
2017-05-16 00:01:57 +02:00
DEFUN ( bgp_evpn_vni_rd ,
bgp_evpn_vni_rd_cmd ,
2017-09-14 20:07:30 +02:00
" rd ASN:NN_OR_IP-ADDRESS:NN " ,
2020-10-06 21:58:12 +02:00
EVPN_RT_DIST_HELP_STR
EVPN_ASN_IP_HELP_STR )
2017-05-16 00:01:57 +02:00
{
struct prefix_rd prd ;
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
VTY_DECLVAR_CONTEXT_SUB ( bgpevpn , vpn ) ;
int ret ;
2018-08-03 15:14:58 +02:00
if ( ! bgp )
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
2019-03-22 13:37:06 +01:00
if ( ! EVPN_ENABLED ( bgp ) ) {
2018-06-02 02:52:14 +02:00
vty_out ( vty ,
2019-03-06 19:15:10 +01:00
" This command is only supported under EVPN VRF \n " ) ;
2018-06-02 02:52:14 +02:00
return CMD_WARNING ;
}
2017-05-16 00:01:57 +02:00
ret = str2prefix_rd ( argv [ 1 ] - > arg , & prd ) ;
if ( ! ret ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Malformed Route Distinguisher \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
/* If same as existing value, there is nothing more to do. */
if ( bgp_evpn_rd_matches_existing ( vpn , & prd ) )
return CMD_SUCCESS ;
/* Configure or update the RD. */
2022-11-22 11:20:51 +01:00
evpn_configure_rd ( bgp , vpn , & prd , argv [ 1 ] - > arg ) ;
2017-05-16 00:01:57 +02:00
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_vni_rd ,
no_bgp_evpn_vni_rd_cmd ,
2017-09-14 20:07:30 +02:00
" no rd ASN:NN_OR_IP-ADDRESS:NN " ,
2017-05-16 00:01:57 +02:00
NO_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_DIST_HELP_STR
EVPN_ASN_IP_HELP_STR )
2017-05-16 00:01:57 +02:00
{
struct prefix_rd prd ;
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
VTY_DECLVAR_CONTEXT_SUB ( bgpevpn , vpn ) ;
int ret ;
2018-08-03 15:14:58 +02:00
if ( ! bgp )
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
2019-03-22 13:37:06 +01:00
if ( ! EVPN_ENABLED ( bgp ) ) {
2018-06-02 02:52:14 +02:00
vty_out ( vty ,
2019-03-06 19:15:10 +01:00
" This command is only supported under EVPN VRF \n " ) ;
2018-06-02 02:52:14 +02:00
return CMD_WARNING ;
}
2017-05-16 00:01:57 +02:00
ret = str2prefix_rd ( argv [ 2 ] - > arg , & prd ) ;
if ( ! ret ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Malformed Route Distinguisher \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
/* Check if we should disallow. */
if ( ! is_rd_configured ( vpn ) ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% RD is not configured for this VNI \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
if ( ! bgp_evpn_rd_matches_existing ( vpn , & prd ) ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty ,
" %% RD specified does not match configuration for this VNI \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
evpn_unconfigure_rd ( bgp , vpn ) ;
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_vni_rd_without_val ,
no_bgp_evpn_vni_rd_without_val_cmd ,
" no rd " ,
NO_STR
2020-10-06 21:58:12 +02:00
EVPN_RT_DIST_HELP_STR )
2017-05-16 00:01:57 +02:00
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
VTY_DECLVAR_CONTEXT_SUB ( bgpevpn , vpn ) ;
2018-08-03 15:14:58 +02:00
if ( ! bgp )
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
2019-03-22 13:37:06 +01:00
if ( ! EVPN_ENABLED ( bgp ) ) {
2018-06-02 02:52:14 +02:00
vty_out ( vty ,
2019-03-06 19:15:10 +01:00
" This command is only supported under EVPN VRF \n " ) ;
2018-06-02 02:52:14 +02:00
return CMD_WARNING ;
}
2017-05-16 00:01:57 +02:00
/* Check if we should disallow. */
if ( ! is_rd_configured ( vpn ) ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% RD is not configured for this VNI \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
evpn_unconfigure_rd ( bgp , vpn ) ;
return CMD_SUCCESS ;
}
/*
* Loop over all extended - communities in the route - target list rtl and
* return 1 if we find ecomtarget
*/
2021-02-17 22:11:49 +01:00
static bool bgp_evpn_rt_matches_existing ( struct list * rtl ,
struct ecommunity * ecomtarget )
2017-05-16 00:01:57 +02:00
{
2021-02-17 22:11:49 +01:00
struct listnode * node ;
2017-05-16 00:01:57 +02:00
struct ecommunity * ecom ;
2021-02-17 22:11:49 +01:00
for ( ALL_LIST_ELEMENTS_RO ( rtl , node , ecom ) ) {
2017-05-16 00:01:57 +02:00
if ( ecommunity_match ( ecom , ecomtarget ) )
2021-02-17 22:11:49 +01:00
return true ;
2017-05-16 00:01:57 +02:00
}
2021-02-17 22:11:49 +01:00
return false ;
}
/*
* L3 RT version of above .
*/
static bool bgp_evpn_vrf_rt_matches_existing ( struct list * rtl ,
struct ecommunity * ecomtarget )
{
struct listnode * node ;
struct vrf_route_target * l3rt ;
for ( ALL_LIST_ELEMENTS_RO ( rtl , node , l3rt ) ) {
if ( ecommunity_match ( l3rt - > ecom , ecomtarget ) )
return true ;
}
return false ;
2017-05-16 00:01:57 +02:00
}
2017-10-09 03:34:29 +02:00
/* display L3VNI related info for a VRF instance */
DEFUN ( show_bgp_vrf_l3vni_info ,
show_bgp_vrf_l3vni_info_cmd ,
2017-11-15 10:01:00 +01:00
" show bgp vrf VRFNAME vni [json] " ,
2017-10-09 03:34:29 +02:00
SHOW_STR
BGP_STR
" show bgp vrf \n "
" VRF Name \n "
" L3-VNI \n "
2017-10-17 10:54:05 +02:00
JSON_STR )
2017-10-09 03:34:29 +02:00
{
char buf [ ETHER_ADDR_STRLEN ] ;
int idx_vrf = 3 ;
const char * name = NULL ;
struct bgp * bgp = NULL ;
struct listnode * node = NULL ;
2017-10-09 05:43:14 +02:00
struct bgpevpn * vpn = NULL ;
2021-02-17 22:11:49 +01:00
struct vrf_route_target * l3rt ;
2017-10-17 10:54:05 +02:00
json_object * json = NULL ;
json_object * json_vnis = NULL ;
json_object * json_export_rts = NULL ;
json_object * json_import_rts = NULL ;
2018-08-29 14:19:54 +02:00
bool uj = use_json ( argc , argv ) ;
2017-10-17 10:54:05 +02:00
if ( uj ) {
json = json_object_new_object ( ) ;
json_vnis = json_object_new_array ( ) ;
json_export_rts = json_object_new_array ( ) ;
json_import_rts = json_object_new_array ( ) ;
}
2017-10-09 03:34:29 +02:00
name = argv [ idx_vrf ] - > arg ;
bgp = bgp_lookup_by_name ( name ) ;
2022-04-13 10:51:38 +02:00
if ( strmatch ( name , VRF_DEFAULT_NAME ) )
bgp = bgp_get_default ( ) ;
2017-10-09 03:34:29 +02:00
if ( ! bgp ) {
2017-10-17 10:54:05 +02:00
if ( ! uj )
2022-04-13 10:51:38 +02:00
vty_out ( vty , " BGP instance for VRF %s not found \n " ,
name ) ;
2017-10-17 10:54:05 +02:00
else {
json_object_string_add ( json , " warning " ,
" BGP instance not found " ) ;
vty_out ( vty , " %s \n " , json_object_to_json_string ( json ) ) ;
json_object_free ( json ) ;
}
2017-10-09 03:34:29 +02:00
return CMD_WARNING ;
}
2017-10-17 10:54:05 +02:00
if ( ! json ) {
vty_out ( vty , " BGP VRF: %s \n " , name ) ;
2020-10-15 21:33:09 +02:00
vty_out ( vty , " Local-Ip: %pI4 \n " , & bgp - > originator_ip ) ;
2017-10-17 10:54:05 +02:00
vty_out ( vty , " L3-VNI: %u \n " , bgp - > l3vni ) ;
vty_out ( vty , " Rmac: %s \n " ,
prefix_mac2str ( & bgp - > rmac , buf , sizeof ( buf ) ) ) ;
2018-02-06 23:28:22 +01:00
vty_out ( vty , " VNI Filter: %s \n " ,
CHECK_FLAG ( bgp - > vrf_flags ,
BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY )
? " prefix-routes-only "
: " none " ) ;
2017-10-17 10:54:05 +02:00
vty_out ( vty , " L2-VNI List: \n " ) ;
vty_out ( vty , " " ) ;
for ( ALL_LIST_ELEMENTS_RO ( bgp - > l2vnis , node , vpn ) )
vty_out ( vty , " %u " , vpn - > vni ) ;
vty_out ( vty , " \n " ) ;
vty_out ( vty , " Export-RTs: \n " ) ;
vty_out ( vty , " " ) ;
2021-02-17 22:11:49 +01:00
for ( ALL_LIST_ELEMENTS_RO ( bgp - > vrf_export_rtl , node , l3rt ) )
vty_out ( vty , " %s " , ecommunity_str ( l3rt - > ecom ) ) ;
2017-10-17 10:54:05 +02:00
vty_out ( vty , " \n " ) ;
vty_out ( vty , " Import-RTs: \n " ) ;
vty_out ( vty , " " ) ;
2021-02-17 22:11:49 +01:00
for ( ALL_LIST_ELEMENTS_RO ( bgp - > vrf_import_rtl , node , l3rt ) )
vty_out ( vty , " %s " , ecommunity_str ( l3rt - > ecom ) ) ;
2017-10-17 10:54:05 +02:00
vty_out ( vty , " \n " ) ;
2022-11-22 09:57:10 +01:00
vty_out ( vty , " RD: " ) ;
vty_out ( vty , BGP_RD_AS_FORMAT ( bgp - > asnotation ) , & bgp - > vrf_prd ) ;
vty_out ( vty , " \n " ) ;
2017-10-17 10:54:05 +02:00
} else {
json_object_string_add ( json , " vrf " , name ) ;
2021-11-18 09:55:47 +01:00
json_object_string_addf ( json , " local-ip " , " %pI4 " ,
& bgp - > originator_ip ) ;
2017-10-17 10:54:05 +02:00
json_object_int_add ( json , " l3vni " , bgp - > l3vni ) ;
json_object_string_add (
json , " rmac " ,
prefix_mac2str ( & bgp - > rmac , buf , sizeof ( buf ) ) ) ;
2018-02-06 23:28:22 +01:00
json_object_string_add (
json , " vniFilter " ,
CHECK_FLAG ( bgp - > vrf_flags ,
BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY )
? " prefix-routes-only "
: " none " ) ;
2017-10-17 10:54:05 +02:00
/* list of l2vnis */
for ( ALL_LIST_ELEMENTS_RO ( bgp - > l2vnis , node , vpn ) )
json_object_array_add ( json_vnis ,
json_object_new_int ( vpn - > vni ) ) ;
json_object_object_add ( json , " l2vnis " , json_vnis ) ;
/* export rts */
2021-02-17 22:11:49 +01:00
for ( ALL_LIST_ELEMENTS_RO ( bgp - > vrf_export_rtl , node , l3rt ) )
2017-10-17 10:54:05 +02:00
json_object_array_add (
json_export_rts ,
2021-02-17 22:11:49 +01:00
json_object_new_string (
ecommunity_str ( l3rt - > ecom ) ) ) ;
2017-10-17 10:54:05 +02:00
json_object_object_add ( json , " export-rts " , json_export_rts ) ;
/* import rts */
2021-02-17 22:11:49 +01:00
for ( ALL_LIST_ELEMENTS_RO ( bgp - > vrf_import_rtl , node , l3rt ) )
2017-10-17 10:54:05 +02:00
json_object_array_add (
json_import_rts ,
2021-02-17 22:11:49 +01:00
json_object_new_string (
ecommunity_str ( l3rt - > ecom ) ) ) ;
2017-10-17 10:54:05 +02:00
json_object_object_add ( json , " import-rts " , json_import_rts ) ;
2022-11-22 09:57:10 +01:00
json_object_string_addf ( json , " rd " ,
BGP_RD_AS_FORMAT ( bgp - > asnotation ) ,
& bgp - > vrf_prd ) ;
2017-10-17 10:54:05 +02:00
}
2017-10-09 03:34:29 +02:00
2021-11-25 23:02:37 +01:00
if ( uj )
2021-11-25 16:51:12 +01:00
vty_json ( vty , json ) ;
2017-10-09 03:34:29 +02:00
return CMD_SUCCESS ;
}
2021-02-25 22:27:07 +01:00
static int add_rt ( struct bgp * bgp , struct ecommunity * ecom , bool is_import ,
bool is_wildcard )
2021-02-25 22:06:38 +01:00
{
/* Do nothing if we already have this route-target */
if ( is_import ) {
2025-03-24 21:53:32 +01:00
if ( CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_IMPORT_RT_CFGD ) & &
bgp_evpn_vrf_rt_matches_existing ( bgp - > vrf_import_rtl , ecom ) )
2021-02-25 22:06:38 +01:00
return - 1 ;
2025-03-24 21:53:32 +01:00
bgp_evpn_configure_import_rt_for_vrf ( bgp , ecom , is_wildcard ) ;
2021-02-25 22:06:38 +01:00
} else {
2025-03-24 21:53:32 +01:00
if ( CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_EXPORT_RT_CFGD ) & &
bgp_evpn_vrf_rt_matches_existing ( bgp - > vrf_export_rtl , ecom ) )
2021-02-25 22:06:38 +01:00
return - 1 ;
2025-03-24 21:53:32 +01:00
bgp_evpn_configure_export_rt_for_vrf ( bgp , ecom ) ;
2021-02-25 22:06:38 +01:00
}
return 0 ;
}
static int del_rt ( struct bgp * bgp , struct ecommunity * ecom , bool is_import )
{
/* Verify we already have this route-target */
if ( is_import ) {
2021-02-17 22:11:49 +01:00
if ( ! bgp_evpn_vrf_rt_matches_existing ( bgp - > vrf_import_rtl ,
ecom ) )
2021-02-25 22:06:38 +01:00
return - 1 ;
bgp_evpn_unconfigure_import_rt_for_vrf ( bgp , ecom ) ;
} else {
2021-02-17 22:11:49 +01:00
if ( ! bgp_evpn_vrf_rt_matches_existing ( bgp - > vrf_export_rtl ,
ecom ) )
2021-02-25 22:06:38 +01:00
return - 1 ;
bgp_evpn_unconfigure_export_rt_for_vrf ( bgp , ecom ) ;
}
return 0 ;
}
static int parse_rtlist ( struct bgp * bgp , struct vty * vty , int argc ,
struct cmd_token * * argv , int rt_idx , bool is_add ,
bool is_import )
{
int ret = CMD_SUCCESS ;
2021-02-25 22:27:07 +01:00
bool is_wildcard = false ;
2021-02-25 22:06:38 +01:00
struct ecommunity * ecom = NULL ;
for ( int i = rt_idx ; i < argc ; i + + ) {
2021-02-25 22:27:07 +01:00
is_wildcard = false ;
/*
* Special handling for wildcard ' * ' here .
*
* Let ' s just convert it to 0 here so we dont have to modify
* the ecommunity parser .
*/
if ( ( argv [ i ] - > arg ) [ 0 ] = = ' * ' ) {
( argv [ i ] - > arg ) [ 0 ] = ' 0 ' ;
is_wildcard = true ;
}
2021-02-25 22:06:38 +01:00
ecom = ecommunity_str2com ( argv [ i ] - > arg , ECOMMUNITY_ROUTE_TARGET ,
0 ) ;
2021-02-25 22:27:07 +01:00
/* Put it back as was */
if ( is_wildcard )
( argv [ i ] - > arg ) [ 0 ] = ' * ' ;
2021-02-25 22:06:38 +01:00
if ( ! ecom ) {
vty_out ( vty , " %% Malformed Route Target list \n " ) ;
ret = CMD_WARNING ;
continue ;
}
ecommunity_str ( ecom ) ;
if ( is_add ) {
2021-02-25 22:27:07 +01:00
if ( add_rt ( bgp , ecom , is_import , is_wildcard ) ! = 0 ) {
2021-02-25 22:06:38 +01:00
vty_out ( vty ,
" %% RT specified already configured for this VRF: %s \n " ,
argv [ i ] - > arg ) ;
ecommunity_free ( & ecom ) ;
ret = CMD_WARNING ;
}
} else {
if ( del_rt ( bgp , ecom , is_import ) ! = 0 ) {
vty_out ( vty ,
" %% RT specified does not match configuration for this VRF: %s \n " ,
argv [ i ] - > arg ) ;
ret = CMD_WARNING ;
}
ecommunity_free ( & ecom ) ;
}
}
return ret ;
}
2017-10-09 03:34:29 +02:00
/* import/export rt for l3vni-vrf */
DEFUN ( bgp_evpn_vrf_rt ,
bgp_evpn_vrf_rt_cmd ,
2021-02-25 22:06:38 +01:00
" route-target <both|import|export> RTLIST... " ,
2017-10-09 03:34:29 +02:00
" Route Target \n "
" import and export \n "
" import \n "
" export \n "
2021-02-25 22:27:07 +01:00
" Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN|*:OPQR|*:MN) \n " )
2017-10-09 03:34:29 +02:00
{
2021-02-25 22:06:38 +01:00
int ret = CMD_SUCCESS ;
int tmp_ret = CMD_SUCCESS ;
2017-10-09 03:34:29 +02:00
int rt_type ;
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
if ( ! bgp )
2021-02-25 22:06:38 +01:00
return CMD_WARNING_CONFIG_FAILED ;
2017-10-09 03:34:29 +02:00
if ( ! strcmp ( argv [ 1 ] - > arg , " import " ) )
rt_type = RT_TYPE_IMPORT ;
else if ( ! strcmp ( argv [ 1 ] - > arg , " export " ) )
rt_type = RT_TYPE_EXPORT ;
else if ( ! strcmp ( argv [ 1 ] - > arg , " both " ) )
rt_type = RT_TYPE_BOTH ;
else {
vty_out ( vty , " %% Invalid Route Target type \n " ) ;
2021-02-25 22:06:38 +01:00
return CMD_WARNING_CONFIG_FAILED ;
2017-10-09 03:34:29 +02:00
}
2021-02-25 22:27:07 +01:00
if ( strmatch ( argv [ 2 ] - > arg , " auto " ) ) {
vty_out ( vty , " %% `auto` cannot be configured via list \n " ) ;
return CMD_WARNING_CONFIG_FAILED ;
2022-03-26 05:09:27 +01:00
}
2022-10-21 07:17:29 +02:00
if ( rt_type ! = RT_TYPE_IMPORT ) {
for ( int i = 2 ; i < argc ; i + + ) {
if ( ( argv [ i ] - > arg ) [ 0 ] = = ' * ' ) {
vty_out ( vty ,
" %% Wildcard '*' only applicable for import \n " ) ;
return CMD_WARNING_CONFIG_FAILED ;
}
}
}
2017-10-09 03:34:29 +02:00
/* Add/update the import route-target */
2021-02-25 22:06:38 +01:00
if ( rt_type = = RT_TYPE_BOTH | | rt_type = = RT_TYPE_IMPORT )
tmp_ret = parse_rtlist ( bgp , vty , argc , argv , 2 , true , true ) ;
2017-10-09 03:34:29 +02:00
2021-02-25 22:06:38 +01:00
if ( ret = = CMD_SUCCESS & & tmp_ret ! = CMD_SUCCESS )
ret = tmp_ret ;
2017-10-09 03:34:29 +02:00
2021-02-25 22:06:38 +01:00
if ( rt_type = = RT_TYPE_BOTH | | rt_type = = RT_TYPE_EXPORT )
tmp_ret = parse_rtlist ( bgp , vty , argc , argv , 2 , true , false ) ;
if ( ret = = CMD_SUCCESS & & tmp_ret ! = CMD_SUCCESS )
ret = tmp_ret ;
return ret ;
}
2022-08-23 18:22:08 +02:00
DEFPY ( bgp_evpn_vrf_rt_auto ,
2021-02-25 22:06:38 +01:00
bgp_evpn_vrf_rt_auto_cmd ,
2022-08-23 18:22:08 +02:00
" route-target <both|import|export>$type auto " ,
2021-02-25 22:06:38 +01:00
" Route Target \n "
" import and export \n "
" import \n "
" export \n "
" Automatically derive route target \n " )
{
2021-02-25 22:27:07 +01:00
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
int rt_type ;
if ( ! bgp )
return CMD_WARNING_CONFIG_FAILED ;
2022-08-23 18:22:08 +02:00
if ( strmatch ( type , " import " ) )
2021-02-25 22:27:07 +01:00
rt_type = RT_TYPE_IMPORT ;
2022-08-23 18:22:08 +02:00
else if ( strmatch ( type , " export " ) )
2021-02-25 22:27:07 +01:00
rt_type = RT_TYPE_EXPORT ;
2022-08-23 18:22:08 +02:00
else if ( strmatch ( type , " both " ) )
2021-02-25 22:27:07 +01:00
rt_type = RT_TYPE_BOTH ;
else {
vty_out ( vty , " %% Invalid Route Target type \n " ) ;
return CMD_WARNING_CONFIG_FAILED ;
2017-10-09 03:34:29 +02:00
}
2021-02-25 22:27:07 +01:00
if ( rt_type = = RT_TYPE_BOTH | | rt_type = = RT_TYPE_IMPORT )
bgp_evpn_configure_import_auto_rt_for_vrf ( bgp ) ;
if ( rt_type = = RT_TYPE_BOTH | | rt_type = = RT_TYPE_EXPORT )
bgp_evpn_configure_export_auto_rt_for_vrf ( bgp ) ;
2017-10-09 03:34:29 +02:00
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_vrf_rt ,
no_bgp_evpn_vrf_rt_cmd ,
2021-02-25 22:06:38 +01:00
" no route-target <both|import|export> RTLIST... " ,
2017-10-09 03:34:29 +02:00
NO_STR
" Route Target \n "
" import and export \n "
" import \n "
" export \n "
2021-02-25 22:06:38 +01:00
" Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN) \n " )
2017-10-09 03:34:29 +02:00
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
2021-02-25 22:06:38 +01:00
int ret = CMD_SUCCESS ;
int tmp_ret = CMD_SUCCESS ;
int rt_type ;
2017-10-09 03:34:29 +02:00
if ( ! bgp )
2021-02-25 22:27:07 +01:00
return CMD_WARNING_CONFIG_FAILED ;
2017-10-09 03:34:29 +02:00
if ( ! strcmp ( argv [ 2 ] - > arg , " import " ) )
rt_type = RT_TYPE_IMPORT ;
else if ( ! strcmp ( argv [ 2 ] - > arg , " export " ) )
rt_type = RT_TYPE_EXPORT ;
else if ( ! strcmp ( argv [ 2 ] - > arg , " both " ) )
rt_type = RT_TYPE_BOTH ;
else {
vty_out ( vty , " %% Invalid Route Target type \n " ) ;
2021-02-25 22:06:38 +01:00
return CMD_WARNING_CONFIG_FAILED ;
2017-10-09 03:34:29 +02:00
}
2021-02-25 22:27:07 +01:00
if ( ! strcmp ( argv [ 3 ] - > arg , " auto " ) ) {
vty_out ( vty , " %% `auto` cannot be unconfigured via list \n " ) ;
return CMD_WARNING_CONFIG_FAILED ;
2017-10-09 03:34:29 +02:00
}
if ( rt_type = = RT_TYPE_IMPORT ) {
if ( ! CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_IMPORT_RT_CFGD ) ) {
vty_out ( vty ,
" %% Import RT is not configured for this VRF \n " ) ;
2021-02-25 22:27:07 +01:00
return CMD_WARNING_CONFIG_FAILED ;
2017-10-09 03:34:29 +02:00
}
} else if ( rt_type = = RT_TYPE_EXPORT ) {
if ( ! CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_EXPORT_RT_CFGD ) ) {
vty_out ( vty ,
" %% Export RT is not configured for this VRF \n " ) ;
2021-02-25 22:27:07 +01:00
return CMD_WARNING_CONFIG_FAILED ;
2017-10-09 03:34:29 +02:00
}
} else if ( rt_type = = RT_TYPE_BOTH ) {
if ( ! CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_IMPORT_RT_CFGD )
& & ! CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_EXPORT_RT_CFGD ) ) {
vty_out ( vty ,
" %% Import/Export RT is not configured for this VRF \n " ) ;
2021-02-25 22:27:07 +01:00
return CMD_WARNING_CONFIG_FAILED ;
2017-10-09 03:34:29 +02:00
}
}
2022-10-21 07:17:29 +02:00
if ( rt_type ! = RT_TYPE_IMPORT ) {
for ( int i = 3 ; i < argc ; i + + ) {
if ( ( argv [ i ] - > arg ) [ 0 ] = = ' * ' ) {
vty_out ( vty ,
" %% Wildcard '*' only applicable for import \n " ) ;
return CMD_WARNING_CONFIG_FAILED ;
}
}
}
2021-02-25 22:06:38 +01:00
if ( rt_type = = RT_TYPE_BOTH | | rt_type = = RT_TYPE_IMPORT )
tmp_ret = parse_rtlist ( bgp , vty , argc , argv , 3 , false , true ) ;
2017-10-09 03:34:29 +02:00
2021-02-25 22:06:38 +01:00
if ( ret = = CMD_SUCCESS & & tmp_ret ! = CMD_SUCCESS )
ret = tmp_ret ;
2017-10-09 03:34:29 +02:00
2021-02-25 22:06:38 +01:00
if ( rt_type = = RT_TYPE_BOTH | | rt_type = = RT_TYPE_EXPORT )
tmp_ret = parse_rtlist ( bgp , vty , argc , argv , 3 , false , false ) ;
2017-10-09 03:34:29 +02:00
2021-02-25 22:06:38 +01:00
if ( ret = = CMD_SUCCESS & & tmp_ret ! = CMD_SUCCESS )
ret = tmp_ret ;
2017-10-09 03:34:29 +02:00
2021-02-25 22:06:38 +01:00
return ret ;
}
2017-10-09 03:34:29 +02:00
2022-08-23 18:22:08 +02:00
DEFPY ( no_bgp_evpn_vrf_rt_auto ,
2021-02-25 22:06:38 +01:00
no_bgp_evpn_vrf_rt_auto_cmd ,
2022-08-23 18:22:08 +02:00
" no route-target <both|import|export>$type auto " ,
2021-02-25 22:06:38 +01:00
NO_STR
" Route Target \n "
" import and export \n "
" import \n "
" export \n "
" Automatically derive route target \n " )
{
2021-02-25 22:27:07 +01:00
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
int rt_type ;
if ( ! bgp )
return CMD_WARNING_CONFIG_FAILED ;
2022-08-23 18:22:08 +02:00
if ( strmatch ( type , " import " ) )
2021-02-25 22:27:07 +01:00
rt_type = RT_TYPE_IMPORT ;
2022-08-23 18:22:08 +02:00
else if ( strmatch ( type , " export " ) )
2021-02-25 22:27:07 +01:00
rt_type = RT_TYPE_EXPORT ;
2022-08-23 18:22:08 +02:00
else if ( strmatch ( type , " both " ) )
2021-02-25 22:27:07 +01:00
rt_type = RT_TYPE_BOTH ;
else {
vty_out ( vty , " %% Invalid Route Target type \n " ) ;
return CMD_WARNING_CONFIG_FAILED ;
2017-10-09 03:34:29 +02:00
}
if ( rt_type = = RT_TYPE_IMPORT ) {
2021-02-25 22:27:07 +01:00
if ( ! CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_IMPORT_AUTO_RT_CFGD ) ) {
2017-10-09 03:34:29 +02:00
vty_out ( vty ,
2021-02-25 22:27:07 +01:00
" %% Import AUTO RT is not configured for this VRF \n " ) ;
return CMD_WARNING_CONFIG_FAILED ;
2017-10-09 03:34:29 +02:00
}
} else if ( rt_type = = RT_TYPE_EXPORT ) {
2021-02-25 22:27:07 +01:00
if ( ! CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_EXPORT_AUTO_RT_CFGD ) ) {
2017-10-09 03:34:29 +02:00
vty_out ( vty ,
2021-02-25 22:27:07 +01:00
" %% Export AUTO RT is not configured for this VRF \n " ) ;
return CMD_WARNING_CONFIG_FAILED ;
2017-10-09 03:34:29 +02:00
}
} else if ( rt_type = = RT_TYPE_BOTH ) {
2021-02-25 22:27:07 +01:00
if ( ! CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_IMPORT_AUTO_RT_CFGD ) & &
! CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_EXPORT_AUTO_RT_CFGD ) ) {
2017-10-09 03:34:29 +02:00
vty_out ( vty ,
2021-02-25 22:27:07 +01:00
" %% Import/Export AUTO RT is not configured for this VRF \n " ) ;
return CMD_WARNING_CONFIG_FAILED ;
2017-10-09 03:34:29 +02:00
}
}
2021-02-25 22:27:07 +01:00
if ( rt_type = = RT_TYPE_BOTH | | rt_type = = RT_TYPE_IMPORT )
bgp_evpn_unconfigure_import_auto_rt_for_vrf ( bgp ) ;
if ( rt_type = = RT_TYPE_BOTH | | rt_type = = RT_TYPE_EXPORT )
bgp_evpn_unconfigure_export_auto_rt_for_vrf ( bgp ) ;
2017-10-09 03:34:29 +02:00
return CMD_SUCCESS ;
}
2017-05-16 00:01:57 +02:00
2021-08-12 21:08:14 +02:00
DEFPY ( bgp_evpn_ead_ess_frag_evi_limit , bgp_evpn_ead_es_frag_evi_limit_cmd ,
" [no$no] ead-es-frag evi-limit (1-1000)$limit " ,
NO_STR
" EAD ES fragment config \n "
" EVIs per-fragment \n "
" limit \n " )
{
bgp_mh_info - > evi_per_es_frag =
no ? BGP_EVPN_MAX_EVI_PER_ES_FRAG : limit ;
return CMD_SUCCESS ;
}
2021-05-12 01:45:55 +02:00
DEFUN ( bgp_evpn_ead_es_rt , bgp_evpn_ead_es_rt_cmd ,
" ead-es-route-target export RT " ,
" EAD ES Route Target \n "
" export \n "
" Route target (A.B.C.D:MN|EF:OPQR|GHJK:MN) \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
struct ecommunity * ecomadd = NULL ;
if ( ! bgp )
return CMD_WARNING ;
if ( ! EVPN_ENABLED ( bgp ) ) {
vty_out ( vty , " This command is only supported under EVPN VRF \n " ) ;
return CMD_WARNING ;
}
/* Add/update the export route-target */
ecomadd = ecommunity_str2com ( argv [ 2 ] - > arg , ECOMMUNITY_ROUTE_TARGET , 0 ) ;
if ( ! ecomadd ) {
vty_out ( vty , " %% Malformed Route Target list \n " ) ;
return CMD_WARNING ;
}
ecommunity_str ( ecomadd ) ;
/* Do nothing if we already have this export route-target */
if ( ! bgp_evpn_rt_matches_existing ( bgp_mh_info - > ead_es_export_rtl ,
ecomadd ) )
bgp_evpn_mh_config_ead_export_rt ( bgp , ecomadd , false ) ;
2023-07-03 11:40:11 +02:00
else
ecommunity_free ( & ecomadd ) ;
2021-05-12 01:45:55 +02:00
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_ead_es_rt , no_bgp_evpn_ead_es_rt_cmd ,
" no ead-es-route-target export RT " ,
NO_STR
" EAD ES Route Target \n "
" export \n " EVPN_ASN_IP_HELP_STR )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
struct ecommunity * ecomdel = NULL ;
if ( ! bgp )
return CMD_WARNING ;
if ( ! EVPN_ENABLED ( bgp ) ) {
vty_out ( vty , " This command is only supported under EVPN VRF \n " ) ;
return CMD_WARNING ;
}
ecomdel = ecommunity_str2com ( argv [ 3 ] - > arg , ECOMMUNITY_ROUTE_TARGET , 0 ) ;
if ( ! ecomdel ) {
vty_out ( vty , " %% Malformed Route Target list \n " ) ;
return CMD_WARNING ;
}
ecommunity_str ( ecomdel ) ;
if ( ! bgp_evpn_rt_matches_existing ( bgp_mh_info - > ead_es_export_rtl ,
ecomdel ) ) {
2022-09-12 04:05:42 +02:00
ecommunity_free ( & ecomdel ) ;
2021-05-12 01:45:55 +02:00
vty_out ( vty ,
" %% RT specified does not match EAD-ES RT configuration \n " ) ;
return CMD_WARNING ;
}
bgp_evpn_mh_config_ead_export_rt ( bgp , ecomdel , true ) ;
2023-07-03 11:40:11 +02:00
ecommunity_free ( & ecomdel ) ;
2021-05-12 01:45:55 +02:00
return CMD_SUCCESS ;
}
2017-05-16 00:01:57 +02:00
DEFUN ( bgp_evpn_vni_rt ,
bgp_evpn_vni_rt_cmd ,
" route-target <both|import|export> RT " ,
" Route Target \n "
" import and export \n "
" import \n "
" export \n "
" Route target (A.B.C.D:MN|EF:OPQR|GHJK:MN) \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
VTY_DECLVAR_CONTEXT_SUB ( bgpevpn , vpn ) ;
int rt_type ;
struct ecommunity * ecomadd = NULL ;
2017-07-17 14:03:14 +02:00
2018-08-03 15:14:58 +02:00
if ( ! bgp )
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
2017-07-17 14:03:14 +02:00
2019-03-22 13:37:06 +01:00
if ( ! EVPN_ENABLED ( bgp ) ) {
2018-06-02 02:52:14 +02:00
vty_out ( vty ,
2019-03-06 19:15:10 +01:00
" This command is only supported under EVPN VRF \n " ) ;
2018-06-02 02:52:14 +02:00
return CMD_WARNING ;
}
2017-10-06 03:31:54 +02:00
if ( ! strcmp ( argv [ 1 ] - > text , " import " ) )
2017-05-16 00:01:57 +02:00
rt_type = RT_TYPE_IMPORT ;
2017-10-06 03:31:54 +02:00
else if ( ! strcmp ( argv [ 1 ] - > text , " export " ) )
2017-05-16 00:01:57 +02:00
rt_type = RT_TYPE_EXPORT ;
2017-10-06 03:31:54 +02:00
else if ( ! strcmp ( argv [ 1 ] - > text , " both " ) )
2017-05-16 00:01:57 +02:00
rt_type = RT_TYPE_BOTH ;
else {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Invalid Route Target type \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
/* Add/update the import route-target */
if ( rt_type = = RT_TYPE_BOTH | | rt_type = = RT_TYPE_IMPORT ) {
2023-02-06 02:27:05 +01:00
/* Note that first of the two RTs is created for "both" type */
ecomadd = ecommunity_str2com ( argv [ 2 ] - > arg ,
ECOMMUNITY_ROUTE_TARGET , 0 ) ;
if ( ! ecomadd ) {
vty_out ( vty , " %% Malformed Route Target list \n " ) ;
return CMD_WARNING ;
}
ecommunity_str ( ecomadd ) ;
2017-05-16 00:01:57 +02:00
/* Do nothing if we already have this import route-target */
2025-03-24 21:53:32 +01:00
if ( CHECK_FLAG ( vpn - > flags , VNI_FLAG_IMPRT_CFGD ) & &
bgp_evpn_rt_matches_existing ( vpn - > import_rtl , ecomadd ) )
2023-07-03 11:40:11 +02:00
ecommunity_free ( & ecomadd ) ;
2025-03-24 21:53:32 +01:00
else
evpn_configure_import_rt ( bgp , vpn , ecomadd ) ;
2017-05-16 00:01:57 +02:00
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
/* Add/update the export route-target */
if ( rt_type = = RT_TYPE_BOTH | | rt_type = = RT_TYPE_EXPORT ) {
2023-02-06 02:27:05 +01:00
/* Note that second of the two RTs is created for "both" type */
ecomadd = ecommunity_str2com ( argv [ 2 ] - > arg ,
ECOMMUNITY_ROUTE_TARGET , 0 ) ;
if ( ! ecomadd ) {
vty_out ( vty , " %% Malformed Route Target list \n " ) ;
return CMD_WARNING ;
}
ecommunity_str ( ecomadd ) ;
2017-05-16 00:01:57 +02:00
/* Do nothing if we already have this export route-target */
2025-03-24 21:53:32 +01:00
if ( CHECK_FLAG ( vpn - > flags , VNI_FLAG_EXPRT_CFGD ) & &
bgp_evpn_rt_matches_existing ( vpn - > export_rtl , ecomadd ) )
2023-07-03 11:40:11 +02:00
ecommunity_free ( & ecomadd ) ;
2025-03-24 21:53:32 +01:00
else
evpn_configure_export_rt ( bgp , vpn , ecomadd ) ;
2017-05-16 00:01:57 +02:00
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_vni_rt ,
no_bgp_evpn_vni_rt_cmd ,
" no route-target <both|import|export> RT " ,
NO_STR
" Route Target \n "
" import and export \n "
" import \n "
" export \n "
2020-10-06 21:58:12 +02:00
EVPN_ASN_IP_HELP_STR )
2017-05-16 00:01:57 +02:00
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
VTY_DECLVAR_CONTEXT_SUB ( bgpevpn , vpn ) ;
int rt_type , found_ecomdel ;
struct ecommunity * ecomdel = NULL ;
2017-07-17 14:03:14 +02:00
2018-08-03 15:14:58 +02:00
if ( ! bgp )
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
2017-07-17 14:03:14 +02:00
2019-03-22 13:37:06 +01:00
if ( ! EVPN_ENABLED ( bgp ) ) {
2018-06-02 02:52:14 +02:00
vty_out ( vty ,
2019-03-06 19:15:10 +01:00
" This command is only supported under EVPN VRF \n " ) ;
2018-06-02 02:52:14 +02:00
return CMD_WARNING ;
}
2017-10-06 03:31:54 +02:00
if ( ! strcmp ( argv [ 2 ] - > text , " import " ) )
2017-05-16 00:01:57 +02:00
rt_type = RT_TYPE_IMPORT ;
2017-10-06 03:31:54 +02:00
else if ( ! strcmp ( argv [ 2 ] - > text , " export " ) )
2017-05-16 00:01:57 +02:00
rt_type = RT_TYPE_EXPORT ;
2017-10-06 03:31:54 +02:00
else if ( ! strcmp ( argv [ 2 ] - > text , " both " ) )
2017-05-16 00:01:57 +02:00
rt_type = RT_TYPE_BOTH ;
else {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Invalid Route Target type \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
/* The user did "no route-target import", check to see if there are any
* import route - targets configured . */
if ( rt_type = = RT_TYPE_IMPORT ) {
if ( ! is_import_rt_configured ( vpn ) ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty ,
" %% Import RT is not configured for this VNI \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
} else if ( rt_type = = RT_TYPE_EXPORT ) {
if ( ! is_export_rt_configured ( vpn ) ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty ,
" %% Export RT is not configured for this VNI \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
} else if ( rt_type = = RT_TYPE_BOTH ) {
if ( ! is_import_rt_configured ( vpn )
& & ! is_export_rt_configured ( vpn ) ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty ,
" %% Import/Export RT is not configured for this VNI \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
2017-07-17 14:03:14 +02:00
}
2017-05-16 00:01:57 +02:00
ecomdel = ecommunity_str2com ( argv [ 3 ] - > arg , ECOMMUNITY_ROUTE_TARGET , 0 ) ;
if ( ! ecomdel ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Malformed Route Target list \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
2017-06-29 23:16:49 +02:00
ecommunity_str ( ecomdel ) ;
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
if ( rt_type = = RT_TYPE_IMPORT ) {
if ( ! bgp_evpn_rt_matches_existing ( vpn - > import_rtl , ecomdel ) ) {
2022-09-12 04:05:42 +02:00
ecommunity_free ( & ecomdel ) ;
2017-07-14 14:52:45 +02:00
vty_out ( vty ,
" %% RT specified does not match configuration for this VNI \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
evpn_unconfigure_import_rt ( bgp , vpn , ecomdel ) ;
} else if ( rt_type = = RT_TYPE_EXPORT ) {
if ( ! bgp_evpn_rt_matches_existing ( vpn - > export_rtl , ecomdel ) ) {
2022-09-12 04:05:42 +02:00
ecommunity_free ( & ecomdel ) ;
2017-07-14 14:52:45 +02:00
vty_out ( vty ,
" %% RT specified does not match configuration for this VNI \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
evpn_unconfigure_export_rt ( bgp , vpn , ecomdel ) ;
} else if ( rt_type = = RT_TYPE_BOTH ) {
found_ecomdel = 0 ;
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
if ( bgp_evpn_rt_matches_existing ( vpn - > import_rtl , ecomdel ) ) {
evpn_unconfigure_import_rt ( bgp , vpn , ecomdel ) ;
found_ecomdel = 1 ;
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
if ( bgp_evpn_rt_matches_existing ( vpn - > export_rtl , ecomdel ) ) {
evpn_unconfigure_export_rt ( bgp , vpn , ecomdel ) ;
found_ecomdel = 1 ;
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
if ( ! found_ecomdel ) {
2022-09-12 04:05:42 +02:00
ecommunity_free ( & ecomdel ) ;
2017-07-14 14:52:45 +02:00
vty_out ( vty ,
" %% RT specified does not match configuration for this VNI \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
}
2017-07-17 14:03:14 +02:00
2023-07-03 11:40:11 +02:00
ecommunity_free ( & ecomdel ) ;
2017-05-16 00:01:57 +02:00
return CMD_SUCCESS ;
}
DEFUN ( no_bgp_evpn_vni_rt_without_val ,
no_bgp_evpn_vni_rt_without_val_cmd ,
" no route-target <import|export> " ,
NO_STR
" Route Target \n "
" import \n "
" export \n " )
{
struct bgp * bgp = VTY_GET_CONTEXT ( bgp ) ;
VTY_DECLVAR_CONTEXT_SUB ( bgpevpn , vpn ) ;
int rt_type ;
2017-07-17 14:03:14 +02:00
2018-08-03 15:14:58 +02:00
if ( ! bgp )
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
2017-07-17 14:03:14 +02:00
2019-03-22 13:37:06 +01:00
if ( ! EVPN_ENABLED ( bgp ) ) {
2018-06-02 02:52:14 +02:00
vty_out ( vty ,
2019-03-06 19:15:10 +01:00
" This command is only supported under EVPN VRF \n " ) ;
2018-06-02 02:52:14 +02:00
return CMD_WARNING ;
}
2017-10-06 03:31:54 +02:00
if ( ! strcmp ( argv [ 2 ] - > text , " import " ) ) {
2017-05-16 00:01:57 +02:00
rt_type = RT_TYPE_IMPORT ;
2017-10-06 03:31:54 +02:00
} else if ( ! strcmp ( argv [ 2 ] - > text , " export " ) ) {
2017-05-16 00:01:57 +02:00
rt_type = RT_TYPE_EXPORT ;
} else {
2017-07-14 14:52:45 +02:00
vty_out ( vty , " %% Invalid Route Target type \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
/* Check if we should disallow. */
if ( rt_type = = RT_TYPE_IMPORT ) {
if ( ! is_import_rt_configured ( vpn ) ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty ,
" %% Import RT is not configured for this VNI \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
}
} else {
if ( ! is_export_rt_configured ( vpn ) ) {
2017-07-14 14:52:45 +02:00
vty_out ( vty ,
" %% Export RT is not configured for this VNI \n " ) ;
2017-05-16 00:01:57 +02:00
return CMD_WARNING ;
2017-07-17 14:03:14 +02:00
}
2017-05-16 00:01:57 +02:00
}
2017-07-17 14:03:14 +02:00
2017-05-16 00:01:57 +02:00
/* Unconfigure the RT. */
if ( rt_type = = RT_TYPE_IMPORT )
evpn_unconfigure_import_rt ( bgp , vpn , NULL ) ;
else
evpn_unconfigure_export_rt ( bgp , vpn , NULL ) ;
return CMD_SUCCESS ;
}
2018-05-25 18:39:38 +02:00
static int vni_cmp ( const void * * a , const void * * b )
{
const struct bgpevpn * first = * a ;
const struct bgpevpn * secnd = * b ;
return secnd - > vni - first - > vni ;
}
2017-05-16 00:01:57 +02:00
/*
* Output EVPN configuration information .
*/
void bgp_config_write_evpn_info ( struct vty * vty , struct bgp * bgp , afi_t afi ,
2017-08-27 22:18:32 +02:00
safi_t safi )
2017-05-16 00:01:57 +02:00
{
2020-06-02 07:42:19 +02:00
if ( bgp - > advertise_all_vni )
vty_out ( vty , " advertise-all-vni \n " ) ;
2022-05-12 03:25:16 +02:00
if ( hashcount ( bgp - > vnihash ) ) {
2018-05-25 18:39:38 +02:00
struct list * vnilist = hash_to_list ( bgp - > vnihash ) ;
struct listnode * ln ;
struct bgpevpn * data ;
list_sort ( vnilist , vni_cmp ) ;
for ( ALL_LIST_ELEMENTS_RO ( vnilist , ln , data ) )
write_vni_config ( vty , data ) ;
2018-10-02 11:39:51 +02:00
list_delete ( & vnilist ) ;
2018-05-25 18:39:38 +02:00
}
2017-05-16 00:01:57 +02:00
2017-04-12 11:24:07 +02:00
if ( bgp - > advertise_autort_rfc8365 )
vty_out ( vty , " autort rfc8365-compatible \n " ) ;
2017-08-27 22:18:32 +02:00
if ( bgp - > advertise_gw_macip )
2017-06-28 10:51:10 +02:00
vty_out ( vty , " advertise-default-gw \n " ) ;
2017-11-05 02:36:19 +01:00
2019-02-04 03:08:46 +01:00
if ( bgp - > evpn_info - > advertise_svi_macip )
vty_out ( vty , " advertise-svi-ip \n " ) ;
2023-05-08 04:51:28 +02:00
if ( bgp - > evpn_info - > soo ) {
char * ecom_str ;
ecom_str = ecommunity_ecom2str ( bgp - > evpn_info - > soo ,
ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
vty_out ( vty , " mac-vrf soo %s \n " , ecom_str ) ;
ecommunity_strfree ( & ecom_str ) ;
}
2021-05-12 00:26:29 +02:00
if ( bgp - > resolve_overlay_index )
vty_out ( vty , " enable-resolve-overlay-index \n " ) ;
2021-08-12 21:08:14 +02:00
if ( bgp_mh_info - > evi_per_es_frag ! = BGP_EVPN_MAX_EVI_PER_ES_FRAG )
vty_out ( vty , " ead-es-frag evi-limit %u \n " ,
bgp_mh_info - > evi_per_es_frag ) ;
2020-05-19 00:55:39 +02:00
if ( bgp_mh_info - > host_routes_use_l3nhg ! =
BGP_EVPN_MH_USE_ES_L3NHG_DEF ) {
if ( bgp_mh_info - > host_routes_use_l3nhg )
vty_out ( vty , " use-es-l3nhg \n " ) ;
else
vty_out ( vty , " no use-es-l3nhg \n " ) ;
}
2020-08-26 03:31:29 +02:00
if ( bgp_mh_info - > ead_evi_rx ! = BGP_EVPN_MH_EAD_EVI_RX_DEF ) {
if ( bgp_mh_info - > ead_evi_rx )
vty_out ( vty , " no disable-ead-evi-rx \n " ) ;
else
vty_out ( vty , " disable-ead-evi-rx \n " ) ;
}
if ( bgp_mh_info - > ead_evi_tx ! = BGP_EVPN_MH_EAD_EVI_TX_DEF ) {
if ( bgp_mh_info - > ead_evi_tx )
vty_out ( vty , " no disable-ead-evi-tx \n " ) ;
else
vty_out ( vty , " disable-ead-evi-tx \n " ) ;
}
2018-11-01 16:28:08 +01:00
if ( ! bgp - > evpn_info - > dup_addr_detect )
vty_out ( vty , " no dup-addr-detection \n " ) ;
if ( bgp - > evpn_info - > dad_max_moves ! =
EVPN_DAD_DEFAULT_MAX_MOVES | |
bgp - > evpn_info - > dad_time ! = EVPN_DAD_DEFAULT_TIME )
vty_out ( vty , " dup-addr-detection max-moves %u time %u \n " ,
bgp - > evpn_info - > dad_max_moves ,
bgp - > evpn_info - > dad_time ) ;
if ( bgp - > evpn_info - > dad_freeze ) {
if ( bgp - > evpn_info - > dad_freeze_time )
vty_out ( vty ,
" dup-addr-detection freeze %u \n " ,
bgp - > evpn_info - > dad_freeze_time ) ;
else
vty_out ( vty ,
" dup-addr-detection freeze permanent \n " ) ;
}
2018-10-05 01:20:12 +02:00
if ( bgp - > vxlan_flood_ctrl = = VXLAN_FLOOD_DISABLED )
vty_out ( vty , " flooding disable \n " ) ;
2018-02-20 09:46:22 +01:00
if ( CHECK_FLAG ( bgp - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
2021-01-05 03:31:11 +01:00
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST ) ) {
2018-04-10 12:02:24 +02:00
if ( bgp - > adv_cmd_rmap [ AFI_IP ] [ SAFI_UNICAST ] . name )
vty_out ( vty , " advertise ipv4 unicast route-map %s \n " ,
bgp - > adv_cmd_rmap [ AFI_IP ] [ SAFI_UNICAST ] . name ) ;
else
2021-01-05 03:31:11 +01:00
vty_out ( vty ,
" advertise ipv4 unicast \n " ) ;
} else if ( CHECK_FLAG ( bgp - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV4_UNICAST_GW_IP ) ) {
if ( bgp - > adv_cmd_rmap [ AFI_IP ] [ SAFI_UNICAST ] . name )
vty_out ( vty ,
" advertise ipv4 unicast gateway-ip route-map %s \n " ,
bgp - > adv_cmd_rmap [ AFI_IP ] [ SAFI_UNICAST ] . name ) ;
else
vty_out ( vty , " advertise ipv4 unicast gateway-ip \n " ) ;
2018-04-10 12:02:24 +02:00
}
2017-11-05 02:36:19 +01:00
2021-05-12 01:45:55 +02:00
/* EAD ES export route-target */
if ( listcount ( bgp_mh_info - > ead_es_export_rtl ) ) {
struct ecommunity * ecom ;
char * ecom_str ;
struct listnode * node ;
for ( ALL_LIST_ELEMENTS_RO ( bgp_mh_info - > ead_es_export_rtl , node ,
ecom ) ) {
ecom_str = ecommunity_ecom2str (
ecom , ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
vty_out ( vty , " ead-es-route-target export %s \n " ,
ecom_str ) ;
XFREE ( MTYPE_ECOMMUNITY_STR , ecom_str ) ;
}
}
2018-02-20 09:46:22 +01:00
if ( CHECK_FLAG ( bgp - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
2021-01-05 03:31:11 +01:00
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST ) ) {
2018-04-10 12:02:24 +02:00
if ( bgp - > adv_cmd_rmap [ AFI_IP6 ] [ SAFI_UNICAST ] . name )
2021-01-05 03:31:11 +01:00
vty_out ( vty ,
" advertise ipv6 unicast route-map %s \n " ,
bgp - > adv_cmd_rmap [ AFI_IP6 ] [ SAFI_UNICAST ] . name ) ;
else
vty_out ( vty ,
" advertise ipv6 unicast \n " ) ;
} else if ( CHECK_FLAG ( bgp - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_ADV_IPV6_UNICAST_GW_IP ) ) {
if ( bgp - > adv_cmd_rmap [ AFI_IP6 ] [ SAFI_UNICAST ] . name )
vty_out ( vty ,
" advertise ipv6 unicast gateway-ip route-map %s \n " ,
2018-04-10 12:02:24 +02:00
bgp - > adv_cmd_rmap [ AFI_IP6 ] [ SAFI_UNICAST ] . name ) ;
else
2021-01-05 03:31:11 +01:00
vty_out ( vty , " advertise ipv6 unicast gateway-ip \n " ) ;
2018-04-10 12:02:24 +02:00
}
2018-02-16 02:20:27 +01:00
if ( CHECK_FLAG ( bgp - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4 ) )
vty_out ( vty , " default-originate ipv4 \n " ) ;
if ( CHECK_FLAG ( bgp - > af_flags [ AFI_L2VPN ] [ SAFI_EVPN ] ,
BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6 ) )
vty_out ( vty , " default-originate ipv6 \n " ) ;
2018-02-27 21:52:24 +01:00
2019-04-18 09:17:57 +02:00
if ( bgp - > inst_type = = BGP_INSTANCE_TYPE_VRF ) {
if ( ! bgp - > evpn_info - > advertise_pip )
vty_out ( vty , " no advertise-pip \n " ) ;
if ( bgp - > evpn_info - > advertise_pip ) {
2020-01-06 23:48:57 +01:00
if ( bgp - > evpn_info - > pip_ip_static . s_addr
! = INADDR_ANY ) {
2022-11-29 09:23:20 +01:00
vty_out ( vty , " advertise-pip ip %pI4 " ,
& bgp - > evpn_info - > pip_ip_static ) ;
2020-01-06 23:48:57 +01:00
if ( ! is_zero_mac ( & (
bgp - > evpn_info - > pip_rmac_static ) ) ) {
char buf [ ETHER_ADDR_STRLEN ] ;
vty_out ( vty , " mac %s " ,
prefix_mac2str (
& bgp - > evpn_info
- > pip_rmac ,
buf , sizeof ( buf ) ) ) ;
}
vty_out ( vty , " \n " ) ;
2019-04-18 09:17:57 +02:00
}
}
}
2018-02-19 11:04:27 +01:00
if ( CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_RD_CFGD ) )
2022-11-22 11:20:51 +01:00
vty_out ( vty , " rd %s \n " , bgp - > vrf_prd_pretty ) ;
2018-02-19 11:04:27 +01:00
2018-02-19 10:39:48 +01:00
/* import route-target */
if ( CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_IMPORT_RT_CFGD ) ) {
char * ecom_str ;
struct listnode * node , * nnode ;
2021-02-17 22:11:49 +01:00
struct vrf_route_target * l3rt ;
2018-02-19 10:39:48 +01:00
for ( ALL_LIST_ELEMENTS ( bgp - > vrf_import_rtl , node , nnode ,
2021-02-17 22:11:49 +01:00
l3rt ) ) {
2021-02-25 22:27:07 +01:00
if ( CHECK_FLAG ( l3rt - > flags , BGP_VRF_RT_AUTO ) )
continue ;
2018-02-19 10:39:48 +01:00
ecom_str = ecommunity_ecom2str (
2021-02-17 22:11:49 +01:00
l3rt - > ecom , ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
2021-02-25 22:27:07 +01:00
if ( CHECK_FLAG ( l3rt - > flags , BGP_VRF_RT_WILD ) ) {
char * vni_str = NULL ;
2022-10-21 17:18:12 +02:00
vni_str = strchr ( ecom_str , ' : ' ) ;
2022-11-01 03:09:15 +01:00
if ( ! vni_str ) {
XFREE ( MTYPE_ECOMMUNITY_STR , ecom_str ) ;
continue ;
}
2021-02-25 22:27:07 +01:00
2022-10-21 17:18:12 +02:00
/* Move pointer to vni */
vni_str + = 1 ;
2021-02-25 22:27:07 +01:00
vty_out ( vty , " route-target import *:%s \n " ,
vni_str ) ;
} else
vty_out ( vty , " route-target import %s \n " ,
ecom_str ) ;
2018-02-19 10:39:48 +01:00
XFREE ( MTYPE_ECOMMUNITY_STR , ecom_str ) ;
}
}
2021-02-25 22:27:07 +01:00
/* import route-target auto */
if ( CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_IMPORT_AUTO_RT_CFGD ) )
vty_out ( vty , " route-target import auto \n " ) ;
2018-02-19 10:39:48 +01:00
/* export route-target */
if ( CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_EXPORT_RT_CFGD ) ) {
char * ecom_str ;
struct listnode * node , * nnode ;
2021-02-17 22:11:49 +01:00
struct vrf_route_target * l3rt ;
2018-02-19 10:39:48 +01:00
for ( ALL_LIST_ELEMENTS ( bgp - > vrf_export_rtl , node , nnode ,
2021-02-17 22:11:49 +01:00
l3rt ) ) {
2021-02-25 22:27:07 +01:00
if ( CHECK_FLAG ( l3rt - > flags , BGP_VRF_RT_AUTO ) )
continue ;
2018-02-19 10:39:48 +01:00
ecom_str = ecommunity_ecom2str (
2021-02-17 22:11:49 +01:00
l3rt - > ecom , ECOMMUNITY_FORMAT_ROUTE_MAP , 0 ) ;
2018-12-07 03:03:58 +01:00
vty_out ( vty , " route-target export %s \n " , ecom_str ) ;
2018-02-19 10:39:48 +01:00
XFREE ( MTYPE_ECOMMUNITY_STR , ecom_str ) ;
}
}
2021-02-25 22:27:07 +01:00
/* export route-target auto */
if ( CHECK_FLAG ( bgp - > vrf_flags , BGP_VRF_EXPORT_AUTO_RT_CFGD ) )
vty_out ( vty , " route-target export auto \n " ) ;
2017-05-16 00:01:57 +02:00
}
2017-01-27 08:25:27 +01:00
void bgp_ethernetvpn_init ( void )
2017-01-09 18:26:24 +01:00
{
2017-05-15 23:30:19 +02:00
install_element ( VIEW_NODE , & show_ip_bgp_l2vpn_evpn_cmd ) ;
install_element ( VIEW_NODE , & show_ip_bgp_l2vpn_evpn_rd_cmd ) ;
install_element ( VIEW_NODE , & show_ip_bgp_l2vpn_evpn_all_tags_cmd ) ;
install_element ( VIEW_NODE , & show_ip_bgp_l2vpn_evpn_rd_tags_cmd ) ;
install_element ( VIEW_NODE ,
2019-08-08 04:58:18 +02:00
& show_ip_bgp_l2vpn_evpn_neighbor_routes_cmd ) ;
2017-05-15 23:30:19 +02:00
install_element ( VIEW_NODE ,
& show_ip_bgp_l2vpn_evpn_rd_neighbor_routes_cmd ) ;
install_element (
VIEW_NODE ,
2019-08-08 04:58:18 +02:00
& show_ip_bgp_l2vpn_evpn_neighbor_advertised_routes_cmd ) ;
2017-05-15 23:30:19 +02:00
install_element (
VIEW_NODE ,
& show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes_cmd ) ;
install_element ( VIEW_NODE , & show_ip_bgp_evpn_rd_overlay_cmd ) ;
install_element ( VIEW_NODE , & show_ip_bgp_l2vpn_evpn_all_overlay_cmd ) ;
install_element ( BGP_EVPN_NODE , & no_evpnrt5_network_cmd ) ;
install_element ( BGP_EVPN_NODE , & evpnrt5_network_cmd ) ;
install_element ( BGP_EVPN_NODE , & bgp_evpn_advertise_all_vni_cmd ) ;
install_element ( BGP_EVPN_NODE , & no_bgp_evpn_advertise_all_vni_cmd ) ;
2017-04-12 11:24:07 +02:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_advertise_autort_rfc8365_cmd ) ;
install_element ( BGP_EVPN_NODE , & no_bgp_evpn_advertise_autort_rfc8365_cmd ) ;
2017-06-28 10:51:10 +02:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_advertise_default_gw_cmd ) ;
install_element ( BGP_EVPN_NODE , & no_bgp_evpn_advertise_default_gw_cmd ) ;
2019-02-04 03:08:46 +01:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_advertise_svi_ip_cmd ) ;
2023-05-08 04:51:28 +02:00
install_element ( BGP_EVPN_NODE , & macvrf_soo_global_cmd ) ;
install_element ( BGP_EVPN_NODE , & no_macvrf_soo_global_cmd ) ;
2017-10-27 23:15:45 +02:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_advertise_type5_cmd ) ;
install_element ( BGP_EVPN_NODE , & no_bgp_evpn_advertise_type5_cmd ) ;
2018-02-16 02:20:27 +01:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_default_originate_cmd ) ;
install_element ( BGP_EVPN_NODE , & no_bgp_evpn_default_originate_cmd ) ;
2018-11-01 16:28:08 +01:00
install_element ( BGP_EVPN_NODE , & dup_addr_detection_cmd ) ;
install_element ( BGP_EVPN_NODE , & dup_addr_detection_auto_recovery_cmd ) ;
install_element ( BGP_EVPN_NODE , & no_dup_addr_detection_cmd ) ;
2018-10-05 01:20:12 +02:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_flood_control_cmd ) ;
2019-04-18 09:17:57 +02:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_advertise_pip_ip_mac_cmd ) ;
2020-05-19 00:55:39 +02:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_use_es_l3nhg_cmd ) ;
2020-08-26 03:31:29 +02:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_ead_evi_rx_disable_cmd ) ;
install_element ( BGP_EVPN_NODE , & bgp_evpn_ead_evi_tx_disable_cmd ) ;
2021-05-12 00:26:29 +02:00
install_element ( BGP_EVPN_NODE ,
& bgp_evpn_enable_resolve_overlay_index_cmd ) ;
2017-07-17 14:03:14 +02:00
2018-04-14 00:01:12 +02:00
/* test commands */
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
install_element ( BGP_EVPN_NODE , & test_es_add_cmd ) ;
install_element ( BGP_EVPN_NODE , & test_es_vni_add_cmd ) ;
2018-04-14 00:01:12 +02:00
2017-06-08 07:43:19 +02:00
/* "show bgp l2vpn evpn" commands. */
2018-04-14 00:01:12 +02:00
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_es_cmd ) ;
bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI Flags RD #VNIs VTEPs
03:00:00:00:00:01:11:00:00:01 LR 27.0.0.15:15 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02 LR 27.0.0.15:16 10 27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03 LR 27.0.0.15:17 10 27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02 R - 10 27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03 R - 10 27.0.0.17(A),27.0.0.18(A)
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI ESI Flags VTEPs
1005 03:00:00:00:00:01:11:00:00:01 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:02 LR 27.0.0.16(EV)
1005 03:00:00:00:00:01:22:00:00:03 LR 27.0.0.16(EV)
1005 03:00:00:00:00:02:11:00:00:01 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:02 R 27.0.0.17(EV),27.0.0.18(EV)
1005 03:00:00:00:00:02:22:00:00:03 R 27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
Network Next Hop Metric LocPrf Weight Path
Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
27.0.0.15 32768 i
ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-28 17:23:40 +01:00
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_es_evi_cmd ) ;
2020-05-09 04:49:33 +02:00
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_es_vrf_cmd ) ;
2020-09-12 19:36:01 +02:00
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_nh_cmd ) ;
2017-06-08 07:43:19 +02:00
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_vni_cmd ) ;
bgpd: EVPN route type-5 to type-2 recursive resolution using gateway IP
When EVPN prefix route with a gateway IP overlay index is imported into the IP
vrf at the ingress PE, BGP nexthop of this route is set to the gateway IP.
For this vrf route to be valid, following conditions must be met.
- Gateway IP nexthop of this route should be L3 reachable, i.e., this route
should be resolved in RIB.
- A remote MAC/IP route should be present for the gateway IP address in the
EVI(L2VPN table).
To check for the first condition, gateway IP is registered with nht (nexthop
tracking) to receive the reachability notifications for this IP from zebra RIB.
If the gateway IP is reachable, zebra sends the reachability information (i.e.,
nexthop interface) for the gateway IP.
This nexthop interface should be the SVI interface.
Now, to find out type-2 route corresponding to the gateway IP, we need to fetch
the VNI for the above SVI.
To do this VNI lookup effitiently, define a hashtable of struct bgpevpn with
svi_ifindex as key.
struct hash *vni_svi_hash;
An EVI instance is added to vni_svi_hash if its svi_ifindex is nonzero.
Using this hash, we obtain struct bgpevpn corresponding to the gateway IP.
For gateway IP overlay index recursive lookup, once we find the correct EVI, we
have to lookup its route table for a MAC/IP prefix. As we have to iterate the
entire route table for every lookup, this lookup is expensive. We can optimize
this lookup by adding all the remote IP addresses in a hash table.
Following hash table is defined for this purpose in struct bgpevpn
Struct hash *remote_ip_hash;
When a MAC/IP route is installed in the EVI table, it is also added to
remote_ip_hash.
It is possible to have multiple MAC/IP routes with the same IP address because
of host move scenarios. Thus, for every address addr in remote_ip_hash, we
maintain list of all the MAC/IP routes having addr as their IP address.
Following structure defines an address in remote_ip_hash.
struct evpn_remote_ip {
struct ipaddr addr;
struct list *macip_path_list;
};
A Boolean field is added to struct bgp_nexthop_cache to indicate that the
nexthop is EVPN gateway IP overlay index.
bool is_evpn_gwip_nexthop;
A flag BGP_NEXTHOP_EVPN_INCOMPLETE is added to struct bgp_nexthop_cache.
This flag is set when the gateway IP is L3 reachable but not yet resolved by a
MAC/IP route.
Following table explains the combination of L3 and L2 reachability w.r.t.
BGP_NEXTHOP_VALID and BGP_NEXTHOP_EVPN_INCOMPLETE flags
* | MACIP resolved | MACIP unresolved
*----------------|----------------|------------------
* L3 reachable | VALID = 1 | VALID = 0
* | INCOMPLETE = 0 | INCOMPLETE = 1
* ---------------|----------------|--------------------
* L3 unreachable | VALID = 0 | VALID = 0
* | INCOMPLETE = 0 | INCOMPLETE = 0
Procedure that we use to check if the gateway IP is resolvable by a MAC/IP
route:
- Find the EVI/L2VRF that belongs to the nexthop SVI using vni_svi_hash.
- Check if the gateway IP is present in remote_ip_hash in this EVI.
When the gateway IP is L3 reachable and it is also resolved by a MAC/IP route,
unset BGP_NEXTHOP_EVPN_INCOMPLETE flag and set BGP_NEXTHOP_VALID flag.
Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2021-01-11 12:51:56 +01:00
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_vni_remote_ip_hash_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_vni_svi_hash_cmd ) ;
2017-06-08 07:43:19 +02:00
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_summary_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_route_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_route_rd_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_route_rd_macip_cmd ) ;
2018-04-14 00:01:12 +02:00
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_route_esi_cmd ) ;
2017-06-08 07:43:19 +02:00
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_route_vni_cmd ) ;
install_element ( VIEW_NODE ,
& show_bgp_l2vpn_evpn_route_vni_multicast_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_route_vni_macip_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_route_vni_all_cmd ) ;
2020-08-18 15:52:40 +02:00
install_element ( VIEW_NODE ,
& show_bgp_l2vpn_evpn_route_mac_ip_evi_es_cmd ) ;
2020-08-18 01:24:50 +02:00
install_element ( VIEW_NODE ,
& show_bgp_l2vpn_evpn_route_mac_ip_global_es_cmd ) ;
2017-06-08 07:43:19 +02:00
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_import_rt_cmd ) ;
2017-10-10 03:12:05 +02:00
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_vrf_import_rt_cmd ) ;
2017-07-17 14:03:14 +02:00
2021-10-26 23:55:54 +02:00
/* "show bgp vni" commands. */
install_element ( VIEW_NODE , & show_bgp_vni_all_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_vni_all_ead_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_vni_all_macip_mac_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_vni_all_macip_ip_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_vni_all_imet_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_vni_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_vni_ead_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_vni_macip_mac_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_vni_macip_ip_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_vni_imet_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_vni_macip_mac_addr_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_vni_macip_ip_addr_cmd ) ;
2017-06-28 20:30:36 +02:00
/* "show bgp evpn" commands. */
install_element ( VIEW_NODE , & show_bgp_evpn_vni_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_evpn_summary_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_evpn_route_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_evpn_route_rd_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_evpn_route_rd_macip_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_evpn_route_vni_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_evpn_route_vni_multicast_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_evpn_route_vni_macip_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_evpn_route_vni_all_cmd ) ;
install_element ( VIEW_NODE , & show_bgp_evpn_import_rt_cmd ) ;
2017-10-09 03:34:29 +02:00
install_element ( VIEW_NODE , & show_bgp_vrf_l3vni_info_cmd ) ;
2019-10-07 23:58:39 +02:00
install_element ( VIEW_NODE , & show_bgp_l2vpn_evpn_com_cmd ) ;
2017-06-28 20:30:36 +02:00
2017-05-16 00:01:57 +02:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_vni_cmd ) ;
install_element ( BGP_EVPN_NODE , & no_bgp_evpn_vni_cmd ) ;
install_element ( BGP_EVPN_VNI_NODE , & exit_vni_cmd ) ;
install_element ( BGP_EVPN_VNI_NODE , & bgp_evpn_vni_rd_cmd ) ;
install_element ( BGP_EVPN_VNI_NODE , & no_bgp_evpn_vni_rd_cmd ) ;
install_element ( BGP_EVPN_VNI_NODE , & no_bgp_evpn_vni_rd_without_val_cmd ) ;
install_element ( BGP_EVPN_VNI_NODE , & bgp_evpn_vni_rt_cmd ) ;
install_element ( BGP_EVPN_VNI_NODE , & no_bgp_evpn_vni_rt_cmd ) ;
install_element ( BGP_EVPN_VNI_NODE , & no_bgp_evpn_vni_rt_without_val_cmd ) ;
2017-11-11 13:17:02 +01:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_vrf_rd_cmd ) ;
install_element ( BGP_EVPN_NODE , & no_bgp_evpn_vrf_rd_cmd ) ;
2017-10-26 01:49:18 +02:00
install_element ( BGP_NODE , & no_bgp_evpn_vrf_rd_without_val_cmd ) ;
2017-11-11 13:06:58 +01:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_vrf_rt_cmd ) ;
install_element ( BGP_EVPN_NODE , & no_bgp_evpn_vrf_rt_cmd ) ;
2021-02-25 22:06:38 +01:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_vrf_rt_auto_cmd ) ;
install_element ( BGP_EVPN_NODE , & no_bgp_evpn_vrf_rt_auto_cmd ) ;
2021-05-12 01:45:55 +02:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_ead_es_rt_cmd ) ;
install_element ( BGP_EVPN_NODE , & no_bgp_evpn_ead_es_rt_cmd ) ;
2021-08-12 21:08:14 +02:00
install_element ( BGP_EVPN_NODE , & bgp_evpn_ead_es_frag_evi_limit_cmd ) ;
2019-02-04 03:08:46 +01:00
install_element ( BGP_EVPN_VNI_NODE , & bgp_evpn_advertise_svi_ip_vni_cmd ) ;
2017-06-28 10:51:10 +02:00
install_element ( BGP_EVPN_VNI_NODE ,
& bgp_evpn_advertise_default_gw_vni_cmd ) ;
install_element ( BGP_EVPN_VNI_NODE ,
& no_bgp_evpn_advertise_default_gw_vni_cmd ) ;
2017-11-20 06:47:04 +01:00
install_element ( BGP_EVPN_VNI_NODE , & bgp_evpn_advertise_vni_subnet_cmd ) ;
install_element ( BGP_EVPN_VNI_NODE ,
& no_bgp_evpn_advertise_vni_subnet_cmd ) ;
2017-01-09 18:26:24 +01:00
}