-
Notifications
You must be signed in to change notification settings - Fork 1k
New test cases to verify voq watchdog #18735
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
Merged
yejianquan
merged 6 commits into
sonic-net:master
from
zhixzhu:voq_watchdog_on_QosSaiBase
Jun 16, 2025
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9b55e10
New test cases for voq watchdog
zhixzhu 2f99ed3
support different scope for disable_voq_watchdog
zhixzhu 2976ea9
merge master
zhixzhu 34ba933
ignore watchdog log in loganalyzer for testcase testQosSaiVoqWatchdog
zhixzhu 48df846
adjust skip condition, skip voq watchdog test if non-cisco or voq wat…
zhixzhu 8f1a3a9
move pkts_num to be global
zhixzhu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| """SAI thrift-based tests for the VOQ watchdog feature in SONiC. | ||
|
|
||
| This set of test cases verifies VOQ watchdog behavior. These are dataplane | ||
| tests that depend on the SAI thrift library in order to pause ports and read | ||
| drop counters. | ||
|
|
||
| Parameters: | ||
| --ptf_portmap <filename> (str): file name of port index to DUT interface alias map. Default is None. | ||
| In case a filename is not provided, a file containing a port indices to aliases map will be generated. | ||
|
|
||
| --qos_swap_syncd (bool): Used to install the RPC syncd image before running the tests. Default is True. | ||
|
|
||
| --qos_dst_ports (list) Indices of available DUT test ports to serve as destination ports. Note: This is not port | ||
| index on DUT, rather an index into filtered (excludes lag member ports) DUT ports. Plan is to randomize port | ||
| selection. Default is [0, 1, 3]. | ||
|
|
||
| --qos_src_ports (list) Indices of available DUT test ports to serve as source port. Similar note as in | ||
| qos_dst_ports applies. Default is [2]. | ||
| """ | ||
|
|
||
| import logging | ||
| import pytest | ||
|
|
||
| from tests.common.fixtures.duthost_utils import dut_qos_maps, \ | ||
| separated_dscp_to_tc_map_on_uplink # noqa F401 | ||
| from tests.common.fixtures.ptfhost_utils import copy_ptftests_directory # noqa F401 | ||
| from tests.common.fixtures.ptfhost_utils import copy_saitests_directory # noqa F401 | ||
| from tests.common.fixtures.ptfhost_utils import change_mac_addresses # noqa F401 | ||
| from .qos_sai_base import QosSaiBase | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| pytestmark = [ | ||
| pytest.mark.topology('any') | ||
| ] | ||
|
|
||
|
|
||
| @pytest.fixture(scope="function") | ||
| def ignore_log_voq_watchdog(duthosts, loganalyzer): | ||
| if not loganalyzer: | ||
| yield | ||
| return | ||
| ignore_list = [r".*HARDWARE_WATCHDOG.*", r".*soft_reset*", r".*VOQ Appears to be stuck*"] | ||
| for dut in duthosts: | ||
| for line in ignore_list: | ||
| loganalyzer[dut.hostname].ignore_regex.append(line) | ||
| yield | ||
| return | ||
|
|
||
|
|
||
| class TestVoqWatchdog(QosSaiBase): | ||
| """TestVoqWatchdog derives from QosSaiBase and contains collection of VOQ watchdog test cases. | ||
| """ | ||
| @pytest.fixture(scope="class", autouse=True) | ||
| def check_skip_voq_watchdog_test(self, get_src_dst_asic_and_duts): | ||
| if not self.voq_watchdog_enabled(get_src_dst_asic_and_duts): | ||
| pytest.skip("Voq watchdog test is skipped since voq watchdog is not enabled.") | ||
|
|
||
| def testQosSaiVoqWatchdog( | ||
| self, ptfhost, dutTestParams, dutConfig, dutQosConfig, | ||
| get_src_dst_asic_and_duts, ignore_log_voq_watchdog | ||
| ): | ||
| """ | ||
| Test VOQ watchdog | ||
| Args: | ||
| ptfhost (AnsibleHost): Packet Test Framework (PTF) | ||
| dutTestParams (Fixture, dict): DUT host test params | ||
| dutConfig (Fixture, dict): Map of DUT config containing dut interfaces, test port IDs, test port IPs, | ||
| and test ports | ||
| dutQosConfig (Fixture, dict): Map containing DUT host QoS configuration | ||
| Returns: | ||
| None | ||
| Raises: | ||
| RunAnsibleModuleFail if ptf test fails | ||
| """ | ||
|
|
||
| testParams = dict() | ||
| testParams.update(dutTestParams["basicParams"]) | ||
| testParams.update({ | ||
| "dscp": 8, | ||
| "dst_port_id": dutConfig["testPorts"]["dst_port_id"], | ||
| "dst_port_ip": dutConfig["testPorts"]["dst_port_ip"], | ||
| "src_port_id": dutConfig["testPorts"]["src_port_id"], | ||
| "src_port_ip": dutConfig["testPorts"]["src_port_ip"], | ||
| "src_port_vlan": dutConfig["testPorts"]["src_port_vlan"], | ||
| "packet_size": 1350, | ||
| "pkts_num": 100, | ||
| "voq_watchdog_enabled": True, | ||
| }) | ||
|
|
||
| self.runPtfTest( | ||
| ptfhost, testCase="sai_qos_tests.VoqWatchdogTest", | ||
| testParams=testParams) | ||
|
|
||
| def testQosSaiVoqWatchdogDisable( | ||
| self, ptfhost, dutTestParams, dutConfig, dutQosConfig, | ||
| get_src_dst_asic_and_duts, disable_voq_watchdog_function_scope | ||
| ): | ||
| """ | ||
| Test VOQ watchdog | ||
| Args: | ||
| ptfhost (AnsibleHost): Packet Test Framework (PTF) | ||
| dutTestParams (Fixture, dict): DUT host test params | ||
| dutConfig (Fixture, dict): Map of DUT config containing dut interfaces, test port IDs, test port IPs, | ||
| and test ports | ||
| dutQosConfig (Fixture, dict): Map containing DUT host QoS configuration | ||
| Returns: | ||
| None | ||
| Raises: | ||
| RunAnsibleModuleFail if ptf test fails | ||
| """ | ||
|
|
||
| testParams = dict() | ||
| testParams.update(dutTestParams["basicParams"]) | ||
| testParams.update({ | ||
| "dscp": 8, | ||
| "dst_port_id": dutConfig["testPorts"]["dst_port_id"], | ||
| "dst_port_ip": dutConfig["testPorts"]["dst_port_ip"], | ||
| "src_port_id": dutConfig["testPorts"]["src_port_id"], | ||
| "src_port_ip": dutConfig["testPorts"]["src_port_ip"], | ||
| "src_port_vlan": dutConfig["testPorts"]["src_port_vlan"], | ||
| "packet_size": 1350, | ||
| "pkts_num": 100, | ||
| "voq_watchdog_enabled": False, | ||
| }) | ||
|
|
||
| self.runPtfTest( | ||
| ptfhost, testCase="sai_qos_tests.VoqWatchdogTest", | ||
| testParams=testParams) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.