blob: a2fe3dad4b7dd136b17e4ceada3ce1dc3e877e00 [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
10... Boot Host AND
11... Clear Existing Error Logs
Rahul Maheshwari43be6932017-05-01 02:37:06 -050012Test Setup Pre Test Case Execution
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
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
41 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
42 ${jsondata}= To JSON ${resp.content}
43 Should Contain ${jsondata}["data"]["AdditionalData"]} ${target_device_path}
44 Should Contain ${jsondata}["data"]["AdditionalData"]} 0x0DEADEAD
45
46Create Test Error Callout And Delete
47 [Documentation] Create Test Error Callout And Delete.
48 [Tags] Create_Test_Error_Callout_And_Delete
49
50 # Test error log entry example:
51 # "/xyz/openbmc_project/logging/entry/1": {
52 # "AdditionalData": [
53 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
54 # "CALLOUT_ERRNO_TEST=0",
55 # "DEV_ADDR=0x0DEADEAD"
56 # ],
57 # "Id": 1,
58 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
59 # "Resolved": 0,
60 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
61 # "Timestamp": 1487747332528,
62 # "associations": [
63 # [
64 # "callout",
65 # "fault",
66 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
67 # ]
68 # ]
69 # },
70 # "/xyz/openbmc_project/logging/entry/1/callout": {
71 # "endpoints": [
72 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
73 # ]
74 # },
75
76 Create Test Error With Callout
77 Delete Error Log Entry ${BMC_LOGGING_ENTRY}${1}
78 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}/callout
79 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
80
81Create Two Test Error Callout And Delete
82 [Documentation] Create Two Test Error Callout And Delete.
83 [Tags] Create_Two_Test_Error_Callout_And_Delete
84
85 # Test error log entry example:
86 # "/xyz/openbmc_project/logging/entry/1": {
87 # "AdditionalData": [
88 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
89 # "CALLOUT_ERRNO_TEST=0",
90 # "DEV_ADDR=0x0DEADEAD"
91 # ],
92 # "Id": 1,
93 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
94 # "Resolved": 0,
95 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
96 # "Timestamp": 1487747332528,
97 # "associations": [
98 # [
99 # "callout",
100 # "fault",
101 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
102 # ]
103 # ]
104 # },
105 # "/xyz/openbmc_project/logging/entry/1/callout": {
106 # "endpoints": [
107 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
108 # ]
109 # },
110 # "/xyz/openbmc_project/logging/entry/2": {
111 # "AdditionalData": [
112 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
113 # "CALLOUT_ERRNO_TEST=0",
114 # "DEV_ADDR=0x0DEADEAD"
115 # ],
116 # "Id": 2,
117 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
118 # "Resolved": 0,
119 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
120 # "Timestamp": 1487747332528,
121 # "associations": [
122 # [
123 # "callout",
124 # "fault",
125 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
126 # ]
127 # ]
128 # },
129 # "/xyz/openbmc_project/logging/entry/2/callout": {
130 # "endpoints": [
131 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
132 # ]
133 # },
134
135 # Create two error logs.
136 Create Test Error With Callout
137 Create Test Error With Callout
138
139 # Delete entry/2 elog entry.
140 Delete Error Log Entry ${BMC_LOGGING_ENTRY}${2}
141
142 # Verify if entry/1 exist and entry/2 is deleted.
143 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/list
144 ${jsondata}= To JSON ${resp.content}
145 Should Contain ${jsondata["data"]} ${BMC_LOGGING_ENTRY}${1}
146 Should Not Contain ${jsondata["data"]} ${BMC_LOGGING_ENTRY}${2}
Chris Austenb29d2e82016-06-07 12:25:35 -0500147
Rahul Maheshwari43be6932017-05-01 02:37:06 -0500148Create Test Error Callout And Verify LED
149 [Documentation] Create an error log callout and verify respective
150 ... LED state.
151 [Tags] Create_Test_Error_Callout_And_Verify_LED
152
153 Create Test Error With Callout
154
155 ${resp}= Get LED State XYZ cpu0_fault
156 Should Be Equal ${resp} ${1}
157
158
Chris Austenb29d2e82016-06-07 12:25:35 -0500159*** Keywords ***
160
Rahul Maheshwari43be6932017-05-01 02:37:06 -0500161Pre Test Case Execution
162 [Documentation] Do the initial test setup.
163
164 Open Connection And Log In
165 Delete Error logs
166
George Keishingf58c4862017-03-28 13:01:03 -0500167Verify callout-test
168 [Documentation] Verify existence of prerequisite callout-test.
Chris Austenb29d2e82016-06-07 12:25:35 -0500169
George Keishingd434c512016-10-07 06:46:29 -0500170 Open Connection And Log In
George Keishingf58c4862017-03-28 13:01:03 -0500171 ${out} ${stderr}= Execute Command which callout-test return_stderr=True
172 Should Be Empty ${stderr}
173 Should Contain ${out} callout-test
174
175Clear Existing Error Logs
176 [Documentation] If error log isn't empty, restart the logging service on
177 ... the BMC
178
Rahul Maheshwari43be6932017-05-01 02:37:06 -0500179 Open Connection And Log In
George Keishingf58c4862017-03-28 13:01:03 -0500180 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
181 Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND}
182 Execute Command On BMC
183 ... systemctl restart xyz.openbmc_project.Logging.service
184 Sleep 10s reason=Wait for logging service to restart properly.
185 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
186 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
187
George Keishingf58c4862017-03-28 13:01:03 -0500188Create Test Error With Callout
189 [Documentation] Generate test error log with callout for CPU0.
190
191 # Test error log entry example:
192 # "/xyz/openbmc_project/logging/entry/4": {
193 # "AdditionalData": [
194 # "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
195 # "CALLOUT_ERRNO_TEST=0",
196 # "DEV_ADDR=0x0DEADEAD"
197 # ],
198 # "Id": 4,
199 # "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
200 # "Resolved": 0,
201 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
202 # "Timestamp": 1487747332528,
203 # "associations": [
204 # [
205 # "callout",
206 # "fault",
207 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
208 # ]
209 # ]
210 # },
211 # "/xyz/openbmc_project/logging/entry/4/callout": {
212 # "endpoints": [
213 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
214 # ]
215 # },
216
217 Execute Command On BMC
218 ... callout-test /sys/devices/platform/fsi-master/slave@00:00
219
220Verify Test Error Log And Callout
221 [Documentation] Verify test error log entries.
222 ${content}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Message
223 Should Be Equal ${content}
224 ... example.xyz.openbmc_project.Example.Elog.TestCallout
225 ${content}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Severity
226 Should Be Equal ${content}
227 ... xyz.openbmc_project.Logging.Entry.Level.Error
228 ${content}= Read Attribute ${BMC_LOGGING_ENTRY}${1}/callout endpoints
229 Should Be Equal ${content[0]}
230 ... /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
231
232Boot Host
233 [Documentation] Boot the host if current state is "Off".
234 ${current_state}= Get Host State
235 Run Keyword If '${current_state}' == 'Off'
236 ... Initiate Host Boot
237
238 Wait Until Keyword Succeeds
239 ... 10 min 10 sec Is OS Starting