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