blob: 478f17c7cd0b66008ad278670d44426546c70f29 [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
George Keishingf58c4862017-03-28 13:01:03 -05002Documentation Test Error callout association.
Chris Austenb29d2e82016-06-07 12:25:35 -05003
George Keishingf58c4862017-03-28 13:01:03 -05004Resource ../lib/connection_client.robot
5Resource ../lib/openbmc_ffdc.robot
6Resource ../lib/utils.robot
7Resource ../lib/state_manager.robot
Chris Austenb29d2e82016-06-07 12:25:35 -05008
George Keishingf58c4862017-03-28 13:01:03 -05009Suite Setup Run Keywords Verify callout-test AND
George Keishingad5817a2017-06-28 10:19:03 -050010... Boot Host
11Test Setup Clear Existing Error Logs
12
George Keishingf58c4862017-03-28 13:01:03 -050013Test Teardown Close All Connections
14Suite Teardown Clear Existing Error Logs
George Keishingd434c512016-10-07 06:46:29 -050015
Sweta Potthurie27b4392017-05-11 07:27:04 -050016***Variables***
17${target_device_path} /sys/devices/platform/fsi-master/slave@00:00
18
Chris Austenb29d2e82016-06-07 12:25:35 -050019*** Test Cases ***
20
George Keishingf58c4862017-03-28 13:01:03 -050021Create Test Error Callout And Verify
22 [Documentation] Create error log callout and verify via REST.
23 [Tags] Create_Test_Error_Callout_And_Verify
Chris Austenb29d2e82016-06-07 12:25:35 -050024
George Keishingf58c4862017-03-28 13:01:03 -050025 Create Test Error With Callout
26 Verify Test Error Log And Callout
Chris Austenb29d2e82016-06-07 12:25:35 -050027
George Keishingad5817a2017-06-28 10:19:03 -050028
Sweta Potthurie27b4392017-05-11 07:27:04 -050029Create Test Error Callout And Verify AdditionalData
30 [Documentation] Create Test Error Callout And Verify AdditionalData.
31 [Tags] Create_Test_Error_Callout_And_Verify_AdditionalData
32
33 # Test error log entry example:
34 # "/xyz/openbmc_project/logging/entry/1": {
35 # "AdditionalData": [
36 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
37 # "CALLOUT_ERRNO_TEST=0",
38 # "DEV_ADDR=0x0DEADEAD"
39 # ]
40
41 Create Test Error With Callout
George Keishingad5817a2017-06-28 10:19:03 -050042 ${elog_entry}= Get Elog URL List
43 ${resp}= OpenBMC Get Request ${elog_entry[0]}
Sweta Potthurie27b4392017-05-11 07:27:04 -050044 ${jsondata}= To JSON ${resp.content}
45 Should Contain ${jsondata}["data"]["AdditionalData"]} ${target_device_path}
46 Should Contain ${jsondata}["data"]["AdditionalData"]} 0x0DEADEAD
47
George Keishingad5817a2017-06-28 10:19:03 -050048
George Keishingc41eaa72017-07-27 04:04:32 -050049Create Test Error Callout And Verify Associations
50 [Documentation] Create test error callout and verify associations.
51 [Tags] Create_Test_Error_Callout_And_Verify_Associations
52
53 # Test error log association entry example:
54 # "associations": [
55 # [
56 # "callout",
57 # "fault",
58 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
59 # ]
60 # ]
61
62 Create Test Error With Callout
63 ${elog_entry}= Get Elog URL List
64 ${resp}= OpenBMC Get Request ${elog_entry[0]}
65 ${jsondata}= To JSON ${resp.content}
66 List Should Contain Value ${jsondata}["data"]["associations"]} callout
67 List Should Contain Value ${jsondata}["data"]["associations"]} fault
68 List Should Contain Value
69 ... ${jsondata}["data"]["associations"]}
70 ... /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
71
72
Sweta Potthurie27b4392017-05-11 07:27:04 -050073Create Test Error Callout And Delete
74 [Documentation] Create Test Error Callout And Delete.
75 [Tags] Create_Test_Error_Callout_And_Delete
76
77 # Test error log entry example:
78 # "/xyz/openbmc_project/logging/entry/1": {
79 # "AdditionalData": [
80 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
81 # "CALLOUT_ERRNO_TEST=0",
82 # "DEV_ADDR=0x0DEADEAD"
83 # ],
84 # "Id": 1,
85 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
86 # "Resolved": 0,
87 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
88 # "Timestamp": 1487747332528,
89 # "associations": [
90 # [
91 # "callout",
92 # "fault",
93 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
94 # ]
95 # ]
96 # },
97 # "/xyz/openbmc_project/logging/entry/1/callout": {
98 # "endpoints": [
99 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
100 # ]
101 # },
102
103 Create Test Error With Callout
George Keishingad5817a2017-06-28 10:19:03 -0500104 ${elog_entry}= Get Elog URL List
105 Delete Error Log Entry ${elog_entry[0]}
106 ${resp}= OpenBMC Get Request ${elog_entry[0]}/callout
Sweta Potthurie27b4392017-05-11 07:27:04 -0500107 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
108
George Keishingad5817a2017-06-28 10:19:03 -0500109
Sweta Potthurie27b4392017-05-11 07:27:04 -0500110Create Two Test Error Callout And Delete
111 [Documentation] Create Two Test Error Callout And Delete.
112 [Tags] Create_Two_Test_Error_Callout_And_Delete
113
114 # Test error log entry example:
115 # "/xyz/openbmc_project/logging/entry/1": {
116 # "AdditionalData": [
117 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
118 # "CALLOUT_ERRNO_TEST=0",
119 # "DEV_ADDR=0x0DEADEAD"
120 # ],
121 # "Id": 1,
122 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
123 # "Resolved": 0,
124 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
125 # "Timestamp": 1487747332528,
126 # "associations": [
127 # [
128 # "callout",
129 # "fault",
130 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
131 # ]
132 # ]
133 # },
134 # "/xyz/openbmc_project/logging/entry/1/callout": {
135 # "endpoints": [
136 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
137 # ]
138 # },
139 # "/xyz/openbmc_project/logging/entry/2": {
140 # "AdditionalData": [
141 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
142 # "CALLOUT_ERRNO_TEST=0",
143 # "DEV_ADDR=0x0DEADEAD"
144 # ],
145 # "Id": 2,
146 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
147 # "Resolved": 0,
148 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
149 # "Timestamp": 1487747332528,
150 # "associations": [
151 # [
152 # "callout",
153 # "fault",
154 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
155 # ]
156 # ]
157 # },
158 # "/xyz/openbmc_project/logging/entry/2/callout": {
159 # "endpoints": [
160 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
161 # ]
162 # },
163
164 # Create two error logs.
165 Create Test Error With Callout
166 Create Test Error With Callout
167
168 # Delete entry/2 elog entry.
George Keishingad5817a2017-06-28 10:19:03 -0500169 ${elog_entry}= Get Elog URL List
170 Delete Error Log Entry ${elog_entry[1]}
Sweta Potthurie27b4392017-05-11 07:27:04 -0500171
172 # Verify if entry/1 exist and entry/2 is deleted.
George Keishingad5817a2017-06-28 10:19:03 -0500173 ${resp}= OpenBMC Get Request ${elog_entry[0]}
174 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
175 ${resp}= OpenBMC Get Request ${elog_entry[1]}
176 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
Chris Austenb29d2e82016-06-07 12:25:35 -0500177
Rahul Maheshwari43be6932017-05-01 02:37:06 -0500178Create Test Error Callout And Verify LED
179 [Documentation] Create an error log callout and verify respective
180 ... LED state.
181 [Tags] Create_Test_Error_Callout_And_Verify_LED
182
183 Create Test Error With Callout
184
185 ${resp}= Get LED State XYZ cpu0_fault
186 Should Be Equal ${resp} ${1}
187
Sweta Potthuriab73f9a2017-07-07 05:33:42 -0500188Set Resolved Field And Verify Callout Deletion
189 [Documentation] Set the "Resolved" error log and verify callout is deleted
190 [Tags] Set_Resolved_Field_And_Verify_Callout_Deletion
191
192 Delete Error logs
193 Create Test Error With Callout
194 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
195 ${resp}= OpenBMC Get Request ${elog_entry[0]}
196 ${jsondata}= To JSON ${resp.content}
197 Should Contain ${jsondata}["data"]["AdditionalData"] callout
198
199 # Set the error log field "Resolved".
200 # By doing so, the callout object should get deleted automatically.
201 ${valueDict}= Create Dictionary data=${1}
202 OpenBMC Put Request ${elog_entry[0]}/attr/Resolved data=${valueDict}
203
204 # Verify if the callout entry is deleted.
205 ${resp}= OpenBMC Get Request ${elog_entry[0]}/callout
206 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
Rahul Maheshwari43be6932017-05-01 02:37:06 -0500207
Chris Austenb29d2e82016-06-07 12:25:35 -0500208*** Keywords ***
209
George Keishingf58c4862017-03-28 13:01:03 -0500210Verify callout-test
211 [Documentation] Verify existence of prerequisite callout-test.
Chris Austenb29d2e82016-06-07 12:25:35 -0500212
George Keishingd434c512016-10-07 06:46:29 -0500213 Open Connection And Log In
George Keishingf58c4862017-03-28 13:01:03 -0500214 ${out} ${stderr}= Execute Command which callout-test return_stderr=True
215 Should Be Empty ${stderr}
216 Should Contain ${out} callout-test
217
218Clear Existing Error Logs
219 [Documentation] If error log isn't empty, restart the logging service on
220 ... the BMC
221
Rahul Maheshwari43be6932017-05-01 02:37:06 -0500222 Open Connection And Log In
George Keishingad5817a2017-06-28 10:19:03 -0500223 Delete Error Logs
224 ${resp}= OpenBMC Get Request /xyz/openbmc_project/logging/entry/
George Keishingf58c4862017-03-28 13:01:03 -0500225 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
226
George Keishingf58c4862017-03-28 13:01:03 -0500227Create Test Error With Callout
228 [Documentation] Generate test error log with callout for CPU0.
229
230 # Test error log entry example:
231 # "/xyz/openbmc_project/logging/entry/4": {
232 # "AdditionalData": [
233 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
234 # "CALLOUT_ERRNO_TEST=0",
235 # "DEV_ADDR=0x0DEADEAD"
236 # ],
237 # "Id": 4,
238 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
239 # "Resolved": 0,
240 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
241 # "Timestamp": 1487747332528,
242 # "associations": [
243 # [
244 # "callout",
245 # "fault",
246 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
247 # ]
248 # ]
249 # },
250 # "/xyz/openbmc_project/logging/entry/4/callout": {
251 # "endpoints": [
252 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
253 # ]
254 # },
255
256 Execute Command On BMC
257 ... callout-test /sys/devices/platform/fsi-master/slave@00:00
258
259Verify Test Error Log And Callout
260 [Documentation] Verify test error log entries.
George Keishingad5817a2017-06-28 10:19:03 -0500261 ${elog_entry}= Get Elog URL List
262 ${resp}= OpenBMC Get Request ${elog_entry[0]}
263 ${json}= To JSON ${resp.content}
264
265 Should Be Equal ${json["data"]["Message"]}
George Keishingf58c4862017-03-28 13:01:03 -0500266 ... example.xyz.openbmc_project.Example.Elog.TestCallout
George Keishingad5817a2017-06-28 10:19:03 -0500267
268 Should Be Equal ${json["data"]["Severity"]}
George Keishingf58c4862017-03-28 13:01:03 -0500269 ... xyz.openbmc_project.Logging.Entry.Level.Error
George Keishingad5817a2017-06-28 10:19:03 -0500270
271 ${content}= Read Attribute ${elog_entry[0]}/callout endpoints
George Keishingf58c4862017-03-28 13:01:03 -0500272 Should Be Equal ${content[0]}
273 ... /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
274
275Boot Host
276 [Documentation] Boot the host if current state is "Off".
277 ${current_state}= Get Host State
278 Run Keyword If '${current_state}' == 'Off'
279 ... Initiate Host Boot
280
281 Wait Until Keyword Succeeds
282 ... 10 min 10 sec Is OS Starting