summaryrefslogtreecommitdiff
path: root/src/conf_mode/protocols_ospf.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-01-10 08:10:12 +0100
committerGitHub <noreply@github.com>2024-01-10 08:10:12 +0100
commit8523cfbc1e9f02ddd90794ce5ded4be2a55e7c4a (patch)
tree7520d06dbc168b964bf5e3f5aeec86a129339ce6 /src/conf_mode/protocols_ospf.py
parent10f6eac581ba46a0c235ae7c97541c7094567e70 (diff)
parentcfb5b052c84ffba789d61a59350676b6b4a0a5f7 (diff)
downloadvyos-1x-8523cfbc1e9f02ddd90794ce5ded4be2a55e7c4a.tar.gz
vyos-1x-8523cfbc1e9f02ddd90794ce5ded4be2a55e7c4a.zip
Merge pull request #2780 from Cheeze-It/current
T5916: Added segment routing check for index size and SRGB size
Diffstat (limited to 'src/conf_mode/protocols_ospf.py')
-rwxr-xr-xsrc/conf_mode/protocols_ospf.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/conf_mode/protocols_ospf.py b/src/conf_mode/protocols_ospf.py
index 2f07142a3..34cf49286 100755
--- a/src/conf_mode/protocols_ospf.py
+++ b/src/conf_mode/protocols_ospf.py
@@ -213,6 +213,19 @@ def verify(ospf):
raise ConfigError(f'Segment routing prefix {prefix} cannot have both explicit-null '\
f'and no-php-flag configured at the same time.')
+ # Check for index ranges being larger than the segment routing global block
+ if dict_search('segment_routing.global_block', ospf):
+ g_high_label_value = dict_search('segment_routing.global_block.high_label_value', ospf)
+ g_low_label_value = dict_search('segment_routing.global_block.low_label_value', ospf)
+ g_label_difference = int(g_high_label_value) - int(g_low_label_value)
+ if dict_search('segment_routing.prefix', ospf):
+ for prefix, prefix_config in ospf['segment_routing']['prefix'].items():
+ if 'index' in prefix_config:
+ index_size = ospf['segment_routing']['prefix'][prefix]['index']['value']
+ if int(index_size) > int(g_label_difference):
+ raise ConfigError(f'Segment routing prefix {prefix} cannot have an '\
+ f'index base size larger than the SRGB label base.')
+
# Check route summarisation
if 'summary_address' in ospf:
for prefix, prefix_options in ospf['summary_address'].items():