Add get_arp_table method
This commit is contained in:
1 parent
7cb0723b07
commit
7888ad9e0b
3 files changed
+68
No files matched your search
@@ -20,6 +20,7 @@ from napalm_base.exceptions import ReplaceConfigException, MergeConfigException
|
||||
from napalm_base.utils.string_parsers import colon_separated_string_to_dict,\
|
||||
convert_uptime_string_seconds
|
||||
from napalm_base.utils import py23_compat
|
||||
import napalm_base.helpers
|
||||
|
||||
try:
|
||||
from napalm.base.base import NetworkDriver
|
||||
@@ -512,3 +513,24 @@ class FortiOSDriver(NetworkDriver):
|
||||
out['power'] = {t: {'status': True, 'capacity': -1.0, 'output': -1.0} for t in psus}
|
||||
|
||||
return out
|
||||
|
||||
def get_arp_table(self):
|
||||
|
||||
arp_table = []
|
||||
command = "get sys arp"
|
||||
output = self._execute_command_with_vdom(command)
|
||||
|
||||
# Skip the first line which is a header
|
||||
output = output[1:]
|
||||
|
||||
for line in output:
|
||||
if len(line) > 0:
|
||||
address, age, mac, interface = line.split()
|
||||
entry = {
|
||||
"interface": interface,
|
||||
"mac": napalm_base.helpers.mac(mac).rstrip(),
|
||||
"ip": address,
|
||||
"age": age.replace("-", "-1"),
|
||||
}
|
||||
arp_table.append(entry)
|
||||
return arp_table
|
||||
@@ -0,0 +1,38 @@
|
||||
[
|
||||
{
|
||||
"interface": "vlan99",
|
||||
"ip": "192.168.199.43",
|
||||
"mac": "EC:F4:BB:D6:4B:C8",
|
||||
"age": 0
|
||||
},
|
||||
{
|
||||
"interface": "vlan99",
|
||||
"ip": "192.168.199.90",
|
||||
"mac": "00:50:56:88:95:25",
|
||||
"age": 0
|
||||
},
|
||||
{
|
||||
"interface": "vlan99",
|
||||
"ip": "192.168.199.75",
|
||||
"mac": "00:0C:29:F0:B6:54",
|
||||
"age": 0
|
||||
},
|
||||
{
|
||||
"interface": "vlan99",
|
||||
"ip": "192.168.199.44",
|
||||
"mac": "00:10:18:E6:8F:A7",
|
||||
"age": 0
|
||||
},
|
||||
{
|
||||
"interface": "port4",
|
||||
"ip": "169.254.0.1",
|
||||
"mac": "00:50:56:88:B9:98",
|
||||
"age": -1
|
||||
},
|
||||
{
|
||||
"interface": "vlan99",
|
||||
"ip": "192.168.199.60",
|
||||
"mac": "00:50:CC:7E:26:40",
|
||||
"age": 0
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
Address Age(min) Hardware Addr Interface
|
||||
192.168.199.43 0 ec:f4:bb:d6:4b:c8 vlan99
|
||||
192.168.199.90 0 00:50:56:88:95:25 vlan99
|
||||
192.168.199.75 0 00:0c:29:f0:b6:54 vlan99
|
||||
192.168.199.44 0 00:10:18:e6:8f:a7 vlan99
|
||||
169.254.0.1 - 00:50:56:88:b9:98 port4
|
||||
192.168.199.60 0 00:50:cc:7e:26:40 vlan99
|
||||
|
||||
Reference in new issue
Block a user