summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAlex Kudentsov <43482574+alexk37@users.noreply.github.com>2026-10-18 16:30:20 +0700
committerAlex Kudentsov <43482574+alexk37@users.noreply.github.com>2026-10-19 01:02:32 +0700
commitc46b3c3f04e2b025cd40193d2665505f725de871 (patch)
treef2b85afadc3d4ab29c4510721d4591817fd34b3c /python
parentaa35ee2b6416e7e3cae29dfe5cedf5ffce077496 (diff)
downloadvyos-1x-c46b3c3f04e2b025cd40193d2665505f725de871.tar.gz
vyos-1x-c46b3c3f04e2b025cd40193d2665505f725de871.zip
bgp: T9450: do not re-render the default conditional-advertisement timer
The CLI's XML default for "bgp conditional-advertisement timer" (60) is always present in the config dict, so the line was rendered on every commit. FRR's own default is the same value (DEFAULT_CONDITIONAL_ROUTES_POLL_TIME, bgpd/bgp_conditional_adv.h) and bgp_config_write() never prints it back when the value equals the default, so frr-reload saw the line missing on every reload and sent it again, both in the default instance and in every VRF instance. Templates cannot query the XML definition while rendering, so frrender takes the value from the config defaults of "parameters conditional-advertisement" (conf.get_config_defaults) and adds it to the BGP dict as the key xml_default_conditional_advertisement_timer, for the global instance and for every VRF instance, the same pattern used for "bgp default local-preference" (T9404). bgpd.frr.j2 renders the line only when the configured value differs from xml_default_conditional_advertisement_timer, comparing both as integers so a timer entered as "060" is still treated as 60.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/frrender.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/python/vyos/frrender.py b/python/vyos/frrender.py
index 7d1401d2c..6a8124325 100644
--- a/python/vyos/frrender.py
+++ b/python/vyos/frrender.py
@@ -334,6 +334,13 @@ def get_frrender_dict(conf: Config, argv=None) -> dict:
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')
+ # Same pattern for "parameters conditional-advertisement timer".
+ tmp = conf.get_config_defaults(
+ bgp_cli_path + ['parameters', 'conditional-advertisement'],
+ key_mangling=('-', '_'),
+ get_first_key=True,
+ )
+ bgp['xml_default_conditional_advertisement_timer'] = tmp.get('timer')
dict.update({'bgp' : bgp})
elif conf.exists_effective(bgp_cli_path):
dict.update({'bgp' : {'deleted' : '', 'dependent_vrfs' : {}}})
@@ -562,6 +569,12 @@ def get_frrender_dict(conf: Config, argv=None) -> dict:
vrf_config['protocols']['bgp']['xml_default_local_pref'] = dict_search(
'parameters.default.local_pref', default_values)
+ vrf_config['protocols']['bgp'][
+ 'xml_default_conditional_advertisement_timer'
+ ] = dict_search(
+ 'parameters.conditional_advertisement.timer', default_values
+ )
+
# Add this BGP VRF instance as dependency into the default VRF
if 'bgp' in dict:
dict['bgp']['dependent_vrfs'].update({vrf_name : deepcopy(vrf_config)})