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