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