summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-24 15:38:38 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-24 15:38:38 +0100
commit9b6b9f6cdfa7b911b79a312c4bdca0562f79b6f9 (patch)
tree6f932f0aaca50c144a9ea4c03799e5e5c20c61e2 /src/conf_mode
parent5ab6882f88036722f533f37331d9e5b63631f4b2 (diff)
downloadvyos-1x-9b6b9f6cdfa7b911b79a312c4bdca0562f79b6f9.tar.gz
vyos-1x-9b6b9f6cdfa7b911b79a312c4bdca0562f79b6f9.zip
ospf(v3): T3236: T3244: add verify() for used route-map existence
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/protocols_ospf.py2
-rwxr-xr-xsrc/conf_mode/protocols_ospfv3.py14
2 files changed, 16 insertions, 0 deletions
diff --git a/src/conf_mode/protocols_ospf.py b/src/conf_mode/protocols_ospf.py
index f43929b46..9842d26cd 100755
--- a/src/conf_mode/protocols_ospf.py
+++ b/src/conf_mode/protocols_ospf.py
@@ -20,6 +20,7 @@ from sys import exit
from vyos.config import Config
from vyos.configdict import dict_merge
+from vyos.configverify import verify_route_maps
from vyos.template import render
from vyos.template import render_to_string
from vyos.util import call
@@ -99,6 +100,7 @@ def verify(ospf):
if not ospf:
return None
+ verify_route_maps(ospf)
return None
def generate(ospf):
diff --git a/src/conf_mode/protocols_ospfv3.py b/src/conf_mode/protocols_ospfv3.py
index f514641ef..2fb600056 100755
--- a/src/conf_mode/protocols_ospfv3.py
+++ b/src/conf_mode/protocols_ospfv3.py
@@ -20,6 +20,7 @@ from sys import exit
from vyos.config import Config
from vyos.configdict import dict_merge
+from vyos.configverify import verify_route_maps
from vyos.template import render
from vyos.template import render_to_string
from vyos.util import call
@@ -48,12 +49,25 @@ def get_config(config=None):
conf = Config()
base = ['protocols', 'ospfv3']
ospfv3 = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True)
+
+ # Bail out early if configuration tree does not exist
+ if not conf.exists(base):
+ return ospfv3
+
+ # We also need some additional information from the config, prefix-lists
+ # and route-maps for instance. They will be used in verify()
+ base = ['policy']
+ tmp = conf.get_config_dict(base, key_mangling=('-', '_'))
+ # Merge policy dict into OSPF dict
+ ospfv3 = dict_merge(tmp, ospfv3)
+
return ospfv3
def verify(ospfv3):
if not ospfv3:
return None
+ verify_route_maps(ospfv3)
return None
def generate(ospfv3):