diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-05-05 22:04:00 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-05-05 22:04:00 +0200 |
commit | 33cfc134a7139515fc8ea7a2a279f03a944defb4 (patch) | |
tree | 87765f2d3e85f04764919ead0fb2d5b300df626e /src/conf_mode/protocols_isis.py | |
parent | d4998fcc4705a3003f673818c18d621673f7cd3d (diff) | |
download | vyos-1x-33cfc134a7139515fc8ea7a2a279f03a944defb4.tar.gz vyos-1x-33cfc134a7139515fc8ea7a2a279f03a944defb4.zip |
isis: T3520: verify interface MTU to be >= lsp-mtu
Diffstat (limited to 'src/conf_mode/protocols_isis.py')
-rwxr-xr-x | src/conf_mode/protocols_isis.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/conf_mode/protocols_isis.py b/src/conf_mode/protocols_isis.py index 4aea59bfd..d1e71c378 100755 --- a/src/conf_mode/protocols_isis.py +++ b/src/conf_mode/protocols_isis.py @@ -24,9 +24,11 @@ from vyos.configdict import dict_merge from vyos.configdict import node_changed from vyos.configverify import verify_common_route_maps from vyos.configverify import verify_interface_exists +from vyos.ifconfig import Interface from vyos.util import dict_search from vyos.util import get_interface_config from vyos.template import render_to_string +from vyos.xml import defaults from vyos import ConfigError from vyos import frr from vyos import airbag @@ -67,6 +69,15 @@ def get_config(config=None): isis.update({'deleted' : ''}) return isis + # We have gathered the dict representation of the CLI, but there are default + # options which we need to update into the dictionary retrived. + # XXX: Note that we can not call defaults(base), as defaults does not work + # on an instance of a tag node. As we use the exact same CLI definition for + # both the non-vrf and vrf version this is absolutely safe! + default_values = defaults(base_path) + # merge in default values + isis = dict_merge(default_values, isis) + # We also need some additional information from the config, prefix-lists # and route-maps for instance. They will be used in verify(). # @@ -99,6 +110,13 @@ def verify(isis): for interface in isis['interface']: verify_interface_exists(interface) + # Interface MTU must be >= configured lsp-mtu + mtu = Interface(interface).get_mtu() + area_mtu = isis['lsp_mtu'] + if mtu < int(area_mtu): + raise ConfigError(f'Interface {interface} has MTU {mtu}, minimum ' \ + f'area MTU is {area_mtu}!') + if 'vrf' in isis: # If interface specific options are set, we must ensure that the # interface is bound to our requesting VRF. Due to the VyOS |