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