refactor iosxr_system for cliconf and netconf (#34749)

* * refactor iosxr_system for cliconf and netconf

* * Fix unit tests and sanity issues
This commit is contained in:
Kedar Kekan 2018-01-17 19:59:28 +05:30 committed by Chris Alfonso
commit 93acd7c651
13 changed files with 1044 additions and 127 deletions

View file

@ -137,9 +137,7 @@ def build_xml_subtree(container_ele, xmap, param=None, opcode=None):
meta_subtree = list()
for key, meta in xmap.items():
candidates = meta.get('xpath', "").split("/")
if container_ele.tag == candidates[-2]:
parent = container_ele
elif sub_root.tag == candidates[-2]:
@ -249,14 +247,13 @@ def build_xml(container, xmap=None, params=None, opcode=None):
container_ele = etree.SubElement(root, container, nsmap=NS_DICT[container.upper() + "_NSMAP"])
if xmap:
if not params:
build_xml_subtree(container_ele, xmap)
if xmap is not None:
if params is None:
build_xml_subtree(container_ele, xmap, opcode=opcode)
else:
subtree_list = list()
for param in to_list(params):
subtree_ele = build_xml_subtree(container_ele, xmap, param, opcode=opcode)
subtree_ele = build_xml_subtree(container_ele, xmap, param=param, opcode=opcode)
if subtree_ele is not None:
subtree_list.append(subtree_ele)