Skip to content

Commit

Permalink
Merge cd2fbd5 into bd9ea11
Browse files Browse the repository at this point in the history
  • Loading branch information
bewing committed Jan 23, 2019
2 parents bd9ea11 + cd2fbd5 commit 9f95854
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 31 deletions.
5 changes: 4 additions & 1 deletion docs/conf.py
Expand Up @@ -299,7 +299,10 @@

EXCLUDE_IN_REPORT = "test_method_signatures"

METHOD_ALIASES = {"get_config_filtered": "get_config"}
METHOD_ALIASES = {
"get_config_filtered": "get_config",
"get_arp_table_with_vrf": "get_arp_table",
}


def _merge_results(last, intermediate):
Expand Down
12 changes: 12 additions & 0 deletions napalm/base/test/base.py
Expand Up @@ -364,6 +364,18 @@ def test_get_arp_table(self):

self.assertTrue(result)

def test_get_arp_table_with_vrf(self):
try:
get_arp_table = self.device.get_arp_table(vrf="TEST")
except NotImplementedError:
raise SkipTest()
result = len(get_arp_table) > 0

for arp_entry in get_arp_table:
result = result and self._test_model(models.arp_table, arp_entry)

self.assertTrue(result)

def test_get_ntp_peers(self):
try:
get_ntp_peers = self.device.get_ntp_peers()
Expand Down
11 changes: 11 additions & 0 deletions napalm/base/test/getters.py
Expand Up @@ -289,6 +289,17 @@ def test_get_arp_table(self, test_case):

return get_arp_table

@wrap_test_cases
def test_get_arp_table_with_vrf(self, test_case):
"""Test get_arp_table."""
get_arp_table = self.device.get_arp_table(vrf="TEST")
assert len(get_arp_table) > 0

for arp_entry in get_arp_table:
assert helpers.test_model(models.arp_table, arp_entry)

return get_arp_table

@wrap_test_cases
def test_get_ipv6_neighbors_table(self, test_case):
"""Test get_ipv6_neighbors_table."""
Expand Down
17 changes: 7 additions & 10 deletions napalm/eos/eos.py
Expand Up @@ -911,19 +911,16 @@ def parse_options(options, default_value=False):
return bgp_config

def get_arp_table(self, vrf=""):
if vrf:
msg = "VRF support has not been added for this getter on this platform."
raise NotImplementedError(msg)

arp_table = []

commands = ["show arp"]

ipv4_neighbors = []
try:
ipv4_neighbors = self.device.run_commands(commands)[0].get(
"ipV4Neighbors", []
)
commands = ["show arp vrf all"]
ipv4_neighbors = [
neighbor
for k, v in self.device.run_commands(commands)[0].get("vrfs").items()
if not vrf or k == vrf
for neighbor in v.get("ipV4Neighbors", [])
]
except pyeapi.eapilib.CommandError:
return []

Expand Down
20 changes: 0 additions & 20 deletions test/eos/mocked_data/test_get_arp_table/normal/show_arp.json

This file was deleted.

@@ -0,0 +1,24 @@
{
"vrfs": {
"default": {
"dynamicEntries": 699,
"ipV4Neighbors": [
{
"hwAddress": "dc38.e111.97cf",
"address": "172.17.17.1",
"interface": "Ethernet45",
"age": 0
},
{
"hwAddress": "90e2.ba5c.25fd",
"address": "172.17.17.1",
"interface": "Ethernet36",
"age": 0
}
],
"notLearnedEntries": 19,
"totalEntries": 699,
"staticEntries": 0
}
}
}
@@ -0,0 +1 @@
[{"interface": "Ethernet45", "ip": "172.17.17.1", "mac": "DC:38:E1:11:97:CF", "age": 0.0}, {"interface": "Ethernet36", "ip": "172.17.17.1", "mac": "90:E2:BA:5C:25:FD", "age": 0.0}]
@@ -0,0 +1,40 @@
{
"vrfs": {
"TEST": {
"dynamicEntries": 699,
"ipV4Neighbors": [
{
"hwAddress": "dc38.e111.97cf",
"address": "172.17.17.1",
"interface": "Ethernet45",
"age": 0
},
{
"hwAddress": "90e2.ba5c.25fd",
"address": "172.17.17.1",
"interface": "Ethernet36",
"age": 0
}
],
"notLearnedEntries": 19,
"totalEntries": 699,
"staticEntries": 0
},
"default": {
"dynamicEntries": 699,
"ipV4Neighbors": [
{
"hwAddress": "90e2.ba5c.25fa",
"address": "172.18.17.1",
"interface": "Ethernet32",
"age": 0
}
],
"notLearnedEntries": 19,
"totalEntries": 699,
"staticEntries": 0
}
}
}


@@ -0,0 +1,14 @@
[
{
"interface": "mgmt0",
"ip": "10.0.0.2",
"mac": "2C:C2:60:FF:00:21",
"age": 4.0
},
{
"interface": "mgmt0",
"ip": "10.0.0.72",
"mac": "2C:C2:60:36:32:21",
"age": 140.0
}
]
@@ -0,0 +1,11 @@

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: 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 *

0 comments on commit 9f95854

Please sign in to comment.