Skip to content

Commit

Permalink
Merge pull request napalm-automation#496 from afourmy/IOS_ipv6_neighb…
Browse files Browse the repository at this point in the history
…ors_table

IOS ipv6 neighbors table
  • Loading branch information
ktbyers authored Nov 10, 2017
2 parents 77fc280 + f4995ee commit 6c05218
Show file tree
Hide file tree
Showing 8 changed files with 495 additions and 1 deletion.
1 change: 0 additions & 1 deletion napalm/base/test/getters.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ def test_get_arp_table(self, test_case):
def test_get_ipv6_neighbors_table(self, test_case):
"""Test get_ipv6_neighbors_table."""
get_ipv6_neighbors_table = self.device.get_ipv6_neighbors_table()
assert len(get_ipv6_neighbors_table) > 0

for entry in get_ipv6_neighbors_table:
assert helpers.test_model(models.ipv6_neighbor, entry)
Expand Down
46 changes: 46 additions & 0 deletions napalm/ios/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -2173,6 +2173,52 @@ def get_config(self, retrieve='all'):

return configs

def get_ipv6_neighbors_table(self):
"""
Get IPv6 neighbors table information.
Return a list of dictionaries having the following set of keys:
* interface (string)
* mac (string)
* ip (string)
* age (float) in seconds
* state (string)
For example::
[
{
'interface' : 'MgmtEth0/RSP0/CPU0/0',
'mac' : '5c:5e:ab:da:3c:f0',
'ip' : '2001:db8:1:1::1',
'age' : 1454496274.84,
'state' : 'REACH'
},
{
'interface': 'MgmtEth0/RSP0/CPU0/0',
'mac' : '66:0e:94:96:e0:ff',
'ip' : '2001:db8:1:1::2',
'age' : 1435641582.49,
'state' : 'STALE'
}
]
"""

ipv6_neighbors_table = []
command = 'show ipv6 neighbors'
output = self._send_command(command)

for entry in output.split('\n')[1:]:
# typical format of an entry in the IOS IPv6 neighbors table:
# 2002:FFFF:233::1 0 2894.0fed.be30 REACH Fa3/1/2.233
ip, age, mac, state, interface = entry.split()
mac = '' if mac == '-' else napalm.base.helpers.mac(mac)
ipv6_neighbors_table.append({
'interface': interface,
'mac': mac,
'ip': ip,
'age': float(age),
'state': state
})
return ipv6_neighbors_table

@property
def dest_file_system(self):
# The self.device check ensures napalm has an open connection
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[

]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Load for five secs: 14%/1%; one minute: 11%; five minutes: 11%
Time source is NTP, 07:49:02.551 DST Tue Nov 7 2017
Loading

0 comments on commit 6c05218

Please sign in to comment.