Fix junos_command py3 related issues (#36782)

Fixes #36204

*  tostring() input string shoulb be in byte string format
*  to_ele() input is required in unicode format
This commit is contained in:
Ganesh Nalawade 2018-03-01 12:09:11 +05:30 committed by GitHub
parent 2fbfce06e7
commit 41d75783b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 6 deletions

View file

@ -102,7 +102,7 @@ class NetconfBase(with_metaclass(ABCMeta, object)):
"""RPC to be execute on remote device
:name: Name of rpc in string format"""
try:
obj = to_ele(to_bytes(name, errors='surrogate_or_strict'))
obj = to_ele(name)
resp = self.m.rpc(obj)
return resp.data_xml if hasattr(resp, 'data_xml') else resp.xml
except RPCError as exc:

View file

@ -50,7 +50,7 @@ class Netconf(NetconfBase):
device_info['network_os'] = 'junos'
ele = new_ele('get-software-information')
data = self.execute_rpc(to_xml(ele))
reply = to_ele(to_bytes(data, errors='surrogate_or_strict'))
reply = to_ele(data)
sw_info = reply.find('.//software-information')
device_info['network_os_version'] = self.get_text(sw_info, 'junos-version')