-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
340 additions
and
20 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,4 @@ | ||
from pathlib import Path | ||
|
||
TESTS_DIR = Path(__file__).parent | ||
FIXTURES_DIR = TESTS_DIR / "fixtures" |
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,15 @@ | ||
def pytest_addoption(parser): | ||
parser.addoption( | ||
"--skip-integration", | ||
action="store_true", | ||
dest="skip_integration", | ||
default=False, | ||
help="skip integration tests", | ||
) | ||
|
||
|
||
def pytest_configure(config): | ||
config.addinivalue_line("markers", "integration: mark integration tests") | ||
|
||
if config.option.skip_integration: | ||
setattr(config.option, "markexpr", "not integration") |
Empty file.
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,3 @@ | ||
from pathlib import Path | ||
|
||
INTEGRATION_FIXTURES_DIR = Path(__file__).parent / "fixtures" |
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,37 @@ | ||
import gnmi.proto | ||
import grpclib.client | ||
import pytest | ||
|
||
from tests.integration.target import Target, TargetConfig | ||
|
||
|
||
@pytest.fixture | ||
def target_config() -> TargetConfig: | ||
return TargetConfig() | ||
|
||
|
||
@pytest.fixture | ||
async def target(target_config) -> Target: | ||
async with Target(config=target_config) as t: | ||
yield t | ||
|
||
|
||
@pytest.fixture | ||
def channel(target) -> grpclib.client.Channel: | ||
return grpclib.client.Channel(host="127.0.0.1", port=target.config.port, ssl=None) | ||
|
||
|
||
@pytest.fixture | ||
def service(target, channel) -> gnmi.proto.gNMIStub: | ||
return gnmi.proto.gNMIStub( | ||
channel, | ||
metadata={ | ||
"username": target.config.username, | ||
"password": target.config.password, | ||
}, | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def service_unauthenticated(channel) -> gnmi.proto.gNMIStub: | ||
return gnmi.proto.gNMIStub(channel) |
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,83 @@ | ||
{ | ||
"openconfig-interfaces:interfaces": { | ||
"interface": [ | ||
{ | ||
"name": "admin", | ||
"config": { | ||
"name": "admin" | ||
} | ||
} | ||
] | ||
}, | ||
"openconfig-system:system": { | ||
"aaa": { | ||
"authentication": { | ||
"admin-user": { | ||
"config": { | ||
"admin-password": "password" | ||
} | ||
}, | ||
"config": { | ||
"authentication-method": [ | ||
"openconfig-aaa-types:LOCAL" | ||
] | ||
} | ||
} | ||
}, | ||
"clock": { | ||
"config": { | ||
"timezone-name": "Europe/Stockholm" | ||
} | ||
}, | ||
"config": { | ||
"hostname": "zz-tri-dev01", | ||
"domain-name": "foo.bar.com", | ||
"login-banner": "This device is for authorized use only", | ||
"motd-banner": "Welcome to Open vSwitch" | ||
}, | ||
"openconfig-openflow:openflow": { | ||
"agent": { | ||
"config": { | ||
"backoff-interval": 5, | ||
"datapath-id": "00:16:3e:00:00:00:00:00", | ||
"failure-mode": "SECURE", | ||
"inactivity-probe": 10, | ||
"max-backoff": 10 | ||
} | ||
}, | ||
"controllers": { | ||
"controller": [ | ||
{ | ||
"config": { | ||
"name": "main" | ||
}, | ||
"connections": { | ||
"connection": [ | ||
{ | ||
"aux-id": 0, | ||
"config": { | ||
"address": "192.0.2.10", | ||
"aux-id": 0, | ||
"port": 6633, | ||
"priority": 1, | ||
"source-interface": "admin", | ||
"transport": "TLS" | ||
}, | ||
"state": { | ||
"address": "192.0.2.10", | ||
"aux-id": 0, | ||
"port": 6633, | ||
"priority": 1, | ||
"source-interface": "admin", | ||
"transport": "TLS" | ||
} | ||
} | ||
] | ||
}, | ||
"name": "main" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.