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

Closes #2003: Fix NXOS ping source_interface bugs #2004

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
14 changes: 9 additions & 5 deletions napalm/nxos/nxos.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,14 +369,18 @@ def ping(
if source != "":
command += " source {}".format(source)
elif source_interface != "":
command += " source {}".format(source_interface)

if vrf != "":
command += " vrf {}".format(vrf)
command += " source-interface {}".format(source_interface)

# source_interface and vrf are mutually exclusive, but since they
# provide the same behavior, no need to raise an exception--just
# prefer source_interface.
if not source_interface:
if vrf != "":
command += " vrf {}".format(vrf)
output = self._send_command(command, raw_text=True)
assert isinstance(output, str)

if "connect:" in output:
if "connect:" in output.lower() or "invalid" in output.lower():
ping_dict["error"] = output
elif "PING" in output:
ping_dict["success"] = {
Expand Down
Loading