Add dpdk max-simd-bitwidth configuration.
[csit.git] / resources / libraries / robot / shared / interfaces.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 *** Settings ***
14 | Library | resources.libraries.python.InterfaceUtil
15 | Library | resources.libraries.python.NodePath
16 | Library | resources.libraries.python.VhostUser
17
18 *** Variables ***
19 | ${dpdk_no_tx_checksum_offload}= | ${True}
20
21 *** Keywords ***
22 | Set single interfaces in path up
23 | | [Documentation]
24 | | ... | *Set UP state on single physical VPP interfaces in path on all DUT
25 | | ... | nodes and set maximal MTU.*
26 | |
27 | | ... | *Arguments:*
28 | | ... | - pf - NIC physical function (physical port).
29 | | ... | Type: integer
30 | |
31 | | ... | *Example:*
32 | |
33 | | ... | \| Set single interfaces in path \| 1 \|
34 | |
35 | | [Arguments] | ${pf}=${1}
36 | |
37 | | FOR | ${dut} | IN | @{duts}
38 | | | Set interfaces in path up on node on PF | ${dut} | ${pf}
39 | | END
40 | | All VPP Interfaces Ready Wait | ${nodes} | retries=${60}
41
42 | Set interfaces in path up
43 | | [Documentation]
44 | | ... | *Set UP state on VPP interfaces in path on all DUT nodes and set
45 | | ... | maximal MTU.*
46 | |
47 | | ... | *Arguments:*
48 | | ... | - validate - Validate interfaces are up.
49 | | ... | Type: boolean
50 | |
51 | | [Arguments] | ${validate}=${True}
52 | |
53 | | FOR | ${dut} | IN | @{duts}
54 | | | Set interfaces in path up on node | ${dut}
55 | | END
56 | | Run Keyword If | ${validate}
57 | | ... | All VPP Interfaces Ready Wait | ${nodes} | retries=${60}
58
59 | Set interfaces in path up on node
60 | | [Documentation]
61 | | ... | *Set UP state on VPP interfaces in path on specified DUT node and
62 | | ... | set maximal MTU.*
63 | |
64 | | ... | *Arguments:*
65 | | ... | - dut - DUT node on which to set the interfaces up.
66 | | ... | Type: string
67 | |
68 | | ... | *Example:*
69 | |
70 | | ... | \| Set interfaces in path up on node \| DUT1 \|
71 | |
72 | | [Arguments] | ${dut}
73 | |
74 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
75 | | | Set interfaces in path up on node on PF | ${dut} | ${pf}
76 | | END
77
78 | Set interfaces in path up on node on PF
79 | | [Documentation]
80 | | ... | *Set UP state on VPP interfaces in path on specified DUT node and
81 | | ... | set maximal MTU.*
82 | |
83 | | ... | *Arguments:*
84 | | ... | - dut - DUT node on which to set the interfaces up.
85 | | ... | Type: string
86 | | ... | - pf - NIC physical function (physical port).
87 | | ... | Type: integer
88 | |
89 | | ... | *Example:*
90 | |
91 | | ... | \| Set interfaces in path up on node on PF \| DUT1 \| 1 \|
92 | |
93 | | [Arguments] | ${dut} | ${pf}
94 | |
95 | | ${_chains} | ${value}= | Run Keyword And Ignore Error
96 | | ... | Variable Should Exist | @{${dut}_${int}${pf}_1}
97 | | ${_id}= | Set Variable If | '${_chains}' == 'PASS' | _1 | ${EMPTY}
98 | | FOR | ${if} | IN | @{${dut}_${int}${pf}${_id}}
99 | | | Set Interface State | ${nodes['${dut}']} | ${if} | up
100 | | | VPP Set Interface MTU | ${nodes['${dut}']} | ${if}
101 | | END
102
103 | Pre-initialize layer driver
104 | | [Documentation]
105 | | ... | Pre-initialize driver based interfaces on each DUT.
106 | |
107 | | ... | *Arguments:*
108 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
109 | | ... | Type: string
110 | |
111 | | ... | *Example:*
112 | |
113 | | ... | \| Pre-initialize layer driver \| vfio-pci \|
114 | |
115 | | [Arguments] | ${driver}
116 | |
117 | | Run Keyword | Pre-initialize layer ${driver} on all DUTs
118
119 | Pre-initialize layer tap on all DUTs
120 | | [Documentation]
121 | | ... | Pre-initialize tap driver. Currently no operation.
122 | |
123 | | No operation
124
125 | Pre-initialize layer vhost on all DUTs
126 | | [Documentation]
127 | | ... | Pre-initialize vhost driver. Currently no operation.
128 | |
129 | | No operation
130
131 | Pre-initialize layer vfio-pci on all DUTs
132 | | [Documentation]
133 | | ... | Pre-initialize vfio-pci driver by adding related sections to startup
134 | | ... | config on all DUTs.
135 | |
136 | | ${index}= | Get Index From List | ${TEST TAGS} | DPDK
137 | | Run Keyword If | ${index} >= 0 | Return From Keyword
138 | | FOR | ${dut} | IN | @{duts}
139 | | | Stop VPP Service | ${nodes['${dut}']}
140 | | | PCI Driver Unbind List | ${nodes['${dut}']} | @{${dut}_pf_pci}
141 | | | Run keyword | ${dut}.Add DPDK Dev | @{${dut}_pf_pci}
142 | | | Run Keyword If | ${dpdk_no_tx_checksum_offload}
143 | | | ... | ${dut}.Add DPDK No Tx Checksum Offload
144 | | | Run Keyword | ${dut}.Add DPDK Log Level | debug
145 | | | Run Keyword | ${dut}.Add DPDK Uio Driver | vfio-pci
146 | | | Run Keyword | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
147 | | | Run Keyword If | not ${jumbo}
148 | | | ... | ${dut}.Add DPDK No Multi Seg
149 | | | Run Keyword If | ${nic_rxq_size} > 0
150 | | | ... | ${dut}.Add DPDK Dev Default RXD | ${nic_rxq_size}
151 | | | Run Keyword If | ${nic_txq_size} > 0
152 | | | ... | ${dut}.Add DPDK Dev Default TXD | ${nic_txq_size}
153 | | | Run Keyword If | '${crypto_type}' != '${None}'
154 | | | ... | ${dut}.Add DPDK Cryptodev | ${thr_count_int}
155 | | | Run Keyword | ${dut}.Add DPDK Max Simd Bitwidth | ${GRAPH_NODE_VARIANT}
156 | | END
157 | | ${_vlan_strip} | ${value}= | Run Keyword And Ignore Error
158 | | ... | Variable Should Exist | ${vlan_strip_off}
159 | | Run keyword If | '${_vlan_strip}' == 'PASS' and ${duts_count} == 2
160 | | ... | Add DPDK VLAN strip offload switch off between DUTs
161
162 | Pre-initialize layer avf on all DUTs
163 | | [Documentation]
164 | | ... | Pre-initialize avf driver. Currently no operation.
165 | |
166 | | No operation
167
168 | Pre-initialize layer rdma-core on all DUTs
169 | | [Documentation]
170 | | ... | Pre-initialize rdma-core driver.
171 | |
172 | | FOR | ${dut} | IN | @{duts}
173 | | | Set Interface Flow Control
174 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rx="off" | tx="off"
175 | | | Set PCI Parameter
176 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | key="68.w" | value="3BCD"
177 | | END
178
179 | Pre-initialize layer mlx5_core on all DUTs
180 | | [Documentation]
181 | | ... | Pre-initialize mlx5_core driver.
182 | |
183 | | FOR | ${dut} | IN | @{duts}
184 | | | Run Keyword If | ${jumbo}
185 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=9200
186 | | | ... | ELSE
187 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=1500
188 | | | Set Interface Flow Control
189 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rx="off" | tx="off"
190 | | | Set PCI Parameter
191 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | key="68.w" | value="3BCD"
192 | | END
193
194 | Initialize layer driver
195 | | [Documentation]
196 | | ... | Initialize driver based interfaces on all DUT. Interfaces are
197 | | ... | brought up.
198 | |
199 | | ... | *Arguments:*
200 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
201 | | ... | Type: string
202 | | ... | - validate - Validate interfaces are up.
203 | | ... | Type: boolean
204 | |
205 | | ... | *Example:*
206 | |
207 | | ... | \| Initialize layer driver \| vfio-pci \|
208 | |
209 | | [Arguments] | ${driver} | ${validate}=${True}
210 | |
211 | | FOR | ${dut} | IN | @{duts}
212 | | | Initialize layer driver on node | ${dut} | ${driver}
213 | | END
214 | | Set Test Variable | ${int} | vf
215 | | Set interfaces in path up | validate=${validate}
216
217 | Initialize layer driver on node
218 | | [Documentation]
219 | | ... | Initialize driver based interfaces on DUT.
220 | |
221 | | ... | *Arguments:*
222 | | ... | - dut - DUT node.
223 | | ... | Type: string
224 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
225 | | ... | Type: string
226 | |
227 | | ... | *Example:*
228 | |
229 | | ... | \| Initialize layer driver \| DUT1 \| vfio-pci \|
230 | |
231 | | [Arguments] | ${dut} | ${driver}
232 | |
233 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
234 | | | ${_vf}=
235 | | | ... | Copy List | ${${dut}_${int}${pf}}
236 | | | ${_ip4_addr}=
237 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_addr}
238 | | | ${_ip4_prefix}=
239 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_prefix}
240 | | | ${_mac}=
241 | | | ... | Copy List | ${${dut}_${int}${pf}_mac}
242 | | | ${_pci}=
243 | | | ... | Copy List | ${${dut}_${int}${pf}_pci}
244 | | | ${_vlan}=
245 | | | ... | Copy List | ${${dut}_${int}${pf}_vlan}
246 | | | Set Test Variable
247 | | | ... | ${${dut}_vf${pf}} | ${_vf}
248 | | | Set Test Variable
249 | | | ... | ${${dut}_vf${pf}_ip4_addr} | ${_ip4_addr}
250 | | | Set Suite Variable
251 | | | ... | ${${dut}_vf${pf}_ip4_prefix} | ${_ip4_prefix}
252 | | | Set Test Variable
253 | | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
254 | | | Set Test Variable
255 | | | ... | ${${dut}_vf${pf}_pci} | ${_pci}
256 | | | Set Test Variable
257 | | | ... | ${${dut}_vf${pf}_vlan} | ${_vlan}
258 | | | Run Keyword | Initialize layer ${driver} on node | ${dut} | ${pf}
259 | | END
260
261 | Initialize layer tap on node
262 | | [Documentation]
263 | | ... | Initialize tap interfaces on DUT.
264 | |
265 | | ... | *Arguments:*
266 | | ... | - dut - DUT node.
267 | | ... | Type: string
268 | | ... | - pf - TAP ID (logical port).
269 | | ... | Type: integer
270 | |
271 | | ... | *Example:*
272 | |
273 | | ... | \| Initialize layer tap on node \| DUT1 \| 0 \|
274 | |
275 | | [Arguments] | ${dut} | ${pf}
276 | |
277 | | Create Namespace
278 | | ... | ${nodes['${dut}']} | tap${${pf}-1}_namespace
279 | | ${tap_feature_mask}= | Create Tap feature mask | gso=${enable_gso}
280 | | ${_tap}=
281 | | ... | And Add Tap Interface | ${nodes['${dut}']} | tap${${pf}-1}
282 | | ... | host_namespace=tap${${pf}-1}_namespace
283 | | ... | num_rx_queues=${rxq_count_int}
284 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
285 | | ... | tap_feature_mask=${tap_feature_mask}
286 | | ${_mac}=
287 | | ... | Get Interface MAC | ${nodes['${dut}']} | tap${pf}
288 | | ${_tap}= | Create List | ${_tap}
289 | | ${_mac}= | Create List | ${_mac}
290 | | Vhost User Affinity
291 | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0]
292 | | ... | skip_cnt=${${CPU_CNT_MAIN}+${CPU_CNT_SYSTEM}+${cpu_count_int}}
293 | | Set Test Variable
294 | | ... | ${${dut}_vf${pf}} | ${_tap}
295 | | Set Test Variable
296 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
297
298 | Initialize layer vhost on node
299 | | [Documentation]
300 | | ... | Initialize vhost interfaces on DUT.
301 | |
302 | | ... | *Arguments:*
303 | | ... | - dut - DUT node.
304 | | ... | Type: string
305 | | ... | - pf - VHOST ID (logical port).
306 | | ... | Type: integer
307 | |
308 | | ... | *Example:*
309 | |
310 | | ... | \| Initialize layer vhost on node \| DUT1 \| 0 \|
311 | |
312 | | [Arguments] | ${dut} | ${pf}
313 | |
314 | | ${virtio_feature_mask}= | Create Virtio feature mask | gso=${enable_gso}
315 | | ${vhost}= | Vpp Create Vhost User Interface
316 | | ... | ${nodes['${dut}']} | /var/run/vpp/sock-${pf}-1
317 | | ... | is_server=${True} | virtio_feature_mask=${virtio_feature_mask}
318 | | ${_mac}=
319 | | ... | Get Interface MAC | ${nodes['${dut}']} | vhost${pf}
320 | | ${_vhost}= | Create List | ${_vhost}
321 | | ${_mac}= | Create List | ${_mac}
322 | | Set Test Variable
323 | | ... | ${${dut}_vf${pf}} | ${_vhost}
324 | | Set Test Variable
325 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
326
327 | Initialize layer vfio-pci on node
328 | | [Documentation]
329 | | ... | Initialize vfio-pci interfaces on DUT on NIC PF.
330 | | ... | Currently no operation.
331 | |
332 | | ... | *Arguments:*
333 | | ... | - dut - DUT node. Type: string
334 | | ... | - pf - NIC physical function (physical port). Type: integer
335 | |
336 | | ... | *Example:*
337 | |
338 | | ... | \| Initialize layer vfio-pci on node \| DUT1 \| 1 \|
339 | |
340 | | [Arguments] | ${dut} | ${pf}
341 | |
342 | | No operation
343
344 | Initialize layer avf on node
345 | | [Documentation]
346 | | ... | Initialize AVF (Intel) interfaces on DUT on NIC PF.
347 | |
348 | | ... | *Arguments:*
349 | | ... | - dut - DUT node. Type: string
350 | | ... | - pf - NIC physical function (physical port). Type: integer
351 | |
352 | | ... | *Example:*
353 | |
354 | | ... | \| Initialize layer avf on node \| DUT1 \| 1 \|
355 | |
356 | | [Arguments] | ${dut} | ${pf}
357 | |
358 | | FOR | ${vf} | IN RANGE | 0 | ${nic_vfs}
359 | | | ${_avf}= | VPP Create AVF Interface
360 | | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[${vf}]
361 | | | ... | num_rx_queues=${rxq_count_int}
362 | | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
363 | | | ${_ip4}=
364 | | | ... | Get Interface IP4 | ${nodes['${dut}']} | ${_avf}
365 | | | ${_ip4_prefix}=
366 | | | ... | Get Interface IP4 Prefix Length | ${nodes['${dut}']} | ${_avf}
367 | | | ${_mac}=
368 | | | ... | Get Interface MAC | ${nodes['${dut}']} | ${_avf}
369 | | | ${_pci}=
370 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${_avf}
371 | | | ${_vlan}=
372 | | | ... | Get Interface VLAN | ${nodes['${dut}']} | ${_avf}
373 | | | Set List Value | ${${dut}_vf${pf}} | ${vf} | ${_avf}
374 | | | Set List Value | ${${dut}_vf${pf}_ip4_addr} | ${vf} | ${_ip4}
375 | | | Set List Value | ${${dut}_vf${pf}_ip4_prefix} | ${vf} | ${_ip4_prefix}
376 | | | Set List Value | ${${dut}_vf${pf}_mac} | ${vf} | ${_mac}
377 | | | Set List Value | ${${dut}_vf${pf}_pci} | ${vf} | ${_pci}
378 | | | Set List Value | ${${dut}_vf${pf}_vlan} | ${vf} | ${_vlan}
379 | | END
380
381 | Initialize layer rdma-core on node
382 | | [Documentation]
383 | | ... | Initialize rdma-core (Mellanox VPP) interfaces on DUT on NIC PF.
384 | |
385 | | ... | *Arguments:*
386 | | ... | - dut - DUT node. Type: string
387 | | ... | - pf - NIC physical function (physical port). Type: integer
388 | |
389 | | ... | *Example:*
390 | |
391 | | ... | \| Initialize layer rdma-core on node \| DUT1 \| 1 \|
392 | |
393 | | [Arguments] | ${dut} | ${pf}
394 | |
395 | | ${_rdma}= | VPP Create Rdma Interface
396 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
397 | | ... | num_rx_queues=${rxq_count_int}
398 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
399 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_rdma}
400
401 | Initialize layer mlx5_core on node
402 | | [Documentation]
403 | | ... | Initialize mlx5_core interfaces on DUT on NIC PF.
404 | | ... | Currently no operation.
405 | |
406 | | No operation
407
408 | Initialize layer interface
409 | | [Documentation]
410 | | ... | Physical interfaces variables to be created on all DUTs.
411 | |
412 | | ... | *Arguments:*
413 | | ... | - count - Number of untagged interfaces variables. Type: integer
414 | |
415 | | ... | *Example:*
416 | |
417 | | ... | \| Initialize layer interface \| 1 \|
418 | |
419 | | [Arguments] | ${count}=${1}
420 | |
421 | | FOR | ${dut} | IN | @{duts}
422 | | | Initialize layer interface on node | ${dut} | count=${count}
423 | | END
424
425 | Initialize layer interface on node
426 | | [Documentation]
427 | | ... | Physical interfaces variables to be created on all DUTs.
428 | |
429 | | ... | *Arguments:*
430 | | ... | - dut - DUT node. Type: string
431 | | ... | - count - Number of baseline interface variables. Type: integer
432 | |
433 | | ... | *Example:*
434 | |
435 | | ... | \| Initialize layer interface on node \| DUT1 \| 1 \|
436 | |
437 | | [Arguments] | ${dut} | ${count}=${1}
438 | |
439 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
440 | | | Initialize layer interface on node on PF | ${dut} | ${pf} | count=${count}
441 | | END
442
443 | Initialize layer interface on node on PF
444 | | [Documentation]
445 | | ... | Baseline interfaces variables to be created.
446 | |
447 | | ... | *Arguments:*
448 | | ... | - dut - DUT node. Type: string
449 | | ... | - pf - NIC physical function (physical port). Type: integer
450 | | ... | - count - Number of baseline interface variables. Type: integer
451 | |
452 | | ... | *Example:*
453 | |
454 | | ... | \| Initialize layer interface on node on PF \| DUT1 \| 1 \| 1 \|
455 | |
456 | | [Arguments] | ${dut} | ${pf} | ${count}=${1}
457 | |
458 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
459 | | | Set Test Variable
460 | | | ... | ${${dut}_${int}${pf}_${id}} | ${${dut}_${int}${pf}}
461 | | END
462
463 | Initialize layer bonding
464 | | [Documentation]
465 | | ... | Bonded interfaces and variables to be created on all DUT's interfaces.
466 | |
467 | | ... | *Arguments:*
468 | | ... | - bond_mode - Link bonding mode. Type: string
469 | | ... | - lb_mode - Load balance mode. Type: string
470 | | ... | - count - Number of bond interface variables. Type: integer
471 | |
472 | | ... | *Example:*
473 | |
474 | | ... | \| Initialize layer bonding \| xor \| l34 \| 1 \|
475 | |
476 | | [Arguments] | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
477 | |
478 | | FOR | ${dut} | IN | @{duts}
479 | | | Initialize layer bonding on node
480 | | | ... | ${dut} | bond_mode=${bond_mode} | lb_mode=${lb_mode}
481 | | | ... | count=${count}
482 | | END
483 | | Set Test Variable | ${int} | bond
484
485 | Initialize layer bonding on node
486 | | [Documentation]
487 | | ... | Bonded interface and variables to be created on across east and
488 | | ... | west DUT's node interfaces.
489 | |
490 | | ... | *Arguments:*
491 | | ... | - dut - DUT node. Type: string
492 | | ... | - bond_mode - Link bonding mode. Type: string
493 | | ... | - lb_mode - Load balance mode. Type: string
494 | | ... | - count - Number of bond interface variables. Type: integer
495 | |
496 | | ... | *Example:*
497 | |
498 | | ... | \| Initialize layer bonding on node \| DUT1 \| xor \| l34 \| 1 \|
499 | |
500 | | [Arguments] | ${dut} | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
501 | |
502 | | ${if_index}= | VPP Create Bond Interface
503 | | ... | ${nodes['${dut}']} | ${bond_mode} | load_balance=${lb_mode}
504 | | ... | mac=00:00:00:01:01:01
505 | | Set Interface State | ${nodes['${dut}']} | ${if_index} | up
506 | | VPP Add Bond Member
507 | | ... | ${nodes['${dut}']} | ${${dut}_${int}1_1} | ${if_index}
508 | | VPP Add Bond Member
509 | | ... | ${nodes['${dut}']} | ${${dut}_${int}2_1} | ${if_index}
510 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
511 | | | Set Test Variable | ${${dut}_bond1_${id}} | ${if_index}
512 | | | Set Test Variable | ${${dut}_bond2_${id}} | ${if_index}
513 | | END
514
515 | Initialize layer dot1q
516 | | [Documentation]
517 | | ... | Dot1q interfaces and variables to be created on all DUTs.
518 | |
519 | | ... | *Arguments:*
520 | | ... | - count - Number of chains.
521 | | ... | Type: integer
522 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
523 | | ... | Type: boolean
524 | | ... | - start - Id of first chain, allows adding chains during test.
525 | | ... | Type: integer
526 | |
527 | | ... | \| Initialize layer dot1q \| 1 \| True \| 1 \|
528 | |
529 | | [Arguments] | ${count}=${1} | ${vlan_per_chain}=${True} | ${start}=${1}
530 | |
531 | | FOR | ${dut} | IN | @{duts}
532 | | | Initialize layer dot1q on node
533 | | | ... | ${dut} | count=${count} | vlan_per_chain=${vlan_per_chain}
534 | | | ... | start=${start}
535 | | END
536 | | Set Test Variable | ${int} | dot1q
537
538 | Initialize layer dot1q on node
539 | | [Documentation]
540 | | ... | Dot1q interfaces and variables to be created on all DUT's node.
541 | |
542 | | ... | *Arguments:*
543 | | ... | - dut - DUT node.
544 | | ... | Type: string
545 | | ... | - count - Number of chains.
546 | | ... | Type: integer
547 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
548 | | ... | Type: boolean
549 | | ... | - start - Id of first chain, allows adding chains during test.
550 | | ... | Type: integer
551 | |
552 | | ... | *Example:*
553 | |
554 | | ... | \| Initialize layer dot1q on node \| DUT1 \| 1 \| True \| 1 \|
555 | |
556 | | [Arguments] | ${dut} | ${count}=${1} | ${vlan_per_chain}=${True}
557 | | ... | ${start}=${1}
558 | |
559 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
560 | | | Initialize layer dot1q on node on PF | ${dut} | pf=${pf} | count=${count}
561 | | | ... | vlan_per_chain=${vlan_per_chain} | start=${start}
562 | | END
563
564 | Initialize layer dot1q on node on PF
565 | | [Documentation]
566 | | ... | Dot1q interfaces and variables to be created on all DUT's node
567 | | ... | interfaces.
568 | |
569 | | ... | *Arguments:*
570 | | ... | - dut - DUT node.
571 | | ... | Type: string
572 | | ... | - pf - NIC physical function (physical port).
573 | | ... | Type: integer
574 | | ... | - count - Number of chains.
575 | | ... | Type: integer
576 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
577 | | ... | Type: boolean
578 | | ... | - start - Id of first chain, allows adding chains during test.
579 | | ... | Type: integer
580 | |
581 | | ... | *Example:*
582 | |
583 | | ... | \| Initialize layer dot1q on node on PF \| DUT1 \| 3 \| True \| 2 \|
584 | |
585 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1}
586 | | ... | ${vlan_per_chain}=${True} | ${start}=${1}
587 | |
588 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
589 | | | ${_dot1q}= | Initialize layer dot1q on node on PF for chain
590 | | | ... | dut=${dut} | pf=${pf} | id=${id} | vlan_per_chain=${vlan_per_chain}
591 | | | # First id results in non-None indices, after that _1_ are defined.
592 | | | ${_dot1q}= | Set Variable If | '${_dot1q}' == '${NONE}'
593 | | | ... | ${${dut}_dot1q${pf}_1}[0] | ${_dot1q}
594 | | | ${_dot1q}= | Create List | ${_dot1q}
595 | | | Set Test Variable | ${${dut}_dot1q${pf}_${id}} | ${_dot1q}
596 | | END
597
598 | Initialize layer dot1q on node on PF for chain
599 | | [Documentation]
600 | | ... | Optionally create tag popping subinterface per chain.
601 | | ... | Return interface indices for dot1q layer interfaces,
602 | | ... | or Nones if subinterfaces are not created.
603 | |
604 | | ... | *Arguments:*
605 | | ... | - dut - DUT node.
606 | | ... | Type: string
607 | | ... | - pf - NIC physical function (physical port).
608 | | ... | Type: integer
609 | | ... | - id - Positive index of the chain.
610 | | ... | Type: integer
611 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
612 | | ... | Type: boolean
613 | |
614 | | ... | *Example:*
615 | |
616 | | ... | \| Initialize layer dot1q on node on PF for chain \| DUT1 \
617 | | ... | \| 1 \| 1 \| True \|
618 | |
619 | | [Arguments] | ${dut} | ${pf} | ${id} | ${vlan_per_chain}=${True}
620 | |
621 | | Return From Keyword If | ${id} != ${1} and not ${vlan_per_chain}
622 | | ... | ${NONE}
623 | | ${_default}= | Evaluate | ${pf} * ${100} + ${id} - ${1}
624 | | ${_vlan}= | Get Variable Value | \${${dut}_pf${pf}_vlan}
625 | | ${_vlan}= | Set Variable If | '${_vlan}[0]' != '${NONE}'
626 | | ... | ${_vlan}[0] | ${_default}
627 | | ${_name} | ${_index}= | Create Vlan Subinterface
628 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0] | ${_vlan}
629 | | Set Interface State | ${nodes['${dut}']} | ${_index} | up
630 | | Configure L2 tag rewrite method on interfaces
631 | | ... | ${nodes['${dut}']} | ${_index} | TAG_REWRITE_METHOD=pop-1
632 | | Return From Keyword | ${_index}
633
634 | Initialize layer ip4vxlan
635 | | [Documentation]
636 | | ... | VXLAN interfaces and variables to be created on all DUT's interfaces.
637 | |
638 | | ... | *Arguments:*
639 | | ... | - count - Number of vxlan interfaces.
640 | | ... | Type: integer
641 | | ... | - start - Id of first chain, allows adding chains during test.
642 | | ... | Type: integer
643 | |
644 | | ... | \| Initialize layer ip4vxlan \| 3 \| 2 \|
645 | |
646 | | [Arguments] | ${count}=${1} | ${start}=${1}
647 | |
648 | | FOR | ${dut} | IN | @{duts}
649 | | | Initialize layer ip4vxlan on node | ${dut} | count=${count}
650 | | | ... | start=${start}
651 | | END
652 | | Set Test Variable | ${int} | ip4vxlan
653
654 | Initialize layer ip4vxlan on node
655 | | [Documentation]
656 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
657 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
658 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
659 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
660 | |
661 | | ... | *Arguments:*
662 | | ... | - dut - DUT node.
663 | | ... | Type: string
664 | | ... | - count - Number of vxlan interfaces.
665 | | ... | Type: integer
666 | | ... | - start - Id of first chain, allows adding chains during test.
667 | | ... | Type: integer
668 | |
669 | | ... | *Example:*
670 | |
671 | | ... | \| Initialize layer ip4vxlan on node \| DUT1 \| 3 \| 2 \|
672 | |
673 | | [Arguments] | ${dut} | ${count}=${1} | ${start}=${1}
674 | |
675 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
676 | | | Initialize layer ip4vxlan on node on PF | ${dut} | pf=${pf}
677 | | | ... | count=${count} | start=${start}
678 | | END
679
680 | Initialize layer ip4vxlan on node on PF
681 | | [Documentation]
682 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
683 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
684 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
685 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
686 | |
687 | | ... | *Arguments:*
688 | | ... | - dut - DUT node.
689 | | ... | Type: string
690 | | ... | - pf - NIC physical function (physical port).
691 | | ... | Type: integer
692 | | ... | - count - Number of vxlan interfaces.
693 | | ... | Type: integer
694 | | ... | - start - Id of first chain, allows adding chains during test.
695 | | ... | Type: integer
696 | |
697 | | ... | *Example:*
698 | |
699 | | ... | \| Initialize layer ip4vxlan on node on PF \| DUT1 \| 3 \| 2 \|
700 | |
701 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1} | ${start}=${1}
702 | |
703 | | Run Keyword If | "${start}" == "1" | VPP Interface Set IP Address
704 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_1}[0]
705 | | ... | 172.${pf}6.0.1 | 24
706 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
707 | | | ${_subnet}= | Evaluate | ${id} - 1
708 | | | ${_vni}= | Evaluate | ${id} - 1
709 | | | ${_ip4vxlan}= | Create VXLAN interface
710 | | | ... | ${nodes['${dut}']} | ${_vni}
711 | | | ... | 172.${pf}6.0.1 | 172.${pf}7.${_subnet}.2
712 | | | ${_prev_mac}=
713 | | | ... | Set Variable If | '${dut}' == 'DUT1'
714 | | | ... | ${TG_pf1_mac}[0] | ${DUT1_pf2_mac}[0]
715 | | | ${_next_mac}=
716 | | | ... | Set Variable If | '${dut}' == 'DUT1' and ${duts_count} == 2
717 | | | ... | ${DUT2_pf1_mac}[0] | ${TG_pf2_mac}[0]
718 | | | ${_even}= | Evaluate | ${pf} % 2
719 | | | ${_mac}= | Set Variable If | ${_even}
720 | | | ... | ${_prev_mac} | ${_next_mac}
721 | | | VPP Add IP Neighbor
722 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
723 | | | ... | 172.${pf}6.${_subnet}.2 | ${_mac}
724 | | | VPP Route Add
725 | | | ... | ${nodes['${dut}']} | 172.${pf}7.${_subnet}.0 | 24
726 | | | ... | gateway=172.${pf}6.${_subnet}.2
727 | | | ... | interface=${${dut}_${int}${pf}_${id}}[0]
728 | | | Set VXLAN Bypass
729 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
730 | | | ${_ip4vxlan}= | Create List | ${_ip4vxlan}
731 | | | Set Test Variable
732 | | | ... | ${${dut}_ip4vxlan${pf}_${id}} | ${_ip4vxlan}
733 | | END
734
735 | Configure vhost interfaces
736 | | [Documentation]
737 | | ... | Create two Vhost-User interfaces on defined VPP node.
738 | |
739 | | ... | *Arguments:*
740 | | ... | - ${dut_node} - DUT node.
741 | | ... | Type: dictionary
742 | | ... | - ${sock1} - Socket path for first Vhost-User interface.
743 | | ... | Type: string
744 | | ... | - ${sock2} - Socket path for second Vhost-User interface.
745 | | ... | Type: string
746 | | ... | - ${vhost_if1} - Name of the first Vhost-User interface (Optional).
747 | | ... | Type: string
748 | | ... | - ${vhost_if2} - Name of the second Vhost-User interface (Optional).
749 | | ... | Type: string
750 | | ... | - ${is_server} - Server side of connection (Optional).
751 | | ... | Type: boolean
752 | | ... | - ${virtio_feature_mask} - Enabled Virtio feature flags (Optional).
753 | | ... | Type: integer
754 | |
755 | | ... | _NOTE:_ This KW sets following test case variable:
756 | | ... | - ${${vhost_if1}} - First Vhost-User interface.
757 | | ... | - ${${vhost_if2}} - Second Vhost-User interface.
758 | |
759 | | ... | *Example:*
760 | |
761 | | ... | \| Configure vhost interfaces \
762 | | ... | \| ${nodes['DUT1']} \| /tmp/sock1 \| /tmp/sock2 \|
763 | |
764 | | [Arguments] | ${dut_node} | ${sock1} | ${sock2} | ${vhost_if1}=vhost_if1
765 | | ... | ${vhost_if2}=vhost_if2 | ${is_server}=${False}
766 | | ... | ${virtio_feature_mask}=${None}
767 | |
768 | | ${vhost_1}= | Vpp Create Vhost User Interface
769 | | ... | ${dut_node} | ${sock1} | is_server=${is_server}
770 | | ... | virtio_feature_mask=${virtio_feature_mask}
771 | | ${vhost_2}= | Vpp Create Vhost User Interface
772 | | ... | ${dut_node} | ${sock2} | is_server=${is_server}
773 | | ... | virtio_feature_mask=${virtio_feature_mask}
774 | | ${vhost_1_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_1}
775 | | ${vhost_2_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_2}
776 | | ${vhost_1_mac}= | Get Interface MAC | ${dut_node} | ${vhost_1_key}
777 | | ${vhost_2_mac}= | Get Interface MAC | ${dut_node} | ${vhost_2_key}
778 | | Set Interface State | ${dut_node} | ${vhost_1} | up
779 | | Set Interface State | ${dut_node} | ${vhost_2} | up
780 | | Set Test Variable | ${${vhost_if1}} | ${vhost_1}
781 | | Set Test Variable | ${${vhost_if2}} | ${vhost_2}
782 | | Set Test Variable | ${${vhost_if1}_mac} | ${vhost_1_mac}
783 | | Set Test Variable | ${${vhost_if2}_mac} | ${vhost_2_mac}
784
785 | Get Vhost dump
786 | | [Documentation] | Get vhost-user dump.
787 | |
788 | | ... | *Arguments:*
789 | | ... | - dut - DUT node data.
790 | | ... | Type: dictionary
791 | |
792 | | [Arguments] | ${dut}
793 | |
794 | | ${vhost_dump}= | Vhost User Dump | ${dut}
795 | | Return From Keyword | ${vhost_dump}