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
parent 0f692f1fe7
commit 93acd7c651
13 changed files with 1044 additions and 127 deletions

View file

@ -107,17 +107,18 @@ class Netconf(NetconfBase):
reply = self.get(install_filter)
ele_boot_variable = etree.fromstring(reply).find('.//boot-variable/boot-variable')
if ele_boot_variable:
if ele_boot_variable is not None:
device_info['network_os_image'] = re.split('[:|,]', ele_boot_variable.text)[1]
ele_package_name = etree.fromstring(reply).find('.//package-name')
if ele_package_name:
if ele_package_name is not None:
device_info['network_os_package'] = ele_package_name.text
device_info['network_os_version'] = re.split('-', ele_package_name.text)[-1]
hostname_filter = build_xml('host-names', opcode='filter')
reply = self.get(hostname_filter)
device_info['network_os_hostname'] = etree.fromstring(reply).find('.//host-name').text
hostname_ele = etree.fromstring(reply).find('.//host-name')
device_info['network_os_hostname'] = hostname_ele.text if hostname_ele is not None else None
return device_info