napalm-automation / napalm

Network Automation and Programmability Abstraction Layer with Multivendor support
Apache License 2.0
2.25k stars 553 forks source link

NXOS get_interfaces_ip not reporting interfaces in all VRFs #483

Open Ragsboss opened 6 years ago

Ragsboss commented 6 years ago

Description of Issue/Question

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

[X] Yes [ ] No

napalm version

(Paste verbatim output from pip freeze | grep napalm between quotes below)

You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
napalm==1.2.0
napalm-base==0.25.0
napalm-eos==0.6.1
napalm-fortios==0.4.0
napalm-ios==0.8.1
napalm-iosxr==0.5.6
napalm-junos==0.12.1
napalm-nxos==0.7.1
napalm-panos==0.4.0
napalm-pluribus==0.5.1
napalm-ros==0.2.2
napalm-vyos==0.1.3

Network device software version

(Paste verbatim output from show version (or equivalent on your platform) between quotes below)

Cisco Nexus Operating System (NX-OS) Software
TAC support: http://www.cisco.com/tac
Documents: http://www.cisco.com/en/US/products/ps9372/tsd_products_support_series_home.html
Copyright (c) 2002-2016, Cisco Systems, Inc. All rights reserved.
The copyrights to certain works contained herein are owned by
other third parties and are used and distributed under license.
Some parts of this software are covered under the GNU Public
License. A copy of the license is available at
http://www.gnu.org/licenses/gpl.html.

NX-OSv9K is a demo version of the Nexus Operating System

Software
  BIOS: version 
  NXOS: version 7.0(3)I2(2d)
  BIOS compile time:  
  NXOS image file is: bootflash:///nxos.7.0.3.I2.2d.bin
  NXOS compile time:  4/24/2016 13:00:00 [04/24/2016 20:28:19]

Hardware
  cisco NX-OSv Chassis 
   with 16411184 kB of memory.
  Processor Board ID 9NXKBL0B5KH

  Device name: switch
  bootflash:    3509454 kB
Kernel uptime is 0 day(s), 2 hour(s), 35 minute(s), 44 second(s)

Last reset 
  Reason: Unknown
  System version: 
  Service: 

plugin
  Core Plugin, Ethernet Plugin

Active Package(s):

Steps to Reproduce the Issue

>>> from napalm import get_network_driver
>>> driver = get_network_driver('nxos')
>>> d = driver('172.20.157.6', 'admin', 'admin')
>>> d.open()
>>> d.get_facts()
{'uptime': 7842, u'vendor': u'Cisco', u'hostname': 'switch', 'fqdn': 'switch', u'os_version': '7.0(3)I2(2d)', u'serial_number': '9NXKBL0B5KH', u'model': 'NX-OSv Chassis', u'interface_list': ['mgmt0', 'Ethernet1/1', 'Ethernet1/2', 'Ethernet1/3', 'Ethernet1/4', 'Ethernet1/5', 'Ethernet1/6', 'Ethernet1/7', 'Ethernet1/8', 'Ethernet1/9', 'Vlan1']}
>>> d.get_interfaces_ip()
{}
>>>

On nx-os, we could use show ip interfaces vrf all to get interfaces from all VRFs. This issue is to change the command used so we get IPs from all interfaces in all VRFs.

switch(config)# show ip interface 
IP Interface Status for VRF "default"
switch(config)# show ip interface vrf all
IP Interface Status for VRF "default"

IP Interface Status for VRF "management"
mgmt0, Interface status: protocol-up/link-up/admin-up, iod: 3,
  IP address: 172.20.157.6, IP subnet: 172.20.157.0/24
  IP broadcast address: 255.255.255.255
  IP multicast groups locally joined: none
  IP MTU: 1500 bytes (using link MTU)
  IP primary address route-preference: 0, tag: 0
  IP proxy ARP : disabled
  IP Local Proxy ARP : disabled
  IP multicast routing: disabled
  IP icmp redirects: enabled
  IP directed-broadcast: disabled 
  IP Forwarding: disabled 
  IP icmp unreachables (except port): disabled
  IP icmp port-unreachable: enabled
  IP unicast reverse path forwarding: none
  IP load sharing: none 
  IP interface statistics last reset: never
  IP interface software stats: (sent/received/forwarded/originated/consumed)
    Unicast packets    : 668/780/1/667/1554
    Unicast bytes      : 149537/66658/346/149191/131342
    Multicast packets  : 0/0/0/0/0
    Multicast bytes    : 0/0/0/0/0
    Broadcast packets  : 0/0/0/0/0
    Broadcast bytes    : 0/0/0/0/0
    Labeled packets    : 0/0/0/0/0
    Labeled bytes      : 0/0/0/0/0
  WCCP Redirect outbound: disabled
  WCCP Redirect inbound: disabled
  WCCP Redirect exclude: disabled

Error Traceback

(Paste the complete traceback of the exception between quotes below)

N/A

Trace captured

Please, reproduce the issue with the cli tool in debug mode and paste the entire execution.

https://napalm.readthedocs.io/en/latest/cli.html
ktbyers commented 6 years ago

@Ragsboss I don't think get_interfaces_ip supports VRFs at this time (only the 'global'/'default' VRF). IIRC this is the behavior across all drivers.

This is a feature/enhancement request.

melphick commented 5 years ago

@ktbyers do you know if support for collecting data from all VRFs for the get_interfaces_ip function was added? I think the behaviour for the IOS driver is to collect the data for all VRFs.

ktbyers commented 5 years ago

@melphick There is this PR that pertains to this issue:

https://github.com/napalm-automation/napalm/pull/877

Though it looks like it needs rebased.

There is probably some driver inconsistency on this behavior that still needs worked through/resolved.

melphick commented 5 years ago

@ktbyers Thanks for the info. It looks like the change is approved. I'm not very familiar with this process. Do you know when this might be released?

ktbyers commented 5 years ago

@melphick Okay, I just dismissed that review. That PR and the PR it updates probably need completely re-created from scratch or a big rebasing. It will probably be easier to re-create it from scratch.

I don't see it being released any time soon. If you want to work on that issue, let me know.

Regards, Kirk

melphick commented 5 years ago

@ktbyers I would love to help to get this fixed. Is there any specific process I should follow?

ktbyers commented 5 years ago

@melphick That is hard...I would have to dig into and review what is required to fix it. I don't think I am going to get to this during this week.