blob: ee65546936478a350bbe39b83cf9c098a0730236 [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
2
3Documentation This testsuite is for testing boot policy function.
4
George Keishing4d6c1da2016-07-15 05:51:22 -05005Resource ../lib/rest_client.robot
6Resource ../lib/ipmi_client.robot
7Resource ../lib/utils.robot
Sivas SRRe1143ae2016-08-26 22:31:02 -05008Resource ../lib/openbmc_ffdc.robot
Rahul Maheshwariec8bf172017-02-21 07:41:08 -06009Resource ../lib/state_manager.robot
Sweta Potthuriaf741cb2017-07-04 09:41:17 -050010Resource ../lib/boot_utils.robot
Chris Austenb29d2e82016-06-07 12:25:35 -050011
Sweta Potthuria6094522017-10-12 03:45:22 -050012Suite Setup Suite Setup Execution
13Test Setup Test Setup Execution
Gunnar Millseac1af22016-11-14 15:30:09 -060014Test Teardown FFDC On Test Case Fail
Sweta Potthuria6094522017-10-12 03:45:22 -050015Suite Teardown Suite Teardown Execution
Chris Austenb29d2e82016-06-07 12:25:35 -050016
George Keishing1052aee2017-07-14 12:19:53 -050017Force Tags boot_policy_test
18
Chris Austenb29d2e82016-06-07 12:25:35 -050019*** Variables ***
Sweta Potthuria6094522017-10-12 03:45:22 -050020${ONETIME} ${1}
21${PERMANENT} ${0}
Chris Austenb29d2e82016-06-07 12:25:35 -050022
23*** Test Cases ***
24
George Keishingbc7cc582017-01-23 12:58:34 -060025Set 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 Keishing314cf852016-08-26 09:02:16 -050029
Sweta Potthuria6094522017-10-12 03:45:22 -050030 Set Boot Policy ${ONETIME}
31 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
32 Should Be Equal ${boot} ${ONETIME}
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050033 ${output}= Run IPMI Standard Command chassis bootparam get 5
34 Should Contain ${output} Options apply to only next boot
35
George Keishingbc7cc582017-01-23 12:58:34 -060036Set Boot Policy To PERMANENT via REST
Sweta Potthuria6094522017-10-12 03:45:22 -050037 [Documentation] Set boot policy to PERMANENT using REST URI and verify
George Keishingbc7cc582017-01-23 12:58:34 -060038 ... using ipmitool.
39 [Tags] Set_Boot_Policy_To_PERMANENT_via_REST
Chris Austenb29d2e82016-06-07 12:25:35 -050040
Sweta Potthuria6094522017-10-12 03:45:22 -050041 Set Boot Policy ${PERMANENT}
42 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
43 Should Be Equal ${boot} ${PERMANENT}
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050044 ${output}= Run IPMI Standard Command chassis bootparam get 5
45 Should Contain ${output} Options apply to all future boots
Chris Austenb29d2e82016-06-07 12:25:35 -050046
George Keishingbc7cc582017-01-23 12:58:34 -060047Set 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 Austenb29d2e82016-06-07 12:25:35 -050051
George Keishingbc7cc582017-01-23 12:58:34 -060052 Run IPMI command 0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
Sweta Potthuria6094522017-10-12 03:45:22 -050053 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
54 Should Be Equal ${boot} ${ONETIME}
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050055 ${output}= Run IPMI Standard Command chassis bootparam get 5
56 Should Contain ${output} Options apply to only next boot
George Keishing314cf852016-08-26 09:02:16 -050057
George Keishingbc7cc582017-01-23 12:58:34 -060058Set 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 Austenb29d2e82016-06-07 12:25:35 -050062
Sweta Potthuria6094522017-10-12 03:45:22 -050063 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 Maheshwarid8d22da2017-04-07 09:13:44 -050066 ${output}= Run IPMI Standard Command chassis bootparam get 5
67 Should Contain ${output} Options apply to all future boots
68
George Keishingbc7cc582017-01-23 12:58:34 -060069Test 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 Austenb29d2e82016-06-07 12:25:35 -050073
root442f0ef2016-08-04 20:23:05 +000074 Initiate Power Off
Chris Austenb29d2e82016-06-07 12:25:35 -050075
Sweta Potthuria6094522017-10-12 03:45:22 -050076 Set Boot Policy ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -050077
Sweta Potthuria6094522017-10-12 03:45:22 -050078 Set Boot Source ${BOOT_SOURCE_CDROM}
Chris Austenb29d2e82016-06-07 12:25:35 -050079
Rahul Maheshwariec8bf172017-02-21 07:41:08 -060080 Initiate Host Boot
Chris Austenb29d2e82016-06-07 12:25:35 -050081
Sweta Potthuria6094522017-10-12 03:45:22 -050082 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
83 Should Be Equal ${boot} ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -050084
Sweta Potthuria6094522017-10-12 03:45:22 -050085 ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
86 Should Be Equal ${flag} ${BOOT_SOURCE_CDROM}
Chris Austenb29d2e82016-06-07 12:25:35 -050087
George Keishingd3206882016-11-29 04:41:14 -060088Persist ONETIME Boot Policy After Reset
89 [Documentation] Verify ONETIME boot policy order does not change
90 ... on warm reset.
Sridevi Rameshb4e67952017-01-19 00:58:10 -060091 [Tags] chassisboot Persist_ONETIME_Boot_Policy_After_Reset
causten147f5752016-08-11 16:24:45 -050092
Rahul Maheshwariec8bf172017-02-21 07:41:08 -060093 Initiate Host Boot
Chris Austenb29d2e82016-06-07 12:25:35 -050094
Sweta Potthuria6094522017-10-12 03:45:22 -050095 Set Boot Policy ${ONETIME}
Chris Austenb29d2e82016-06-07 12:25:35 -050096
Sweta Potthuria6094522017-10-12 03:45:22 -050097 Set Boot Source ${BOOT_SOURCE_NETWORK}
Chris Austenb29d2e82016-06-07 12:25:35 -050098
Sweta Potthuria6094522017-10-12 03:45:22 -050099 OBMC Reboot (off)
Chris Austenb29d2e82016-06-07 12:25:35 -0500100
Sweta Potthuria6094522017-10-12 03:45:22 -0500101 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
102 Should Be Equal ${boot} ${ONETIME}
Chris Austenb29d2e82016-06-07 12:25:35 -0500103
Sweta Potthuria6094522017-10-12 03:45:22 -0500104 ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
105 Should Be Equal ${flag} ${BOOT_SOURCE_NETWORK}
Chris Austenb29d2e82016-06-07 12:25:35 -0500106
George Keishingd3206882016-11-29 04:41:14 -0600107Persist 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 Austenb29d2e82016-06-07 12:25:35 -0500111
Rahul Maheshwariec8bf172017-02-21 07:41:08 -0600112 Initiate Host Boot
Chris Austenb29d2e82016-06-07 12:25:35 -0500113
Sweta Potthuria6094522017-10-12 03:45:22 -0500114 Set Boot Policy ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -0500115
Sweta Potthuria6094522017-10-12 03:45:22 -0500116 Set Boot Source ${BOOT_SOURCE_CDROM}
Chris Austenb29d2e82016-06-07 12:25:35 -0500117
Sweta Potthuria6094522017-10-12 03:45:22 -0500118 OBMC Reboot (off)
Chris Austenb29d2e82016-06-07 12:25:35 -0500119
Sweta Potthuria6094522017-10-12 03:45:22 -0500120 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
121 Should Be Equal ${boot} ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -0500122
Sweta Potthuria6094522017-10-12 03:45:22 -0500123 ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
124 Should Be Equal ${flag} ${BOOT_SOURCE_CDROM}
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500125
126Verify 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 Keishingb8783f12017-08-05 11:20:16 -0500133 ${boot_mode}= Read Attribute
Sweta Potthuria6094522017-10-12 03:45:22 -0500134 ... ${CONTROL_HOST_URI}/boot BootMode
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500135 Set Suite Variable ${initial_boot_mode} ${boot_mode}
136
137 # Set bootmode to non default value.
Sweta Potthuria6094522017-10-12 03:45:22 -0500138 Set Boot Mode ${BOOT_MODE_SAFE}
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500139
140 Initiate BMC Reboot
141 Wait Until Keyword Succeeds 10 min 10 sec Is BMC Ready
142
George Keishingb8783f12017-08-05 11:20:16 -0500143 ${boot_mode_after}= Read Attribute
Sweta Potthuria6094522017-10-12 03:45:22 -0500144 ... ${CONTROL_HOST_URI}/boot BootMode
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500145
George Keishingb8783f12017-08-05 11:20:16 -0500146 Should Be Equal As Strings
Sweta Potthuria6094522017-10-12 03:45:22 -0500147 ... ${boot_mode_after} ${BOOT_MODE_SAFE}
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500148
Chris Austenb29d2e82016-06-07 12:25:35 -0500149*** Keywords ***
150
George Keishingb8783f12017-08-05 11:20:16 -0500151Set Boot Mode
152 [Arguments] ${args}
Sweta Potthuria6094522017-10-12 03:45:22 -0500153 ${bootmode}= Set Variable ${args}
George Keishingb8783f12017-08-05 11:20:16 -0500154 ${valueDict}= Create Dictionary data=${bootmode}
Sweta Potthuria6094522017-10-12 03:45:22 -0500155 Write Attribute ${CONTROL_HOST_URI}/boot/ BootMode data=${valueDict}
George Keishingb8783f12017-08-05 11:20:16 -0500156
Chris Austenb29d2e82016-06-07 12:25:35 -0500157Set Boot Policy
158 [Arguments] ${args}
Sweta Potthuria6094522017-10-12 03:45:22 -0500159 ${bootpolicy}= Set Variable ${args}
160 ${valueDict}= Create Dictionary data=${bootpolicy}
161 Write Attribute ${CONTROL_URI}/host0/boot/one_time Enabled data=${valueDict}
Chris Austenb29d2e82016-06-07 12:25:35 -0500162
Sweta Potthuria6094522017-10-12 03:45:22 -0500163Set 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 SRRe1143ae2016-08-26 22:31:02 -0500168
Sweta Potthuria6094522017-10-12 03:45:22 -0500169 ${valueDict}= Create Dictionary data=${boot_source}
170 Write Attribute ${CONTROL_HOST_URI}/boot/ BootSource data=${valueDict}
171
172Suite Teardown Execution
George Keishingb4400192017-02-01 11:10:30 -0600173 [Documentation] Restore default settings.
Sweta Potthuria6094522017-10-12 03:45:22 -0500174 Set Boot Policy ${ONETIME}
175 Set Boot Source ${BOOT_SOURCE_DEFAULT}
George Keishingb4400192017-02-01 11:10:30 -0600176 Close All Connections
George Keishing3ce958c2017-03-27 01:09:02 -0500177
Sweta Potthuria6094522017-10-12 03:45:22 -0500178Test Setup Execution
George Keishing3ce958c2017-03-27 01:09:02 -0500179 [Documentation] Do the initial test setup.
180 Open Connection And Log In
181 Initialize DBUS cmd "boot_flags"
182
Sweta Potthuria6094522017-10-12 03:45:22 -0500183Suite Setup Execution
George Keishing3ce958c2017-03-27 01:09:02 -0500184 [Documentation] Do the initial suite setup.
George Keishingf1426682017-07-12 23:17:17 -0500185
Sweta Potthuria6094522017-10-12 03:45:22 -0500186 # 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 Keishing3ce958c2017-03-27 01:09:02 -0500194
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500195Restore Bootmode Setting
196 [Documentation] Restore initial bootmode setting.
197
George Keishingb8783f12017-08-05 11:20:16 -0500198 Set Boot Mode ${initial_boot_mode}