summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-10-11 20:54:19 +0200
committerGitHub <noreply@github.com>2026-10-11 20:54:19 +0200
commita3a16c61445e4f53cab9093b26cc7022181fd0b6 (patch)
tree7ea712501ad9d99039091ed90b13f106a642a827 /python
parentc8d344fd8954035c840a0991a97c6653a72c7c54 (diff)
parent104791f05d493f4001ff092717f24bafbfae28e3 (diff)
downloadvyos-1x-a3a16c61445e4f53cab9093b26cc7022181fd0b6.tar.gz
vyos-1x-a3a16c61445e4f53cab9093b26cc7022181fd0b6.zip
Merge pull request #5545 from rnavarro/fix/ospf-metric-type-default
ospf: T9448: do not render metric-type when it is the default
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 371ea95b5..7d1401d2c 100644
--- a/python/vyos/frrender.py
+++ b/python/vyos/frrender.py
@@ -120,6 +120,12 @@ def get_frrender_dict(conf: Config, argv=None) -> dict:
# options which we need to update into the dictionary retrieved.
default_values = conf.get_config_defaults(path, key_mangling=('-', '_'),
get_first_key=True, recursive=True)
+ # The XML default of metric-type (shared by default-information and
+ # redistribute) is added to the dict, the template cannot query it
+ # while rendering.
+ xml_default_metric_type = dict_search(
+ 'default_information.originate.metric_type', default_values
+ )
# We have to cleanup the default dict, as default values could enable features
# which are not explicitly enabled on the CLI. Example: default-information
@@ -151,6 +157,7 @@ def get_frrender_dict(conf: Config, argv=None) -> dict:
del default_values['interface'][interface]['dead_interval']
ospf = config_dict_merge(default_values, ospf)
+ ospf['xml_default_metric_type'] = xml_default_metric_type
return ospf
def dict_helper_ospfv3_defaults(ospfv3, path):
@@ -158,6 +165,11 @@ def get_frrender_dict(conf: Config, argv=None) -> dict:
# options which we need to update into the dictionary retrieved.
default_values = conf.get_config_defaults(path, key_mangling=('-', '_'),
get_first_key=True, recursive=True)
+ # The XML default of metric-type is added to the dict, the template
+ # cannot query it while rendering.
+ xml_default_metric_type = dict_search(
+ 'default_information.originate.metric_type', default_values
+ )
# We have to cleanup the default dict, as default values could enable features
# which are not explicitly enabled on the CLI. Example: default-information
@@ -179,6 +191,7 @@ def get_frrender_dict(conf: Config, argv=None) -> dict:
# merge in remaining default values
ospfv3 = config_dict_merge(default_values, ospfv3)
+ ospfv3['xml_default_metric_type'] = xml_default_metric_type
return ospfv3
def dict_helper_pim_defaults(pim, path):