blob: ce7c1c99fadd8770c4d35bf53952bff4e9a8433f [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
Chris Austenb29d2e82016-06-07 12:25:35 -050010
George Keishing3ce958c2017-03-27 01:09:02 -050011Suite Setup Test Suite Setup
12Test Setup Test Init Setup
Gunnar Millseac1af22016-11-14 15:30:09 -060013Test Teardown FFDC On Test Case Fail
George Keishingb4400192017-02-01 11:10:30 -060014Suite Teardown Restore Boot Settings
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 ***
George Keishingec807372016-12-05 03:54:51 -060019${HOST_SETTINGS} ${SETTINGS_URI}host0
Chris Austenb29d2e82016-06-07 12:25:35 -050020
21*** Test Cases ***
22
George Keishingbc7cc582017-01-23 12:58:34 -060023Set Boot Policy To ONETIME via REST
24 [Documentation] Set boot policy to ONETIME using REST URI and verify
25 ... using ipmitool.
26 [Tags] Set_Boot_Policy_To_ONETIME_via_REST
George Keishing314cf852016-08-26 09:02:16 -050027
Chris Austenb29d2e82016-06-07 12:25:35 -050028 Set Boot Policy ONETIME
29
George Keishingec807372016-12-05 03:54:51 -060030 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050031 Should Be Equal ${boot} ONETIME
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050032 ${output}= Run IPMI Standard Command chassis bootparam get 5
33 Should Contain ${output} Options apply to only next boot
34
Chris Austenb29d2e82016-06-07 12:25:35 -050035
George Keishingbc7cc582017-01-23 12:58:34 -060036Set Boot Policy To PERMANENT via REST
37 [Documentation] Set boot policy to PERMANENT via REST URI and verify
38 ... using ipmitool.
39 [Tags] Set_Boot_Policy_To_PERMANENT_via_REST
Chris Austenb29d2e82016-06-07 12:25:35 -050040
41 Set Boot Policy PERMANENT
42
George Keishingec807372016-12-05 03:54:51 -060043 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -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 Keishingec807372016-12-05 03:54:51 -060054 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -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
64 Run IPMI command 0x0 0x8 0x05 0xC0 0x00 0x00 0x00 0x00
George Keishingec807372016-12-05 03:54:51 -060065 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -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
Chris Austenb29d2e82016-06-07 12:25:35 -050070
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
root442f0ef2016-08-04 20:23:05 +000076 Initiate Power Off
Chris Austenb29d2e82016-06-07 12:25:35 -050077
78 Set Boot Policy PERMANENT
79
80 Set Boot Device CDROM
81
Rahul Maheshwariec8bf172017-02-21 07:41:08 -060082 Initiate Host Boot
Chris Austenb29d2e82016-06-07 12:25:35 -050083
George Keishingec807372016-12-05 03:54:51 -060084 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050085 Should Be Equal ${boot} PERMANENT
86
George Keishingec807372016-12-05 03:54:51 -060087 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -050088 Should Be Equal ${flag} CDROM
89
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
97 Set Boot Policy ONETIME
98
99 Set Boot Device Network
100
101 Trigger Warm Reset
102
George Keishingec807372016-12-05 03:54:51 -0600103 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -0500104 Should Be Equal ${boot} ONETIME
105
George Keishingec807372016-12-05 03:54:51 -0600106 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -0500107 Should Be Equal ${flag} Network
108
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
116 Set Boot Policy PERMANENT
117
118 Set Boot Device CDROM
119
120 Trigger Warm Reset
121
George Keishingec807372016-12-05 03:54:51 -0600122 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -0500123 Should Be Equal ${boot} PERMANENT
124
George Keishingec807372016-12-05 03:54:51 -0600125 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -0500126 Should Be Equal ${flag} CDROM
George Keishing314cf852016-08-26 09:02:16 -0500127
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600128Set Boot Policy To Invalid Value
George Keishing5f62a4a2016-11-16 02:09:17 -0600129 [Documentation] This testcase verify that the boot policy doesn't get
130 ... updated with invalid policy supplied by user.
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600131 [Tags] Set_Boot_Policy_To_Invalid_Value
George Keishing314cf852016-08-26 09:02:16 -0500132
George Keishing5f62a4a2016-11-16 02:09:17 -0600133 Run Keyword and Ignore Error Set Boot Policy abc
Chris Austenb29d2e82016-06-07 12:25:35 -0500134
George Keishingec807372016-12-05 03:54:51 -0600135 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
George Keishing314cf852016-08-26 09:02:16 -0500136 Should Not Be Equal ${boot} abc
137
Chris Austenb29d2e82016-06-07 12:25:35 -0500138*** Keywords ***
139
140Set Boot Policy
141 [Arguments] ${args}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600142 ${bootpolicy}= Set Variable ${args}
143 ${valueDict}= create dictionary data=${bootpolicy}
George Keishingec807372016-12-05 03:54:51 -0600144 Write Attribute ${HOST_SETTINGS} boot_policy data=${valueDict}
Chris Austenb29d2e82016-06-07 12:25:35 -0500145
146Set Boot Device
147 [Arguments] ${args}
George Keishingec807372016-12-05 03:54:51 -0600148 ${bootDevice} = Set Variable ${args}
149 ${valueDict} = create dictionary data=${bootDevice}
150 Write Attribute ${HOST_SETTINGS} boot_flags data=${valueDict}
Sivas SRRe1143ae2016-08-26 22:31:02 -0500151
George Keishingb4400192017-02-01 11:10:30 -0600152Restore Boot Settings
153 [Documentation] Restore default settings.
154 Set Boot Policy ONETIME
Rahul Maheshwari28087e92017-04-07 07:12:49 -0500155 Set Boot Device Default
George Keishingb4400192017-02-01 11:10:30 -0600156 Close All Connections
George Keishing3ce958c2017-03-27 01:09:02 -0500157
158Test Init Setup
159 [Documentation] Do the initial test setup.
160 Open Connection And Log In
161 Initialize DBUS cmd "boot_flags"
162
163Test Suite Setup
164 [Documentation] Do the initial suite setup.
George Keishingf1426682017-07-12 23:17:17 -0500165
166 # Reboot host to re-power on clean if host is not "off".
George Keishing3ce958c2017-03-27 01:09:02 -0500167 ${current_state}= Get Host State
168 Run Keyword If '${current_state}' == 'Off'
169 ... Initiate Host Boot
George Keishingf1426682017-07-12 23:17:17 -0500170 ... ELSE Initiate Host Reboot
George Keishing3ce958c2017-03-27 01:09:02 -0500171
172 Wait Until Keyword Succeeds
173 ... 10 min 10 sec Is OS Starting
174