1 # Copyright (c) 2018 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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
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
33 | Configure all DUTs before test
34 | | [Documentation] | Setup all DUTs in topology before test execution.
36 | | Setup All DUTs | ${nodes}
38 | Configure all TGs for traffic script
39 | | [Documentation] | Prepare all TGs before traffic scripts execution.
41 | | All TGs Set Interface Default Driver | ${nodes}
43 | Show Vpp Errors On All DUTs
44 | | [Documentation] | Show VPP errors verbose on all DUTs.
46 | | ${duts}= | Get Matches | ${nodes} | DUT*
47 | | :FOR | ${dut} | IN | @{duts}
48 | | | Vpp Show Errors | ${nodes['${dut}']}
50 | Show VPP trace dump on all DUTs
51 | | [Documentation] | Save API trace and dump output on all DUTs.
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}']}
58 | Show Bridge Domain Data On All DUTs
59 | | [Documentation] | Show Bridge Domain data on all DUTs.
61 | | ${duts}= | Get Matches | ${nodes} | DUT*
62 | | :FOR | ${dut} | IN | @{duts}
63 | | | Vpp Get Bridge Domain Data | ${nodes['${dut}']}
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.
69 | | ${duts}= | Get Matches | ${nodes} | DUT*
70 | | :FOR | ${dut} | IN | @{duts}
71 | | | Set VPP Scheduling rr | ${nodes['${dut}']}
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.
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}
85 | | ... | \| Configure crypto device on all DUTs \| ${True} \|
87 | | [Arguments] | ${force_init}=${False} | ${numvfs}=${32}
89 | | ${duts}= | Get Matches | ${nodes} | DUT*
90 | | :FOR | ${dut} | IN | @{duts}
91 | | | Crypto Device Verify | ${nodes['${dut}']} | force_init=${force_init}
92 | | | ... | numvfs=${numvfs}
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.
98 | | ... | *Arguments:*
99 | | ... | - module - Module to verify. Type: string
100 | | ... | - force_load - Try to load module. Type: boolean
104 | | ... | \| Configure kernel module on all DUTs \| ${True} \|
106 | | [Arguments] | ${module} | ${force_load}=${False}
108 | | ${duts}= | Get Matches | ${nodes} | DUT*
109 | | :FOR | ${dut} | IN | @{duts}
110 | | | Kernel Module Verify | ${nodes['${dut}']} | ${module}
111 | | | ... | force_load=${force_load}
113 | Create base startup configuration of VPP on all DUTs
114 | | [Documentation] | Create base startup configuration of VPP to all DUTs.
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
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.
143 | | ... | *Arguments:*
144 | | ... | - phy_cores - Number of physical cores to use. Type: integer
145 | | ... | - rx_queues - Number of RX queues. Type: integer
149 | | ... | \| Add worker threads and rxqueues to all DUTs \| ${1} \| ${1} \|
151 | | [Arguments] | ${phy_cores} | ${rx_queues}=${None}
153 | | ${cpu_count_int} | Convert to Integer | ${phy_cores}
154 | | ${thr_count_int} | Convert to Integer | ${phy_cores}
155 | | ${num_mbufs_int} | Convert to Integer | 16384
156 | | ${duts}= | Get Matches | ${nodes} | DUT*
157 | | :FOR | ${dut} | IN | @{duts}
158 | | | ${numa}= | Get interfaces numa node | ${nodes['${dut}']}
159 | | | ... | ${${dut}_if1} | ${${dut}_if2}
160 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
161 | | | ${cpu_main}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
162 | | | ... | skip_cnt=${1} | cpu_cnt=${1}
163 | | | ${cpu_wt}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
164 | | | ... | skip_cnt=${2} | cpu_cnt=${cpu_count_int} | smt_used=${smt_used}
165 | | | ${thr_count_int}= | Run keyword if | ${smt_used}
166 | | | ... | Evaluate | int(${cpu_count_int}*2)
167 | | | ... | ELSE | Set variable | ${thr_count_int}
168 | | | ${rxq_count_int}= | Run keyword if | ${rx_queues}
169 | | | ... | Set variable | ${rx_queues}
170 | | | ... | ELSE | Evaluate | int(${thr_count_int}/2)
171 | | | ${rxq_count_int}= | Run keyword if | ${rxq_count_int} == 0
172 | | | ... | Set variable | ${1}
173 | | | ... | ELSE | Set variable | ${rxq_count_int}
174 | | | ${num_mbufs_int}= | Evaluate | int(${num_mbufs_int}*${rxq_count_int})
175 | | | Run keyword | ${dut}.Add CPU Main Core | ${cpu_main}
176 | | | Run keyword | ${dut}.Add CPU Corelist Workers | ${cpu_wt}
177 | | | Run keyword | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
178 | | | Run keyword | ${dut}.Add DPDK Num Mbufs | ${num_mbufs_int}
179 | | | Run keyword if | ${thr_count_int} > 1
180 | | | ... | Set Tags | MTHREAD | ELSE | Set Tags | STHREAD
181 | | | Set Tags | ${thr_count_int}T${cpu_count_int}C
182 | | Set Test Variable | ${smt_used}
183 | | Set Test Variable | ${thr_count_int}
184 | | Set Test Variable | ${rxq_count_int}
186 | Add no multi seg to all DUTs
187 | | [Documentation] | Add No Multi Seg to VPP startup configuration to all DUTs.
189 | | ${duts}= | Get Matches | ${nodes} | DUT*
190 | | :FOR | ${dut} | IN | @{duts}
191 | | | Run keyword | ${dut}.Add DPDK No Multi Seg
193 | Add DPDK dev default RXD to all DUTs
194 | | [Documentation] | Add DPDK num-rx-desc to VPP startup configuration to all
197 | | ... | *Arguments:*
198 | | ... | - rxd - Number of RX descriptors. Type: string
202 | | ... | \| Add DPDK dev default RXD to all DUTs \| ${rxd} \|
204 | | [Arguments] | ${rxd}
206 | | ${duts}= | Get Matches | ${nodes} | DUT*
207 | | :FOR | ${dut} | IN | @{duts}
208 | | | Run keyword | ${dut}.Add DPDK Dev Default RXD | ${rxd}
210 | Add DPDK dev default TXD to all DUTs
211 | | [Documentation] | Add DPDK num-tx-desc to VPP startup configuration to all
214 | | ... | *Arguments:*
215 | | ... | - txd - Number of TX descriptors. Type: string
219 | | ... | \| Add DPDK dev default TXD to all DUTs \| ${txd} \|
221 | | [Arguments] | ${txd}
223 | | ${duts}= | Get Matches | ${nodes} | DUT*
224 | | :FOR | ${dut} | IN | @{duts}
225 | | | Run keyword | ${dut}.Add DPDK Dev Default TXD | ${txd}
227 | Add DPDK Uio Driver on all DUTs
228 | | [Documentation] | Add DPDK uio driver to VPP startup configuration on all
231 | | ... | *Arguments:*
232 | | ... | - uio_driver - Required uio driver. Type: string
236 | | ... | \| Add DPDK Uio Driver on all DUTs \| igb_uio \|
238 | | [Arguments] | ${uio_driver}
240 | | ${duts}= | Get Matches | ${nodes} | DUT*
241 | | :FOR | ${dut} | IN | @{duts}
242 | | | Run keyword | ${dut}.Add DPDK Uio Driver | ${uio_driver}
244 | Add NAT to all DUTs
245 | | [Documentation] | Add NAT configuration to all DUTs.
247 | | ${duts}= | Get Matches | ${nodes} | DUT*
248 | | :FOR | ${dut} | IN | @{duts}
249 | | | Run keyword | ${dut}.Add NAT
251 | Add cryptodev to all DUTs
252 | | [Documentation] | Add Cryptodev to VPP startup configuration to all DUTs.
254 | | ... | *Arguments:*
255 | | ... | - count - Number of QAT devices. Type: integer
259 | | ... | \| Add cryptodev to all DUTs \| ${4} \|
261 | | [Arguments] | ${count}
262 | | ${duts}= | Get Matches | ${nodes} | DUT*
263 | | :FOR | ${dut} | IN | @{duts}
264 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
265 | | | ${thr_count_int}= | Run keyword if | ${smt_used}
266 | | | ... | Evaluate | int(${count}*2)
267 | | | ... | ELSE | Set variable | ${count}
268 | | | Run keyword | ${dut}.Add DPDK Cryptodev | ${thr_count_int}
270 | Add DPDK SW cryptodev on DUTs in 3-node single-link circular topology
271 | | [Documentation] | Add required number of SW crypto devices of given type
272 | | ... | to VPP startup configuration on all DUTs in 3-node single-link
273 | | ... | circular topology.
275 | | ... | *Arguments:*
276 | | ... | - sw_pmd_type - PMD type of SW crypto device. Type: string
277 | | ... | - count - Number of SW crypto devices. Type: string
281 | | ... | \| Add DPDK SW cryptodev on DUTs in 3-node single-link circular\
282 | | ... | topology \| aesni-mb \| ${2} \|
284 | | [Arguments] | ${sw_pmd_type} | ${count}
285 | | ${smt_used}= | Is SMT enabled | ${nodes['DUT1']['cpuinfo']}
286 | | ${thr_count_int}= | Run keyword if | ${smt_used}
287 | | ... | Evaluate | int(${count}*2)
288 | | ... | ELSE | Set variable | ${count}
289 | | ${socket_id}= | Get Interface Numa Node | ${nodes['DUT1']} | ${dut1_if2}
290 | | Run keyword | DUT1.Add DPDK SW Cryptodev | ${sw_pmd_type} | ${socket_id}
291 | | ... | ${thr_count_int}
292 | | ${smt_used}= | Is SMT enabled | ${nodes['DUT2']['cpuinfo']}
293 | | ${thr_count_int}= | Run keyword if | ${smt_used}
294 | | ... | Evaluate | int(${count}*2)
295 | | ... | ELSE | Set variable | ${count}
296 | | ${socket_id}= | Get Interface Numa Node | ${nodes['DUT2']} | ${dut2_if1}
297 | | Run keyword | DUT2.Add DPDK SW Cryptodev | ${sw_pmd_type} | ${socket_id}
298 | | ... | ${thr_count_int}
300 | Apply startup configuration on all VPP DUTs
301 | | [Documentation] | Write startup configuration and restart VPP on all DUTs.
303 | | ... | *Arguments:*
304 | | ... | - restart_vpp - Whether to restart VPP (Optional). Type: boolean
308 | | ... | \| Apply startup configuration on all VPP DUTs \| ${False} \|
310 | | [Arguments] | ${restart_vpp}=${True}
312 | | ${duts}= | Get Matches | ${nodes} | DUT*
313 | | :FOR | ${dut} | IN | @{duts}
314 | | | Run keyword | ${dut}.Apply Config | restart_vpp=${restart_vpp}
315 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${True}
318 | | [Documentation] | Get PIDs of VPP processes from all DUTs in topology and\
319 | | ... | set it as a test variable. The PIDs are stored as dictionary items\
320 | | ... | where the key is the host and the value is the PID.
322 | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes}
323 | | ${keys}= | Get Dictionary Keys | ${setup_vpp_pids}
324 | | :FOR | ${key} | IN | @{keys}
325 | | | ${pid}= | Get From Dictionary | ${setup_vpp_pids} | ${key}
326 | | | Run Keyword If | $pid is None | FAIL | No VPP PID found on node ${key}
327 | | | Run Keyword If | ',' in '${pid}'
328 | | | ... | FAIL | More then one VPP PID found on node ${key}: ${pid}
329 | | Set Test Variable | ${setup_vpp_pids}
331 | Verify VPP PID in Teardown
332 | | [Documentation] | Check if the VPP PIDs on all DUTs are the same at the end\
333 | | ... | of test as they were at the begining. If they are not, only a message\
334 | | ... | is printed on console and to log. The test will not fail.
336 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
337 | | ${err_msg}= | Catenate | ${SUITE NAME} - ${TEST NAME}
338 | | ... | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
339 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
340 | | ${rc} | ${msg}= | Run keyword and ignore error
341 | | ... | Dictionaries Should Be Equal
342 | | ... | ${setup_vpp_pids} | ${teardown_vpp_pids}
343 | | Run Keyword And Return If | '${rc}'=='FAIL' | Log | ${err_msg}
344 | | ... | console=yes | level=WARN
346 | Set up functional test
347 | | [Documentation] | Common test setup for functional tests.
349 | | Configure all DUTs before test
351 | | Configure all TGs for traffic script
352 | | Update All Interface Data On All Nodes | ${nodes}
353 | | Reset VAT History On All DUTs | ${nodes}
355 | Tear down functional test
356 | | [Documentation] | Common test teardown for functional tests.
358 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
359 | | Show Packet Trace on All DUTs | ${nodes}
360 | | Show VAT History On All DUTs | ${nodes}
361 | | Vpp Show Errors On All DUTs | ${nodes}
362 | | Verify VPP PID in Teardown
364 | Tear down LISP functional test
365 | | [Documentation] | Common test teardown for functional tests with LISP.
367 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
368 | | Show Packet Trace on All DUTs | ${nodes}
369 | | Show VAT History On All DUTs | ${nodes}
370 | | Show Vpp Settings | ${nodes['DUT1']}
371 | | Show Vpp Settings | ${nodes['DUT2']}
372 | | Vpp Show Errors On All DUTs | ${nodes}
373 | | Verify VPP PID in Teardown
375 | Tear down LISP functional test with QEMU
376 | | [Documentation] | Common test teardown for functional tests with LISP and\
379 | | ... | *Arguments:*
380 | | ... | - vm_node - VM to stop. Type: string
384 | | ... | \| Tear down LISP functional test with QEMU \| ${vm_node} \|
386 | | [Arguments] | ${vm_node}
388 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
389 | | Show Packet Trace on All DUTs | ${nodes}
390 | | Show VAT History On All DUTs | ${nodes}
391 | | Show Vpp Settings | ${nodes['DUT1']}
392 | | Show Vpp Settings | ${nodes['DUT2']}
393 | | Vpp Show Errors On All DUTs | ${nodes}
394 | | Stop and clear QEMU | ${nodes['DUT1']} | ${vm_node}
395 | | Verify VPP PID in Teardown
397 | Set up TAP functional test
398 | | [Documentation] | Common test setup for functional tests with TAP.
400 | | Set up functional test
401 | | Clean Up Namespaces | ${nodes['DUT1']}
403 | Tear down TAP functional test
404 | | [Documentation] | Common test teardown for functional tests with TAP.
406 | | Tear down functional test
407 | | Clean Up Namespaces | ${nodes['DUT1']}
409 | Tear down TAP functional test with Linux bridge
410 | | [Documentation] | Common test teardown for functional tests with TAP and
411 | | ... | a Linux bridge.
413 | | ... | *Arguments:*
414 | | ... | - bid_TAP - Bridge name. Type: string
418 | | ... | \| Tear down TAP functional test with Linux bridge \| ${bid_TAP} \|
420 | | [Arguments] | ${bid_TAP}
422 | | Tear down functional test
423 | | Linux Del Bridge | ${nodes['DUT1']} | ${bid_TAP}
424 | | Clean Up Namespaces | ${nodes['DUT1']}
426 | Tear down FDS functional test
427 | | [Documentation] | Common test teardown for FDS functional tests.
429 | | ... | *Arguments:*
430 | | ... | - dut1_node - Node Nr.1 where to clean qemu. Type: dictionary
431 | | ... | - qemu_node1 - VM Nr.1 node info dictionary. Type: string
432 | | ... | - dut2_node - Node Nr.2 where to clean qemu. Type: dictionary
433 | | ... | - qemu_node2 - VM Nr.2 node info dictionary. Type: string
437 | | ... | \| Tear down FDS functional test \| ${dut1_node} \| ${qemu_node1}\
438 | | ... | \| ${dut2_node} \| ${qemu_node2} \|
440 | | [Arguments] | ${dut1_node} | ${qemu_node1} | ${dut2_node}
441 | | ... | ${qemu_node2}
443 | | Tear down functional test
444 | | Tear down QEMU | ${dut1_node} | ${qemu_node1} | qemu_node1
445 | | Tear down QEMU | ${dut2_node} | ${qemu_node2} | qemu_node2
447 | Stop VPP Service on DUT
448 | | [Documentation] | Stop the VPP service on the specified node.
450 | | ... | *Arguments:*
451 | | ... | - node - information about a DUT node. Type: dictionary
455 | | ... | \| Stop VPP Service on DUT \| ${nodes['DUT1']} \|
457 | | [Arguments] | ${node}
458 | | Stop VPP Service | ${node}
460 | Start VPP Service on DUT
461 | | [Documentation] | Start the VPP service on the specified node.
463 | | ... | *Arguments:*
464 | | ... | - node - information about a DUT node. Type: dictionary
468 | | ... | \| Start VPP Service on DUT \| ${nodes['DUT1']} \|
470 | | [Arguments] | ${node}
471 | | Start VPP Service | ${node}