blob: a65c46992ce76d8c1fabe6cb281c6a78c9c225bd [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
Gunnar Millseac1af22016-11-14 15:30:09 -060013Test Teardown FFDC On Test Case Fail
Sweta Potthuria6094522017-10-12 03:45:22 -050014Suite Teardown Suite Teardown Execution
Chris Austenb29d2e82016-06-07 12:25:35 -050015
George Keishing1052aee2017-07-14 12:19:53 -050016Force Tags boot_policy_test
17
Chris Austenb29d2e82016-06-07 12:25:35 -050018*** Variables ***
Sweta Potthuria6094522017-10-12 03:45:22 -050019${ONETIME} ${1}
20${PERMANENT} ${0}
Chris Austenb29d2e82016-06-07 12:25:35 -050021
George Keishing162e7332017-10-23 01:16:00 -050022${stack_mode} skip
23
Chris Austenb29d2e82016-06-07 12:25:35 -050024*** Test Cases ***
25
George Keishingbc7cc582017-01-23 12:58:34 -060026Set Boot Policy To ONETIME via REST
27 [Documentation] Set boot policy to ONETIME using REST URI and verify
28 ... using ipmitool.
29 [Tags] Set_Boot_Policy_To_ONETIME_via_REST
George Keishing314cf852016-08-26 09:02:16 -050030
Sweta Potthuria6094522017-10-12 03:45:22 -050031 Set Boot Policy ${ONETIME}
George Keishingdf3e65f2018-12-18 13:06:56 -060032 ${boot}= Read Attribute ${CONTROL_URI}host0/boot/one_time Enabled
Sweta Potthuria6094522017-10-12 03:45:22 -050033 Should Be Equal ${boot} ${ONETIME}
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050034 ${output}= Run IPMI Standard Command chassis bootparam get 5
35 Should Contain ${output} Options apply to only next boot
36
George Keishingbc7cc582017-01-23 12:58:34 -060037Set Boot Policy To PERMANENT via REST
Sweta Potthuria6094522017-10-12 03:45:22 -050038 [Documentation] Set boot policy to PERMANENT using REST URI and verify
George Keishingbc7cc582017-01-23 12:58:34 -060039 ... using ipmitool.
40 [Tags] Set_Boot_Policy_To_PERMANENT_via_REST
Chris Austenb29d2e82016-06-07 12:25:35 -050041
Sweta Potthuria6094522017-10-12 03:45:22 -050042 Set Boot Policy ${PERMANENT}
George Keishingdf3e65f2018-12-18 13:06:56 -060043 ${boot}= Read Attribute ${CONTROL_URI}host0/boot/one_time Enabled
Sweta Potthuria6094522017-10-12 03:45:22 -050044 Should Be Equal ${boot} ${PERMANENT}
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050045 ${output}= Run IPMI Standard Command chassis bootparam get 5
46 Should Contain ${output} Options apply to all future boots
Chris Austenb29d2e82016-06-07 12:25:35 -050047
George Keishingbc7cc582017-01-23 12:58:34 -060048Set 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 Austenb29d2e82016-06-07 12:25:35 -050052
George Keishingbc7cc582017-01-23 12:58:34 -060053 Run IPMI command 0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
George Keishingdf3e65f2018-12-18 13:06:56 -060054 ${boot}= Read Attribute ${CONTROL_URI}host0/boot/one_time Enabled
Sweta Potthuria6094522017-10-12 03:45:22 -050055 Should Be Equal ${boot} ${ONETIME}
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050056 ${output}= Run IPMI Standard Command chassis bootparam get 5
57 Should Contain ${output} Options apply to only next boot
George Keishing314cf852016-08-26 09:02:16 -050058
George Keishingbc7cc582017-01-23 12:58:34 -060059Set 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 Austenb29d2e82016-06-07 12:25:35 -050063
Sweta Potthuria6094522017-10-12 03:45:22 -050064 Run IPMI command 0x0 0x8 0x05 0xC0 0x00 0x00 0x00 0x0
George Keishingdf3e65f2018-12-18 13:06:56 -060065 ${boot}= Read Attribute ${CONTROL_URI}host0/boot/one_time Enabled
Sweta Potthuria6094522017-10-12 03:45:22 -050066 Should Be Equal ${boot} ${PERMANENT}
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050067 ${output}= Run IPMI Standard Command chassis bootparam get 5
68 Should Contain ${output} Options apply to all future boots
69
George Keishingbc7cc582017-01-23 12:58:34 -060070Test Boot Order via REST
71 [Documentation] Set boot policy to PERMANENT and boot device to CDROM
72 ... and verify that the order doesn't change post power on.
George Keishingac8661e2022-02-10 00:36:12 -060073 [Tags] Test_Boot_Order_via_REST
Chris Austenb29d2e82016-06-07 12:25:35 -050074
Chris Austenb29d2e82016-06-07 12:25:35 -050075
Sweta Potthuria6094522017-10-12 03:45:22 -050076 Set Boot Policy ${PERMANENT}
Sweta Potthuria6094522017-10-12 03:45:22 -050077 Set Boot Source ${BOOT_SOURCE_CDROM}
Chris Austenb29d2e82016-06-07 12:25:35 -050078
George Keishingdf3e65f2018-12-18 13:06:56 -060079 ${boot}= Read Attribute ${CONTROL_URI}host0/boot/one_time Enabled
Sweta Potthuria6094522017-10-12 03:45:22 -050080 Should Be Equal ${boot} ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -050081
George Keishingdf3e65f2018-12-18 13:06:56 -060082 ${flag}= Read Attribute ${CONTROL_URI}host0/boot/ BootSource
Sweta Potthuria6094522017-10-12 03:45:22 -050083 Should Be Equal ${flag} ${BOOT_SOURCE_CDROM}
Chris Austenb29d2e82016-06-07 12:25:35 -050084
George Keishingd3206882016-11-29 04:41:14 -060085Persist ONETIME Boot Policy After Reset
86 [Documentation] Verify ONETIME boot policy order does not change
87 ... on warm reset.
George Keishingac8661e2022-02-10 00:36:12 -060088 [Tags] Persist_ONETIME_Boot_Policy_After_Reset
causten147f5752016-08-11 16:24:45 -050089
Sweta Potthuria6094522017-10-12 03:45:22 -050090 Set Boot Policy ${ONETIME}
Sweta Potthuria6094522017-10-12 03:45:22 -050091 Set Boot Source ${BOOT_SOURCE_NETWORK}
Chris Austenb29d2e82016-06-07 12:25:35 -050092
Sweta Potthuria6094522017-10-12 03:45:22 -050093 OBMC Reboot (off)
Chris Austenb29d2e82016-06-07 12:25:35 -050094
George Keishingdf3e65f2018-12-18 13:06:56 -060095 ${boot}= Read Attribute ${CONTROL_URI}host0/boot/one_time Enabled
Sweta Potthuria6094522017-10-12 03:45:22 -050096 Should Be Equal ${boot} ${ONETIME}
Chris Austenb29d2e82016-06-07 12:25:35 -050097
George Keishingdf3e65f2018-12-18 13:06:56 -060098 ${flag}= Read Attribute ${CONTROL_URI}host0/boot/ BootSource
Sweta Potthuria6094522017-10-12 03:45:22 -050099 Should Be Equal ${flag} ${BOOT_SOURCE_NETWORK}
Chris Austenb29d2e82016-06-07 12:25:35 -0500100
George Keishingd3206882016-11-29 04:41:14 -0600101Persist PERMANENT Boot Policy After Reset
102 [Documentation] Verify PERMANENT boot policy order does not change
103 ... on warm reset.
George Keishingac8661e2022-02-10 00:36:12 -0600104 [Tags] Persist_PERMANENT_Boot_Policy_After_Reset
Chris Austenb29d2e82016-06-07 12:25:35 -0500105
Sweta Potthuria6094522017-10-12 03:45:22 -0500106 Set Boot Policy ${PERMANENT}
Sweta Potthuria6094522017-10-12 03:45:22 -0500107 Set Boot Source ${BOOT_SOURCE_CDROM}
Chris Austenb29d2e82016-06-07 12:25:35 -0500108
Sweta Potthuria6094522017-10-12 03:45:22 -0500109 OBMC Reboot (off)
Chris Austenb29d2e82016-06-07 12:25:35 -0500110
George Keishingdf3e65f2018-12-18 13:06:56 -0600111 ${boot}= Read Attribute ${CONTROL_URI}host0/boot/one_time Enabled
Sweta Potthuria6094522017-10-12 03:45:22 -0500112 Should Be Equal ${boot} ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -0500113
George Keishingdf3e65f2018-12-18 13:06:56 -0600114 ${flag}= Read Attribute ${CONTROL_URI}host0/boot/ BootSource
Sweta Potthuria6094522017-10-12 03:45:22 -0500115 Should Be Equal ${flag} ${BOOT_SOURCE_CDROM}
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500116
117Verify Boot Mode Persistency After BMC Reboot
118 [Documentation] Verify boot mode persistency after BMC reboot.
119 [Tags] Verify_Boot_Mode_Persistency_After_BMC_Reboot
120 [Teardown] Run Keywords Restore Bootmode Setting
121 ... AND FFDC On Test Case Fail
122
123 # Record initial bootmode setting.
George Keishingb8783f12017-08-05 11:20:16 -0500124 ${boot_mode}= Read Attribute
Sweta Potthuria6094522017-10-12 03:45:22 -0500125 ... ${CONTROL_HOST_URI}/boot BootMode
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500126 Set Suite Variable ${initial_boot_mode} ${boot_mode}
127
128 # Set bootmode to non default value.
Sweta Potthuria6094522017-10-12 03:45:22 -0500129 Set Boot Mode ${BOOT_MODE_SAFE}
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500130
George Keishinga3475c32017-12-06 04:56:07 -0600131 OBMC Reboot (off)
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500132
George Keishingb8783f12017-08-05 11:20:16 -0500133 ${boot_mode_after}= Read Attribute
Sweta Potthuria6094522017-10-12 03:45:22 -0500134 ... ${CONTROL_HOST_URI}/boot BootMode
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500135
George Keishingb8783f12017-08-05 11:20:16 -0500136 Should Be Equal As Strings
Sweta Potthuria6094522017-10-12 03:45:22 -0500137 ... ${boot_mode_after} ${BOOT_MODE_SAFE}
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500138
Chris Austenb29d2e82016-06-07 12:25:35 -0500139*** Keywords ***
140
George Keishingb8783f12017-08-05 11:20:16 -0500141Set Boot Mode
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -0500142 [Documentation] Set the host boot mode via REST.
George Keishingb8783f12017-08-05 11:20:16 -0500143 [Arguments] ${args}
Sweta Potthuria6094522017-10-12 03:45:22 -0500144 ${bootmode}= Set Variable ${args}
George Keishingb8783f12017-08-05 11:20:16 -0500145 ${valueDict}= Create Dictionary data=${bootmode}
Sweta Potthuria6094522017-10-12 03:45:22 -0500146 Write Attribute ${CONTROL_HOST_URI}/boot/ BootMode data=${valueDict}
George Keishingb8783f12017-08-05 11:20:16 -0500147
Chris Austenb29d2e82016-06-07 12:25:35 -0500148Set Boot Policy
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -0500149 [Documentation] Set the host boot policy via REST.
Chris Austenb29d2e82016-06-07 12:25:35 -0500150 [Arguments] ${args}
Sweta Potthuria6094522017-10-12 03:45:22 -0500151 ${bootpolicy}= Set Variable ${args}
152 ${valueDict}= Create Dictionary data=${bootpolicy}
George Keishing162e7332017-10-23 01:16:00 -0500153 Write Attribute
154 ... ${CONTROL_HOST_URI}/boot/one_time Enabled data=${valueDict}
Chris Austenb29d2e82016-06-07 12:25:35 -0500155
Sweta Potthuria6094522017-10-12 03:45:22 -0500156Set Boot Source
157 [Documentation] Set given boot source.
158 [Arguments] ${boot_source}
159 # Description of argument(s):
160 # boot_source Boot source which need to be set.
Sivas SRRe1143ae2016-08-26 22:31:02 -0500161
Sweta Potthuria6094522017-10-12 03:45:22 -0500162 ${valueDict}= Create Dictionary data=${boot_source}
163 Write Attribute ${CONTROL_HOST_URI}/boot/ BootSource data=${valueDict}
164
165Suite Teardown Execution
George Keishingb4400192017-02-01 11:10:30 -0600166 [Documentation] Restore default settings.
Sweta Potthuria6094522017-10-12 03:45:22 -0500167 Set Boot Policy ${ONETIME}
168 Set Boot Source ${BOOT_SOURCE_DEFAULT}
George Keishing3ce958c2017-03-27 01:09:02 -0500169
Sweta Potthuria6094522017-10-12 03:45:22 -0500170Suite Setup Execution
George Keishing3ce958c2017-03-27 01:09:02 -0500171 [Documentation] Do the initial suite setup.
George Keishingf1426682017-07-12 23:17:17 -0500172
George Keishinga3475c32017-12-06 04:56:07 -0600173 Smart Power Off
George Keishing3ce958c2017-03-27 01:09:02 -0500174
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500175Restore Bootmode Setting
176 [Documentation] Restore initial bootmode setting.
177
George Keishingb8783f12017-08-05 11:20:16 -0500178 Set Boot Mode ${initial_boot_mode}