Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation This testsuite is for testing boot policy function. |
| 4 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 5 | Resource ../lib/rest_client.robot |
| 6 | Resource ../lib/ipmi_client.robot |
| 7 | Resource ../lib/utils.robot |
Sivas SRR | e1143ae | 2016-08-26 22:31:02 -0500 | [diff] [blame] | 8 | Resource ../lib/openbmc_ffdc.robot |
Rahul Maheshwari | ec8bf17 | 2017-02-21 07:41:08 -0600 | [diff] [blame] | 9 | Resource ../lib/state_manager.robot |
Sweta Potthuri | af741cb | 2017-07-04 09:41:17 -0500 | [diff] [blame] | 10 | Resource ../lib/boot_utils.robot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 11 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 12 | Suite Setup Suite Setup Execution |
| 13 | Test Setup Test Setup Execution |
Gunnar Mills | eac1af2 | 2016-11-14 15:30:09 -0600 | [diff] [blame] | 14 | Test Teardown FFDC On Test Case Fail |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 15 | Suite Teardown Suite Teardown Execution |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 16 | |
George Keishing | 1052aee | 2017-07-14 12:19:53 -0500 | [diff] [blame] | 17 | Force Tags boot_policy_test |
| 18 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 19 | *** Variables *** |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 20 | ${ONETIME} ${1} |
| 21 | ${PERMANENT} ${0} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 22 | |
| 23 | *** Test Cases *** |
| 24 | |
George Keishing | bc7cc58 | 2017-01-23 12:58:34 -0600 | [diff] [blame] | 25 | Set Boot Policy To ONETIME via REST |
| 26 | [Documentation] Set boot policy to ONETIME using REST URI and verify |
| 27 | ... using ipmitool. |
| 28 | [Tags] Set_Boot_Policy_To_ONETIME_via_REST |
George Keishing | 314cf85 | 2016-08-26 09:02:16 -0500 | [diff] [blame] | 29 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 30 | Set Boot Policy ${ONETIME} |
| 31 | ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled |
| 32 | Should Be Equal ${boot} ${ONETIME} |
Rahul Maheshwari | d8d22da | 2017-04-07 09:13:44 -0500 | [diff] [blame] | 33 | ${output}= Run IPMI Standard Command chassis bootparam get 5 |
| 34 | Should Contain ${output} Options apply to only next boot |
| 35 | |
George Keishing | bc7cc58 | 2017-01-23 12:58:34 -0600 | [diff] [blame] | 36 | Set Boot Policy To PERMANENT via REST |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 37 | [Documentation] Set boot policy to PERMANENT using REST URI and verify |
George Keishing | bc7cc58 | 2017-01-23 12:58:34 -0600 | [diff] [blame] | 38 | ... using ipmitool. |
| 39 | [Tags] Set_Boot_Policy_To_PERMANENT_via_REST |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 40 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 41 | Set Boot Policy ${PERMANENT} |
| 42 | ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled |
| 43 | Should Be Equal ${boot} ${PERMANENT} |
Rahul Maheshwari | d8d22da | 2017-04-07 09:13:44 -0500 | [diff] [blame] | 44 | ${output}= Run IPMI Standard Command chassis bootparam get 5 |
| 45 | Should Contain ${output} Options apply to all future boots |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 46 | |
George Keishing | bc7cc58 | 2017-01-23 12:58:34 -0600 | [diff] [blame] | 47 | Set Boot Policy To ONETIME via IPMITOOL |
| 48 | [Documentation] Set boot policy to ONETIME via ipmitool and verify |
| 49 | ... using REST URI. |
| 50 | [Tags] Set_Boot_Policy_To_ONETIME_via_IPMITOOL |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 51 | |
George Keishing | bc7cc58 | 2017-01-23 12:58:34 -0600 | [diff] [blame] | 52 | Run IPMI command 0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00 |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 53 | ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled |
| 54 | Should Be Equal ${boot} ${ONETIME} |
Rahul Maheshwari | d8d22da | 2017-04-07 09:13:44 -0500 | [diff] [blame] | 55 | ${output}= Run IPMI Standard Command chassis bootparam get 5 |
| 56 | Should Contain ${output} Options apply to only next boot |
George Keishing | 314cf85 | 2016-08-26 09:02:16 -0500 | [diff] [blame] | 57 | |
George Keishing | bc7cc58 | 2017-01-23 12:58:34 -0600 | [diff] [blame] | 58 | Set Boot Policy To PERMANENT via IPMITOOL |
| 59 | [Documentation] Set boot policy to PERMANENT via ipmitool and verify |
| 60 | ... using REST URI. |
| 61 | [Tags] Set_Boot_Policy_To_PERMANENT_via_IPMITOOL |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 62 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 63 | Run IPMI command 0x0 0x8 0x05 0xC0 0x00 0x00 0x00 0x0 |
| 64 | ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled |
| 65 | Should Be Equal ${boot} ${PERMANENT} |
Rahul Maheshwari | d8d22da | 2017-04-07 09:13:44 -0500 | [diff] [blame] | 66 | ${output}= Run IPMI Standard Command chassis bootparam get 5 |
| 67 | Should Contain ${output} Options apply to all future boots |
| 68 | |
George Keishing | bc7cc58 | 2017-01-23 12:58:34 -0600 | [diff] [blame] | 69 | Test Boot Order via REST |
| 70 | [Documentation] Set boot policy to PERMANENT and boot device to CDROM |
| 71 | ... and verify that the order doesn't change post power on. |
| 72 | [Tags] chassisboot Test_Boot_Order_via_REST |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 73 | |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 74 | Initiate Power Off |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 75 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 76 | Set Boot Policy ${PERMANENT} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 77 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 78 | Set Boot Source ${BOOT_SOURCE_CDROM} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 79 | |
Rahul Maheshwari | ec8bf17 | 2017-02-21 07:41:08 -0600 | [diff] [blame] | 80 | Initiate Host Boot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 81 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 82 | ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled |
| 83 | Should Be Equal ${boot} ${PERMANENT} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 84 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 85 | ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource |
| 86 | Should Be Equal ${flag} ${BOOT_SOURCE_CDROM} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 87 | |
George Keishing | d320688 | 2016-11-29 04:41:14 -0600 | [diff] [blame] | 88 | Persist ONETIME Boot Policy After Reset |
| 89 | [Documentation] Verify ONETIME boot policy order does not change |
| 90 | ... on warm reset. |
Sridevi Ramesh | b4e6795 | 2017-01-19 00:58:10 -0600 | [diff] [blame] | 91 | [Tags] chassisboot Persist_ONETIME_Boot_Policy_After_Reset |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 92 | |
Rahul Maheshwari | ec8bf17 | 2017-02-21 07:41:08 -0600 | [diff] [blame] | 93 | Initiate Host Boot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 94 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 95 | Set Boot Policy ${ONETIME} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 96 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 97 | Set Boot Source ${BOOT_SOURCE_NETWORK} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 98 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 99 | OBMC Reboot (off) |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 100 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 101 | ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled |
| 102 | Should Be Equal ${boot} ${ONETIME} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 103 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 104 | ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource |
| 105 | Should Be Equal ${flag} ${BOOT_SOURCE_NETWORK} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 106 | |
George Keishing | d320688 | 2016-11-29 04:41:14 -0600 | [diff] [blame] | 107 | Persist PERMANENT Boot Policy After Reset |
| 108 | [Documentation] Verify PERMANENT boot policy order does not change |
| 109 | ... on warm reset. |
| 110 | [Tags] chassisboot Persist_PERMANENT_Boot_Policy_After_Reset |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 111 | |
Rahul Maheshwari | ec8bf17 | 2017-02-21 07:41:08 -0600 | [diff] [blame] | 112 | Initiate Host Boot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 113 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 114 | Set Boot Policy ${PERMANENT} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 115 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 116 | Set Boot Source ${BOOT_SOURCE_CDROM} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 117 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 118 | OBMC Reboot (off) |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 119 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 120 | ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled |
| 121 | Should Be Equal ${boot} ${PERMANENT} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 122 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 123 | ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource |
| 124 | Should Be Equal ${flag} ${BOOT_SOURCE_CDROM} |
Rahul Maheshwari | a001dd2 | 2017-07-23 23:43:35 -0500 | [diff] [blame] | 125 | |
| 126 | Verify Boot Mode Persistency After BMC Reboot |
| 127 | [Documentation] Verify boot mode persistency after BMC reboot. |
| 128 | [Tags] Verify_Boot_Mode_Persistency_After_BMC_Reboot |
| 129 | [Teardown] Run Keywords Restore Bootmode Setting |
| 130 | ... AND FFDC On Test Case Fail |
| 131 | |
| 132 | # Record initial bootmode setting. |
George Keishing | b8783f1 | 2017-08-05 11:20:16 -0500 | [diff] [blame] | 133 | ${boot_mode}= Read Attribute |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 134 | ... ${CONTROL_HOST_URI}/boot BootMode |
Rahul Maheshwari | a001dd2 | 2017-07-23 23:43:35 -0500 | [diff] [blame] | 135 | Set Suite Variable ${initial_boot_mode} ${boot_mode} |
| 136 | |
| 137 | # Set bootmode to non default value. |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 138 | Set Boot Mode ${BOOT_MODE_SAFE} |
Rahul Maheshwari | a001dd2 | 2017-07-23 23:43:35 -0500 | [diff] [blame] | 139 | |
| 140 | Initiate BMC Reboot |
| 141 | Wait Until Keyword Succeeds 10 min 10 sec Is BMC Ready |
| 142 | |
George Keishing | b8783f1 | 2017-08-05 11:20:16 -0500 | [diff] [blame] | 143 | ${boot_mode_after}= Read Attribute |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 144 | ... ${CONTROL_HOST_URI}/boot BootMode |
Rahul Maheshwari | a001dd2 | 2017-07-23 23:43:35 -0500 | [diff] [blame] | 145 | |
George Keishing | b8783f1 | 2017-08-05 11:20:16 -0500 | [diff] [blame] | 146 | Should Be Equal As Strings |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 147 | ... ${boot_mode_after} ${BOOT_MODE_SAFE} |
Rahul Maheshwari | a001dd2 | 2017-07-23 23:43:35 -0500 | [diff] [blame] | 148 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 149 | *** Keywords *** |
| 150 | |
George Keishing | b8783f1 | 2017-08-05 11:20:16 -0500 | [diff] [blame] | 151 | Set Boot Mode |
| 152 | [Arguments] ${args} |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 153 | ${bootmode}= Set Variable ${args} |
George Keishing | b8783f1 | 2017-08-05 11:20:16 -0500 | [diff] [blame] | 154 | ${valueDict}= Create Dictionary data=${bootmode} |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 155 | Write Attribute ${CONTROL_HOST_URI}/boot/ BootMode data=${valueDict} |
George Keishing | b8783f1 | 2017-08-05 11:20:16 -0500 | [diff] [blame] | 156 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 157 | Set Boot Policy |
| 158 | [Arguments] ${args} |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 159 | ${bootpolicy}= Set Variable ${args} |
| 160 | ${valueDict}= Create Dictionary data=${bootpolicy} |
| 161 | Write Attribute ${CONTROL_URI}/host0/boot/one_time Enabled data=${valueDict} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 162 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 163 | Set Boot Source |
| 164 | [Documentation] Set given boot source. |
| 165 | [Arguments] ${boot_source} |
| 166 | # Description of argument(s): |
| 167 | # boot_source Boot source which need to be set. |
Sivas SRR | e1143ae | 2016-08-26 22:31:02 -0500 | [diff] [blame] | 168 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 169 | ${valueDict}= Create Dictionary data=${boot_source} |
| 170 | Write Attribute ${CONTROL_HOST_URI}/boot/ BootSource data=${valueDict} |
| 171 | |
| 172 | Suite Teardown Execution |
George Keishing | b440019 | 2017-02-01 11:10:30 -0600 | [diff] [blame] | 173 | [Documentation] Restore default settings. |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 174 | Set Boot Policy ${ONETIME} |
| 175 | Set Boot Source ${BOOT_SOURCE_DEFAULT} |
George Keishing | b440019 | 2017-02-01 11:10:30 -0600 | [diff] [blame] | 176 | Close All Connections |
George Keishing | 3ce958c | 2017-03-27 01:09:02 -0500 | [diff] [blame] | 177 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 178 | Test Setup Execution |
George Keishing | 3ce958c | 2017-03-27 01:09:02 -0500 | [diff] [blame] | 179 | [Documentation] Do the initial test setup. |
| 180 | Open Connection And Log In |
| 181 | Initialize DBUS cmd "boot_flags" |
| 182 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 183 | Suite Setup Execution |
George Keishing | 3ce958c | 2017-03-27 01:09:02 -0500 | [diff] [blame] | 184 | [Documentation] Do the initial suite setup. |
George Keishing | f142668 | 2017-07-12 23:17:17 -0500 | [diff] [blame] | 185 | |
Sweta Potthuri | a609452 | 2017-10-12 03:45:22 -0500 | [diff] [blame^] | 186 | # Reboot host to re-power on clean if host is not "off". |
| 187 | ${current_state}= Get Host State |
| 188 | Run Keyword If '${current_state}' == 'Off' |
| 189 | ... Initiate Host Boot |
| 190 | ... ELSE Initiate Host Reboot |
| 191 | |
| 192 | Wait Until Keyword Succeeds |
| 193 | ... 10 min 10 sec Is OS Starting |
George Keishing | 3ce958c | 2017-03-27 01:09:02 -0500 | [diff] [blame] | 194 | |
Rahul Maheshwari | a001dd2 | 2017-07-23 23:43:35 -0500 | [diff] [blame] | 195 | Restore Bootmode Setting |
| 196 | [Documentation] Restore initial bootmode setting. |
| 197 | |
George Keishing | b8783f1 | 2017-08-05 11:20:16 -0500 | [diff] [blame] | 198 | Set Boot Mode ${initial_boot_mode} |