[tests/platform/test_reboot.py] add testcases for reboot cause#1079
[tests/platform/test_reboot.py] add testcases for reboot cause#1079jleveque merged 6 commits intosonic-net:masterfrom stephenxs:pr2-reboot-cause
Conversation
tests/platform/test_reboot.py
Outdated
| assert m is not None, "got reboot-cause %s after rebooted by %s" % (reboot_cause_got, reboot_cause_expected) | ||
|
|
||
|
|
||
| def reboot_and_check(localhost, dut, interfaces, reboot_type="cold", reboot_helper=None, reboot_argu=None): |
There was a problem hiding this comment.
- Parameter passing should use pre-defined constant:
reboot_type=REBOOT_TYPE_COLD
- Suggest to use a better name
reboot_kwargs.
tests/platform/test_reboot.py
Outdated
|
|
||
| reboot_ctrl_element = reboot_ctrl_dict.get(reboot_type) | ||
| if reboot_ctrl_element is None: | ||
| assert False, "Unknown reboot type %s" % reboot_type |
There was a problem hiding this comment.
The above 3 lines of code can be simplified in a more pythonic way:
assert reboot_type in REBOOT_TYPES.keys(), "Unknown reboot type %s" % reboot_type
tests/platform/test_reboot.py
Outdated
| assert False, "Unknown reboot type %s" % reboot_type | ||
|
|
||
| reboot_timeout = reboot_ctrl_element[REBOOT_TIMEOUT] | ||
| reboot_cause = reboot_ctrl_element[REBOOT_CAUSE] |
There was a problem hiding this comment.
If we use a simplified REBOOT_TYPES dict, then the above two lines should be like below:
reboot_timeout = REBOOT_TYPES[reboot_type]["timeout"]
reboot_cause = REBOOT_TYPES[reboot_type]["cause"]
tests/platform/test_reboot.py
Outdated
| process.terminate() | ||
| logging.error("reboot result %s" % str(queue.get())) | ||
| assert False, "DUT did not go down" | ||
| reboot_cmd = reboot_ctrl_element[REBOOT_COMMAND] |
There was a problem hiding this comment.
reboot_cmd = REBOOT_TYPES[reboot_type]["command"]
tests/platform/test_reboot.py
Outdated
| return request.param | ||
|
|
||
|
|
||
| def _power_off_reboot_helper(args): |
There was a problem hiding this comment.
Since this function expects a dictionary argument, it usually a better practice to name the argument like kwargs.
tests/platform/test_reboot.py
Outdated
|
|
||
| delay_time_list = [15, 5] | ||
| poweroff_reboot_argu = {} | ||
| poweroff_reboot_argu["dut"] = ans_host |
There was a problem hiding this comment.
Suggest to use a better variable name poweroff_reboot_kwargs.
tests/platform/test_reboot.py
Outdated
| ans_host = testbed_devices["dut"] | ||
| localhost = testbed_devices["localhost"] | ||
|
|
||
| watchdog_reboot_command = "python -c \"import sonic_platform.platform as P; P.Platform().get_chassis().get_watchdog().arm(5); exit()\"" |
There was a problem hiding this comment.
This watchdog_reboot_command variable is unnecessary here. It's already in the REBOOT_TYPES dict.
tests/platform/test_reboot.py
Outdated
| watchdog_reboot_argu = {} | ||
| watchdog_reboot_argu["dut"] = ans_host | ||
| watchdog_reboot_argu["cause"] = "Watchdog" | ||
| watchdog_reboot_argu["command"] = watchdog_reboot_command |
There was a problem hiding this comment.
This watchdog_reboot_argu variable is not used. Why define it here?
jleveque
left a comment
There was a problem hiding this comment.
Please resolve confilcts.
|
Fixed.
|
* [201811][swss][utilities] advance sub module head Submodule src/sonic-swss fcd091c..9585be4: > [teamsyncd]: Check if LAG exists before removing (sonic-net#1069) > [mirrororch]: Toggle the mirror session when moving between VLAN/non-VLAN (sonic-net#1078) Submodule src/sonic-utilities 7bb6ffb..2d721de: > [show] Properly replace port name with alias in command output (sonic-net#664) > [neighbor_advertiser] hand pick partial change from sonic-net#525 (sonic-net#689) > Revert "Revert "Fixed config Asym PFC CLI. (sonic-net#632)" (sonic-net#652)" Signed-off-by: Ying Xie <[email protected]> * address compile issue Submodule src/sonic-swss 9585be4..2529d79: > [mirrororch]: Address compiler switch issue (sonic-net#1079) Signed-off-by: Ying Xie <[email protected]>
Description of PR
Summary:
add testcases for reboot cause
Type of change
Approach
How did you do it?
How did you do it?
add hardware reboot testcases to reboot test
add reboot-cause checking after each reboot.
How did you verify/test it?
run test on every testbed
Any platform specific information?
Supported testbed topology if it's a new test case?
all topo
Documentation
[sonic_platform_test_plan.md]add reboot cause test #451