blob: f4c2bd7a294b4c50f6ddc33dac10baae0b5cc0ed [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}
32 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
33 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}
43 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
44 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
Sweta Potthuria6094522017-10-12 03:45:22 -050054 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
55 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
65 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
66 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.
73 [Tags] chassisboot 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
Sweta Potthuria6094522017-10-12 03:45:22 -050079 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
80 Should Be Equal ${boot} ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -050081
Sweta Potthuria6094522017-10-12 03:45:22 -050082 ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
83 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.
Sridevi Rameshb4e67952017-01-19 00:58:10 -060088 [Tags] chassisboot 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
Sweta Potthuria6094522017-10-12 03:45:22 -050095 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
96 Should Be Equal ${boot} ${ONETIME}
Chris Austenb29d2e82016-06-07 12:25:35 -050097
Sweta Potthuria6094522017-10-12 03:45:22 -050098 ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
99 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.
104 [Tags] chassisboot 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
Sweta Potthuria6094522017-10-12 03:45:22 -0500111 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
112 Should Be Equal ${boot} ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -0500113
Sweta Potthuria6094522017-10-12 03:45:22 -0500114 ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
115 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
142 [Arguments] ${args}
Sweta Potthuria6094522017-10-12 03:45:22 -0500143 ${bootmode}= Set Variable ${args}
George Keishingb8783f12017-08-05 11:20:16 -0500144 ${valueDict}= Create Dictionary data=${bootmode}
Sweta Potthuria6094522017-10-12 03:45:22 -0500145 Write Attribute ${CONTROL_HOST_URI}/boot/ BootMode data=${valueDict}
George Keishingb8783f12017-08-05 11:20:16 -0500146
Chris Austenb29d2e82016-06-07 12:25:35 -0500147Set Boot Policy
148 [Arguments] ${args}
Sweta Potthuria6094522017-10-12 03:45:22 -0500149 ${bootpolicy}= Set Variable ${args}
150 ${valueDict}= Create Dictionary data=${bootpolicy}
George Keishing162e7332017-10-23 01:16:00 -0500151 Write Attribute
152 ... ${CONTROL_HOST_URI}/boot/one_time Enabled data=${valueDict}
Chris Austenb29d2e82016-06-07 12:25:35 -0500153
Sweta Potthuria6094522017-10-12 03:45:22 -0500154Set Boot Source
155 [Documentation] Set given boot source.
156 [Arguments] ${boot_source}
157 # Description of argument(s):
158 # boot_source Boot source which need to be set.
Sivas SRRe1143ae2016-08-26 22:31:02 -0500159
Sweta Potthuria6094522017-10-12 03:45:22 -0500160 ${valueDict}= Create Dictionary data=${boot_source}
161 Write Attribute ${CONTROL_HOST_URI}/boot/ BootSource data=${valueDict}
162
163Suite Teardown Execution
George Keishingb4400192017-02-01 11:10:30 -0600164 [Documentation] Restore default settings.
Sweta Potthuria6094522017-10-12 03:45:22 -0500165 Set Boot Policy ${ONETIME}
166 Set Boot Source ${BOOT_SOURCE_DEFAULT}
George Keishing3ce958c2017-03-27 01:09:02 -0500167
Sweta Potthuria6094522017-10-12 03:45:22 -0500168Suite Setup Execution
George Keishing3ce958c2017-03-27 01:09:02 -0500169 [Documentation] Do the initial suite setup.
George Keishingf1426682017-07-12 23:17:17 -0500170
George Keishinga3475c32017-12-06 04:56:07 -0600171 Smart Power Off
George Keishing3ce958c2017-03-27 01:09:02 -0500172
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500173Restore Bootmode Setting
174 [Documentation] Restore initial bootmode setting.
175
George Keishingb8783f12017-08-05 11:20:16 -0500176 Set Boot Mode ${initial_boot_mode}