blob: bc7cc6aeb3c43c65058587b1ffd069b54d667a62 [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
2
3Documentation This testsuite is for testing the functions of Heartbeat,
4... Identify and Power LED's
5
6Resource ../lib/rest_client.robot
7Resource ../lib/resource.txt
George Keishingd55a4be2016-08-26 03:28:17 -05008Resource ../lib/openbmc_ffdc.robot
9Test Teardown Log FFDC
Chris Austenb29d2e82016-06-07 12:25:35 -050010
11*** Variables ***
12
13${MIN_TOGGLE_VALUE} 0
14${SAMPLING_FREQUENCY} 6
15
16*** Test Cases ***
17
George Keishingf7226162016-07-08 06:25:07 -050018Validate Heartbeat LEDs Test Cases
19 [Documentation] If heartbeat LED exist then execute the test set.
20 ${resp} = OpenBMC Get Request /org/openbmc/control/led/heartbeat
21 Run keyword If ${resp.status_code} == ${HTTP_OK} Execute Heartbeat LEDs Test Cases
22
23Validate Identify LEDs Test Cases
24 [Documentation] If identify LED exist then execute the test set.
25 ${resp} = OpenBMC Get Request /org/openbmc/control/led/identify
26 Run keyword If ${resp.status_code} == ${HTTP_OK} Execute Identify LEDs Test Cases
27
28Validate Beep LEDs Test Cases
29 [Documentation] If beep LED exist then execute the test set.
30 ${resp} = OpenBMC Get Request /org/openbmc/control/led/beep
31 Run keyword If ${resp.status_code} == ${HTTP_OK} Execute Beep LEDs Test Cases
32
33*** Keywords ***
34
35Execute Heartbeat LEDs Test Cases
36 [Documentation] Executing ON/OFF/Fast/Slow Heartbeat LED test cases.
37 Turn ON the Heartbeat LED
38 Turn OFF the Heartbeat LED
39 Blink Fast the Heartbeat LED
40 Blink Slow the Heartbeat LED
41
42Execute Identify LEDs Test Cases
43 [Documentation] Executing ON/OFF/Fast/Slow Identify LED test cases.
44 Turn ON the Identify LED
45 Turn OFF the Identify LED
46 Blink Fast the Identify LED
47 Blink Slow the Identify LED
48
49Execute Beep LEDs Test Cases
50 [Documentation] Executing ON/OFF/Fast/Slow Beep LED test cases.
51 Turn ON the Beep LED
52 Turn OFF the Beep LED
53 Blink Fast the Beep LED
54 Blink Slow the Beep LED
55
Chris Austenb29d2e82016-06-07 12:25:35 -050056Turn ON the Heartbeat LED
57 [Documentation] This testcase is to test the setOn functionality of the
58 ... Heartbeat LED. The LED state is read again to check if
59 ... the LED is in ON state.
60 Set On heartbeat
61 ${ledstate} = Get LED State heartbeat
62 should be equal as strings ${ledstate} On
63
64Turn OFF the Heartbeat LED
65 [Documentation] This testcase is to test the setOff functionality of the
66 ... Heartbeat LED. The LED state is read again to check if
67 ... the LED is in OFF state.
68 Set Off heartbeat
69 ${ledstate} = Get LED State heartbeat
70 should be equal as strings ${ledstate} Off
71
72Blink Fast the Heartbeat LED
73 [Documentation] This testcase is to test the setBlinkFast functionality of the
74 ... Heartbeat LED. The LED state is sampled to figure out
75 ... whether the LED is blinking. There is no distinguishing
76 ... between whether the LED is blinking fast or slow for
77 ... this testcase to pass.
78 ${OFF_VALUE}= Set Variable ${0}
79 ${ON_VALUE}= Set Variable ${0}
80 Set Blink Fast heartbeat
81 : FOR ${INDEX} IN RANGE 1 ${SAMPLING_FREQUENCY}
82 \ ${ledstate} = Get LED State heartbeat
83 \ ${ON_VALUE} = Set Variable If '${ledstate}'=='On' ${ON_VALUE + 1} ${ON_VALUE}
84 \ ${OFF_VALUE} = Set Variable If '${ledstate}'=='Off' ${OFF_VALUE + 1} ${OFF_VALUE}
85 should be true ${ON_VALUE} > ${MIN_TOGGLE_VALUE} and ${OFF_VALUE} > ${MIN_TOGGLE_VALUE}
86
87Blink Slow the Heartbeat LED
88 [Documentation] This testcase is to test the setBlinkSlow functionality of the
89 ... Heartbeat LED. The LED state is sampled to figure out
90 ... whether the LED is blinking. There is no distinguishing
91 ... between whether the LED is blinking fast or slow for
92 ... this testcase to pass.
93 ${OFF_VALUE}= Set Variable ${0}
94 ${ON_VALUE}= Set Variable ${0}
95 Set Blink Slow heartbeat
96 : FOR ${INDEX} IN RANGE 1 ${SAMPLING_FREQUENCY}
97 \ ${ledstate} = Get LED State heartbeat
98 \ ${ON_VALUE} = Set Variable If '${ledstate}'=='On' ${ON_VALUE + 1} ${ON_VALUE}
99 \ ${OFF_VALUE} = Set Variable If '${ledstate}'=='Off' ${OFF_VALUE + 1} ${OFF_VALUE}
100 should be true ${ON_VALUE} > ${MIN_TOGGLE_VALUE} and ${OFF_VALUE} > ${MIN_TOGGLE_VALUE}
101
102Turn ON the Identify LED
103 [Documentation] This testcase is to test the setOn functionality of the
104 ... Identify LED. The LED state is read again to check if
105 ... the LED is in ON state.
106 Set On identify
107 ${ledstate} = Get LED State identify
108 should be equal as strings ${ledstate} On
109
110Turn OFF the Identify LED
111 [Documentation] This testcase is to test the setOff functionality of the
112 ... Identify LED. The LED state is read again to check if
113 ... the LED is in OFF state.
114 Set Off identify
115 ${ledstate} = Get LED State identify
116 should be equal as strings ${ledstate} Off
117
118Blink Fast the Identify LED
119 [Documentation] This testcase is to test the setBlinkFast functionality of the
120 ... Identify LED. The LED state is sampled to figure out
121 ... whether the LED is blinking. There is no distinguishing
122 ... between whether the LED is blinking fast or slow for
123 ... this testcase to pass.
124 ${OFF_VALUE}= Set Variable ${0}
125 ${ON_VALUE}= Set Variable ${0}
126 Set Blink Fast identify
127 : FOR ${INDEX} IN RANGE 1 ${SAMPLING_FREQUENCY}
128 \ ${ledstate} = Get LED State identify
129 \ ${ON_VALUE} = Set Variable If '${ledstate}'=='On' ${ON_VALUE + 1} ${ON_VALUE}
130 \ ${OFF_VALUE} = Set Variable If '${ledstate}'=='Off' ${OFF_VALUE + 1} ${OFF_VALUE}
131 should be true ${ON_VALUE} > ${MIN_TOGGLE_VALUE} and ${OFF_VALUE} > ${MIN_TOGGLE_VALUE}
132
133Blink Slow the Identify LED
134 [Documentation] This testcase is to test the setBlinkSlow functionality of the
135 ... Identify LED. The LED state is sampled to figure out
136 ... whether the LED is blinking. There is no distinguishing
137 ... between whether the LED is blinking fast or slow for
138 ... this testcase to pass.
139 ${OFF_VALUE}= Set Variable ${0}
140 ${ON_VALUE}= Set Variable ${0}
141 Set Blink Slow identify
142 : FOR ${INDEX} IN RANGE 1 ${SAMPLING_FREQUENCY}
143 \ ${ledstate} = Get LED State identify
144 \ ${ON_VALUE} = Set Variable If '${ledstate}'=='On' ${ON_VALUE + 1} ${ON_VALUE}
145 \ ${OFF_VALUE} = Set Variable If '${ledstate}'=='Off' ${OFF_VALUE + 1} ${OFF_VALUE}
146 should be true ${ON_VALUE} > ${MIN_TOGGLE_VALUE} and ${OFF_VALUE} > ${MIN_TOGGLE_VALUE}
147
148Turn ON the Beep LED
149 [Documentation] This testcase is to test the setOn functionality of the
150 ... Beep LED. The LED state is read again to check if
151 ... the LED is in ON state.
152 Set On beep
153 ${ledstate} = Get LED State beep
154 should be equal as strings ${ledstate} On
155
156Turn OFF the Beep LED
157 [Documentation] This testcase is to test the setOff functionality of the
158 ... Beep LED. The LED state is read again to check if
159 ... the LED is in OFF state.
160 Set Off beep
161 ${ledstate} = Get LED State beep
162 should be equal as strings ${ledstate} Off
163
164Blink Fast the Beep LED
165 [Documentation] This testcase is to test the setBlinkFast functionality of the
166 ... Beep LED. The LED state is sampled to figure out
167 ... whether the LED is blinking. There is no distinguishing
168 ... between whether the LED is blinking fast or slow for
169 ... this testcase to pass.
170 ${OFF_VALUE}= Set Variable ${0}
171 ${ON_VALUE}= Set Variable ${0}
172 ${data} = create dictionary data=@{EMPTY}
173 Set Blink Fast beep
174 : FOR ${INDEX} IN RANGE 1 ${SAMPLING_FREQUENCY}
175 \ ${ledstate} = Get LED State beep
176 \ ${ON_VALUE} = Set Variable If '${ledstate}'=='On' ${ON_VALUE + 1} ${ON_VALUE}
177 \ ${OFF_VALUE} = Set Variable If '${ledstate}'=='Off' ${OFF_VALUE + 1} ${OFF_VALUE}
178 should be true ${ON_VALUE} > ${MIN_TOGGLE_VALUE} and ${OFF_VALUE} > ${MIN_TOGGLE_VALUE}
179
180Blink Slow the Beep LED
181 [Documentation] This testcase is to test the setBlinkSlow functionality of the
182 ... Beep LED. The LED state is sampled to figure out
183 ... whether the LED is blinking. There is no distinguishing
184 ... between whether the LED is blinking fast or slow for
185 ... this testcase to pass.
186 ${OFF_VALUE}= Set Variable ${0}
187 ${ON_VALUE}= Set Variable ${0}
188 Set Blink Slow beep
189 : FOR ${INDEX} IN RANGE 1 ${SAMPLING_FREQUENCY}
190 \ ${ledstate} = Get LED State beep
191 \ ${ON_VALUE} = Set Variable If '${ledstate}'=='On' ${ON_VALUE + 1} ${ON_VALUE}
192 \ ${OFF_VALUE} = Set Variable If '${ledstate}'=='Off' ${OFF_VALUE + 1} ${OFF_VALUE}
193 should be true ${ON_VALUE} > ${MIN_TOGGLE_VALUE} and ${OFF_VALUE} > ${MIN_TOGGLE_VALUE}
194
Chris Austenb29d2e82016-06-07 12:25:35 -0500195Get LED State
196 [arguments] ${args}
197 ${data} = create dictionary data=@{EMPTY}
198 ${resp} = OpenBMC Post Request /org/openbmc/control/led/${args}/action/GetLedState data=${data}
199 should be equal as strings ${resp.status_code} ${HTTP_OK}
200 ${json} = to json ${resp.content}
201 [return] ${json['data'][1]}
202
203Set On
204 [arguments] ${args}
205 ${data} = create dictionary data=@{EMPTY}
206 ${resp} = OpenBMC Post Request /org/openbmc/control/led/${args}/action/setOn data=${data}
207 should be equal as strings ${resp.status_code} ${HTTP_OK}
208 ${json} = to json ${resp.content}
209 should be equal as integers ${json['data']} 0
210
211Set Off
212 [arguments] ${args}
213 ${data} = create dictionary data=@{EMPTY}
214 ${resp} = OpenBMC Post Request /org/openbmc/control/led/${args}/action/setOff data=${data}
215 should be equal as strings ${resp.status_code} ${HTTP_OK}
216 ${json} = to json ${resp.content}
217 should be equal as integers ${json['data']} 0
218
219Set Blink Fast
220 [arguments] ${args}
221 ${data} = create dictionary data=@{EMPTY}
222 ${resp} = OpenBMC Post Request /org/openbmc/control/led/${args}/action/setBlinkFast data=${data}
223 should be equal as strings ${resp.status_code} ${HTTP_OK}
224 ${json} = to json ${resp.content}
225 should be equal as integers ${json['data']} 0
226
227Set Blink Slow
228 [arguments] ${args}
229 ${data} = create dictionary data=@{EMPTY}
230 ${resp} = OpenBMC Post Request /org/openbmc/control/led/${args}/action/setBlinkSlow data=${data}
231 should be equal as strings ${resp.status_code} ${HTTP_OK}
232 ${json} = to json ${resp.content}
233 should be equal as integers ${json['data']} 0