summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-08-24 15:55:16 +0200
committerChristian Breunig <christian@breunig.cc>2023-08-24 15:55:16 +0200
commit3baba6b477409163fd3520dd8bf806790d4edd6e (patch)
tree1b14c910901babf6f647856fd25dfe1897bae7a5 /src
parentbf7e94a6606c9245721194b7d5c18c24a9f8baef (diff)
downloadvyos-1x-3baba6b477409163fd3520dd8bf806790d4edd6e.tar.gz
vyos-1x-3baba6b477409163fd3520dd8bf806790d4edd6e.zip
system: T5505: fix zebra route-map is not removed from FRR
Configuring "set system ip protocol ospf|bgp route-map foo" and commit it installs the route-map into FRR. Removing the CLI configuration "delete system ip protocol" does not remove the route-map from FRR - it stays active. This commit adds the fix and appropriate smoketests extenstion.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/system-ip.py24
-rwxr-xr-xsrc/conf_mode/system-ipv6.py22
2 files changed, 21 insertions, 25 deletions
diff --git a/src/conf_mode/system-ip.py b/src/conf_mode/system-ip.py
index 9ed34c735..5e4e5ec28 100755
--- a/src/conf_mode/system-ip.py
+++ b/src/conf_mode/system-ip.py
@@ -61,8 +61,7 @@ def verify(opt):
return
def generate(opt):
- if 'protocol' in opt:
- opt['frr_zebra_config'] = render_to_string('frr/zebra.route-map.frr.j2', opt)
+ opt['frr_zebra_config'] = render_to_string('frr/zebra.route-map.frr.j2', opt)
return
def apply(opt):
@@ -116,17 +115,16 @@ def apply(opt):
value = '48' if (tmp is None) else tmp
sysctl_write('net.ipv4.tcp_mtu_probe_floor', value)
- if 'protocol' in opt:
- zebra_daemon = 'zebra'
- # Save original configuration prior to starting any commit actions
- frr_cfg = frr.FRRConfig()
-
- # 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 \w+ route-map [-a-zA-Z0-9.]+', stop_pattern='(\s|!)')
- if 'frr_zebra_config' in opt:
- frr_cfg.add_before(frr.default_add_before, opt['frr_zebra_config'])
- frr_cfg.commit_configuration(zebra_daemon)
+ zebra_daemon = 'zebra'
+ # Save original configuration prior to starting any commit actions
+ frr_cfg = frr.FRRConfig()
+
+ # 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 \w+ route-map [-a-zA-Z0-9.]+', stop_pattern='(\s|!)')
+ if 'frr_zebra_config' in opt:
+ frr_cfg.add_before(frr.default_add_before, opt['frr_zebra_config'])
+ frr_cfg.commit_configuration(zebra_daemon)
if __name__ == '__main__':
try:
diff --git a/src/conf_mode/system-ipv6.py b/src/conf_mode/system-ipv6.py
index 8a4df11fa..e40ed38e2 100755
--- a/src/conf_mode/system-ipv6.py
+++ b/src/conf_mode/system-ipv6.py
@@ -61,8 +61,7 @@ def verify(opt):
return
def generate(opt):
- if 'protocol' in opt:
- opt['frr_zebra_config'] = render_to_string('frr/zebra.route-map.frr.j2', opt)
+ opt['frr_zebra_config'] = render_to_string('frr/zebra.route-map.frr.j2', opt)
return
def apply(opt):
@@ -94,17 +93,16 @@ def apply(opt):
if name == 'accept_dad':
write_file(os.path.join(root, name), value)
- if 'protocol' in opt:
- zebra_daemon = 'zebra'
- # Save original configuration prior to starting any commit actions
- frr_cfg = frr.FRRConfig()
+ zebra_daemon = 'zebra'
+ # Save original configuration prior to starting any commit actions
+ frr_cfg = frr.FRRConfig()
- # 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'ipv6 protocol \w+ route-map [-a-zA-Z0-9.]+', stop_pattern='(\s|!)')
- if 'frr_zebra_config' in opt:
- frr_cfg.add_before(frr.default_add_before, opt['frr_zebra_config'])
- frr_cfg.commit_configuration(zebra_daemon)
+ # 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'ipv6 protocol \w+ route-map [-a-zA-Z0-9.]+', stop_pattern='(\s|!)')
+ if 'frr_zebra_config' in opt:
+ frr_cfg.add_before(frr.default_add_before, opt['frr_zebra_config'])
+ frr_cfg.commit_configuration(zebra_daemon)
if __name__ == '__main__':
try: