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