implement get_arp_table()

This commit is contained in:
Jasper Lievisse Adriaanse committed 2018-04-14 10:23:51 +02:00
1 parent 8587b8cb79
commit f81b99dc3c
1 file changed
+30
+30
View File
@@ -37,6 +37,7 @@ from napalm.base.exceptions import (
)
from napalm.base.utils import py23_compat
import napalm.base.helpers
class S350Driver(NetworkDriver):
@@ -135,6 +136,35 @@ class S350Driver(NetworkDriver):
return uptime_sec
def get_arp_table(self):
"""
Get the ARP table, the age isn't readily available so we leave that out for now.
"""
arp_table = []
output = self._send_command('show arp | include (static|dynamic)')
for line in output.splitlines():
# A VLAN may not be set for the entry
if len(line.split()) == 4:
interface, ip, mac, _ = line.split()
elif len(line.split()) == 5:
_, interface, mac, _ = line.split()
else:
raise ValueError('Unexpected output: {}'.format(line.split()))
entry = {
'interface': interface,
'mac': napalm.base.helpers.mac(mac),
'ip': ip,
'age': 0,
}
arp_table.append(entry)
return arp_table
def get_config(self, retrieve='all'):
"""
get_config for S350. Since this firmware doesn't support a candidate