-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eos: add optional real-device integration test
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import os | ||
import pytest | ||
|
||
from napalm.eos import eos | ||
from napalm.base.base import NetworkDriver | ||
|
||
|
||
@pytest.fixture | ||
def integration_device(): | ||
with eos.EOSDriver( | ||
os.environ["NAPALM_INTEGRATION_HOST"], | ||
os.environ["NAPALM_USERNAME"], | ||
os.environ["NAPALM_PASSWORD"], | ||
) as d: | ||
yield d | ||
|
||
|
||
@pytest.mark.skipif( | ||
os.getenv("NAPALM_INTEGRATION_HOST") is None, reason="No integration host specified" | ||
) | ||
def test_eos_foo(integration_device): | ||
getters = [s for s in dir(NetworkDriver) if s.startswith("get_")] | ||
|
||
getter_options = {"get_route_to": {"destination": "0.0.0.0/0", "longer": True}} | ||
|
||
for getter in getters: | ||
try: | ||
ret = getattr(integration_device, getter)(**getter_options.get(getter, {})) | ||
assert ret | ||
except NotImplementedError: | ||
pass |