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 |
George Keishing | fd9d8db | 2018-02-22 12:43:47 -0600 | [diff] [blame] | 8 | Resource ../lib/state_manager.robot |
Charles Paul Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 9 | |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 10 | Test Setup Test Setup Execution |
| 11 | Test Teardown Test Teardown Execution |
| 12 | |
| 13 | *** Variables *** |
| 14 | |
| 15 | ${sbe_side_bit_mask} ${0x00004000} |
| 16 | |
Charles Paul Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 17 | *** Test Cases *** |
| 18 | |
| 19 | Test 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 Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 24 | REST Power On |
| 25 | |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 26 | ${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 Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 30 | |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 31 | # Get which side the SBE is booted with. By default 0. |
George Keishing | fb218a1 | 2018-11-28 11:20:42 -0600 | [diff] [blame] | 32 | ${sbe_val}= Get SBE |
| 33 | ${sbe_cur_side}= Evaluate ${sbe_side_bit_mask} & ${sbe_val} |
Charles Paul Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 34 | |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 35 | 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 Keishing | fb218a1 | 2018-11-28 11:20:42 -0600 | [diff] [blame] | 41 | ${sbe_val}= Get SBE |
| 42 | ${sbe_orig_side}= Evaluate ${sbe_side_bit_mask} & ${sbe_val} |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 43 | |
| 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 Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 53 | |
| 54 | |
| 55 | *** Keywords *** |
| 56 | |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 57 | Test Setup Execution |
| 58 | [Documentation] Do the test setup execution. |
Charles Paul Hofer | bbc0f20 | 2017-09-29 11:48:39 -0500 | [diff] [blame] | 59 | |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 60 | Delete All Error Logs |
| 61 | Set Auto Reboot ${1} |
| 62 | Smart Power Off |
| 63 | |
| 64 | |
| 65 | Test Teardown Execution |
| 66 | [Documentation] Do the test teardown execution. |
| 67 | FFDC On Test Case Fail |
| 68 | Smart Power Off |
| 69 | |
| 70 | |
| 71 | Watchdog 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 Keishing | 42871db | 2018-01-29 09:59:32 -0600 | [diff] [blame] | 76 | ... msg=Failed to get ${WATCHDOG_URI}, response = ${resp.status_code}. |
George Keishing | fb837e3 | 2017-11-30 03:05:09 -0600 | [diff] [blame] | 77 | |
| 78 | |
| 79 | Trigger 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}. |