IOS-XR get_environment() throws an error in 6.3.2 on NCS5501 #1181
Description
Description of Issue/Question
Note: Please check https://guides.github.com/features/mastering-markdown/
to see how to properly format your request.
Did you follow the steps from https://github.com/napalm-automation/napalm#faq
(Place an x
between the square brackets where applicable)
- Yes
- [] No
Setup
napalm version
(Paste verbatim output from pip freeze | grep napalm
between quotes below)
napalm==2.5.0
Network operating system version
(Paste verbatim output from show version
- or equivalent - between quotes below)
Cisco IOS XR Software, Version 6.3.3
Copyright (c) 2013-2017 by Cisco Systems, Inc.
Build Information:
Built By : ahoang
Built On : Tue Aug 28 13:54:20 PDT 2018
Build Host : iox-lnx-040
Workspace : /auto/srcarchive16/prod/6.3.3/ncs5500/ws
Version : 6.3.3
Location : /opt/cisco/XR/packages/
Label : 6.3.3
Steps to Reproduce the Issue
Error Traceback
(Paste the complete traceback of the exception between quotes below)
Traceback (most recent call last):
File "ncs_get_environment.py", line 23, in <module>
main()
File "ncs_get_environment.py", line 13, in main
environment = device.get_environment()
File "/Library/Python/2.7/site-packages/napalm_iosxr/iosxr.py", line 545, in get_environment
result_tree = ETREE.fromstring(self.device.make_rpc_call(rpc_command))
File "/Library/Python/2.7/site-packages/pyIOSXR/iosxr.py", line 151, in make_rpc_call
result = self._execute_rpc(rpc_command)
File "/Library/Python/2.7/site-packages/pyIOSXR/iosxr.py", line 416, in _execute_rpc
raise XMLCLIError(error_msg, self)
pyIOSXR.exceptions.XMLCLIError:
Original call was: <?xml version="1.0" encoding="UTF-8"?><Request MajorVersion="1" MinorVersion="0"><Get><AdminOperational><MemorySummary> </MemorySummary></AdminOperational></Get></Request>
XML RPC
I dug into the XML and found an error in the format for the RPC call here: https://github.com/napalm-automation/napalm/blob/develop/napalm/iosxr/iosxr.py#L662
When I corrected the RPC call I was able to get the memory values. rpc_command = '<Get><Operational><MemorySummary></MemorySummary></Operational></Get>'
However, that resulted in yet another issue with the active modules
. This: https://github.com/napalm-automation/napalm/blob/develop/napalm/iosxr/iosxr.py#L669
Resulted in:
Traceback (most recent call last):
File "ncs_get_environment.py", line 23, in <module>
main()
File "ncs_get_environment.py", line 13, in main
environment = device.get_environment()
File "/Library/Python/2.7/site-packages/napalm_iosxr/iosxr.py", line 553, in get_environment
'Naming/NodeName/Rack') == active_modules['RSP'][0]:
IndexError: list index out of range
XML Data
I've included two XML files that are being returned by the device in the current configuration. I wasn't able to pinpoint the exact cause of the error in the code but it does appear to expect a value or set of values that are not there.
From: https://github.com/napalm-automation/napalm/blob/develop/napalm/iosxr/iosxr.py#L589
From: https://github.com/napalm-automation/napalm/blob/develop/napalm/iosxr/iosxr.py#L664