blob: 6de1a41520c4dbf0715565fafa1e73672e0c062f [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
George Keishing162e7332017-10-23 01:16:00 -050023${stack_mode} skip
24
Chris Austenb29d2e82016-06-07 12:25:35 -050025*** Test Cases ***
26
George Keishingbc7cc582017-01-23 12:58:34 -060027Set Boot Policy To ONETIME via REST
28 [Documentation] Set boot policy to ONETIME using REST URI and verify
29 ... using ipmitool.
30 [Tags] Set_Boot_Policy_To_ONETIME_via_REST
George Keishing314cf852016-08-26 09:02:16 -050031
Sweta Potthuria6094522017-10-12 03:45:22 -050032 Set Boot Policy ${ONETIME}
33 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
34 Should Be Equal ${boot} ${ONETIME}
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050035 ${output}= Run IPMI Standard Command chassis bootparam get 5
36 Should Contain ${output} Options apply to only next boot
37
George Keishingbc7cc582017-01-23 12:58:34 -060038Set Boot Policy To PERMANENT via REST
Sweta Potthuria6094522017-10-12 03:45:22 -050039 [Documentation] Set boot policy to PERMANENT using REST URI and verify
George Keishingbc7cc582017-01-23 12:58:34 -060040 ... using ipmitool.
41 [Tags] Set_Boot_Policy_To_PERMANENT_via_REST
Chris Austenb29d2e82016-06-07 12:25:35 -050042
Sweta Potthuria6094522017-10-12 03:45:22 -050043 Set Boot Policy ${PERMANENT}
44 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
45 Should Be Equal ${boot} ${PERMANENT}
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050046 ${output}= Run IPMI Standard Command chassis bootparam get 5
47 Should Contain ${output} Options apply to all future boots
Chris Austenb29d2e82016-06-07 12:25:35 -050048
George Keishingbc7cc582017-01-23 12:58:34 -060049Set Boot Policy To ONETIME via IPMITOOL
50 [Documentation] Set boot policy to ONETIME via ipmitool and verify
51 ... using REST URI.
52 [Tags] Set_Boot_Policy_To_ONETIME_via_IPMITOOL
Chris Austenb29d2e82016-06-07 12:25:35 -050053
George Keishingbc7cc582017-01-23 12:58:34 -060054 Run IPMI command 0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
Sweta Potthuria6094522017-10-12 03:45:22 -050055 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
56 Should Be Equal ${boot} ${ONETIME}
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050057 ${output}= Run IPMI Standard Command chassis bootparam get 5
58 Should Contain ${output} Options apply to only next boot
George Keishing314cf852016-08-26 09:02:16 -050059
George Keishingbc7cc582017-01-23 12:58:34 -060060Set Boot Policy To PERMANENT via IPMITOOL
61 [Documentation] Set boot policy to PERMANENT via ipmitool and verify
62 ... using REST URI.
63 [Tags] Set_Boot_Policy_To_PERMANENT_via_IPMITOOL
Chris Austenb29d2e82016-06-07 12:25:35 -050064
Sweta Potthuria6094522017-10-12 03:45:22 -050065 Run IPMI command 0x0 0x8 0x05 0xC0 0x00 0x00 0x00 0x0
66 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
67 Should Be Equal ${boot} ${PERMANENT}
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050068 ${output}= Run IPMI Standard Command chassis bootparam get 5
69 Should Contain ${output} Options apply to all future boots
70
George Keishingbc7cc582017-01-23 12:58:34 -060071Test 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 Austenb29d2e82016-06-07 12:25:35 -050075
George Keishing162e7332017-10-23 01:16:00 -050076 Initiate Host PowerOff
Chris Austenb29d2e82016-06-07 12:25:35 -050077
Sweta Potthuria6094522017-10-12 03:45:22 -050078 Set Boot Policy ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -050079
Sweta Potthuria6094522017-10-12 03:45:22 -050080 Set Boot Source ${BOOT_SOURCE_CDROM}
Chris Austenb29d2e82016-06-07 12:25:35 -050081
Rahul Maheshwariec8bf172017-02-21 07:41:08 -060082 Initiate Host Boot
Chris Austenb29d2e82016-06-07 12:25:35 -050083
Sweta Potthuria6094522017-10-12 03:45:22 -050084 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
85 Should Be Equal ${boot} ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -050086
Sweta Potthuria6094522017-10-12 03:45:22 -050087 ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
88 Should Be Equal ${flag} ${BOOT_SOURCE_CDROM}
Chris Austenb29d2e82016-06-07 12:25:35 -050089
George Keishingd3206882016-11-29 04:41:14 -060090Persist ONETIME Boot Policy After Reset
91 [Documentation] Verify ONETIME boot policy order does not change
92 ... on warm reset.
Sridevi Rameshb4e67952017-01-19 00:58:10 -060093 [Tags] chassisboot Persist_ONETIME_Boot_Policy_After_Reset
causten147f5752016-08-11 16:24:45 -050094
Rahul Maheshwariec8bf172017-02-21 07:41:08 -060095 Initiate Host Boot
Chris Austenb29d2e82016-06-07 12:25:35 -050096
Sweta Potthuria6094522017-10-12 03:45:22 -050097 Set Boot Policy ${ONETIME}
Chris Austenb29d2e82016-06-07 12:25:35 -050098
Sweta Potthuria6094522017-10-12 03:45:22 -050099 Set Boot Source ${BOOT_SOURCE_NETWORK}
Chris Austenb29d2e82016-06-07 12:25:35 -0500100
Sweta Potthuria6094522017-10-12 03:45:22 -0500101 OBMC Reboot (off)
Chris Austenb29d2e82016-06-07 12:25:35 -0500102
Sweta Potthuria6094522017-10-12 03:45:22 -0500103 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
104 Should Be Equal ${boot} ${ONETIME}
Chris Austenb29d2e82016-06-07 12:25:35 -0500105
Sweta Potthuria6094522017-10-12 03:45:22 -0500106 ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
107 Should Be Equal ${flag} ${BOOT_SOURCE_NETWORK}
Chris Austenb29d2e82016-06-07 12:25:35 -0500108
George Keishingd3206882016-11-29 04:41:14 -0600109Persist 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 Austenb29d2e82016-06-07 12:25:35 -0500113
Rahul Maheshwariec8bf172017-02-21 07:41:08 -0600114 Initiate Host Boot
Chris Austenb29d2e82016-06-07 12:25:35 -0500115
Sweta Potthuria6094522017-10-12 03:45:22 -0500116 Set Boot Policy ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -0500117
Sweta Potthuria6094522017-10-12 03:45:22 -0500118 Set Boot Source ${BOOT_SOURCE_CDROM}
Chris Austenb29d2e82016-06-07 12:25:35 -0500119
Sweta Potthuria6094522017-10-12 03:45:22 -0500120 OBMC Reboot (off)
Chris Austenb29d2e82016-06-07 12:25:35 -0500121
Sweta Potthuria6094522017-10-12 03:45:22 -0500122 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
123 Should Be Equal ${boot} ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -0500124
Sweta Potthuria6094522017-10-12 03:45:22 -0500125 ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
126 Should Be Equal ${flag} ${BOOT_SOURCE_CDROM}
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500127
128Verify Boot Mode Persistency After BMC Reboot
129 [Documentation] Verify boot mode persistency after BMC reboot.
130 [Tags] Verify_Boot_Mode_Persistency_After_BMC_Reboot
131 [Teardown] Run Keywords Restore Bootmode Setting
132 ... AND FFDC On Test Case Fail
133
134 # Record initial bootmode setting.
George Keishingb8783f12017-08-05 11:20:16 -0500135 ${boot_mode}= Read Attribute
Sweta Potthuria6094522017-10-12 03:45:22 -0500136 ... ${CONTROL_HOST_URI}/boot BootMode
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500137 Set Suite Variable ${initial_boot_mode} ${boot_mode}
138
139 # Set bootmode to non default value.
Sweta Potthuria6094522017-10-12 03:45:22 -0500140 Set Boot Mode ${BOOT_MODE_SAFE}
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500141
142 Initiate BMC Reboot
143 Wait Until Keyword Succeeds 10 min 10 sec Is BMC Ready
144
George Keishingb8783f12017-08-05 11:20:16 -0500145 ${boot_mode_after}= Read Attribute
Sweta Potthuria6094522017-10-12 03:45:22 -0500146 ... ${CONTROL_HOST_URI}/boot BootMode
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500147
George Keishingb8783f12017-08-05 11:20:16 -0500148 Should Be Equal As Strings
Sweta Potthuria6094522017-10-12 03:45:22 -0500149 ... ${boot_mode_after} ${BOOT_MODE_SAFE}
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500150
Chris Austenb29d2e82016-06-07 12:25:35 -0500151*** Keywords ***
152
George Keishingb8783f12017-08-05 11:20:16 -0500153Set Boot Mode
154 [Arguments] ${args}
Sweta Potthuria6094522017-10-12 03:45:22 -0500155 ${bootmode}= Set Variable ${args}
George Keishingb8783f12017-08-05 11:20:16 -0500156 ${valueDict}= Create Dictionary data=${bootmode}
Sweta Potthuria6094522017-10-12 03:45:22 -0500157 Write Attribute ${CONTROL_HOST_URI}/boot/ BootMode data=${valueDict}
George Keishingb8783f12017-08-05 11:20:16 -0500158
Chris Austenb29d2e82016-06-07 12:25:35 -0500159Set Boot Policy
160 [Arguments] ${args}
Sweta Potthuria6094522017-10-12 03:45:22 -0500161 ${bootpolicy}= Set Variable ${args}
162 ${valueDict}= Create Dictionary data=${bootpolicy}
George Keishing162e7332017-10-23 01:16:00 -0500163 Write Attribute
164 ... ${CONTROL_HOST_URI}/boot/one_time Enabled data=${valueDict}
Chris Austenb29d2e82016-06-07 12:25:35 -0500165
Sweta Potthuria6094522017-10-12 03:45:22 -0500166Set Boot Source
167 [Documentation] Set given boot source.
168 [Arguments] ${boot_source}
169 # Description of argument(s):
170 # boot_source Boot source which need to be set.
Sivas SRRe1143ae2016-08-26 22:31:02 -0500171
Sweta Potthuria6094522017-10-12 03:45:22 -0500172 ${valueDict}= Create Dictionary data=${boot_source}
173 Write Attribute ${CONTROL_HOST_URI}/boot/ BootSource data=${valueDict}
174
175Suite Teardown Execution
George Keishingb4400192017-02-01 11:10:30 -0600176 [Documentation] Restore default settings.
Sweta Potthuria6094522017-10-12 03:45:22 -0500177 Set Boot Policy ${ONETIME}
178 Set Boot Source ${BOOT_SOURCE_DEFAULT}
George Keishingb4400192017-02-01 11:10:30 -0600179 Close All Connections
George Keishing3ce958c2017-03-27 01:09:02 -0500180
Sweta Potthuria6094522017-10-12 03:45:22 -0500181Test Setup Execution
George Keishing3ce958c2017-03-27 01:09:02 -0500182 [Documentation] Do the initial test setup.
183 Open Connection And Log In
184 Initialize DBUS cmd "boot_flags"
185
Sweta Potthuria6094522017-10-12 03:45:22 -0500186Suite Setup Execution
George Keishing3ce958c2017-03-27 01:09:02 -0500187 [Documentation] Do the initial suite setup.
George Keishingf1426682017-07-12 23:17:17 -0500188
George Keishing162e7332017-10-23 01:16:00 -0500189 REST Power On
George Keishing3ce958c2017-03-27 01:09:02 -0500190
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500191Restore Bootmode Setting
192 [Documentation] Restore initial bootmode setting.
193
George Keishingb8783f12017-08-05 11:20:16 -0500194 Set Boot Mode ${initial_boot_mode}