Skip to content

Commit

Permalink
napalm.nxos.traceroute - VRF traces and handle AS in hops (napalm-aut…
Browse files Browse the repository at this point in the history
…omation#989)

* Adding traceroute from a specific VRF

* Combination of source and vrf command

* On some devices running BGP, an AS number will appear after the IP address of the hop

* E261 at least two spaces before inline comment [pep8]
  • Loading branch information
donckers authored and bravindranath-bsn committed Apr 19, 2020
1 parent 527b3b3 commit c75b878
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion napalm/nxos/nxos.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ def traceroute(
r"(", # beginning of host_name (ip_address) group only
r"([a-zA-Z0-9\.:-]*)", # hostname
r"\s+",
r"\(?([a-fA-F0-9\.:][^\)]*)\)?" # IP Address between brackets
r"\(?([a-fA-F0-9\.:][^\)]*)\)?", # IP Address between brackets
r"(?:\s+\(AS\s+[0-9]+\))?", # AS number -- may or may not be present
r")?", # end of host_name (ip_address) group only
# also hostname/ip are optional -- they can or cannot be specified
# if not specified, means the current probe followed the same path as the previous
Expand Down Expand Up @@ -432,6 +433,9 @@ def traceroute(
version=version, destination=destination
)

if vrf != "":
command += " vrf {vrf}".format(vrf=vrf)

try:
traceroute_raw_output = self._send_command(command, raw_text=True)
except CommandErrorException:
Expand Down

0 comments on commit c75b878

Please sign in to comment.