blob: 7e2bdfd38649de2789860ab4b19487e4869a81ac [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
George Keishingfd9d8db2018-02-22 12:43:47 -06008Resource ../lib/state_manager.robot
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -05009
George Keishingfb837e32017-11-30 03:05:09 -060010Test Setup Test Setup Execution
11Test Teardown Test Teardown Execution
12
13*** Variables ***
14
15${sbe_side_bit_mask} ${0x00004000}
16
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -050017*** Test Cases ***
18
19Test SBE Side Switch
20 [Documentation] Trigger watchdog errors on the host until it side
21 ... switches.
22 [Tags] Test_SBE_Side_Switch
23
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -050024 REST Power On
25
George Keishingfb837e32017-11-30 03:05:09 -060026 ${attempts_left}= Read Attribute /xyz/openbmc_project/state/host0
27 ... AttemptsLeft
28 Should Be Equal As Strings ${attempts_left} 3
29 ... msg=Expects boot attempts left 3, but got ${attempts_left}.
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -050030
George Keishingfb837e32017-11-30 03:05:09 -060031 # Get which side the SBE is booted with. By default 0.
George Keishingfb218a12018-11-28 11:20:42 -060032 ${sbe_val}= Get SBE
33 ${sbe_cur_side}= Evaluate ${sbe_side_bit_mask} & ${sbe_val}
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -050034
George Keishingfb837e32017-11-30 03:05:09 -060035 Trigger Watchdog Error To Switch SBE Boot Side
36
37 # Next Power on check if host booting is in progress.
38 Wait Until Keyword Succeeds 2 min 30 sec Watchdog Object Should Exist
39
40 # Verify that the side has switched.
George Keishingfb218a12018-11-28 11:20:42 -060041 ${sbe_val}= Get SBE
42 ${sbe_orig_side}= Evaluate ${sbe_side_bit_mask} & ${sbe_val}
George Keishingfb837e32017-11-30 03:05:09 -060043
44 Run Keyword If ${sbe_orig_side} == ${0}
45 ... Should Be True ${sbe_cur_side} == ${sbe_side_bit_mask}
46 ... msg=SBE seeprom side is 1.
47 ... ELSE
48 ... Should Be True ${sbe_cur_side} == ${0}
49 ... msg=SBE seeprom side is 0.
50
51 # Verify that host booted on the current SBE side.
52 Wait Until Keyword Succeeds 10 min 10 sec Is Host Running
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -050053
54
55*** Keywords ***
56
George Keishingfb837e32017-11-30 03:05:09 -060057Test Setup Execution
58 [Documentation] Do the test setup execution.
Charles Paul Hoferbbc0f202017-09-29 11:48:39 -050059
George Keishingfb837e32017-11-30 03:05:09 -060060 Delete All Error Logs
61 Set Auto Reboot ${1}
62 Smart Power Off
63
64
65Test Teardown Execution
66 [Documentation] Do the test teardown execution.
67 FFDC On Test Case Fail
68 Smart Power Off
69
70
71Watchdog Object Should Exist
72 [Documentation] Watchdog object should exist.
73
74 ${resp}= OpenBMC Get Request ${WATCHDOG_URI} quiet=${1}
75 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
George Keishing42871db2018-01-29 09:59:32 -060076 ... msg=Failed to get ${WATCHDOG_URI}, response = ${resp.status_code}.
George Keishingfb837e32017-11-30 03:05:09 -060077
78
79Trigger Watchdog Error To Switch SBE Boot Side
80 [Documentation] Trigger watchdog error to force SBE boot side switch.
81
82 # 20 second wait is introduced to ensure host boot progress at least
83 # crossed the initial istep booting sequence.
84
85 Trigger Host Watchdog Error
86 ${attempts_left}= Read Attribute /xyz/openbmc_project/state/host0
87 ... AttemptsLeft
88 Should Be Equal As Strings ${attempts_left} 2
89 ... msg=Expects boot attempts left 2, but got ${attempts_left}.
90
91 Wait Until Keyword Succeeds 2 min 30 sec Watchdog Object Should Exist
92 Sleep 20 s
93 Trigger Host Watchdog Error
94 ${attempts_left}= Read Attribute /xyz/openbmc_project/state/host0
95 ... AttemptsLeft
96 Should Be Equal As Strings ${attempts_left} 1
97 ... msg=Expects boot attempts left 1, but got ${attempts_left}.
98
99 Wait Until Keyword Succeeds 2 min 30 sec Watchdog Object Should Exist
100 Sleep 20 s
101 Trigger Host Watchdog Error
102 ${attempts_left}= Read Attribute /xyz/openbmc_project/state/host0
103 ... AttemptsLeft
104 Should Be Equal As Strings ${attempts_left} 0
105 ... msg=Expects boot attempts left 0, but got ${attempts_left}.