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