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