From d958f00dda8bcf15720d32c610f1e2fb5909a53a Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Fri, 19 May 2023 14:16:21 -0500 Subject: 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. --- python/vyos/xml_ref/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'python/vyos/xml_ref/__init__.py') 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) -- cgit v1.2.3