blob: 2f26d6fe7e68773dee7afd217e4b405b6569f25c [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
Chris Austenb29d2e82016-06-07 12:25:35 -05009
George Keishing4d6c1da2016-07-15 05:51:22 -050010Suite Setup Open Connection And Log In
11Suite Teardown Close All Connections
Sivas SRRe1143ae2016-08-26 22:31:02 -050012Test Setup Initialize DBUS cmd "boot_policy"
Gunnar Millseac1af22016-11-14 15:30:09 -060013Test Teardown FFDC On Test Case Fail
Chris Austenb29d2e82016-06-07 12:25:35 -050014
15*** Variables ***
George Keishingec807372016-12-05 03:54:51 -060016${HOST_SETTINGS} ${SETTINGS_URI}host0
Chris Austenb29d2e82016-06-07 12:25:35 -050017
18*** Test Cases ***
19
20Set Onetime boot policy using REST
21 [Documentation] This testcase is to set onetime boot policy using REST
22 ... URI and then verify using REST API and ipmitool.\n
George Keishing314cf852016-08-26 09:02:16 -050023
Chris Austenb29d2e82016-06-07 12:25:35 -050024 Set Boot Policy ONETIME
25
George Keishingec807372016-12-05 03:54:51 -060026 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050027 Should Be Equal ${boot} ONETIME
Sivas SRRe1143ae2016-08-26 22:31:02 -050028 ${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
29 Should Be Empty ${stderr}
30 Should Contain ${output} ONETIME
Chris Austenb29d2e82016-06-07 12:25:35 -050031
32Set Permanent boot policy using REST
33 [Documentation] This testcase is to set permanent boot policy using REST
34 ... URI and then verify using REST API and ipmitool.\n
35
36 Set Boot Policy PERMANENT
37
George Keishingec807372016-12-05 03:54:51 -060038 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050039 Should Be Equal ${boot} PERMANENT
Sivas SRRe1143ae2016-08-26 22:31:02 -050040 ${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
41 Should Be Empty ${stderr}
42 Should Contain ${output} PERMANENT
Chris Austenb29d2e82016-06-07 12:25:35 -050043
44Set Onetime boot policy using IPMITOOL
45 [Documentation] This testcase is to set boot policy to onetime boot using ipmitool
46 ... and then verify using REST URI and ipmitool.\n
47
48 Run IPMI command 0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
George Keishingec807372016-12-05 03:54:51 -060049 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050050 Should Be Equal ${boot} ONETIME
Sivas SRRe1143ae2016-08-26 22:31:02 -050051 ${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
52 Should Be Empty ${stderr}
53 Should Contain ${output} ONETIME
George Keishing314cf852016-08-26 09:02:16 -050054
Chris Austenb29d2e82016-06-07 12:25:35 -050055Set Permanent boot policy using IPMITOOL
56 [Documentation] This testcase is to set boot policy to permanent using ipmitool
57 ... and then verify using REST URI and ipmitool.
58
59 Run IPMI command 0x0 0x8 0x05 0xC0 0x00 0x00 0x00 0x00
George Keishingec807372016-12-05 03:54:51 -060060 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050061 Should Be Equal ${boot} PERMANENT
Sivas SRRe1143ae2016-08-26 22:31:02 -050062 ${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
63 Should Be Empty ${stderr}
64 Should Contain ${output} PERMANENT
Chris Austenb29d2e82016-06-07 12:25:35 -050065
66Boot order with permanent boot policy
67 [Documentation] This testcase is to verify that boot order does not change
68 ... after first boot when boot policy set to permanent
causten147f5752016-08-11 16:24:45 -050069 [Tags] chassisboot
Chris Austenb29d2e82016-06-07 12:25:35 -050070
root442f0ef2016-08-04 20:23:05 +000071 Initiate Power Off
Chris Austenb29d2e82016-06-07 12:25:35 -050072
73 Set Boot Policy PERMANENT
74
75 Set Boot Device CDROM
76
root442f0ef2016-08-04 20:23:05 +000077 Initiate Power On
Chris Austenb29d2e82016-06-07 12:25:35 -050078
George Keishingec807372016-12-05 03:54:51 -060079 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050080 Should Be Equal ${boot} PERMANENT
81
George Keishingec807372016-12-05 03:54:51 -060082 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -050083 Should Be Equal ${flag} CDROM
84
George Keishingd3206882016-11-29 04:41:14 -060085Persist ONETIME Boot Policy After Reset
86 [Documentation] Verify ONETIME boot policy order does not change
87 ... on warm reset.
88 [Tags] chassisboot Persist_ONETIME Boot_Policy_After_Reset
causten147f5752016-08-11 16:24:45 -050089
root442f0ef2016-08-04 20:23:05 +000090 Initiate Power On
Chris Austenb29d2e82016-06-07 12:25:35 -050091
92 Set Boot Policy ONETIME
93
94 Set Boot Device Network
95
96 Trigger Warm Reset
97
George Keishingec807372016-12-05 03:54:51 -060098 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050099 Should Be Equal ${boot} ONETIME
100
George Keishingec807372016-12-05 03:54:51 -0600101 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -0500102 Should Be Equal ${flag} Network
103
George Keishingd3206882016-11-29 04:41:14 -0600104Persist PERMANENT Boot Policy After Reset
105 [Documentation] Verify PERMANENT boot policy order does not change
106 ... on warm reset.
107 [Tags] chassisboot Persist_PERMANENT_Boot_Policy_After_Reset
Chris Austenb29d2e82016-06-07 12:25:35 -0500108
root442f0ef2016-08-04 20:23:05 +0000109 Initiate Power On
Chris Austenb29d2e82016-06-07 12:25:35 -0500110
111 Set Boot Policy PERMANENT
112
113 Set Boot Device CDROM
114
115 Trigger Warm Reset
116
George Keishingec807372016-12-05 03:54:51 -0600117 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -0500118 Should Be Equal ${boot} PERMANENT
119
George Keishingec807372016-12-05 03:54:51 -0600120 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -0500121 Should Be Equal ${flag} CDROM
George Keishing314cf852016-08-26 09:02:16 -0500122
Chris Austenb29d2e82016-06-07 12:25:35 -0500123Set boot policy to invalid value
George Keishing5f62a4a2016-11-16 02:09:17 -0600124 [Documentation] This testcase verify that the boot policy doesn't get
125 ... updated with invalid policy supplied by user.
126 [Tags] Set_boot_policy_to_invalid_value
George Keishing314cf852016-08-26 09:02:16 -0500127
George Keishing5f62a4a2016-11-16 02:09:17 -0600128 Run Keyword and Ignore Error Set Boot Policy abc
Chris Austenb29d2e82016-06-07 12:25:35 -0500129
George Keishingec807372016-12-05 03:54:51 -0600130 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
George Keishing314cf852016-08-26 09:02:16 -0500131 Should Not Be Equal ${boot} abc
132
Chris Austenb29d2e82016-06-07 12:25:35 -0500133*** Keywords ***
134
135Set Boot Policy
136 [Arguments] ${args}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600137 ${bootpolicy}= Set Variable ${args}
138 ${valueDict}= create dictionary data=${bootpolicy}
George Keishingec807372016-12-05 03:54:51 -0600139 Write Attribute ${HOST_SETTINGS} boot_policy data=${valueDict}
Chris Austenb29d2e82016-06-07 12:25:35 -0500140
141Set Boot Device
142 [Arguments] ${args}
George Keishingec807372016-12-05 03:54:51 -0600143 ${bootDevice} = Set Variable ${args}
144 ${valueDict} = create dictionary data=${bootDevice}
145 Write Attribute ${HOST_SETTINGS} boot_flags data=${valueDict}
Sivas SRRe1143ae2016-08-26 22:31:02 -0500146
147
148