From ff4001f4702a1db50398abd8f24f7ad54149f200 Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Fri, 5 Jul 2019 12:21:38 +0530 Subject: [PATCH] Update junos module utils (#58730) * Add utils fucntion to build xml subtree --- lib/ansible/module_utils/network/junos/utils/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ansible/module_utils/network/junos/utils/utils.py b/lib/ansible/module_utils/network/junos/utils/utils.py index 1c013cf1db..a5326cea7c 100644 --- a/lib/ansible/module_utils/network/junos/utils/utils.py +++ b/lib/ansible/module_utils/network/junos/utils/utils.py @@ -27,6 +27,14 @@ def build_child_xml_node(parent, tag, text=None, attrib=None): return element +def build_subtree(parent, path): + element = parent + for field in path.split('/'): + sub_element = build_child_xml_node(element, field) + element = sub_element + return element + + def _handle_field_replace(root, field, have, want, tag=None): tag = field if not tag else tag want_value = want.get(field) if want else None