blob: 926bca53326763d7e41bc1d0f1e6896d18940269 [file] [log] [blame]
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -05001*** Settings ***
2Documentation Test SBE side switching with watchdog errors.
3
4Library ../lib/state.py
5Library ../lib/utils.py
6Variables ../data/variables.py
7Resource ../lib/boot_utils.robot
8
George Keishingfb837e32017-11-30 03:05:09 -06009Test Setup Test Setup Execution
10Test Teardown Test Teardown Execution
11
12*** Variables ***
13
14${sbe_side_bit_mask} ${0x00004000}
15
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -050016*** Test Cases ***
17
18Test SBE Side Switch
19 [Documentation] Trigger watchdog errors on the host until it side
20 ... switches.
21 [Tags] Test_SBE_Side_Switch
22
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -050023 REST Power On
24
George Keishingfb837e32017-11-30 03:05:09 -060025 ${attempts_left}= Read Attribute /xyz/openbmc_project/state/host0
26 ... AttemptsLeft
27 Should Be Equal As Strings ${attempts_left} 3
28 ... msg=Expects boot attempts left 3, but got ${attempts_left}.
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -050029
George Keishingfb837e32017-11-30 03:05:09 -060030 # Get which side the SBE is booted with. By default 0.
31 ${sbe_val} = Get SBE
32 ${sbe_cur_side} = Evaluate ${sbe_side_bit_mask} & ${sbe_val}
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -050033
George Keishingfb837e32017-11-30 03:05:09 -060034 Trigger Watchdog Error To Switch SBE Boot Side
35
36 # Next Power on check if host booting is in progress.
37 Wait Until Keyword Succeeds 2 min 30 sec Watchdog Object Should Exist
38
39 # Verify that the side has switched.
40 ${sbe_val} = Get SBE
41 ${sbe_orig_side} = Evaluate ${sbe_side_bit_mask} & ${sbe_val}
42
43 Run Keyword If ${sbe_orig_side} == ${0}
44 ... Should Be True ${sbe_cur_side} == ${sbe_side_bit_mask}
45 ... msg=SBE seeprom side is 1.
46 ... ELSE
47 ... Should Be True ${sbe_cur_side} == ${0}
48 ... msg=SBE seeprom side is 0.
49
50 # Verify that host booted on the current SBE side.
51 Wait Until Keyword Succeeds 10 min 10 sec Is Host Running
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -050052
53
54*** Keywords ***
55
George Keishingfb837e32017-11-30 03:05:09 -060056Test Setup Execution
57 [Documentation] Do the test setup execution.
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -050058
George Keishingfb837e32017-11-30 03:05:09 -060059 Delete All Error Logs
60 Set Auto Reboot ${1}
61 Smart Power Off
62
63
64Test Teardown Execution
65 [Documentation] Do the test teardown execution.
66 FFDC On Test Case Fail
67 Smart Power Off
68
69
70Watchdog Object Should Exist
71 [Documentation] Watchdog object should exist.
72
73 ${resp}= OpenBMC Get Request ${WATCHDOG_URI} quiet=${1}
74 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
George Keishing42871db2018-01-29 09:59:32 -060075 ... msg=Failed to get ${WATCHDOG_URI}, response = ${resp.status_code}.
George Keishingfb837e32017-11-30 03:05:09 -060076
77
78Trigger Watchdog Error To Switch SBE Boot Side
79 [Documentation] Trigger watchdog error to force SBE boot side switch.
80
81 # 20 second wait is introduced to ensure host boot progress at least
82 # crossed the initial istep booting sequence.
83
84 Trigger Host Watchdog Error
85 ${attempts_left}= Read Attribute /xyz/openbmc_project/state/host0
86 ... AttemptsLeft
87 Should Be Equal As Strings ${attempts_left} 2
88 ... msg=Expects boot attempts left 2, but got ${attempts_left}.
89
90 Wait Until Keyword Succeeds 2 min 30 sec Watchdog Object Should Exist
91 Sleep 20 s
92 Trigger Host Watchdog Error
93 ${attempts_left}= Read Attribute /xyz/openbmc_project/state/host0
94 ... AttemptsLeft
95 Should Be Equal As Strings ${attempts_left} 1
96 ... msg=Expects boot attempts left 1, but got ${attempts_left}.
97
98 Wait Until Keyword Succeeds 2 min 30 sec Watchdog Object Should Exist
99 Sleep 20 s
100 Trigger Host Watchdog Error
101 ${attempts_left}= Read Attribute /xyz/openbmc_project/state/host0
102 ... AttemptsLeft
103 Should Be Equal As Strings ${attempts_left} 0
104 ... msg=Expects boot attempts left 0, but got ${attempts_left}.