704f518573813bc4e19f8b911cba80929a41143f
[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 | Resource | resources/libraries/robot/shared/default.robot
21
22 *** Keywords ***
23 | Configure Honeycomb service on DUTs
24 | | [Documentation] | *Setup environment for honeycomb testing.*
25 | | ...
26 | | ... | _Setup steps:_
27 | | ... | - 1. Login to each honeycomb node using ssh
28 | | ... | - 2. Startup honeycomb service
29 | | ... | - 3. Monitor service startup using HTTP GET request loop
30 | | ... | Expected sequence of HTTP replies:
31 | | ... | connection refused -> 404 -> 401 -> 503 or 500 -> 200 (pass)
32 | | ... | - 4. Configure honeycomb nodes using HTTP PUT request
33 | | ...
34 | | ... | _Arguments:_
35 | | ... | - duts - list of nodes to setup Honeycomb on
36 | | ...
37 | | ... | _Used global constants and variables:_
38 | | ... | - RESOURCES_TPL_HC - path to honeycomb templates directory
39 | | ... | - HTTPCodes - HTTP protocol status codes
40 | | ...
41 | | [Arguments] | @{duts}
42 | | Start honeycomb on DUTs | @{duts}
43 | | :FOR | ${dut} | IN | @{duts}
44 | | | Check honeycomb startup state | @{duts}
45 | | | Sleep | 5s | Make sure all modules are loaded and ready.
46
47 | Stop Honeycomb service on DUTs
48 | | [Documentation] | *Cleanup environment after honeycomb testing.*
49 | | ...
50 | | ... | _Teardown steps:_
51 | | ... | - 1. Login to each honeycomb node using ssh
52 | | ... | - 2. Stop honeycomb service
53 | | ... | - 3. Monitor service shutdown using HTTP GET request loop
54 | | ... | Expected sequence of HTTP replies:
55 | | ... | 200 -> 404 -> connection refused (pass)
56 | | ...
57 | | ... | _Arguments:_
58 | | ... | - duts - list of nodes to stop Honeycomb on
59 | | ...
60 | | ... | _Used global constants and variables:_
61 | | ... | - RESOURCES_TPL_HC - path to honeycomb templates directory
62 | | ... | - HTTPCodes - HTTP protocol status codes
63 | | ...
64 | | [Arguments] | @{duts}
65 | | Stop honeycomb on DUTs | @{duts}
66 | | :FOR | ${dut} | IN | @{duts}
67 | | | Wait until keyword succeeds | 60sec | 15sec
68 | | | ... | Check honeycomb shutdown state | @{duts}
69
70 | Clear persisted Honeycomb configuration
71 | | [Documentation] | *Delete saved configuration.*
72 | | ...
73 | | ... | *Arguments:*
74 | | ... | - duts - one or more nodes to clear persistence on. Type: dictionary
75 | | ...
76 | | ... | *Example:*
77 | | ...
78 | | ... | \| Clear persisted Honeycomb configuration \| ${nodes['DUT1']} \|
79 | | ...
80 | | [Arguments] | @{duts}
81 | | Clear persisted Honeycomb config | @{duts}
82
83 | Restart Honeycomb and VPP and clear persisted configuration
84 | | [Documentation] | Restarts Honeycomb and VPP with default configuration.
85 | | ...
86 | | ... | *Arguments:*
87 | | ... | - node - information about a DUT node. Type: dictionary
88 | | ...
89 | | ... | *Example:*
90 | | ...
91 | | ... | \| Restart Honeycomb and VPP and clear persisted configuration \
92 | | ... | \| ${nodes['DUT1']} \|
93 | | ...
94 | | [Arguments] | ${node}
95 | | Stop Honeycomb service on DUTs | ${node}
96 | | Clear persisted Honeycomb configuration | ${node}
97 | | Setup DUT | ${node}
98 | | Sleep | 10s | Wait 10sec so VPP is up for sure.
99 | | Configure Honeycomb service on DUTs | ${node}
100
101 | Restart Honeycomb and VPP
102 | | [Documentation] | Stops the Honeycomb service and verifies it is stopped.
103 | | ... | Then restarts VPP, starts Honeycomb again and verifies it is running.
104 | | ...
105 | | ... | *Arguments:*
106 | | ... | - node - information about a DUT node. Type: dictionary
107 | | ...
108 | | ... | *Example:*
109 | | ...
110 | | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \|
111 | | ...
112 | | [Arguments] | ${node}
113 | | Stop Honeycomb service on DUTs | ${node}
114 | | Setup DUT | ${node}
115 | | Sleep | 10s | Wait 10sec so VPP is up for sure.
116 | | Configure Honeycomb service on DUTs | ${node}
117
118 | Restart Honeycomb and VPP in performance test
119 | | [Documentation] | Stops Honeycomb and VPP and verifies HC is stopped.
120 | | ... | Then restarts VPP, starts Honeycomb again and verifies it is running.
121 | | ...
122 | | ... | *Arguments:*
123 | | ... | - node - information about a DUT node. Type: dictionary
124 | | ...
125 | | ... | *Example:*
126 | | ...
127 | | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \|
128 | | ...
129 | | [Arguments] | ${node}
130 | | Stop Honeycomb service on DUTs | ${node}
131 | | Stop VPP service on DUT | ${node}
132 | | Setup DUT | ${node}
133 | | Sleep | 10s | Wait 10sec so VPP is up for sure.
134 | | Configure Honeycomb service on DUTs | ${node}
135 | | Check honeycomb startup state | ${node} | timeout=120
136
137 | Archive Honeycomb logs
138 | | [Documentation] | Copies log files from Honeycomb node\
139 | | ... | to test executor.
140 | | ...
141 | | ... | *Arguments:*
142 | | ... | - node - information about a DUT node. Type: dictionary
143 | | ... | - perf - Running on performance testbed? Yes/no Type: boolean
144 | | ...
145 | | ... | *Example:*
146 | | ...
147 | | ... | \| Archive Honeycomb logs \| ${nudes['DUT1']} \|
148 | | ...
149 | | [Arguments] | ${node} | ${perf}=${False}
150 | | Archive Honeycomb log | ${node} | ${perf}
151 | | Archive ODL log | ${node}
152
153 | Configure ODL Client Service On DUT
154 | | [Documentation] | Configure and start ODL client, then repeatedly check if
155 | | ... | it is running.
156 | | ...
157 | | ... | *Arguments:*
158 | | ... | - node - information about a DUT node. Type: dictionary
159 | | ... | - odl_name - Name of ODL client version. Type: string
160 | | ...
161 | | ... | *Example:*
162 | | ...
163 | | ... | \| Configure ODL Client Service on DUT \| ${nodes['DUT1']} \
164 | | ... | \| carbon-SR1 \|
165 | | ...
166 | | [Arguments] | ${node} | ${odl_name}
167 | | Copy ODL Client | ${node} | ${odl_name} | /mnt/common | /tmp
168 | | Setup ODL Client | ${node} | /tmp
169 | | Wait until keyword succeeds | 3min | 30sec
170 | | ... | Install ODL Features | ${node} | /tmp
171 | | Wait until keyword succeeds | 4min | 15sec
172 | | ... | Mount Honeycomb on ODL | ${node}
173 | | Wait until keyword succeeds | 2min | 15sec
174 | | ... | Check ODL startup state | ${node}
175 | | Check honeycomb startup state | ${node} | timeout=120
176
177 | Configure Honeycomb for functional testing
178 | | [Documentation] | Configure Honeycomb with parameters for functional
179 | | ... | testing, then start Honeycomb and repeatedly check startup status.
180 | | ...
181 | | ... | *Arguments:*
182 | | ... | - node - information about a DUT node. Type: dictionary
183 | | ...
184 | | ... | *Example:*
185 | | ...
186 | | ... | \| Configure Honeycomb for functional testing \| ${nodes['DUT1']} \|
187 | | ...
188 | | [Arguments] | ${node}
189 | | Configure Restconf binding address | ${node}
190 | | Configure Log Level | ${node} | TRACE
191 | | Configure Persistence | ${node} | disable
192 | | Configure jVPP timeout | ${node} | ${10}
193 | | Generate Honeycomb startup configuration for ODL test | ${node}
194 | | Clear Persisted Honeycomb Configuration | ${node}
195 | | Configure Honeycomb service on DUTs | ${node}
196
197 | Configure ODL Client for functional testing
198 | | [Documentation] | Read external variable HC_ODL. Depending on its
199 | | ... | value either: do nothing, or setup ODL client for testing and
200 | | ... | create a global variable that modifies Restconf requests to use ODL.
201 | | ...
202 | | ... | *Arguments:*
203 | | ... | - node - information about a DUT node. Type: dictionary
204 | | ...
205 | | ... | *Example:*
206 | | ...
207 | | ... | \| Configure ODL Client for functional testing \| ${nodes['DUT1']} \|
208 | | ...
209 | | [Arguments] | ${node}
210 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
211 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
212 | | ... | Run Keywords
213 | | ... | Set Global Variable | ${use_odl_client} | AND
214 | | ... | Configure ODL Client Service On DUT | ${node} | ${use_odl_client}
215 | | ... | ELSE | Log | Variable HC_ODL is not present. Not using ODL.
216 | | ... | level=INFO
217
218 | Set Up Honeycomb Functional Test Suite
219 | | [Documentation] | Generic test suite setup for Honeycomb functional tests.
220 | | ... | Restarts VPP, then enables Honeycomb and optionally ODL, based
221 | | ... | on external variable.
222 | | ...
223 | | ... | *Arguments:*
224 | | ... | - node - information about a DUT node. Type: dictionary
225 | | ...
226 | | ... | *Example:*
227 | | ...
228 | | ... | \| Set Up Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
229 | | ...
230 | | [Arguments] | ${node}
231 | | Setup DUT | ${node}
232 | | Configure all TGs for traffic script
233 | | Configure Honeycomb for functional testing | ${node}
234 | | Configure ODL Client for functional testing | ${node}
235
236 | Tear Down Honeycomb Functional Test Suite
237 | | [Documentation] | Generic test suite teardown for Honeycomb functional
238 | | ... | tests. Stops ODL client (if used), then stops Honeycomb and verifies
239 | | ... | that they are both stopped.
240 | | ...
241 | | ... | *Arguments:*
242 | | ... | - node - information about a DUT node. Type: dictionary
243 | | ...
244 | | ... | *Example:*
245 | | ...
246 | | ... | \| Tear Down Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
247 | | ...
248 | | [Arguments] | ${node}
249 | | Append suite to Honeycomb log file | ${node}
250 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
251 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
252 | | ... | Run Keywords
253 | | ... | Append suite to ODL log file | ${node} | ${use_odl_client} | AND
254 | | ... | Stop ODL Client | ${node} | /tmp | AND
255 | | ... | Wait until keyword succeeds | 3min | 15sec
256 | | ... | Check ODL shutdown state | ${node} | AND
257 | | ... | Set Global Variable | ${use_odl_client} | ${NONE}
258 | | Stop Honeycomb service on DUTs | ${node}
259 | | Clear Honeycomb Log | ${node}
260 | | Stop VPP Service on DUT | ${node}
261
262 | Enable Honeycomb Feature
263 | | [Documentation] | Enable the specified feature in Honeycomb configuration.
264 | | ... | Requires a restart of Honeycomb to take effect.
265 | | ...
266 | | ... | *Arguments:*
267 | | ... | - node - information about a DUT node. Type: dictionary
268 | | ...
269 | | ... | *Example:*
270 | | ...
271 | | ... | \| Enable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
272 | | ...
273 | | [arguments] | ${node} | ${feature}
274 | | Manage Honeycomb Features | ${node} | ${feature}
275
276 | Disable Honeycomb Feature
277 | | [Documentation] | Disable the specified feature in Honeycomb configuration.
278 | | ... | Requires a restart of Honeycomb to take effect.
279 | | ...
280 | | ... | *Arguments:*
281 | | ... | - node - information about a DUT node. Type: dictionary
282 | | ...
283 | | ... | *Example:*
284 | | ...
285 | | ... | \| Disable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
286 | | ...
287 | | [arguments] | ${node} | ${feature}
288 | | Manage Honeycomb Features | ${node} | ${feature} | disable=${True}
289
290 | Honeycomb Performance Suite Setup Generic
291 | | [Documentation] | Generic test suite setup for Honeycomb performance tests.
292 | | ... | Performs multiple attempts to start Honeycomb+VPP stack.
293 | | ...
294 | | ... | *Arguments:*
295 | | ... | - node - information about a DUT node. Type: dictionary
296 | | ...
297 | | ... | *Example:*
298 | | ...
299 | | ... | \| Honeycomb Performance Suite Setup Generic \| ${nodes['DUT1']} \|
300 | | ...
301 | | [Arguments] | ${node}
302 | | Wait until keyword succeeds | 8min | 2min
303 | | ... | Restart Honeycomb and VPP in Performance test | ${node}
304
305 | Honeycomb Performance Suite Teardown Generic
306 | | [Documentation] | Generic test suite teardown for Honeycomb performance
307 | | ... | tests. Logs CPU usage before stopping Honeycomb.
308 | | ...
309 | | ... | *Arguments:*
310 | | ... | - node - information about a DUT node. Type: dictionary
311 | | ...
312 | | ... | *Example:*
313 | | ...
314 | | ... | \| Honeycomb Performance Suite Teardown Generic \| ${nodes['DUT1']} \|
315 | | ...
316 | | [Arguments] | ${node}
317 | | Log Honeycomb and VPP process distribution on cores | ${node}
318 | | Append suite to Honeycomb log file | ${node}
319 | | Stop Honeycomb service on DUTs | ${node}
320 | | Clear Honeycomb Log | ${node}
321 | | Stop VPP Service on DUT | ${node}
322
323 | Append suite to Honeycomb log file
324 | | [Documentation] | Add the contents of honeycomb.log for the current suite\
325 | | ... | to the full log which will be archived.
326 | | ...
327 | | ... | *Arguments:*
328 | | ... | - node - information about a DUT node. Type: dictionary
329 | | ...
330 | | ... | *Example:*
331 | | ...
332 | | ... | \| Append suite to Honeycomb log file \| ${nodes['DUT1']} \|
333 | | ...
334 | | [Arguments] | ${node}
335 | | Append Honeycomb log | ${node} | ${SUITE_NAME}
336
337 | Append suite to ODL log file
338 | | [Documentation] | Add the contents of ODL karaf.log for the current suite\
339 | | ... | to the full log which will be archived.
340 | | ...
341 | | ... | *Arguments:*
342 | | ... | - node - information about a DUT node. Type: dictionary
343 | | ... | - odl_name - name of ODL client version. Type: string
344 | | ...
345 | | ... | *Example:*
346 | | ...
347 | | ... | \| Append suite to ODL karaf log file \| ${nodes['DUT1']} \
348 | | ... | \| Oxygen \|
349 | | ...
350 | | [Arguments] | ${node} | ${odl_name}
351 | | Append ODL log | ${node} | ${odl_name} | ${SUITE_NAME}
352
353 | Generate Honeycomb startup configuration for ODL test
354 | | [Documentation] | Create HC startup configuration and apply to config
355 | | ... | file on DUT. Requires Honeycomb restart to take effect.
356 | | ...
357 | | ... | *Arguments:*
358 | | ... | - node - Honeycomb node. Type: dictionary
359 | | ...
360 | | ... | *Example:*
361 | | ...
362 | | ... | \| Generate Honeycomb startup configuration for ODL test \
363 | | ... | \| ${nodes[DUT1]} \|
364 | | ...
365 | | [Arguments] | ${node}
366 | | Import Library | resources.libraries.python.honeycomb.HoneycombSetup.HoneycombStartupConfig
367 | | ... | WITH NAME | HC_config
368 | | Run Keyword | HC_config.Set SSH Security provider
369 | | Run Keyword | HC_config.Set Memory Size | ${32}
370 | | Run Keyword | HC_config.Set Metaspace Size | ${32}
371 | | Run Keyword | HC_config.Apply config | ${node}