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:
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.VppConfigGenerator
28 | Library | resources.libraries.python.VppCounters
29 | Library | resources.libraries.python.VPPUtil
30 | Library | resources.libraries.python.Trace
31 | Library | Collections
34 | Configure all DUTs before test
35 | | [Documentation] | Setup all DUTs in topology before test execution.
37 | | Setup All DUTs | ${nodes}
39 | Configure all TGs for traffic script
40 | | [Documentation] | Prepare all TGs before traffic scripts execution.
42 | | All TGs Set Interface Default Driver | ${nodes}
44 | Show Vpp Errors On All DUTs
45 | | [Documentation] | Show VPP errors verbose on all DUTs.
47 | | ${duts}= | Get Matches | ${nodes} | DUT*
48 | | :FOR | ${dut} | IN | @{duts}
49 | | | Vpp Show Errors | ${nodes['${dut}']}
51 | Show VPP trace dump on all DUTs
52 | | [Documentation] | Save API trace and dump output on all DUTs.
54 | | ${duts}= | Get Matches | ${nodes} | DUT*
55 | | :FOR | ${dut} | IN | @{duts}
56 | | | Vpp api trace save | ${nodes['${dut}']}
57 | | | Vpp api trace dump | ${nodes['${dut}']}
59 | Show Bridge Domain Data On All DUTs
60 | | [Documentation] | Show Bridge Domain data on all DUTs.
62 | | ${duts}= | Get Matches | ${nodes} | DUT*
63 | | :FOR | ${dut} | IN | @{duts}
64 | | | Vpp Get Bridge Domain Data | ${nodes['${dut}']}
66 | Setup Scheduler Policy for Vpp On All DUTs
67 | | [Documentation] | Set realtime scheduling policy (SCHED_RR) with priority 1
68 | | ... | on all VPP worker threads on all DUTs.
70 | | ${duts}= | Get Matches | ${nodes} | DUT*
71 | | :FOR | ${dut} | IN | @{duts}
72 | | | Set VPP Scheduling rr | ${nodes['${dut}']}
74 | Configure crypto device on all DUTs
75 | | [Documentation] | Verify if Crypto QAT device virtual functions are
76 | | ... | initialized on all DUTs. If parameter force_init is set to True, then
77 | | ... | try to initialize.
79 | | ... | *Arguments:*
80 | | ... | - ${force_init} - Try to initialize. Type: boolean
84 | | ... | \| Configure crypto device on all DUTs \| ${True} \|
86 | | [Arguments] | ${force_init}=${False}
88 | | ${duts}= | Get Matches | ${nodes} | DUT*
89 | | :FOR | ${dut} | IN | @{duts}
90 | | | Crypto Device Verify | ${nodes['${dut}']} | force_init=${force_init}
92 | Configure kernel module on all DUTs
93 | | [Documentation] | Verify if specific kernel module is loaded on all DUTs.
94 | | ... | If parameter force_load is set to True, then try to initialize.
96 | | ... | *Arguments:*
97 | | ... | - ${module} - Module to verify. Type: string
98 | | ... | - ${force_load} - Try to load module. Type: boolean
102 | | ... | \| Configure kernel module on all DUTs \| ${True} \|
104 | | [Arguments] | ${module} | ${force_load}=${False}
106 | | ${duts}= | Get Matches | ${nodes} | DUT*
107 | | :FOR | ${dut} | IN | @{duts}
108 | | | Kernel Module Verify | ${nodes['${dut}']} | ${module}
109 | | | ... | force_load=${force_load}
111 | Create base startup configuration of VPP on all DUTs
112 | | [Documentation] | Create base startup configuration of VPP to all DUTs.
114 | | ${duts}= | Get Matches | ${nodes} | DUT*
115 | | :FOR | ${dut} | IN | @{duts}
116 | | | Import Library | resources.libraries.python.VppConfigGenerator
117 | | | ... | WITH NAME | ${dut}
118 | | | Run keyword | ${dut}.Set Node | ${nodes['${dut}']}
119 | | | Run keyword | ${dut}.Add Unix Log
120 | | | Run keyword | ${dut}.Add Unix CLI Listen
121 | | | Run keyword | ${dut}.Add Unix Nodaemon
122 | | | Run keyword | ${dut}.Add DPDK Socketmem | "1024,1024"
123 | | | Run keyword | ${dut}.Add Heapsize | "3G"
124 | | | Run keyword | ${dut}.Add IP6 Hash Buckets | "2000000"
125 | | | Run keyword | ${dut}.Add IP6 Heap Size | "3G"
127 | Add '${m}' worker threads and '${n}' rxqueues in 3-node single-link circular topology
128 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
129 | | ... | configuration on all DUTs in 3-node single-link topology.
131 | | ${m_int}= | Convert To Integer | ${m}
132 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
133 | | ... | ${dut1_if1} | ${dut1_if2}
134 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
135 | | ... | ${dut2_if1} | ${dut2_if2}
136 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
137 | | ... | skip_cnt=${1} | cpu_cnt=${1}
138 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
139 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
140 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
141 | | ... | skip_cnt=${1} | cpu_cnt=${1}
142 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
143 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
144 | | Run keyword | DUT1.Add CPU Main Core | ${dut1_cpu_main}
145 | | Run keyword | DUT2.Add CPU Main Core | ${dut2_cpu_main}
146 | | Run keyword | DUT1.Add CPU Corelist Workers | ${dut1_cpu_w}
147 | | Run keyword | DUT2.Add CPU Corelist Workers | ${dut2_cpu_w}
148 | | Run keyword | DUT1.Add DPDK Dev Default RXQ | ${n}
149 | | Run keyword | DUT2.Add DPDK Dev Default RXQ | ${n}
151 | Add '${m}' worker threads and '${n}' rxqueues in 2-node single-link circular topology
152 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
153 | | ... | configuration on all DUTs in 2-node single-link topology.
155 | | ${m_int}= | Convert To Integer | ${m}
156 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
157 | | ... | ${dut1_if1} | ${dut1_if2}
158 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
159 | | ... | skip_cnt=${1} | cpu_cnt=${1}
160 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
161 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
162 | | Run keyword | DUT1.Add CPU Main Core | ${dut1_cpu_main}
163 | | Run keyword | DUT1.Add CPU Corelist Workers | ${dut1_cpu_w}
164 | | Run keyword | DUT1.Add DPDK Dev Default RXQ | ${n}
166 | Add '${m}' worker threads using SMT and '${n}' rxqueues in 3-node single-link circular topology
167 | | [Documentation] | Setup M worker threads using SMT and N rxqueues in vpp\
168 | | ... | startup configuration on all DUTs in 3-node single-link topology.
170 | | ${m_int}= | Convert To Integer | ${m}
171 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
172 | | ... | ${dut1_if1} | ${dut1_if2}
173 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
174 | | ... | ${dut2_if1} | ${dut2_if2}
175 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
176 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
177 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
178 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
179 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
180 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
181 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
182 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
183 | | Run keyword | DUT1.Add CPU Main Core | ${dut1_cpu_main}
184 | | Run keyword | DUT2.Add CPU Main Core | ${dut2_cpu_main}
185 | | Run keyword | DUT1.Add CPU Corelist Workers | ${dut1_cpu_w}
186 | | Run keyword | DUT2.Add CPU Corelist Workers | ${dut2_cpu_w}
187 | | Run keyword | DUT1.Add DPDK Dev Default RXQ | ${n}
188 | | Run keyword | DUT2.Add DPDK Dev Default RXQ | ${n}
190 | Add '${m}' worker threads using SMT and '${n}' rxqueues in 2-node single-link circular topology
191 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
192 | | ... | configuration on all DUTs in 2-node single-link topology.
194 | | ${m_int}= | Convert To Integer | ${m}
195 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
196 | | ... | ${dut1_if1} | ${dut1_if2}
197 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
198 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
199 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
200 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
201 | | Run keyword | DUT1.Add CPU Main Core | ${dut1_cpu_main}
202 | | Run keyword | DUT1.Add CPU Corelist Workers | ${dut1_cpu_w}
203 | | Run keyword | DUT1.Add DPDK Dev Default RXQ | ${n}
205 | Add no multi seg to all DUTs
206 | | [Documentation] | Add No Multi Seg to VPP startup configuration to all DUTs.
208 | | ${duts}= | Get Matches | ${nodes} | DUT*
209 | | :FOR | ${dut} | IN | @{duts}
210 | | | Run keyword | ${dut}.Add DPDK No Multi Seg
212 | Add DPDK dev default RXD to all DUTs
213 | | [Documentation] | Add DPDK num-rx-desc to VPP startup configuration to all
216 | | ... | *Arguments:*
217 | | ... | - rxd - Number of RX descriptors. Type: string
221 | | ... | \| Add DPDK dev default RXD to all DUTs \| ${rxd} \|
223 | | [Arguments] | ${rxd}
225 | | ${duts}= | Get Matches | ${nodes} | DUT*
226 | | :FOR | ${dut} | IN | @{duts}
227 | | | Run keyword | ${dut}.Add DPDK Dev Default RXD | ${rxd}
229 | Add DPDK dev default TXD to all DUTs
230 | | [Documentation] | Add DPDK num-tx-desc to VPP startup configuration to all
233 | | ... | *Arguments:*
234 | | ... | - txd - Number of TX descriptors. Type: string
238 | | ... | \| Add DPDK dev default TXD to all DUTs \| ${txd} \|
240 | | [Arguments] | ${txd}
242 | | ${duts}= | Get Matches | ${nodes} | DUT*
243 | | :FOR | ${dut} | IN | @{duts}
244 | | | Run keyword | ${dut}.Add DPDK Dev Default TXD | ${txd}
246 | Add NAT to all DUTs
247 | | [Documentation] | Add NAT configuration to all DUTs.
249 | | ${duts}= | Get Matches | ${nodes} | DUT*
250 | | :FOR | ${dut} | IN | @{duts}
251 | | | Run keyword | ${dut}.Add NAT
253 | Add cryptodev to all DUTs
254 | | [Documentation] | Add Cryptodev to VPP startup configuration to all DUTs.
256 | | ... | *Arguments:*
257 | | ... | - ${count} - Number of QAT devices. Type: integer
261 | | ... | \| Add cryptodev to all DUTs \| ${4} \|
263 | | [Arguments] | ${count}
264 | | ${duts}= | Get Matches | ${nodes} | DUT*
265 | | :FOR | ${dut} | IN | @{duts}
266 | | | Run keyword | ${dut}.Add DPDK Cryptodev | ${count}
268 | Apply startup configuration on all VPP DUTs
269 | | [Documentation] | Write startup configuration and restart VPP on all DUTs.
271 | | ${duts}= | Get Matches | ${nodes} | DUT*
272 | | :FOR | ${dut} | IN | @{duts}
273 | | | Run keyword | ${dut}.Apply Config
274 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${TRUE}
277 | | [Documentation] | Get PIDs of VPP processes from all DUTs in topology and\
278 | | ... | set it as a test variable. The PIDs are stored as dictionary items\
279 | | ... | where the key is the host and the value is the PID.
281 | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes}
282 | | ${keys}= | Get Dictionary Keys | ${setup_vpp_pids}
283 | | :FOR | ${key} | IN | @{keys}
284 | | | ${pid}= | Get From Dictionary | ${setup_vpp_pids} | ${key}
285 | | | Run Keyword If | $pid is None | FAIL | No VPP PID found on node ${key}
286 | | | Run Keyword If | ',' in '${pid}'
287 | | | ... | FAIL | More then one VPP PID found on node ${key}: ${pid}
288 | | Set Test Variable | ${setup_vpp_pids}
290 | Verify VPP PID in Teardown
291 | | [Documentation] | Check if the VPP PIDs on all DUTs are the same at the end\
292 | | ... | of test as they were at the begining. If they are not, only a message\
293 | | ... | is printed on console and to log. The test will not fail.
295 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
296 | | ${err_msg}= | Catenate | ${SUITE NAME} - ${TEST NAME}
297 | | ... | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
298 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
299 | | ${rc} | ${msg}= | Run keyword and ignore error
300 | | ... | Dictionaries Should Be Equal
301 | | ... | ${setup_vpp_pids} | ${teardown_vpp_pids}
302 | | Run Keyword And Return If | '${rc}'=='FAIL' | Log | ${err_msg}
303 | | ... | console=yes | level=WARN
305 | Set up functional test
306 | | [Documentation] | Common test setup for functional tests.
308 | | Configure all DUTs before test
310 | | Configure all TGs for traffic script
311 | | Update All Interface Data On All Nodes | ${nodes}
312 | | Reset VAT History On All DUTs | ${nodes}
314 | Tear down functional test
315 | | [Documentation] | Common test teardown for functional tests.
317 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
318 | | Show Packet Trace on All DUTs | ${nodes}
319 | | Show VAT History On All DUTs | ${nodes}
320 | | Vpp Show Errors On All DUTs | ${nodes}
321 | | Verify VPP PID in Teardown
323 | Tear down LISP functional test
324 | | [Documentation] | Common test teardown for functional tests with LISP.
326 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
327 | | Show Packet Trace on All DUTs | ${nodes}
328 | | Show VAT History On All DUTs | ${nodes}
329 | | Show Vpp Settings | ${nodes['DUT1']}
330 | | Show Vpp Settings | ${nodes['DUT2']}
331 | | Vpp Show Errors On All DUTs | ${nodes}
332 | | Verify VPP PID in Teardown
334 | Tear down LISP functional test with QEMU
335 | | [Documentation] | Common test teardown for functional tests with LISP and\
338 | | ... | *Arguments:*
339 | | ... | - vm_node - VM to stop. Type: string
343 | | ... | \| Tear down LISP functional test with QEMU \| ${vm_node} \|
345 | | [Arguments] | ${vm_node}
347 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
348 | | Show Packet Trace on All DUTs | ${nodes}
349 | | Show VAT History On All DUTs | ${nodes}
350 | | Show Vpp Settings | ${nodes['DUT1']}
351 | | Show Vpp Settings | ${nodes['DUT2']}
352 | | Vpp Show Errors On All DUTs | ${nodes}
353 | | Stop and clear QEMU | ${nodes['DUT1']} | ${vm_node}
354 | | Verify VPP PID in Teardown
356 | Set up TAP functional test
357 | | [Documentation] | Common test setup for functional tests with TAP.
359 | | Set up functional test
360 | | Clean Up Namespaces | ${nodes['DUT1']}
362 | Tear down TAP functional test
363 | | [Documentation] | Common test teardown for functional tests with TAP.
365 | | Tear down functional test
366 | | Clean Up Namespaces | ${nodes['DUT1']}
368 | Tear down TAP functional test with Linux bridge
369 | | [Documentation] | Common test teardown for functional tests with TAP and
370 | | ... | a Linux bridge.
372 | | ... | *Arguments:*
373 | | ... | - bid_TAP - Bridge name. Type: string
377 | | ... | \| Tear down TAP functional test with Linux bridge \| ${bid_TAP} \|
379 | | [Arguments] | ${bid_TAP}
381 | | Tear down functional test
382 | | Linux Del Bridge | ${nodes['DUT1']} | ${bid_TAP}
383 | | Clean Up Namespaces | ${nodes['DUT1']}
385 | Tear down FDS functional test
386 | | [Documentation] | Common test teardown for FDS functional tests.
388 | | ... | *Arguments:*
389 | | ... | - dut1_node - Node Nr.1 where to clean qemu. Type: dictionary
390 | | ... | - qemu_node1 - VM Nr.1 node info dictionary. Type: string
391 | | ... | - dut2_node - Node Nr.2 where to clean qemu. Type: dictionary
392 | | ... | - qemu_node2 - VM Nr.2 node info dictionary. Type: string
396 | | ... | \| Tear down FDS functional test \| ${dut1_node} \| ${qemu_node1}\
397 | | ... | \| ${dut2_node} \| ${qemu_node2} \|
399 | | [Arguments] | ${dut1_node} | ${qemu_node1} | ${dut2_node}
400 | | ... | ${qemu_node2}
402 | | Tear down functional test
403 | | Tear down QEMU | ${dut1_node} | ${qemu_node1} | qemu_node1
404 | | Tear down QEMU | ${dut2_node} | ${qemu_node2} | qemu_node2
406 | Stop VPP Service on DUT
407 | | [Documentation] | Stop the VPP service on the specified node.
409 | | ... | *Arguments:*
410 | | ... | - node - information about a DUT node. Type: dictionary
414 | | ... | \| Stop VPP Service on DUT \| ${nodes['DUT1']} \|
416 | | [Arguments] | ${node}
417 | | Stop VPP Service | ${node}
419 | Start VPP Service on DUT
420 | | [Documentation] | Start the VPP service on the specified node.
422 | | ... | *Arguments:*
423 | | ... | - node - information about a DUT node. Type: dictionary
427 | | ... | \| Start VPP Service on DUT \| ${nodes['DUT1']} \|
429 | | [Arguments] | ${node}
430 | | Start VPP Service | ${node}