CSIT-646 Refactor VPPConfigGenerator script
[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 | Create base startup configuration of VPP on all DUTs
121 | | [Documentation] | Create base startup configuration of VPP to all DUTs.
122 | | ...
123 | | ${duts}= | Get Matches | ${nodes} | DUT*
124 | | :FOR | ${dut} | IN | @{duts}
125 | | | Import Library | resources.libraries.python.VppConfigGenerator
126 | | | ... | WITH NAME | ${dut}
127 | | | Run keyword | ${dut}.Set Node |  ${nodes['${dut}']}
128 | | | Run keyword | ${dut}.Add Unix Log
129 | | | Run keyword | ${dut}.Add Unix CLI Listen
130 | | | Run keyword | ${dut}.Add Unix Nodaemon
131 | | | Run keyword | ${dut}.Add DPDK Socketmem | "1024,1024"
132 | | | Run keyword | ${dut}.Add Heapsize | "3G"
133 | | | Run keyword | ${dut}.Add IP6 Hash Buckets | "2000000"
134 | | | Run keyword | ${dut}.Add IP6 Heap Size | "3G"
135
136 | Add '${m}' worker threads and '${n}' rxqueues in 3-node single-link circular topology
137 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
138 | | ... | configuration on all DUTs in 3-node single-link topology.
139 | | ...
140 | | ${m_int}= | Convert To Integer | ${m}
141 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
142 | | ... | ${dut1_if1} | ${dut1_if2}
143 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
144 | | ... | ${dut2_if1} | ${dut2_if2}
145 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
146 | | ... | skip_cnt=${1} | cpu_cnt=${1}
147 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
148 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
149 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
150 | | ... | skip_cnt=${1} | cpu_cnt=${1}
151 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
152 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
153 | | Run keyword | DUT1.Add CPU Main Core | ${dut1_cpu_main}
154 | | Run keyword | DUT2.Add CPU Main Core | ${dut2_cpu_main}
155 | | Run keyword | DUT1.Add CPU Corelist Workers | ${dut1_cpu_w}
156 | | Run keyword | DUT2.Add CPU Corelist Workers | ${dut2_cpu_w}
157 | | Run keyword | DUT1.Add DPDK Dev Default RXQ | ${n}
158 | | Run keyword | DUT2.Add DPDK Dev Default RXQ | ${n}
159
160 | Add '${m}' worker threads and '${n}' rxqueues in 2-node single-link circular topology
161 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
162 | | ... | configuration on all DUTs in 2-node single-link topology.
163 | | ...
164 | | ${m_int}= | Convert To Integer | ${m}
165 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
166 | | ... | ${dut1_if1} | ${dut1_if2}
167 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
168 | | ... | skip_cnt=${1} | cpu_cnt=${1}
169 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
170 | | ... | skip_cnt=${2} | cpu_cnt=${m_int}
171 | | Run keyword | DUT1.Add CPU Main Core | ${dut1_cpu_main}
172 | | Run keyword | DUT1.Add CPU Corelist Workers | ${dut1_cpu_w}
173 | | Run keyword | DUT1.Add DPDK Dev Default RXQ | ${n}
174
175 | Add '${m}' worker threads using SMT and '${n}' rxqueues in 3-node single-link circular topology
176 | | [Documentation] | Setup M worker threads using SMT and N rxqueues in vpp\
177 | | ... | startup configuration on all DUTs in 3-node single-link topology.
178 | | ...
179 | | ${m_int}= | Convert To Integer | ${m}
180 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
181 | | ... | ${dut1_if1} | ${dut1_if2}
182 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
183 | | ... | ${dut2_if1} | ${dut2_if2}
184 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
185 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
186 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
187 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
188 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
189 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
190 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
191 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
192 | | Run keyword | DUT1.Add CPU Main Core | ${dut1_cpu_main}
193 | | Run keyword | DUT2.Add CPU Main Core | ${dut2_cpu_main}
194 | | Run keyword | DUT1.Add CPU Corelist Workers | ${dut1_cpu_w}
195 | | Run keyword | DUT2.Add CPU Corelist Workers | ${dut2_cpu_w}
196 | | Run keyword | DUT1.Add DPDK Dev Default RXQ | ${n}
197 | | Run keyword | DUT2.Add DPDK Dev Default RXQ | ${n}
198
199 | Add '${m}' worker threads using SMT and '${n}' rxqueues in 2-node single-link circular topology
200 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup\
201 | | ... | configuration on all DUTs in 2-node single-link topology.
202 | | ...
203 | | ${m_int}= | Convert To Integer | ${m}
204 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
205 | | ... | ${dut1_if1} | ${dut1_if2}
206 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
207 | | ... | skip_cnt=${1} | cpu_cnt=${1} | smt_used=${True}
208 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
209 | | ... | skip_cnt=${2} | cpu_cnt=${m_int} | smt_used=${True}
210 | | Run keyword | DUT1.Add CPU Main Core | ${dut1_cpu_main}
211 | | Run keyword | DUT1.Add CPU Corelist Workers | ${dut1_cpu_w}
212 | | Run keyword | DUT1.Add DPDK Dev Default RXQ | ${n}
213
214 | Add no multi seg to all DUTs
215 | | [Documentation] | Add No Multi Seg to VPP startup configuration to all DUTs.
216 | | ...
217 | | ${duts}= | Get Matches | ${nodes} | DUT*
218 | | :FOR | ${dut} | IN | @{duts}
219 | | | Run keyword | ${dut}.Add DPDK No Multi Seg
220
221 | Add SNAT to all DUTs
222 | | [Documentation] | Add SNAT configuration to all DUTs.
223 | | ...
224 | | ${duts}= | Get Matches | ${nodes} | DUT*
225 | | :FOR | ${dut} | IN | @{duts}
226 | | | Run keyword | ${dut}.Add SNAT
227
228 | Add cryptodev to all DUTs
229 | | [Documentation] | Add Cryptodev to VPP startup configuration to all DUTs.
230 | | ...
231 | | ... | *Arguments:*
232 | | ... | - ${count} - Number of QAT devices. Type: integer
233 | | ...
234 | | ... | *Example:*
235 | | ...
236 | | ... | \| Add cryptodev to all DUTs \| ${4} \|
237 | | ...
238 | | [Arguments] | ${count}
239 | | ${duts}= | Get Matches | ${nodes} | DUT*
240 | | :FOR | ${dut} | IN | @{duts}
241 | | | Run keyword | ${dut}.Add DPDK Cryptodev | ${count}
242
243 | Apply startup configuration on all VPP DUTs
244 | | [Documentation] | Write startup configuration and restart VPP on all DUTs.
245 | | ...
246 | | ${duts}= | Get Matches | ${nodes} | DUT*
247 | | :FOR | ${dut} | IN | @{duts}
248 | | | Run keyword | ${dut}.Apply Config
249 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${TRUE}
250
251 | Save VPP PIDs
252 | | [Documentation] | Get PIDs of VPP processes from all DUTs in topology and\
253 | | ... | set it as a test variable. The PIDs are stored as dictionary items\
254 | | ... | where the key is the host and the value is the PID.
255 | | ...
256 | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes}
257 | | ${keys}= | Get Dictionary Keys | ${setup_vpp_pids}
258 | | :FOR | ${key} | IN | @{keys}
259 | | | ${pid}= | Get From Dictionary | ${setup_vpp_pids} | ${key}
260 | | | Run Keyword If | $pid is None | FAIL | No VPP PID found on node ${key}
261 | | | Run Keyword If | ',' in '${pid}'
262 | | | ... | FAIL | More then one VPP PID found on node ${key}: ${pid}
263 | | Set Test Variable | ${setup_vpp_pids}
264
265 | Verify VPP PID in Teardown
266 | | [Documentation] | Check if the VPP PIDs on all DUTs are the same at the end\
267 | | ... | of test as they were at the begining. If they are not, only a message\
268 | | ... | is printed on console and to log. The test will not fail.
269 | | ...
270 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
271 | | ${err_msg}= | Catenate | ${SUITE NAME} - ${TEST NAME}
272 | | ... | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
273 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
274 | | ${rc} | ${msg}= | Run keyword and ignore error
275 | | ... | Dictionaries Should Be Equal
276 | | ... | ${setup_vpp_pids} | ${teardown_vpp_pids}
277 | | Run Keyword And Return If | '${rc}'=='FAIL' | Log | ${err_msg}
278 | | ... | console=yes | level=WARN
279
280 | Set up functional test
281 | | [Documentation] | Common test setup for functional tests.
282 | | ...
283 | | Configure all DUTs before test
284 | | Save VPP PIDs
285 | | Configure all TGs for traffic script
286 | | Update All Interface Data On All Nodes | ${nodes}
287 | | Reset VAT History On All DUTs | ${nodes}
288
289 | Tear down functional test
290 | | [Documentation] | Common test teardown for functional tests.
291 | | ...
292 | | Show Packet Trace on All DUTs | ${nodes}
293 | | Show VAT History On All DUTs | ${nodes}
294 | | Vpp Show Errors On All DUTs | ${nodes}
295 | | Verify VPP PID in Teardown