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 | 4e35c58c3ff85668797aa2413cd8af72ec29c830 (patch) | |
tree | 4ad8086274d5d7908dca92ea7a2fbc5a7fd55094 | |
parent | a6dcf706f925c11b3de4666fa2264c2d13863f12 (diff) | |
download | vyos-1x-4e35c58c3ff85668797aa2413cd8af72ec29c830.tar.gz vyos-1x-4e35c58c3ff85668797aa2413cd8af72ec29c830.zip |
bgp: T3753: adjust to new FRR 8.1 syntax
-rw-r--r-- | data/templates/frr/bgpd.frr.tmpl | 3 | ||||
-rwxr-xr-x | src/conf_mode/protocols_bgp.py | 12 |
2 files changed, 7 insertions, 8 deletions
diff --git a/data/templates/frr/bgpd.frr.tmpl b/data/templates/frr/bgpd.frr.tmpl index 61936bb56..fbdbafd6e 100644 --- a/data/templates/frr/bgpd.frr.tmpl +++ b/data/templates/frr/bgpd.frr.tmpl @@ -524,5 +524,4 @@ router bgp {{ local_as }} {{ 'vrf ' ~ vrf if vrf is defined and vrf is not none {% if timers is defined and timers.keepalive is defined and timers.holdtime is defined %} timers bgp {{ timers.keepalive }} {{ timers.holdtime }} {% endif %} - end -!
\ No newline at end of file +exit
\ No newline at end of file diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py index 084198251..359bfff76 100755 --- a/src/conf_mode/protocols_bgp.py +++ b/src/conf_mode/protocols_bgp.py @@ -268,8 +268,6 @@ def verify(bgp): def generate(bgp): if not bgp or 'deleted' in bgp: - bgp['frr_bgpd_config'] = '' - bgp['frr_zebra_config'] = '' return None bgp['protocol'] = 'bgp' # required for frr/vrf.route-map.frr.tmpl @@ -287,8 +285,9 @@ def apply(bgp): # The route-map used for the FIB (zebra) is part of the zebra daemon frr_cfg.load_configuration(zebra_daemon) - frr_cfg.modify_section(r'(\s+)?ip protocol bgp route-map [-a-zA-Z0-9.]+$', '', '(\s|!)') - frr_cfg.add_before(frr.default_add_before, bgp['frr_zebra_config']) + frr_cfg.modify_section(r'(\s+)?ip protocol bgp route-map [-a-zA-Z0-9.]+', stop_pattern='(\s|!)') + if 'frr_zebra_config' in bgp: + frr_cfg.add_before(frr.default_add_before, bgp['frr_zebra_config']) frr_cfg.commit_configuration(zebra_daemon) # Generate empty helper string which can be ammended to FRR commands, it @@ -298,8 +297,9 @@ def apply(bgp): vrf = ' vrf ' + bgp['vrf'] frr_cfg.load_configuration(bgp_daemon) - frr_cfg.modify_section(f'^router bgp \d+{vrf}$', '') - frr_cfg.add_before(frr.default_add_before, bgp['frr_bgpd_config']) + frr_cfg.modify_section(f'^router bgp \d+{vrf}', stop_pattern='^exit', remove_stop_mark=True) + if 'frr_bgpd_config' in bgp: + frr_cfg.add_before(frr.default_add_before, bgp['frr_bgpd_config']) frr_cfg.commit_configuration(bgp_daemon) # Save configuration to /run/frr/config/frr.conf |