Charles Paul Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test SBE side switching with watchdog errors. |
| 3 | |
| 4 | Library ../lib/state.py |
| 5 | Library ../lib/utils.py |
| 6 | Variables ../data/variables.py |
| 7 | Resource ../lib/boot_utils.robot |
| 8 | |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 9 | Test Setup Test Setup Execution |
| 10 | Test Teardown Test Teardown Execution |
| 11 | |
| 12 | *** Variables *** |
| 13 | |
| 14 | ${sbe_side_bit_mask} ${0x00004000} |
| 15 | |
Charles Paul Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 16 | *** Test Cases *** |
| 17 | |
| 18 | Test 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 Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 23 | REST Power On |
| 24 | |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 25 | ${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 Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 29 | |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 30 | # 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 Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 33 | |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 34 | 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 Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 52 | |
| 53 | |
| 54 | *** Keywords *** |
| 55 | |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 56 | Test Setup Execution |
| 57 | [Documentation] Do the test setup execution. |
Charles Paul Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 58 | |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 59 | Delete All Error Logs |
| 60 | Set Auto Reboot ${1} |
| 61 | Smart Power Off |
| 62 | |
| 63 | |
| 64 | Test Teardown Execution |
| 65 | [Documentation] Do the test teardown execution. |
| 66 | FFDC On Test Case Fail |
| 67 | Smart Power Off |
| 68 | |
| 69 | |
| 70 | Watchdog 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} |
| 75 | ... msg=Failed to get ${WATCHDOC_URI}, response = ${resp.status_code}. |
| 76 | |
| 77 | |
| 78 | Trigger 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}. |