Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS-XR get_environment() throws an error in 6.3.2 on NCS5501 #1181

Closed
1 task done
mcroff-wish opened this issue Apr 22, 2020 · 3 comments
Closed
1 task done

IOS-XR get_environment() throws an error in 6.3.2 on NCS5501 #1181

mcroff-wish opened this issue Apr 22, 2020 · 3 comments
Milestone

Comments

@mcroff-wish
Copy link

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.

xml-active-modules.xml.log

From: https://github.com/napalm-automation/napalm/blob/develop/napalm/iosxr/iosxr.py#L589

xml-result.xml.log

From: https://github.com/napalm-automation/napalm/blob/develop/napalm/iosxr/iosxr.py#L664

@n-holmstedt
Copy link

n-holmstedt commented Sep 4, 2020

Seems like have been reworked in later versions. I'm on IOSXR 7.0.2 and i couldn't find anything regarding inventory under the adminoperational.

 <?xml version="1.0" encoding="UTF-8"?><Request MajorVersion="1" MinorVersion="0"><Get><Operational><Inventory/></Operational></Get></Request>

This seems to get some information regarding physical entities tho.

@mirceaulinic
Copy link
Member

It looks like this got moved under Oper (instead of AdminOper as in previous versions).

@n-holmstedt if you have multiple devices available, would you be able to confirm the following output on XR 7+ in show xml schema mode?

xml-schema[config]:> adminoper 
xml-schema[adminoper]:> walkdata ?

License                  SDRInventory             SystemProcess            
PlatformInventory        Platform                 DSC                      
Redundancy               NTP                      SmartLicense             
xml-schema[adminoper]:>

Instead it's available under:

xml-schema[adminoper]:> oper
xml-schema[oper]:> walkdata MemorySummary
MemorySummary.NodeTable.Node{0/0/CPU0}.Summary
Value:
  node_mem_info

For XR 6 and earlier, MemorySummary should still be under AdminOper). It'd be great if you or someone would be able to verify what I'm assuming (I only have access to 7.0.2 currently).

@mirceaulinic
Copy link
Member

Would anyone be able to test #1400 and confirm it solves this issue?

mirceaulinic added a commit that referenced this issue Mar 26, 2021
Resolve #1181 and reduce the get_facts heavy workload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants