Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
George Keishing | 6b59f1d | 2016-10-12 04:14:53 -0500 | [diff] [blame] | 2 | Documentation This suite verifies the power restore policy supported by |
| 3 | ... REST Interfaces. |
| 4 | ... Refer here for documentation on the REST interfaces |
| 5 | ... https://github.com/openbmc/docs/blob/master/rest-api.md |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 6 | |
| 7 | Resource ../lib/rest_client.robot |
| 8 | Resource ../lib/pdu/pdu.robot |
| 9 | Resource ../lib/utils.robot |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 10 | Resource ../lib/openbmc_ffdc.robot |
George Keishing | 6b59f1d | 2016-10-12 04:14:53 -0500 | [diff] [blame] | 11 | Resource ../lib/boot/boot_resource_master.robot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 12 | |
| 13 | |
| 14 | Library SSHLibrary |
| 15 | |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 16 | Test Teardown Log FFDC |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 17 | Force Tags chassisboot bmcreboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 18 | |
George Keishing | 6b59f1d | 2016-10-12 04:14:53 -0500 | [diff] [blame] | 19 | *** Variables *** |
| 20 | ${HOST_SETTING} /org/openbmc/settings/host0 |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 21 | |
George Keishing | 6b59f1d | 2016-10-12 04:14:53 -0500 | [diff] [blame] | 22 | *** Test Cases *** |
George Keishing | d277f83 | 2016-10-07 12:04:50 -0500 | [diff] [blame] | 23 | |
George Keishing | 6b59f1d | 2016-10-12 04:14:53 -0500 | [diff] [blame] | 24 | Set the power restore policy |
| 25 | #Policy Expected System State Next System State |
George Keishing | d277f83 | 2016-10-07 12:04:50 -0500 | [diff] [blame] | 26 | |
George Keishing | 6b59f1d | 2016-10-12 04:14:53 -0500 | [diff] [blame] | 27 | LEAVE_OFF HOST_POWERED_OFF HOST_POWERED_OFF |
| 28 | LEAVE_OFF HOST_BOOTED HOST_POWERED_OFF |
| 29 | ALWAYS_POWER_ON HOST_POWERED_OFF HOST_BOOTED |
| 30 | ALWAYS_POWER_ON HOST_BOOTED HOST_BOOTED |
| 31 | RESTORE_LAST_STATE HOST_BOOTED HOST_BOOTED |
| 32 | RESTORE_LAST_STATE HOST_POWERED_OFF HOST_POWERED_OFF |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 33 | |
George Keishing | 6b59f1d | 2016-10-12 04:14:53 -0500 | [diff] [blame] | 34 | [Documentation] Test to validate restore policy attribute functionality. |
| 35 | ... Policy: |
| 36 | ... System policy to restore on power cycle |
| 37 | ... Expected System State: |
| 38 | ... State where system should be before running the |
| 39 | ... test case |
| 40 | ... Next System State: |
| 41 | ... After power cycle, system should reach this |
| 42 | ... specific state |
| 43 | |
| 44 | [Template] Set Restore Policy |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 45 | |
| 46 | ***keywords*** |
George Keishing | 6b59f1d | 2016-10-12 04:14:53 -0500 | [diff] [blame] | 47 | |
| 48 | Set Restore Policy |
| 49 | [arguments] ${policy} ${expectedState} ${nextState} |
| 50 | |
| 51 | Set Policy Setting ${policy} |
| 52 | |
| 53 | ${currentState}= |
| 54 | ... Read Attribute ${HOST_SETTING} system_state |
| 55 | |
| 56 | Log Current System State= ${currentState} |
| 57 | Log Expected System State= ${expectedState} |
| 58 | Log Next System State= ${nextState} |
| 59 | |
| 60 | Run Keyword If |
| 61 | ... '${currentState}' != '${expectedState}' |
| 62 | ... Set Initial Test State ${expectedState} |
| 63 | |
| 64 | Log "Doing power cycle" |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 65 | PDU Power Cycle |
George Keishing | d277f83 | 2016-10-07 12:04:50 -0500 | [diff] [blame] | 66 | Check If BMC is Up 5 min 10 sec |
George Keishing | 6b59f1d | 2016-10-12 04:14:53 -0500 | [diff] [blame] | 67 | Log "BMC is Online now" |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 68 | |
George Keishing | 6b59f1d | 2016-10-12 04:14:53 -0500 | [diff] [blame] | 69 | Wait Until Keyword Succeeds |
| 70 | ... 5 min 10 sec System State ${nextState} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 71 | |
| 72 | |
George Keishing | 6b59f1d | 2016-10-12 04:14:53 -0500 | [diff] [blame] | 73 | Set Policy Setting |
| 74 | [Documentation] Set the given test policy |
| 75 | [arguments] ${policy} |
| 76 | |
| 77 | ${valueDict} = create dictionary data=${policy} |
| 78 | Write Attribute ${HOST_SETTING} power_policy data=${valueDict} |
| 79 | ${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy |
| 80 | Should Be Equal ${currentPolicy} ${policy} |
| 81 | |
| 82 | |
| 83 | Set Initial Test State |
| 84 | [Documentation] Poweron if ON expected, Poweroff if OFF expected |
| 85 | ... to initial state of the test. |
| 86 | [arguments] ${expectedState} |
| 87 | |
| 88 | Run Keyword If |
| 89 | ... '${expectedState}' == 'HOST_BOOTED' |
| 90 | ... BMC Power On |
| 91 | |
| 92 | Run Keyword If |
| 93 | ... '${expectedState}' == 'HOST_POWERED_OFF' |
| 94 | ... BMC Power Off |
| 95 | |
| 96 | |
| 97 | System State |
| 98 | [arguments] ${nextState} |
| 99 | ${afterPduSystemState}= |
| 100 | ... Read Attribute ${HOST_SETTING} system_state |
| 101 | Should be equal ${afterPduSystemState} ${nextState} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 102 | |