Skip to content

Commit

Permalink
Updated SAI-C related scripts as per changes in SAI-C repo (#307)
Browse files Browse the repository at this point in the history
* 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
andriy-kokhan authored Jan 2, 2023
1 parent f3f335e commit 220dbbe
Show file tree
Hide file tree
Showing 16 changed files with 217 additions and 212 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
[submodule "test/SAI-Challenger"]
path = test/SAI-Challenger
url = https://github.com/opencomputeproject/SAI-Challenger
branch = multiple-api-support
branch = main
7 changes: 3 additions & 4 deletions dash-pipeline/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG = $(DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG_

docker-saichallenger-client-bldr:
{ [ x$(ENABLE_DOCKER_PULL) == xy ] && docker pull $(DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG); } || \
{ pushd $(SAI_CHALLENGER_PATH) && ./build.sh -i client && popd; \
{ pushd $(SAI_CHALLENGER_PATH) && git submodule update --init && ./build.sh -i client && popd; \
docker build \
-f dockerfiles/Dockerfile.saichallenger-client-bldr \
-t $(DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG) \
Expand All @@ -609,8 +609,7 @@ docker-publish-saichallenger-client-bldr:
docker-pull-saichallenger-client-bldr:
docker pull $(DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG)

docker-saichallenger-client:
cd $(SAI_CHALLENGER_PATH) && ./build.sh -i client
docker-saichallenger-client: docker-saichallenger-client-bldr
docker build \
-f dockerfiles/Dockerfile.saichallenger-client \
-t $(DOCKER_SAI_CHALLENGER_CLIENT_IMG) \
Expand Down Expand Up @@ -666,4 +665,4 @@ run-saichallenger-scale-tests: deploy-ixiac

install-docker-compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$$(uname -s)-$$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Changing this will cause build/publish to occur in CI actions
export DASH_ACR_REGISTRY=sonicdash.azurecr.io
export DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG_NAME=${DASH_ACR_REGISTRY}/dash-saichallenger-client-bldr
export DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG_CTAG?=221209
export DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG_CTAG?=221228
3 changes: 1 addition & 2 deletions dash-pipeline/dockerfiles/Dockerfile.saichallenger-client
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM sonicdash.azurecr.io/dash-saichallenger-client-bldr:221109
FROM sonicdash.azurecr.io/dash-saichallenger-client-bldr:221228

ENV SAI_CHALLENGER_PATH /sai-challenger
ENV DASH_PATH /dash
Expand All @@ -20,7 +20,6 @@ RUN cd /saithrift-0.9 && \
rm -rf thrift-0.11.0 && \
cd /SAI/test/ptf && \
python3 setup.py install && \
ln -s ${SAI_CHALLENGER_PATH} /usr/local/lib/python3.7/dist-packages/saichallenger && \
ln -s ${DASH_PATH}/test/test-cases/scale/saic ${SAI_CHALLENGER_PATH}/dash_tests

CMD ["/usr/bin/supervisord"]
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/
Expand Down
2 changes: 1 addition & 1 deletion test/SAI-Challenger
Submodule SAI-Challenger updated 111 files
73 changes: 49 additions & 24 deletions test/test-cases/functional/saic/conftest.py
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 test/test-cases/functional/saic/sai_dpu_client_server_ptf.json
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 test/test-cases/functional/saic/sai_dpu_client_server_snappi.json
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"}
]
}
]

}
75 changes: 50 additions & 25 deletions test/test-cases/scale/saic/conftest.py
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
2 changes: 1 addition & 1 deletion test/test-cases/scale/saic/dash_helper/vnet2vnet_helper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import snappi
import saichallenger.dataplane.traffic_utils as tu
import saichallenger.common.sai_dataplane.utils.traffic_utils as tu
from collections import namedtuple


Expand Down
Loading

0 comments on commit 220dbbe

Please sign in to comment.