-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated SAI-C related scripts as per changes in SAI-C repo (#307)
* Updated SAI-C related scripts as per changes in SAI-C repo Signed-off-by: Andriy Kokhan <[email protected]> * Update branch name in .gitmodules Signed-off-by: Andriy Kokhan <[email protected]> * Initialize SAI-C submodules from Makefile Signed-off-by: Andriy Kokhan <[email protected]> * Revert "Initialize SAI-C submodules from Makefile" This reverts commit 5196002. * Fixed DASH check for SAI-C * Updated SAI-C submodule to main branch Signed-off-by: Andriy Kokhan <[email protected]> * Re-worked SAI-C target build Signed-off-by: Andriy Kokhan <[email protected]> * Updated SAI-C TB description files Signed-off-by: Andriy Kokhan <[email protected]> Signed-off-by: Andriy Kokhan <[email protected]>
- Loading branch information
1 parent
f3f335e
commit 220dbbe
Showing
16 changed files
with
217 additions
and
212 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
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Requires <url of sai-challenger branch> <commit sha> or something | ||
FROM sc-client | ||
|
||
ADD tests/ /tests/ | ||
|
Submodule SAI-Challenger
updated
111 files
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 |
---|---|---|
@@ -1,49 +1,74 @@ | ||
import logging | ||
import os | ||
import pytest | ||
|
||
|
||
curdir = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
from saichallenger.common.sai_dpu import SaiDpu | ||
from saichallenger.common.sai_environment import init_setup | ||
from saichallenger.common.sai_testbed import SaiTestbed | ||
|
||
def pytest_addoption(parser): | ||
parser.addoption("--traffic", action="store_true", default=False, help="run tests with traffic") | ||
parser.addoption("--loglevel", action="store", default='NOTICE', help="syncd logging level") | ||
parser.addoption("--setup", action="store", default=None, help="Setup description (Path to the json file).") | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def exec_params(request): | ||
config_param = {} | ||
config_param["setup"] = init_setup(request.config) | ||
config_param["traffic"] = request.config.getoption("--traffic") | ||
config_param["loglevel"] = request.config.getoption("--loglevel") | ||
logging.getLogger().setLevel(getattr(logging, config_param["loglevel"].upper(), "INFO")) | ||
config_param = { | ||
# Generic parameters | ||
"traffic": request.config.getoption("--traffic"), | ||
"testbed": request.config.getoption("--setup"), | ||
} | ||
return config_param | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def dpu(exec_params) -> SaiDpu: | ||
dpu = exec_params["setup"]["DPU"][0] | ||
if dpu is not None: | ||
dpu.reset() | ||
return dpu | ||
def testbed_instance(exec_params): | ||
testbed_json = exec_params.get("testbed", None) | ||
if testbed_json is None: | ||
yield None | ||
else: | ||
testbed = SaiTestbed(f"{curdir}/../..", testbed_json, exec_params["traffic"]) | ||
testbed.init() | ||
yield testbed | ||
testbed.deinit() | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def testbed(testbed_instance): | ||
if testbed_instance: | ||
testbed_instance.setup() | ||
yield testbed_instance | ||
testbed_instance.teardown() | ||
else: | ||
yield None | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def dataplane_session(exec_params): | ||
dataplane = exec_params["setup"]["DATAPLANE"][0] | ||
# Set up the dataplane | ||
dataplane.init() | ||
yield dataplane | ||
# Shutdown the dataplane | ||
dataplane.remove() | ||
def dpu(exec_params, testbed_instance) -> SaiDpu: | ||
if len(testbed_instance.dpu) == 1: | ||
return testbed_instance.dpu[0] | ||
return None | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def dataplane_instance(testbed_instance): | ||
if len(testbed_instance.dataplane) == 1: | ||
yield testbed_instance.dataplane[0] | ||
else: | ||
yield None | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def confgen(): | ||
return dpugen.sai.SaiConfig() | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def dataplane(dataplane_session): | ||
dataplane_session.setUp() | ||
yield dataplane_session | ||
dataplane_session.tearDown() | ||
def dataplane(dataplane_instance): | ||
if dataplane_instance: | ||
dataplane_instance.setup() | ||
yield dataplane_instance | ||
dataplane_instance.teardown() | ||
else: | ||
yield None |
59 changes: 24 additions & 35 deletions
59
test/test-cases/functional/saic/sai_dpu_client_server_ptf.json
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 |
---|---|---|
@@ -1,41 +1,30 @@ | ||
{"DPU": [ | ||
{ | ||
"alias": "dash", | ||
"asic": "generic", | ||
"target": "bmv2", | ||
"type": null, | ||
"sku": null, | ||
"mode": "client-server", | ||
"sai_server_ip": "127.0.0.1", | ||
"client": { | ||
{ | ||
"dpu": [ | ||
{ | ||
"alias": "dash", | ||
"asic": "generic", | ||
"target": "bmv2", | ||
"sku": null, | ||
"client": { | ||
"type": "thrift", | ||
"config": { | ||
"ip": "127.0.0.1", | ||
"port": "9092" | ||
"ip": "127.0.0.1", | ||
"port": "9092" | ||
} | ||
}, | ||
"port_groups": [{"1x10G": "Ethernet0", "init": "1x10G", "alias": 0}, | ||
{"1x10G": "Ethernet1", "init": "1x10G", "alias": 1} | ||
], | ||
"sai_dataplane": "ptf_nn" | ||
} | ||
], | ||
} | ||
} | ||
], | ||
|
||
"DATAPLANE": [ | ||
{ | ||
"alias": "ptf", | ||
"type": "ptf", | ||
"mode": "eth", | ||
"port_groups": [{"10G": "veth1", "init": "10G", "alias": 0}, | ||
{"10G": "veth2", "init": "10G", "alias": 1} | ||
] | ||
} | ||
], | ||
|
||
"CONNECTIONS": { | ||
"ptf->dash": [[0, 0], | ||
[1, 1] | ||
] | ||
} | ||
"dataplane": [ | ||
{ | ||
"alias": "ptf", | ||
"type": "ptf", | ||
"mode": "eth", | ||
"port_groups": [ | ||
{"alias": 0, "name": "veth1"}, | ||
{"alias": 1, "name": "veth2"} | ||
] | ||
} | ||
] | ||
|
||
} |
61 changes: 25 additions & 36 deletions
61
test/test-cases/functional/saic/sai_dpu_client_server_snappi.json
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 |
---|---|---|
@@ -1,42 +1,31 @@ | ||
{"DPU": [ | ||
{ | ||
"alias": "dash", | ||
"asic": "generic", | ||
"target": "bmv2", | ||
"type": null, | ||
"sku": null, | ||
"mode": "client-server", | ||
"sai_server_ip": "127.0.0.1", | ||
"client": { | ||
{ | ||
"dpu": [ | ||
{ | ||
"alias": "dash", | ||
"asic": "generic", | ||
"target": "bmv2", | ||
"sku": null, | ||
"client": { | ||
"type": "thrift", | ||
"config": { | ||
"ip": "127.0.0.1", | ||
"port": "9092" | ||
"ip": "127.0.0.1", | ||
"port": "9092" | ||
} | ||
}, | ||
"port_groups": [{"1x10G": "Ethernet0", "init": "1x10G", "alias": 0}, | ||
{"1x10G": "Ethernet1", "init": "1x10G", "alias": 1} | ||
], | ||
"sai_dataplane": "ptf_nn" | ||
} | ||
], | ||
} | ||
} | ||
], | ||
|
||
"DATAPLANE": [ | ||
{ | ||
"alias": "ixia", | ||
"type": "snappi", | ||
"mode": "ixia_c", | ||
"controller": "https://127.0.0.1:443", | ||
"port_groups": [{"10G": "veth1", "init": "10G", "alias": 0}, | ||
{"10G": "veth3", "init": "10G", "alias": 1} | ||
] | ||
} | ||
], | ||
|
||
"CONNECTIONS": { | ||
"ixia->dash": [[0, 0], | ||
[1, 1] | ||
] | ||
} | ||
"dataplane": [ | ||
{ | ||
"alias": "ixia", | ||
"type": "snappi", | ||
"mode": "ixia_c", | ||
"controller": "https://127.0.0.1:443", | ||
"port_groups": [ | ||
{"alias": 0, "name": "veth1", "speed": "10G"}, | ||
{"alias": 1, "name": "veth3", "speed": "10G"} | ||
] | ||
} | ||
] | ||
|
||
} |
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 |
---|---|---|
@@ -1,49 +1,74 @@ | ||
import logging | ||
import os | ||
import pytest | ||
|
||
|
||
curdir = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
from saichallenger.common.sai_dpu import SaiDpu | ||
from saichallenger.common.sai_environment import init_setup | ||
from saichallenger.common.sai_testbed import SaiTestbed | ||
|
||
def pytest_addoption(parser): | ||
parser.addoption("--traffic", action="store_true", default=False, help="run tests with traffic") | ||
parser.addoption("--loglevel", action="store", default='NOTICE', help="syncd logging level") | ||
parser.addoption("--setup", action="store", default=None, help="Setup description (Path to the json file).") | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def exec_params(request): | ||
config_param = {} | ||
config_param["setup"] = init_setup(request.config) | ||
config_param["traffic"] = request.config.getoption("--traffic") | ||
config_param["loglevel"] = request.config.getoption("--loglevel") | ||
logging.getLogger().setLevel(getattr(logging, config_param["loglevel"].upper(), "INFO")) | ||
config_param = { | ||
# Generic parameters | ||
"traffic": request.config.getoption("--traffic"), | ||
"testbed": request.config.getoption("--setup"), | ||
} | ||
return config_param | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def dpu(exec_params) -> SaiDpu: | ||
dpu = exec_params["setup"]["DPU"][0] | ||
if dpu is not None: | ||
dpu.reset() | ||
return dpu | ||
def testbed_instance(exec_params): | ||
testbed_json = exec_params.get("testbed", None) | ||
if testbed_json is None: | ||
yield None | ||
else: | ||
testbed = SaiTestbed(f"{curdir}/../..", testbed_json, exec_params["traffic"]) | ||
testbed.init() | ||
yield testbed | ||
testbed.deinit() | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def testbed(testbed_instance): | ||
if testbed_instance: | ||
testbed_instance.setup() | ||
yield testbed_instance | ||
testbed_instance.teardown() | ||
else: | ||
yield None | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def dpu(exec_params, testbed_instance) -> SaiDpu: | ||
if len(testbed_instance.dpu) == 1: | ||
return testbed_instance.dpu[0] | ||
return None | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def dataplane_session(exec_params): | ||
dataplane = exec_params["setup"]["DATAPLANE"][0] | ||
# Set up the dataplane | ||
dataplane.init() | ||
yield dataplane | ||
# Shutdown the dataplane | ||
dataplane.remove() | ||
def dataplane_instance(testbed_instance): | ||
if len(testbed_instance.dataplane) == 1: | ||
yield testbed_instance.dataplane[0] | ||
else: | ||
yield None | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def confgen(): | ||
return dpugen.sai.SaiConfig() | ||
|
||
|
||
|
||
@pytest.fixture(scope="function") | ||
def dataplane(dataplane_session): | ||
dataplane_session.setUp() | ||
yield dataplane_session | ||
dataplane_session.tearDown() | ||
def dataplane(dataplane_instance): | ||
if dataplane_instance: | ||
dataplane_instance.setup() | ||
yield dataplane_instance | ||
dataplane_instance.teardown() | ||
else: | ||
yield None |
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
Oops, something went wrong.