blob: 88e90d0badddceab2b1546327a822243ab117cb9 [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
171
172 ${pre_reboot_log_uri} = Create a test log
173 ${association_uri} = catenate SEPARATOR= ${pre_reboot_log_uri} /fru
174 ${pre_reboot_association_content} = Read Attribute ${association_uri} endpoints
175
Chris Austenb29d2e82016-06-07 12:25:35 -0500176 ${output}= Execute Command /sbin/reboot
177 Sleep ${SYSTEM_SHUTDOWN_TIME}
178 Wait For Host To Ping ${OPENBMC_HOST}
179 Sleep ${WAIT_FOR_SERVICES_UP}
180
181 ${post_reboot_association_content} = Read Attribute ${association_uri} endpoints
182 Should Be Equal ${pre_reboot_association_content} ${pre_reboot_association_content}
183
184 ${post_reboot_dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
185 Should Contain ${post_reboot_dimm3_event} ${pre_reboot_log_uri}
186 ${post_reboot_dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
187 Should Contain ${post_reboot_dimm2_event} ${pre_reboot_log_uri}
188
189*** Keywords ***
190
191Get EventList
192 ${resp} = openbmc get request /org/openbmc/records/events/
193 should be equal as strings ${resp.status_code} ${HTTP_OK}
194 ${jsondata} = to json ${resp.content}
195 [return] ${jsondata['data']}
196
197Create a test log
198 [arguments]
199 ${data} = create dictionary data=@{EMPTY}
200 ${resp} = openbmc post request /org/openbmc/records/events/action/acceptTestMessage data=${data}
201 should be equal as strings ${resp.status_code} ${HTTP_OK}
202 ${json} = to json ${resp.content}
203 ${LOGID} = convert to integer ${json['data']}
204 ${uri}= catenate SEPARATOR= /org/openbmc/records/events/ ${LOGID}
205 [return] ${uri}
206
Chris Austenb29d2e82016-06-07 12:25:35 -0500207Clear all logs
208 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
209 should be equal as strings ${resp.status_code} ${HTTP_OK}
210 ${resp} = openbmc get request /org/openbmc/records/events/
211 ${json} = to json ${resp.content}
212 Should Be Empty ${json['data']}