diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-11-27 10:32:01 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-11-27 10:32:01 +0100 |
commit | c65ee39e28422785734fd736eb15727ae9228b5a (patch) | |
tree | 31a807b68f7e138e5a8409dfbdf3dd5036e4c464 /src/conf_mode/policy.py | |
parent | 262fec8868d09d7cdd1f939a9ec0c74ba0ecc7c5 (diff) | |
download | vyos-1x-c65ee39e28422785734fd736eb15727ae9228b5a.tar.gz vyos-1x-c65ee39e28422785734fd736eb15727ae9228b5a.zip |
policy: T3753: adjust to new FRR 8.1 syntax
Every node in running config now has an explicit "exit" tag
Diffstat (limited to 'src/conf_mode/policy.py')
-rwxr-xr-x | src/conf_mode/policy.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/conf_mode/policy.py b/src/conf_mode/policy.py index 5c592a599..5f9fcab9f 100755 --- a/src/conf_mode/policy.py +++ b/src/conf_mode/policy.py @@ -171,9 +171,7 @@ def verify(policy): def generate(policy): if not policy: - policy['new_frr_config'] = '' return None - policy['new_frr_config'] = render_to_string('frr/policy.frr.tmpl', policy) return None @@ -190,8 +188,9 @@ def apply(policy): frr_cfg.modify_section(r'^bgp community-list .*') frr_cfg.modify_section(r'^bgp extcommunity-list .*') frr_cfg.modify_section(r'^bgp large-community-list .*') - frr_cfg.modify_section(r'^route-map .*') - frr_cfg.add_before(frr.default_add_before, policy['new_frr_config']) + frr_cfg.modify_section(r'^route-map .*', stop_pattern='^exit', remove_stop_mark=True) + if 'new_frr_config' in policy: + frr_cfg.add_before(frr.default_add_before, policy['new_frr_config']) frr_cfg.commit_configuration(bgp_daemon) # The route-map used for the FIB (zebra) is part of the zebra daemon @@ -200,16 +199,11 @@ def apply(policy): frr_cfg.modify_section(r'^ipv6 access-list .*') frr_cfg.modify_section(r'^ip prefix-list .*') frr_cfg.modify_section(r'^ipv6 prefix-list .*') - frr_cfg.modify_section(r'^route-map .*') - frr_cfg.add_before(frr.default_add_before, policy['new_frr_config']) + frr_cfg.modify_section(r'^route-map .*', stop_pattern='^exit', remove_stop_mark=True) + if 'new_frr_config' in policy: + frr_cfg.add_before(frr.default_add_before, policy['new_frr_config']) frr_cfg.commit_configuration(zebra_daemon) - # If FRR config is blank, rerun the blank commit x times due to frr-reload - # behavior/bug not properly clearing out on one commit. - if policy['new_frr_config'] == '': - for a in range(5): - frr_cfg.commit_configuration(zebra_daemon) - # Save configuration to /run/frr/config/frr.conf frr.save_configuration() |