summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-11-27 10:32:01 +0100
committerChristian Poessinger <christian@poessinger.com>2021-11-27 10:32:01 +0100
commit32725123a2e98f3f417a94e4646721e97be1eaca (patch)
tree9c9d0ffa522d29d52f3d8abfc0d890836f2a2074
parentea3c7785d06ed341487efb800c141fa7a7797ba7 (diff)
downloadvyos-1x-32725123a2e98f3f417a94e4646721e97be1eaca.tar.gz
vyos-1x-32725123a2e98f3f417a94e4646721e97be1eaca.zip
bfd: T3753: adjust to new FRR 8.1 syntax
Every node in running config now has an explicit "exit" tag.
-rw-r--r--data/templates/frr/bfdd.frr.tmpl11
-rwxr-xr-xsrc/conf_mode/protocols_bfd.py10
2 files changed, 10 insertions, 11 deletions
diff --git a/data/templates/frr/bfdd.frr.tmpl b/data/templates/frr/bfdd.frr.tmpl
index 3fb1f47d6..c14939677 100644
--- a/data/templates/frr/bfdd.frr.tmpl
+++ b/data/templates/frr/bfdd.frr.tmpl
@@ -1,4 +1,4 @@
-!
+{% if profile is defined or peer is defined %}
bfd
{% if profile is defined and profile is not none %}
{% for profile_name, profile_config in profile.items() %}
@@ -18,7 +18,8 @@ bfd
{% else %}
no shutdown
{% endif %}
- exit
+ exit
+ !
{% endfor %}
{% endif %}
{% if peer is defined and peer is not none %}
@@ -38,8 +39,10 @@ bfd
{% else %}
no shutdown
{% endif %}
- exit
+ exit
+ !
{% endfor %}
{% endif %}
- end
+exit
!
+{% endif %}
diff --git a/src/conf_mode/protocols_bfd.py b/src/conf_mode/protocols_bfd.py
index f698e30d9..94825ba10 100755
--- a/src/conf_mode/protocols_bfd.py
+++ b/src/conf_mode/protocols_bfd.py
@@ -16,8 +16,6 @@
import os
-from sys import exit
-
from vyos.config import Config
from vyos.configdict import dict_merge
from vyos.template import is_ipv6
@@ -36,7 +34,6 @@ def get_config(config=None):
conf = Config()
base = ['protocols', 'bfd']
bfd = conf.get_config_dict(base, get_first_key=True)
-
# Bail out early if configuration tree does not exist
if not conf.exists(base):
return bfd
@@ -89,9 +86,7 @@ def verify(bfd):
def generate(bfd):
if not bfd:
- bfd['new_frr_config'] = ''
return None
-
bfd['new_frr_config'] = render_to_string('frr/bfdd.frr.tmpl', bfd)
def apply(bfd):
@@ -100,8 +95,9 @@ def apply(bfd):
# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()
frr_cfg.load_configuration(bfd_daemon)
- frr_cfg.modify_section('^bfd', '')
- frr_cfg.add_before(frr.default_add_before, bfd['new_frr_config'])
+ frr_cfg.modify_section('^bfd', stop_pattern='^exit', remove_stop_mark=True)
+ if 'new_frr_config' in bfd:
+ frr_cfg.add_before(frr.default_add_before, bfd['new_frr_config'])
frr_cfg.commit_configuration(bfd_daemon)
return None