diff --git a/napalm_eos/eos.py b/napalm_eos/eos.py index c726900..e4dfe7f 100644 --- a/napalm_eos/eos.py +++ b/napalm_eos/eos.py @@ -1696,3 +1696,25 @@ def ping(self, destination, source=c.PING_SOURCE, ttl=c.PING_TTL, timeout=c.PING }) ping_dict['success'].update({'results': results_array}) return ping_dict + + def get_ipv6_neighbors(self): + + result = {} + command = ['show ipv6 neighbors'] + + output = self.device.run_commands(command)[0] + if not output['ipV6Neighbors']: + return output['ipV6Neighbors'] + + for neighbor in output['ipV6Neighbors']: + if neighbor['address'] not in result: + result[neighbor['address']] = {} + result[neighbor['address']]['neighbor_mac'] = neighbor['hwAddress'] + result[neighbor['address']]['neighbor_state'] = neighbor['state'] + result[neighbor['address']]['intf_connected'] = [] + result[neighbor['address']]['intf_connected'].append(neighbor['interface']) + + else: + result[neighbor['address']]['intf_connected'].append(neighbor['interface']) + + return result diff --git a/test/unit/mocked_data/test_get_ipv6_neighbors/expected_result.json b/test/unit/mocked_data/test_get_ipv6_neighbors/expected_result.json new file mode 100644 index 0000000..ddd760b --- /dev/null +++ b/test/unit/mocked_data/test_get_ipv6_neighbors/expected_result.json @@ -0,0 +1,8 @@ +{ + "fe80::a00:27ff:fe6a:1829": + { + "intf_connected": ["Et1", "Et2"], + "neighbor_mac": "0800.276a.1829", + "neighbor_state": "REACH" + } +} diff --git a/test/unit/mocked_data/test_get_ipv6_neighbors/show_ipv6_neighbors.json b/test/unit/mocked_data/test_get_ipv6_neighbors/show_ipv6_neighbors.json new file mode 100644 index 0000000..5657af9 --- /dev/null +++ b/test/unit/mocked_data/test_get_ipv6_neighbors/show_ipv6_neighbors.json @@ -0,0 +1,20 @@ +{ + "ipV6Neighbors": [ + { + "hwAddress": "0800.276a.1829", + "state": "REACH", + "address": "fe80::a00:27ff:fe6a:1829", + "interface": "Et1" + }, + { + "hwAddress": "0800.276a.1829", + "state": "REACH", + "address": "fe80::a00:27ff:fe6a:1829", + "interface": "Et2" + } + ], + "dynamicEntries": 2, + "notLearnedEntries": 0, + "totalEntries": 2, + "staticEntries": 0 +}