diff --git a/tests/snappi_tests/files/helper.py b/tests/snappi_tests/files/helper.py index c57f4b4f490..9cf024a1cee 100644 --- a/tests/snappi_tests/files/helper.py +++ b/tests/snappi_tests/files/helper.py @@ -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 diff --git a/tests/snappi_tests/multidut/ecn/test_multidut_ecn_marking_with_snappi.py b/tests/snappi_tests/multidut/ecn/test_multidut_ecn_marking_with_snappi.py index 79992795ef4..2a0472c4329 100644 --- a/tests/snappi_tests/multidut/ecn/test_multidut_ecn_marking_with_snappi.py +++ b/tests/snappi_tests/multidut/ecn/test_multidut_ecn_marking_with_snappi.py @@ -1,7 +1,7 @@ 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, \ @@ -9,7 +9,7 @@ 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 @@ -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()