Skip to content
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
17 changes: 12 additions & 5 deletions tests/platform_tests/api/test_watchdog.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import re
import time
import logging
import yaml
Expand Down Expand Up @@ -48,14 +49,19 @@ def conf(self, request, duthost):
platform = duthost.facts['platform']
hwsku = duthost.facts['hwsku']

if platform in test_config and 'default' in test_config[platform]:
config.update(test_config[platform]['default'])
if platform in test_config and hwsku in test_config[platform]:
config.update(test_config[platform][hwsku])
# override test config with platform/hwsku specific configs
for platform_regexp in test_config:
if re.match(platform_regexp, platform):
config.update(test_config[platform_regexp].get('default', {}))
for hwsku_regexp in test_config[platform_regexp]:
if re.match(hwsku_regexp, hwsku):
config.update(test_config[platform_regexp][hwsku_regexp])

pytest_assert('valid_timeout' in config, "valid_timeout is not defined in config")
# make sure watchdog won't reboot the system when test sleeps for @TEST_WAIT_TIME_SECONDS
pytest_assert(config['valid_timeout'] > TEST_WAIT_TIME_SECONDS * 2, "valid_timeout {} seconds is too short".format(config['valid_timeout']))

logger.info('Test configuration for platform: {} hwksu: {}: {}'.format(platform, hwsku, config))
return config

@pytest.mark.dependency()
Expand Down Expand Up @@ -95,7 +101,7 @@ def test_arm_disarm_states(self, duthost, localhost, platform_api_conn, conf):

res = localhost.wait_for(host=duthost.hostname, port=22, state="stopped", delay=5, timeout=watchdog_timeout + TIMEOUT_DEVIATION, module_ignore_errors=True)

self.expect('exception' in res, "unexpected disconnection from dut")
self.expect('Timeout' in res.get('msg', ''), "unexpected disconnection from dut")
self.assert_expectations()

@pytest.mark.dependency(depends=["test_arm_disarm_states"])
Expand Down Expand Up @@ -194,3 +200,4 @@ def test_arm_negative_timeout(self, duthost, platform_api_conn):
actual_timeout = watchdog.arm(platform_api_conn, watchdog_timeout)
self.expect(actual_timeout == -1, "{}: Watchdog should be disarmed, but returned timeout of {} seconds".format(test_arm_negative_timeout.__name__, watchdog_timeout))
self.assert_expectations()

20 changes: 14 additions & 6 deletions tests/platform_tests/api/watchdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,26 @@ default:
greater_timeout: 20 # A greater timeout value that watchdog has to accept, put None if single timeout value is a watchdog limitation
too_big_timeout: 100 # A timeout which is too big for HW watchdog, put None if there is no such limitation

# Mellanox SPC-2 based systems have different hardware watchdog capabilities
x86_64-mlnx_msn3700-r0:
# Mellanox watchdog type 2
x86_64-mlnx_msn.*-r0:
default:
greater_timeout: 100
too_big_timeout: 300

x86_64-mlnx_msn3700c-r0:
# Mellnox watchdog type 1
x86_64-mlnx_msn2410-r0:
default:
greater_timeout: 100
too_big_timeout: 300
valid_timeout: 10
greater_timeout: 20
too_big_timeout: 100

# Mellanox watchdog type 3
x86_64-mlnx_msn3800-r0:
default:
greater_timeout: 100
too_big_timeout: 300
too_big_timeout: 66000

x86_64-mlnx_msn2700-r0:
default:
greater_timeout: 100
too_big_timeout: 66000