blob: 0c2e572156c6d577778caac1a05a48d05f1089ce [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
George Keishing3ce958c2017-03-27 01:09:02 -050012Suite Setup Test Suite Setup
13Test Setup Test Init Setup
Gunnar Millseac1af22016-11-14 15:30:09 -060014Test Teardown FFDC On Test Case Fail
George Keishingb4400192017-02-01 11:10:30 -060015Suite Teardown Restore Boot Settings
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 Potthuriaf741cb2017-07-04 09:41:17 -050020${stack_mode} skip
George Keishingec807372016-12-05 03:54:51 -060021${HOST_SETTINGS} ${SETTINGS_URI}host0
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
Chris Austenb29d2e82016-06-07 12:25:35 -050030 Set Boot Policy ONETIME
31
George Keishingec807372016-12-05 03:54:51 -060032 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -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
Chris Austenb29d2e82016-06-07 12:25:35 -050037
George Keishingbc7cc582017-01-23 12:58:34 -060038Set Boot Policy To PERMANENT via REST
39 [Documentation] Set boot policy to PERMANENT via REST URI and verify
40 ... using ipmitool.
41 [Tags] Set_Boot_Policy_To_PERMANENT_via_REST
Chris Austenb29d2e82016-06-07 12:25:35 -050042
43 Set Boot Policy PERMANENT
44
George Keishingec807372016-12-05 03:54:51 -060045 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050046 Should Be Equal ${boot} PERMANENT
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050047 ${output}= Run IPMI Standard Command chassis bootparam get 5
48 Should Contain ${output} Options apply to all future boots
Chris Austenb29d2e82016-06-07 12:25:35 -050049
George Keishingbc7cc582017-01-23 12:58:34 -060050Set Boot Policy To ONETIME via IPMITOOL
51 [Documentation] Set boot policy to ONETIME via ipmitool and verify
52 ... using REST URI.
53 [Tags] Set_Boot_Policy_To_ONETIME_via_IPMITOOL
Chris Austenb29d2e82016-06-07 12:25:35 -050054
George Keishingbc7cc582017-01-23 12:58:34 -060055 Run IPMI command 0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
George Keishingec807372016-12-05 03:54:51 -060056 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050057 Should Be Equal ${boot} ONETIME
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050058 ${output}= Run IPMI Standard Command chassis bootparam get 5
59 Should Contain ${output} Options apply to only next boot
George Keishing314cf852016-08-26 09:02:16 -050060
George Keishingbc7cc582017-01-23 12:58:34 -060061Set Boot Policy To PERMANENT via IPMITOOL
62 [Documentation] Set boot policy to PERMANENT via ipmitool and verify
63 ... using REST URI.
64 [Tags] Set_Boot_Policy_To_PERMANENT_via_IPMITOOL
Chris Austenb29d2e82016-06-07 12:25:35 -050065
66 Run IPMI command 0x0 0x8 0x05 0xC0 0x00 0x00 0x00 0x00
George Keishingec807372016-12-05 03:54:51 -060067 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050068 Should Be Equal ${boot} PERMANENT
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050069 ${output}= Run IPMI Standard Command chassis bootparam get 5
70 Should Contain ${output} Options apply to all future boots
71
Chris Austenb29d2e82016-06-07 12:25:35 -050072
George Keishingbc7cc582017-01-23 12:58:34 -060073Test Boot Order via REST
74 [Documentation] Set boot policy to PERMANENT and boot device to CDROM
75 ... and verify that the order doesn't change post power on.
76 [Tags] chassisboot Test_Boot_Order_via_REST
Chris Austenb29d2e82016-06-07 12:25:35 -050077
root442f0ef2016-08-04 20:23:05 +000078 Initiate Power Off
Chris Austenb29d2e82016-06-07 12:25:35 -050079
80 Set Boot Policy PERMANENT
81
82 Set Boot Device CDROM
83
Rahul Maheshwariec8bf172017-02-21 07:41:08 -060084 Initiate Host Boot
Chris Austenb29d2e82016-06-07 12:25:35 -050085
George Keishingec807372016-12-05 03:54:51 -060086 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050087 Should Be Equal ${boot} PERMANENT
88
George Keishingec807372016-12-05 03:54:51 -060089 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -050090 Should Be Equal ${flag} CDROM
91
George Keishingd3206882016-11-29 04:41:14 -060092Persist ONETIME Boot Policy After Reset
93 [Documentation] Verify ONETIME boot policy order does not change
94 ... on warm reset.
Sridevi Rameshb4e67952017-01-19 00:58:10 -060095 [Tags] chassisboot Persist_ONETIME_Boot_Policy_After_Reset
causten147f5752016-08-11 16:24:45 -050096
Rahul Maheshwariec8bf172017-02-21 07:41:08 -060097 Initiate Host Boot
Chris Austenb29d2e82016-06-07 12:25:35 -050098
99 Set Boot Policy ONETIME
100
101 Set Boot Device Network
102
103 Trigger Warm Reset
104
George Keishingec807372016-12-05 03:54:51 -0600105 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -0500106 Should Be Equal ${boot} ONETIME
107
George Keishingec807372016-12-05 03:54:51 -0600108 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -0500109 Should Be Equal ${flag} Network
110
George Keishingd3206882016-11-29 04:41:14 -0600111Persist PERMANENT Boot Policy After Reset
112 [Documentation] Verify PERMANENT boot policy order does not change
113 ... on warm reset.
114 [Tags] chassisboot Persist_PERMANENT_Boot_Policy_After_Reset
Chris Austenb29d2e82016-06-07 12:25:35 -0500115
Rahul Maheshwariec8bf172017-02-21 07:41:08 -0600116 Initiate Host Boot
Chris Austenb29d2e82016-06-07 12:25:35 -0500117
118 Set Boot Policy PERMANENT
119
120 Set Boot Device CDROM
121
122 Trigger Warm Reset
123
George Keishingec807372016-12-05 03:54:51 -0600124 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -0500125 Should Be Equal ${boot} PERMANENT
126
George Keishingec807372016-12-05 03:54:51 -0600127 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -0500128 Should Be Equal ${flag} CDROM
George Keishing314cf852016-08-26 09:02:16 -0500129
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600130Set Boot Policy To Invalid Value
George Keishing5f62a4a2016-11-16 02:09:17 -0600131 [Documentation] This testcase verify that the boot policy doesn't get
132 ... updated with invalid policy supplied by user.
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600133 [Tags] Set_Boot_Policy_To_Invalid_Value
George Keishing314cf852016-08-26 09:02:16 -0500134
George Keishing5f62a4a2016-11-16 02:09:17 -0600135 Run Keyword and Ignore Error Set Boot Policy abc
Chris Austenb29d2e82016-06-07 12:25:35 -0500136
George Keishingec807372016-12-05 03:54:51 -0600137 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
George Keishing314cf852016-08-26 09:02:16 -0500138 Should Not Be Equal ${boot} abc
139
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500140
141Verify Boot Mode Persistency After BMC Reboot
142 [Documentation] Verify boot mode persistency after BMC reboot.
143 [Tags] Verify_Boot_Mode_Persistency_After_BMC_Reboot
144 [Teardown] Run Keywords Restore Bootmode Setting
145 ... AND FFDC On Test Case Fail
146
147 # Record initial bootmode setting.
George Keishingb8783f12017-08-05 11:20:16 -0500148 ${boot_mode}= Read Attribute
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500149 ... ${CONTROL_HOST_URI}/boot_mode BootMode
150 Set Suite Variable ${initial_boot_mode} ${boot_mode}
151
152 # Set bootmode to non default value.
George Keishingb8783f12017-08-05 11:20:16 -0500153 Set Boot Mode xyz.openbmc_project.Control.Boot.Mode.Modes.Safe
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500154
155 Initiate BMC Reboot
156 Wait Until Keyword Succeeds 10 min 10 sec Is BMC Ready
157
George Keishingb8783f12017-08-05 11:20:16 -0500158 ${boot_mode_after}= Read Attribute
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500159 ... ${CONTROL_HOST_URI}/boot_mode BootMode
160
George Keishingb8783f12017-08-05 11:20:16 -0500161 Should Be Equal As Strings
162 ... ${boot_mode_after} xyz.openbmc_project.Control.Boot.Mode.Modes.Safe
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500163
164
Chris Austenb29d2e82016-06-07 12:25:35 -0500165*** Keywords ***
166
George Keishingb8783f12017-08-05 11:20:16 -0500167Set Boot Mode
168 [Arguments] ${args}
169 ${bootmode}= Set Variable ${args}
170 ${valueDict}= Create Dictionary data=${bootmode}
171 Write Attribute ${CONTROL_HOST_URI}/boot_mode BootMode data=${valueDict}
172
Chris Austenb29d2e82016-06-07 12:25:35 -0500173Set Boot Policy
174 [Arguments] ${args}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600175 ${bootpolicy}= Set Variable ${args}
176 ${valueDict}= create dictionary data=${bootpolicy}
George Keishingec807372016-12-05 03:54:51 -0600177 Write Attribute ${HOST_SETTINGS} boot_policy data=${valueDict}
Chris Austenb29d2e82016-06-07 12:25:35 -0500178
179Set Boot Device
180 [Arguments] ${args}
George Keishingec807372016-12-05 03:54:51 -0600181 ${bootDevice} = Set Variable ${args}
182 ${valueDict} = create dictionary data=${bootDevice}
183 Write Attribute ${HOST_SETTINGS} boot_flags data=${valueDict}
Sivas SRRe1143ae2016-08-26 22:31:02 -0500184
George Keishingb4400192017-02-01 11:10:30 -0600185Restore Boot Settings
186 [Documentation] Restore default settings.
187 Set Boot Policy ONETIME
Rahul Maheshwari28087e92017-04-07 07:12:49 -0500188 Set Boot Device Default
George Keishingb4400192017-02-01 11:10:30 -0600189 Close All Connections
George Keishing3ce958c2017-03-27 01:09:02 -0500190
191Test Init Setup
192 [Documentation] Do the initial test setup.
193 Open Connection And Log In
194 Initialize DBUS cmd "boot_flags"
195
196Test Suite Setup
197 [Documentation] Do the initial suite setup.
George Keishingf1426682017-07-12 23:17:17 -0500198
Sweta Potthuriaf741cb2017-07-04 09:41:17 -0500199 #Boot Host.
200 REST Power On
George Keishing3ce958c2017-03-27 01:09:02 -0500201
Rahul Maheshwaria001dd22017-07-23 23:43:35 -0500202Restore Bootmode Setting
203 [Documentation] Restore initial bootmode setting.
204
George Keishingb8783f12017-08-05 11:20:16 -0500205 Set Boot Mode ${initial_boot_mode}