Skip to content

Commit

Permalink
fix issue caused by conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
JibinBao committed Dec 13, 2024
1 parent 796037c commit 9606cbb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def pytest_addoption(parser):
############################
# SmartSwitch options #
############################
parser.addoption("--dpu-pattern", action="store", default=None, help="dpu host name")
parser.addoption("--dpu-pattern", action="store", default="all", help="dpu host name")


def pytest_configure(config):
Expand Down Expand Up @@ -382,6 +382,9 @@ def get_specified_device_info(request, device_pattern):

host_pattern = request.config.getoption(device_pattern)
if host_pattern == 'all':
if device_pattern == '--dpu-pattern':
testbed_duts = [dpu_dut for dpu_dut in testbed_duts if 'dpu' in dpu_dut]
logger.info(f"dpu duts: {testbed_duts}")
return testbed_duts

if ';' in host_pattern:
Expand Down Expand Up @@ -481,8 +484,11 @@ def fixture_dpuhosts(enhance_inventory, ansible_adhoc, tbinfo, request):
mandatory argument for the class constructors.
@param tbinfo: fixture provides information about testbed.
"""
# Before calling dpuhosts, we must enable NAT on NPU.
# E.g. run sonic-dpu-mgmt-traffic.sh on NPU to enable NAT
# sonic-dpu-mgmt-traffic.sh inbound -e --dpus all --ports 5021,5022,5023,5024
try:
host = DutHosts(ansible_adhoc, tbinfo, get_specified_dpus(request),
host = DutHosts(ansible_adhoc, tbinfo, request, get_specified_dpus(request),
target_hostname=get_target_hostname(request), is_parallel_leader=is_parallel_leader(request))
return host
except BaseException as e:
Expand Down

0 comments on commit 9606cbb

Please sign in to comment.