blob: b7d456a93886b97b1d6e367dbd82c900cd415553 [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
Chris Austenb29d2e82016-06-07 12:25:35 -05007
George Keishing4d6c1da2016-07-15 05:51:22 -05008Library Collections
9
10Suite Setup Open Connection And Log In
11Suite Teardown Close All Connections
Chris Austenb29d2e82016-06-07 12:25:35 -050012
13*** Variables ***
14
15${SYSTEM_SHUTDOWN_TIME} 1min
16
17${WAIT_FOR_SERVICES_UP} 3min
18
19${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
20
21${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
22
23${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
24
25${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
26
27${DIMM1_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm1
28
29${DIMM2_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm2
30
31${DIMM3_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm3
32
33&{NIL} data=@{EMPTY}
34
35*** Test Cases ***
36
37Create error log on single FRU
38 [Documentation] ***GOOD PATH***
39 ... Create an error log on single FRU and verify
40 ... its association.\n
41
42 Clear all logs
43
Chris Austenb29d2e82016-06-07 12:25:35 -050044 ${output}= Execute Command ${CREATE_ERROR_SINGLE_FRU}
45
46 ${log_list} = Get EventList
47 ${association_uri} = catenate SEPARATOR= ${log_list[0]} /fru
48
49 ${association_content} = Read Attribute ${association_uri} endpoints
50 Should Contain ${association_content} ${DIMM1_URI}
51
52 ${dimm1_event} = Read Attribute ${DIMM1_URI}/event endpoints
53 Should Contain ${dimm1_event} ${log_list[0]}
54
55
56Create error log on two FRU
57 [Documentation] ***GOOD PATH***
58 ... Create an error log on two FRUs and verify
59 ... its association.\n
60
61 ${log_uri} = Create a test log
62 ${association_uri} = catenate SEPARATOR= ${log_uri} /fru
63
64 ${association_content} = Read Attribute ${association_uri} endpoints
65 Should Contain ${association_content} ${DIMM3_URI}
66 Should Contain ${association_content} ${DIMM2_URI}
67
68 ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
69 Should Contain ${dimm3_event} ${log_uri}
70
71 ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
72 Should Contain ${dimm2_event} ${log_uri}
73
74
75Create multiple error logs
76 [Documentation] ***GOOD PATH***
77 ... Create multiple error logs and verify
78 ... their association.\n
79
80 : FOR ${INDEX} IN RANGE 1 4
81 \ Log ${INDEX}
82 \ ${log_uri} = Create a test log
83 \ ${association_uri} = catenate SEPARATOR= ${log_uri} /fru
84
85 \ ${association_content} = Read Attribute ${association_uri} endpoints
86 \ Should Contain ${association_content} ${DIMM3_URI}
87 \ Should Contain ${association_content} ${DIMM2_URI}
88
89 \ ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
90 \ Should Contain ${dimm3_event} ${log_uri}
91
92 \ ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
93 \ Should Contain ${dimm2_event} ${log_uri}
94
95
96Delete error log
97 [Documentation] ***BAD PATH***
98 ... Delete an error log and verify that its
99 ... association is also removed.\n
100
101 ${log_uri1} = Create a test log
102 ${association_uri1} = catenate SEPARATOR= ${log_uri1} /fru
103
104 ${log_uri2} = Create a test log
105
106 ${del_uri} = catenate SEPARATOR= ${log_uri1} /action/delete
107 ${resp} = openbmc post request ${del_uri} data=${NIL}
108 should be equal as strings ${resp.status_code} ${HTTP_OK}
109
110 ${resp} = openbmc get request ${association_uri1}
111 ${jsondata} = to json ${resp.content}
112 Should Contain ${jsondata['message']} 404 Not Found
113
114 ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
115 Should Not Contain ${dimm3_event} ${log_uri1}
116
117 ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
118 Should Not Contain ${dimm2_event} ${log_uri1}
119
120
121Association with invalid FRU
122 [Documentation] ***BAD PATH***
George Keishing4d6c1da2016-07-15 05:51:22 -0500123 ... Create an error log on invalid FRU and verify
Chris Austenb29d2e82016-06-07 12:25:35 -0500124 ... that its does not have any association.\n
125
126 Clear all logs
127
Chris Austenb29d2e82016-06-07 12:25:35 -0500128 ${output}= Execute Command ${CREATE_ERROR_INVALID_FRU}
129 ${log_list} = Get EventList
130 ${association_uri} = catenate SEPARATOR= ${log_list[0]} /fru
131
132 ${resp} = openbmc get request ${association_uri}
133 ${jsondata} = to json ${resp.content}
134 Should Contain ${jsondata['message']} 404 Not Found
135
136
137Assocition with no FRU error event
138 [Documentation] ***BAD PATH***
139 ... Create an error log on no FRU and verify
140 ... that its does not have any association.\n
141
142 Clear all logs
143
Chris Austenb29d2e82016-06-07 12:25:35 -0500144 ${output}= Execute Command ${CREATE_ERROR_NO_FRU}
145 ${log_list} = Get EventList
146 ${association_uri} = catenate SEPARATOR= ${log_list[0]} /fru
147
148 ${resp} = openbmc get request ${association_uri}
149 ${jsondata} = to json ${resp.content}
150 Should Contain ${jsondata['message']} 404 Not Found
151
152
153Association with virtual sensor
154 [Documentation] ***GOOD PATH***
155 ... Create an error log on virtual sensor and
156 ... verify its association.\n
157
158 Clear all logs
159
Chris Austenb29d2e82016-06-07 12:25:35 -0500160 ${output}= Execute Command ${CREATE_ERROR_VIRTUAL_SENSOR}
161 ${log_list} = Get EventList
162 ${association_uri} = catenate SEPARATOR= ${log_list[0]} /fru
163
164 ${association_content} = Read Attribute ${association_uri} endpoints
165 Should Contain ${association_content} /org/openbmc/inventory/system/systemevent
166
167Association unchanged after reboot
168 [Documentation] ***GOOD PATH***
169 ... This test case is to verify that error log association
170 ... does not change after open bmc reboot.\n
causten147f5752016-08-11 16:24:45 -0500171 [Tags] bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500172
173 ${pre_reboot_log_uri} = Create a test log
174 ${association_uri} = catenate SEPARATOR= ${pre_reboot_log_uri} /fru
175 ${pre_reboot_association_content} = Read Attribute ${association_uri} endpoints
176
Chris Austenb29d2e82016-06-07 12:25:35 -0500177 ${output}= Execute Command /sbin/reboot
178 Sleep ${SYSTEM_SHUTDOWN_TIME}
179 Wait For Host To Ping ${OPENBMC_HOST}
180 Sleep ${WAIT_FOR_SERVICES_UP}
181
182 ${post_reboot_association_content} = Read Attribute ${association_uri} endpoints
183 Should Be Equal ${pre_reboot_association_content} ${pre_reboot_association_content}
184
185 ${post_reboot_dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
186 Should Contain ${post_reboot_dimm3_event} ${pre_reboot_log_uri}
187 ${post_reboot_dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
188 Should Contain ${post_reboot_dimm2_event} ${pre_reboot_log_uri}
189
190*** Keywords ***
191
192Get EventList
193 ${resp} = openbmc get request /org/openbmc/records/events/
194 should be equal as strings ${resp.status_code} ${HTTP_OK}
195 ${jsondata} = to json ${resp.content}
196 [return] ${jsondata['data']}
197
198Create a test log
199 [arguments]
200 ${data} = create dictionary data=@{EMPTY}
201 ${resp} = openbmc post request /org/openbmc/records/events/action/acceptTestMessage data=${data}
202 should be equal as strings ${resp.status_code} ${HTTP_OK}
203 ${json} = to json ${resp.content}
204 ${LOGID} = convert to integer ${json['data']}
205 ${uri}= catenate SEPARATOR= /org/openbmc/records/events/ ${LOGID}
206 [return] ${uri}
207
Chris Austenb29d2e82016-06-07 12:25:35 -0500208Clear all logs
209 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
210 should be equal as strings ${resp.status_code} ${HTTP_OK}
211 ${resp} = openbmc get request /org/openbmc/records/events/
212 ${json} = to json ${resp.content}
213 Should Be Empty ${json['data']}