-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_boot.robot
212 lines (178 loc) · 9.64 KB
/
test_boot.robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
*** Settings ***
Documentation This testsuite is for testing the Boot Device Functions
Resource ../lib/rest_client.robot
Resource ../lib/ipmi_client.robot
Suite Setup Open Connection And Log In
Suite Teardown Close All Connections
*** Variables ***
${dbuscmd} = dbus-send --system --print-reply --dest=org.openbmc.settings.Host /org/openbmc/settings/host0 org.freedesktop.DBus.Properties.Get string:"org.openbmc.settings.Host" string:"boot_flags"
*** Test Cases ***
Set the Boot Device as Default using REST API
[Documentation] This testcase is to set the boot device as Default using REST
... URI. The Boot device is read using REST API and ipmitool.
${bootDevice} = Set Variable Default
${valueDict} = create dictionary data=${bootDevice}
Write Attribute /org/openbmc/settings/host0 boot_flags data=${valueDict}
Read the Attribute /org/openbmc/settings/host0 boot_flags
Response Should Be Equal Default
# ${output} = Run IPMI command 0x00 0x09 0x05 0x00 0x00
# ${output} = Run IPMI Standard command chassis bootparam get 5
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Should Be Empty ${stderr}
Log to Console \n ${output}
Should Contain ${output} Default
Set the Boot Device as Default using ipmitool
[Documentation] This testcase is to set the boot device as Default using
... ipmitool. The Boot device is read using REST API and
... ipmitool.
Run IPMI command 0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
Read the Attribute /org/openbmc/settings/host0 boot_flags
Response Should Be Equal Default
# ${output} = Run IPMI Standard command chassis bootparam get 5
# ${output} = Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Should Be Empty ${stderr}
Log to Console \n ${output}
Should Contain ${output} Default
Set the Boot Device as Network using REST API
[Documentation] This testcase is to set the boot device as Network using REST
... URI. The Boot device is read using REST API and ipmitool.
${bootDevice} = Set Variable Network
${valueDict} = create dictionary data=${bootDevice}
Write Attribute /org/openbmc/settings/host0 boot_flags data=${valueDict}
Read the Attribute /org/openbmc/settings/host0 boot_flags
Response Should Be Equal Network
# ${output} = Run IPMI Standard command chassis bootparam get 5
# ${output} = Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Log to Console \n ${output}
Should Be Empty ${stderr}
Should Contain ${output} Network
Set the Boot Device as Network using ipmitool
[Documentation] This testcase is to set the boot device as Network using
... ipmitool. The Boot device is read using REST API and
... ipmitool.
Run IPMI command 0x0 0x8 0x05 0x80 0x04 0x00 0x00 0x00
Read the Attribute /org/openbmc/settings/host0 boot_flags
Response Should Be Equal Network
# ${output} = Run IPMI Standard command chassis bootparam get 5
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Log to Console \n ${output}
Should Be Empty ${stderr}
Should Contain ${output} Network
Set the Boot Device as Disk using REST API
[Documentation] This testcase is to set the boot device as Disk using REST
... URI. The Boot device is read using REST API and ipmitool.
${bootDevice} = Set Variable Disk
${valueDict} = create dictionary data=${bootDevice}
Write Attribute /org/openbmc/settings/host0 boot_flags data=${valueDict}
Read the Attribute /org/openbmc/settings/host0 boot_flags
Response Should Be Equal Disk
# ${output} = Run IPMI Standard command chassis bootparam get 5
# ${output} = Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Log to Console \n ${output}
Should Be Empty ${stderr}
Should Contain ${output} Disk
Set the Boot Device as Disk using ipmitool
[Documentation] This testcase is to set the boot device as Disk using
... ipmitool. The Boot device is read using REST API and
... ipmitool.
Run IPMI command 0x0 0x8 0x05 0x80 0x08 0x00 0x00 0x00
Read the Attribute /org/openbmc/settings/host0 boot_flags
Response Should Be Equal Disk
# ${output} = Run IPMI Standard command chassis bootparam get 5
# ${output} = Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Log to Console \n ${output}
Should Be Empty ${stderr}
Should Contain ${output} Disk
Set the Boot Device as Safe using REST API
[Documentation] This testcase is to set the boot device as Safe using REST
... URI. The Boot device is read using REST API and ipmitool.
${bootDevice} = Set Variable Safe
${valueDict} = create dictionary data=${bootDevice}
Write Attribute /org/openbmc/settings/host0 boot_flags data=${valueDict}
Read the Attribute /org/openbmc/settings/host0 boot_flags
Response Should Be Equal Safe
# ${output} = Run IPMI Standard command chassis bootparam get 5
# ${output} = Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Log to Console \n ${output}
Should Be Empty ${stderr}
Should Contain ${output} Safe
Set the Boot Device as Safe using ipmitool
[Documentation] This testcase is to set the boot device as Safe using
... ipmitool. The Boot device is read using REST API and
... ipmitool.
Run IPMI command 0x0 0x8 0x05 0x80 0x0C 0x00 0x00 0x00
Read the Attribute /org/openbmc/settings/host0 boot_flags
Response Should Be Equal Safe
# ${output} = Run IPMI Standard command chassis bootparam get 5
# ${output} = Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Log to Console \n ${output}
Should Be Empty ${stderr}
Should Contain ${output} Safe
Set the Boot Device as CDROM using REST API
[Documentation] This testcase is to set the boot device as CDROM using REST
... URI. The Boot device is read using REST API and ipmitool.
${bootDevice} = Set Variable CDROM
${valueDict} = create dictionary data=${bootDevice}
Write Attribute /org/openbmc/settings/host0 boot_flags data=${valueDict}
Read the Attribute /org/openbmc/settings/host0 boot_flags
Response Should Be Equal CDROM
# ${output} = Run IPMI Standard command chassis bootparam get 5
# ${output} = Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Log to Console \n ${output}
Should Be Empty ${stderr}
Should Contain ${output} CDROM
Set the Boot Device as CDROM using ipmitool
[Documentation] This testcase is to set the boot device as CDROM using
... ipmitool. The Boot device is read using REST API and
... ipmitool.
Run IPMI command 0x0 0x8 0x05 0x80 0x14 0x00 0x00 0x00
Read the Attribute /org/openbmc/settings/host0 boot_flags
Response Should Be Equal CDROM
# ${output} = Run IPMI Standard command chassis bootparam get 5
# ${output} = Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Log to Console \n ${output}
Should Be Empty ${stderr}
Should Contain ${output} CDROM
Set the Boot Device as Setup using REST API
[Documentation] This testcase is to set the boot device as Setup using REST
... URI. The Boot device is read using REST API and ipmitool.
${bootDevice} = Set Variable Setup
${valueDict} = create dictionary data=${bootDevice}
Write Attribute /org/openbmc/settings/host0 boot_flags data=${valueDict}
Read the Attribute /org/openbmc/settings/host0 boot_flags
Response Should Be Equal Setup
# ${output} = Run IPMI Standard command chassis bootparam get 5
# ${output} = Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Log to Console \n ${output}
Should Be Empty ${stderr}
Should Contain ${output} Setup
Set the Boot Device as Setup using ipmitool
[Documentation] This testcase is to set the boot device as Setup using
... ipmitool. The Boot device is read using REST API and
... ipmitool.
Run IPMI command 0x0 0x8 0x05 0x80 0x18 0x00 0x00 0x00
Read the Attribute /org/openbmc/settings/host0 boot_flags
Response Should Be Equal Setup
# ${output} = Run IPMI Standard command chassis bootparam get 5
# ${output} = Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Log to Console \n ${output}
Should Be Empty ${stderr}
Should Contain ${output} Setup
*** Keywords ***
Response Should Be Equal
[arguments] ${args}
Should Be Equal ${OUTPUT} ${args}
Read the Attribute
[arguments] ${uri} ${parm}
${output} = Read Attribute ${uri} ${parm}
set test variable ${OUTPUT} ${output}