summaryrefslogtreecommitdiff
path: root/python/vyos/xml_ref/__init__.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-05-19 14:16:21 -0500
committerJohn Estabrook <jestabro@vyos.io>2023-05-19 14:53:38 -0500
commitd958f00dda8bcf15720d32c610f1e2fb5909a53a (patch)
treea7b6c9efa007561ef3ecc2ceb9aa42a1049a33bb /python/vyos/xml_ref/__init__.py
parent222f459d82ec8bed2f4e4c89e7ea81249bc4ebe4 (diff)
downloadvyos-1x-d958f00dda8bcf15720d32c610f1e2fb5909a53a.tar.gz
vyos-1x-d958f00dda8bcf15720d32c610f1e2fb5909a53a.zip
xml: T5218: return defaults only for child leaf-nodes, unless recursive
Operations get_defaults and get_config_defaults return default values only for nodes with parent in the config dict (get_config_defaults) or at the path (get_defaults). To include default values of decendent nodes, set option recursive=True.
Diffstat (limited to 'python/vyos/xml_ref/__init__.py')
-rw-r--r--python/vyos/xml_ref/__init__.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/python/vyos/xml_ref/__init__.py b/python/vyos/xml_ref/__init__.py
index 66525865c..ae5184746 100644
--- a/python/vyos/xml_ref/__init__.py
+++ b/python/vyos/xml_ref/__init__.py
@@ -51,8 +51,16 @@ def component_version() -> dict:
def multi_to_list(rpath: list, conf: dict) -> dict:
return load_reference().multi_to_list(rpath, conf)
-def get_defaults(path: list, get_first_key=False) -> dict:
- return load_reference().get_defaults(path, get_first_key=get_first_key)
+def get_defaults(path: list, get_first_key=False, recursive=False) -> dict:
+ return load_reference().get_defaults(path, get_first_key=get_first_key,
+ recursive=recursive)
+
+def get_config_defaults(rpath: list, conf: dict, get_first_key=False,
+ recursive=False) -> dict:
+
+ return load_reference().relative_defaults(rpath, conf=conf,
+ get_first_key=get_first_key,
+ recursive=recursive)
def merge_defaults(path: list, conf: dict) -> dict:
return load_reference().merge_defaults(path, conf)