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

The get_interfaces() speed crash with no IP address #672

Closed
FloLaco opened this issue Mar 11, 2018 · 2 comments
Closed

The get_interfaces() speed crash with no IP address #672

FloLaco opened this issue Mar 11, 2018 · 2 comments

Comments

@FloLaco
Copy link
Contributor

FloLaco commented Mar 11, 2018

The get_interfaces() function crash when a SVI does not have IP address.

Problem seen on Nexus N9K-C93180LC-EX
Driver : NXOS_SSH
Traceback :

Traceback (most recent call last):
  File "script_switch.py", line 308, in <module>
    main(sys.argv[1:])
  File "script_switch.py", line 303, in main
    test_migration(ip, login, pwd, driver, fex)
  File "script_switch.py", line 206, in test_migration
    new_intf_table = device.get_interfaces()
  File "/home/florian_lacommare/GitHub/napalm/napalm/nxos_ssh/nxos_ssh.py", line 862, in get_interfaces
    interfaces.update(parse_intf_section(entry))
  File "/home/florian_lacommare/GitHub/napalm/napalm/nxos_ssh/nxos_ssh.py", line 149, in parse_intf_section
    speed = int(match.group('speed'))
AttributeError: 'NoneType' object has no attribute 'group'

The interface that trigger the crash :

Vlan600 is up, line protocol is up, autostate enabled
  Hardware is EtherSVI, address is  6cb2.aeb5.9f59
  Description: *** L3VNI-PROD ***  MTU 9216 bytes, BW 1000000 Kbit, DLY 10 usec,
   reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive not supported
  ARP type: ARPA
  Last clearing of "show interface" counters never
  L3 in Switched:
    ucast: 0 pkts, 0 bytes

As we see, the description part is on the same line as MTU/SPEED
And here is the regex for the speed : re_speed = r"^\s+MTU .*, BW (?P<speed>\S+) (?P<speed_unit>\S+), "

We just need to remove the regex "beginning of new line".
I'll provide a PR for that because there is some other issue with VXLAN

FloLaco pushed a commit to FloLaco/napalm that referenced this issue Mar 12, 2018
@dbarrosop
Copy link
Member

Great, thanks for the report. Waiting for the PR :D

@FloLaco
Copy link
Contributor Author

FloLaco commented Mar 14, 2018

I'm going to be crazy with the cisco scrapping data ...
New N9K is different to N3K, N7K etc ... I've fixed the issue, I just need to continue my development for adding support to vxlan with N9K before creating the PR

@mirceaulinic mirceaulinic added this to the APPROVED milestone Mar 15, 2018
ktbyers added a commit that referenced this issue Apr 12, 2018
* Remove multiple entries for netmiko (#617)

* Fixes NX-OS string change in show diff rollback-patch output (#619)

* Require to upgrade setuptools

* Modify NX-OS to properly save config to startup-config on commit_config (#624)

* Fixing NX-OS rollback issue (#626)

* Junos fix next-hop self in get_bgp_config() (#620)

* junos fix nhs in get_bgp_config()

* junos add test case for nhs in get_bgp_config()

* junos fix missing policy in existing test case for nhs

* junos fix E712 comparison

* fix typo

* junos remove nhs key in group level in get_bgp_config()

* junos rework nhs in get_bgp_config() by fetching all policies in one go

* junos fix test case for nhs get_bgp_config()

* junos clean code and add comments in nhs get_bgp_config()

* junos nhs remove inactive term in mocked data

* IOS-XR: return the is_alive flag for the SSH channel (#623)

* Fixes for CAM and ARP parsing issues in nxos_ssh.py (#634)

* Fixes #441, Fixes #633 show arp and mac address table processing.

* Minor improvement to get_arp processing on NXOS SSH (#639)

* Minor improvement to get_arp processing on NXOS SSH

* don't hide relevant import errors (#635)

* don't hide relevant import errors

* original name

* py2 compliance

* now back to py3 compatibility....

* Update index.rst (#650)

* improved exceptions - added new base exception (#649)

* improved exceptions - added new base exception

* fixed pep8 issue

* another pep8 issue fixed

* fixes #640 junos ConnectionException (#648)

* FIXES #653 additional error message on failed replace (#654)

* NX-OS ping implementation using more shared common code (#642)

* fix get_mac_table on IOS when there are routed ports

* [646] updating junos.py to support PTX platform (#665)

* Minor doc changes for NX-OS and IOS (#669)

* Unify netmiko argument processing across napalm drivers (#673)

* Start sharing common Netmiko code

* Adding unit tests for new netmiko argument parsing

* Adding NXOS to use netmiko argument processing

* IOS-XR and netmiko args processing

* Make nxos_facts behavior more consistent between NX-API and SSH (#674)

* fix issue #477: the output is now consistent between NXOS and NXOS_SSH driver

* #477 fix crash for some N9K 93180YC-EX, 93180LC-EX, etc

* Updates to NX-OS SSH get_facts

* Adding better test case for NX-API

* Update get_interfaces_ip to deal with unnumbered interfaces (#632)

* Update get_interfaces_ip to deal with unnumbered interfaces

* Extend tests for show_ip_interface

* Fix issue about N9K with vxlan (#676)

* Adding VXLAN support: EVPN and control plane flags on mac address + new interface name

* Fix #672: get_interfaces() crash with nve interfaces or no IP address

* fix missing mgmt0 interface in the get_fact on N9K device

* fix wrong description SVI on N9K device

* fix some pep error and an EOL issue for a test case

* Fix setup.py issue when using pip 10. (#692)

* Add virtualbox provider to the docs (#679)

* Apply correct format to code block

* Add virtualbox provider flag to vagrant

* Lldp neighbors detail bugfix (#675)

* Cosmetic cleanup in line with PEP8, whitespace and indentation fixes

* Address inconsistency in junos xml rpc calls for lldp interface information.

* Add two more cases where the RPC call for lldp neighbors interface detail is different to that documented

* Add StackStorm integrations to README (#683)

* Track BGP state to report is_up (#684)

* NAPALM release 2.3.1 (#696)

* Rolling version to 2.3.1

* Fixing linter issues introduced by new version of pylama
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