Add stats segment heapsize to default config
[csit.git] / resources / libraries / robot / shared / 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 | Resource | resources/libraries/robot/vm/qemu.robot
16 | Resource | resources/libraries/robot/vm/double_qemu_setup.robot
17 | Variables | resources/libraries/python/topology.py
18 | Variables | resources/libraries/python/VatHistory.py
19 | Library | resources.libraries.python.topology.Topology
20 | Library | resources.libraries.python.VatHistory
21 | Library | resources.libraries.python.CpuUtils
22 | Library | resources.libraries.python.DUTSetup
23 | Library | resources.libraries.python.SchedUtils
24 | Library | resources.libraries.python.TGSetup
25 | Library | resources.libraries.python.L2Util
26 | Library | resources.libraries.python.Tap
27 | Library | resources.libraries.python.VppCounters
28 | Library | resources.libraries.python.VPPUtil
29 | Library | resources.libraries.python.Trace
30 | Library | Collections
31
32 *** Keywords ***
33 | Configure all DUTs before test
34 | | [Documentation] | Setup all DUTs in topology before test execution.
35 | | ...
36 | | Setup All DUTs | ${nodes}
37
38 | Configure all TGs for traffic script
39 | | [Documentation] | Prepare all TGs before traffic scripts execution.
40 | | ...
41 | | All TGs Set Interface Default Driver | ${nodes}
42
43 | Show Vpp Errors On All DUTs
44 | | [Documentation] | Show VPP errors verbose on all DUTs.
45 | | ...
46 | | ${duts}= | Get Matches | ${nodes} | DUT*
47 | | :FOR | ${dut} | IN | @{duts}
48 | | | Vpp Show Errors | ${nodes['${dut}']}
49
50 | Show VPP trace dump on all DUTs
51 | | [Documentation] | Save API trace and dump output on all DUTs.
52 | | ...
53 | | ${duts}= | Get Matches | ${nodes} | DUT*
54 | | :FOR | ${dut} | IN | @{duts}
55 | | | Vpp api trace save | ${nodes['${dut}']}
56 | | | Vpp api trace dump | ${nodes['${dut}']}
57
58 | Show Bridge Domain Data On All DUTs
59 | | [Documentation] | Show Bridge Domain data on all DUTs.
60 | | ...
61 | | ${duts}= | Get Matches | ${nodes} | DUT*
62 | | :FOR | ${dut} | IN | @{duts}
63 | | | Vpp Get Bridge Domain Data | ${nodes['${dut}']}
64
65 | Setup Scheduler Policy for Vpp On All DUTs
66 | | [Documentation] | Set realtime scheduling policy (SCHED_RR) with priority 1
67 | | ... | on all VPP worker threads on all DUTs.
68 | | ...
69 | | ${duts}= | Get Matches | ${nodes} | DUT*
70 | | :FOR | ${dut} | IN | @{duts}
71 | | | Set VPP Scheduling rr | ${nodes['${dut}']}
72
73 | Configure crypto device on all DUTs
74 | | [Documentation] | Verify if Crypto QAT device virtual functions are
75 | | ... | initialized on all DUTs. If parameter force_init is set to True, then
76 | | ... | try to initialize/disable.
77 | | ...
78 | | ... | *Arguments:*
79 | | ... | - force_init - Force to initialize. Type: boolean
80 | | ... | - numvfs - Number of VFs to initialize, 0 - disable the VFs
81 | | ... | (Optional). Type: integer, default value: ${32}
82 | | ...
83 | | ... | *Example:*
84 | | ...
85 | | ... | \| Configure crypto device on all DUTs \| ${True} \|
86 | | ...
87 | | [Arguments] | ${force_init}=${False} | ${numvfs}=${32}
88 | | ...
89 | | ${duts}= | Get Matches | ${nodes} | DUT*
90 | | :FOR | ${dut} | IN | @{duts}
91 | | | Crypto Device Verify | ${nodes['${dut}']} | force_init=${force_init}
92 | | | ... | numvfs=${numvfs}
93
94 | Configure kernel module on all DUTs
95 | | [Documentation] | Verify if specific kernel module is loaded on all DUTs.
96 | | ... | If parameter force_load is set to True, then try to initialize.
97 | | ...
98 | | ... | *Arguments:*
99 | | ... | - module - Module to verify. Type: string
100 | | ... | - force_load - Try to load module. Type: boolean
101 | | ...
102 | | ... | *Example:*
103 | | ...
104 | | ... | \| Configure kernel module on all DUTs \| ${True} \|
105 | | ...
106 | | [Arguments] | ${module} | ${force_load}=${False}
107 | | ...
108 | | ${duts}= | Get Matches | ${nodes} | DUT*
109 | | :FOR | ${dut} | IN | @{duts}
110 | | | Kernel Module Verify | ${nodes['${dut}']} | ${module}
111 | | | ... | force_load=${force_load}
112
113 | Create base startup configuration of VPP on all DUTs
114 | | [Documentation] | Create base startup configuration of VPP to all DUTs.
115 | | ...
116 | | ${duts}= | Get Matches | ${nodes} | DUT*
117 | | :FOR | ${dut} | IN | @{duts}
118 | | | Import Library | resources.libraries.python.VppConfigGenerator
119 | | | ... | WITH NAME | ${dut}
120 | | | Run keyword | ${dut}.Set Node |  ${nodes['${dut}']}
121 | | | Run keyword | ${dut}.Add Unix Log
122 | | | Run keyword | ${dut}.Add Unix CLI Listen
123 | | | Run keyword | ${dut}.Add Unix Nodaemon
124 | | | Run keyword | ${dut}.Add DPDK Socketmem | 1024,1024
125 | | | Run keyword | ${dut}.Add DPDK No Tx Checksum Offload
126 | | | Run keyword | ${dut}.Add DPDK Log Level | debug
127 | | | Run keyword | ${dut}.Add DPDK Uio Driver
128 | | | Run keyword | ${dut}.Add Heapsize | 4G
129 | | | Run keyword | ${dut}.Add Statseg size | 4G
130 | | | Run keyword | ${dut}.Add Plugin | disable | default
131 | | | Run keyword | ${dut}.Add Plugin | enable | @{plugins_to_enable}
132 | | | Run keyword | ${dut}.Add IP6 Hash Buckets | 2000000
133 | | | Run keyword | ${dut}.Add IP6 Heap Size | 4G
134 | | | Run keyword | ${dut}.Add IP Heap Size | 4G
135
136 | Add worker threads and rxqueues to all DUTs
137 | | [Documentation] | Setup worker threads and rxqueues in vpp startup
138 | | ... | configuration on all DUTs. Based on the SMT configuration of DUT if
139 | | ... | enabled keyword will automatically map also the sibling logical cores.
140 | | ... | Keyword will automatically set the appropriate test TAGs in format
141 | | ... | mTnC, where m=logical_core_count and n=physical_core_count.
142 | | ...
143 | | ... | *Arguments:*
144 | | ... | - cpu_cnt - Number of physical cores to use. Type: integer
145 | | ... | - rx_queues - Number of RX queues. Type: integer
146 | | ...
147 | | ... | *Example:*
148 | | ...
149 | | ... | \| Add worker threads and rxqueues to all DUTs \| ${1} \| ${1} \|
150 | | ...
151 | | [Arguments] | ${cpu_cnt} | ${rx_queues}
152 | | ...
153 | | ${cpu_count_int} | Convert to Integer | ${cpu_cnt}
154 | | ${thr_count_int} | Convert to Integer | ${cpu_cnt}
155 | | ${duts}= | Get Matches | ${nodes} | DUT*
156 | | :FOR | ${dut} | IN | @{duts}
157 | | | ${numa}= | Get interfaces numa node | ${nodes['${dut}']}
158 | | | ... | ${${dut}_if1} | ${${dut}_if2}
159 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
160 | | | ${cpu_main}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
161 | | | ... | skip_cnt=${1} | cpu_cnt=${1}
162 | | | ${cpu_wt}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
163 | | | ... | skip_cnt=${2} | cpu_cnt=${cpu_count_int} | smt_used=${smt_used}
164 | | | Run keyword | ${dut}.Add CPU Main Core | ${cpu_main}
165 | | | Run keyword | ${dut}.Add CPU Corelist Workers | ${cpu_wt}
166 | | | Run keyword | ${dut}.Add DPDK Dev Default RXQ | ${rx_queues}
167 | | | ${thr_count_int}= | Run keyword if | ${smt_used} |
168 | | | ... | Evaluate | int(${cpu_count_int}*2) | ELSE | Set variable
169 | | | ... | ${thr_count_int}
170 | | | Run keyword if | ${thr_count_int} > 1
171 | | | ... | Set Tags | MTHREAD | ELSE | Set Tags | STHREAD
172 | | | Set Tags | ${thr_count_int}T${cpu_count_int}C
173
174 # FIXME: Remove the keyword after refactor of suites. Currently kept for
175 # backward compatibility only.
176 | Add '${m}' worker threads and '${n}' rxqueues in 3-node single-link circular topology
177 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
178 | | ... | configuration on all DUTs in 3-node single-link topology.
179 | | ...
180 | | Add worker threads and rxqueues to all DUTs | ${m} | ${n}
181
182 | Add no multi seg to all DUTs
183 | | [Documentation] | Add No Multi Seg to VPP startup configuration to all DUTs.
184 | | ...
185 | | ${duts}= | Get Matches | ${nodes} | DUT*
186 | | :FOR | ${dut} | IN | @{duts}
187 | | | Run keyword | ${dut}.Add DPDK No Multi Seg
188
189 | Add DPDK dev default RXD to all DUTs
190 | | [Documentation] | Add DPDK num-rx-desc to VPP startup configuration to all
191 | | ... | DUTs.
192 | | ...
193 | | ... | *Arguments:*
194 | | ... | - rxd - Number of RX descriptors. Type: string
195 | | ...
196 | | ... | *Example:*
197 | | ...
198 | | ... | \| Add DPDK dev default RXD to all DUTs \| ${rxd} \|
199 | | ...
200 | | [Arguments] | ${rxd}
201 | | ...
202 | | ${duts}= | Get Matches | ${nodes} | DUT*
203 | | :FOR | ${dut} | IN | @{duts}
204 | | | Run keyword | ${dut}.Add DPDK Dev Default RXD | ${rxd}
205
206 | Add DPDK dev default TXD to all DUTs
207 | | [Documentation] | Add DPDK num-tx-desc to VPP startup configuration to all
208 | | ... | DUTs.
209 | | ...
210 | | ... | *Arguments:*
211 | | ... | - txd - Number of TX descriptors. Type: string
212 | | ...
213 | | ... | *Example:*
214 | | ...
215 | | ... | \| Add DPDK dev default TXD to all DUTs \| ${txd} \|
216 | | ...
217 | | [Arguments] | ${txd}
218 | | ...
219 | | ${duts}= | Get Matches | ${nodes} | DUT*
220 | | :FOR | ${dut} | IN | @{duts}
221 | | | Run keyword | ${dut}.Add DPDK Dev Default TXD | ${txd}
222
223 | Add DPDK Uio Driver on all DUTs
224 | | [Documentation] | Add DPDK uio driver to VPP startup configuration on all
225 | | ... | DUTs.
226 | | ...
227 | | ... | *Arguments:*
228 | | ... | - uio_driver - Required uio driver. Type: string
229 | | ...
230 | | ... | *Example:*
231 | | ...
232 | | ... | \| Add DPDK Uio Driver on all DUTs \| igb_uio \|
233 | | ...
234 | | [Arguments] | ${uio_driver}
235 | | ...
236 | | ${duts}= | Get Matches | ${nodes} | DUT*
237 | | :FOR | ${dut} | IN | @{duts}
238 | | | Run keyword | ${dut}.Add DPDK Uio Driver | ${uio_driver}
239
240 | Add NAT to all DUTs
241 | | [Documentation] | Add NAT configuration to all DUTs.
242 | | ...
243 | | ${duts}= | Get Matches | ${nodes} | DUT*
244 | | :FOR | ${dut} | IN | @{duts}
245 | | | Run keyword | ${dut}.Add NAT
246
247 | Add cryptodev to all DUTs
248 | | [Documentation] | Add Cryptodev to VPP startup configuration to all DUTs.
249 | | ...
250 | | ... | *Arguments:*
251 | | ... | - count - Number of QAT devices. Type: integer
252 | | ...
253 | | ... | *Example:*
254 | | ...
255 | | ... | \| Add cryptodev to all DUTs \| ${4} \|
256 | | ...
257 | | [Arguments] | ${count}
258 | | ${duts}= | Get Matches | ${nodes} | DUT*
259 | | :FOR | ${dut} | IN | @{duts}
260 | | | Run keyword | ${dut}.Add DPDK Cryptodev | ${count}
261
262 | Add DPDK SW cryptodev on DUTs in 3-node single-link circular topology
263 | | [Documentation] | Add required number of SW crypto devices of given type
264 | | ... | to VPP startup configuration on all DUTs in 3-node single-link
265 | | ... | circular topology.
266 | | ...
267 | | ... | *Arguments:*
268 | | ... | - sw_pmd_type - PMD type of SW crypto device. Type: string
269 | | ... | - count - Number of SW crypto devices. Type: string
270 | | ...
271 | | ... | *Example:*
272 | | ...
273 | | ... | \| Add DPDK SW cryptodev on DUTs in 3-node single-link circular\
274 | | ... | topology \| aesni-mb \| ${2} \|
275 | | ...
276 | | [Arguments] | ${sw_pmd_type} | ${count}
277 | | ${socket_id}= | Get Interface Numa Node | ${nodes['DUT1']} | ${dut1_if2}
278 | | Run keyword | DUT1.Add DPDK SW Cryptodev | ${sw_pmd_type} | ${socket_id}
279 | | ... | ${count}
280 | | ${socket_id}= | Get Interface Numa Node | ${nodes['DUT2']} | ${dut2_if1}
281 | | Run keyword | DUT2.Add DPDK SW Cryptodev | ${sw_pmd_type} | ${socket_id}
282 | | ... | ${count}
283
284 | Apply startup configuration on all VPP DUTs
285 | | [Documentation] | Write startup configuration and restart VPP on all DUTs.
286 | | ...
287 | | ... | *Arguments:*
288 | | ... | - restart_vpp - Whether to restart VPP (Optional). Type: boolean
289 | | ...
290 | | ... | *Example:*
291 | | ...
292 | | ... | \| Apply startup configuration on all VPP DUTs \| ${False} \|
293 | | ...
294 | | [Arguments] | ${restart_vpp}=${True}
295 | | ...
296 | | ${duts}= | Get Matches | ${nodes} | DUT*
297 | | :FOR | ${dut} | IN | @{duts}
298 | | | Run keyword | ${dut}.Apply Config | restart_vpp=${restart_vpp}
299 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${True}
300
301 | Save VPP PIDs
302 | | [Documentation] | Get PIDs of VPP processes from all DUTs in topology and\
303 | | ... | set it as a test variable. The PIDs are stored as dictionary items\
304 | | ... | where the key is the host and the value is the PID.
305 | | ...
306 | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes}
307 | | ${keys}= | Get Dictionary Keys | ${setup_vpp_pids}
308 | | :FOR | ${key} | IN | @{keys}
309 | | | ${pid}= | Get From Dictionary | ${setup_vpp_pids} | ${key}
310 | | | Run Keyword If | $pid is None | FAIL | No VPP PID found on node ${key}
311 | | | Run Keyword If | ',' in '${pid}'
312 | | | ... | FAIL | More then one VPP PID found on node ${key}: ${pid}
313 | | Set Test Variable | ${setup_vpp_pids}
314
315 | Verify VPP PID in Teardown
316 | | [Documentation] | Check if the VPP PIDs on all DUTs are the same at the end\
317 | | ... | of test as they were at the begining. If they are not, only a message\
318 | | ... | is printed on console and to log. The test will not fail.
319 | | ...
320 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
321 | | ${err_msg}= | Catenate | ${SUITE NAME} - ${TEST NAME}
322 | | ... | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
323 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
324 | | ${rc} | ${msg}= | Run keyword and ignore error
325 | | ... | Dictionaries Should Be Equal
326 | | ... | ${setup_vpp_pids} | ${teardown_vpp_pids}
327 | | Run Keyword And Return If | '${rc}'=='FAIL' | Log | ${err_msg}
328 | | ... | console=yes | level=WARN
329
330 | Set up functional test
331 | | [Documentation] | Common test setup for functional tests.
332 | | ...
333 | | Configure all DUTs before test
334 | | Save VPP PIDs
335 | | Configure all TGs for traffic script
336 | | Update All Interface Data On All Nodes | ${nodes}
337 | | Reset VAT History On All DUTs | ${nodes}
338
339 | Tear down functional test
340 | | [Documentation] | Common test teardown for functional tests.
341 | | ...
342 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
343 | | Show Packet Trace on All DUTs | ${nodes}
344 | | Show VAT History On All DUTs | ${nodes}
345 | | Vpp Show Errors On All DUTs | ${nodes}
346 | | Verify VPP PID in Teardown
347
348 | Tear down LISP functional test
349 | | [Documentation] | Common test teardown for functional tests with LISP.
350 | | ...
351 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
352 | | Show Packet Trace on All DUTs | ${nodes}
353 | | Show VAT History On All DUTs | ${nodes}
354 | | Show Vpp Settings | ${nodes['DUT1']}
355 | | Show Vpp Settings | ${nodes['DUT2']}
356 | | Vpp Show Errors On All DUTs | ${nodes}
357 | | Verify VPP PID in Teardown
358
359 | Tear down LISP functional test with QEMU
360 | | [Documentation] | Common test teardown for functional tests with LISP and\
361 | | ... | QEMU.
362 | | ...
363 | | ... | *Arguments:*
364 | | ... | - vm_node - VM to stop. Type: string
365 | | ...
366 | | ... | *Example:*
367 | | ...
368 | | ... | \| Tear down LISP functional test with QEMU \| ${vm_node} \|
369 | | ...
370 | | [Arguments] | ${vm_node}
371 | | ...
372 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
373 | | Show Packet Trace on All DUTs | ${nodes}
374 | | Show VAT History On All DUTs | ${nodes}
375 | | Show Vpp Settings | ${nodes['DUT1']}
376 | | Show Vpp Settings | ${nodes['DUT2']}
377 | | Vpp Show Errors On All DUTs | ${nodes}
378 | | Stop and clear QEMU | ${nodes['DUT1']} | ${vm_node}
379 | | Verify VPP PID in Teardown
380
381 | Set up TAP functional test
382 | | [Documentation] | Common test setup for functional tests with TAP.
383 | | ...
384 | | Set up functional test
385 | | Clean Up Namespaces | ${nodes['DUT1']}
386
387 | Tear down TAP functional test
388 | | [Documentation] | Common test teardown for functional tests with TAP.
389 | | ...
390 | | Tear down functional test
391 | | Clean Up Namespaces | ${nodes['DUT1']}
392
393 | Tear down TAP functional test with Linux bridge
394 | | [Documentation] | Common test teardown for functional tests with TAP and
395 | | ... | a Linux bridge.
396 | | ...
397 | | ... | *Arguments:*
398 | | ... | - bid_TAP - Bridge name. Type: string
399 | | ...
400 | | ... | *Example:*
401 | | ...
402 | | ... | \| Tear down TAP functional test with Linux bridge \| ${bid_TAP} \|
403 | | ...
404 | | [Arguments] | ${bid_TAP}
405 | | ...
406 | | Tear down functional test
407 | | Linux Del Bridge | ${nodes['DUT1']} | ${bid_TAP}
408 | | Clean Up Namespaces | ${nodes['DUT1']}
409
410 | Tear down FDS functional test
411 | | [Documentation] | Common test teardown for FDS functional tests.
412 | | ...
413 | | ... | *Arguments:*
414 | | ... | - dut1_node - Node Nr.1 where to clean qemu. Type: dictionary
415 | | ... | - qemu_node1 - VM Nr.1 node info dictionary. Type: string
416 | | ... | - dut2_node - Node Nr.2 where to clean qemu. Type: dictionary
417 | | ... | - qemu_node2 - VM Nr.2 node info dictionary. Type: string
418 | | ...
419 | | ... | *Example:*
420 | | ...
421 | | ... | \| Tear down FDS functional test \| ${dut1_node} \| ${qemu_node1}\
422 | | ... | \| ${dut2_node} \| ${qemu_node2} \|
423 | | ...
424 | | [Arguments] | ${dut1_node} | ${qemu_node1} | ${dut2_node}
425 | | ... | ${qemu_node2}
426 | | ...
427 | | Tear down functional test
428 | | Tear down QEMU | ${dut1_node} | ${qemu_node1} | qemu_node1
429 | | Tear down QEMU | ${dut2_node} | ${qemu_node2} | qemu_node2
430
431 | Stop VPP Service on DUT
432 | | [Documentation] | Stop the VPP service on the specified node.
433 | | ...
434 | | ... | *Arguments:*
435 | | ... | - node - information about a DUT node. Type: dictionary
436 | | ...
437 | | ... | *Example:*
438 | | ...
439 | | ... | \| Stop VPP Service on DUT \| ${nodes['DUT1']} \|
440 | | ...
441 | | [Arguments] | ${node}
442 | | Stop VPP Service | ${node}
443
444 | Start VPP Service on DUT
445 | | [Documentation] | Start the VPP service on the specified node.
446 | | ...
447 | | ... | *Arguments:*
448 | | ... | - node - information about a DUT node. Type: dictionary
449 | | ...
450 | | ... | *Example:*
451 | | ...
452 | | ... | \| Start VPP Service on DUT \| ${nodes['DUT1']} \|
453 | | ...
454 | | [Arguments] | ${node}
455 | | Start VPP Service | ${node}