summaryrefslogtreecommitdiff
path: root/src/conf_mode/protocols_rpki.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-11-27 10:32:02 +0100
committerChristian Poessinger <christian@poessinger.com>2021-11-27 10:32:02 +0100
commit5f2e797d8f33b995afdfa02953f461ac6d2fc88c (patch)
treee5134cd75e1efdef17e8688ec96446359d07fe29 /src/conf_mode/protocols_rpki.py
parent79e91d9193aa118663626dd79450aa608f3a1a04 (diff)
downloadvyos-1x-5f2e797d8f33b995afdfa02953f461ac6d2fc88c.tar.gz
vyos-1x-5f2e797d8f33b995afdfa02953f461ac6d2fc88c.zip
rpki: T3753: adjust to new FRR 8.1 syntax
Diffstat (limited to 'src/conf_mode/protocols_rpki.py')
-rwxr-xr-xsrc/conf_mode/protocols_rpki.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/conf_mode/protocols_rpki.py b/src/conf_mode/protocols_rpki.py
index 0688e542f..41ce1f1fd 100755
--- a/src/conf_mode/protocols_rpki.py
+++ b/src/conf_mode/protocols_rpki.py
@@ -28,8 +28,6 @@ from vyos import frr
from vyos import airbag
airbag.enable()
-frr_daemon = 'bgpd'
-
def get_config(config=None):
if config:
conf = config
@@ -38,7 +36,9 @@ def get_config(config=None):
base = ['protocols', 'rpki']
rpki = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True)
+ # Bail out early if configuration tree does not exist
if not conf.exists(base):
+ rpki.update({'deleted' : ''})
return rpki
# We have gathered the dict representation of the CLI, but there are default
@@ -79,16 +79,21 @@ def verify(rpki):
return None
def generate(rpki):
+ if not rpki:
+ return
rpki['new_frr_config'] = render_to_string('frr/rpki.frr.tmpl', rpki)
return None
def apply(rpki):
+ bgp_daemon = 'bgpd'
+
# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()
- frr_cfg.load_configuration(frr_daemon)
- frr_cfg.modify_section('rpki', '')
- frr_cfg.add_before(frr.default_add_before, rpki['new_frr_config'])
- frr_cfg.commit_configuration(frr_daemon)
+ frr_cfg.load_configuration(bgp_daemon)
+ frr_cfg.modify_section('^rpki')
+ if 'new_frr_config' in rpki:
+ frr_cfg.add_before(frr.default_add_before, rpki['new_frr_config'])
+ frr_cfg.commit_configuration(bgp_daemon)
return None