summaryrefslogtreecommitdiff
path: root/src/conf_mode/protocols_static.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
commitff4e9245b4cc187124345171c07fd22b0aae7377 (patch)
tree409e585043e4f9df047151a8cb66e8644cea733a /src/conf_mode/protocols_static.py
parent1a96fb8a4424967f9d535df64c3119fc572d2f52 (diff)
downloadvyos-1x-ff4e9245b4cc187124345171c07fd22b0aae7377.tar.gz
vyos-1x-ff4e9245b4cc187124345171c07fd22b0aae7377.zip
static: T3753: adjust to new FRR 8.1 syntax
Diffstat (limited to 'src/conf_mode/protocols_static.py')
-rwxr-xr-xsrc/conf_mode/protocols_static.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/conf_mode/protocols_static.py b/src/conf_mode/protocols_static.py
index f010141e9..5cfe37655 100755
--- a/src/conf_mode/protocols_static.py
+++ b/src/conf_mode/protocols_static.py
@@ -85,6 +85,8 @@ def verify(static):
return None
def generate(static):
+ if not static:
+ return None
static['new_frr_config'] = render_to_string('frr/staticd.frr.tmpl', static)
return None
@@ -97,19 +99,19 @@ def apply(static):
# 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'^ip protocol static route-map [-a-zA-Z0-9.]+$', '')
+ frr_cfg.modify_section(r'^ip protocol static route-map [-a-zA-Z0-9.]+', '')
frr_cfg.commit_configuration(zebra_daemon)
-
frr_cfg.load_configuration(static_daemon)
if 'vrf' in static:
vrf = static['vrf']
- frr_cfg.modify_section(f'^vrf {vrf}$', '')
+ frr_cfg.modify_section(f'^vrf {vrf}', stop_pattern='^exit', remove_stop_mark=True)
else:
- frr_cfg.modify_section(r'^ip route .*', '')
- frr_cfg.modify_section(r'^ipv6 route .*', '')
+ frr_cfg.modify_section(r'^ip route .*')
+ frr_cfg.modify_section(r'^ipv6 route .*')
- frr_cfg.add_before(r'(interface .*|line vty)', static['new_frr_config'])
+ if 'new_frr_config' in static:
+ frr_cfg.add_before(frr.default_add_before, static['new_frr_config'])
frr_cfg.commit_configuration(static_daemon)
# Save configuration to /run/frr/config/frr.conf