IPsec Multi-Tunnel performance test suite
[csit.git] / resources / libraries / robot / default.robot
1 # Copyright (c) 2016 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 | Variables | resources/libraries/python/topology.py
16 | Variables | resources/libraries/python/VatHistory.py
17 | Library | resources.libraries.python.topology.Topology
18 | Library | resources.libraries.python.VatHistory
19 | Library | resources.libraries.python.CpuUtils
20 | Library | resources.libraries.python.DUTSetup
21 | Library | resources.libraries.python.SchedUtils
22 | Library | resources.libraries.python.TGSetup
23 | Library | resources.libraries.python.L2Util
24 | Library | resources/libraries/python/VppConfigGenerator.py
25 | Library | resources/libraries/python/VppCounters.py
26 | Library | Collections
27
28 *** Keywords ***
29 | Setup all DUTs before test
30 | | [Documentation] | Setup all DUTs in topology before test execution.
31 | | ...
32 | | Setup All DUTs | ${nodes}
33
34 | Setup all TGs before traffic script
35 | | [Documentation] | Prepare all TGs before traffic scripts execution.
36 | | ...
37 | | All TGs Set Interface Default Driver | ${nodes}
38
39 | Show Vpp Version On All DUTs
40 | | [Documentation] | Show VPP version verbose on all DUTs.
41 | | ...
42 | | ${duts}= | Get Matches | ${nodes} | DUT*
43 | | :FOR | ${dut} | IN | @{duts}
44 | | | Vpp show version verbose | ${nodes['${dut}']}
45
46 | Show Vpp Errors On All DUTs
47 | | [Documentation] | Show VPP errors verbose on all DUTs.
48 | | ...
49 | | ${duts}= | Get Matches | ${nodes} | DUT*
50 | | :FOR | ${dut} | IN | @{duts}
51 | | | Vpp Show Errors | ${nodes['${dut}']}
52
53 | Show Vpp Trace Dump On All DUTs
54 | | [Documentation] | Save API trace and dump output on all DUTs.
55 | | ...
56 | | ${duts}= | Get Matches | ${nodes} | DUT*
57 | | :FOR | ${dut} | IN | @{duts}
58 | | | Vpp api trace save | ${nodes['${dut}']}
59 | | | Vpp api trace dump | ${nodes['${dut}']}
60
61 | Show Vpp Vhost On All DUTs
62 | | [Documentation] | Show Vhost User on all DUTs.
63 | | ...
64 | | ${duts}= | Get Matches | ${nodes} | DUT*
65 | | :FOR | ${dut} | IN | @{duts}
66 | | | Vpp Show Vhost | ${nodes['${dut}']}
67
68 | Show Bridge Domain Data On All DUTs
69 | | [Documentation] | Show Bridge Domain data on all DUTs.
70 | | ...
71 | | ${duts}= | Get Matches | ${nodes} | DUT*
72 | | :FOR | ${dut} | IN | @{duts}
73 | | | Vpp Get Bridge Domain Data | ${nodes['${dut}']}
74
75 | Setup Scheduler Policy for Vpp On All DUTs
76 | | [Documentation] | Set realtime scheduling policy (SCHED_RR) with priority 1
77 | | ... | on all VPP worker threads on all DUTs.
78 | | ...
79 | | ${duts}= | Get Matches | ${nodes} | DUT*
80 | | :FOR | ${dut} | IN | @{duts}
81 | | | Set VPP Scheduling rr | ${nodes['${dut}']}
82
83 | Verify Crypto Device On All DUTs
84 | | [Documentation] | Verify if Crypto QAT device virtual functions are
85 | | ... | initialized on all DUTs. If parameter force_init is set to True, then
86 | | ... | try to initialize.
87 | | ...
88 | | ... | *Arguments:*
89 | | ... | - ${force_init} - Try to initialize. Type: boolean
90 | | ...
91 | | ... | *Example:*
92 | | ...
93 | | ... | \| Verify Crypto Device On All DUTs \| ${True} \|
94 | | ...
95 | | [Arguments] | ${force_init}=${False}
96 | | ...
97 | | ${duts}= | Get Matches | ${nodes} | DUT*
98 | | :FOR | ${dut} | IN | @{duts}
99 | | | Crypto Device Verify | ${nodes['${dut}']} | force_init=${force_init}
100
101 | Verify Kernel Module On All DUTs
102 | | [Documentation] | Verify if specific kernel module is loaded on all DUTs.
103 | | ... | If parameter force_load is set to True, then try to initialize.
104 | | ...
105 | | ... | *Arguments:*
106 | | ... | - ${module} - Module to verify. Type: string
107 | | ... | - ${force_load} - Try to load module. Type: boolean
108 | | ...
109 | | ... | *Example:*
110 | | ...
111 | | ... | \| Verify Kernel Module On All DUTs \| ${True} \|
112 | | ...
113 | | [Arguments] | ${module} | ${force_load}=${False}
114 | | ...
115 | | ${duts}= | Get Matches | ${nodes} | DUT*
116 | | :FOR | ${dut} | IN | @{duts}
117 | | | Kernel Module Verify | ${nodes['${dut}']} | ${module}
118 | | | ... | force_load=${force_load}
119
120 | Add '${m}' worker threads and rxqueues '${n}' in 3-node single-link topo
121 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
122 | | ... | configuration on all DUTs in 3-node single-link topology.
123 | | ...
124 | | ${m_int}= | Convert To Integer | ${m}
125 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
126 | | ... | ${dut1_if1} | ${dut1_if2}
127 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
128 | | ... | ${dut2_if1} | ${dut2_if2}
129 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
130 | | ... | skip_cnt=${1} | cpu_cnt=${1}
131 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
132 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
133 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
134 | | ... | skip_cnt=${1} | cpu_cnt=${1}
135 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
136 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
137 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
138 | | ... | corelist-workers | ${dut1_cpu_w}
139 | | ${dut2_cpu}= | Catenate | main-core | ${dut2_cpu_main}
140 | | ... | corelist-workers | ${dut2_cpu_w}
141 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
142 | | Add CPU config | ${dut1} | ${dut1_cpu}
143 | | Add CPU config | ${dut2} | ${dut2_cpu}
144 | | Add rxqueues config | ${dut1} | ${rxqueues}
145 | | Add rxqueues config | ${dut2} | ${rxqueues}
146
147 | Add '${m}' worker threads and rxqueues '${n}' in 2-node single-link topo
148 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
149 | | ... | configuration on all DUTs in 2-node single-link topology.
150 | | ...
151 | | ${m_int}= | Convert To Integer | ${m}
152 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
153 | | ... | ${dut1_if1} | ${dut1_if2}
154 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
155 | | ... | skip_cnt=${1} | cpu_cnt=${1}
156 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
157 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
158 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
159 | | ... | corelist-workers | ${dut1_cpu_w}
160 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
161 | | Add CPU config | ${dut1} | ${dut1_cpu}
162 | | Add rxqueues config | ${dut1} | ${rxqueues}
163
164 | Add '${m}' worker threads using SMT and rxqueues '${n}' in 3-node single-link topo
165 | | [Documentation] | Setup M worker threads using SMT and N rxqueues in vpp\
166 | | ... | startup configuration on all DUTs in 3-node single-link topology.
167 | | ...
168 | | ${m_int}= | Convert To Integer | ${m}
169 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
170 | | ... | ${dut1_if1} | ${dut1_if2}
171 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
172 | | ... | ${dut2_if1} | ${dut2_if2}
173 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
174 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
175 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
176 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
177 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
178 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
179 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
180 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
181 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
182 | | ... | corelist-workers | ${dut1_cpu_w}
183 | | ${dut2_cpu}= | Catenate | main-core | ${dut2_cpu_main}
184 | | ... | corelist-workers | ${dut2_cpu_w}
185 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
186 | | Add CPU config | ${dut1} | ${dut1_cpu}
187 | | Add CPU config | ${dut2} | ${dut2_cpu}
188 | | Add rxqueues config | ${dut1} | ${rxqueues}
189 | | Add rxqueues config | ${dut2} | ${rxqueues}
190
191 | Add '${m}' worker threads using SMT and rxqueues '${n}' in 2-node single-link topo
192 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
193 | | ... | configuration on all DUTs in 2-node single-link topology.
194 | | ...
195 | | ${m_int}= | Convert To Integer | ${m}
196 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
197 | | ... | ${dut1_if1} | ${dut1_if2}
198 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
199 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
200 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
201 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
202 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
203 | | ... | corelist-workers | ${dut1_cpu_w}
204 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
205 | | Add CPU config | ${dut1} | ${dut1_cpu}
206 | | Add rxqueues config | ${dut1} | ${rxqueues}
207
208 | Add worker threads and rxqueues to all DUTs
209 | | [Documentation] | Setup worker threads and rxqueues in VPP startup\
210 | | ... | configuration to all DUTs.
211 | | ...
212 | | ... | *Arguments:*
213 | | ... | - ${cpu} - CPU configuration. Type: string
214 | | ... | - ${rxqueues} - rxqueues configuration. Type: string
215 | | ...
216 | | ... | *Example:*
217 | | ...
218 | | ... | \| Add worker threads and rxqueues to all DUTs \| main-core 0 \
219 | | ... | \| rxqueues 2 \|
220 | | ...
221 | | [Arguments] | ${cpu} | ${rxqueues}
222 | | ...
223 | | ${duts}= | Get Matches | ${nodes} | DUT*
224 | | :FOR | ${dut} | IN | @{duts}
225 | | | Add CPU config | ${nodes['${dut}']} | ${cpu}
226 | | | Add rxqueues config | ${nodes['${dut}']} | ${rxqueues}
227
228 | Add all PCI devices to all DUTs
229 | | [Documentation] | Add all available PCI devices from topology file to VPP\
230 | | ... | startup configuration to all DUTs.
231 | | ...
232 | | ${duts}= | Get Matches | ${nodes} | DUT*
233 | | :FOR | ${dut} | IN | @{duts}
234 | | | Add PCI all devices | ${nodes['${dut}']}
235
236 | Add PCI device to DUT
237 | | [Documentation] | Add PCI device to VPP startup configuration
238 | | ... | to DUT specified as argument.
239 | | ...
240 | | ... | *Arguments:*
241 | | ... | - ${node} - DUT node. Type: dictionary
242 | | ... | - ${pci_address} - PCI address. Type: string
243 | | ...
244 | | ... | *Example:*
245 | | ...
246 | | ... | \| Add PCI device to DUT \| ${nodes['DUT1']} \| 0000:00:00.0 \|
247 | | ...
248 | | [Arguments] | ${node} | ${pci_address}
249 | | ...
250 | | Add PCI device | ${node} | ${pci_address}
251
252 | Add Heapsize Config to all DUTs
253 | | [Documentation] | Add Add Heapsize Config to VPP startup configuration\
254 | | ... | to all DUTs.
255 | | ...
256 | | ... | *Arguments:*
257 | | ... | - ${heapsize} - Heapsize string (5G, 200M, ...)
258 | | ...
259 | | ... | *Example:*
260 | | ...
261 | | ... | \| Add Heapsize Config to all DUTs \| 200M \|
262 | | ...
263 | | [Arguments] | ${heapsize}
264 | | ...
265 | | ${duts}= | Get Matches | ${nodes} | DUT*
266 | | :FOR | ${dut} | IN | @{duts}
267 | | | Add Heapsize Config | ${nodes['${dut}']} | ${heapsize}
268
269 | Add No Multi Seg to all DUTs
270 | | [Documentation] | Add No Multi Seg to VPP startup configuration to all DUTs.
271 | | ...
272 | | ${duts}= | Get Matches | ${nodes} | DUT*
273 | | :FOR | ${dut} | IN | @{duts}
274 | | | Add No Multi Seg Config | ${nodes['${dut}']}
275
276 | Add Enable Vhost User to all DUTs
277 | | [Documentation] | Add Enable Vhost User to VPP startup configuration to all\
278 | | ... | DUTs.
279 | | ...
280 | | ${duts}= | Get Matches | ${nodes} | DUT*
281 | | :FOR | ${dut} | IN | @{duts}
282 | | | Add Enable Vhost User Config | ${nodes['${dut}']}
283
284 | Add Cryptodev to all DUTs
285 | | [Documentation] | AddCryptodev to VPP startup configuration to all
286 | | ...             | DUTs
287 | | ...
288 | | ... | *Arguments:*
289 | | ... | - ${count} - Number of QAT devices. Type: integer
290 | | ...
291 | | ... | *Example:*
292 | | ...
293 | | ... | \| Add Cryptodev to all DUTs \| ${4} \|
294 | | ...
295 | | [Arguments] | ${count}
296 | | ${duts}= | Get Matches | ${nodes} | DUT*
297 | | :FOR | ${dut} | IN | @{duts}
298 | | | Add Cryptodev Config | ${nodes['${dut}']} | ${count}
299
300 | Remove startup configuration of VPP from all DUTs
301 | | [Documentation] | Remove VPP startup configuration from all DUTs.
302 | | ...
303 | | ${duts}= | Get Matches | ${nodes} | DUT*
304 | | :FOR | ${dut} | IN | @{duts}
305 | | | Remove All PCI Devices | ${nodes['${dut}']}
306 | | | Remove All CPU Config | ${nodes['${dut}']}
307 | | | Remove Socketmem Config | ${nodes['${dut}']}
308 | | | Remove Cryptodev Config | ${nodes['${dut}']}
309 | | | Remove Heapsize Config | ${nodes['${dut}']}
310 | | | Remove Rxqueues Config | ${nodes['${dut}']}
311 | | | Remove No Multi Seg Config | ${nodes['${dut}']}
312 | | | Remove Enable Vhost User Config | ${nodes['${dut}']}
313
314 | Setup default startup configuration of VPP on all DUTs
315 | | [Documentation] | Setup default startup configuration of VPP to all DUTs.
316 | | ...
317 | | Remove startup configuration of VPP from all DUTs
318 | | Add '1' worker threads and rxqueues '1' in 3-node single-link topo
319 | | Add all PCI devices to all DUTs
320 | | Apply startup configuration on all VPP DUTs
321
322 | Setup 2-node startup configuration of VPP on all DUTs
323 | | [Documentation] | Setup default startup configuration of VPP to all DUTs.
324 | | ...
325 | | Remove startup configuration of VPP from all DUTs
326 | | Add '1' worker threads and rxqueues '1' in 2-node single-link topo
327 | | Add all PCI devices to all DUTs
328 | | Apply startup configuration on all VPP DUTs
329
330 | Apply startup configuration on all VPP DUTs
331 | | [Documentation] | Apply startup configuration of VPP and restart VPP on all\
332 | | ... | DUTs.
333 | | ...
334 | | ${duts}= | Get Matches | ${nodes} | DUT*
335 | | :FOR | ${dut} | IN | @{duts}
336 | | | Apply Config | ${nodes['${dut}']}
337 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${TRUE}
338
339 | Save VPP PIDs
340 | | [Documentation] | Get PIDs of VPP processes from all DUTs in topology and\
341 | | ... | set it as a test variable. The PIDs are stored as dictionary items\
342 | | ... | where the key is the host and the value is the PID.
343 | | ...
344 | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes}
345 | | Set Test Variable | ${setup_vpp_pids}
346
347 | Check VPP PID in Teardown
348 | | [Documentation] | Check if the VPP PIDs on all DUTs are the same at the end\
349 | | ... | of test as they were at the begining. If they are not, only a message\
350 | | ... | is printed on console and to log. The test will not fail.
351 | | ...
352 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
353 | | ${err_msg}= | Catenate | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
354 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
355 | | ${rc} | ${msg}= | Run keyword and ignore error
356 | | ... | Dictionaries Should Be Equal
357 | | ... | ${setup_vpp_pids} | ${teardown_vpp_pids}
358 | | Run Keyword And Return If | '${rc}'=='FAIL' | Log | ${err_msg}
359 | | ... | console=yes | level=WARN
360
361 | Func Test Setup
362 | | [Documentation] | Common test setup for functional tests.
363 | | ...
364 | | Setup all DUTs before test
365 | | Save VPP PIDs
366 | | Setup all TGs before traffic script
367 | | Update All Interface Data On All Nodes | ${nodes}
368 | | Reset VAT History On All DUTs | ${nodes}
369
370 | Func Test Teardown
371 | | [Documentation] | Common test teardown for functional tests.
372 | | ...
373 | | Show Packet Trace on All DUTs | ${nodes}
374 | | Show VAT History On All DUTs | ${nodes}
375 | | Vpp Show Errors On All DUTs | ${nodes}
376 | | Check VPP PID in Teardown