blob: fdc7b0eee6e6f4866827ede6d74a2c83263b27c8 [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
Rahul Maheshwarif8119102016-10-05 01:15:56 -0500162 [Tags] Association_with_virtual_sensor
Chris Austenb29d2e82016-06-07 12:25:35 -0500163
164 Clear all logs
165
Chris Austenb29d2e82016-06-07 12:25:35 -0500166 ${output}= Execute Command ${CREATE_ERROR_VIRTUAL_SENSOR}
167 ${log_list} = Get EventList
168 ${association_uri} = catenate SEPARATOR= ${log_list[0]} /fru
169
170 ${association_content} = Read Attribute ${association_uri} endpoints
171 Should Contain ${association_content} /org/openbmc/inventory/system/systemevent
172
173Association unchanged after reboot
174 [Documentation] ***GOOD PATH***
175 ... This test case is to verify that error log association
176 ... does not change after open bmc reboot.\n
causten147f5752016-08-11 16:24:45 -0500177 [Tags] bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500178
179 ${pre_reboot_log_uri} = Create a test log
180 ${association_uri} = catenate SEPARATOR= ${pre_reboot_log_uri} /fru
181 ${pre_reboot_association_content} = Read Attribute ${association_uri} endpoints
182
Chris Austenb29d2e82016-06-07 12:25:35 -0500183 ${output}= Execute Command /sbin/reboot
George Keishingf4e4faf2016-09-26 00:40:06 -0500184 Check If BMC is Up 5 min 10 sec
Chris Austenb29d2e82016-06-07 12:25:35 -0500185
186 ${post_reboot_association_content} = Read Attribute ${association_uri} endpoints
187 Should Be Equal ${pre_reboot_association_content} ${pre_reboot_association_content}
188
189 ${post_reboot_dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
190 Should Contain ${post_reboot_dimm3_event} ${pre_reboot_log_uri}
191 ${post_reboot_dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
192 Should Contain ${post_reboot_dimm2_event} ${pre_reboot_log_uri}
193
194*** Keywords ***
195
196Get EventList
197 ${resp} = openbmc get request /org/openbmc/records/events/
198 should be equal as strings ${resp.status_code} ${HTTP_OK}
199 ${jsondata} = to json ${resp.content}
200 [return] ${jsondata['data']}
201
202Create a test log
203 [arguments]
204 ${data} = create dictionary data=@{EMPTY}
205 ${resp} = openbmc post request /org/openbmc/records/events/action/acceptTestMessage data=${data}
206 should be equal as strings ${resp.status_code} ${HTTP_OK}
207 ${json} = to json ${resp.content}
208 ${LOGID} = convert to integer ${json['data']}
209 ${uri}= catenate SEPARATOR= /org/openbmc/records/events/ ${LOGID}
210 [return] ${uri}
211
Chris Austenb29d2e82016-06-07 12:25:35 -0500212Clear all logs
213 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
214 should be equal as strings ${resp.status_code} ${HTTP_OK}
215 ${resp} = openbmc get request /org/openbmc/records/events/
216 ${json} = to json ${resp.content}
217 Should Be Empty ${json['data']}