diff options
| author | Christian Poessinger <christian@poessinger.com> | 2021-08-26 18:26:22 +0200 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-26 18:26:22 +0200 | 
| commit | c2dfb24a0672ea93a4262feeddd6929275eb08cf (patch) | |
| tree | f973d7518971a5be4196d77fcba62a89c99e1ef5 | |
| parent | 9471a9bac452c2c5600ef5d91dd842c8e084e8d6 (diff) | |
| parent | 8681a62fbb413ad3a613ebedb430919a940beef7 (diff) | |
| download | vyos-1x-c2dfb24a0672ea93a4262feeddd6929275eb08cf.tar.gz vyos-1x-c2dfb24a0672ea93a4262feeddd6929275eb08cf.zip | |
Merge pull request #965 from c-po/t3739-evpn-route-map
bgp: evpn: T3739: add route-map match support
| -rw-r--r-- | data/templates/frr/policy.frr.tmpl | 12 | ||||
| -rw-r--r-- | interface-definitions/policy.xml.in | 38 | ||||
| -rwxr-xr-x | smoketest/scripts/cli/test_policy.py | 33 | 
3 files changed, 83 insertions, 0 deletions
| diff --git a/data/templates/frr/policy.frr.tmpl b/data/templates/frr/policy.frr.tmpl index 57ab0f363..51adc1902 100644 --- a/data/templates/frr/policy.frr.tmpl +++ b/data/templates/frr/policy.frr.tmpl @@ -165,6 +165,18 @@ route-map {{ route_map }} {{ rule_config.action }} {{ rule }}  {%           if rule_config.match.extcommunity is defined and rule_config.match.extcommunity is not none %}   match extcommunity {{ rule_config.match.extcommunity }}  {%           endif %} +{%           if rule_config.match.evpn is defined and rule_config.match.evpn.default_route is defined %} + match evpn default-route +{%           endif %} +{%           if rule_config.match.evpn is defined and rule_config.match.evpn.rd is defined and rule_config.match.evpn.rd is not none %} + match evpn rd {{ rule_config.match.evpn.rd }} +{%           endif %} +{%           if rule_config.match.evpn is defined and rule_config.match.evpn.route_type is defined and rule_config.match.evpn.route_type is not none %} + match evpn route-type {{ rule_config.match.evpn.route_type }} +{%           endif %} +{%           if rule_config.match.evpn is defined and rule_config.match.evpn.vni is defined and rule_config.match.evpn.vni is not none %} + match evpn vni {{ rule_config.match.evpn.vni }} +{%           endif %}  {%           if rule_config.match.interface is defined and rule_config.match.interface is not none %}   match interface {{ rule_config.match.interface }}  {%           endif %} diff --git a/interface-definitions/policy.xml.in b/interface-definitions/policy.xml.in index bf1832832..cf65daf00 100644 --- a/interface-definitions/policy.xml.in +++ b/interface-definitions/policy.xml.in @@ -551,6 +551,44 @@                        </leafNode>                      </children>                    </node> +                  <node name="evpn"> +                    <properties> +                      <help>Ethernet Virtual Private Network</help> +                    </properties> +                    <children> +                      <leafNode name="default-route"> +                        <properties> +                          <help>Default EVPN type-5 route</help> +                          <valueless/> +                        </properties> +                      </leafNode> +                      #include <include/bgp/route-distinguisher.xml.i> +                      <leafNode name="route-type"> +                        <properties> +                          <help>Match route-type</help> +                          <completionHelp> +                            <list>macip multicast prefix</list> +                          </completionHelp> +                          <valueHelp> +                            <format>macip</format> +                            <description>mac-ip route</description> +                          </valueHelp> +                          <valueHelp> +                            <format>multicast</format> +                            <description>IMET route</description> +                          </valueHelp> +                          <valueHelp> +                            <format>prefix</format> +                            <description>Prefix route</description> +                          </valueHelp> +                          <constraint> +                            <regex>^(macip|multicast|prefix)$</regex> +                          </constraint> +                        </properties> +                      </leafNode> +                      #include <include/vni.xml.i> +                    </children> +                  </node>                    <leafNode name="extcommunity">                      <properties>                        <help>BGP extended community to match</help> diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py index 485cc274a..c2288a86a 100755 --- a/smoketest/scripts/cli/test_policy.py +++ b/smoketest/scripts/cli/test_policy.py @@ -804,6 +804,19 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):                      },                  },              }, +            'evpn-configuration' : { +                'rule' : { +                    '10' : { +                        'action' : 'permit', +                        'match' : { +                            'evpn-default-route'  : '', +                            'evpn-rd'             : '100:300', +                            'evpn-route-type'     : 'prefix', +                            'evpn-vni'            : '1234', +                        }, +                    }, +                }, +            },          }          self.cli_set(['policy', 'access-list', access_list, 'rule', '10', 'action', 'permit']) @@ -847,6 +860,14 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):                      if 'community' in rule_config['match']:                          self.cli_set(path + ['rule', rule, 'match', 'community', 'community-list', rule_config['match']['community']])                          self.cli_set(path + ['rule', rule, 'match', 'community', 'exact-match']) +                    if 'evpn-default-route' in rule_config['match']: +                        self.cli_set(path + ['rule', rule, 'match', 'evpn', 'default-route']) +                    if 'evpn-rd' in rule_config['match']: +                        self.cli_set(path + ['rule', rule, 'match', 'evpn', 'rd', rule_config['match']['evpn-rd']]) +                    if 'evpn-route-type' in rule_config['match']: +                        self.cli_set(path + ['rule', rule, 'match', 'evpn', 'route-type', rule_config['match']['evpn-route-type']]) +                    if 'evpn-vni' in rule_config['match']: +                        self.cli_set(path + ['rule', rule, 'match', 'evpn', 'vni', rule_config['match']['evpn-vni']])                      if 'extcommunity' in rule_config['match']:                          self.cli_set(path + ['rule', rule, 'match', 'extcommunity', rule_config['match']['extcommunity']])                      if 'interface' in rule_config['match']: @@ -967,6 +988,18 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):                      if 'community' in rule_config['match']:                          tmp = f'match community {rule_config["match"]["community"]} exact-match'                          self.assertIn(tmp, config) +                    if 'evpn-default-route' in rule_config['match']: +                        tmp = f'match evpn default-route' +                        self.assertIn(tmp, config) +                    if 'evpn-rd' in rule_config['match']: +                        tmp = f'match evpn rd {rule_config["match"]["evpn-rd"]}' +                        self.assertIn(tmp, config) +                    if 'evpn-route-type' in rule_config['match']: +                        tmp = f'match evpn route-type {rule_config["match"]["evpn-route-type"]}' +                        self.assertIn(tmp, config) +                    if 'evpn-vni' in rule_config['match']: +                        tmp = f'match evpn vni {rule_config["match"]["evpn-vni"]}' +                        self.assertIn(tmp, config)                      if 'extcommunity' in rule_config['match']:                          tmp = f'match extcommunity {rule_config["match"]["extcommunity"]}'                          self.assertIn(tmp, config) | 
