blob: 3bb6f9a008b35238efaf7a7c65716e108508756d [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
Chris Austenb29d2e82016-06-07 12:25:35 -050076
Sweta Potthuria6094522017-10-12 03:45:22 -050077 Set Boot Policy ${PERMANENT}
Sweta Potthuria6094522017-10-12 03:45:22 -050078 Set Boot Source ${BOOT_SOURCE_CDROM}
Chris Austenb29d2e82016-06-07 12:25:35 -050079
Sweta Potthuria6094522017-10-12 03:45:22 -050080 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
81 Should Be Equal ${boot} ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -050082
Sweta Potthuria6094522017-10-12 03:45:22 -050083 ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
84 Should Be Equal ${flag} ${BOOT_SOURCE_CDROM}
Chris Austenb29d2e82016-06-07 12:25:35 -050085
George Keishingd3206882016-11-29 04:41:14 -060086Persist ONETIME Boot Policy After Reset
87 [Documentation] Verify ONETIME boot policy order does not change
88 ... on warm reset.
Sridevi Rameshb4e67952017-01-19 00:58:10 -060089 [Tags] chassisboot Persist_ONETIME_Boot_Policy_After_Reset
causten147f5752016-08-11 16:24:45 -050090
Sweta Potthuria6094522017-10-12 03:45:22 -050091 Set Boot Policy ${ONETIME}
Sweta Potthuria6094522017-10-12 03:45:22 -050092 Set Boot Source ${BOOT_SOURCE_NETWORK}
Chris Austenb29d2e82016-06-07 12:25:35 -050093
Sweta Potthuria6094522017-10-12 03:45:22 -050094 OBMC Reboot (off)
Chris Austenb29d2e82016-06-07 12:25:35 -050095
Sweta Potthuria6094522017-10-12 03:45:22 -050096 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
97 Should Be Equal ${boot} ${ONETIME}
Chris Austenb29d2e82016-06-07 12:25:35 -050098
Sweta Potthuria6094522017-10-12 03:45:22 -050099 ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
100 Should Be Equal ${flag} ${BOOT_SOURCE_NETWORK}
Chris Austenb29d2e82016-06-07 12:25:35 -0500101
George Keishingd3206882016-11-29 04:41:14 -0600102Persist PERMANENT Boot Policy After Reset
103 [Documentation] Verify PERMANENT boot policy order does not change
104 ... on warm reset.
105 [Tags] chassisboot Persist_PERMANENT_Boot_Policy_After_Reset
Chris Austenb29d2e82016-06-07 12:25:35 -0500106
Sweta Potthuria6094522017-10-12 03:45:22 -0500107 Set Boot Policy ${PERMANENT}
Sweta Potthuria6094522017-10-12 03:45:22 -0500108 Set Boot Source ${BOOT_SOURCE_CDROM}
Chris Austenb29d2e82016-06-07 12:25:35 -0500109
Sweta Potthuria6094522017-10-12 03:45:22 -0500110 OBMC Reboot (off)
Chris Austenb29d2e82016-06-07 12:25:35 -0500111
Sweta Potthuria6094522017-10-12 03:45:22 -0500112 ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
113 Should Be Equal ${boot} ${PERMANENT}
Chris Austenb29d2e82016-06-07 12:25:35 -0500114
Sweta Potthuria6094522017-10-12 03:45:22 -0500115 ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
116 Should Be Equal ${flag} ${BOOT_SOURCE_CDROM}
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500117
118Verify Boot Mode Persistency After BMC Reboot
119 [Documentation] Verify boot mode persistency after BMC reboot.
120 [Tags] Verify_Boot_Mode_Persistency_After_BMC_Reboot
121 [Teardown] Run Keywords Restore Bootmode Setting
122 ... AND FFDC On Test Case Fail
123
124 # Record initial bootmode setting.
George Keishingb8783f12017-08-05 11:20:16 -0500125 ${boot_mode}= Read Attribute
Sweta Potthuria6094522017-10-12 03:45:22 -0500126 ... ${CONTROL_HOST_URI}/boot BootMode
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500127 Set Suite Variable ${initial_boot_mode} ${boot_mode}
128
129 # Set bootmode to non default value.
Sweta Potthuria6094522017-10-12 03:45:22 -0500130 Set Boot Mode ${BOOT_MODE_SAFE}
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500131
George Keishinga3475c32017-12-06 04:56:07 -0600132 OBMC Reboot (off)
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500133
George Keishingb8783f12017-08-05 11:20:16 -0500134 ${boot_mode_after}= Read Attribute
Sweta Potthuria6094522017-10-12 03:45:22 -0500135 ... ${CONTROL_HOST_URI}/boot BootMode
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500136
George Keishingb8783f12017-08-05 11:20:16 -0500137 Should Be Equal As Strings
Sweta Potthuria6094522017-10-12 03:45:22 -0500138 ... ${boot_mode_after} ${BOOT_MODE_SAFE}
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500139
Chris Austenb29d2e82016-06-07 12:25:35 -0500140*** Keywords ***
141
George Keishingb8783f12017-08-05 11:20:16 -0500142Set Boot Mode
143 [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
149 [Arguments] ${args}
Sweta Potthuria6094522017-10-12 03:45:22 -0500150 ${bootpolicy}= Set Variable ${args}
151 ${valueDict}= Create Dictionary data=${bootpolicy}
George Keishing162e7332017-10-23 01:16:00 -0500152 Write Attribute
153 ... ${CONTROL_HOST_URI}/boot/one_time Enabled data=${valueDict}
Chris Austenb29d2e82016-06-07 12:25:35 -0500154
Sweta Potthuria6094522017-10-12 03:45:22 -0500155Set Boot Source
156 [Documentation] Set given boot source.
157 [Arguments] ${boot_source}
158 # Description of argument(s):
159 # boot_source Boot source which need to be set.
Sivas SRRe1143ae2016-08-26 22:31:02 -0500160
Sweta Potthuria6094522017-10-12 03:45:22 -0500161 ${valueDict}= Create Dictionary data=${boot_source}
162 Write Attribute ${CONTROL_HOST_URI}/boot/ BootSource data=${valueDict}
163
164Suite Teardown Execution
George Keishingb4400192017-02-01 11:10:30 -0600165 [Documentation] Restore default settings.
Sweta Potthuria6094522017-10-12 03:45:22 -0500166 Set Boot Policy ${ONETIME}
167 Set Boot Source ${BOOT_SOURCE_DEFAULT}
George Keishingb4400192017-02-01 11:10:30 -0600168 Close All Connections
George Keishing3ce958c2017-03-27 01:09:02 -0500169
Sweta Potthuria6094522017-10-12 03:45:22 -0500170Test Setup Execution
George Keishing3ce958c2017-03-27 01:09:02 -0500171 [Documentation] Do the initial test setup.
172 Open Connection And Log In
173 Initialize DBUS cmd "boot_flags"
174
Sweta Potthuria6094522017-10-12 03:45:22 -0500175Suite Setup Execution
George Keishing3ce958c2017-03-27 01:09:02 -0500176 [Documentation] Do the initial suite setup.
George Keishingf1426682017-07-12 23:17:17 -0500177
George Keishinga3475c32017-12-06 04:56:07 -0600178 Smart Power Off
George Keishing3ce958c2017-03-27 01:09:02 -0500179
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500180Restore Bootmode Setting
181 [Documentation] Restore initial bootmode setting.
182
George Keishingb8783f12017-08-05 11:20:16 -0500183 Set Boot Mode ${initial_boot_mode}