napalm-automation / napalm

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

Ping does not work on NXOS when specifying source_interface #2003

Open decoupca opened 1 year ago

decoupca commented 1 year ago

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)

Setup

napalm version

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

napalm==4.1.0

Network operating system version

(Paste verbatim output from show version - or equivalent - between quotes below)

Cisco Nexus Operating System (NX-OS) Software
TAC support: http://www.cisco.com/tac
Copyright (C) 2002-2023, Cisco and/or its affiliates.
All rights reserved.
The copyrights to certain works contained in this software are
owned by other third parties and used and distributed under their own
licenses, such as open source.  This software is provided "as is," and unless
otherwise stated, there is no warranty, express or implied, including but not
limited to warranties of merchantability and fitness for a particular purpose.
Certain components of this software are licensed under
the GNU General Public License (GPL) version 2.0 or
GNU General Public License (GPL) version 3.0  or the GNU
Lesser General Public License (LGPL) Version 2.1 or
Lesser General Public License (LGPL) Version 2.0.
A copy of each such license is available at
http://www.opensource.org/licenses/gpl-2.0.php and
http://opensource.org/licenses/gpl-3.0.html and
http://www.opensource.org/licenses/lgpl-2.1.php and
http://www.gnu.org/licenses/old-licenses/library.txt.

Software
  BIOS: version 05.47
  NXOS: version 10.2(5) [Maintenance Release]
  BIOS compile time:  04/28/2022
  NXOS image file is: bootflash:///nxos64-cs.10.2.5.M.bin
  NXOS compile time:  3/10/2023 12:00:00 [03/03/2023 12:00:11]

Hardware
  cisco Nexus9000 C93108TC-FX Chassis
  Intel(R) Xeon(R) CPU D-1526 @ 1.80GHz with 24556024 kB of memory.
  Processor Board ID FDO23220C7L
  Device name: SAPC00SS12
  bootflash:  115805356 kB

Kernel uptime is 81 day(s), 23 hour(s), 37 minute(s), 15 second(s)

Last reset at 148650 usecs after Fri Jun 16 14:57:41 2023
  Reason: Power Down/UP epld upgrade process
  System version: 10.2(5)
  Service: Power Down/UP epld upgrade process

plugin
  Core Plugin, Ethernet Plugin

Active Package(s):

Steps to Reproduce the Issue

Assume destination is reachable and source_interface exists on the device:

device.ping(destination='10.2.3.4', source_interface='mgmt0')

Error Traceback

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

The command succeeds but returns an empty data structure ({}).

Debugging shows that the fired command is: ping 10.2.3.4 timeout 2 packet-size 100 count 5 source mgmt0

NXOS returns the following error, which is not caught by napalm:

% Invalid host/interface mgmt0

However, changing source to source-interface works:

nxos-test# ping 10.2.3.4 timeout 2 packet-size 100 count 5 source-interface mgmt0
PING 10.8.148.34 (10.8.148.34): 100 data bytes
108 bytes from 10.2.3.4: icmp_seq=0 ttl=54 time=257.729 ms
108 bytes from 10.2.3.4: icmp_seq=1 ttl=54 time=257.811 ms
108 bytes from 10.2.3.4: icmp_seq=2 ttl=54 time=257.871 ms
108 bytes from 10.2.3.4: icmp_seq=3 ttl=54 time=257.82 ms
108 bytes from 10.2.3.4: icmp_seq=4 ttl=54 time=257.917 ms

--- 10.2.3.4 ping statistics ---
5 packets transmitted, 5 packets received, 0.00% packet loss
round-trip min/avg/max = 257.729/257.829/257.917 ms
decoupca commented 1 year ago

Also, if an invalid interface is specified as source_interface, the command will fail similarly and return an empty data structure. The result from the device is: % Invalid host/interface mgmt1