CSIT-748 vnf-agent integration
[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 IP6 Hash Buckets | "2000000"
123 | | | Run keyword | ${dut}.Add IP6 Heap Size | "3G"
124
125 | Add '${m}' worker threads and '${n}' rxqueues in 3-node single-link circular topology
126 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
127 | | ... | configuration on all DUTs in 3-node single-link topology.
128 | | ...
129 | | ${m_int}= | Convert To Integer | ${m}
130 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
131 | | ... | ${dut1_if1} | ${dut1_if2}
132 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
133 | | ... | ${dut2_if1} | ${dut2_if2}
134 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
135 | | ... | skip_cnt=${1} | cpu_cnt=${1}
136 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
137 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
138 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
139 | | ... | skip_cnt=${1} | cpu_cnt=${1}
140 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
141 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
142 | | Run keyword | DUT1.Add CPU Main Core | ${dut1_cpu_main}
143 | | Run keyword | DUT2.Add CPU Main Core | ${dut2_cpu_main}
144 | | Run keyword | DUT1.Add CPU Corelist Workers | ${dut1_cpu_w}
145 | | Run keyword | DUT2.Add CPU Corelist Workers | ${dut2_cpu_w}
146 | | Run keyword | DUT1.Add DPDK Dev Default RXQ | ${n}
147 | | Run keyword | DUT2.Add DPDK Dev Default RXQ | ${n}
148
149 | Add '${m}' worker threads and '${n}' rxqueues in 2-node single-link circular topology
150 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
151 | | ... | configuration on all DUTs in 2-node single-link topology.
152 | | ...
153 | | ${m_int}= | Convert To Integer | ${m}
154 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
155 | | ... | ${dut1_if1} | ${dut1_if2}
156 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
157 | | ... | skip_cnt=${1} | cpu_cnt=${1}
158 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
159 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
160 | | Run keyword | DUT1.Add CPU Main Core | ${dut1_cpu_main}
161 | | Run keyword | DUT1.Add CPU Corelist Workers | ${dut1_cpu_w}
162 | | Run keyword | DUT1.Add DPDK Dev Default RXQ | ${n}
163
164 | Add '${m}' worker threads using SMT and '${n}' rxqueues in 3-node single-link circular topology
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 | | Run keyword | DUT1.Add CPU Main Core | ${dut1_cpu_main}
182 | | Run keyword | DUT2.Add CPU Main Core | ${dut2_cpu_main}
183 | | Run keyword | DUT1.Add CPU Corelist Workers | ${dut1_cpu_w}
184 | | Run keyword | DUT2.Add CPU Corelist Workers | ${dut2_cpu_w}
185 | | Run keyword | DUT1.Add DPDK Dev Default RXQ | ${n}
186 | | Run keyword | DUT2.Add DPDK Dev Default RXQ | ${n}
187
188 | Add '${m}' worker threads using SMT and '${n}' rxqueues in 2-node single-link circular topology
189 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
190 | | ... | configuration on all DUTs in 2-node single-link topology.
191 | | ...
192 | | ${m_int}= | Convert To Integer | ${m}
193 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
194 | | ... | ${dut1_if1} | ${dut1_if2}
195 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
196 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
197 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
198 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
199 | | Run keyword | DUT1.Add CPU Main Core | ${dut1_cpu_main}
200 | | Run keyword | DUT1.Add CPU Corelist Workers | ${dut1_cpu_w}
201 | | Run keyword | DUT1.Add DPDK Dev Default RXQ | ${n}
202
203 | Add no multi seg to all DUTs
204 | | [Documentation] | Add No Multi Seg to VPP startup configuration to all DUTs.
205 | | ...
206 | | ${duts}= | Get Matches | ${nodes} | DUT*
207 | | :FOR | ${dut} | IN | @{duts}
208 | | | Run keyword | ${dut}.Add DPDK No Multi Seg
209
210 | Add DPDK dev default RXD to all DUTs
211 | | [Documentation] | Add DPDK num-rx-desc to VPP startup configuration to all
212 | | ... | DUTs.
213 | | ...
214 | | ... | *Arguments:*
215 | | ... | - rxd - Number of RX descriptors. Type: string
216 | | ...
217 | | ... | *Example:*
218 | | ...
219 | | ... | \| Add DPDK dev default RXD to all DUTs \| ${rxd} \|
220 | | ...
221 | | [Arguments] | ${rxd}
222 | | ...
223 | | ${duts}= | Get Matches | ${nodes} | DUT*
224 | | :FOR | ${dut} | IN | @{duts}
225 | | | Run keyword | ${dut}.Add DPDK Dev Default RXD | ${rxd}
226
227 | Add DPDK dev default TXD to all DUTs
228 | | [Documentation] | Add DPDK num-tx-desc to VPP startup configuration to all
229 | | ... | DUTs.
230 | | ...
231 | | ... | *Arguments:*
232 | | ... | - txd - Number of TX descriptors. Type: string
233 | | ...
234 | | ... | *Example:*
235 | | ...
236 | | ... | \| Add DPDK dev default TXD to all DUTs \| ${txd} \|
237 | | ...
238 | | [Arguments] | ${txd}
239 | | ...
240 | | ${duts}= | Get Matches | ${nodes} | DUT*
241 | | :FOR | ${dut} | IN | @{duts}
242 | | | Run keyword | ${dut}.Add DPDK Dev Default TXD | ${txd}
243
244 | Add NAT to all DUTs
245 | | [Documentation] | Add NAT configuration to all DUTs.
246 | | ...
247 | | ${duts}= | Get Matches | ${nodes} | DUT*
248 | | :FOR | ${dut} | IN | @{duts}
249 | | | Run keyword | ${dut}.Add NAT
250
251 | Add cryptodev to all DUTs
252 | | [Documentation] | Add Cryptodev to VPP startup configuration to all DUTs.
253 | | ...
254 | | ... | *Arguments:*
255 | | ... | - ${count} - Number of QAT devices. Type: integer
256 | | ...
257 | | ... | *Example:*
258 | | ...
259 | | ... | \| Add cryptodev to all DUTs \| ${4} \|
260 | | ...
261 | | [Arguments] | ${count}
262 | | ${duts}= | Get Matches | ${nodes} | DUT*
263 | | :FOR | ${dut} | IN | @{duts}
264 | | | Run keyword | ${dut}.Add DPDK Cryptodev | ${count}
265
266 | Apply startup configuration on all VPP DUTs
267 | | [Documentation] | Write startup configuration and restart VPP on all DUTs.
268 | | ...
269 | | ${duts}= | Get Matches | ${nodes} | DUT*
270 | | :FOR | ${dut} | IN | @{duts}
271 | | | Run keyword | ${dut}.Apply Config
272 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${TRUE}
273
274 | Save VPP PIDs
275 | | [Documentation] | Get PIDs of VPP processes from all DUTs in topology and\
276 | | ... | set it as a test variable. The PIDs are stored as dictionary items\
277 | | ... | where the key is the host and the value is the PID.
278 | | ...
279 | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes}
280 | | ${keys}= | Get Dictionary Keys | ${setup_vpp_pids}
281 | | :FOR | ${key} | IN | @{keys}
282 | | | ${pid}= | Get From Dictionary | ${setup_vpp_pids} | ${key}
283 | | | Run Keyword If | $pid is None | FAIL | No VPP PID found on node ${key}
284 | | | Run Keyword If | ',' in '${pid}'
285 | | | ... | FAIL | More then one VPP PID found on node ${key}: ${pid}
286 | | Set Test Variable | ${setup_vpp_pids}
287
288 | Verify VPP PID in Teardown
289 | | [Documentation] | Check if the VPP PIDs on all DUTs are the same at the end\
290 | | ... | of test as they were at the begining. If they are not, only a message\
291 | | ... | is printed on console and to log. The test will not fail.
292 | | ...
293 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
294 | | ${err_msg}= | Catenate | ${SUITE NAME} - ${TEST NAME}
295 | | ... | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
296 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
297 | | ${rc} | ${msg}= | Run keyword and ignore error
298 | | ... | Dictionaries Should Be Equal
299 | | ... | ${setup_vpp_pids} | ${teardown_vpp_pids}
300 | | Run Keyword And Return If | '${rc}'=='FAIL' | Log | ${err_msg}
301 | | ... | console=yes | level=WARN
302
303 | Set up functional test
304 | | [Documentation] | Common test setup for functional tests.
305 | | ...
306 | | Configure all DUTs before test
307 | | Save VPP PIDs
308 | | Configure all TGs for traffic script
309 | | Update All Interface Data On All Nodes | ${nodes}
310 | | Reset VAT History On All DUTs | ${nodes}
311
312 | Tear down functional test
313 | | [Documentation] | Common test teardown for functional tests.
314 | | ...
315 | | Show Packet Trace on All DUTs | ${nodes}
316 | | Show VAT History On All DUTs | ${nodes}
317 | | Vpp Show Errors On All DUTs | ${nodes}
318 | | Verify VPP PID in Teardown
319
320 | Tear down LISP functional test
321 | | [Documentation] | Common test teardown for functional tests with LISP.
322 | | ...
323 | | Show Packet Trace on All DUTs | ${nodes}
324 | | Show VAT History On All DUTs | ${nodes}
325 | | Show Vpp Settings | ${nodes['DUT1']}
326 | | Show Vpp Settings | ${nodes['DUT2']}
327 | | Vpp Show Errors On All DUTs | ${nodes}
328 | | Verify VPP PID in Teardown
329
330 | Tear down LISP functional test with QEMU
331 | | [Documentation] | Common test teardown for functional tests with LISP and\
332 | | ... | QEMU.
333 | | ...
334 | | ... | *Arguments:*
335 | | ... | - vm_node - VM to stop. Type: string
336 | | ...
337 | | ... | *Example:*
338 | | ...
339 | | ... | \| Tear down LISP functional test with QEMU \| ${vm_node} \|
340 | | ...
341 | | [Arguments] | ${vm_node}
342 | | ...
343 | | Show Packet Trace on All DUTs | ${nodes}
344 | | Show VAT History On All DUTs | ${nodes}
345 | | Show Vpp Settings | ${nodes['DUT1']}
346 | | Show Vpp Settings | ${nodes['DUT2']}
347 | | Vpp Show Errors On All DUTs | ${nodes}
348 | | Stop and clear QEMU | ${nodes['DUT1']} | ${vm_node}
349 | | Verify VPP PID in Teardown
350
351 | Set up TAP functional test
352 | | [Documentation] | Common test setup for functional tests with TAP.
353 | | ...
354 | | Set up functional test
355 | | Clean Up Namespaces | ${nodes['DUT1']}
356
357 | Tear down TAP functional test
358 | | [Documentation] | Common test teardown for functional tests with TAP.
359 | | ...
360 | | Tear down functional test
361 | | Clean Up Namespaces | ${nodes['DUT1']}
362
363 | Tear down TAP functional test with Linux bridge
364 | | [Documentation] | Common test teardown for functional tests with TAP and
365 | | ... | a Linux bridge.
366 | | ...
367 | | ... | *Arguments:*
368 | | ... | - bid_TAP - Bridge name. Type: string
369 | | ...
370 | | ... | *Example:*
371 | | ...
372 | | ... | \| Tear down TAP functional test with Linux bridge \| ${bid_TAP} \|
373 | | ...
374 | | [Arguments] | ${bid_TAP}
375 | | ...
376 | | Tear down functional test
377 | | Linux Del Bridge | ${nodes['DUT1']} | ${bid_TAP}
378 | | Clean Up Namespaces | ${nodes['DUT1']}
379
380 | Stop VPP Service on DUT
381 | | [Documentation] | Stop the VPP service on the specified node.
382 | | ...
383 | | ... | *Arguments:*
384 | | ... | - node - information about a DUT node. Type: dictionary
385 | | ...
386 | | ... | *Example:*
387 | | ...
388 | | ... | \| Stop VPP Service on DUT \| ${nodes['DUT1']} \|
389 | | ...
390 | | [Arguments] | ${node}
391 | | Stop VPP Service | ${node}
392
393 | Start VPP Service on DUT
394 | | [Documentation] | Start the VPP service on the specified node.
395 | | ...
396 | | ... | *Arguments:*
397 | | ... | - node - information about a DUT node. Type: dictionary
398 | | ...
399 | | ... | *Example:*
400 | | ...
401 | | ... | \| Start VPP Service on DUT \| ${nodes['DUT1']} \|
402 | | ...
403 | | [Arguments] | ${node}
404 | | Start VPP Service | ${node}