diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-06-04 20:59:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-04 20:59:12 +0200 |
commit | b6da1332a14cfb5dafb6ea11003ff671695cf4ec (patch) | |
tree | 73c17fa33c52f3b91c954056ddd49462ed2af21f | |
parent | b9a26085b49397eb73e7110872b5c07015c911b4 (diff) | |
parent | 8ab854a6f6d44fe79b517722f5f45f37dd142408 (diff) | |
download | vyos-1x-b6da1332a14cfb5dafb6ea11003ff671695cf4ec.tar.gz vyos-1x-b6da1332a14cfb5dafb6ea11003ff671695cf4ec.zip |
Merge pull request #1348 from nicolas-fort/T3976-T4449-nexthop
Policy: T3976-T4449-nexthop: add - match ipv6 nexthop type -
-rw-r--r-- | data/templates/frr/policy.frr.j2 | 3 | ||||
-rw-r--r-- | interface-definitions/policy.xml.in | 15 | ||||
-rwxr-xr-x | smoketest/scripts/cli/test_policy.py | 7 |
3 files changed, 25 insertions, 0 deletions
diff --git a/data/templates/frr/policy.frr.j2 b/data/templates/frr/policy.frr.j2 index 40ec0bb1e..33df17770 100644 --- a/data/templates/frr/policy.frr.j2 +++ b/data/templates/frr/policy.frr.j2 @@ -227,6 +227,9 @@ route-map {{ route_map }} {{ rule_config.action }} {{ rule }} {% if rule_config.match.ipv6.nexthop.prefix_list is vyos_defined %} match ipv6 next-hop prefix-list {{ rule_config.match.ipv6.nexthop.prefix_list }} {% endif %} +{% if rule_config.match.ipv6.nexthop.type is vyos_defined %} + match ipv6 next-hop type {{ rule_config.match.ipv6.nexthop.type }} +{% endif %} {% if rule_config.match.large_community.large_community_list is vyos_defined %} match large-community {{ rule_config.match.large_community.large_community_list }} {% endif %} diff --git a/interface-definitions/policy.xml.in b/interface-definitions/policy.xml.in index 3b61877c5..83ae714b4 100644 --- a/interface-definitions/policy.xml.in +++ b/interface-definitions/policy.xml.in @@ -873,6 +873,21 @@ </completionHelp> </properties> </leafNode> + <leafNode name="type"> + <properties> + <help>Match type</help> + <completionHelp> + <list>blackhole</list> + </completionHelp> + <valueHelp> + <format>blackhole</format> + <description>Blackhole</description> + </valueHelp> + <constraint> + <regex>(blackhole)</regex> + </constraint> + </properties> + </leafNode> </children> </node> </children> diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py index 9c2353856..f175d7df7 100755 --- a/smoketest/scripts/cli/test_policy.py +++ b/smoketest/scripts/cli/test_policy.py @@ -722,6 +722,7 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase): ipv4_prefix_len= '18' ipv6_prefix_len= '122' ipv4_nexthop_type= 'blackhole' + ipv6_nexthop_type= 'blackhole' test_data = { @@ -794,6 +795,7 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase): 'ipv6-nexthop-address' : ipv6_nexthop_address, 'ipv6-nexthop-access-list' : access_list, 'ipv6-nexthop-prefix-list' : prefix_list, + 'ipv6-nexthop-type' : ipv6_nexthop_type, 'ipv6-address-pfx-len' : ipv6_prefix_len, 'large-community' : large_community_list, 'local-pref' : local_pref, @@ -973,6 +975,8 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase): self.cli_set(path + ['rule', rule, 'match', 'ipv6', 'nexthop', 'access-list', rule_config['match']['ipv6-nexthop-access-list']]) if 'ipv6-nexthop-prefix-list' in rule_config['match']: self.cli_set(path + ['rule', rule, 'match', 'ipv6', 'nexthop', 'prefix-list', rule_config['match']['ipv6-nexthop-prefix-list']]) + if 'ipv6-nexthop-type' in rule_config['match']: + self.cli_set(path + ['rule', rule, 'match', 'ipv6', 'nexthop', 'type', rule_config['match']['ipv6-nexthop-type']]) if 'large-community' in rule_config['match']: self.cli_set(path + ['rule', rule, 'match', 'large-community', 'large-community-list', rule_config['match']['large-community']]) if 'local-pref' in rule_config['match']: @@ -1141,6 +1145,9 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase): if 'ipv6-nexthop-prefix-list' in rule_config['match']: tmp = f'match ipv6 next-hop prefix-list {rule_config["match"]["ipv6-nexthop-prefix-list"]}' self.assertIn(tmp, config) + if 'ipv6-nexthop-type' in rule_config['match']: + tmp = f'match ipv6 next-hop type {rule_config["match"]["ipv6-nexthop-type"]}' + self.assertIn(tmp, config) if 'large-community' in rule_config['match']: tmp = f'match large-community {rule_config["match"]["large-community"]}' self.assertIn(tmp, config) |