blob: 68ad7634b6da19997448d6e989361c9b09f05e2b [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
16*** Variables ***
George Keishingec807372016-12-05 03:54:51 -060017${HOST_SETTINGS} ${SETTINGS_URI}host0
Chris Austenb29d2e82016-06-07 12:25:35 -050018
19*** Test Cases ***
20
George Keishingbc7cc582017-01-23 12:58:34 -060021Set Boot Policy To ONETIME via REST
22 [Documentation] Set boot policy to ONETIME using REST URI and verify
23 ... using ipmitool.
24 [Tags] Set_Boot_Policy_To_ONETIME_via_REST
George Keishing314cf852016-08-26 09:02:16 -050025
Chris Austenb29d2e82016-06-07 12:25:35 -050026 Set Boot Policy ONETIME
27
George Keishingec807372016-12-05 03:54:51 -060028 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050029 Should Be Equal ${boot} ONETIME
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050030 ${output}= Run IPMI Standard Command chassis bootparam get 5
31 Should Contain ${output} Options apply to only next boot
32
Chris Austenb29d2e82016-06-07 12:25:35 -050033
George Keishingbc7cc582017-01-23 12:58:34 -060034Set Boot Policy To PERMANENT via REST
35 [Documentation] Set boot policy to PERMANENT via REST URI and verify
36 ... using ipmitool.
37 [Tags] Set_Boot_Policy_To_PERMANENT_via_REST
Chris Austenb29d2e82016-06-07 12:25:35 -050038
39 Set Boot Policy PERMANENT
40
George Keishingec807372016-12-05 03:54:51 -060041 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050042 Should Be Equal ${boot} PERMANENT
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050043 ${output}= Run IPMI Standard Command chassis bootparam get 5
44 Should Contain ${output} Options apply to all future boots
Chris Austenb29d2e82016-06-07 12:25:35 -050045
George Keishingbc7cc582017-01-23 12:58:34 -060046Set Boot Policy To ONETIME via IPMITOOL
47 [Documentation] Set boot policy to ONETIME via ipmitool and verify
48 ... using REST URI.
49 [Tags] Set_Boot_Policy_To_ONETIME_via_IPMITOOL
Chris Austenb29d2e82016-06-07 12:25:35 -050050
George Keishingbc7cc582017-01-23 12:58:34 -060051 Run IPMI command 0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
George Keishingec807372016-12-05 03:54:51 -060052 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050053 Should Be Equal ${boot} ONETIME
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050054 ${output}= Run IPMI Standard Command chassis bootparam get 5
55 Should Contain ${output} Options apply to only next boot
George Keishing314cf852016-08-26 09:02:16 -050056
George Keishingbc7cc582017-01-23 12:58:34 -060057Set Boot Policy To PERMANENT via IPMITOOL
58 [Documentation] Set boot policy to PERMANENT via ipmitool and verify
59 ... using REST URI.
60 [Tags] Set_Boot_Policy_To_PERMANENT_via_IPMITOOL
Chris Austenb29d2e82016-06-07 12:25:35 -050061
62 Run IPMI command 0x0 0x8 0x05 0xC0 0x00 0x00 0x00 0x00
George Keishingec807372016-12-05 03:54:51 -060063 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050064 Should Be Equal ${boot} PERMANENT
Rahul Maheshwarid8d22da2017-04-07 09:13:44 -050065 ${output}= Run IPMI Standard Command chassis bootparam get 5
66 Should Contain ${output} Options apply to all future boots
67
Chris Austenb29d2e82016-06-07 12:25:35 -050068
George Keishingbc7cc582017-01-23 12:58:34 -060069Test Boot Order via REST
70 [Documentation] Set boot policy to PERMANENT and boot device to CDROM
71 ... and verify that the order doesn't change post power on.
72 [Tags] chassisboot Test_Boot_Order_via_REST
Chris Austenb29d2e82016-06-07 12:25:35 -050073
root442f0ef2016-08-04 20:23:05 +000074 Initiate Power Off
Chris Austenb29d2e82016-06-07 12:25:35 -050075
76 Set Boot Policy PERMANENT
77
78 Set Boot Device CDROM
79
Rahul Maheshwariec8bf172017-02-21 07:41:08 -060080 Initiate Host Boot
Chris Austenb29d2e82016-06-07 12:25:35 -050081
George Keishingec807372016-12-05 03:54:51 -060082 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050083 Should Be Equal ${boot} PERMANENT
84
George Keishingec807372016-12-05 03:54:51 -060085 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -050086 Should Be Equal ${flag} CDROM
87
George Keishingd3206882016-11-29 04:41:14 -060088Persist ONETIME Boot Policy After Reset
89 [Documentation] Verify ONETIME boot policy order does not change
90 ... on warm reset.
Sridevi Rameshb4e67952017-01-19 00:58:10 -060091 [Tags] chassisboot Persist_ONETIME_Boot_Policy_After_Reset
causten147f5752016-08-11 16:24:45 -050092
Rahul Maheshwariec8bf172017-02-21 07:41:08 -060093 Initiate Host Boot
Chris Austenb29d2e82016-06-07 12:25:35 -050094
95 Set Boot Policy ONETIME
96
97 Set Boot Device Network
98
99 Trigger Warm Reset
100
George Keishingec807372016-12-05 03:54:51 -0600101 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -0500102 Should Be Equal ${boot} ONETIME
103
George Keishingec807372016-12-05 03:54:51 -0600104 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -0500105 Should Be Equal ${flag} Network
106
George Keishingd3206882016-11-29 04:41:14 -0600107Persist PERMANENT Boot Policy After Reset
108 [Documentation] Verify PERMANENT boot policy order does not change
109 ... on warm reset.
110 [Tags] chassisboot Persist_PERMANENT_Boot_Policy_After_Reset
Chris Austenb29d2e82016-06-07 12:25:35 -0500111
Rahul Maheshwariec8bf172017-02-21 07:41:08 -0600112 Initiate Host Boot
Chris Austenb29d2e82016-06-07 12:25:35 -0500113
114 Set Boot Policy PERMANENT
115
116 Set Boot Device CDROM
117
118 Trigger Warm Reset
119
George Keishingec807372016-12-05 03:54:51 -0600120 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -0500121 Should Be Equal ${boot} PERMANENT
122
George Keishingec807372016-12-05 03:54:51 -0600123 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -0500124 Should Be Equal ${flag} CDROM
George Keishing314cf852016-08-26 09:02:16 -0500125
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600126Set Boot Policy To Invalid Value
George Keishing5f62a4a2016-11-16 02:09:17 -0600127 [Documentation] This testcase verify that the boot policy doesn't get
128 ... updated with invalid policy supplied by user.
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600129 [Tags] Set_Boot_Policy_To_Invalid_Value
George Keishing314cf852016-08-26 09:02:16 -0500130
George Keishing5f62a4a2016-11-16 02:09:17 -0600131 Run Keyword and Ignore Error Set Boot Policy abc
Chris Austenb29d2e82016-06-07 12:25:35 -0500132
George Keishingec807372016-12-05 03:54:51 -0600133 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
George Keishing314cf852016-08-26 09:02:16 -0500134 Should Not Be Equal ${boot} abc
135
Chris Austenb29d2e82016-06-07 12:25:35 -0500136*** Keywords ***
137
138Set Boot Policy
139 [Arguments] ${args}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600140 ${bootpolicy}= Set Variable ${args}
141 ${valueDict}= create dictionary data=${bootpolicy}
George Keishingec807372016-12-05 03:54:51 -0600142 Write Attribute ${HOST_SETTINGS} boot_policy data=${valueDict}
Chris Austenb29d2e82016-06-07 12:25:35 -0500143
144Set Boot Device
145 [Arguments] ${args}
George Keishingec807372016-12-05 03:54:51 -0600146 ${bootDevice} = Set Variable ${args}
147 ${valueDict} = create dictionary data=${bootDevice}
148 Write Attribute ${HOST_SETTINGS} boot_flags data=${valueDict}
Sivas SRRe1143ae2016-08-26 22:31:02 -0500149
George Keishingb4400192017-02-01 11:10:30 -0600150Restore Boot Settings
151 [Documentation] Restore default settings.
152 Set Boot Policy ONETIME
Rahul Maheshwari28087e92017-04-07 07:12:49 -0500153 Set Boot Device Default
George Keishingb4400192017-02-01 11:10:30 -0600154 Close All Connections
George Keishing3ce958c2017-03-27 01:09:02 -0500155
156Test Init Setup
157 [Documentation] Do the initial test setup.
158 Open Connection And Log In
159 Initialize DBUS cmd "boot_flags"
160
161Test Suite Setup
162 [Documentation] Do the initial suite setup.
163 ${current_state}= Get Host State
164 Run Keyword If '${current_state}' == 'Off'
165 ... Initiate Host Boot
166
167 Wait Until Keyword Succeeds
168 ... 10 min 10 sec Is OS Starting
169