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