88d9d04cd0ac5fa78a233e2c4fd411ae2445d405
[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 | Setup all DUTs before test
30 | | [Documentation] | Setup all DUTs in topology before test execution.
31 | | ...
32 | | Setup All DUTs | ${nodes}
33
34 | Setup all TGs before 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 | Add '${m}' worker threads and rxqueues '${n}' in 3-node single-link topo
84 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
85 | | ... | configuration on all DUTs in 3-node single-link topology.
86 | | ...
87 | | ${m_int}= | Convert To Integer | ${m}
88 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
89 | | ... | ${dut1_if1} | ${dut1_if2}
90 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
91 | | ... | ${dut2_if1} | ${dut2_if2}
92 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
93 | | ... | skip_cnt=${1} | cpu_cnt=${1}
94 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
95 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
96 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
97 | | ... | skip_cnt=${1} | cpu_cnt=${1}
98 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
99 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
100 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
101 | | ... | corelist-workers | ${dut1_cpu_w}
102 | | ${dut2_cpu}= | Catenate | main-core | ${dut2_cpu_main}
103 | | ... | corelist-workers | ${dut2_cpu_w}
104 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
105 | | Add CPU config | ${dut1} | ${dut1_cpu}
106 | | Add CPU config | ${dut2} | ${dut2_cpu}
107 | | Add rxqueues config | ${dut1} | ${rxqueues}
108 | | Add rxqueues config | ${dut2} | ${rxqueues}
109
110 | Add '${m}' worker threads and rxqueues '${n}' in 2-node single-link topo
111 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
112 | | ... | configuration on all DUTs in 2-node single-link topology.
113 | | ...
114 | | ${m_int}= | Convert To Integer | ${m}
115 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
116 | | ... | ${dut1_if1} | ${dut1_if2}
117 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
118 | | ... | skip_cnt=${1} | cpu_cnt=${1}
119 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
120 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
121 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
122 | | ... | corelist-workers | ${dut1_cpu_w}
123 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
124 | | Add CPU config | ${dut1} | ${dut1_cpu}
125 | | Add rxqueues config | ${dut1} | ${rxqueues}
126
127 | Add '${m}' worker threads using SMT and rxqueues '${n}' in 3-node single-link topo
128 | | [Documentation] | Setup M worker threads using SMT and N rxqueues in vpp\
129 | | ... | startup configuration on all DUTs in 3-node single-link topology.
130 | | ...
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} | smt_used=${True}
138 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
139 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
140 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
141 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
142 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
143 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
144 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
145 | | ... | corelist-workers | ${dut1_cpu_w}
146 | | ${dut2_cpu}= | Catenate | main-core | ${dut2_cpu_main}
147 | | ... | corelist-workers | ${dut2_cpu_w}
148 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
149 | | Add CPU config | ${dut1} | ${dut1_cpu}
150 | | Add CPU config | ${dut2} | ${dut2_cpu}
151 | | Add rxqueues config | ${dut1} | ${rxqueues}
152 | | Add rxqueues config | ${dut2} | ${rxqueues}
153
154 | Add '${m}' worker threads using SMT and rxqueues '${n}' in 2-node single-link topo
155 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
156 | | ... | configuration on all DUTs in 2-node single-link topology.
157 | | ...
158 | | ${m_int}= | Convert To Integer | ${m}
159 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
160 | | ... | ${dut1_if1} | ${dut1_if2}
161 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
162 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
163 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
164 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
165 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
166 | | ... | corelist-workers | ${dut1_cpu_w}
167 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
168 | | Add CPU config | ${dut1} | ${dut1_cpu}
169 | | Add rxqueues config | ${dut1} | ${rxqueues}
170
171 | Add worker threads and rxqueues to all DUTs
172 | | [Documentation] | Setup worker threads and rxqueues in VPP startup\
173 | | ... | configuration to all DUTs.
174 | | ...
175 | | ... | *Arguments:*
176 | | ... | - ${cpu} - CPU configuration. Type: string
177 | | ... | - ${rxqueues} - rxqueues configuration. Type: string
178 | | ...
179 | | ... | *Example:*
180 | | ...
181 | | ... | \| Add worker threads and rxqueues to all DUTs \| main-core 0 \
182 | | ... | \| rxqueues 2 \|
183 | | ...
184 | | [Arguments] | ${cpu} | ${rxqueues}
185 | | ...
186 | | ${duts}= | Get Matches | ${nodes} | DUT*
187 | | :FOR | ${dut} | IN | @{duts}
188 | | | Add CPU config | ${nodes['${dut}']} | ${cpu}
189 | | | Add rxqueues config | ${nodes['${dut}']} | ${rxqueues}
190
191 | Add all PCI devices to all DUTs
192 | | [Documentation] | Add all available PCI devices from topology file to VPP\
193 | | ... | startup configuration to all DUTs.
194 | | ...
195 | | ${duts}= | Get Matches | ${nodes} | DUT*
196 | | :FOR | ${dut} | IN | @{duts}
197 | | | Add PCI all devices | ${nodes['${dut}']}
198
199 | Add PCI device to DUT
200 | | [Documentation] | Add PCI device to VPP startup configuration
201 | | ... | to DUT specified as argument.
202 | | ...
203 | | ... | *Arguments:*
204 | | ... | - ${node} - DUT node. Type: dictionary
205 | | ... | - ${pci_address} - PCI address. Type: string
206 | | ...
207 | | ... | *Example:*
208 | | ...
209 | | ... | \| Add PCI device to DUT \| ${nodes['DUT1']} \| 0000:00:00.0 \|
210 | | ...
211 | | [Arguments] | ${node} | ${pci_address}
212 | | ...
213 | | Add PCI device | ${node} | ${pci_address}
214
215 | Add Heapsize Config to all DUTs
216 | | [Documentation] | Add Add Heapsize Config to VPP startup configuration\
217 | | ... | to all DUTs.
218 | | ...
219 | | ... | *Arguments:*
220 | | ... | - ${heapsize} - Heapsize string (5G, 200M, ...)
221 | | ...
222 | | ... | *Example:*
223 | | ...
224 | | ... | \| Add Heapsize Config to all DUTs \| 200M \|
225 | | ...
226 | | [Arguments] | ${heapsize}
227 | | ...
228 | | ${duts}= | Get Matches | ${nodes} | DUT*
229 | | :FOR | ${dut} | IN | @{duts}
230 | | | Add Heapsize Config | ${nodes['${dut}']} | ${heapsize}
231
232 | Add No Multi Seg to all DUTs
233 | | [Documentation] | Add No Multi Seg to VPP startup configuration to all DUTs.
234 | | ...
235 | | ${duts}= | Get Matches | ${nodes} | DUT*
236 | | :FOR | ${dut} | IN | @{duts}
237 | | | Add No Multi Seg Config | ${nodes['${dut}']}
238
239 | Add Enable Vhost User to all DUTs
240 | | [Documentation] | Add Enable Vhost User to VPP startup configuration to all\
241 | | ... | DUTs.
242 | | ...
243 | | ${duts}= | Get Matches | ${nodes} | DUT*
244 | | :FOR | ${dut} | IN | @{duts}
245 | | | Add Enable Vhost User Config | ${nodes['${dut}']}
246
247 | Remove startup configuration of VPP from all DUTs
248 | | [Documentation] | Remove VPP startup configuration from all DUTs.
249 | | ...
250 | | ${duts}= | Get Matches | ${nodes} | DUT*
251 | | :FOR | ${dut} | IN | @{duts}
252 | | | Remove All PCI Devices | ${nodes['${dut}']}
253 | | | Remove All CPU Config | ${nodes['${dut}']}
254 | | | Remove Socketmem Config | ${nodes['${dut}']}
255 | | | Remove Heapsize Config | ${nodes['${dut}']}
256 | | | Remove Rxqueues Config | ${nodes['${dut}']}
257 | | | Remove No Multi Seg Config | ${nodes['${dut}']}
258 | | | Remove Enable Vhost User Config | ${nodes['${dut}']}
259
260 | Setup default startup configuration of VPP on all DUTs
261 | | [Documentation] | Setup default startup configuration of VPP to all DUTs.
262 | | ...
263 | | Remove startup configuration of VPP from all DUTs
264 | | Add '1' worker threads and rxqueues '1' in 3-node single-link topo
265 | | Add all PCI devices to all DUTs
266 | | Apply startup configuration on all VPP DUTs
267
268 | Setup 2-node startup configuration of VPP on all DUTs
269 | | [Documentation] | Setup default startup configuration of VPP to all DUTs.
270 | | ...
271 | | Remove startup configuration of VPP from all DUTs
272 | | Add '1' worker threads and rxqueues '1' in 2-node single-link topo
273 | | Add all PCI devices to all DUTs
274 | | Apply startup configuration on all VPP DUTs
275
276 | Apply startup configuration on all VPP DUTs
277 | | [Documentation] | Apply startup configuration of VPP and restart VPP on all\
278 | | ... | DUTs.
279 | | ...
280 | | ${duts}= | Get Matches | ${nodes} | DUT*
281 | | :FOR | ${dut} | IN | @{duts}
282 | | | Apply Config | ${nodes['${dut}']}
283 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${TRUE}
284
285 | Save VPP PIDs
286 | | [Documentation] | Get PIDs of VPP processes from all DUTs in topology and\
287 | | ... | set it as a test variable. The PIDs are stored as dictionary items\
288 | | ... | where the key is the host and the value is the PID.
289 | | ...
290 | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes}
291 | | Set Test Variable | ${setup_vpp_pids}
292
293 | Check VPP PID in Teardown
294 | | [Documentation] | Check if the VPP PIDs on all DUTs are the same at the end\
295 | | ... | of test as they were at the begining. If they are not, only a message\
296 | | ... | is printed on console and to log. The test will not fail.
297 | | ...
298 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
299 | | ${err_msg}= | Catenate | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
300 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
301 | | ${rc} | ${msg}= | Run keyword and ignore error
302 | | ... | Dictionaries Should Be Equal
303 | | ... | ${setup_vpp_pids} | ${teardown_vpp_pids}
304 | | Run Keyword And Return If | '${rc}'=='FAIL' | Log | ${err_msg}
305 | | ... | console=yes | level=WARN
306
307 | Func Test Setup
308 | | [Documentation] | Common test setup for functional tests.
309 | | ...
310 | | Setup all DUTs before test
311 | | Save VPP PIDs
312 | | Setup all TGs before traffic script
313 | | Update All Interface Data On All Nodes | ${nodes}
314 | | Reset VAT History On All DUTs | ${nodes}
315
316 | Func Test Teardown
317 | | [Documentation] | Common test teardown for functional tests.
318 | | ...
319 | | Show Packet Trace on All DUTs | ${nodes}
320 | | Show VAT History On All DUTs | ${nodes}
321 | | Vpp Show Errors On All DUTs | ${nodes}
322 | | Check VPP PID in Teardown