HC Test: Fix missing import in performance job setup
[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 log file
138 | | [Documentation] | Copy honeycomb.log file 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 log file \| ${nudes['DUT1']} \|
148 | | ...
149 | | [Arguments] | ${node} | ${perf}=${False}
150 | | Archive Honeycomb log | ${node} | ${perf}
151
152 | Configure ODL Client Service On DUT
153 | | [Documentation] | Configure and start ODL client, then repeatedly check if
154 | | ... | it is running.
155 | | ...
156 | | ... | *Arguments:*
157 | | ... | - node - information about a DUT node. Type: dictionary
158 | | ... | - odl_name - Name of ODL client version. Type: string
159 | | ...
160 | | ... | *Example:*
161 | | ...
162 | | ... | \| Configure ODL Client Service on DUT \| ${nodes['DUT1']} \
163 | | ... | \| carbon-SR1 \|
164 | | ...
165 | | [Arguments] | ${node} | ${odl_name}
166 | | Copy ODL Client | ${node} | ${odl_name} | /mnt/common | /tmp
167 | | Setup ODL Client | ${node} | /tmp
168 | | Wait until keyword succeeds | 2min | 30sec
169 | | ... | Install ODL Features | ${node} | /tmp
170 | | Wait until keyword succeeds | 4min | 15sec
171 | | ... | Mount Honeycomb on ODL | ${node}
172 | | Wait until keyword succeeds | 2min | 15sec
173 | | ... | Check ODL startup state | ${node}
174 | | Check honeycomb startup state | ${node} | timeout=120
175
176 | Configure Honeycomb for functional testing
177 | | [Documentation] | Configure Honeycomb with parameters for functional
178 | | ... | testing, then start Honeycomb and repeatedly check startup status.
179 | | ...
180 | | ... | *Arguments:*
181 | | ... | - node - information about a DUT node. Type: dictionary
182 | | ...
183 | | ... | *Example:*
184 | | ...
185 | | ... | \| Configure Honeycomb for functional testing \| ${nodes['DUT1']} \|
186 | | ...
187 | | [Arguments] | ${node}
188 | | Configure Restconf binding address | ${node}
189 | | Configure Log Level | ${node} | TRACE
190 | | Configure Persistence | ${node} | disable
191 | | Configure jVPP timeout | ${node} | ${10}
192 | | Generate Honeycomb startup configuration for ODL test | ${node}
193 | | Clear Persisted Honeycomb Configuration | ${node}
194 | | Configure Honeycomb service on DUTs | ${node}
195
196 | Configure ODL Client for functional testing
197 | | [Documentation] | Read external variable HC_ODL. Depending on its
198 | | ... | value either: do nothing, or setup ODL client for testing and
199 | | ... | create a global variable that modifies Restconf requests to use ODL.
200 | | ...
201 | | ... | *Arguments:*
202 | | ... | - node - information about a DUT node. Type: dictionary
203 | | ...
204 | | ... | *Example:*
205 | | ...
206 | | ... | \| Configure ODL Client for functional testing \| ${nodes['DUT1']} \|
207 | | ...
208 | | [Arguments] | ${node}
209 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
210 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
211 | | ... | Run Keywords
212 | | ... | Set Global Variable | ${use_odl_client} | AND
213 | | ... | Configure ODL Client Service On DUT | ${node} | ${use_odl_client}
214 | | ... | ELSE | Log | Variable HC_ODL is not present. Not using ODL.
215 | | ... | level=INFO
216
217 | Set Up Honeycomb Functional Test Suite
218 | | [Documentation] | Generic test suite setup for Honeycomb functional tests.
219 | | ... | Restarts VPP, then enables Honeycomb and optionally ODL, based
220 | | ... | on external variable.
221 | | ...
222 | | ... | *Arguments:*
223 | | ... | - node - information about a DUT node. Type: dictionary
224 | | ...
225 | | ... | *Example:*
226 | | ...
227 | | ... | \| Set Up Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
228 | | ...
229 | | [Arguments] | ${node}
230 | | Setup DUT | ${node}
231 | | Configure all TGs for traffic script
232 | | Configure Honeycomb for functional testing | ${node}
233 | | Configure ODL Client for functional testing | ${node}
234
235 | Tear Down Honeycomb Functional Test Suite
236 | | [Documentation] | Generic test suite teardown for Honeycomb functional
237 | | ... | tests. Stops ODL client (if used), then stops Honeycomb and verifies
238 | | ... | that they are both stopped.
239 | | ...
240 | | ... | *Arguments:*
241 | | ... | - node - information about a DUT node. Type: dictionary
242 | | ...
243 | | ... | *Example:*
244 | | ...
245 | | ... | \| Tear Down Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
246 | | ...
247 | | [Arguments] | ${node}
248 | | Append suite to Honeycomb log file | ${node}
249 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
250 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
251 | | ... | Run Keywords
252 | | ... | Stop ODL Client | ${node} | /tmp | AND
253 | | ... | Wait until keyword succeeds | 3min | 15sec
254 | | ... | Check ODL shutdown state | ${node} | AND
255 | | ... | Set Global Variable | ${use_odl_client} | ${NONE}
256 | | Stop Honeycomb service on DUTs | ${node}
257 | | Clear Honeycomb Log | ${node}
258 | | Stop VPP Service on DUT | ${node}
259
260 | Enable Honeycomb Feature
261 | | [Documentation] | Enable the specified feature in Honeycomb configuration.
262 | | ... | Requires a restart of Honeycomb to take effect.
263 | | ...
264 | | ... | *Arguments:*
265 | | ... | - node - information about a DUT node. Type: dictionary
266 | | ...
267 | | ... | *Example:*
268 | | ...
269 | | ... | \| Enable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
270 | | ...
271 | | [arguments] | ${node} | ${feature}
272 | | Manage Honeycomb Features | ${node} | ${feature}
273
274 | Disable Honeycomb Feature
275 | | [Documentation] | Disable the specified feature in Honeycomb configuration.
276 | | ... | Requires a restart of Honeycomb to take effect.
277 | | ...
278 | | ... | *Arguments:*
279 | | ... | - node - information about a DUT node. Type: dictionary
280 | | ...
281 | | ... | *Example:*
282 | | ...
283 | | ... | \| Disable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
284 | | ...
285 | | [arguments] | ${node} | ${feature}
286 | | Manage Honeycomb Features | ${node} | ${feature} | disable=${True}
287
288 | Honeycomb Performance Suite Setup Generic
289 | | [Documentation] | Generic test suite setup for Honeycomb performance tests.
290 | | ... | Performs multiple attempts to start Honeycomb+VPP stack.
291 | | ...
292 | | ... | *Arguments:*
293 | | ... | - node - information about a DUT node. Type: dictionary
294 | | ...
295 | | ... | *Example:*
296 | | ...
297 | | ... | \| Honeycomb Performance Suite Setup Generic \| ${nodes['DUT1']} \|
298 | | ...
299 | | [Arguments] | ${node}
300 | | Wait until keyword succeeds | 8min | 2min
301 | | ... | Restart Honeycomb and VPP in Performance test | ${node}
302
303 | Honeycomb Performance Suite Teardown Generic
304 | | [Documentation] | Generic test suite teardown for Honeycomb performance
305 | | ... | tests. Logs CPU usage before stopping Honeycomb.
306 | | ...
307 | | ... | *Arguments:*
308 | | ... | - node - information about a DUT node. Type: dictionary
309 | | ...
310 | | ... | *Example:*
311 | | ...
312 | | ... | \| Honeycomb Performance Suite Teardown Generic \| ${nodes['DUT1']} \|
313 | | ...
314 | | [Arguments] | ${node}
315 | | Log Honeycomb and VPP process distribution on cores | ${node}
316 | | Append suite to Honeycomb log file | ${node}
317 | | Stop Honeycomb service on DUTs | ${node}
318 | | Clear Honeycomb Log | ${node}
319 | | Stop VPP Service on DUT | ${node}
320
321 | Append suite to Honeycomb log file
322 | | [Documentation] | Add the contents of honeycomb.log for the current suite\
323 | | ... | to the full log which will be archived.
324 | | ...
325 | | ... | *Arguments:*
326 | | ... | - node - information about a DUT node. Type: dictionary
327 | | ...
328 | | ... | *Example:*
329 | | ...
330 | | ... | \| Append suite to Honeycomb log file \| ${nodes['DUT1']} \|
331 | | ...
332 | | [Arguments] | ${node}
333 | | Append Honeycomb log | ${node} | ${SUITE_NAME}
334
335 | Generate Honeycomb startup configuration for ODL test
336 | | [Documentation] | Create HC startup configuration and apply to config
337 | | ... | file on DUT. Requires Honeycomb restart to take effect.
338 | | ...
339 | | ... | *Arguments:*
340 | | ... | - node - Honeycomb node. Type: dictionary
341 | | ...
342 | | ... | *Example:*
343 | | ...
344 | | ... | \| Generate Honeycomb startup configuration for ODL test \
345 | | ... | \| ${nodes[DUT1]} \|
346 | | ...
347 | | [Arguments] | ${node}
348 | | Import Library | resources.libraries.python.honeycomb.HoneycombSetup.HoneycombStartupConfig
349 | | ... | WITH NAME | HC_config
350 | | Run Keyword | HC_config.Set SSH Security provider
351 | | Run Keyword | HC_config.Set Memory Size | ${32}
352 | | Run Keyword | HC_config.Set Metaspace Size | ${32}
353 | | Run Keyword | HC_config.Apply config | ${node}