diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-11-27 19:36:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-27 19:36:34 +0100 |
commit | 59dc14bee7ca6e4fd2bbabe5c5ae7518839e7a80 (patch) | |
tree | 8164c4cb49efaf0be512e6133259f4b4cfac6009 /src/conf_mode/protocols_bfd.py | |
parent | 1df8ba611f04c46d49f4cf70d6fa22cfef089392 (diff) | |
parent | 5e38895c906f05ecd3815573f07106a9ccab145a (diff) | |
download | vyos-1x-59dc14bee7ca6e4fd2bbabe5c5ae7518839e7a80.tar.gz vyos-1x-59dc14bee7ca6e4fd2bbabe5c5ae7518839e7a80.zip |
Merge pull request #1089 from c-po/t3753-frr8
T3753 - CLI adjustments for FRR8.1
Diffstat (limited to 'src/conf_mode/protocols_bfd.py')
-rwxr-xr-x | src/conf_mode/protocols_bfd.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/conf_mode/protocols_bfd.py b/src/conf_mode/protocols_bfd.py index 539fd7b8e..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,18 +86,19 @@ 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): + bfd_daemon = 'bfdd' + # Save original configuration prior to starting any commit actions frr_cfg = frr.FRRConfig() - frr_cfg.load_configuration() - frr_cfg.modify_section('^bfd', '') - frr_cfg.add_before(r'(ip prefix-list .*|route-map .*|line vty)', bfd['new_frr_config']) - frr_cfg.commit_configuration() + frr_cfg.load_configuration(bfd_daemon) + 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 |