Repository: napalm-automation/napalm

Issue:
nxos_ssh.py parsing for arp table dies if flags present in command output
This line forces the arp table to only have at most 4 columns in output:
https://github.com/napalm-automation/napalm/blob/cb5fbd8de58c7f3971deacfd287c62e124155588/napalm/nxos_ssh/nxos_ssh.py#L1057

But there's a valid 5th column for flags that could be ignored, but shouldn't void parsing the result:
```
# sh ip arp

Flags: * - Adjacencies learnt on non-active FHRP router
       + - Adjacencies synced via CFSoE
       # - Adjacencies Throttled for Glean
       D - Static Adjacencies attached to down interface

IP ARP Table for context default
Total number of entries: 2302
Address         Age       MAC Address     Interface
172.20.10.82    00:02:03  f4cf.e2e0.cf41  Ethernet3/36
172.16.252.10   00:05:44  002c.c87d.743f  Ethernet1/5
172.16.253.2    00:02:54  2c5a.0ff0.457f  Ethernet1/7
172.20.110.6    00:09:11  002c.c87d.757f  Ethernet1/9
172.16.200.46   00:00:08  70df.2f07.20e4  Ethernet1/11
192.32.10.1     00:07:23  0000.0c07.ac0a  Vlan10
192.32.10.3     00:15:35  4055.3922.ccc1  Vlan10
192.6.125.22    00:11:32  00e0.8602.a5e9  Vlan125
192.6.125.23    00:09:39  00e0.8602.c3d0  Vlan125
192.6.125.25    00:06:01  001b.d502.a744  Vlan125
192.6.125.32    00:04:50  0050.569a.79dd  Vlan125          *
192.6.125.36    00:00:26  0024.81e1.e512  Vlan125          *
192.6.125.37    00:00:03  0025.b323.f35e  Vlan125          *
192.6.125.44    00:06:31  0050.56b2.003f  Vlan125
```

a simple `elif` to catch the case with 5 columns and parse the 5th column into _ or some unused var would suffice?


Discussion:

Resolving patch:
diff --git a/napalm/nxos_ssh/nxos_ssh.py b/napalm/nxos_ssh/nxos_ssh.py
--- a/napalm/nxos_ssh/nxos_ssh.py
+++ b/napalm/nxos_ssh/nxos_ssh.py
@@ -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()))
 
@@ -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():
 


Test patch:
diff --git a/test/nxos_ssh/mocked_data/test_get_arp_table/normal/show_ip_arp_vrf_default___exc_INCOMPLETE.txt b/test/nxos_ssh/mocked_data/test_get_arp_table/normal/show_ip_arp_vrf_default___exc_INCOMPLETE.txt
--- a/test/nxos_ssh/mocked_data/test_get_arp_table/normal/show_ip_arp_vrf_default___exc_INCOMPLETE.txt
+++ b/test/nxos_ssh/mocked_data/test_get_arp_table/normal/show_ip_arp_vrf_default___exc_INCOMPLETE.txt
@@ -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          *
diff --git a/test/nxos_ssh/mocked_data/test_get_mac_address_table/normal/expected_result.json b/test/nxos_ssh/mocked_data/test_get_mac_address_table/normal/expected_result.json
--- a/test/nxos_ssh/mocked_data/test_get_mac_address_table/normal/expected_result.json
+++ b/test/nxos_ssh/mocked_data/test_get_mac_address_table/normal/expected_result.json
@@ -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,
diff --git a/test/nxos_ssh/mocked_data/test_get_mac_address_table/normal/show_mac_address_table.txt b/test/nxos_ssh/mocked_data/test_get_mac_address_table/normal/show_mac_address_table.txt
--- a/test/nxos_ssh/mocked_data/test_get_mac_address_table/normal/show_mac_address_table.txt
+++ b/test/nxos_ssh/mocked_data/test_get_mac_address_table/normal/show_mac_address_table.txt
@@ -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