summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-04-25 18:32:08 +0200
committerChristian Poessinger <christian@poessinger.com>2021-04-25 18:32:08 +0200
commit9b44fb16ee2af648fa60cab7dfbcc8986e8ad539 (patch)
treed803100ed86ae9b4602063a26386d9ef8ee53f75 /src/conf_mode
parent675b473a07f8af7c7c01203ce7ed16f09e3085ba (diff)
downloadvyos-1x-9b44fb16ee2af648fa60cab7dfbcc8986e8ad539.tar.gz
vyos-1x-9b44fb16ee2af648fa60cab7dfbcc8986e8ad539.zip
policy: T3497: add verify() that prefix-lists must carry a defined prefix
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/policy.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/conf_mode/policy.py b/src/conf_mode/policy.py
index 74f23948c..fb732dd81 100755
--- a/src/conf_mode/policy.py
+++ b/src/conf_mode/policy.py
@@ -94,20 +94,24 @@ def verify(policy):
if policy_type == 'access_list':
if 'source' not in rule_config:
- raise ConfigError(f'Source {mandatory_error}')
+ raise ConfigError(f'A source {mandatory_error}')
if int(instance) in range(100, 200) or int(instance) in range(2000, 2700):
if 'destination' not in rule_config:
- raise ConfigError(f'Destination {mandatory_error}')
+ raise ConfigError(f'A destination {mandatory_error}')
if policy_type == 'access_list6':
if 'source' not in rule_config:
- raise ConfigError(f'Source {mandatory_error}')
+ raise ConfigError(f'A source {mandatory_error}')
if policy_type in ['as_path_list', 'community_list', 'extcommunity_list',
'large_community_list']:
if 'regex' not in rule_config:
- raise ConfigError(f'Regex {mandatory_error}')
+ raise ConfigError(f'A regex {mandatory_error}')
+
+ if policy_type in ['prefix_list', 'prefix_list6']:
+ if 'prefix' not in rule_config:
+ raise ConfigError(f'A prefix {mandatory_error}')
# route-maps tend to be a bit more complex so they get their own verify() section