summaryrefslogtreecommitdiff
path: root/src/conf_mode/vrf_vni.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/conf_mode/vrf_vni.py')
-rwxr-xr-xsrc/conf_mode/vrf_vni.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/conf_mode/vrf_vni.py b/src/conf_mode/vrf_vni.py
index 50d60f0dc..585fdbebf 100755
--- a/src/conf_mode/vrf_vni.py
+++ b/src/conf_mode/vrf_vni.py
@@ -40,20 +40,18 @@ def verify(vrf):
return None
def generate(vrf):
- vrf['new_frr_config'] = render_to_string('frr/vrf-vni.frr.tmpl', vrf)
+ vrf['new_frr_config'] = render_to_string('frr/vrf-vni.frr.j2', vrf)
return None
def apply(vrf):
# add configuration to FRR
frr_cfg = frr.FRRConfig()
frr_cfg.load_configuration(frr_daemon)
- frr_cfg.modify_section(f'^vrf .+$', '')
- frr_cfg.add_before(r'(interface .*|line vty)', vrf['new_frr_config'])
+ frr_cfg.modify_section(f'^vrf .+', stop_pattern='^exit-vrf', remove_stop_mark=True)
+ if 'new_frr_config' in vrf:
+ frr_cfg.add_before(frr.default_add_before, vrf['new_frr_config'])
frr_cfg.commit_configuration(frr_daemon)
- # Save configuration to /run/frr/config/frr.conf
- frr.save_configuration()
-
return None
if __name__ == '__main__':