From bd44ab083155186c21d5296e91bf211627370453 Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Tue, 8 Feb 2022 12:59:16 -0800 Subject: [PATCH 1/3] bgpd: evpn route-map match ead type-1 route-type Add evpn mh route type-1 (EAD) to match clause of route-map. Ticket: issue#10461 Reviewed By: Testing Done: With fix: vtep1(config-route-map)# match evpn route-type 1 EAD (Type-1) route 2 MAC-IP (Type-2) route 3 Multicast (Type-3) route 5 Prefix (Type-5) route ead EAD (Type-1) route macip MAC-IP (Type-2) route multicast Multicast (Type-3) route prefix Prefix (Type-5) route vtep1# show running-config bgpd .... route-map HOST_ALLOW_1 permit 1 match evpn route-type ead vtep1# show route-map HOST_ALLOW_1 BGP: route-map: HOST_ALLOW_1 Invoked: 6 Optimization: disabled Processed Change: false permit, sequence 1 Invoked 6 Match clauses: ip address prefix-list LOCAL_HOST_VRF1 evpn route-type ead Signed-off-by: Chirag Shah --- bgpd/bgp_routemap.c | 12 +++++++++--- yang/frr-bgp-route-map.yang | 5 +++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index fa03276f64..3bcf2a7986 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -1039,7 +1039,9 @@ static void *route_match_evpn_route_type_compile(const char *arg) route_type = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint8_t)); - if (strncmp(arg, "ma", 2) == 0) + if (strncmp(arg, "ea", 2) == 0) + *route_type = BGP_EVPN_AD_ROUTE; + else if (strncmp(arg, "ma", 2) == 0) *route_type = BGP_EVPN_MAC_IP_ROUTE; else if (strncmp(arg, "mu", 2) == 0) *route_type = BGP_EVPN_IMET_ROUTE; @@ -4167,10 +4169,12 @@ static const char *parse_evpn_rt_type(const char *num_rt_type) DEFUN_YANG (match_evpn_route_type, match_evpn_route_type_cmd, - "match evpn route-type ", + "match evpn route-type ", MATCH_STR EVPN_HELP_STR EVPN_TYPE_HELP_STR + EVPN_TYPE_1_HELP_STR + EVPN_TYPE_1_HELP_STR EVPN_TYPE_2_HELP_STR EVPN_TYPE_2_HELP_STR EVPN_TYPE_3_HELP_STR @@ -4194,11 +4198,13 @@ DEFUN_YANG (match_evpn_route_type, DEFUN_YANG (no_match_evpn_route_type, no_match_evpn_route_type_cmd, - "no match evpn route-type ", + "no match evpn route-type ", NO_STR MATCH_STR EVPN_HELP_STR EVPN_TYPE_HELP_STR + EVPN_TYPE_1_HELP_STR + EVPN_TYPE_1_HELP_STR EVPN_TYPE_2_HELP_STR EVPN_TYPE_2_HELP_STR EVPN_TYPE_3_HELP_STR diff --git a/yang/frr-bgp-route-map.yang b/yang/frr-bgp-route-map.yang index 9bd26043a7..9d4ac5c9c6 100644 --- a/yang/frr-bgp-route-map.yang +++ b/yang/frr-bgp-route-map.yang @@ -532,6 +532,11 @@ module frr-bgp-route-map { description "Prefix route"; } + enum "ead" { + value 3; + description + "Ethernet Auto-Discovery route"; + } } } } From 2514d231905f9abc9c8d5783af3da0c672348fc4 Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Thu, 10 Feb 2022 19:35:14 -0800 Subject: [PATCH 2/3] bgpd: evpn route-map match esr type-4 route-type Testing: After fix: bharat(config-route-map)# match evpn route-type 1 EAD (Type-1) route 2 MAC-IP (Type-2) route 3 Multicast (Type-3) route 4 Ethernet Segment (Type-4) route <---- 5 Prefix (Type-5) route ead EAD (Type-1) route es Ethernet Segment (Type-4) route macip MAC-IP (Type-2) route multicast Multicast (Type-3) route prefix Prefix (Type-5) route bharat(config-route-map)# match evpn route-type 4 bharat(config-route-map)# do show running-config Building configuration... ... ! route-map ALLOW_EVPN_R permit 10 match evpn route-type es <---- exit BGP: route-map: ALLOW_EVPN_R Invoked: 0 Optimization: enabled Processed Change: false permit, sequence 10 Invoked 0 Match clauses: evpn route-type es <----- Set clauses: Call clause: Action: Exit routemap Signed-off-by: Chirag Shah --- bgpd/bgp_routemap.c | 10 ++++++++-- yang/frr-bgp-route-map.yang | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 3bcf2a7986..efb7f9eb7b 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -1045,6 +1045,8 @@ static void *route_match_evpn_route_type_compile(const char *arg) *route_type = BGP_EVPN_MAC_IP_ROUTE; else if (strncmp(arg, "mu", 2) == 0) *route_type = BGP_EVPN_IMET_ROUTE; + else if (strncmp(arg, "es", 2) == 0) + *route_type = BGP_EVPN_ES_ROUTE; else *route_type = BGP_EVPN_IP_PREFIX_ROUTE; @@ -4169,7 +4171,7 @@ static const char *parse_evpn_rt_type(const char *num_rt_type) DEFUN_YANG (match_evpn_route_type, match_evpn_route_type_cmd, - "match evpn route-type ", + "match evpn route-type ", MATCH_STR EVPN_HELP_STR EVPN_TYPE_HELP_STR @@ -4179,6 +4181,8 @@ DEFUN_YANG (match_evpn_route_type, EVPN_TYPE_2_HELP_STR EVPN_TYPE_3_HELP_STR EVPN_TYPE_3_HELP_STR + EVPN_TYPE_4_HELP_STR + EVPN_TYPE_4_HELP_STR EVPN_TYPE_5_HELP_STR EVPN_TYPE_5_HELP_STR) { @@ -4198,7 +4202,7 @@ DEFUN_YANG (match_evpn_route_type, DEFUN_YANG (no_match_evpn_route_type, no_match_evpn_route_type_cmd, - "no match evpn route-type ", + "no match evpn route-type ", NO_STR MATCH_STR EVPN_HELP_STR @@ -4209,6 +4213,8 @@ DEFUN_YANG (no_match_evpn_route_type, EVPN_TYPE_2_HELP_STR EVPN_TYPE_3_HELP_STR EVPN_TYPE_3_HELP_STR + EVPN_TYPE_4_HELP_STR + EVPN_TYPE_4_HELP_STR EVPN_TYPE_5_HELP_STR EVPN_TYPE_5_HELP_STR) { diff --git a/yang/frr-bgp-route-map.yang b/yang/frr-bgp-route-map.yang index 9d4ac5c9c6..74008bc078 100644 --- a/yang/frr-bgp-route-map.yang +++ b/yang/frr-bgp-route-map.yang @@ -537,6 +537,11 @@ module frr-bgp-route-map { description "Ethernet Auto-Discovery route"; } + enum "es" { + value 4; + description + "Ethernet Segment route"; + } } } } From 79d2f64ee16d21a36718215dbf948031121513ac Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Wed, 16 Feb 2022 21:39:43 -0800 Subject: [PATCH 3/3] doc: add description for match evpn route-type Signed-off-by: Chirag Shah --- doc/user/routemap.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/user/routemap.rst b/doc/user/routemap.rst index a7f22cd40c..ef7aef9c5e 100644 --- a/doc/user/routemap.rst +++ b/doc/user/routemap.rst @@ -215,6 +215,18 @@ Route Map Match Command This is a ZEBRA specific match command. The number is a range from (0-255). Matches the originating protocols instance specified. +.. clicmd:: match evpn route-type ROUTE_TYPE_NAME + + This is a BGP EVPN specific match command. It matches to EVPN route-type + from type-1 (EAD route-type) to type-5 (Prefix route-type). + User can provide in an integral form (1-5) or string form of route-type + (i.e ead, macip, multicast, es, prefix). + +.. clicmd:: match evpn vni NUMBER + + This is a BGP EVPN specific match command which matches to EVPN VNI id. + The number is a range from (1-6777215). + .. _route-map-set-command: Route Map Set Command