LIGATO: Remove
[csit.git] / resources / libraries / robot / shared / default.robot
1 # Copyright (c) 2019 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/PapiHistory.py
17 | Variables | resources/libraries/python/Constants.py
18 | ...
19 | Library | Collections
20 | Library | OperatingSystem
21 | Library | String
22 | ...
23 | Library | resources.libraries.python.Classify
24 | Library | resources.libraries.python.CpuUtils
25 | Library | resources.libraries.python.CoreDumpUtil
26 | Library | resources.libraries.python.Cop
27 | Library | resources.libraries.python.DUTSetup
28 | Library | resources.libraries.python.L2Util
29 | Library | resources.libraries.python.InterfaceUtil
30 | Library | resources.libraries.python.IPUtil
31 | Library | resources.libraries.python.IPv6Util
32 | Library | resources.libraries.python.NodePath
33 | Library | resources.libraries.python.Namespaces
34 | Library | resources.libraries.python.PapiHistory
35 | Library | resources.libraries.python.SchedUtils
36 | Library | resources.libraries.python.Tap
37 | Library | resources.libraries.python.TestConfig
38 | Library | resources.libraries.python.TGSetup
39 | Library | resources.libraries.python.topology.Topology
40 | Library | resources.libraries.python.Trace
41 | Library | resources.libraries.python.VppCounters
42 | Library | resources.libraries.python.VPPUtil
43 | ...
44 | Resource | resources/libraries/robot/lb/load_balancer.robot
45 | Resource | resources/libraries/robot/crypto/ipsec.robot
46 | Resource | resources/libraries/robot/features/acl.robot
47 | Resource | resources/libraries/robot/features/gbp.robot
48 | Resource | resources/libraries/robot/features/policer.robot
49 | Resource | resources/libraries/robot/ip/ip4.robot
50 | Resource | resources/libraries/robot/ip/ip6.robot
51 | Resource | resources/libraries/robot/ip/nat.robot
52 | Resource | resources/libraries/robot/l2/l2_bridge_domain.robot
53 | Resource | resources/libraries/robot/l2/l2_patch.robot
54 | Resource | resources/libraries/robot/l2/l2_traffic.robot
55 | Resource | resources/libraries/robot/l2/l2_xconnect.robot
56 | Resource | resources/libraries/robot/l2/tagging.robot
57 | Resource | resources/libraries/robot/overlay/srv6.robot
58 | Resource | resources/libraries/robot/overlay/lisp.robot
59 | Resource | resources/libraries/robot/overlay/lispgpe.robot
60 | Resource | resources/libraries/robot/overlay/lisp_api.robot
61 | Resource | resources/libraries/robot/performance/performance_configuration.robot
62 | Resource | resources/libraries/robot/performance/performance_limits.robot
63 | Resource | resources/libraries/robot/performance/performance_utils.robot
64 | Resource | resources/libraries/robot/shared/interfaces.robot
65 | Resource | resources/libraries/robot/shared/container.robot
66 | Resource | resources/libraries/robot/shared/memif.robot
67 | Resource | resources/libraries/robot/shared/suite_teardown.robot
68 | Resource | resources/libraries/robot/shared/suite_setup.robot
69 | Resource | resources/libraries/robot/shared/test_teardown.robot
70 | Resource | resources/libraries/robot/shared/test_setup.robot
71 | Resource | resources/libraries/robot/shared/testing_path.robot
72 | Resource | resources/libraries/robot/shared/traffic.robot
73 | Resource | resources/libraries/robot/shared/vm.robot
74
75 *** Keywords ***
76 | Configure crypto device on all DUTs
77 | | [Documentation] | Verify if Crypto QAT device virtual functions are
78 | | ... | initialized on all DUTs. If parameter force_init is set to True, then
79 | | ... | try to initialize/disable.
80 | | ...
81 | | ... | *Arguments:*
82 | | ... | - crypto_type - Crypto device type - HW_DH895xcc or HW_C3xxx.
83 | | ... | Type: string, default value: HW_DH895xcc
84 | | ... | - numvfs - Number of VFs to initialize, 0 - disable the VFs
85 | | ... | Type: integer, default value: ${32}
86 | | ... | - force_init - Force to initialize. Type: boolean
87 | | ...
88 | | ... | *Example:*
89 | | ...
90 | | ... | \| Configure crypto device on all DUTs \| HW_DH895xcc \| ${32} \|
91 | | ...
92 | | [Arguments] | ${crypto_type} | ${numvfs} | ${force_init}=${False}
93 | | ...
94 | | :FOR | ${dut} | IN | @{duts}
95 | | | Crypto Device Verify | ${nodes['${dut}']} | ${crypto_type}
96 | | | ... | ${numvfs} | force_init=${force_init}
97
98 | Configure kernel module on all DUTs
99 | | [Documentation] | Verify if specific kernel module is loaded on all DUTs.
100 | | ... | If parameter force_load is set to True, then try to load.
101 | | ...
102 | | ... | *Arguments:*
103 | | ... | - module - Module to verify. Type: string
104 | | ... | - force_load - Try to load module. Type: boolean
105 | | ...
106 | | ... | *Example:*
107 | | ...
108 | | ... | \| Configure kernel module on all DUTs \| ${True} \|
109 | | ...
110 | | [Arguments] | ${module} | ${force_load}=${False}
111 | | ...
112 | | Verify Kernel Module on All DUTs | ${nodes} | ${module}
113 | | ... | force_load=${force_load}
114
115 | Create base startup configuration of VPP on all DUTs
116 | | [Documentation] | Create base startup configuration of VPP to all DUTs.
117 | | ...
118 | | :FOR | ${dut} | IN | @{duts}
119 | | | Import Library | resources.libraries.python.VppConfigGenerator
120 | | | ... | WITH NAME | ${dut}
121 | | | Run keyword | ${dut}.Set Node |  ${nodes['${dut}']}
122 | | | Run keyword | ${dut}.Add Unix Log
123 | | | Run keyword | ${dut}.Add Unix CLI Listen
124 | | | Run keyword | ${dut}.Add Unix Nodaemon
125 | | | Run keyword | ${dut}.Add Unix Coredump
126 | | | Run keyword | ${dut}.Add Socksvr | ${SOCKSVR_PATH}
127 | | | Run keyword | ${dut}.Add Heapsize | 4G
128 | | | Run keyword | ${dut}.Add Statseg size | 4G
129 | | | Run keyword | ${dut}.Add Statseg Per Node Counters | on
130 | | | Run keyword | ${dut}.Add Plugin | disable | default
131 | | | Run keyword | ${dut}.Add Plugin | enable | @{plugins_to_enable}
132 | | | Run keyword | ${dut}.Add IP6 Hash Buckets | 2000000
133 | | | Run keyword | ${dut}.Add IP6 Heap Size | 4G
134 | | | Run keyword | ${dut}.Add IP Heap Size | 4G
135
136 | Add worker threads to all DUTs
137 | | [Documentation] | Setup worker threads in vpp startup configuration on all
138 | | ... | DUTs. Based on the SMT configuration of DUT if enabled keyword will
139 | | ... | automatically map also the sibling logical cores.
140 | | ... | Keyword will automatically set the appropriate test TAGs in format
141 | | ... | mTnC, where m=logical_core_count and n=physical_core_count.
142 | | ... | RXQ are computed automatically by dividing thread count with number 2
143 | | ... | (TODO: Add division by actual number of interfaces). User can manually
144 | | ... | override RX, RXD, TXD parameters if needed.
145 | | ...
146 | | ... | *Arguments:*
147 | | ... | - phy_cores - Number of physical cores to use. Type: integer
148 | | ... | - rx_queues - Number of RX queues. Type: integer
149 | | ... | - rxd - Number of RX descriptors. Type: integer
150 | | ... | - txd - Number of TX descriptors. Type: integer
151 | | ...
152 | | ... | *Example:*
153 | | ...
154 | | ... | \| Add worker threads to all DUTs \| ${1} \| ${1} \|
155 | | ...
156 | | [Arguments] | ${phy_cores} | ${rx_queues}=${None} | ${rxd}=${None}
157 | | ... | ${txd}=${None}
158 | | ...
159 | | ${cpu_count_int} | Convert to Integer | ${phy_cores}
160 | | ${thr_count_int} | Convert to Integer | ${phy_cores}
161 | | ${rxd_count_int}= | Set variable | ${rxd}
162 | | ${txd_count_int}= | Set variable | ${txd}
163 | | :FOR | ${dut} | IN | @{duts}
164 | | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
165 | | | ... | Variable Should Exist | ${${dut}_if1}
166 | | | @{if_list}= | Run Keyword If | '${if1_status}' == 'PASS'
167 | | | ... | Create List | ${${dut}_if1}
168 | | | ... | ELSE | Create List | ${${dut}_if1_1} | ${${dut}_if1_2}
169 | | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
170 | | | ... | Variable Should Exist | ${${dut}_if2}
171 | | | Run Keyword If | '${if2_status}' == 'PASS'
172 | | | ... | Append To List | ${if_list} | ${${dut}_if2}
173 | | | ... | ELSE
174 | | | ... | Append To List | ${if_list} | ${${dut}_if2_1} | ${${dut}_if2_2}
175 | | | ${numa}= | Get interfaces numa node | ${nodes['${dut}']} | @{if_list}
176 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
177 | | | ${skip_cnt}= | Set variable | ${CPU_CNT_SYSTEM}
178 | | | ${cpu_main}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
179 | | | ... | skip_cnt=${skip_cnt} | cpu_cnt=${CPU_CNT_MAIN}
180 | | | ${skip_cnt}= | Evaluate | ${CPU_CNT_SYSTEM} + ${CPU_CNT_MAIN}
181 | | | ${cpu_wt}= | Run keyword if | ${cpu_count_int} > 0 |
182 | | | ... | Cpu list per node str | ${nodes['${dut}']} | ${numa}
183 | | | ... | skip_cnt=${skip_cnt} | cpu_cnt=${cpu_count_int}
184 | | | ... | smt_used=${smt_used}
185 | | | ${thr_count_int}= | Run keyword if | ${smt_used}
186 | | | ... | Evaluate | int(${cpu_count_int}*2)
187 | | | ... | ELSE | Set variable | ${thr_count_int}
188 | | | ${rxq_count_int}= | Run keyword if | ${rx_queues}
189 | | | ... | Set variable | ${rx_queues}
190 | | | ... | ELSE | Evaluate | int(${thr_count_int}/2)
191 | | | ${rxq_count_int}= | Run keyword if | ${rxq_count_int} == 0
192 | | | ... | Set variable | ${1}
193 | | | ... | ELSE | Set variable | ${rxq_count_int}
194 | | | Run keyword if | ${cpu_count_int} > 0
195 | | | ... | ${dut}.Add CPU Main Core | ${cpu_main}
196 | | | Run keyword if | ${cpu_count_int} > 0
197 | | | ... | ${dut}.Add CPU Corelist Workers | ${cpu_wt}
198 | | | Run keyword if | ${smt_used}
199 | | | ... | Run keyword | ${dut}.Add Buffers Per Numa | ${215040} | ELSE
200 | | | ... | Run keyword | ${dut}.Add Buffers Per Numa | ${107520}
201 | | | Run keyword if | ${thr_count_int} > 1
202 | | | ... | Set Tags | MTHREAD | ELSE | Set Tags | STHREAD
203 | | | Set Tags | ${thr_count_int}T${cpu_count_int}C
204 | | Set Test Variable | ${smt_used}
205 | | Set Test Variable | ${thr_count_int}
206 | | Set Test Variable | ${cpu_count_int}
207 | | Set Test Variable | ${rxq_count_int}
208 | | Set Test Variable | ${rxd_count_int}
209 | | Set Test Variable | ${txd_count_int}
210
211 | Add DPDK pci devices to all DUTs
212 | | [Documentation]
213 | | ... | Add PCI devices to VPP configuration file.
214 | | ...
215 | | :FOR | ${dut} | IN | @{duts}
216 | | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
217 | | | ... | Variable Should Exist | ${${dut}_if1}
218 | | | ${if1_pci}= | Run Keyword If | '${if1_status}' == 'PASS'
219 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if1}
220 | | | ${if1_1_pci}= | Run Keyword Unless | '${if1_status}' == 'PASS'
221 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if1_1}
222 | | | ${if1_2_pci}= | Run Keyword Unless | '${if1_status}' == 'PASS'
223 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if1_2}
224 | | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
225 | | | ... | Variable Should Exist | ${${dut}_if2}
226 | | | ${if2_pci}= | Run Keyword If | '${if2_status}' == 'PASS'
227 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if2}
228 | | | ${if2_1_pci}= | Run Keyword Unless | '${if2_status}' == 'PASS'
229 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if2_1}
230 | | | ${if2_2_pci}= | Run Keyword Unless | '${if2_status}' == 'PASS'
231 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if2_2}
232 | | | @{pci_devs}= | Run Keyword If | '${if1_status}' == 'PASS'
233 | | | ... | Create List | ${if1_pci}
234 | | | ... | ELSE
235 | | | ... | Create List | ${if1_1_pci} | ${if1_2_pci}
236 | | | Run Keyword If | '${if2_status}' == 'PASS'
237 | | | ... | Append To List | ${pci_devs} | ${if2_pci}
238 | | | ... | ELSE
239 | | | ... | Append To List | ${pci_devs} | ${if2_1_pci} | ${if2_2_pci}
240 | | | Run keyword | ${dut}.Add DPDK Dev | @{pci_devs}
241 | | | Run Keyword If | '${if1_status}' == 'PASS'
242 | | | ... | Set Test Variable | ${${dut}_if1_pci} | ${if1_pci}
243 | | | Run Keyword Unless | '${if1_status}' == 'PASS'
244 | | | ... | Set Test Variable | ${${dut}_if1_1_pci} | ${if1_1_pci}
245 | | | Run Keyword Unless | '${if1_status}' == 'PASS'
246 | | | ... | Set Test Variable | ${${dut}_if1_2_pci} | ${if1_2_pci}
247 | | | Run Keyword If | '${if2_status}' == 'PASS'
248 | | | ... | Set Test Variable | ${${dut}_if2_pci} | ${if2_pci}
249 | | | Run Keyword Unless | '${if2_status}' == 'PASS'
250 | | | ... | Set Test Variable | ${${dut}_if2_1_pci} | ${if2_1_pci}
251 | | | Run Keyword Unless | '${if2_status}' == 'PASS'
252 | | | ... | Set Test Variable | ${${dut}_if2_2_pci} | ${if2_2_pci}
253
254 | Add DPDK no PCI to all DUTs
255 | | [Documentation] | Add DPDK no-pci to VPP startup configuration to all DUTs.
256 | | ...
257 | | :FOR | ${dut} | IN | @{duts}
258 | | | Run keyword | ${dut}.Add DPDK no PCI
259
260 | Add VLAN strip offload switch off between DUTs in 3-node single link topology
261 | | [Documentation]
262 | | ... | Add VLAN Strip Offload switch off on PCI devices between DUTs to VPP
263 | | ... | configuration file.
264 | | ...
265 | | Run keyword | DUT1.Add DPDK Dev Parameter | ${dut1_if2_pci}
266 | | ... | vlan-strip-offload | off
267 | | Run keyword | DUT2.Add DPDK Dev Parameter | ${dut2_if1_pci}
268 | | ... | vlan-strip-offload | off
269
270 | Add VLAN strip offload switch off between DUTs in 3-node double link topology
271 | | [Documentation]
272 | | ... | Add VLAN Strip Offload switch off on PCI devices between DUTs to VPP
273 | | ... | configuration file
274 | | ...
275 | | Run keyword | DUT1.Add DPDK Dev Parameter | ${dut1_if2_1_pci}
276 | | ... | vlan-strip-offload | off
277 | | Run keyword | DUT1.Add DPDK Dev Parameter | ${dut1_if2_2_pci}
278 | | ... | vlan-strip-offload | off
279 | | Run keyword | DUT2.Add DPDK Dev Parameter | ${dut2_if1_1_pci}
280 | | ... | vlan-strip-offload | off
281 | | Run keyword | DUT2.Add DPDK Dev Parameter | ${dut2_if1_2_pci}
282 | | ... | vlan-strip-offload | off
283
284 | Add NAT to all DUTs
285 | | [Documentation] | Add NAT configuration to all DUTs.
286 | | ...
287 | | :FOR | ${dut} | IN | @{duts}
288 | | | Run keyword | ${dut}.Add NAT
289
290 | Write startup configuration on all VPP DUTs
291 | | [Documentation] | Write VPP startup configuration without restarting VPP.
292 | | ...
293 | | :FOR | ${dut} | IN | @{duts}
294 | | | Run keyword | ${dut}.Write Config
295
296 | Apply startup configuration on all VPP DUTs
297 | | [Documentation] | Write VPP startup configuration and restart VPP on all
298 | | ... | DUTs.
299 | | ...
300 | | ... | *Arguments:*
301 | | ... | - with_trace - Enable packet trace after VPP restart Type: boolean
302 | | ...
303 | | ... | *Example:*
304 | | ...
305 | | ... | \| Apply startup configuration on all VPP DUTs \| False \|
306 | | ...
307 | | [Arguments] | ${with_trace}=${False}
308 | | ...
309 | | :FOR | ${dut} | IN | @{duts}
310 | | | Run keyword | ${dut}.Apply Config
311 | | | Add New Socket | ${nodes['${dut}']} | PAPI | ${dut} | ${SOCKSVR_PATH}
312 | | | Add New Socket | ${nodes['${dut}']} | STATS | ${dut} | ${SOCKSTAT_PATH}
313 | | Save VPP PIDs
314 | | Enable Coredump Limit VPP on All DUTs | ${nodes}
315 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${True}
316 | | Run keyword If | ${with_trace} | VPP Enable Traces On All Duts | ${nodes}
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 | | ${duts}= | Get Matches | ${nodes} | DUT*
326 | | :FOR | ${key} | IN | @{keys}
327 | | | ${pid}= | Get From Dictionary | ${setup_vpp_pids} | ${key}
328 | | | Run Keyword If | $pid is None | FAIL | No VPP PID found on node ${key}
329 | | Set Test Variable | ${setup_vpp_pids}
330
331 | Verify VPP PID in Teardown
332 | | [Documentation] | Check if the VPP PIDs on all DUTs are the same at the end\
333 | | ... | of test as they were at the begining. If they are not, only a message\
334 | | ... | is printed on console and to log. The test will not fail.
335 | | ...
336 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
337 | | ${err_msg}= | Catenate | ${SUITE NAME} - ${TEST NAME}
338 | | ... | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
339 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
340 | | ${rc} | ${msg}= | Run keyword and ignore error
341 | | ... | Dictionaries Should Be Equal
342 | | ... | ${setup_vpp_pids} | ${teardown_vpp_pids}
343 | | Run Keyword And Return If | '${rc}'=='FAIL' | Log | ${err_msg}
344 | | ... | console=yes | level=WARN
345
346 # TODO: Cleanup when VIRL is gone.
347 | Set up functional test
348 | | [Documentation] | Common test setup for functional tests.
349 | | ...
350 | | Restart Vpp Service On All Duts | ${nodes}
351 | | Verify Vpp On All Duts | ${nodes}
352 | | VPP Enable Traces On All Duts | ${nodes}
353 | | Save VPP PIDs
354 | | All TGs Set Interface Default Driver | ${nodes}
355 | | Update All Interface Data On All Nodes | ${nodes}
356 | | Reset PAPI History On All DUTs | ${nodes}
357 | | ${duts}= | Get Matches | ${nodes} | DUT*
358 | | :FOR | ${dut} | IN | @{duts}
359 | | | Add New Socket | ${nodes['${dut}']} | PAPI | ${dut} | ${SOCKSVR_PATH}
360 | | | Add New Socket | ${nodes['${dut}']} | STATS | ${dut} | ${SOCKSTAT_PATH}
361
362 # TODO: Cleanup when VIRL is gone.
363 | Tear down functional test
364 | | [Documentation] | Common test teardown for functional tests.
365 | | ...
366 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
367 | | Show Packet Trace on All DUTs | ${nodes}
368 | | Show PAPI History On All DUTs | ${nodes}
369 | | Vpp Show Errors On All DUTs | ${nodes}
370 | | Verify VPP PID in Teardown
371 | | Clean Sockets On All Nodes | ${nodes}