blob: ba56890f8dcba52e17733e89a81a2f1d4b1aed95 [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
Sweta Potthurie27b4392017-05-11 07:27:04 -050049Create Test Error Callout And Delete
50 [Documentation] Create Test Error Callout And Delete.
51 [Tags] Create_Test_Error_Callout_And_Delete
52
53 # Test error log entry example:
54 # "/xyz/openbmc_project/logging/entry/1": {
55 # "AdditionalData": [
56 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
57 # "CALLOUT_ERRNO_TEST=0",
58 # "DEV_ADDR=0x0DEADEAD"
59 # ],
60 # "Id": 1,
61 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
62 # "Resolved": 0,
63 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
64 # "Timestamp": 1487747332528,
65 # "associations": [
66 # [
67 # "callout",
68 # "fault",
69 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
70 # ]
71 # ]
72 # },
73 # "/xyz/openbmc_project/logging/entry/1/callout": {
74 # "endpoints": [
75 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
76 # ]
77 # },
78
79 Create Test Error With Callout
George Keishingad5817a2017-06-28 10:19:03 -050080 ${elog_entry}= Get Elog URL List
81 Delete Error Log Entry ${elog_entry[0]}
82 ${resp}= OpenBMC Get Request ${elog_entry[0]}/callout
Sweta Potthurie27b4392017-05-11 07:27:04 -050083 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
84
George Keishingad5817a2017-06-28 10:19:03 -050085
Sweta Potthurie27b4392017-05-11 07:27:04 -050086Create Two Test Error Callout And Delete
87 [Documentation] Create Two Test Error Callout And Delete.
88 [Tags] Create_Two_Test_Error_Callout_And_Delete
89
90 # Test error log entry example:
91 # "/xyz/openbmc_project/logging/entry/1": {
92 # "AdditionalData": [
93 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
94 # "CALLOUT_ERRNO_TEST=0",
95 # "DEV_ADDR=0x0DEADEAD"
96 # ],
97 # "Id": 1,
98 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
99 # "Resolved": 0,
100 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
101 # "Timestamp": 1487747332528,
102 # "associations": [
103 # [
104 # "callout",
105 # "fault",
106 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
107 # ]
108 # ]
109 # },
110 # "/xyz/openbmc_project/logging/entry/1/callout": {
111 # "endpoints": [
112 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
113 # ]
114 # },
115 # "/xyz/openbmc_project/logging/entry/2": {
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": 2,
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/2/callout": {
135 # "endpoints": [
136 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
137 # ]
138 # },
139
140 # Create two error logs.
141 Create Test Error With Callout
142 Create Test Error With Callout
143
144 # Delete entry/2 elog entry.
George Keishingad5817a2017-06-28 10:19:03 -0500145 ${elog_entry}= Get Elog URL List
146 Delete Error Log Entry ${elog_entry[1]}
Sweta Potthurie27b4392017-05-11 07:27:04 -0500147
148 # Verify if entry/1 exist and entry/2 is deleted.
George Keishingad5817a2017-06-28 10:19:03 -0500149 ${resp}= OpenBMC Get Request ${elog_entry[0]}
150 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
151 ${resp}= OpenBMC Get Request ${elog_entry[1]}
152 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
Chris Austenb29d2e82016-06-07 12:25:35 -0500153
Rahul Maheshwari43be6932017-05-01 02:37:06 -0500154Create Test Error Callout And Verify LED
155 [Documentation] Create an error log callout and verify respective
156 ... LED state.
157 [Tags] Create_Test_Error_Callout_And_Verify_LED
158
159 Create Test Error With Callout
160
161 ${resp}= Get LED State XYZ cpu0_fault
162 Should Be Equal ${resp} ${1}
163
Sweta Potthuriab73f9a2017-07-07 05:33:42 -0500164Set Resolved Field And Verify Callout Deletion
165 [Documentation] Set the "Resolved" error log and verify callout is deleted
166 [Tags] Set_Resolved_Field_And_Verify_Callout_Deletion
167
168 Delete Error logs
169 Create Test Error With Callout
170 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
171 ${resp}= OpenBMC Get Request ${elog_entry[0]}
172 ${jsondata}= To JSON ${resp.content}
173 Should Contain ${jsondata}["data"]["AdditionalData"] callout
174
175 # Set the error log field "Resolved".
176 # By doing so, the callout object should get deleted automatically.
177 ${valueDict}= Create Dictionary data=${1}
178 OpenBMC Put Request ${elog_entry[0]}/attr/Resolved data=${valueDict}
179
180 # Verify if the callout entry is deleted.
181 ${resp}= OpenBMC Get Request ${elog_entry[0]}/callout
182 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
Rahul Maheshwari43be6932017-05-01 02:37:06 -0500183
Chris Austenb29d2e82016-06-07 12:25:35 -0500184*** Keywords ***
185
George Keishingf58c4862017-03-28 13:01:03 -0500186Verify callout-test
187 [Documentation] Verify existence of prerequisite callout-test.
Chris Austenb29d2e82016-06-07 12:25:35 -0500188
George Keishingd434c512016-10-07 06:46:29 -0500189 Open Connection And Log In
George Keishingf58c4862017-03-28 13:01:03 -0500190 ${out} ${stderr}= Execute Command which callout-test return_stderr=True
191 Should Be Empty ${stderr}
192 Should Contain ${out} callout-test
193
194Clear Existing Error Logs
195 [Documentation] If error log isn't empty, restart the logging service on
196 ... the BMC
197
Rahul Maheshwari43be6932017-05-01 02:37:06 -0500198 Open Connection And Log In
George Keishingad5817a2017-06-28 10:19:03 -0500199 Delete Error Logs
200 ${resp}= OpenBMC Get Request /xyz/openbmc_project/logging/entry/
George Keishingf58c4862017-03-28 13:01:03 -0500201 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
202
George Keishingf58c4862017-03-28 13:01:03 -0500203Create Test Error With Callout
204 [Documentation] Generate test error log with callout for CPU0.
205
206 # Test error log entry example:
207 # "/xyz/openbmc_project/logging/entry/4": {
208 # "AdditionalData": [
209 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
210 # "CALLOUT_ERRNO_TEST=0",
211 # "DEV_ADDR=0x0DEADEAD"
212 # ],
213 # "Id": 4,
214 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
215 # "Resolved": 0,
216 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
217 # "Timestamp": 1487747332528,
218 # "associations": [
219 # [
220 # "callout",
221 # "fault",
222 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
223 # ]
224 # ]
225 # },
226 # "/xyz/openbmc_project/logging/entry/4/callout": {
227 # "endpoints": [
228 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
229 # ]
230 # },
231
232 Execute Command On BMC
233 ... callout-test /sys/devices/platform/fsi-master/slave@00:00
234
235Verify Test Error Log And Callout
236 [Documentation] Verify test error log entries.
George Keishingad5817a2017-06-28 10:19:03 -0500237 ${elog_entry}= Get Elog URL List
238 ${resp}= OpenBMC Get Request ${elog_entry[0]}
239 ${json}= To JSON ${resp.content}
240
241 Should Be Equal ${json["data"]["Message"]}
George Keishingf58c4862017-03-28 13:01:03 -0500242 ... example.xyz.openbmc_project.Example.Elog.TestCallout
George Keishingad5817a2017-06-28 10:19:03 -0500243
244 Should Be Equal ${json["data"]["Severity"]}
George Keishingf58c4862017-03-28 13:01:03 -0500245 ... xyz.openbmc_project.Logging.Entry.Level.Error
George Keishingad5817a2017-06-28 10:19:03 -0500246
247 ${content}= Read Attribute ${elog_entry[0]}/callout endpoints
George Keishingf58c4862017-03-28 13:01:03 -0500248 Should Be Equal ${content[0]}
249 ... /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
250
251Boot Host
252 [Documentation] Boot the host if current state is "Off".
253 ${current_state}= Get Host State
254 Run Keyword If '${current_state}' == 'Off'
255 ... Initiate Host Boot
256
257 Wait Until Keyword Succeeds
258 ... 10 min 10 sec Is OS Starting