diff options
| author | Alex Kudentsov <43482574+alexk37@users.noreply.github.com> | 2026-10-06 13:25:22 +0700 |
|---|---|---|
| committer | Alex Kudentsov <43482574+alexk37@users.noreply.github.com> | 2026-10-07 00:46:24 +0700 |
| commit | df22720c7af9fab801f2f7b3b69afd05e6e511e9 (patch) | |
| tree | e1c6fe82f334b2ca893cfe8555bdcbd68794c244 /python | |
| parent | 87e0a46281746f92a0dde4c7d71c86aa00ec90ea (diff) | |
| download | vyos-1x-df22720c7af9fab801f2f7b3b69afd05e6e511e9.tar.gz vyos-1x-df22720c7af9fab801f2f7b3b69afd05e6e511e9.zip | |
bgp: T9404: do not render "bgp default local-preference" when the value is 100
FRR does not print "bgp default local-preference 100" in show
running-config because 100 is its default, so frr-reload never finds the
line in the running config and sends it again on every reload. The
command handler calls bgp_clear_star_soft_in() whether or not the value
changed, so every reload ran "clear bgp * soft in" (once in pass 0 and
twice in pass 1), a full inbound re-evaluation of every peer.
Add the default (100) to the XML definition of parameters default
local-pref. Templates cannot query the XML definition while rendering,
so frrender takes the value from the config defaults of "parameters
default" (conf.get_config_defaults) and adds it to the BGP dict as the
key xml_default_local_pref, for the global instance and for every VRF
instance. bgpd.frr.j2 renders the line only when the configured value
differs from xml_default_local_pref, so the value 100 is not hardcoded
in the template. A real value change (100 to 200, or 200 to 100) is
still sent: frr-reload sees the difference between the rendered file and
the running config.
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/frrender.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/python/vyos/frrender.py b/python/vyos/frrender.py index 69bb93a96..eac03e4d3 100644 --- a/python/vyos/frrender.py +++ b/python/vyos/frrender.py @@ -297,6 +297,12 @@ def get_frrender_dict(conf: Config, argv=None) -> dict: no_tag_node_value_mangle=True, with_recursive_defaults=True) bgp['dependent_vrfs'] = {} + # The XML default of "parameters default local-pref" is added to the + # dict, the template cannot query it while rendering. Only the node + # "parameters default" is asked for, not the whole BGP tree. + tmp = conf.get_config_defaults(bgp_cli_path + ['parameters', 'default'], + key_mangling=('-', '_'), get_first_key=True) + bgp['xml_default_local_pref'] = tmp.get('local_pref') dict.update({'bgp' : bgp}) elif conf.exists_effective(bgp_cli_path): dict.update({'bgp' : {'deleted' : '', 'dependent_vrfs' : {}}}) @@ -522,6 +528,8 @@ def get_frrender_dict(conf: Config, argv=None) -> dict: # merge in remaining default values vrf_config['protocols']['bgp'] = config_dict_merge(default_values, vrf_config['protocols']['bgp']) + vrf_config['protocols']['bgp']['xml_default_local_pref'] = dict_search( + 'parameters.default.local_pref', default_values) # Add this BGP VRF instance as dependency into the default VRF if 'bgp' in dict: |
