HC Test: create Vlan sub-interface using netconf
[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/VppConfigGenerator.py
24 | Library | resources/libraries/python/VppCounters.py
25 | Library | Collections
26
27 *** Keywords ***
28 | Setup all DUTs before test
29 | | [Documentation] | Setup all DUTs in topology before test execution.
30 | | ...
31 | | Setup All DUTs | ${nodes}
32
33 | Setup all TGs before traffic script
34 | | [Documentation] | Prepare all TGs before traffic scripts execution.
35 | | ...
36 | | All TGs Set Interface Default Driver | ${nodes}
37
38 | Show Vpp Version On All DUTs
39 | | [Documentation] | Show VPP version verbose on all DUTs.
40 | | ...
41 | | ${duts}= | Get Matches | ${nodes} | DUT*
42 | | :FOR | ${dut} | IN | @{duts}
43 | | | Vpp show version verbose | ${nodes['${dut}']}
44
45 | Show Vpp Errors On All DUTs
46 | | [Documentation] | Show VPP errors verbose on all DUTs.
47 | | ...
48 | | ${duts}= | Get Matches | ${nodes} | DUT*
49 | | :FOR | ${dut} | IN | @{duts}
50 | | | Vpp Show Errors | ${nodes['${dut}']}
51
52 | Show Vpp Trace Dump On All DUTs
53 | | [Documentation] | Save API trace and dump output on all DUTs.
54 | | ...
55 | | ${duts}= | Get Matches | ${nodes} | DUT*
56 | | :FOR | ${dut} | IN | @{duts}
57 | | | Vpp api trace save | ${nodes['${dut}']}
58 | | | Vpp api trace dump | ${nodes['${dut}']}
59
60 | Show Vpp Vhost On All DUTs
61 | | [Documentation] | Show Vhost User on all DUTs.
62 | | ...
63 | | ${duts}= | Get Matches | ${nodes} | DUT*
64 | | :FOR | ${dut} | IN | @{duts}
65 | | | Vpp Show Vhost | ${nodes['${dut}']}
66
67 | Setup Scheduler Policy for Vpp On All DUTs
68 | | [Documentation] | Set realtime scheduling policy (SCHED_RR) with priority 1
69 | | ... | on all VPP worker threads on all DUTs.
70 | | ...
71 | | ${duts}= | Get Matches | ${nodes} | DUT*
72 | | :FOR | ${dut} | IN | @{duts}
73 | | | Set VPP Scheduling rr | ${nodes['${dut}']}
74
75 | Add '${m}' worker threads and rxqueues '${n}' in 3-node single-link topo
76 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
77 | | ... | configuration on all DUTs in 3-node single-link topology.
78 | | ...
79 | | ${m_int}= | Convert To Integer | ${m}
80 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
81 | | ... | ${dut1_if1} | ${dut1_if2}
82 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
83 | | ... | ${dut2_if1} | ${dut2_if2}
84 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
85 | | ... | skip_cnt=${1} | cpu_cnt=${1}
86 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
87 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
88 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
89 | | ... | skip_cnt=${1} | cpu_cnt=${1}
90 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
91 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
92 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
93 | | ... | corelist-workers | ${dut1_cpu_w}
94 | | ${dut2_cpu}= | Catenate | main-core | ${dut2_cpu_main}
95 | | ... | corelist-workers | ${dut2_cpu_w}
96 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
97 | | Add CPU config | ${dut1} | ${dut1_cpu}
98 | | Add CPU config | ${dut2} | ${dut2_cpu}
99 | | Add rxqueues config | ${dut1} | ${rxqueues}
100 | | Add rxqueues config | ${dut2} | ${rxqueues}
101
102 | Add '${m}' worker threads and rxqueues '${n}' in 2-node single-link topo
103 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
104 | | ... | configuration on all DUTs in 2-node single-link topology.
105 | | ...
106 | | ${m_int}= | Convert To Integer | ${m}
107 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
108 | | ... | ${dut1_if1} | ${dut1_if2}
109 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
110 | | ... | skip_cnt=${1} | cpu_cnt=${1}
111 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
112 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
113 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
114 | | ... | corelist-workers | ${dut1_cpu_w}
115 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
116 | | Add CPU config | ${dut1} | ${dut1_cpu}
117 | | Add rxqueues config | ${dut1} | ${rxqueues}
118
119 | Add '${m}' worker threads using SMT and rxqueues '${n}' in 3-node single-link topo
120 | | [Documentation] | Setup M worker threads using SMT and N rxqueues in vpp\
121 | | ... | startup configuration on all DUTs in 3-node single-link topology.
122 | | ...
123 | | ${m_int}= | Convert To Integer | ${m}
124 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
125 | | ... | ${dut1_if1} | ${dut1_if2}
126 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
127 | | ... | ${dut2_if1} | ${dut2_if2}
128 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
129 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
130 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
131 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
132 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
133 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
134 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
135 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
136 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
137 | | ... | corelist-workers | ${dut1_cpu_w}
138 | | ${dut2_cpu}= | Catenate | main-core | ${dut2_cpu_main}
139 | | ... | corelist-workers | ${dut2_cpu_w}
140 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
141 | | Add CPU config | ${dut1} | ${dut1_cpu}
142 | | Add CPU config | ${dut2} | ${dut2_cpu}
143 | | Add rxqueues config | ${dut1} | ${rxqueues}
144 | | Add rxqueues config | ${dut2} | ${rxqueues}
145
146 | Add '${m}' worker threads using SMT and rxqueues '${n}' in 2-node single-link topo
147 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
148 | | ... | configuration on all DUTs in 2-node single-link topology.
149 | | ...
150 | | ${m_int}= | Convert To Integer | ${m}
151 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
152 | | ... | ${dut1_if1} | ${dut1_if2}
153 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
154 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
155 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
156 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
157 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
158 | | ... | corelist-workers | ${dut1_cpu_w}
159 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
160 | | Add CPU config | ${dut1} | ${dut1_cpu}
161 | | Add rxqueues config | ${dut1} | ${rxqueues}
162
163 | Add worker threads and rxqueues to all DUTs
164 | | [Documentation] | Setup worker threads and rxqueues in VPP startup\
165 | | ... | configuration to all DUTs.
166 | | ...
167 | | ... | *Arguments:*
168 | | ... | - ${cpu} - CPU configuration. Type: string
169 | | ... | - ${rxqueues} - rxqueues configuration. Type: string
170 | | ...
171 | | ... | *Example:*
172 | | ...
173 | | ... | \| Add worker threads and rxqueues to all DUTs \| main-core 0 \
174 | | ... | \| rxqueues 2 \|
175 | | ...
176 | | [Arguments] | ${cpu} | ${rxqueues}
177 | | ...
178 | | ${duts}= | Get Matches | ${nodes} | DUT*
179 | | :FOR | ${dut} | IN | @{duts}
180 | | | Add CPU config | ${nodes['${dut}']} | ${cpu}
181 | | | Add rxqueues config | ${nodes['${dut}']} | ${rxqueues}
182
183 | Add all PCI devices to all DUTs
184 | | [Documentation] | Add all available PCI devices from topology file to VPP\
185 | | ... | startup configuration to all DUTs.
186 | | ...
187 | | ${duts}= | Get Matches | ${nodes} | DUT*
188 | | :FOR | ${dut} | IN | @{duts}
189 | | | Add PCI all devices | ${nodes['${dut}']}
190
191 | Add PCI device to DUT
192 | | [Documentation] | Add PCI device to VPP startup configuration
193 | | ... | to DUT specified as argument.
194 | | ...
195 | | ... | *Arguments:*
196 | | ... | - ${node} - DUT node. Type: dictionary
197 | | ... | - ${pci_address} - PCI address. Type: string
198 | | ...
199 | | ... | *Example:*
200 | | ...
201 | | ... | \| Add PCI device to DUT \| ${nodes['DUT1']} \| 0000:00:00.0 \|
202 | | ...
203 | | [Arguments] | ${node} | ${pci_address}
204 | | ...
205 | | Add PCI device | ${node} | ${pci_address}
206
207 | Add Heapsize Config to all DUTs
208 | | [Documentation] | Add Add Heapsize Config to VPP startup configuration\
209 | | ... | to all DUTs.
210 | | ...
211 | | ... | *Arguments:*
212 | | ... | - ${heapsize} - Heapsize string (5G, 200M, ...)
213 | | ...
214 | | ... | *Example:*
215 | | ...
216 | | ... | \| Add Heapsize Config to all DUTs \| 200M \|
217 | | ...
218 | | [Arguments] | ${heapsize}
219 | | ...
220 | | ${duts}= | Get Matches | ${nodes} | DUT*
221 | | :FOR | ${dut} | IN | @{duts}
222 | | | Add Heapsize Config | ${nodes['${dut}']} | ${heapsize}
223
224 | Add No Multi Seg to all DUTs
225 | | [Documentation] | Add No Multi Seg to VPP startup configuration to all DUTs.
226 | | ...
227 | | ${duts}= | Get Matches | ${nodes} | DUT*
228 | | :FOR | ${dut} | IN | @{duts}
229 | | | Add No Multi Seg Config | ${nodes['${dut}']}
230
231 | Add Enable Vhost User to all DUTs
232 | | [Documentation] | Add Enable Vhost User to VPP startup configuration to all\
233 | | ... | DUTs.
234 | | ...
235 | | ${duts}= | Get Matches | ${nodes} | DUT*
236 | | :FOR | ${dut} | IN | @{duts}
237 | | | Add Enable Vhost User Config | ${nodes['${dut}']}
238
239 | Remove startup configuration of VPP from all DUTs
240 | | [Documentation] | Remove VPP startup configuration from all DUTs.
241 | | ...
242 | | ${duts}= | Get Matches | ${nodes} | DUT*
243 | | :FOR | ${dut} | IN | @{duts}
244 | | | Remove All PCI Devices | ${nodes['${dut}']}
245 | | | Remove All CPU Config | ${nodes['${dut}']}
246 | | | Remove Socketmem Config | ${nodes['${dut}']}
247 | | | Remove Heapsize Config | ${nodes['${dut}']}
248 | | | Remove Rxqueues Config | ${nodes['${dut}']}
249 | | | Remove No Multi Seg Config | ${nodes['${dut}']}
250 | | | Remove Enable Vhost User Config | ${nodes['${dut}']}
251
252 | Setup default startup configuration of VPP on all DUTs
253 | | [Documentation] | Setup default startup configuration of VPP to all DUTs.
254 | | ...
255 | | Remove startup configuration of VPP from all DUTs
256 | | Add '1' worker threads and rxqueues '1' in 3-node single-link topo
257 | | Add all PCI devices to all DUTs
258 | | Apply startup configuration on all VPP DUTs
259
260 | Setup 2-node 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 2-node single-link topo
265 | | Add all PCI devices to all DUTs
266 | | Apply startup configuration on all VPP DUTs
267
268 | Apply startup configuration on all VPP DUTs
269 | | [Documentation] | Apply startup configuration of VPP and restart VPP on all\
270 | | ... | DUTs.
271 | | ...
272 | | ${duts}= | Get Matches | ${nodes} | DUT*
273 | | :FOR | ${dut} | IN | @{duts}
274 | | | Apply Config | ${nodes['${dut}']}
275 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${TRUE}
276
277 | Save VPP PIDs
278 | | [Documentation] | Get PIDs of VPP processes from all DUTs in topology and\
279 | | ... | set it as a test variable. The PIDs are stored as dictionary items\
280 | | ... | where the key is the host and the value is the PID.
281 | | ...
282 | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes}
283 | | Set Test Variable | ${setup_vpp_pids}
284
285 | Check VPP PID in Teardown
286 | | [Documentation] | Check if the VPP PIDs on all DUTs are the same at the end\
287 | | ... | of test as they were at the begining. If they are not, only a message\
288 | | ... | is printed on console and to log. The test will not fail.
289 | | ...
290 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
291 | | ${err_msg}= | Catenate | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
292 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
293 | | ${rc} | ${msg}= | Run keyword and ignore error
294 | | ... | Dictionaries Should Be Equal
295 | | ... | ${setup_vpp_pids} | ${teardown_vpp_pids}
296 | | Run Keyword And Return If | '${rc}'=='FAIL' | Log | ${err_msg}
297 | | ... | console=yes | level=WARN
298
299 | Func Test Setup
300 | | [Documentation] | Common test setup for functional tests.
301 | | ...
302 | | Setup all DUTs before test
303 | | Save VPP PIDs
304 | | Setup all TGs before traffic script
305 | | Update All Interface Data On All Nodes | ${nodes}
306 | | Reset VAT History On All DUTs | ${nodes}
307
308 | Func Test Teardown
309 | | [Documentation] | Common test teardown for functional tests.
310 | | ...
311 | | Show Packet Trace on All DUTs | ${nodes}
312 | | Show VAT History On All DUTs | ${nodes}
313 | | Vpp Show Errors On All DUTs | ${nodes}
314 | | Check VPP PID in Teardown