]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: numerical evpn type support to route-map cmds 7300/head
authorStephen Worley <sworley@cumulusnetworks.com>
Tue, 13 Oct 2020 20:12:14 +0000 (16:12 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Tue, 13 Oct 2020 20:13:16 +0000 (16:13 -0400)
Add numberical evpn route-type support to route-map evpn
commands.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
bgpd/bgp_routemap.c

index 09cc775d479550aa4120babb731fc0b7fc79297e..69405143038f2e9588cb24e952f73807b5a57c6b 100644 (file)
@@ -4034,32 +4034,64 @@ DEFUN (no_match_mac_address,
                                      RMAP_EVENT_FILTER_DELETED);
 }
 
+/*
+ * Helper to handle the case of the user passing in a number or type string
+ */
+static const char *parse_evpn_rt_type(const char *num_rt_type)
+{
+       switch (num_rt_type[0]) {
+       case '1':
+               return "ead";
+       case '2':
+               return "macip";
+       case '3':
+               return "multicast";
+       case '4':
+               return "es";
+       case '5':
+               return "prefix";
+       default:
+               break;
+       }
+
+       /* Was already full type string */
+       return num_rt_type;
+}
+
 DEFUN (match_evpn_route_type,
        match_evpn_route_type_cmd,
-       "match evpn route-type <macip | multicast | prefix>",
+       "match evpn route-type <macip|2|multicast|3|prefix|5>",
        MATCH_STR
        EVPN_HELP_STR
-       "Match route-type\n"
-       "mac-ip route\n"
-       "IMET route\n"
-       "prefix route\n")
-{
-       return bgp_route_match_add(vty, "evpn route-type", argv[3]->arg,
+       EVPN_TYPE_HELP_STR
+       EVPN_TYPE_2_HELP_STR
+       EVPN_TYPE_2_HELP_STR
+       EVPN_TYPE_3_HELP_STR
+       EVPN_TYPE_3_HELP_STR
+       EVPN_TYPE_5_HELP_STR
+       EVPN_TYPE_5_HELP_STR)
+{
+       return bgp_route_match_add(vty, "evpn route-type",
+                                  parse_evpn_rt_type(argv[3]->arg),
                                   RMAP_EVENT_MATCH_ADDED);
 }
 
 DEFUN (no_match_evpn_route_type,
        no_match_evpn_route_type_cmd,
-       "no match evpn route-type <macip | multicast | prefix>",
+       "no match evpn route-type <macip|2|multicast|3|prefix|5>",
        NO_STR
        MATCH_STR
        EVPN_HELP_STR
-       "Match route-type\n"
-       "mac-ip route\n"
-       "IMET route\n"
-       "prefix route\n")
-{
-       return bgp_route_match_delete(vty, "evpn route-type", argv[4]->arg,
+       EVPN_TYPE_HELP_STR
+       EVPN_TYPE_2_HELP_STR
+       EVPN_TYPE_2_HELP_STR
+       EVPN_TYPE_3_HELP_STR
+       EVPN_TYPE_3_HELP_STR
+       EVPN_TYPE_5_HELP_STR
+       EVPN_TYPE_5_HELP_STR)
+{
+       return bgp_route_match_delete(vty, "evpn route-type",
+                                     parse_evpn_rt_type(argv[4]->arg),
                                      RMAP_EVENT_MATCH_DELETED);
 }