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