blob: 86c98ccb6472807d843a1554db777dc0cdced961 [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
George Keishing4d6c1da2016-07-15 05:51:22 -05002Documentation This suite is used for testing eventlog association.
Chris Austenb29d2e82016-06-07 12:25:35 -05003
George Keishing4d6c1da2016-07-15 05:51:22 -05004Resource ../lib/rest_client.robot
5Resource ../lib/utils.robot
6Resource ../lib/connection_client.robot
George Keishingd55a4be2016-08-26 03:28:17 -05007Resource ../lib/openbmc_ffdc.robot
Chris Austenb29d2e82016-06-07 12:25:35 -05008
George Keishing4d6c1da2016-07-15 05:51:22 -05009Library Collections
10
11Suite Setup Open Connection And Log In
12Suite Teardown Close All Connections
Chris Austenb29d2e82016-06-07 12:25:35 -050013
George Keishingd55a4be2016-08-26 03:28:17 -050014Test Teardown Log FFDC
15
Chris Austenb29d2e82016-06-07 12:25:35 -050016*** Variables ***
17
18${SYSTEM_SHUTDOWN_TIME} 1min
19
20${WAIT_FOR_SERVICES_UP} 3min
21
22${CREATE_ERROR_SINGLE_FRU} busctl call org.openbmc.records.events /org/openbmc/records/events org.openbmc.recordlog acceptHostMessage sssay "Error" "Testing failure" "/org/openbmc/inventory/system/chassis/motherboard/dimm1" 1 1
23
24${CREATE_ERROR_INVALID_FRU} busctl call org.openbmc.records.events /org/openbmc/records/events org.openbmc.recordlog acceptHostMessage sssay "Error" "Testing with invalid FRU" "abc" 1 1
25
26${CREATE_ERROR_NO_FRU} busctl call org.openbmc.records.events /org/openbmc/records/events org.openbmc.recordlog acceptHostMessage sssay "Error" "Testing with no fru" "" 1 1
27
28${CREATE_ERROR_VIRTUAL_SENSOR} busctl call org.openbmc.records.events /org/openbmc/records/events org.openbmc.recordlog acceptHostMessage sssay "Error" "Testing with a virtual sensor" "/org/openbmc/inventory/system/systemevent " 1 1
29
30${DIMM1_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm1
31
32${DIMM2_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm2
33
34${DIMM3_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm3
35
36&{NIL} data=@{EMPTY}
37
38*** Test Cases ***
39
40Create error log on single FRU
41 [Documentation] ***GOOD PATH***
42 ... Create an error log on single FRU and verify
43 ... its association.\n
George Keishing97651c72016-10-04 00:44:15 -050044 [Tags] Create_error_log_on_single_FRU
Chris Austenb29d2e82016-06-07 12:25:35 -050045
46 Clear all logs
47
Chris Austenb29d2e82016-06-07 12:25:35 -050048 ${output}= Execute Command ${CREATE_ERROR_SINGLE_FRU}
49
50 ${log_list} = Get EventList
51 ${association_uri} = catenate SEPARATOR= ${log_list[0]} /fru
52
53 ${association_content} = Read Attribute ${association_uri} endpoints
54 Should Contain ${association_content} ${DIMM1_URI}
55
56 ${dimm1_event} = Read Attribute ${DIMM1_URI}/event endpoints
57 Should Contain ${dimm1_event} ${log_list[0]}
58
59
60Create error log on two FRU
61 [Documentation] ***GOOD PATH***
62 ... Create an error log on two FRUs and verify
63 ... its association.\n
64
65 ${log_uri} = Create a test log
66 ${association_uri} = catenate SEPARATOR= ${log_uri} /fru
67
68 ${association_content} = Read Attribute ${association_uri} endpoints
69 Should Contain ${association_content} ${DIMM3_URI}
70 Should Contain ${association_content} ${DIMM2_URI}
71
72 ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
73 Should Contain ${dimm3_event} ${log_uri}
74
75 ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
76 Should Contain ${dimm2_event} ${log_uri}
77
78
79Create multiple error logs
80 [Documentation] ***GOOD PATH***
81 ... Create multiple error logs and verify
82 ... their association.\n
83
84 : FOR ${INDEX} IN RANGE 1 4
85 \ Log ${INDEX}
86 \ ${log_uri} = Create a test log
87 \ ${association_uri} = catenate SEPARATOR= ${log_uri} /fru
88
89 \ ${association_content} = Read Attribute ${association_uri} endpoints
90 \ Should Contain ${association_content} ${DIMM3_URI}
91 \ Should Contain ${association_content} ${DIMM2_URI}
92
93 \ ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
94 \ Should Contain ${dimm3_event} ${log_uri}
95
96 \ ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
97 \ Should Contain ${dimm2_event} ${log_uri}
98
99
100Delete error log
101 [Documentation] ***BAD PATH***
102 ... Delete an error log and verify that its
103 ... association is also removed.\n
George Keishing97651c72016-10-04 00:44:15 -0500104 [Tags] Delete_error_log
Chris Austenb29d2e82016-06-07 12:25:35 -0500105
106 ${log_uri1} = Create a test log
107 ${association_uri1} = catenate SEPARATOR= ${log_uri1} /fru
108
109 ${log_uri2} = Create a test log
110
111 ${del_uri} = catenate SEPARATOR= ${log_uri1} /action/delete
112 ${resp} = openbmc post request ${del_uri} data=${NIL}
113 should be equal as strings ${resp.status_code} ${HTTP_OK}
114
115 ${resp} = openbmc get request ${association_uri1}
116 ${jsondata} = to json ${resp.content}
117 Should Contain ${jsondata['message']} 404 Not Found
118
119 ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
120 Should Not Contain ${dimm3_event} ${log_uri1}
121
122 ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
123 Should Not Contain ${dimm2_event} ${log_uri1}
124
125
126Association with invalid FRU
127 [Documentation] ***BAD PATH***
George Keishing4d6c1da2016-07-15 05:51:22 -0500128 ... Create an error log on invalid FRU and verify
Chris Austenb29d2e82016-06-07 12:25:35 -0500129 ... that its does not have any association.\n
130
131 Clear all logs
132
Chris Austenb29d2e82016-06-07 12:25:35 -0500133 ${output}= Execute Command ${CREATE_ERROR_INVALID_FRU}
134 ${log_list} = Get EventList
135 ${association_uri} = catenate SEPARATOR= ${log_list[0]} /fru
136
137 ${resp} = openbmc get request ${association_uri}
138 ${jsondata} = to json ${resp.content}
139 Should Contain ${jsondata['message']} 404 Not Found
140
141
142Assocition with no FRU error event
143 [Documentation] ***BAD PATH***
144 ... Create an error log on no FRU and verify
145 ... that its does not have any association.\n
146
147 Clear all logs
148
Chris Austenb29d2e82016-06-07 12:25:35 -0500149 ${output}= Execute Command ${CREATE_ERROR_NO_FRU}
150 ${log_list} = Get EventList
151 ${association_uri} = catenate SEPARATOR= ${log_list[0]} /fru
152
153 ${resp} = openbmc get request ${association_uri}
154 ${jsondata} = to json ${resp.content}
155 Should Contain ${jsondata['message']} 404 Not Found
156
157
158Association with virtual sensor
159 [Documentation] ***GOOD PATH***
160 ... Create an error log on virtual sensor and
161 ... verify its association.\n
162
163 Clear all logs
164
Chris Austenb29d2e82016-06-07 12:25:35 -0500165 ${output}= Execute Command ${CREATE_ERROR_VIRTUAL_SENSOR}
166 ${log_list} = Get EventList
167 ${association_uri} = catenate SEPARATOR= ${log_list[0]} /fru
168
169 ${association_content} = Read Attribute ${association_uri} endpoints
170 Should Contain ${association_content} /org/openbmc/inventory/system/systemevent
171
172Association unchanged after reboot
173 [Documentation] ***GOOD PATH***
174 ... This test case is to verify that error log association
175 ... does not change after open bmc reboot.\n
causten147f5752016-08-11 16:24:45 -0500176 [Tags] bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500177
178 ${pre_reboot_log_uri} = Create a test log
179 ${association_uri} = catenate SEPARATOR= ${pre_reboot_log_uri} /fru
180 ${pre_reboot_association_content} = Read Attribute ${association_uri} endpoints
181
Chris Austenb29d2e82016-06-07 12:25:35 -0500182 ${output}= Execute Command /sbin/reboot
George Keishingf4e4faf2016-09-26 00:40:06 -0500183 Check If BMC is Up 5 min 10 sec
Chris Austenb29d2e82016-06-07 12:25:35 -0500184
185 ${post_reboot_association_content} = Read Attribute ${association_uri} endpoints
186 Should Be Equal ${pre_reboot_association_content} ${pre_reboot_association_content}
187
188 ${post_reboot_dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
189 Should Contain ${post_reboot_dimm3_event} ${pre_reboot_log_uri}
190 ${post_reboot_dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
191 Should Contain ${post_reboot_dimm2_event} ${pre_reboot_log_uri}
192
193*** Keywords ***
194
195Get EventList
196 ${resp} = openbmc get request /org/openbmc/records/events/
197 should be equal as strings ${resp.status_code} ${HTTP_OK}
198 ${jsondata} = to json ${resp.content}
199 [return] ${jsondata['data']}
200
201Create a test log
202 [arguments]
203 ${data} = create dictionary data=@{EMPTY}
204 ${resp} = openbmc post request /org/openbmc/records/events/action/acceptTestMessage data=${data}
205 should be equal as strings ${resp.status_code} ${HTTP_OK}
206 ${json} = to json ${resp.content}
207 ${LOGID} = convert to integer ${json['data']}
208 ${uri}= catenate SEPARATOR= /org/openbmc/records/events/ ${LOGID}
209 [return] ${uri}
210
Chris Austenb29d2e82016-06-07 12:25:35 -0500211Clear all logs
212 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
213 should be equal as strings ${resp.status_code} ${HTTP_OK}
214 ${resp} = openbmc get request /org/openbmc/records/events/
215 ${json} = to json ${resp.content}
216 Should Be Empty ${json['data']}