CSIT-619 HC Test: Honeycomb performance testing - initial commit
[csit.git] / resources / libraries / robot / honeycomb / honeycomb.robot
1 # Copyright (c) 2017 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Settings ***
15 | Library | resources.libraries.python.honeycomb.HoneycombSetup
16 | Library | resources.libraries.python.honeycomb.HoneycombUtil
17 | Library | resources.libraries.python.honeycomb.HcPersistence
18 | Library | resources.libraries.python.DUTSetup
19 | Library | resources.libraries.python.InterfaceUtil
20
21 *** Keywords ***
22 | Configure Honeycomb service on DUTs
23 | | [Documentation] | *Setup environment for honeycomb testing.*
24 | | ...
25 | | ... | _Setup steps:_
26 | | ... | - 1. Login to each honeycomb node using ssh
27 | | ... | - 2. Startup honeycomb service
28 | | ... | - 3. Monitor service startup using HTTP GET request loop
29 | | ... | Expected sequence of HTTP replies:
30 | | ... | connection refused -> 404 -> 401 -> 503 or 500 -> 200 (pass)
31 | | ... | - 4. Configure honeycomb nodes using HTTP PUT request
32 | | ...
33 | | ... | _Arguments:_
34 | | ... | - duts - list of nodes to setup Honeycomb on
35 | | ...
36 | | ... | _Used global constants and variables:_
37 | | ... | - RESOURCES_TPL_HC - path to honeycomb templates directory
38 | | ... | - HTTPCodes - HTTP protocol status codes
39 | | ...
40 | | [Arguments] | @{duts}
41 | | Start honeycomb on DUTs | @{duts}
42 | | Wait until keyword succeeds | 4min | 16sec
43 | | ... | Check honeycomb startup state | @{duts}
44
45 | Stop Honeycomb service on DUTs
46 | | [Documentation] | *Cleanup environment after honeycomb testing.*
47 | | ...
48 | | ... | _Teardown steps:_
49 | | ... | - 1. Login to each honeycomb node using ssh
50 | | ... | - 2. Stop honeycomb service
51 | | ... | - 3. Monitor service shutdown using HTTP GET request loop
52 | | ... | Expected sequence of HTTP replies:
53 | | ... | 200 -> 404 -> connection refused (pass)
54 | | ...
55 | | ... | _Arguments:_
56 | | ... | - duts - list of nodes to stop Honeycomb on
57 | | ...
58 | | ... | _Used global constants and variables:_
59 | | ... | - RESOURCES_TPL_HC - path to honeycomb templates directory
60 | | ... | - HTTPCodes - HTTP protocol status codes
61 | | ...
62 | | [Arguments] | @{duts}
63 | | Stop honeycomb on DUTs | @{duts}
64 | | Wait until keyword succeeds | 60sec | 16sec
65 | | ... | Check honeycomb shutdown state | @{duts}
66
67 | Clear persisted Honeycomb configuration
68 | | [Documentation] | *Delete saved configuration.*
69 | | ...
70 | | ... | *Arguments:*
71 | | ... | - duts - one or more nodes to clear persistence on. Type: dictionary
72 | | ...
73 | | ... | *Example:*
74 | | ...
75 | | ... | \| Clear persisted Honeycomb configuration \| ${nodes['DUT1']} \|
76 | | ...
77 | | [Arguments] | @{duts}
78 | | Clear persisted Honeycomb config | @{duts}
79
80 | Restart Honeycomb and VPP and clear persisted configuration
81 | | [Documentation] | Restarts Honeycomb and VPP with default configuration.
82 | | ...
83 | | ... | *Arguments:*
84 | | ... | - node - information about a DUT node. Type: dictionary
85 | | ...
86 | | ... | *Example:*
87 | | ...
88 | | ... | \| Restart Honeycomb and VPP and clear persisted configuration \
89 | | ... | \| ${nodes['DUT1']} \|
90 | | ...
91 | | [Arguments] | ${node}
92 | | Stop Honeycomb service on DUTs | ${node}
93 | | Clear persisted Honeycomb configuration | ${node}
94 | | Setup DUT | ${node}
95 | | Sleep | 10s | Wait 10sec so VPP is up for sure.
96 | | Configure Honeycomb service on DUTs | ${node}
97
98 | Restart Honeycomb and VPP
99 | | [Documentation] | Stops the Honeycomb service and verifies it is stopped.
100 | | ... | Then restarts VPP, starts Honeycomb again and verifies it is running.
101 | | ...
102 | | ... | *Arguments:*
103 | | ... | - node - information about a DUT node. Type: dictionary
104 | | ...
105 | | ... | *Example:*
106 | | ...
107 | | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \|
108 | | ...
109 | | [Arguments] | ${node}
110 | | Stop Honeycomb service on DUTs | ${node}
111 | | Setup DUT | ${node}
112 | | Sleep | 10s | Wait 10sec so VPP is up for sure.
113 | | Configure Honeycomb service on DUTs | ${node}
114
115 | Restart Honeycomb and VPP in performance test
116 | | [Documentation] | Stops Honeycomb and VPP and verifies HC is stopped.
117 | | ... | Then restarts VPP, starts Honeycomb again and verifies it is running.
118 | | ...
119 | | ... | *Arguments:*
120 | | ... | - node - information about a DUT node. Type: dictionary
121 | | ...
122 | | ... | *Example:*
123 | | ...
124 | | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \|
125 | | ...
126 | | [Arguments] | ${node}
127 | | Stop Honeycomb service on DUTs | ${node}
128 | | Stop VPP service on DUT | ${node}
129 | | Setup DUT | ${node}
130 | | Sleep | 10s | Wait 10sec so VPP is up for sure.
131 | | Configure Honeycomb service on DUTs | ${node}
132 | | Wait until keyword succeeds | 2min | 16sec
133 | | ... | Check honeycomb startup state | ${node}
134
135 | Archive Honeycomb log file
136 | | [Documentation] | Copy honeycomb.log file from Honeycomb node\
137 | | ... | to test executor.
138 | | ...
139 | | ... | *Arguments:*
140 | | ... | - node - information about a DUT node. Type: dictionary
141 | | ... | - perf - Running on performance testbed? Yes/no Type: boolean
142 | | ...
143 | | ... | *Example:*
144 | | ...
145 | | ... | \| Archive Honeycomb log file \| ${nudes['DUT1']} \|
146 | | ...
147 | | [Arguments] | ${node} | ${perf}=${False}
148 | | Archive Honeycomb log | ${node} | ${perf}
149
150 | Configure ODL Client Service On DUT
151 | | [Documentation] | Configure and start ODL client, then repeatedly check if
152 | | ... | it is running.
153 | | ...
154 | | ... | *Arguments:*
155 | | ... | - node - information about a DUT node. Type: dictionary
156 | | ... | - odl_name - Name of ODL client version. Type: string
157 | | ...
158 | | ... | *Example:*
159 | | ...
160 | | ... | \| Configure ODL Client Service on DUT \| ${nodes['DUT1']} \
161 | | ... | \| carbon-SR1 \|
162 | | ...
163 | | [Arguments] | ${node} | ${odl_name}
164 | | Copy ODL Client | ${node} | ${odl_name} | /mnt/common | /tmp
165 | | Setup ODL Client | ${node} | /tmp
166 | | Wait until keyword succeeds | 2min | 30sec
167 | | ... | Install ODL Features | ${node} | /tmp
168 | | Wait until keyword succeeds | 4min | 16sec
169 | | ... | Mount Honeycomb on ODL | ${node}
170 | | Wait until keyword succeeds | 2min | 16sec
171 | | ... | Check ODL startup state | ${node}
172 | | Wait until keyword succeeds | 2min | 16sec
173 | | ... | Check honeycomb startup state | ${node}
174
175 | Configure Honeycomb for functional testing
176 | | [Documentation] | Configure Honeycomb with parameters for functional
177 | | ... | testing, then start Honeycomb and repeatedly check startup status.
178 | | ...
179 | | ... | *Arguments:*
180 | | ... | - node - information about a DUT node. Type: dictionary
181 | | ...
182 | | ... | *Example:*
183 | | ...
184 | | ... | \| Configure Honeycomb for functional testing \| ${nodes['DUT1']} \|
185 | | ...
186 | | [Arguments] | ${node}
187 | | Configure Restconf binding address | ${node}
188 | | Configure Log Level | ${node} | TRACE
189 | | Configure Persistence | ${node} | disable
190 | | Configure jVPP timeout | ${node} | ${14}
191 | | Clear Persisted Honeycomb Configuration | ${node}
192 | | Configure Honeycomb service on DUTs | ${node}
193
194 | Configure ODL Client for functional testing
195 | | [Documentation] | Read external variable HC_ODL. Depending on its
196 | | ... | value either: do nothing, or setup ODL client for testing and
197 | | ... | create a global variable that modifies Restconf requests to use ODL.
198 | | ...
199 | | ... | *Arguments:*
200 | | ... | - node - information about a DUT node. Type: dictionary
201 | | ...
202 | | ... | *Example:*
203 | | ...
204 | | ... | \| Configure ODL Client for functional testing \| ${nodes['DUT1']} \|
205 | | ...
206 | | [Arguments] | ${node}
207 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
208 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
209 | | ... | Run Keywords
210 | | ... | Set Global Variable | ${use_odl_client} | AND
211 | | ... | Configure ODL Client Service On DUT | ${node} | ${use_odl_client}
212 | | ... | ELSE | Log | Variable HC_ODL is not present. Not using ODL.
213 | | ... | level=INFO
214
215 | Set Up Honeycomb Functional Test Suite
216 | | [Documentation] | Generic test suite setup for Honeycomb functional tests.
217 | | ... | Restarts VPP, then enables Honeycomb and optionally ODL, based
218 | | ... | on external variable.
219 | | ...
220 | | ... | *Arguments:*
221 | | ... | - node - information about a DUT node. Type: dictionary
222 | | ...
223 | | ... | *Example:*
224 | | ...
225 | | ... | \| Set Up Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
226 | | ...
227 | | [Arguments] | ${node}
228 | | Setup DUT | ${node}
229 | | Configure all TGs for traffic script
230 | | Configure Honeycomb for functional testing | ${node}
231 | | Configure ODL Client for functional testing | ${node}
232
233 | Tear Down Honeycomb Functional Test Suite
234 | | [Documentation] | Generic test suite teardown for Honeycomb functional
235 | | ... | tests. Stops ODL client (if used), then stops Honeycomb and verifies
236 | | ... | that they are both stopped.
237 | | ...
238 | | ... | *Arguments:*
239 | | ... | - node - information about a DUT node. Type: dictionary
240 | | ...
241 | | ... | *Example:*
242 | | ...
243 | | ... | \| Tear Down Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
244 | | ...
245 | | [Arguments] | ${node}
246 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
247 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
248 | | ... | Run Keywords
249 | | ... | Stop ODL Client | ${node} | /tmp | AND
250 | | ... | Set Global Variable | ${use_odl_client} | ${NONE}
251 | | Stop Honeycomb service on DUTs | ${node}
252
253 | Enable Honeycomb Feature
254 | | [Documentation] | Enable the specified feature in Honeycomb configuration.
255 | | ... | Requires a restart of Honeycomb to take effect.
256 | | ...
257 | | ... | *Arguments:*
258 | | ... | - node - information about a DUT node. Type: dictionary
259 | | ...
260 | | ... | *Example:*
261 | | ...
262 | | ... | \| Enable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
263 | | ...
264 | | [arguments] | ${node} | ${feature}
265 | | Manage Honeycomb Features | ${node} | ${feature}
266
267 | Disable Honeycomb Feature
268 | | [Documentation] | Disable the specified feature in Honeycomb configuration.
269 | | ... | Requires a restart of Honeycomb to take effect.
270 | | ...
271 | | ... | *Arguments:*
272 | | ... | - node - information about a DUT node. Type: dictionary
273 | | ...
274 | | ... | *Example:*
275 | | ...
276 | | ... | \| Disable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
277 | | ...
278 | | [arguments] | ${node} | ${feature}
279 | | Manage Honeycomb Features | ${node} | ${feature} | disable=${True}
280
281 | Stop VPP Service on DUT
282 | | [Documentation] | Stop the VPP service on the specified node.
283 | | ...
284 | | ... | *Arguments:*
285 | | ... | - node - information about a DUT node. Type: dictionary
286 | | ...
287 | | ... | *Example:*
288 | | ...
289 | | ... | \| Stop VPP Service on DUT \| ${nodes['DUT1']} \|
290 | | ...
291 | | [Arguments] | ${node}
292 | | Stop VPP Service | ${node}
293
294 | Honeycomb Performance Suite Setup Generic
295 | | [Documentation] | Generic test suite setup for Honeycomb performance tests.
296 | | ... | Performs multiple attempts to start Honeycomb+VPP stack.
297 | | ...
298 | | ... | *Arguments:*
299 | | ... | - node - information about a DUT node. Type: dictionary
300 | | ...
301 | | ... | *Example:*
302 | | ...
303 | | ... | \| Honeycomb Performance Suite Setup Generic \| ${nodes['DUT1']} \|
304 | | ...
305 | | [Arguments] | ${node}
306 | | Wait until keyword succeeds | 8min | 2min
307 | | ... | Restart Honeycomb and VPP in Performance test | ${node}
308
309 | Honeycomb Performance Suite Teardown Generic
310 | | [Documentation] | Generic test suite teardown for Honeycomb performance
311 | | ... | tests. Logs CPU usage before stopping Honeycomb.
312 | | ...
313 | | ... | *Arguments:*
314 | | ... | - node - information about a DUT node. Type: dictionary
315 | | ...
316 | | ... | *Example:*
317 | | ...
318 | | ... | \| Honeycomb Performance Suite Teardown Generic \| ${nodes['DUT1']} \|
319 | | ...
320 | | [Arguments] | ${node}
321 | | Log Honeycomb and VPP process distribution on cores | ${node}
322 | | Stop Honeycomb service on DUTs | ${node}