Skip to content

Commit

Permalink
Cisco specific: Check debug shell status before ecn marking test (#15934
Browse files Browse the repository at this point in the history
)

Description of PR
Summary:
Fixes # (issue)

Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 Test case(new/improvement)
Back port request
 202012
 202205
 202305
 202311
 202405
Approach
What is the motivation for this PR?
Testcase execution might fail if a previous test did a config reload
which results in delay of dshell init which is expected.

How did you do it?
Added a pytest fixture to run along with testcase.

How did you verify/test it?
on Snappi based run

co-authorized by: [email protected]
  • Loading branch information
sreejithsreekumaran authored Dec 11, 2024
1 parent 4e48542 commit 2e62e24
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
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

0 comments on commit 2e62e24

Please sign in to comment.