blob: db99e120190b876c3ae820b7cb172b35994be4ac [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
George Keishing95c371a2017-09-14 15:42:33 -05008Resource ../lib/boot_utils.robot
Chris Austenb29d2e82016-06-07 12:25:35 -05009
George Keishing95c371a2017-09-14 15:42:33 -050010Test Setup Test Setup Execution
George Keishingf58c4862017-03-28 13:01:03 -050011Test Teardown Close All Connections
George Keishingd434c512016-10-07 06:46:29 -050012
Sweta Potthurie27b4392017-05-11 07:27:04 -050013***Variables***
George Keishingf2fe7452017-08-24 09:40:46 -050014${target_device_path} /sys/devices/platform/gpio-fsi/fsi0/slave@00:00/raw
Sweta Potthurie27b4392017-05-11 07:27:04 -050015
George Keishing95c371a2017-09-14 15:42:33 -050016${stack_mode} skip
17
Chris Austenb29d2e82016-06-07 12:25:35 -050018*** Test Cases ***
19
George Keishingf58c4862017-03-28 13:01:03 -050020Create Test Error Callout And Verify
21 [Documentation] Create error log callout and verify via REST.
22 [Tags] Create_Test_Error_Callout_And_Verify
Chris Austenb29d2e82016-06-07 12:25:35 -050023
George Keishingf58c4862017-03-28 13:01:03 -050024 Create Test Error With Callout
25 Verify Test Error Log And Callout
Chris Austenb29d2e82016-06-07 12:25:35 -050026
George Keishingad5817a2017-06-28 10:19:03 -050027
Sweta Potthurie27b4392017-05-11 07:27:04 -050028Create Test Error Callout And Verify AdditionalData
29 [Documentation] Create Test Error Callout And Verify AdditionalData.
30 [Tags] Create_Test_Error_Callout_And_Verify_AdditionalData
31
32 # Test error log entry example:
33 # "/xyz/openbmc_project/logging/entry/1": {
34 # "AdditionalData": [
35 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
36 # "CALLOUT_ERRNO_TEST=0",
37 # "DEV_ADDR=0x0DEADEAD"
38 # ]
39
40 Create Test Error With Callout
George Keishingad5817a2017-06-28 10:19:03 -050041 ${elog_entry}= Get Elog URL List
42 ${resp}= OpenBMC Get Request ${elog_entry[0]}
Sweta Potthurie27b4392017-05-11 07:27:04 -050043 ${jsondata}= To JSON ${resp.content}
44 Should Contain ${jsondata}["data"]["AdditionalData"]} ${target_device_path}
45 Should Contain ${jsondata}["data"]["AdditionalData"]} 0x0DEADEAD
46
George Keishingad5817a2017-06-28 10:19:03 -050047
George Keishingc41eaa72017-07-27 04:04:32 -050048Create Test Error Callout And Verify Associations
49 [Documentation] Create test error callout and verify associations.
50 [Tags] Create_Test_Error_Callout_And_Verify_Associations
51
52 # Test error log association entry example:
53 # "associations": [
54 # [
55 # "callout",
56 # "fault",
57 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
58 # ]
59 # ]
60
61 Create Test Error With Callout
62 ${elog_entry}= Get Elog URL List
63 ${resp}= OpenBMC Get Request ${elog_entry[0]}
64 ${jsondata}= To JSON ${resp.content}
65 List Should Contain Value ${jsondata}["data"]["associations"]} callout
66 List Should Contain Value ${jsondata}["data"]["associations"]} fault
67 List Should Contain Value
68 ... ${jsondata}["data"]["associations"]}
69 ... /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
70
71
Sweta Potthurie27b4392017-05-11 07:27:04 -050072Create Test Error Callout And Delete
73 [Documentation] Create Test Error Callout And Delete.
74 [Tags] Create_Test_Error_Callout_And_Delete
75
76 # Test error log entry example:
77 # "/xyz/openbmc_project/logging/entry/1": {
78 # "AdditionalData": [
79 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
80 # "CALLOUT_ERRNO_TEST=0",
81 # "DEV_ADDR=0x0DEADEAD"
82 # ],
83 # "Id": 1,
84 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
85 # "Resolved": 0,
86 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
87 # "Timestamp": 1487747332528,
88 # "associations": [
89 # [
90 # "callout",
91 # "fault",
92 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
93 # ]
94 # ]
95 # },
96 # "/xyz/openbmc_project/logging/entry/1/callout": {
97 # "endpoints": [
98 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
99 # ]
100 # },
101
102 Create Test Error With Callout
George Keishingad5817a2017-06-28 10:19:03 -0500103 ${elog_entry}= Get Elog URL List
104 Delete Error Log Entry ${elog_entry[0]}
105 ${resp}= OpenBMC Get Request ${elog_entry[0]}/callout
Sweta Potthurie27b4392017-05-11 07:27:04 -0500106 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
107
George Keishingad5817a2017-06-28 10:19:03 -0500108
Sweta Potthurie27b4392017-05-11 07:27:04 -0500109Create Two Test Error Callout And Delete
110 [Documentation] Create Two Test Error Callout And Delete.
111 [Tags] Create_Two_Test_Error_Callout_And_Delete
112
113 # Test error log entry example:
114 # "/xyz/openbmc_project/logging/entry/1": {
115 # "AdditionalData": [
116 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
117 # "CALLOUT_ERRNO_TEST=0",
118 # "DEV_ADDR=0x0DEADEAD"
119 # ],
120 # "Id": 1,
121 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
122 # "Resolved": 0,
123 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
124 # "Timestamp": 1487747332528,
125 # "associations": [
126 # [
127 # "callout",
128 # "fault",
129 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
130 # ]
131 # ]
132 # },
133 # "/xyz/openbmc_project/logging/entry/1/callout": {
134 # "endpoints": [
135 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
136 # ]
137 # },
138 # "/xyz/openbmc_project/logging/entry/2": {
139 # "AdditionalData": [
140 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
141 # "CALLOUT_ERRNO_TEST=0",
142 # "DEV_ADDR=0x0DEADEAD"
143 # ],
144 # "Id": 2,
145 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
146 # "Resolved": 0,
147 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
148 # "Timestamp": 1487747332528,
149 # "associations": [
150 # [
151 # "callout",
152 # "fault",
153 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
154 # ]
155 # ]
156 # },
157 # "/xyz/openbmc_project/logging/entry/2/callout": {
158 # "endpoints": [
159 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
160 # ]
161 # },
162
163 # Create two error logs.
164 Create Test Error With Callout
165 Create Test Error With Callout
166
167 # Delete entry/2 elog entry.
George Keishingad5817a2017-06-28 10:19:03 -0500168 ${elog_entry}= Get Elog URL List
169 Delete Error Log Entry ${elog_entry[1]}
Sweta Potthurie27b4392017-05-11 07:27:04 -0500170
171 # Verify if entry/1 exist and entry/2 is deleted.
George Keishingad5817a2017-06-28 10:19:03 -0500172 ${resp}= OpenBMC Get Request ${elog_entry[0]}
173 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
174 ${resp}= OpenBMC Get Request ${elog_entry[1]}
175 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
Chris Austenb29d2e82016-06-07 12:25:35 -0500176
Rahul Maheshwari43be6932017-05-01 02:37:06 -0500177Create Test Error Callout And Verify LED
178 [Documentation] Create an error log callout and verify respective
179 ... LED state.
180 [Tags] Create_Test_Error_Callout_And_Verify_LED
181
182 Create Test Error With Callout
183
184 ${resp}= Get LED State XYZ cpu0_fault
185 Should Be Equal ${resp} ${1}
186
Sweta Potthuriab73f9a2017-07-07 05:33:42 -0500187Set Resolved Field And Verify Callout Deletion
188 [Documentation] Set the "Resolved" error log and verify callout is deleted
189 [Tags] Set_Resolved_Field_And_Verify_Callout_Deletion
190
George Keishingcc71c3c2017-09-20 09:38:03 -0500191 Delete All Error Logs
Sweta Potthuriab73f9a2017-07-07 05:33:42 -0500192 Create Test Error With Callout
193 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
194 ${resp}= OpenBMC Get Request ${elog_entry[0]}
195 ${jsondata}= To JSON ${resp.content}
196 Should Contain ${jsondata}["data"]["AdditionalData"] callout
197
198 # Set the error log field "Resolved".
199 # By doing so, the callout object should get deleted automatically.
200 ${valueDict}= Create Dictionary data=${1}
201 OpenBMC Put Request ${elog_entry[0]}/attr/Resolved data=${valueDict}
202
203 # Verify if the callout entry is deleted.
204 ${resp}= OpenBMC Get Request ${elog_entry[0]}/callout
205 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
Rahul Maheshwari43be6932017-05-01 02:37:06 -0500206
Chris Austenb29d2e82016-06-07 12:25:35 -0500207*** Keywords ***
208
George Keishing95c371a2017-09-14 15:42:33 -0500209Callout Test Binary Exist
George Keishingf58c4862017-03-28 13:01:03 -0500210 [Documentation] Verify existence of prerequisite callout-test.
Chris Austenb29d2e82016-06-07 12:25:35 -0500211
George Keishingd434c512016-10-07 06:46:29 -0500212 Open Connection And Log In
George Keishing95c371a2017-09-14 15:42:33 -0500213 ${out} ${stderr}= Execute Command
214 ... which /tmp/tarball/bin/callout-test return_stderr=True
George Keishingf58c4862017-03-28 13:01:03 -0500215 Should Be Empty ${stderr}
216 Should Contain ${out} callout-test
217
George Keishingf58c4862017-03-28 13:01:03 -0500218
George Keishingf58c4862017-03-28 13:01:03 -0500219Create Test Error With Callout
220 [Documentation] Generate test error log with callout for CPU0.
221
222 # Test error log entry example:
223 # "/xyz/openbmc_project/logging/entry/4": {
224 # "AdditionalData": [
225 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
226 # "CALLOUT_ERRNO_TEST=0",
227 # "DEV_ADDR=0x0DEADEAD"
228 # ],
229 # "Id": 4,
230 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
231 # "Resolved": 0,
232 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
233 # "Timestamp": 1487747332528,
234 # "associations": [
235 # [
236 # "callout",
237 # "fault",
238 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
239 # ]
240 # ]
241 # },
242 # "/xyz/openbmc_project/logging/entry/4/callout": {
243 # "endpoints": [
244 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
245 # ]
246 # },
247
248 Execute Command On BMC
George Keishing95c371a2017-09-14 15:42:33 -0500249 ... /tmp/tarball/bin/callout-test ${target_device_path}
George Keishingf58c4862017-03-28 13:01:03 -0500250
251Verify Test Error Log And Callout
252 [Documentation] Verify test error log entries.
George Keishingad5817a2017-06-28 10:19:03 -0500253 ${elog_entry}= Get Elog URL List
254 ${resp}= OpenBMC Get Request ${elog_entry[0]}
255 ${json}= To JSON ${resp.content}
256
257 Should Be Equal ${json["data"]["Message"]}
George Keishingf58c4862017-03-28 13:01:03 -0500258 ... example.xyz.openbmc_project.Example.Elog.TestCallout
George Keishingad5817a2017-06-28 10:19:03 -0500259
260 Should Be Equal ${json["data"]["Severity"]}
George Keishingf58c4862017-03-28 13:01:03 -0500261 ... xyz.openbmc_project.Logging.Entry.Level.Error
George Keishingad5817a2017-06-28 10:19:03 -0500262
263 ${content}= Read Attribute ${elog_entry[0]}/callout endpoints
George Keishingf58c4862017-03-28 13:01:03 -0500264 Should Be Equal ${content[0]}
265 ... /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
266
George Keishing95c371a2017-09-14 15:42:33 -0500267
268Test Setup Execution
Sweta Potthuri04c68d72017-07-19 06:06:50 -0500269 [Documentation] Do test case setup tasks.
George Keishing95c371a2017-09-14 15:42:33 -0500270
George Keishing5ee22d62018-05-07 02:23:09 -0500271 REST Power On stack_mode=skip quiet=1
Sweta Potthuri04c68d72017-07-19 06:06:50 -0500272 ${status}= Run Keyword And Return Status Callout Test Binary Exist
273 Run Keyword If ${status} == ${False} Install Tarball
274 Delete All Error Logs
George Keishing95c371a2017-09-14 15:42:33 -0500275
276
277Install Tarball
278 [Documentation] Install tarball on BMC.
279
280 Run Keyword If '${DEBUG_TARBALL_PATH}' == '${EMPTY}' Return from Keyword
281 BMC Execute Command rm -rf /tmp/tarball
282 Install Debug Tarball On BMC ${DEBUG_TARBALL_PATH}