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