Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This suite will verifiy the power restore policy rest Interfaces |
| 3 | ... Details of valid interfaces can be found here... |
| 4 | ... https://github.com/openbmc/docs/blob/master/rest-api.md |
| 5 | |
| 6 | Resource ../lib/rest_client.robot |
| 7 | Resource ../lib/pdu/pdu.robot |
| 8 | Resource ../lib/utils.robot |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 9 | Resource ../lib/openbmc_ffdc.robot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 10 | |
| 11 | |
| 12 | Library SSHLibrary |
| 13 | |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 14 | Test Teardown Log FFDC |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 15 | Force Tags chassisboot bmcreboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 16 | |
| 17 | ***test cases*** |
| 18 | |
| 19 | Set the power restore policy Policy ExpectedSystemState NextSystemState |
George Keishing | d277f83 | 2016-10-07 12:04:50 -0500 | [diff] [blame] | 20 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 21 | LEAVE_OFF HOST_POWERED_OFF HOST_POWERED_OFF |
| 22 | LEAVE_OFF HOST_POWERED_ON HOST_POWERED_OFF |
| 23 | ALWAYS_POWER_ON HOST_POWERED_OFF HOST_POWERED_ON |
| 24 | ALWAYS_POWER_ON HOST_POWERED_ON HOST_POWERED_ON |
| 25 | RESTORE_LAST_STATE HOST_POWERED_ON HOST_POWERED_ON |
George Keishing | d277f83 | 2016-10-07 12:04:50 -0500 | [diff] [blame] | 26 | RESTORE_LAST_STATE HOST_POWERED_OFF HOST_POWERED_OFF |
| 27 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 28 | [Documentation] This test case sets the pilicy as given under the policy attribute. |
| 29 | ... ExpectedSystemState:-is the state where system should be before running the test case |
George Keishing | d277f83 | 2016-10-07 12:04:50 -0500 | [diff] [blame] | 30 | ... NextSystemState:-is After Power cycle system should reach to this state |
| 31 | ... if the system is not at the Expected System State,This test case brings the system |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 32 | ... in the Expected state then do the power cycle. |
| 33 | |
| 34 | [Template] setRestorePolicy |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 35 | |
| 36 | ***keywords*** |
| 37 | setRestorePolicy |
| 38 | [arguments] ${policy} ${expectedSystemState} ${nextSystemState} |
| 39 | ${valueDict} = create dictionary data=${policy} |
| 40 | Write Attribute /org/openbmc/settings/host0 power_policy data=${valueDict} |
| 41 | ${currentPolicy}= Read Attribute /org/openbmc/settings/host0 power_policy |
| 42 | Should Be Equal ${currentPolicy} ${policy} |
| 43 | ${currentSystemState}= Read Attribute /org/openbmc/settings/host0 system_state |
George Keishing | d277f83 | 2016-10-07 12:04:50 -0500 | [diff] [blame] | 44 | log Many "CurrentSystemState=" ${currentSystemState} |
| 45 | log Many "ExpectedSystemState=" ${expectedSystemState} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 46 | log Many "NextSystemState=" ${nextSystemState} |
| 47 | Run Keyword If '${currentSystemState}' != '${expectedSystemState}' and '${expectedSystemState}' == 'HOST_POWERED_ON' powerOnHost |
| 48 | Run Keyword If '${currentSystemState}' != '${expectedSystemState}' and '${expectedSystemState}' == 'HOST_POWERED_OFF' powerOffHost |
| 49 | log to console "Doing power cycle" |
| 50 | PDU Power Cycle |
George Keishing | d277f83 | 2016-10-07 12:04:50 -0500 | [diff] [blame] | 51 | Check If BMC is Up 5 min 10 sec |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 52 | log to console "Host is pingable now" |
| 53 | Sleep 100sec |
| 54 | ${afterPduSystemState}= Read Attribute /org/openbmc/settings/host0 system_state |
| 55 | Should be equal ${afterPduSystemState} ${nextSystemState} |
| 56 | |
| 57 | powerOffHost |
| 58 | log to console "Powering off the host" |
George Keishing | d277f83 | 2016-10-07 12:04:50 -0500 | [diff] [blame] | 59 | @{arglist}= Create List |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 60 | ${args}= Create Dictionary data=@{arglist} |
| 61 | ${resp}= Call Method /org/openbmc/control/chassis0/ powerOff data=${args} |
| 62 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 63 | ${json} = to json ${resp.content} |
| 64 | should be equal as strings ${json['status']} ok |
| 65 | sleep 30sec |
| 66 | ${currentSystemState}= Read Attribute /org/openbmc/settings/host0 system_state |
| 67 | Should be equal ${currentSystemState} HOST_POWERED_OFF |
| 68 | |
| 69 | powerOnHost |
| 70 | log to console "Powering on the host" |
George Keishing | d277f83 | 2016-10-07 12:04:50 -0500 | [diff] [blame] | 71 | @{arglist}= Create List |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 72 | ${args}= Create Dictionary data=@{arglist} |
| 73 | ${resp}= Call Method /org/openbmc/control/chassis0/ powerOn data=${args} |
| 74 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 75 | ${json} = to json ${resp.content} |
| 76 | should be equal as strings ${json['status']} ok |
| 77 | sleep 30sec |
| 78 | ${currentSystemState}= Read Attribute /org/openbmc/settings/host0 system_state |
| 79 | Should be equal ${currentSystemState} HOST_POWERED_ON |
| 80 | |
| 81 | |
| 82 | |