|
11 | 11 | import copy |
12 | 12 | import time |
13 | 13 | import collections |
14 | | -from contextlib import contextmanager |
15 | 14 |
|
16 | 15 | from tests.common.fixtures.ptfhost_utils import ptf_portmap_file # noqa F401 |
17 | 16 | from tests.common.helpers.assertions import pytest_assert, pytest_require |
18 | 17 | from tests.common.helpers.multi_thread_utils import SafeThreadPoolExecutor |
19 | 18 | from tests.common.mellanox_data import is_mellanox_device as isMellanoxDevice |
20 | | -from tests.common.cisco_data import is_cisco_device, copy_set_voq_watchdog_script_cisco_8000, \ |
21 | | - copy_dshell_script_cisco_8000, run_dshell_command |
| 19 | +from tests.common.cisco_data import is_cisco_device, copy_dshell_script_cisco_8000, run_dshell_command |
22 | 20 | from tests.common.dualtor.dual_tor_common import active_standby_ports # noqa F401 |
23 | 21 | from tests.common.dualtor.dual_tor_utils import upper_tor_host, lower_tor_host, dualtor_ports, is_tunnel_qos_remap_enabled # noqa F401 |
24 | 22 | from tests.common.dualtor.mux_simulator_control \ |
|
35 | 33 | from tests.common.snappi_tests.qos_fixtures import get_pfcwd_config, reapply_pfcwd |
36 | 34 | from tests.common.snappi_tests.common_helpers import \ |
37 | 35 | stop_pfcwd, disable_packet_aging, enable_packet_aging |
38 | | -from .qos_helpers import dutBufferConfig |
| 36 | +from .qos_helpers import dutBufferConfig, disable_voq_watchdog |
39 | 37 |
|
40 | 38 | logger = logging.getLogger(__name__) |
41 | 39 |
|
@@ -2783,66 +2781,14 @@ def set_cir_change(self, get_src_dst_asic_and_duts, dutConfig): |
2783 | 2781 | yield |
2784 | 2782 | return |
2785 | 2783 |
|
2786 | | - def voq_watchdog_enabled(self, get_src_dst_asic_and_duts): |
2787 | | - dst_dut = get_src_dst_asic_and_duts['dst_dut'] |
2788 | | - if not is_cisco_device(dst_dut): |
2789 | | - return False |
2790 | | - namespace_option = "-n asic0" if dst_dut.facts.get("modular_chassis") else "" |
2791 | | - show_command = "show platform npu global {}".format(namespace_option) |
2792 | | - result = run_dshell_command(dst_dut, show_command) |
2793 | | - pattern = r"voq_watchdog_enabled +: +True" |
2794 | | - match = re.search(pattern, result["stdout"]) |
2795 | | - return match |
2796 | | - |
2797 | | - def modify_voq_watchdog(self, duthosts, get_src_dst_asic_and_duts, dutConfig, enable): |
2798 | | - # Skip if voq watchdog is not enabled. |
2799 | | - if not self.voq_watchdog_enabled(get_src_dst_asic_and_duts): |
2800 | | - logger.info("voq_watchdog is not enabled, skipping modify voq watchdog") |
2801 | | - return |
2802 | | - |
2803 | | - dst_dut = get_src_dst_asic_and_duts['dst_dut'] |
2804 | | - dst_asic = get_src_dst_asic_and_duts['dst_asic'] |
2805 | | - dut_list = [dst_dut] |
2806 | | - asic_index_list = [dst_asic.asic_index] |
2807 | | - |
2808 | | - if not get_src_dst_asic_and_duts["single_asic_test"]: |
2809 | | - src_dut = get_src_dst_asic_and_duts['src_dut'] |
2810 | | - src_asic = get_src_dst_asic_and_duts['src_asic'] |
2811 | | - dut_list.append(src_dut) |
2812 | | - asic_index_list.append(src_asic.asic_index) |
2813 | | - # fabric card asics |
2814 | | - for rp_dut in duthosts.supervisor_nodes: |
2815 | | - for asic in rp_dut.asics: |
2816 | | - dut_list.append(rp_dut) |
2817 | | - asic_index_list.append(asic.asic_index) |
2818 | | - |
2819 | | - # Modify voq watchdog. |
2820 | | - for (dut, asic_index) in zip(dut_list, asic_index_list): |
2821 | | - copy_set_voq_watchdog_script_cisco_8000( |
2822 | | - dut=dut, |
2823 | | - asic=asic_index, |
2824 | | - enable=enable) |
2825 | | - cmd_opt = "-n asic{}".format(asic_index) |
2826 | | - if not dst_dut.sonichost.is_multi_asic: |
2827 | | - cmd_opt = "" |
2828 | | - dut.shell("sudo show platform npu script {} -s set_voq_watchdog.py".format(cmd_opt)) |
2829 | | - |
2830 | | - @contextmanager |
2831 | | - def disable_voq_watchdog(self, duthosts, get_src_dst_asic_and_duts, dutConfig): |
2832 | | - # Disable voq watchdog. |
2833 | | - self.modify_voq_watchdog(duthosts, get_src_dst_asic_and_duts, dutConfig, enable=False) |
2834 | | - yield |
2835 | | - # Enable voq watchdog. |
2836 | | - self.modify_voq_watchdog(duthosts, get_src_dst_asic_and_duts, dutConfig, enable=True) |
2837 | | - |
2838 | 2784 | @pytest.fixture(scope='function') |
2839 | | - def disable_voq_watchdog_function_scope(self, duthosts, get_src_dst_asic_and_duts, dutConfig): |
2840 | | - with self.disable_voq_watchdog(duthosts, get_src_dst_asic_and_duts, dutConfig) as result: |
| 2785 | + def disable_voq_watchdog_function_scope(self, duthosts, get_src_dst_asic_and_duts): |
| 2786 | + with disable_voq_watchdog(duthosts, get_src_dst_asic_and_duts) as result: |
2841 | 2787 | yield result |
2842 | 2788 |
|
2843 | 2789 | @pytest.fixture(scope='class') |
2844 | | - def disable_voq_watchdog_class_scope(self, duthosts, get_src_dst_asic_and_duts, dutConfig): |
2845 | | - with self.disable_voq_watchdog(duthosts, get_src_dst_asic_and_duts, dutConfig) as result: |
| 2790 | + def disable_voq_watchdog_class_scope(self, duthosts, get_src_dst_asic_and_duts): |
| 2791 | + with disable_voq_watchdog(duthosts, get_src_dst_asic_and_duts) as result: |
2846 | 2792 | yield result |
2847 | 2793 |
|
2848 | 2794 | def oq_watchdog_enabled(self, get_src_dst_asic_and_duts): |
|
0 commit comments