1b08e3955f06cb77e77a9e0d64c07daed0eb7f39
[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 | | Sleep | 5s | Make sure all modules are loaded and ready.
45
46 | Stop Honeycomb service on DUTs
47 | | [Documentation] | *Cleanup environment after honeycomb testing.*
48 | | ...
49 | | ... | _Teardown steps:_
50 | | ... | - 1. Login to each honeycomb node using ssh
51 | | ... | - 2. Stop honeycomb service
52 | | ... | - 3. Monitor service shutdown using HTTP GET request loop
53 | | ... | Expected sequence of HTTP replies:
54 | | ... | 200 -> 404 -> connection refused (pass)
55 | | ...
56 | | ... | _Arguments:_
57 | | ... | - duts - list of nodes to stop Honeycomb on
58 | | ...
59 | | ... | _Used global constants and variables:_
60 | | ... | - RESOURCES_TPL_HC - path to honeycomb templates directory
61 | | ... | - HTTPCodes - HTTP protocol status codes
62 | | ...
63 | | [Arguments] | @{duts}
64 | | Stop honeycomb on DUTs | @{duts}
65 | | Wait until keyword succeeds | 60sec | 16sec
66 | | ... | Check honeycomb shutdown state | @{duts}
67
68 | Clear persisted Honeycomb configuration
69 | | [Documentation] | *Delete saved configuration.*
70 | | ...
71 | | ... | *Arguments:*
72 | | ... | - duts - one or more nodes to clear persistence on. Type: dictionary
73 | | ...
74 | | ... | *Example:*
75 | | ...
76 | | ... | \| Clear persisted Honeycomb configuration \| ${nodes['DUT1']} \|
77 | | ...
78 | | [Arguments] | @{duts}
79 | | Clear persisted Honeycomb config | @{duts}
80
81 | Restart Honeycomb and VPP and clear persisted configuration
82 | | [Documentation] | Restarts Honeycomb and VPP with default configuration.
83 | | ...
84 | | ... | *Arguments:*
85 | | ... | - node - information about a DUT node. Type: dictionary
86 | | ...
87 | | ... | *Example:*
88 | | ...
89 | | ... | \| Restart Honeycomb and VPP and clear persisted configuration \
90 | | ... | \| ${nodes['DUT1']} \|
91 | | ...
92 | | [Arguments] | ${node}
93 | | Stop Honeycomb service on DUTs | ${node}
94 | | Clear persisted Honeycomb configuration | ${node}
95 | | Setup DUT | ${node}
96 | | Sleep | 10s | Wait 10sec so VPP is up for sure.
97 | | Configure Honeycomb service on DUTs | ${node}
98
99 | Restart Honeycomb and VPP
100 | | [Documentation] | Stops the Honeycomb service and verifies it is stopped.
101 | | ... | Then restarts VPP, starts Honeycomb again and verifies it is running.
102 | | ...
103 | | ... | *Arguments:*
104 | | ... | - node - information about a DUT node. Type: dictionary
105 | | ...
106 | | ... | *Example:*
107 | | ...
108 | | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \|
109 | | ...
110 | | [Arguments] | ${node}
111 | | Stop Honeycomb service on DUTs | ${node}
112 | | Setup DUT | ${node}
113 | | Sleep | 10s | Wait 10sec so VPP is up for sure.
114 | | Configure Honeycomb service on DUTs | ${node}
115
116 | Restart Honeycomb and VPP in performance test
117 | | [Documentation] | Stops Honeycomb and VPP and verifies HC is stopped.
118 | | ... | Then restarts VPP, starts Honeycomb again and verifies it is running.
119 | | ...
120 | | ... | *Arguments:*
121 | | ... | - node - information about a DUT node. Type: dictionary
122 | | ...
123 | | ... | *Example:*
124 | | ...
125 | | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \|
126 | | ...
127 | | [Arguments] | ${node}
128 | | Stop Honeycomb service on DUTs | ${node}
129 | | Stop VPP service on DUT | ${node}
130 | | Setup DUT | ${node}
131 | | Sleep | 10s | Wait 10sec so VPP is up for sure.
132 | | Configure Honeycomb service on DUTs | ${node}
133 | | Wait until keyword succeeds | 2min | 16sec
134 | | ... | Check honeycomb startup state | ${node}
135
136 | Archive Honeycomb log file
137 | | [Documentation] | Copy honeycomb.log file from Honeycomb node\
138 | | ... | to test executor.
139 | | ...
140 | | ... | *Arguments:*
141 | | ... | - node - information about a DUT node. Type: dictionary
142 | | ... | - perf - Running on performance testbed? Yes/no Type: boolean
143 | | ...
144 | | ... | *Example:*
145 | | ...
146 | | ... | \| Archive Honeycomb log file \| ${nudes['DUT1']} \|
147 | | ...
148 | | [Arguments] | ${node} | ${perf}=${False}
149 | | Archive Honeycomb log | ${node} | ${perf}
150
151 | Configure ODL Client Service On DUT
152 | | [Documentation] | Configure and start ODL client, then repeatedly check if
153 | | ... | it is running.
154 | | ...
155 | | ... | *Arguments:*
156 | | ... | - node - information about a DUT node. Type: dictionary
157 | | ... | - odl_name - Name of ODL client version. Type: string
158 | | ...
159 | | ... | *Example:*
160 | | ...
161 | | ... | \| Configure ODL Client Service on DUT \| ${nodes['DUT1']} \
162 | | ... | \| carbon-SR1 \|
163 | | ...
164 | | [Arguments] | ${node} | ${odl_name}
165 | | Copy ODL Client | ${node} | ${odl_name} | /mnt/common | /tmp
166 | | Setup ODL Client | ${node} | /tmp
167 | | Wait until keyword succeeds | 2min | 30sec
168 | | ... | Install ODL Features | ${node} | /tmp
169 | | Wait until keyword succeeds | 4min | 16sec
170 | | ... | Mount Honeycomb on ODL | ${node}
171 | | Wait until keyword succeeds | 2min | 16sec
172 | | ... | Check ODL startup state | ${node}
173 | | Wait until keyword succeeds | 2min | 16sec
174 | | ... | Check honeycomb startup state | ${node}
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} | ${14}
192 | | Clear Persisted Honeycomb Configuration | ${node}
193 | | Configure Honeycomb service on DUTs | ${node}
194
195 | Configure ODL Client for functional testing
196 | | [Documentation] | Read external variable HC_ODL. Depending on its
197 | | ... | value either: do nothing, or setup ODL client for testing and
198 | | ... | create a global variable that modifies Restconf requests to use ODL.
199 | | ...
200 | | ... | *Arguments:*
201 | | ... | - node - information about a DUT node. Type: dictionary
202 | | ...
203 | | ... | *Example:*
204 | | ...
205 | | ... | \| Configure ODL Client for functional testing \| ${nodes['DUT1']} \|
206 | | ...
207 | | [Arguments] | ${node}
208 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
209 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
210 | | ... | Run Keywords
211 | | ... | Set Global Variable | ${use_odl_client} | AND
212 | | ... | Configure ODL Client Service On DUT | ${node} | ${use_odl_client}
213 | | ... | ELSE | Log | Variable HC_ODL is not present. Not using ODL.
214 | | ... | level=INFO
215
216 | Set Up Honeycomb Functional Test Suite
217 | | [Documentation] | Generic test suite setup for Honeycomb functional tests.
218 | | ... | Restarts VPP, then enables Honeycomb and optionally ODL, based
219 | | ... | on external variable.
220 | | ...
221 | | ... | *Arguments:*
222 | | ... | - node - information about a DUT node. Type: dictionary
223 | | ...
224 | | ... | *Example:*
225 | | ...
226 | | ... | \| Set Up Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
227 | | ...
228 | | [Arguments] | ${node}
229 | | Setup DUT | ${node}
230 | | Configure all TGs for traffic script
231 | | Configure Honeycomb for functional testing | ${node}
232 | | Configure ODL Client for functional testing | ${node}
233
234 | Tear Down Honeycomb Functional Test Suite
235 | | [Documentation] | Generic test suite teardown for Honeycomb functional
236 | | ... | tests. Stops ODL client (if used), then stops Honeycomb and verifies
237 | | ... | that they are both stopped.
238 | | ...
239 | | ... | *Arguments:*
240 | | ... | - node - information about a DUT node. Type: dictionary
241 | | ...
242 | | ... | *Example:*
243 | | ...
244 | | ... | \| Tear Down Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
245 | | ...
246 | | [Arguments] | ${node}
247 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
248 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
249 | | ... | Run Keywords
250 | | ... | Stop ODL Client | ${node} | /tmp | AND
251 | | ... | Wait until keyword succeeds | 2min | 15sec
252 | | ... | Check ODL shutdown state | ${node} | AND
253 | | ... | Set Global Variable | ${use_odl_client} | ${NONE}
254 | | Stop Honeycomb service on DUTs | ${node}
255 | | Stop VPP Service on DUT | ${node}
256
257 | Enable Honeycomb Feature
258 | | [Documentation] | Enable the specified feature in Honeycomb configuration.
259 | | ... | Requires a restart of Honeycomb to take effect.
260 | | ...
261 | | ... | *Arguments:*
262 | | ... | - node - information about a DUT node. Type: dictionary
263 | | ...
264 | | ... | *Example:*
265 | | ...
266 | | ... | \| Enable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
267 | | ...
268 | | [arguments] | ${node} | ${feature}
269 | | Manage Honeycomb Features | ${node} | ${feature}
270
271 | Disable Honeycomb Feature
272 | | [Documentation] | Disable the specified feature in Honeycomb configuration.
273 | | ... | Requires a restart of Honeycomb to take effect.
274 | | ...
275 | | ... | *Arguments:*
276 | | ... | - node - information about a DUT node. Type: dictionary
277 | | ...
278 | | ... | *Example:*
279 | | ...
280 | | ... | \| Disable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
281 | | ...
282 | | [arguments] | ${node} | ${feature}
283 | | Manage Honeycomb Features | ${node} | ${feature} | disable=${True}
284
285 | Stop VPP Service on DUT
286 | | [Documentation] | Stop the VPP service on the specified node.
287 | | ...
288 | | ... | *Arguments:*
289 | | ... | - node - information about a DUT node. Type: dictionary
290 | | ...
291 | | ... | *Example:*
292 | | ...
293 | | ... | \| Stop VPP Service on DUT \| ${nodes['DUT1']} \|
294 | | ...
295 | | [Arguments] | ${node}
296 | | Stop VPP Service | ${node}
297
298 | Honeycomb Performance Suite Setup Generic
299 | | [Documentation] | Generic test suite setup for Honeycomb performance tests.
300 | | ... | Performs multiple attempts to start Honeycomb+VPP stack.
301 | | ...
302 | | ... | *Arguments:*
303 | | ... | - node - information about a DUT node. Type: dictionary
304 | | ...
305 | | ... | *Example:*
306 | | ...
307 | | ... | \| Honeycomb Performance Suite Setup Generic \| ${nodes['DUT1']} \|
308 | | ...
309 | | [Arguments] | ${node}
310 | | Wait until keyword succeeds | 8min | 2min
311 | | ... | Restart Honeycomb and VPP in Performance test | ${node}
312
313 | Honeycomb Performance Suite Teardown Generic
314 | | [Documentation] | Generic test suite teardown for Honeycomb performance
315 | | ... | tests. Logs CPU usage before stopping Honeycomb.
316 | | ...
317 | | ... | *Arguments:*
318 | | ... | - node - information about a DUT node. Type: dictionary
319 | | ...
320 | | ... | *Example:*
321 | | ...
322 | | ... | \| Honeycomb Performance Suite Teardown Generic \| ${nodes['DUT1']} \|
323 | | ...
324 | | [Arguments] | ${node}
325 | | Log Honeycomb and VPP process distribution on cores | ${node}
326 | | Stop Honeycomb service on DUTs | ${node}
327 | | Stop VPP Service on DUT | ${node}