summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-10-16 18:04:15 +0200
committerGitHub <noreply@github.com>2026-10-16 18:04:15 +0200
commit1f482caab97b76e3acb4e675f15011649821a4c2 (patch)
tree98d8b7eefb12e6e481c7e15761978a46e0a55dfd
parent8302a96fd1b45afcd8550883b729d4907a723e0f (diff)
parent6e3598a23b22462c59635cac4f367987c253277b (diff)
downloadvyos-1x-rolling.tar.gz
vyos-1x-rolling.zip
Merge pull request #5560 from alexandr-san4ez/T9346-rolling_validation-fixrolling
policy: T9346: Allow dot in `prefix-list` and `prefix-list6` names
-rw-r--r--interface-definitions/include/bgp/afi-ipv4-prefix-list.xml.i8
-rw-r--r--interface-definitions/include/bgp/afi-ipv6-prefix-list.xml.i8
-rw-r--r--interface-definitions/include/isis/lfa-remote.xml.i4
-rw-r--r--interface-definitions/include/policy/prefix-list-name.xml.i3
-rw-r--r--interface-definitions/policy.xml.in8
-rw-r--r--python/vyos/configverify.py13
-rwxr-xr-xsmoketest/scripts/cli/test_policy.py16
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bgp.py4
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_isis.py2
9 files changed, 41 insertions, 25 deletions
diff --git a/interface-definitions/include/bgp/afi-ipv4-prefix-list.xml.i b/interface-definitions/include/bgp/afi-ipv4-prefix-list.xml.i
index 0f760daae..a8fffbc39 100644
--- a/interface-definitions/include/bgp/afi-ipv4-prefix-list.xml.i
+++ b/interface-definitions/include/bgp/afi-ipv4-prefix-list.xml.i
@@ -15,9 +15,9 @@
<description>Name of IPv4 prefix-list</description>
</valueHelp>
<constraint>
- #include <include/constraint/alpha-numeric-hyphen-underscore.xml.i>
+ #include <include/policy/prefix-list-name.xml.i>
</constraint>
- <constraintErrorMessage>Name of prefix-list can only contain alpha-numeric letters, hyphen and underscores</constraintErrorMessage>
+ <constraintErrorMessage>Name of prefix-list can only contain alpha-numeric letters, hyphen, underscore and dot</constraintErrorMessage>
</properties>
</leafNode>
<leafNode name="import">
@@ -31,9 +31,9 @@
<description>Name of IPv4 prefix-list</description>
</valueHelp>
<constraint>
- #include <include/constraint/alpha-numeric-hyphen-underscore.xml.i>
+ #include <include/policy/prefix-list-name.xml.i>
</constraint>
- <constraintErrorMessage>Name of prefix-list can only contain alpha-numeric letters, hyphen and underscores</constraintErrorMessage>
+ <constraintErrorMessage>Name of prefix-list can only contain alpha-numeric letters, hyphen, underscore and dot</constraintErrorMessage>
</properties>
</leafNode>
</children>
diff --git a/interface-definitions/include/bgp/afi-ipv6-prefix-list.xml.i b/interface-definitions/include/bgp/afi-ipv6-prefix-list.xml.i
index 268d9cbc0..a3cbf29bb 100644
--- a/interface-definitions/include/bgp/afi-ipv6-prefix-list.xml.i
+++ b/interface-definitions/include/bgp/afi-ipv6-prefix-list.xml.i
@@ -15,9 +15,9 @@
<description>Name of IPv6 prefix-list</description>
</valueHelp>
<constraint>
- #include <include/constraint/alpha-numeric-hyphen-underscore.xml.i>
+ #include <include/policy/prefix-list-name.xml.i>
</constraint>
- <constraintErrorMessage>Name of prefix-list6 can only contain alpha-numeric letters, hyphen and underscores</constraintErrorMessage>
+ <constraintErrorMessage>Name of prefix-list6 can only contain alpha-numeric letters, hyphen, underscore and dot</constraintErrorMessage>
</properties>
</leafNode>
<leafNode name="import">
@@ -31,9 +31,9 @@
<description>Name of IPv6 prefix-list</description>
</valueHelp>
<constraint>
- #include <include/constraint/alpha-numeric-hyphen-underscore.xml.i>
+ #include <include/policy/prefix-list-name.xml.i>
</constraint>
- <constraintErrorMessage>Name of prefix-list6 can only contain alpha-numeric letters, hyphen and underscores</constraintErrorMessage>
+ <constraintErrorMessage>Name of prefix-list6 can only contain alpha-numeric letters, hyphen, underscore and dot</constraintErrorMessage>
</properties>
</leafNode>
</children>
diff --git a/interface-definitions/include/isis/lfa-remote.xml.i b/interface-definitions/include/isis/lfa-remote.xml.i
index 8434e35bf..7495666c7 100644
--- a/interface-definitions/include/isis/lfa-remote.xml.i
+++ b/interface-definitions/include/isis/lfa-remote.xml.i
@@ -15,9 +15,9 @@
<description>Name of IPv4/IPv6 prefix-list</description>
</valueHelp>
<constraint>
- #include <include/constraint/alpha-numeric-hyphen-underscore.xml.i>
+ #include <include/policy/prefix-list-name.xml.i>
</constraint>
- <constraintErrorMessage>Name of prefix-list can only contain alpha-numeric letters, hyphen and underscores</constraintErrorMessage>
+ <constraintErrorMessage>Name of prefix-list can only contain alpha-numeric letters, hyphen, underscore and dot</constraintErrorMessage>
</properties>
<children>
#include <include/isis/level-1-2-leaf.xml.i>
diff --git a/interface-definitions/include/policy/prefix-list-name.xml.i b/interface-definitions/include/policy/prefix-list-name.xml.i
new file mode 100644
index 000000000..40d4abc97
--- /dev/null
+++ b/interface-definitions/include/policy/prefix-list-name.xml.i
@@ -0,0 +1,3 @@
+<!-- include start from policy/prefix-list-name.xml.i -->
+<regex>[-_a-zA-Z0-9.]+</regex>
+<!-- include end -->
diff --git a/interface-definitions/policy.xml.in b/interface-definitions/policy.xml.in
index 53dcfd8ee..b9be2119e 100644
--- a/interface-definitions/policy.xml.in
+++ b/interface-definitions/policy.xml.in
@@ -380,9 +380,9 @@
<description>Name of IPv4 prefix-list</description>
</valueHelp>
<constraint>
- #include <include/constraint/alpha-numeric-hyphen-underscore.xml.i>
+ #include <include/policy/prefix-list-name.xml.i>
</constraint>
- <constraintErrorMessage>Name of prefix-list can only contain alpha-numeric letters, hyphen and underscores</constraintErrorMessage>
+ <constraintErrorMessage>Name of prefix-list can only contain alpha-numeric letters, hyphen, underscore and dot</constraintErrorMessage>
</properties>
<children>
#include <include/generic-description.xml.i>
@@ -448,9 +448,9 @@
<description>Name of IPv6 prefix-list</description>
</valueHelp>
<constraint>
- #include <include/constraint/alpha-numeric-hyphen-underscore.xml.i>
+ #include <include/policy/prefix-list-name.xml.i>
</constraint>
- <constraintErrorMessage>Name of prefix-list6 can only contain alpha-numeric letters, hyphen and underscores</constraintErrorMessage>
+ <constraintErrorMessage>Name of prefix-list6 can only contain alpha-numeric letters, hyphen, underscore and dot</constraintErrorMessage>
</properties>
<children>
#include <include/generic-description.xml.i>
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py
index 89f1b7ad7..d918c53bb 100644
--- a/python/vyos/configverify.py
+++ b/python/vyos/configverify.py
@@ -439,10 +439,9 @@ def verify_common_route_maps(config):
for route_map in ['route-map', 'route_map']:
if route_map not in config:
continue
- tmp = config[route_map]
+ route_map_name = config[route_map]
# Check if the specified route-map exists, if not error out
- if dict_search(f'policy.route_map.{tmp}', config) == None:
- raise ConfigError(f'Specified route-map "{tmp}" does not exist!')
+ verify_route_map(route_map_name, config)
if 'redistribute' in config:
for protocol, protocol_config in config['redistribute'].items():
@@ -454,8 +453,10 @@ def verify_route_map(route_map_name, config):
Common helper function used by routing protocol implementations to perform
recurring validation if a specified route-map exists!
"""
+
# Check if the specified route-map exists, if not error out
- if dict_search(f'policy.route_map.{route_map_name}', config) == None:
+ route_maps = dict_search('policy.route_map', config) or {}
+ if route_map_name not in route_maps:
raise ConfigError(f'Specified route-map "{route_map_name}" does not exist!')
def verify_prefix_list(prefix_list, config, version=''):
@@ -463,8 +464,10 @@ def verify_prefix_list(prefix_list, config, version=''):
Common helper function used by routing protocol implementations to perform
recurring validation if a specified prefix-list exists!
"""
+
# Check if the specified prefix-list exists, if not error out
- if dict_search(f'policy.prefix_list{version}.{prefix_list}', config) == None:
+ prefixes = dict_search(f'policy.prefix_list{version}', config) or {}
+ if prefix_list not in prefixes:
raise ConfigError(f'Specified prefix-list{version} "{prefix_list}" does not exist!')
def verify_access_list(access_list, config, version=''):
diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py
index 093ba4066..40bb01a8b 100755
--- a/smoketest/scripts/cli/test_policy.py
+++ b/smoketest/scripts/cli/test_policy.py
@@ -532,7 +532,7 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
},
},
},
- 'bar' : {
+ 'bar.baz' : {
'rule' : {
'5' : {
'action' : 'permit',
@@ -615,7 +615,7 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
},
},
},
- 'bar' : {
+ 'bar.baz' : {
'rule' : {
'5' : {
'action' : 'permit',
@@ -676,6 +676,16 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.assertIn(tmp, config)
+ def test_prefix_list_name(self):
+ # T9346: prefix-list names use the VyOS 1.3 pattern '^[-_a-zA-Z0-9.]+$'
+ invalid_names = ['foo+bar', 'foo,bar', 'foo/bar', 'foo:bar']
+
+ for prefix_list in ['prefix-list', 'prefix-list6']:
+ for name in invalid_names:
+ with self.assertRaises(ConfigSessionError):
+ path = base_path + [prefix_list, name, 'description', 'invalid']
+ self.cli_set(path)
+
def test_prefix_list_duplicates(self):
# FRR does not allow to specify the same profix list rule multiple times
#
@@ -966,7 +976,7 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
ipv6_nexthop_type= 'blackhole'
test_data = {
- 'foo-map-bar' : {
+ 'foo-map.bar' : {
'rule' : {
'5' : {
'action' : 'permit',
diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py
index ed00be45d..1346bc3bc 100755
--- a/smoketest/scripts/cli/test_protocols_bgp.py
+++ b/smoketest/scripts/cli/test_protocols_bgp.py
@@ -33,10 +33,10 @@ base_path = ['protocols', 'bgp']
route_map_in = 'foo-map-in'
route_map_out = 'foo-map-out'
-prefix_list_in = 'pfx-foo-in'
+prefix_list_in = 'pfx.foo-in'
prefix_list_out = 'pfx-foo-out'
prefix_list_in6 = 'pfx-foo-in6'
-prefix_list_out6 = 'pfx-foo-out6'
+prefix_list_out6 = 'pfx.foo-out6'
bfd_profile = 'foo-bar-baz'
import_afi = 'ipv4-unicast'
diff --git a/smoketest/scripts/cli/test_protocols_isis.py b/smoketest/scripts/cli/test_protocols_isis.py
index a4b8fca9b..7e8124675 100755
--- a/smoketest/scripts/cli/test_protocols_isis.py
+++ b/smoketest/scripts/cli/test_protocols_isis.py
@@ -368,7 +368,7 @@ class TestProtocolsISIS(VyOSUnitTestSHIM.TestCase):
self.assertIn(f' no isis mpls ldp-sync', tmp)
def test_isis_09_lfa(self):
- prefix_list = 'lfa-prefix-list-test-1'
+ prefix_list = 'lfa.prefix-list.test-1'
prefix_list_address = '192.168.255.255/32'
interface = 'lo'