Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .azure-pipelines/pr_test_scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,16 @@ wan-pub:
- tacacs/test_authorization.py
- tacacs/test_accounting.py

dpu:
- dash/test_dash_vnet.py

specific_param:
t0-sonic:
- name: bgp/test_bgp_fact.py
param: "--neighbor_type=sonic --enable_macsec --macsec_profile=128_SCI,256_XPN_SCI"
# all the test modules under macsec directory
- name: macsec
param: "--neighbor_type=sonic --enable_macsec --macsec_profile=128_SCI,256_XPN_SCI"
dpu:
- name: dash/test_dash_vnet.py
param: " --skip_dataplane_checking "
14 changes: 14 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,20 @@ stages:
MGMT_BRANCH: "master"
SCRIPTS_EXCLUDE: "bgp/test_bgp_fact.py"

- job: dpu_elastictest
displayName: "kvmtest-dpu by Elastictest"
timeoutInMinutes: 240
continueOnError: false
pool: ubuntu-20.04
steps:
- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: dpu
MIN_WORKER: $(T0_SONIC_INSTANCE_NUM)
MAX_WORKER: $(T0_SONIC_INSTANCE_NUM)
KVM_IMAGE_BRANCH: "master"
MGMT_BRANCH: "master"

# - job: wan_elastictest
# displayName: "kvmtest-wan by Elastictest"
# timeoutInMinutes: 240
Expand Down
43 changes: 41 additions & 2 deletions tests/dash/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
REMOTE_PA_IP, REMOTE_PTF_INTF, REMOTE_PTF_MAC, REMOTE_PA_PREFIX, VNET1_NAME, VNET2_NAME, ROUTING_ACTION, \
ROUTING_ACTION_TYPE, LOOKUP_OVERLAY_IP
from dash_utils import render_template_to_host, apply_swssconfig_file
from gnmi_utils import generate_gnmi_cert, apply_gnmi_cert, recover_gnmi_cert, apply_gnmi_file

logger = logging.getLogger(__name__)

ENABLE_GNMI_API = True


def pytest_addoption(parser):
"""
Expand All @@ -34,6 +37,12 @@ def pytest_addoption(parser):
help="Skip config cleanup after test"
)

parser.addoption(
"--skip_dataplane_checking",
action="store_true",
help="Skip dataplane checking"
)


@pytest.fixture(scope="module")
def config_only(request):
Expand All @@ -50,6 +59,11 @@ def skip_cleanup(request):
return request.config.getoption("--skip_cleanup")


@pytest.fixture(scope="module")
def skip_dataplane_checking(request):
return request.config.getoption("--skip_dataplane_checking")


@pytest.fixture(scope="module")
def config_facts(duthost):
return duthost.config_facts(host=duthost.hostname, source="running")['ansible_facts']
Expand Down Expand Up @@ -126,7 +140,7 @@ def dash_config_info(duthost, config_facts, minigraph_facts):


@pytest.fixture(scope="function")
def apply_config(duthost, skip_config, skip_cleanup):
def apply_config(duthost, ptfhost, skip_config, skip_cleanup):
configs = []
op = "SET"

Expand All @@ -140,7 +154,10 @@ def _apply_config(config_info):
template_name = "{}.j2".format(config)
dest_path = "/tmp/{}.json".format(config)
render_template_to_host(template_name, duthost, dest_path, config_info, op=op)
apply_swssconfig_file(duthost, dest_path)
if ENABLE_GNMI_API:
apply_gnmi_file(duthost, ptfhost, dest_path)
else:
apply_swssconfig_file(duthost, dest_path)

yield _apply_config

Expand Down Expand Up @@ -202,3 +219,25 @@ def apply_direct_configs(dash_outbound_configs, apply_config):
del dash_outbound_configs[VNET2_NAME]

apply_config(dash_outbound_configs)


@pytest.fixture(scope="module", autouse=True)
def setup_gnmi_server(duthosts, rand_one_dut_hostname, localhost, ptfhost):
if not ENABLE_GNMI_API:
yield
return

duthost = duthosts[rand_one_dut_hostname]
generate_gnmi_cert(localhost, duthost)
apply_gnmi_cert(duthost, ptfhost)
yield
recover_gnmi_cert(localhost, duthost)


@pytest.fixture(scope="function")
def asic_db_checker(duthost):
def _check_asic_db(tables):
for table in tables:
output = duthost.shell("sonic-db-cli ASIC_DB keys 'ASIC_STATE:{}:*'".format(table))
assert output["stdout"].strip() != "", "No entries found in ASIC_DB table {}".format(table)
yield _check_asic_db
Loading