summaryrefslogtreecommitdiff
path: root/src/conf_mode/protocols_ospfv3.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-02-16 18:58:21 +0100
committerChristian Poessinger <christian@poessinger.com>2021-02-16 18:58:21 +0100
commit050f44ef1fba3cc23934a65df59ab3d1181cb5d0 (patch)
treef26727c632a4c3f7d23a86169baf8db0aa08498f /src/conf_mode/protocols_ospfv3.py
parent96656b1a7bb7166c923a45d1333d7e7c7add5514 (diff)
downloadvyos-1x-050f44ef1fba3cc23934a65df59ab3d1181cb5d0.tar.gz
vyos-1x-050f44ef1fba3cc23934a65df59ab3d1181cb5d0.zip
ospfv3: T3313: move interface related options to "protocols ospfv3 interface"
Diffstat (limited to 'src/conf_mode/protocols_ospfv3.py')
-rwxr-xr-xsrc/conf_mode/protocols_ospfv3.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/conf_mode/protocols_ospfv3.py b/src/conf_mode/protocols_ospfv3.py
index 6c3aaf426..6f068b196 100755
--- a/src/conf_mode/protocols_ospfv3.py
+++ b/src/conf_mode/protocols_ospfv3.py
@@ -23,6 +23,7 @@ from vyos.configdict import dict_merge
from vyos.configverify import verify_route_maps
from vyos.template import render_to_string
from vyos.util import call
+from vyos.ifconfig import Interface
from vyos.xml import defaults
from vyos import ConfigError
from vyos import frr
@@ -57,6 +58,14 @@ def verify(ospfv3):
return None
verify_route_maps(ospfv3)
+
+ if 'interface' in ospfv3:
+ for ifname, if_config in ospfv3['interface'].items():
+ if 'ifmtu' in if_config:
+ mtu = Interface(ifname).get_mtu()
+ if int(if_config['ifmtu']) > int(mtu):
+ raise ConfigError(f'OSPFv3 ifmtu cannot go beyond physical MTU of "{mtu}"')
+
return None
def generate(ospfv3):
@@ -71,7 +80,8 @@ def apply(ospfv3):
# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()
frr_cfg.load_configuration(frr_daemon)
- frr_cfg.modify_section('router ospf6', '')
+ frr_cfg.modify_section(r'^interface \S+', '')
+ frr_cfg.modify_section('^router ospf6$', '')
frr_cfg.add_before(r'(ip prefix-list .*|route-map .*|line vty)', ospfv3['new_frr_config'])
frr_cfg.commit_configuration(frr_daemon)