Performance: Add AF_XDP tests
[csit.git] / resources / libraries / robot / shared / default.robot
1 # Copyright (c) 2021 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.Adl
24 | Library | resources.libraries.python.Classify
25 | Library | resources.libraries.python.CpuUtils
26 | Library | resources.libraries.python.CoreDumpUtil
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.IrqUtil
33 | Library | resources.libraries.python.NodePath
34 | Library | resources.libraries.python.Namespaces
35 | Library | resources.libraries.python.PapiHistory
36 | Library | resources.libraries.python.SchedUtils
37 | Library | resources.libraries.python.Tap
38 | Library | resources.libraries.python.Tap.TapFeatureMask
39 | Library | resources.libraries.python.TestConfig
40 | Library | resources.libraries.python.TGSetup
41 | Library | resources.libraries.python.topology.Topology
42 | Library | resources.libraries.python.Trace
43 | Library | resources.libraries.python.VhostUser.VirtioFeatureMask
44 | Library | resources.libraries.python.VppCounters
45 | Library | resources.libraries.python.VPPUtil
46 |
47 | Resource | resources/libraries/robot/lb/load_balancer.robot
48 | Resource | resources/libraries/robot/crypto/ipsec.robot
49 | Resource | resources/libraries/robot/features/acl.robot
50 | Resource | resources/libraries/robot/features/policer.robot
51 | Resource | resources/libraries/robot/ip/ip4.robot
52 | Resource | resources/libraries/robot/ip/ip6.robot
53 | Resource | resources/libraries/robot/ip/nat.robot
54 | Resource | resources/libraries/robot/l2/l2_bridge_domain.robot
55 | Resource | resources/libraries/robot/l2/l2_patch.robot
56 | Resource | resources/libraries/robot/l2/l2_traffic.robot
57 | Resource | resources/libraries/robot/l2/l2_xconnect.robot
58 | Resource | resources/libraries/robot/l2/tagging.robot
59 | Resource | resources/libraries/robot/overlay/srv6.robot
60 | Resource | resources/libraries/robot/overlay/lisp.robot
61 | Resource | resources/libraries/robot/overlay/lispgpe.robot
62 | Resource | resources/libraries/robot/overlay/lisp_api.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/traffic.robot
72 | Resource | resources/libraries/robot/shared/vm.robot
73
74 *** Variables ***
75 | ${cpu_alloc_str}= | ${0}
76
77 *** Keywords ***
78 # TODO: Sort keywords alphabetically.
79
80 | Call Resetter
81 | | [Documentation]
82 | | ... | Check for a presence of test variable \${resetter}.
83 | | ... | If it exists (and not None), call the resetter (as a Python callable).
84 | | ... | This is usually used to reset any state on DUT before next trial.
85 | |
86 | | ... | TODO: Move to a more specific library if needed.
87 | |
88 | | ... | *Example:*
89 | |
90 | | ... | \| Call Resetter \|
91 | |
92 | | ${resetter} = | Get Resetter
93 | | # See http://robotframework.org/robotframework/3.1.2/libraries/BuiltIn.html
94 | | # #Evaluating%20expressions for $variable (without braces) syntax.
95 | | # Parens are there to perform the call.
96 | | Run Keyword If | $resetter | Evaluate | $resetter()
97
98 | Verify statistic commands
99 | | [Documentation]
100 | | ... | Execute several commands related to stats.
101 | | ... | To be used by "stats" device tests,
102 | | ... | as other device tests do not interact with stats.
103 | |
104 | | ... | The commands should also cover frequently used
105 | | ... | PAPI (non-stats) commands and CLI commands.
106 | |
107 | | ${results}= | Create List
108 | | ${status} | ${value}= | Run Keyword And Ignore Error
109 | | ... | VPP Show Runtime On All DUTs | ${nodes}
110 | | Append To List | ${results} | ${status}
111 | | ${status} | ${value}= | Run Keyword And Ignore Error
112 | | ... | Show Statistics On All DUTs | ${nodes}
113 | | Append To List | ${results} | ${status}
114 | | ${status} | ${value}= | Run Keyword And Ignore Error
115 | | ... | Show Event Logger On All DUTs | ${nodes}
116 | | Append To List | ${results} | ${status}
117 | | ${status} | ${value}= | Run Keyword And Ignore Error
118 | | ... | VPP Clear Runtime On All DUTs | ${nodes}
119 | | Append To List | ${results} | ${status}
120 | | ${status} | ${value}= | Run Keyword And Ignore Error
121 | | ... | Clear Statistics On All DUTs | ${nodes}
122 | | Append To List | ${results} | ${status}
123 | | Should Not Contain Match | ${results} | FAIL
124 | | ... | msg=At least one of statistic commands failed!
125
126 | Workers From Physical Cores
127 | | [Documentation]
128 | | ... | Convert from core count to worker count.
129 | |
130 | | ... | This just calls CpuUtils.worker_count_from_cores_and_smt keyword
131 | | ... | with the global \${smt_used} value.
132 | | ... | See documentation there.
133 | |
134 | | ... | *Arguments:*
135 | | ... | - phy_cores - Number of physical cores to convert from. Type: integer.
136 | |
137 | | ... | *Return value:*
138 | | ... | - Number of workers active on the given number of cores.
139 | |
140 | | ... | *Example:*
141 | |
142 | | ... | \| \${dp_workers} = \| Workers from Physical Cores \| \${1} \|
143 | |
144 | | [Arguments] | ${phy_cores}
145 | |
146 | | Run Keyword And Return | Worker Count From Cores And Smt
147 | | ... | phy_cores=${phy_cores} | smt_used=${smt_used}
148
149 | Configure crypto device on all DUTs
150 | | [Documentation] | Verify if Crypto QAT device virtual functions are
151 | | ... | initialized on all DUTs. If parameter force_init is set to True, then
152 | | ... | try to initialize/disable.
153 | |
154 | | ... | *Arguments:*
155 | | ... | - crypto_type - Crypto device type - HW_DH895xcc or HW_C3xxx; default
156 | | ... | value: HW_DH895xcc. Type: string
157 | | ... | - numvfs - Number of VFs to initialize, 0 - disable the VFs; default
158 | | ... | value: ${32} Type: integer
159 | | ... | - force_init - Force to initialize. Type: boolean
160 | |
161 | | ... | *Example:*
162 | |
163 | | ... | \| Configure crypto device on all DUTs \| HW_DH895xcc \| ${32} \|
164 | |
165 | | [Arguments] | ${crypto_type} | ${numvfs} | ${force_init}=${False}
166 | |
167 | | FOR | ${dut} | IN | @{duts}
168 | | | Crypto Device Verify | ${nodes['${dut}']} | ${crypto_type}
169 | | | ... | ${numvfs} | force_init=${force_init}
170 | | END
171
172 | Configure kernel module on all DUTs
173 | | [Documentation] | Verify if specific kernel module is loaded on all DUTs.
174 | | ... | If parameter force_load is set to True, then try to load.
175 | |
176 | | ... | *Arguments:*
177 | | ... | - module - Module to verify. Type: string
178 | | ... | - force_load - Try to load module. Type: boolean
179 | |
180 | | ... | *Example:*
181 | |
182 | | ... | \| Configure kernel module on all DUTs \| ${True} \|
183 | |
184 | | [Arguments] | ${module} | ${force_load}=${False}
185 | |
186 | | Verify Kernel Module on All DUTs | ${nodes} | ${module}
187 | | ... | force_load=${force_load}
188
189 | Get Keyname for DUT
190 | | [Documentation]
191 | | ... | Get the Keyname for the DUT in the keyname list.
192 | | ... | Returns lowercase keyname value.
193 | |
194 | | ... | *Arguments:*
195 | | ... | - dutx - DUT to find keyname. Type: dict
196 | | ... | - dut_keys - DUT Keynames to search. Type: list
197 | |
198 | | ... | *Example:*
199 | |
200 | | ... | \| Get Keyname for DUT \| ${dutx} \| ${duts} \|
201 | |
202 | | [Arguments] | ${dutx} | ${dut_keys}
203 | |
204 | | FOR | ${key} | IN | @{dut_keys}
205 | | | ${found_key} | ${value}= | Run Keyword And Ignore Error
206 | | | ... | Dictionaries Should Be Equal | ${nodes['${key}']} | ${dutx}
207 | | | Run Keyword If | '${found_key}' == 'PASS' | EXIT FOR LOOP
208 | | END
209 | | Run Keyword If | '${found_key}' != 'PASS'
210 | | ... | Fail | Keyname for ${dutx} not found
211 | | ${keyname}= | Convert To Lowercase | ${key}
212 | | Return From Keyword | ${keyname}
213
214 | Create base startup configuration of VPP on all DUTs
215 | | [Documentation] | Create base startup configuration of VPP to all DUTs.
216 | |
217 | | FOR | ${dut} | IN | @{duts}
218 | | | Import Library | resources.libraries.python.VppConfigGenerator
219 | | | ... | WITH NAME | ${dut}
220 | | | Run Keyword | ${dut}.Set Node | ${nodes['${dut}']} | node_key=${dut}
221 | | | Run Keyword | ${dut}.Add Unix Log
222 | | | Run Keyword | ${dut}.Add Unix CLI Listen
223 | | | Run Keyword | ${dut}.Add Unix Nodaemon
224 | | | Run Keyword | ${dut}.Add Unix Coredump
225 | | | Run Keyword | ${dut}.Add Socksvr | ${SOCKSVR_PATH}
226 | | | Run Keyword | ${dut}.Add Main Heap Size | ${${heap_size_mult}*${2}}G
227 | | | Run Keyword | ${dut}.Add Main Heap Page Size | 2M
228 | | | Run Keyword | ${dut}.Add Statseg Size | 2G
229 | | | Run Keyword | ${dut}.Add Statseg Page Size | 2M
230 | | | Run Keyword | ${dut}.Add Statseg Per Node Counters | on
231 | | | Run Keyword | ${dut}.Add Plugin | disable | default
232 | | | Run Keyword | ${dut}.Add Plugin | enable | @{plugins_to_enable}
233 | | | Run Keyword | ${dut}.Add IP6 Hash Buckets | 2000000
234 | | | Run Keyword | ${dut}.Add IP6 Heap Size | 4G
235 | | | Run Keyword | ${dut}.Add Graph Node Variant | ${GRAPH_NODE_VARIANT}
236 | | END
237
238 | Add worker threads to all DUTs
239 | | [Documentation] | Setup worker threads in vpp startup configuration on all
240 | | ... | DUTs. Based on the SMT configuration of DUT if enabled keyword will
241 | | ... | automatically map also the sibling logical cores.
242 | | ... | Keyword will automatically set the appropriate test TAGs in format
243 | | ... | mTnC, where m=logical_core_count and n=physical_core_count.
244 | | ... | RXQ are computed automatically by dividing thread count with number 2
245 | | ... | (TODO: Add division by actual number of interfaces). User can manually
246 | | ... | override RX, RXD, TXD parameters if needed.
247 | |
248 | | ... | *Arguments:*
249 | | ... | - phy_cores - Number of physical cores to use. Type: integer
250 | | ... | - rx_queues - Number of RX queues. Type: integer
251 | | ... | - rxd - Number of RX descriptors. Type: integer
252 | | ... | - txd - Number of TX descriptors. Type: integer
253 | |
254 | | ... | *Example:*
255 | |
256 | | ... | \| Add worker threads to all DUTs \| ${1} \| ${1} \|
257 | |
258 | | [Arguments] | ${phy_cores} | ${rx_queues}=${None} | ${rxd}=${None}
259 | | ... | ${txd}=${None}
260 | |
261 | | ${cpu_count_int} | Convert to Integer | ${phy_cores}
262 | | ${thr_count_int} | Convert to Integer | ${phy_cores}
263 | | ${rxd_count_int}= | Set variable | ${rxd}
264 | | ${txd_count_int}= | Set variable | ${txd}
265 | | FOR | ${dut} | IN | @{duts}
266 | | | ${numa}= | Get interfaces numa node
267 | | | ... | ${nodes['${dut}']} | @{${dut}_pf_keys}
268 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
269 | | | ${skip_cnt}= | Set variable | ${CPU_CNT_SYSTEM}
270 | | | ${cpu_main}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
271 | | | ... | skip_cnt=${skip_cnt} | cpu_cnt=${CPU_CNT_MAIN}
272 | | | ${skip_cnt}= | Evaluate | ${CPU_CNT_SYSTEM} + ${CPU_CNT_MAIN}
273 | | | ${cpu_wt}= | Run Keyword If | ${cpu_count_int} > 0 |
274 | | | ... | Cpu list per node str | ${nodes['${dut}']} | ${numa}
275 | | | ... | skip_cnt=${skip_cnt} | cpu_cnt=${cpu_count_int}
276 | | | ... | smt_used=${smt_used}
277 | | | ${thr_count_int}= | Run Keyword If | ${smt_used}
278 | | | ... | Evaluate | int(${cpu_count_int}*2)
279 | | | ... | ELSE | Set variable | ${thr_count_int}
280 | | | ${rxq_ratio} = | Get Variable Value | \${rxq_ratio} | ${1}
281 | | | ${rxq_count_int}= | Run Keyword If | ${rx_queues}
282 | | | ... | Set variable | ${rx_queues}
283 | | | ... | ELSE | Evaluate | int(${thr_count_int}/${rxq_ratio})
284 | | | ${rxq_count_int}= | Run Keyword If | ${rxq_count_int} == 0
285 | | | ... | Set variable | ${1}
286 | | | ... | ELSE | Set variable | ${rxq_count_int}
287 | | | Run Keyword | ${dut}.Add CPU Main Core | ${cpu_main}
288 | | | Run Keyword If | ${cpu_count_int} > 0
289 | | | ... | ${dut}.Add CPU Corelist Workers | ${cpu_wt}
290 | | | Run Keyword If | ${smt_used}
291 | | | ... | Run Keyword | ${dut}.Add Buffers Per Numa | ${215040} | ELSE
292 | | | ... | Run Keyword | ${dut}.Add Buffers Per Numa | ${107520}
293 | | | Run Keyword If | ${thr_count_int} > 1
294 | | | ... | Set Tags | MTHREAD | ELSE | Set Tags | STHREAD
295 | | | Set Tags | ${thr_count_int}T${cpu_count_int}C
296 | | END
297 | | ${cpu_alloc_str}= | Catenate | SEPARATOR=, | ${cpu_alloc_str} | ${cpu_main}
298 | | ${cpu_alloc_str}= | Catenate | SEPARATOR=, | ${cpu_alloc_str} | ${cpu_wt}
299 | | Set Test Variable | ${smt_used}
300 | | Set Test Variable | ${cpu_alloc_str}
301 | | Set Test Variable | ${cpu_count_int}
302 | | Set Test Variable | ${thr_count_int}
303 | | Set Test Variable | ${rxd_count_int}
304 | | Set Test Variable | ${txd_count_int}
305 | | Set Test Variable | ${rxq_count_int}
306
307 | Add worker threads for GSO tests to all DUTs
308 | | [Documentation] | Setup worker threads in vpp startup configuration on all
309 | | ... | DUTs. Based on the SMT configuration of DUT if enabled keyword will
310 | | ... | automatically map also the sibling logical cores.
311 | | ... | Keyword will automatically set the appropriate test TAGs in format
312 | | ... | mTnC, where m=logical_core_count and n=physical_core_count.
313 | | ... | RXQ are computed automatically by dividing thread count with number 2
314 | | ... | (TODO: Add division by actual number of interfaces). User can manually
315 | | ... | override RX, RXD, TXD parameters if needed.
316 | |
317 | | ... | *Arguments:*
318 | | ... | - phy_cores - Number of physical cores to use. Type: integer
319 | | ... | - rx_queues - Number of RX queues. Type: integer
320 | | ... | - rxd - Number of RX descriptors. Type: integer
321 | | ... | - txd - Number of TX descriptors. Type: integer
322 | |
323 | | ... | *Example:*
324 | |
325 | | ... | \| Add worker threads for GSO tests to all DUTs \| ${1} \| ${1} \|
326 | |
327 | | [Arguments] | ${phy_cores} | ${rx_queues}=${None} | ${rxd}=${None}
328 | | ... | ${txd}=${None}
329 | |
330 | | ${cpu_count_int} | Convert to Integer | ${phy_cores}
331 | | ${thr_count_int} | Convert to Integer | ${phy_cores}
332 | | ${rxd_count_int}= | Set variable | ${rxd}
333 | | ${txd_count_int}= | Set variable | ${txd}
334 | | FOR | ${dut} | IN | @{duts}
335 | | | ${numa}= | Get interfaces numa node
336 | | | ... | ${nodes['${dut}']} | @{${dut}_pf_keys}
337 | | | ${smt_used}= | Set variable | ${False}
338 | | | ${skip_cnt}= | Set variable | ${CPU_CNT_SYSTEM}
339 | | | ${cpu_main}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
340 | | | ... | skip_cnt=${skip_cnt} | cpu_cnt=${CPU_CNT_MAIN}
341 | | | ${skip_cnt}= | Evaluate | ${CPU_CNT_SYSTEM} + ${CPU_CNT_MAIN}
342 | | | ${cpu_wt}= | Run Keyword If | ${cpu_count_int} > 0 |
343 | | | ... | Cpu list per node str | ${nodes['${dut}']} | ${numa}
344 | | | ... | skip_cnt=${skip_cnt} | cpu_cnt=${cpu_count_int}
345 | | | ... | smt_used=${smt_used}
346 | | | ${thr_count_int}= | Run Keyword If | ${smt_used}
347 | | | ... | Evaluate | int(${cpu_count_int}*2)
348 | | | ... | ELSE | Set variable | ${thr_count_int}
349 | | | ${rxq_ratio} = | Get Variable Value | \${rxq_ratio} | ${1}
350 | | | ${rxq_count_int}= | Run Keyword If | ${rx_queues}
351 | | | ... | Set variable | ${rx_queues}
352 | | | ... | ELSE | Evaluate | int(${thr_count_int}/${rxq_ratio})
353 | | | ${rxq_count_int}= | Run Keyword If | ${rxq_count_int} == 0
354 | | | ... | Set variable | ${1}
355 | | | ... | ELSE | Set variable | ${rxq_count_int}
356 | | | Run Keyword | ${dut}.Add CPU Main Core | ${cpu_main}
357 | | | Run Keyword If | ${cpu_count_int} > 0
358 | | | ... | ${dut}.Add CPU Corelist Workers | ${cpu_wt}
359 | | | Run Keyword If | ${smt_used}
360 | | | ... | Run Keyword | ${dut}.Add Buffers Per Numa | ${215040} | ELSE
361 | | | ... | Run Keyword | ${dut}.Add Buffers Per Numa | ${107520}
362 | | | Run Keyword If | ${thr_count_int} > 1
363 | | | ... | Set Tags | MTHREAD | ELSE | Set Tags | STHREAD
364 | | | Set Tags | ${thr_count_int}T${cpu_count_int}C
365 | | END
366 | | ${cpu_alloc_str}= | Catenate | SEPARATOR=, | ${cpu_alloc_str} | ${cpu_main}
367 | | ${cpu_alloc_str}= | Catenate | SEPARATOR=, | ${cpu_alloc_str} | ${cpu_wt}
368 | | Set Test Variable | ${smt_used}
369 | | Set Test Variable | ${cpu_alloc_str}
370 | | Set Test Variable | ${cpu_count_int}
371 | | Set Test Variable | ${thr_count_int}
372 | | Set Test Variable | ${rxd_count_int}
373 | | Set Test Variable | ${txd_count_int}
374 | | Set Test Variable | ${rxq_count_int}
375
376 | Add DPDK VLAN strip offload switch off between DUTs
377 | | [Documentation]
378 | | ... | Add VLAN Strip Offload switch off on PCI devices between DUTs to VPP
379 | | ... | configuration file.
380 | |
381 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
382 | | | ${_even}= | Evaluate | ${pf} % 2
383 | | | Run Keyword Unless | ${even}
384 | | | ... | DUT1.Add DPDK Dev Parameter | ${DUT1_${int}${pf}_pci}[0]
385 | | | ... | vlan-strip-offload | off
386 | | END
387 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
388 | | | ${_even}= | Evaluate | ${pf} % 2
389 | | | Run Keyword If | ${even}
390 | | | ... | DUT2.Add DPDK Dev Parameter | ${DUT2_${int}${pf}_pci}[0]
391 | | | ... | vlan-strip-offload | off
392 | | END
393
394 | Add NAT to all DUTs
395 | | [Documentation] | Add NAT configuration to all DUTs.
396 | |
397 | | ... | *Arguments:*
398 | | ... | - nat_mode - NAT mode; default value: deterministic. Type: string
399 | |
400 | | ... | *Example:*
401 | |
402 | | ... | \| Add NAT to all DUTs \| nat_mode=endpoint-dependent \|
403 | |
404 | | [Arguments] | ${nat_mode}=deterministic
405 | |
406 | | FOR | ${dut} | IN | @{duts}
407 | | | Run Keyword | ${dut}.Add NAT | value=${nat_mode}
408 | | END
409
410 | Add NAT max translations per thread to all DUTs
411 | | [Documentation] | Add NAT maximum number of translations per thread
412 | | ... | configuration.
413 | |
414 | | ... | *Arguments:*
415 | | ... | - max_translations_per_thread - NAT maximum number of translations per
416 | | ... | thread. Type: string
417 | |
418 | | ... | *Example:*
419 | |
420 | | ... | \| Add NAT translation memory to all DUTs \
421 | | ... | \| max_translations_per_thread=2048 \|
422 | |
423 | | [Arguments] | ${max_translations_per_thread}=1024
424 | |
425 | | FOR | ${dut} | IN | @{duts}
426 | | | Run Keyword | ${dut}.Add NAT max translations per thread
427 | | | ... | value=${max_translations_per_thread}
428 | | END
429
430 | Write startup configuration on all VPP DUTs
431 | | [Documentation] | Write VPP startup configuration without restarting VPP.
432 | |
433 | | FOR | ${dut} | IN | @{duts}
434 | | | Run Keyword | ${dut}.Write Config
435 | | END
436
437 | Apply startup configuration on all VPP DUTs
438 | | [Documentation] | Write VPP startup configuration and restart VPP on all
439 | | ... | DUTs.
440 | |
441 | | ... | *Arguments:*
442 | | ... | - with_trace - Enable packet trace after VPP restart Type: boolean
443 | |
444 | | ... | *Example:*
445 | |
446 | | ... | \| Apply startup configuration on all VPP DUTs \| False \|
447 | |
448 | | [Arguments] | ${with_trace}=${False}
449 | |
450 | | FOR | ${dut} | IN | @{duts}
451 | | | Run Keyword | ${dut}.Apply Config
452 | | END
453 | | Save VPP PIDs
454 | | Enable Coredump Limit VPP on All DUTs | ${nodes}
455 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${True}
456 | | Run Keyword If | ${with_trace} | VPP Enable Traces On All Duts | ${nodes}
457
458 | Apply startup configuration on VPP DUT
459 | | [Documentation] | Write VPP startup configuration and restart VPP DUT.
460 | |
461 | | ... | *Arguments:*
462 | | ... | - dut - DUT on which to apply the configuration. Type: string
463 | | ... | - with_trace - Enable packet trace after VPP restart Type: boolean
464 | |
465 | | [Arguments] | ${dut} | ${with_trace}=${False}
466 | |
467 | | Run Keyword | ${dut}.Apply Config
468 | | Save VPP PIDs on DUT | ${dut}
469 | | Enable Coredump Limit VPP on DUT | ${nodes['${dut}']}
470 | | ${dutnode}= | Copy Dictionary | ${nodes}
471 | | Keep In Dictionary | ${dutnode} | ${dut}
472 | | Update All Interface Data On All Nodes | ${dutnode} | skip_tg=${True}
473 | | Run Keyword If | ${with_trace} | VPP Enable Traces On Dut
474 | | ... | ${nodes['${dut}']}
475
476 | Save VPP PIDs
477 | | [Documentation] | Get PIDs of VPP processes from all DUTs in topology and\
478 | | ... | set it as a test variable. The PIDs are stored as dictionary items\
479 | | ... | where the key is the host and the value is the PID.
480 | |
481 | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes}
482 | | ${keys}= | Get Dictionary Keys | ${setup_vpp_pids}
483 | | FOR | ${key} | IN | @{keys}
484 | | | ${pid}= | Get From Dictionary | ${setup_vpp_pids} | ${key}
485 | | | Run Keyword If | $pid is None | FAIL | No VPP PID found on node ${key}
486 | | END
487 | | Set Test Variable | ${setup_vpp_pids}
488
489 | Save VPP PIDs on DUT
490 | | [Documentation] | Get PID of VPP processes from DUT and\
491 | | ... | set it as a test variable. The PID is stored as dictionary item\
492 | | ... | where the key is the host and the value is the PID.
493 | |
494 | | [Arguments] | ${dut}
495 | |
496 | | ${vpp_pids}= | Get VPP PID | ${nodes['${dut}']}
497 | | Run Keyword If | ${vpp_pids} is None | FAIL
498 | | ... | No VPP PID found on node ${nodes['${dut}']['host']
499 | | ${status} | ${message}= | Run Keyword And Ignore Error
500 | | ... | Variable Should Exist | ${setup_vpp_pids}
501 | | ${setup_vpp_pids}= | Run Keyword If | '${status}' == 'FAIL'
502 | | ... | Create Dictionary | ${nodes['${dut}']['host']}=${vpp_pids}
503 | | ... | ELSE | Set To Dictionary | ${setup_vpp_pids}
504 | | ... | ${nodes['${dut}']['host']}=${vpp_pids}
505 | | Set Test Variable | ${setup_vpp_pids}
506
507 | Verify VPP PID in Teardown
508 | | [Documentation] | Check if the VPP PIDs on all DUTs are the same at the end\
509 | | ... | of test as they were at the begining. If they are not, only a message\
510 | | ... | is printed on console and to log. The test will not fail.
511 | |
512 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
513 | | ${err_msg}= | Catenate | ${SUITE NAME} - ${TEST NAME}
514 | | ... | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
515 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
516 | | ${rc} | ${msg}= | Run Keyword And Ignore Error
517 | | ... | Dictionaries Should Be Equal
518 | | ... | ${setup_vpp_pids} | ${teardown_vpp_pids}
519 | | Run Keyword And Return If | '${rc}'=='FAIL' | Log | ${err_msg}
520 | | ... | console=yes | level=WARN