napalm-automation / napalm-ios

Apache License 2.0
31 stars 40 forks source link

ValueError: Failure processing show lldp neighbors detail #126

Closed kaage closed 7 years ago

kaage commented 7 years ago

Description of Issue/Question

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

Setup

Connecting to Cisco IOSv L2-switches and gathering LLDP neighbors detail.

napalm-ios version

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

jaakko@ubuntu:~/Desktop/Ansible-shared/ansible-playbooks$ pip freeze | grep napalm-io
napalm-ios==0.6.1

IOS version

(Paste verbatim output from show version between quotes below)

SW1#show version 
Cisco IOS Software, vios_l2 Software (vios_l2-ADVENTERPRISEK9-M), Version 15.2(4.0.55)E, TEST ENGINEERING ESTG_WEEKLY BUILD, synced to  END_OF_FLO_ISP
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2015 by Cisco Systems, Inc.
Compiled Tue 28-Jul-15 18:52 by sasyamal

ROM: Bootstrap program is IOSv

SW1 uptime is 16 minutes
System returned to ROM by reload
System image file is "flash0:/vios_l2-adventerprisek9-m"
Last reload reason: Unknown reason

This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

Cisco IOSv () processor (revision 1.0) with 574721K/209920K bytes of memory.
Processor board ID 9O7KR3I0XGY
1 Virtual Ethernet interface
16 Gigabit Ethernet interfaces
DRAM configuration is 72 bits wide with parity disabled.
256K bytes of non-volatile configuration memory.
2097144K bytes of ATA System CompactFlash 0 (Read/Write)
0K bytes of ATA CompactFlash 1 (Read/Write)
0K bytes of ATA CompactFlash 2 (Read/Write)
0K bytes of ATA CompactFlash 3 (Read/Write)

Configuration register is 0x0

Steps to Reproduce the Issue

You need to have some specific neighbor to get it fail. I have similar switch with just this switch as neighbor and it works well. Howerver, when I have another LLDP neighbor (I think it is my Win10 laptop) it fails. Gathering LLDP neighbors without "detail" keyword works well.

Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from netmiko import ConnectHandler
>>> from napalm import get_network_driver
>>> get_network_driver('ios')
<class 'napalm_ios.ios.IOSDriver'>
>>> 
>>> optional_args = {}
>>> optional_args['secret'] = 'cisco'
>>> 
>>> driver = get_network_driver('ios')
>>> device = driver('192.168.61.121', 'cisco', 'cisco', optional_args=optional_args)
>>> device.open()
>>> device.get_lldp_neighbors()
{u'GigabitEthernet1/0': [{u'hostname': u'SW2.cisco.com', u'port': u'Gi2/0'}], u'GigabitEthernet0/0': [{u'hostname': u'0050.56c0.0001', u'port': u'0050.56c0.0001'}]}
>>> device.get_lldp_neighbors_detail()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/napalm_ios/ios.py", line 656, in get_lldp_neighbors_detail
    raise ValueError("Failure processing show lldp neighbors detail")
ValueError: Failure processing show lldp neighbors detail
SW1#show lldp neighbors detail 
------------------------------------------------
Local Intf: Gi1/0
Chassis id: 00ae.3b11.1d00
Port id: Gi2/0
Port Description: GigabitEthernet2/0
System Name: SW2.cisco.com

System Description: 
Cisco IOS Software, vios_l2 Software (vios_l2-ADVENTERPRISEK9-M), Version 15.2(4.0.55)E, TEST ENGINEERING ESTG_WEEKLY BUILD, synced to  END_OF_FLO_ISP
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2015 by Cisco Systems, Inc.
Compi

Time remaining: 108 seconds
System Capabilities: B,R
Enabled Capabilities: R
Management Addresses:
    IP: 192.168.61.122
Auto Negotiation - not supported
Physical media capabilities - not advertised
Media Attachment Unit type - not advertised
Vlan ID: - not advertised

------------------------------------------------
Local Intf: Gi0/0
Chassis id: 0050.56c0.0001
Port id: 0050.56c0.0001
Port Description - not advertised
System Name - not advertised
System Description - not advertised

Time remaining: 3514 seconds
System Capabilities - not advertised
Enabled Capabilities - not advertised
Management Addresses - not advertised
Auto Negotiation - supported, enabled
Physical media capabilities:
    1000baseT(FD)
Media Attachment Unit type - not advertised
Vlan ID: - not advertised

MED Information:

    MED Codes:
          (NP) Network Policy, (LI) Location Identification
          (PS) Power Source Entity, (PD) Power Device
          (IN) Inventory

    Inventory information - not advertised
    Capabilities: 
    Device type: Endpoint Class I
    Network Policies - not advertised
    Power requirements - not advertised
    Location - not advertised

Total entries displayed: 2

Error Traceback

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

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/napalm_ios/ios.py", line 656, in get_lldp_neighbors_detail
    raise ValueError("Failure processing show lldp neighbors detail")
ValueError: Failure processing show lldp neighbors detail
ktbyers commented 7 years ago

@kaage So what does show lldp neighbors show here?

I am particular interested in what it shows for capabilities.

System Capabilities - not advertised
Enabled Capabilities - not advertised
kaage commented 7 years ago

Here it comes:

SW1#show lldp neighbors
Capability codes:
    (R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device
    (W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other

Device ID           Local Intf     Hold-time  Capability      Port ID
SW2.cisco.com       Gi1/0          120        R               Gi2/0
SW2.cisco.com       Gi2/0          120        R               Gi1/0
0050.56c0.0001      Gi0/0          3601                       0050.56c0.0001