Skip to content

Commit

Permalink
Fixes for CAM and ARP parsing issues in nxos_ssh.py (#634)
Browse files Browse the repository at this point in the history
* Fixes #441, Fixes #633 show arp and mac address table processing.
  • Loading branch information
rbcollins123 authored and ktbyers committed Jan 31, 2018
1 parent cb5fbd8 commit 68c1861
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions napalm/nxos_ssh/nxos_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,8 +1054,8 @@ def get_arp_table(self):

arp_entries = arp_list[1].strip()
for line in arp_entries.splitlines():
if len(line.split()) == 4:
address, age, mac, interface = line.split()
if len(line.split()) >= 4:
address, age, mac, interface = line.split()[:4]
else:
raise ValueError("Unexpected output from: {}".format(line.split()))

Expand Down Expand Up @@ -1282,6 +1282,7 @@ def process_mac_fields(vlan, mac, mac_type, interface):
output = re.sub(r"^\(R\)", "", output, flags=re.M)
output = re.sub(r"^\(T\)", "", output, flags=re.M)
output = re.sub(r"^\(F\)", "", output, flags=re.M)
output = re.sub(r"vPC Peer-Link", "vPC-Peer-Link", output, flags=re.M)

for line in output.splitlines():

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ IP ARP Table for context default
Total number of entries: 2
Address Age MAC Address Interface
10.0.0.2 00:00:04 2cc2.60ff.0021 mgmt0
10.0.0.72 00:02:20 2cc2.6036.3221 mgmt0
10.0.0.72 00:02:20 2cc2.6036.3221 mgmt0 *
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
{
"vlan": 17,
"last_move": -1,
"interface": "po2",
"interface": "vPC-Peer-Link",
"mac": "00:26:98:0A:DF:44",
"static": false,
"active": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ age - seconds since last seen,+ - primary entry using vPC Peer-Link,
* 16 0050.56bb.2577 dynamic - F F po2
* 16 0050.56bb.cccf dynamic - F F po2
* 33 0050.56bb.cccf dynamic - F F po2
* 17 0026.980a.df44 dynamic - F F po2
* 17 0026.980a.df44 dynamic - F F vPC Peer-Link
* 17 0050.56bb.ba9a dynamic - F F po2
* 40 0050.56bb.f532 dynamic - F F po2
* 13 90e2.ba5a.9f30 dynamic - F F eth1/2
Expand Down

0 comments on commit 68c1861

Please sign in to comment.