Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[action] [PR:15934] Cisco specific: Check debug shell status before ecn marking test #16333

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
35 changes: 35 additions & 0 deletions tests/snappi_tests/files/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,38 @@ def revert_config_and_reload(node, results=None):
# parallel_run(revert_config_and_reload, {}, {}, list(args), timeout=900)
for duthost in args:
revert_config_and_reload(node=duthost)


@pytest.fixture(autouse=True)
def enable_debug_shell(setup_ports_and_dut): # noqa: F811
_, _, snappi_ports = setup_ports_and_dut
rx_duthost = snappi_ports[0]['duthost']

if is_cisco_device(rx_duthost):
dutport = snappi_ports[0]['peer_port']
asic_namespace_string = ""
syncd_string = "syncd"
if rx_duthost.is_multi_asic:
asic = rx_duthost.get_port_asic_instance(dutport)
asic_namespace_string = " -n " + asic.namespace
asic_id = rx_duthost.get_asic_id_from_namespace(asic.namespace)
syncd_string += str(asic_id)

dshell_status = "".join(rx_duthost.shell("docker exec {} supervisorctl status dshell_client | \
grep \"dshell_client.*RUNNING\"".format(syncd_string),
module_ignore_errors=True)["stdout_lines"])
if 'RUNNING' not in dshell_status:
debug_shell_enable = rx_duthost.command("docker exec {} supervisorctl start dshell_client".
format(syncd_string))
logging.info(debug_shell_enable)

def is_debug_shell_enabled():
output = "".join(rx_duthost.shell("sudo show platform npu voq voq_globals -i {}{}".format(
dutport, asic_namespace_string))["stdout_lines"])
if "cisco sdk-debug enable" in output:
return False
return True

wait_until(360, 5, 0, is_debug_shell_enabled)
yield
pass
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import pytest
import logging
from tabulate import tabulate # noqa F401
from tests.common.helpers.assertions import pytest_assert # noqa: F401
from tests.common.helpers.assertions import pytest_assert, pytest_require # noqa: F401
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts, \
fanout_graph_facts_multidut # noqa: F401
from tests.common.snappi_tests.snappi_fixtures import snappi_api_serv_ip, snappi_api_serv_port, \
snappi_api, snappi_dut_base_config, get_snappi_ports, get_snappi_ports_for_rdma, cleanup_config, \
is_snappi_multidut, get_snappi_ports_multi_dut, get_snappi_ports_single_dut # noqa: F401
from tests.common.snappi_tests.qos_fixtures import prio_dscp_map, \
lossless_prio_list, disable_pfcwd # noqa F401
from tests.snappi_tests.files.helper import multidut_port_info, setup_ports_and_dut # noqa: F401
from tests.snappi_tests.files.helper import multidut_port_info, setup_ports_and_dut, enable_debug_shell # noqa: F401
from tests.snappi_tests.multidut.ecn.files.multidut_helper import run_ecn_marking_test, run_ecn_marking_port_toggle_test
from tests.common.snappi_tests.snappi_test_params import SnappiTestParams
from tests.common.cisco_data import is_cisco_device
Expand Down Expand Up @@ -147,7 +147,7 @@ def test_ecn_marking_lossless_prio(

testbed_config, port_config_list, snappi_ports = setup_ports_and_dut

pytest_assert(validate_snappi_ports(snappi_ports), "Invalid combination of duthosts or ASICs in snappi_ports")
pytest_require(validate_snappi_ports(snappi_ports), "Invalid combination of duthosts or ASICs in snappi_ports")

logger.info("Snappi Ports : {}".format(snappi_ports))
snappi_extra_params = SnappiTestParams()
Expand Down
Loading