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