Closed writememe closed 4 years ago
Hi NAPALM team, would it be possible to get some assistance on this issue? I'd be happy to help fix it if you lead me to where the problem might be. Thanks
I stumbled across this issue and took a stab at it.
I was able to reproduce the issue if my lab switch didn't have any IP interfaces assigned to the switch. I suspect if you just ran the command get_interfaces_ip
it would throw the same stack trace. After assigning an IP address my lab setup, the script complained about not being able to run show ipv6 interface
. After I commented the IPV6 part out I was able to get the test scripts you posted to work.
I'll create a PR to skip ipv6 if it isn't configured and in the case no IPs are set on the device that get_interfaces_ip
returns nothing instead of a stack trace.
So it looks like the interface not having an IP address was just fixed with https://github.com/napalm-automation/napalm/commit/ed9cbe4841d67d90cbd043303c634719a3fcd902
Hey @tcaiazza , thanks a lot for helping! That fix seems to be with the nxos_ssh
(napalm/nxos_ssh/nxos_ssh.py) driver however my issue is with the nxos
(napalm/nxos/nxos.py) driver.
I commented out the entire get_interfaces_ip ipv6 block (lines 1125 to 1170) and the code now runs:
I'm guessing that the logic needs to be something like:
if ipv6 addresses exist: do ipv6 block else: continue
I'm no expert but hopefully this helps in hunting down the problem?
@writememe Yeah that is still the issue, I have a PR now that once it is merged should fix your issue. https://github.com/napalm-automation/napalm/pull/1108
Thanks! @tcaiazza
develop
branch)?Hi @mirceaulinic, using the python script above works. I'll double check using napalm_ansible tomorrow and let you know (having issues with my lab) and confirm 100%. Thanks again
Hi @mirceaulinic, I've checked this again and it's now working. Thanks to you and @tcaiazza for helping out, much appreciated
Great, thanks for confirming!
Description of Issue/Question
It appears that the
nxos
driver is not working correctly for napalm validation onget_interfaces_ip
, however when using thenxos_ssh
driver with the same validation file, it works correctly.Did you follow the steps from https://github.com/napalm-automation/napalm#faq
(Place an
x
between the square brackets where applicable)Setup
napalm version
(Paste verbatim output from
pip freeze | grep napalm
between quotes below)Network operating system version
(Paste verbatim output from
show version
- or equivalent - between quotes below)Steps to Reproduce the Issue
1) Create a napalm validation file with a
get_interfaces_ip
validation check. For the purposes of this example, it will be called automated-validation.yml2) Create the following Python script to validate the network device. For the purposes of this example, I will refer to this as
nxos_ssh_validate.py
. NOTE: The network driver for this script isnxos_ssh
:3) Run the script
nxos_ssh_validate.py
. This should be successful4) Use the following Python script to validate the device. For the purposes of this example, I will refer to this as
nxos_validate.py
. NOTE: The network driver for this script isnxos
and is identical except for the driver:5) Run the script
nxos_validate.py
.This will not be successful.
6) Next, create another validation file, which uses other getters such as
get_facts
,get_interfaces
,get_bgp_neighbors
andget_lldp_neighbors_detail
. For the purposes of this example, I will call it alternate-validation.yml7) Change both the
nxos_validate.py
andnxos_ssh_validate.py
scripts by modifying the last line: Find the line:Replace with
8) Run both the
nxos_validate.py
andnxos_ssh_validate.py
scripts. These will both be successful._CONCLUSION: It seems to be an issue with the
nxos
driver and theget_interfaces_ip
validation._I've initially came across this attempting to use
napalm_validate
in Ansible and have subsequently had more time investigate it further. I'm not sure whether I should close the napalm-ansible issue I raised, but please let me know and I can cancel it.Thanks, Daniel
Error Traceback
(Paste the complete traceback of the exception between quotes below)