summaryrefslogtreecommitdiff
path: root/src/conf_mode/protocols_ospf.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-02-02 22:57:49 +0100
committerChristian Poessinger <christian@poessinger.com>2021-02-02 22:57:49 +0100
commitc9e1a3b357f2e145a85ff4f7e92ee680937561a3 (patch)
tree7f7460e65300618c6dde1834654a837826413cba /src/conf_mode/protocols_ospf.py
parentccd516b4d10c518ea445928c01d6c7dc2770777b (diff)
downloadvyos-1x-c9e1a3b357f2e145a85ff4f7e92ee680937561a3.tar.gz
vyos-1x-c9e1a3b357f2e145a85ff4f7e92ee680937561a3.zip
ospf: T3263: support hello sub-second timer
Added "set protocols ospf interface eth1 hello-multiplier <n>" CLI command. This is mutually exclusive to "set protocols ospf interface eth1 dead-interval <n>".
Diffstat (limited to 'src/conf_mode/protocols_ospf.py')
-rwxr-xr-xsrc/conf_mode/protocols_ospf.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/conf_mode/protocols_ospf.py b/src/conf_mode/protocols_ospf.py
index 866b2db62..3310fac5a 100755
--- a/src/conf_mode/protocols_ospf.py
+++ b/src/conf_mode/protocols_ospf.py
@@ -97,8 +97,15 @@ def get_config(config=None):
default_values, ospf['area'][area]['virtual_link'][virtual_link])
if 'interface' in ospf:
- default_values = defaults(base + ['interface'])
for interface in ospf['interface']:
+ # We need to reload the defaults on every pass b/c of
+ # hello-multiplier dependency on dead-interval
+ default_values = defaults(base + ['interface'])
+ # If hello-multiplier is set, we need to remove the default from
+ # dead-interval.
+ if 'hello_multiplier' in ospf['interface'][interface]:
+ del default_values['dead_interval']
+
ospf['interface'][interface] = dict_merge(default_values,
ospf['interface'][interface])
@@ -120,6 +127,11 @@ def verify(ospf):
if 'interface' in ospf:
for interface in ospf['interface']:
verify_interface_exists(interface)
+ # One can not use dead-interval and hello-multiplier at the same
+ # time. FRR will only activate the last option set via CLI.
+ if {'hello_multiplier', 'dead_interval'} <= set(ospf['interface'][interface]):
+ raise ConfigError(f'Can not use hello-multiplier and dead-interval ' \
+ f'concurrently for "{interface}"!')
return None