summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-01-13 07:22:37 +0100
committerChristian Breunig <christian@breunig.cc>2023-01-13 07:22:37 +0100
commitf1950a6a11dfd085e72b4f3a839febc69bb66692 (patch)
treeeedb16067f778e2f478d45a9e57b90dce54badcc
parente7ac306c31f51c1b6d6ec2dd1aef86744f3fc794 (diff)
downloadvyos-1x-f1950a6a11dfd085e72b4f3a839febc69bb66692.tar.gz
vyos-1x-f1950a6a11dfd085e72b4f3a839febc69bb66692.zip
T4935: ospfv3: bugfix KeyError: 'range'
Commit 1fc7e30f ('T4935: ospfv3: "not-advertise" and "advertise" conflict') added a check for not-advertive and advertise in the same area but lacked a test if the key really exists in the dict which is to be validated.
-rwxr-xr-xsrc/conf_mode/protocols_ospfv3.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/conf_mode/protocols_ospfv3.py b/src/conf_mode/protocols_ospfv3.py
index 7cc36b58c..ed0a8fba2 100755
--- a/src/conf_mode/protocols_ospfv3.py
+++ b/src/conf_mode/protocols_ospfv3.py
@@ -117,9 +117,10 @@ def verify(ospfv3):
if 'area_type' in area_config:
if len(area_config['area_type']) > 1:
raise ConfigError(f'Can only configure one area-type for OSPFv3 area "{area}"!')
- for range, range_config in area_config['range'].items():
- if {'not_advertise', 'advertise'} <= range_config.keys():
- raise ConfigError(f'"not-advertise" and "advertise" for "range {range}" cannot be both configured at the same time!')
+ if 'range' in area_config:
+ for range, range_config in area_config['range'].items():
+ if {'not_advertise', 'advertise'} <= range_config.keys():
+ raise ConfigError(f'"not-advertise" and "advertise" for "range {range}" cannot be both configured at the same time!')
if 'interface' in ospfv3:
for interface, interface_config in ospfv3['interface'].items():