diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-04-11 18:38:05 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-04-12 21:16:19 +0200 |
commit | b720ba2244e70ee730bcb7e2418f4a86e6a7f114 (patch) | |
tree | 9f24438ea45e6119dec3e10f4c1fda8f2ee12abd /src | |
parent | c70a815437fdeed798f9a903873e7d95320bdb12 (diff) | |
download | vyos-1x-b720ba2244e70ee730bcb7e2418f4a86e6a7f114.tar.gz vyos-1x-b720ba2244e70ee730bcb7e2418f4a86e6a7f114.zip |
ospf: T3328: route-map to zebra/kernel can not be removed
Removing the Zebra/Linux Kernel route-map added by "set protocols ospf route-map"
was not removed once applied. This was because the removal must happen within
the zebra daemon and not ospfd.
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/protocols_ospf.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/conf_mode/protocols_ospf.py b/src/conf_mode/protocols_ospf.py index a97d5b5ed..7f718fb43 100755 --- a/src/conf_mode/protocols_ospf.py +++ b/src/conf_mode/protocols_ospf.py @@ -35,8 +35,6 @@ from vyos import frr from vyos import airbag airbag.enable() -frr_daemon = 'ospfd' - def get_config(config=None): if config: conf = config @@ -181,17 +179,26 @@ def generate(ospf): return None def apply(ospf): + ospf_daemon = 'ospfd' + zebra_daemon = 'zebra' + # Save original configuration prior to starting any commit actions frr_cfg = frr.FRRConfig() - frr_cfg.load_configuration(frr_daemon) - # Generate empty helper string which can be ammended to FRR commands, - # it will be either empty (default VRF) or contain the "vrf <name" statement + # 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 ospf route-map [-a-zA-Z0-9.]+$', '') + frr_cfg.commit_configuration(zebra_daemon) + + # Generate empty helper string which can be ammended to FRR commands, it + # will be either empty (default VRF) or contain the "vrf <name" statement vrf = '' if 'vrf' in ospf: vrf = ' vrf ' + ospf['vrf'] + frr_cfg.load_configuration(ospf_daemon) frr_cfg.modify_section(f'^router ospf{vrf}$', '') + for key in ['interface', 'interface_removed']: if key not in ospf: continue @@ -199,13 +206,13 @@ def apply(ospf): frr_cfg.modify_section(f'^interface {interface}{vrf}$', '') frr_cfg.add_before(r'(ip prefix-list .*|route-map .*|line vty)', ospf['new_frr_config']) - frr_cfg.commit_configuration(frr_daemon) + frr_cfg.commit_configuration(ospf_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 ospf['new_frr_config'] == '': for a in range(5): - frr_cfg.commit_configuration(frr_daemon) + frr_cfg.commit_configuration(ospf_daemon) # Save configuration to /run/frr/config/frr.conf frr.save_configuration() |