diff options
| author | Christian Breunig <christian@breunig.cc> | 2025-10-29 08:46:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-29 08:46:37 +0100 |
| commit | 0046b24ad9def8b0672606795e70b7927ea79dc4 (patch) | |
| tree | b59595d3f8111f97f85e5ecb125c2aa2281305de /src | |
| parent | 7e4715447564ec3a8c522ae3e4647a3474b182ed (diff) | |
| parent | c23c277d0fe3e08d1fece3e938b32406b7b976d7 (diff) | |
| download | vyos-1x-0046b24ad9def8b0672606795e70b7927ea79dc4.tar.gz vyos-1x-0046b24ad9def8b0672606795e70b7927ea79dc4.zip | |
Merge pull request #4810 from bl0way/T7896-frr-profile
T7896: Add frr profile selection
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/system_frr.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/conf_mode/system_frr.py b/src/conf_mode/system_frr.py index 06af37ad8..5365ac294 100755 --- a/src/conf_mode/system_frr.py +++ b/src/conf_mode/system_frr.py @@ -19,12 +19,15 @@ from sys import exit from vyos import ConfigError from vyos.base import Warning from vyos.config import Config +from vyos.frrender import FRRender +from vyos.frrender import get_frrender_dict from vyos.logger import syslog from vyos.template import render_to_string from vyos.utils.boot import boot_configuration_complete from vyos.utils.file import read_file from vyos.utils.file import write_file from vyos.utils.process import call +from vyos.utils.process import is_systemd_service_running from vyos import airbag airbag.enable() @@ -42,7 +45,8 @@ def get_config(config=None): frr_config = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True, with_recursive_defaults=True) - + # get FRR configuration + frr_config['frr_dict'] = get_frrender_dict(conf) return frr_config def verify(frr_config): @@ -60,7 +64,17 @@ def generate(frr_config): write_file(config_file, daemons_config_new) frr_config['config_file_changed'] = True + # profile could be automatically generated by frr in frr.conf + # and needs to be updated as it is taking precedence + if 'frr_dict' in frr_config and not is_systemd_service_running('vyos-configd.service'): + FRRender().generate(frr_config['frr_dict']) + return None + def apply(frr_config): + # applying the profile configuration if necessary + if 'frr_dict' in frr_config and not is_systemd_service_running('vyos-configd.service'): + FRRender().apply() + # display warning to user if boot_configuration_complete() and frr_config.get('config_file_changed'): # Since FRR restart is not safe thing, better to give |
