summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-09-27 08:52:13 +0200
committerChristian Breunig <christian@breunig.cc>2025-09-27 08:52:13 +0200
commit5845c4b1c50bc0335284cfb3306e0a91de3efd40 (patch)
tree3b134b4018a972ee7d5b8119e8408130aa149902 /python
parent7da3fcc9b7306f2e241716aa26b518540f3e3471 (diff)
downloadvyos-1x-5845c4b1c50bc0335284cfb3306e0a91de3efd40.tar.gz
vyos-1x-5845c4b1c50bc0335284cfb3306e0a91de3efd40.zip
frr: T7875: add pre-apply validation using frr-reload --test
Ensures rendered FRR config passes sanity checks before applying. Prevents issues like T7089 where bad template syntax broke routing. Improves robustness and minimizes risk of config-induced outages.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/frrender.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/vyos/frrender.py b/python/vyos/frrender.py
index f4ed69205..b3af4bf0a 100644
--- a/python/vyos/frrender.py
+++ b/python/vyos/frrender.py
@@ -34,6 +34,10 @@ def debug(message):
return
print(message)
+ERROR_RELOAD_TEST: str = 'The system encountered an error while rendering the ' \
+ 'new routing daemon configuration. To ensure network stability and avoid ' \
+ 'potential connectivity disruptions, the configuration was not applied!'
+
frr_protocols = ['babel', 'bfd', 'bgp', 'eigrp', 'isis', 'mpls', 'nhrp',
'openfabric', 'ospf', 'ospfv3', 'pim', 'pim6', 'rip',
'ripng', 'rpki', 'segment_routing', 'static']
@@ -748,6 +752,13 @@ class FRRender:
return True
def apply(self, count_max=5):
+ # Do a config reload test
+ cmdline = f'/usr/lib/frr/frr-reload.py --test'
+ rc, emsg = rc_cmd(f'{cmdline} {self._frr_conf}')
+ if rc != 0:
+ debug(emsg)
+ raise ConfigError(ERROR_RELOAD_TEST)
+
count = 0
emsg = ''
while count < count_max: