1a7b32ea00a68a7b56a9d12485ea5b5fd2340d98
[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 | ${dp_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 af_xdp on all DUTs
169 | | [Documentation]
170 | | ... | Pre-initialize af_xdp driver.
171 | |
172 | | FOR | ${dut} | IN | @{duts}
173 | | | Set Interface State PCI
174 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | state=up
175 | | | Set Interface Channels
176 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | num_queues=${rxq_count_int}
177 | | | ... | channel=combined
178 | | END
179
180 | Pre-initialize layer rdma-core on all DUTs
181 | | [Documentation]
182 | | ... | Pre-initialize rdma-core driver.
183 | |
184 | | FOR | ${dut} | IN | @{duts}
185 | | | Set Interface Flow Control
186 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off"
187 | | | Set PCI Parameter
188 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | key="68.w" | value="3BCD"
189 | | END
190
191 | Pre-initialize layer mlx5_core on all DUTs
192 | | [Documentation]
193 | | ... | Pre-initialize mlx5_core driver.
194 | |
195 | | FOR | ${dut} | IN | @{duts}
196 | | | Run Keyword If | ${jumbo}
197 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=9200
198 | | | ... | ELSE
199 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=1500
200 | | | Set Interface Flow Control
201 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off"
202 | | | Set PCI Parameter
203 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | key="68.w" | value="3BCD"
204 | | END
205
206 | Initialize layer driver
207 | | [Documentation]
208 | | ... | Initialize driver based interfaces on all DUT. Interfaces are
209 | | ... | brought up.
210 | |
211 | | ... | *Arguments:*
212 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
213 | | ... | Type: string
214 | | ... | - validate - Validate interfaces are up.
215 | | ... | Type: boolean
216 | |
217 | | ... | *Example:*
218 | |
219 | | ... | \| Initialize layer driver \| vfio-pci \|
220 | |
221 | | [Arguments] | ${driver} | ${validate}=${True}
222 | |
223 | | FOR | ${dut} | IN | @{duts}
224 | | | Initialize layer driver on node | ${dut} | ${driver}
225 | | END
226 | | Set Test Variable | ${int} | vf
227 | | Set interfaces in path up | validate=${validate}
228
229 | Initialize layer driver on node
230 | | [Documentation]
231 | | ... | Initialize driver based interfaces on DUT.
232 | |
233 | | ... | *Arguments:*
234 | | ... | - dut - DUT node.
235 | | ... | Type: string
236 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
237 | | ... | Type: string
238 | |
239 | | ... | *Example:*
240 | |
241 | | ... | \| Initialize layer driver \| DUT1 \| vfio-pci \|
242 | |
243 | | [Arguments] | ${dut} | ${driver}
244 | |
245 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
246 | | | ${_vf}=
247 | | | ... | Copy List | ${${dut}_${int}${pf}}
248 | | | ${_ip4_addr}=
249 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_addr}
250 | | | ${_ip4_prefix}=
251 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_prefix}
252 | | | ${_mac}=
253 | | | ... | Copy List | ${${dut}_${int}${pf}_mac}
254 | | | ${_pci}=
255 | | | ... | Copy List | ${${dut}_${int}${pf}_pci}
256 | | | ${_vlan}=
257 | | | ... | Copy List | ${${dut}_${int}${pf}_vlan}
258 | | | Set Test Variable
259 | | | ... | ${${dut}_vf${pf}} | ${_vf}
260 | | | Set Test Variable
261 | | | ... | ${${dut}_vf${pf}_ip4_addr} | ${_ip4_addr}
262 | | | Set Suite Variable
263 | | | ... | ${${dut}_vf${pf}_ip4_prefix} | ${_ip4_prefix}
264 | | | Set Test Variable
265 | | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
266 | | | Set Test Variable
267 | | | ... | ${${dut}_vf${pf}_pci} | ${_pci}
268 | | | Set Test Variable
269 | | | ... | ${${dut}_vf${pf}_vlan} | ${_vlan}
270 | | | Run Keyword | Initialize layer ${driver} on node | ${dut} | ${pf}
271 | | END
272
273 | Initialize layer tap on node
274 | | [Documentation]
275 | | ... | Initialize tap interfaces on DUT.
276 | |
277 | | ... | *Arguments:*
278 | | ... | - dut - DUT node.
279 | | ... | Type: string
280 | | ... | - pf - TAP ID (logical port).
281 | | ... | Type: integer
282 | |
283 | | ... | *Example:*
284 | |
285 | | ... | \| Initialize layer tap on node \| DUT1 \| 0 \|
286 | |
287 | | [Arguments] | ${dut} | ${pf}
288 | |
289 | | Create Namespace
290 | | ... | ${nodes['${dut}']} | tap${${pf}-1}_namespace
291 | | ${tap_feature_mask}= | Create Tap feature mask | gso=${enable_gso}
292 | | ${_tap}=
293 | | ... | And Add Tap Interface | ${nodes['${dut}']} | tap${${pf}-1}
294 | | ... | host_namespace=tap${${pf}-1}_namespace
295 | | ... | num_rx_queues=${rxq_count_int}
296 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
297 | | ... | tap_feature_mask=${tap_feature_mask}
298 | | ${_mac}=
299 | | ... | Get Interface MAC | ${nodes['${dut}']} | tap${pf}
300 | | ${_tap}= | Create List | ${_tap}
301 | | ${_mac}= | Create List | ${_mac}
302 | | Vhost User Affinity
303 | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0]
304 | | ... | skip_cnt=${${CPU_CNT_MAIN}+${CPU_CNT_SYSTEM}+${cpu_count_int}}
305 | | Set Test Variable
306 | | ... | ${${dut}_vf${pf}} | ${_tap}
307 | | Set Test Variable
308 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
309
310 | Initialize layer vhost on node
311 | | [Documentation]
312 | | ... | Initialize vhost interfaces on DUT.
313 | |
314 | | ... | *Arguments:*
315 | | ... | - dut - DUT node.
316 | | ... | Type: string
317 | | ... | - pf - VHOST ID (logical port).
318 | | ... | Type: integer
319 | |
320 | | ... | *Example:*
321 | |
322 | | ... | \| Initialize layer vhost on node \| DUT1 \| 0 \|
323 | |
324 | | [Arguments] | ${dut} | ${pf}
325 | |
326 | | ${virtio_feature_mask}= | Create Virtio feature mask | gso=${enable_gso}
327 | | ${vhost}= | Vpp Create Vhost User Interface
328 | | ... | ${nodes['${dut}']} | /var/run/vpp/sock-${pf}-1
329 | | ... | is_server=${True} | virtio_feature_mask=${virtio_feature_mask}
330 | | ${_mac}=
331 | | ... | Get Interface MAC | ${nodes['${dut}']} | vhost${pf}
332 | | ${_vhost}= | Create List | ${_vhost}
333 | | ${_mac}= | Create List | ${_mac}
334 | | Set Test Variable
335 | | ... | ${${dut}_vf${pf}} | ${_vhost}
336 | | Set Test Variable
337 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
338
339 | Initialize layer vfio-pci on node
340 | | [Documentation]
341 | | ... | Initialize vfio-pci interfaces on DUT on NIC PF.
342 | | ... | Currently no operation.
343 | |
344 | | ... | *Arguments:*
345 | | ... | - dut - DUT node. Type: string
346 | | ... | - pf - NIC physical function (physical port). Type: integer
347 | |
348 | | ... | *Example:*
349 | |
350 | | ... | \| Initialize layer vfio-pci on node \| DUT1 \| 1 \|
351 | |
352 | | [Arguments] | ${dut} | ${pf}
353 | |
354 | | No operation
355
356 | Initialize layer avf on node
357 | | [Documentation]
358 | | ... | Initialize AVF (Intel) interfaces on DUT on NIC PF.
359 | |
360 | | ... | *Arguments:*
361 | | ... | - dut - DUT node. Type: string
362 | | ... | - pf - NIC physical function (physical port). Type: integer
363 | |
364 | | ... | *Example:*
365 | |
366 | | ... | \| Initialize layer avf on node \| DUT1 \| 1 \|
367 | |
368 | | [Arguments] | ${dut} | ${pf}
369 | |
370 | | FOR | ${vf} | IN RANGE | 0 | ${nic_vfs}
371 | | | ${_avf}= | VPP Create AVF Interface
372 | | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[${vf}]
373 | | | ... | num_rx_queues=${rxq_count_int}
374 | | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
375 | | | ${_ip4}=
376 | | | ... | Get Interface IP4 | ${nodes['${dut}']} | ${_avf}
377 | | | ${_ip4_prefix}=
378 | | | ... | Get Interface IP4 Prefix Length | ${nodes['${dut}']} | ${_avf}
379 | | | ${_mac}=
380 | | | ... | Get Interface MAC | ${nodes['${dut}']} | ${_avf}
381 | | | ${_pci}=
382 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${_avf}
383 | | | ${_vlan}=
384 | | | ... | Get Interface VLAN | ${nodes['${dut}']} | ${_avf}
385 | | | Set List Value | ${${dut}_vf${pf}} | ${vf} | ${_avf}
386 | | | Set List Value | ${${dut}_vf${pf}_ip4_addr} | ${vf} | ${_ip4}
387 | | | Set List Value | ${${dut}_vf${pf}_ip4_prefix} | ${vf} | ${_ip4_prefix}
388 | | | Set List Value | ${${dut}_vf${pf}_mac} | ${vf} | ${_mac}
389 | | | Set List Value | ${${dut}_vf${pf}_pci} | ${vf} | ${_pci}
390 | | | Set List Value | ${${dut}_vf${pf}_vlan} | ${vf} | ${_vlan}
391 | | END
392
393 | Initialize layer af_xdp on node
394 | | [Documentation]
395 | | ... | Initialize AF_XDP (eBPF) interfaces on DUT on NIC PF.
396 | |
397 | | ... | *Arguments:*
398 | | ... | - dut - DUT node. Type: string
399 | | ... | - pf - NIC physical function (physical port). Type: integer
400 | |
401 | | ... | *Example:*
402 | |
403 | | ... | \| Initialize layer af_xdp on node \| DUT1 \| 1 \|
404 | |
405 | | [Arguments] | ${dut} | ${pf}
406 | |
407 | | ${_af_xdp}= | VPP Create AF XDP Interface
408 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
409 | | ... | num_rx_queues=${65535}
410 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
411 | | ${cpu_skip_cnt}= | Evaluate | ${CPU_CNT_SYSTEM}+${CPU_CNT_MAIN}
412 | | ${cpu_skip_cnt}= | Evaluate | ${cpu_skip_cnt}+${cpu_count_int}
413 | | ${cpu_skip_cnt}= | Evaluate | ${cpu_skip_cnt}+(${pf}-${1})*${rxq_count_int}
414 | | Set Interface IRQs Affinity
415 | | ... | ${nodes['${dut}']} | ${_af_xdp}
416 | | ... | cpu_skip_cnt=${cpu_skip_cnt} | cpu_cnt=${rxq_count_int}
417 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_af_xdp}
418
419 | Initialize layer rdma-core on node
420 | | [Documentation]
421 | | ... | Initialize rdma-core (Mellanox VPP) interfaces on DUT on NIC PF.
422 | |
423 | | ... | *Arguments:*
424 | | ... | - dut - DUT node. Type: string
425 | | ... | - pf - NIC physical function (physical port). Type: integer
426 | |
427 | | ... | *Example:*
428 | |
429 | | ... | \| Initialize layer rdma-core on node \| DUT1 \| 1 \|
430 | |
431 | | [Arguments] | ${dut} | ${pf}
432 | |
433 | | ${_rdma}= | VPP Create Rdma Interface
434 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
435 | | ... | num_rx_queues=${rxq_count_int}
436 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
437 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_rdma}
438
439 | Initialize layer mlx5_core on node
440 | | [Documentation]
441 | | ... | Initialize mlx5_core interfaces on DUT on NIC PF.
442 | | ... | Currently no operation.
443 | |
444 | | No operation
445
446 | Initialize layer interface
447 | | [Documentation]
448 | | ... | Physical interfaces variables to be created on all DUTs.
449 | |
450 | | ... | *Arguments:*
451 | | ... | - count - Number of untagged interfaces variables. Type: integer
452 | |
453 | | ... | *Example:*
454 | |
455 | | ... | \| Initialize layer interface \| 1 \|
456 | |
457 | | [Arguments] | ${count}=${1}
458 | |
459 | | FOR | ${dut} | IN | @{duts}
460 | | | Initialize layer interface on node | ${dut} | count=${count}
461 | | END
462
463 | Initialize layer interface on node
464 | | [Documentation]
465 | | ... | Physical interfaces variables to be created on all DUTs.
466 | |
467 | | ... | *Arguments:*
468 | | ... | - dut - DUT node. Type: string
469 | | ... | - count - Number of baseline interface variables. Type: integer
470 | |
471 | | ... | *Example:*
472 | |
473 | | ... | \| Initialize layer interface on node \| DUT1 \| 1 \|
474 | |
475 | | [Arguments] | ${dut} | ${count}=${1}
476 | |
477 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
478 | | | Initialize layer interface on node on PF | ${dut} | ${pf} | count=${count}
479 | | END
480
481 | Initialize layer interface on node on PF
482 | | [Documentation]
483 | | ... | Baseline interfaces variables to be created.
484 | |
485 | | ... | *Arguments:*
486 | | ... | - dut - DUT node. Type: string
487 | | ... | - pf - NIC physical function (physical port). Type: integer
488 | | ... | - count - Number of baseline interface variables. Type: integer
489 | |
490 | | ... | *Example:*
491 | |
492 | | ... | \| Initialize layer interface on node on PF \| DUT1 \| 1 \| 1 \|
493 | |
494 | | [Arguments] | ${dut} | ${pf} | ${count}=${1}
495 | |
496 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
497 | | | Set Test Variable
498 | | | ... | ${${dut}_${int}${pf}_${id}} | ${${dut}_${int}${pf}}
499 | | END
500
501 | Initialize layer bonding
502 | | [Documentation]
503 | | ... | Bonded interfaces and variables to be created on all DUT's interfaces.
504 | |
505 | | ... | *Arguments:*
506 | | ... | - bond_mode - Link bonding mode. Type: string
507 | | ... | - lb_mode - Load balance mode. Type: string
508 | | ... | - count - Number of bond interface variables. Type: integer
509 | |
510 | | ... | *Example:*
511 | |
512 | | ... | \| Initialize layer bonding \| xor \| l34 \| 1 \|
513 | |
514 | | [Arguments] | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
515 | |
516 | | FOR | ${dut} | IN | @{duts}
517 | | | Initialize layer bonding on node
518 | | | ... | ${dut} | bond_mode=${bond_mode} | lb_mode=${lb_mode}
519 | | | ... | count=${count}
520 | | END
521 | | Set Test Variable | ${int} | bond
522
523 | Initialize layer bonding on node
524 | | [Documentation]
525 | | ... | Bonded interface and variables to be created on across east and
526 | | ... | west DUT's node interfaces.
527 | |
528 | | ... | *Arguments:*
529 | | ... | - dut - DUT node. Type: string
530 | | ... | - bond_mode - Link bonding mode. Type: string
531 | | ... | - lb_mode - Load balance mode. Type: string
532 | | ... | - count - Number of bond interface variables. Type: integer
533 | |
534 | | ... | *Example:*
535 | |
536 | | ... | \| Initialize layer bonding on node \| DUT1 \| xor \| l34 \| 1 \|
537 | |
538 | | [Arguments] | ${dut} | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
539 | |
540 | | ${if_index}= | VPP Create Bond Interface
541 | | ... | ${nodes['${dut}']} | ${bond_mode} | load_balance=${lb_mode}
542 | | ... | mac=00:00:00:01:01:01
543 | | Set Interface State | ${nodes['${dut}']} | ${if_index} | up
544 | | VPP Add Bond Member
545 | | ... | ${nodes['${dut}']} | ${${dut}_${int}1_1} | ${if_index}
546 | | VPP Add Bond Member
547 | | ... | ${nodes['${dut}']} | ${${dut}_${int}2_1} | ${if_index}
548 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
549 | | | Set Test Variable | ${${dut}_bond1_${id}} | ${if_index}
550 | | | Set Test Variable | ${${dut}_bond2_${id}} | ${if_index}
551 | | END
552
553 | Initialize layer dot1q
554 | | [Documentation]
555 | | ... | Dot1q interfaces and variables to be created on all DUTs.
556 | |
557 | | ... | *Arguments:*
558 | | ... | - count - Number of chains.
559 | | ... | Type: integer
560 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
561 | | ... | Type: boolean
562 | | ... | - start - Id of first chain, allows adding chains during test.
563 | | ... | Type: integer
564 | |
565 | | ... | \| Initialize layer dot1q \| 1 \| True \| 1 \|
566 | |
567 | | [Arguments] | ${count}=${1} | ${vlan_per_chain}=${True} | ${start}=${1}
568 | |
569 | | FOR | ${dut} | IN | @{duts}
570 | | | Initialize layer dot1q on node
571 | | | ... | ${dut} | count=${count} | vlan_per_chain=${vlan_per_chain}
572 | | | ... | start=${start}
573 | | END
574 | | Set Test Variable | ${int} | dot1q
575
576 | Initialize layer dot1q on node
577 | | [Documentation]
578 | | ... | Dot1q interfaces and variables to be created on all DUT's node.
579 | |
580 | | ... | *Arguments:*
581 | | ... | - dut - DUT node.
582 | | ... | Type: string
583 | | ... | - count - Number of chains.
584 | | ... | Type: integer
585 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
586 | | ... | Type: boolean
587 | | ... | - start - Id of first chain, allows adding chains during test.
588 | | ... | Type: integer
589 | |
590 | | ... | *Example:*
591 | |
592 | | ... | \| Initialize layer dot1q on node \| DUT1 \| 1 \| True \| 1 \|
593 | |
594 | | [Arguments] | ${dut} | ${count}=${1} | ${vlan_per_chain}=${True}
595 | | ... | ${start}=${1}
596 | |
597 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
598 | | | Initialize layer dot1q on node on PF | ${dut} | pf=${pf} | count=${count}
599 | | | ... | vlan_per_chain=${vlan_per_chain} | start=${start}
600 | | END
601
602 | Initialize layer dot1q on node on PF
603 | | [Documentation]
604 | | ... | Dot1q interfaces and variables to be created on all DUT's node
605 | | ... | interfaces.
606 | |
607 | | ... | *Arguments:*
608 | | ... | - dut - DUT node.
609 | | ... | Type: string
610 | | ... | - pf - NIC physical function (physical port).
611 | | ... | Type: integer
612 | | ... | - count - Number of chains.
613 | | ... | Type: integer
614 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
615 | | ... | Type: boolean
616 | | ... | - start - Id of first chain, allows adding chains during test.
617 | | ... | Type: integer
618 | |
619 | | ... | *Example:*
620 | |
621 | | ... | \| Initialize layer dot1q on node on PF \| DUT1 \| 3 \| True \| 2 \|
622 | |
623 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1}
624 | | ... | ${vlan_per_chain}=${True} | ${start}=${1}
625 | |
626 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
627 | | | ${_dot1q}= | Initialize layer dot1q on node on PF for chain
628 | | | ... | dut=${dut} | pf=${pf} | id=${id} | vlan_per_chain=${vlan_per_chain}
629 | | | # First id results in non-None indices, after that _1_ are defined.
630 | | | ${_dot1q}= | Set Variable If | '${_dot1q}' == '${NONE}'
631 | | | ... | ${${dut}_dot1q${pf}_1}[0] | ${_dot1q}
632 | | | ${_dot1q}= | Create List | ${_dot1q}
633 | | | Set Test Variable | ${${dut}_dot1q${pf}_${id}} | ${_dot1q}
634 | | END
635
636 | Initialize layer dot1q on node on PF for chain
637 | | [Documentation]
638 | | ... | Optionally create tag popping subinterface per chain.
639 | | ... | Return interface indices for dot1q layer interfaces,
640 | | ... | or Nones if subinterfaces are not created.
641 | |
642 | | ... | *Arguments:*
643 | | ... | - dut - DUT node.
644 | | ... | Type: string
645 | | ... | - pf - NIC physical function (physical port).
646 | | ... | Type: integer
647 | | ... | - id - Positive index of the chain.
648 | | ... | Type: integer
649 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
650 | | ... | Type: boolean
651 | |
652 | | ... | *Example:*
653 | |
654 | | ... | \| Initialize layer dot1q on node on PF for chain \| DUT1 \
655 | | ... | \| 1 \| 1 \| True \|
656 | |
657 | | [Arguments] | ${dut} | ${pf} | ${id} | ${vlan_per_chain}=${True}
658 | |
659 | | Return From Keyword If | ${id} != ${1} and not ${vlan_per_chain}
660 | | ... | ${NONE}
661 | | ${_default}= | Evaluate | ${pf} * ${100} + ${id} - ${1}
662 | | ${_vlan}= | Get Variable Value | \${${dut}_pf${pf}_vlan}
663 | | ${_vlan}= | Set Variable If | '${_vlan}[0]' != '${NONE}'
664 | | ... | ${_vlan}[0] | ${_default}
665 | | ${_name} | ${_index}= | Create Vlan Subinterface
666 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0] | ${_vlan}
667 | | Set Interface State | ${nodes['${dut}']} | ${_index} | up
668 | | Configure L2 tag rewrite method on interfaces
669 | | ... | ${nodes['${dut}']} | ${_index} | TAG_REWRITE_METHOD=pop-1
670 | | Return From Keyword | ${_index}
671
672 | Initialize layer ip4vxlan
673 | | [Documentation]
674 | | ... | VXLAN interfaces and variables to be created on all DUT's interfaces.
675 | |
676 | | ... | *Arguments:*
677 | | ... | - count - Number of vxlan interfaces.
678 | | ... | Type: integer
679 | | ... | - start - Id of first chain, allows adding chains during test.
680 | | ... | Type: integer
681 | |
682 | | ... | \| Initialize layer ip4vxlan \| 3 \| 2 \|
683 | |
684 | | [Arguments] | ${count}=${1} | ${start}=${1}
685 | |
686 | | FOR | ${dut} | IN | @{duts}
687 | | | Initialize layer ip4vxlan on node | ${dut} | count=${count}
688 | | | ... | start=${start}
689 | | END
690 | | Set Test Variable | ${int} | ip4vxlan
691
692 | Initialize layer ip4vxlan on node
693 | | [Documentation]
694 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
695 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
696 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
697 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
698 | |
699 | | ... | *Arguments:*
700 | | ... | - dut - DUT node.
701 | | ... | Type: string
702 | | ... | - count - Number of vxlan interfaces.
703 | | ... | Type: integer
704 | | ... | - start - Id of first chain, allows adding chains during test.
705 | | ... | Type: integer
706 | |
707 | | ... | *Example:*
708 | |
709 | | ... | \| Initialize layer ip4vxlan on node \| DUT1 \| 3 \| 2 \|
710 | |
711 | | [Arguments] | ${dut} | ${count}=${1} | ${start}=${1}
712 | |
713 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
714 | | | Initialize layer ip4vxlan on node on PF | ${dut} | pf=${pf}
715 | | | ... | count=${count} | start=${start}
716 | | END
717
718 | Initialize layer ip4vxlan on node on PF
719 | | [Documentation]
720 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
721 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
722 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
723 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
724 | |
725 | | ... | *Arguments:*
726 | | ... | - dut - DUT node.
727 | | ... | Type: string
728 | | ... | - pf - NIC physical function (physical port).
729 | | ... | Type: integer
730 | | ... | - count - Number of vxlan interfaces.
731 | | ... | Type: integer
732 | | ... | - start - Id of first chain, allows adding chains during test.
733 | | ... | Type: integer
734 | |
735 | | ... | *Example:*
736 | |
737 | | ... | \| Initialize layer ip4vxlan on node on PF \| DUT1 \| 3 \| 2 \|
738 | |
739 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1} | ${start}=${1}
740 | |
741 | | Run Keyword If | "${start}" == "1" | VPP Interface Set IP Address
742 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_1}[0]
743 | | ... | 172.${pf}6.0.1 | 24
744 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
745 | | | ${_subnet}= | Evaluate | ${id} - 1
746 | | | ${_vni}= | Evaluate | ${id} - 1
747 | | | ${_ip4vxlan}= | Create VXLAN interface
748 | | | ... | ${nodes['${dut}']} | ${_vni}
749 | | | ... | 172.${pf}6.0.1 | 172.${pf}7.${_subnet}.2
750 | | | ${_prev_mac}=
751 | | | ... | Set Variable If | '${dut}' == 'DUT1'
752 | | | ... | ${TG_pf1_mac}[0] | ${DUT1_pf2_mac}[0]
753 | | | ${_next_mac}=
754 | | | ... | Set Variable If | '${dut}' == 'DUT1' and ${duts_count} == 2
755 | | | ... | ${DUT2_pf1_mac}[0] | ${TG_pf2_mac}[0]
756 | | | ${_even}= | Evaluate | ${pf} % 2
757 | | | ${_mac}= | Set Variable If | ${_even}
758 | | | ... | ${_prev_mac} | ${_next_mac}
759 | | | VPP Add IP Neighbor
760 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
761 | | | ... | 172.${pf}6.${_subnet}.2 | ${_mac}
762 | | | VPP Route Add
763 | | | ... | ${nodes['${dut}']} | 172.${pf}7.${_subnet}.0 | 24
764 | | | ... | gateway=172.${pf}6.${_subnet}.2
765 | | | ... | interface=${${dut}_${int}${pf}_${id}}[0]
766 | | | Set VXLAN Bypass
767 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
768 | | | ${_ip4vxlan}= | Create List | ${_ip4vxlan}
769 | | | Set Test Variable
770 | | | ... | ${${dut}_ip4vxlan${pf}_${id}} | ${_ip4vxlan}
771 | | END
772
773 | Configure vhost interfaces
774 | | [Documentation]
775 | | ... | Create two Vhost-User interfaces on defined VPP node.
776 | |
777 | | ... | *Arguments:*
778 | | ... | - ${dut_node} - DUT node.
779 | | ... | Type: dictionary
780 | | ... | - ${sock1} - Socket path for first Vhost-User interface.
781 | | ... | Type: string
782 | | ... | - ${sock2} - Socket path for second Vhost-User interface.
783 | | ... | Type: string
784 | | ... | - ${vhost_if1} - Name of the first Vhost-User interface (Optional).
785 | | ... | Type: string
786 | | ... | - ${vhost_if2} - Name of the second Vhost-User interface (Optional).
787 | | ... | Type: string
788 | | ... | - ${is_server} - Server side of connection (Optional).
789 | | ... | Type: boolean
790 | | ... | - ${virtio_feature_mask} - Enabled Virtio feature flags (Optional).
791 | | ... | Type: integer
792 | |
793 | | ... | _NOTE:_ This KW sets following test case variable:
794 | | ... | - ${${vhost_if1}} - First Vhost-User interface.
795 | | ... | - ${${vhost_if2}} - Second Vhost-User interface.
796 | |
797 | | ... | *Example:*
798 | |
799 | | ... | \| Configure vhost interfaces \
800 | | ... | \| ${nodes['DUT1']} \| /tmp/sock1 \| /tmp/sock2 \|
801 | |
802 | | [Arguments] | ${dut_node} | ${sock1} | ${sock2} | ${vhost_if1}=vhost_if1
803 | | ... | ${vhost_if2}=vhost_if2 | ${is_server}=${False}
804 | | ... | ${virtio_feature_mask}=${None}
805 | |
806 | | ${vhost_1}= | Vpp Create Vhost User Interface
807 | | ... | ${dut_node} | ${sock1} | is_server=${is_server}
808 | | ... | virtio_feature_mask=${virtio_feature_mask}
809 | | ${vhost_2}= | Vpp Create Vhost User Interface
810 | | ... | ${dut_node} | ${sock2} | is_server=${is_server}
811 | | ... | virtio_feature_mask=${virtio_feature_mask}
812 | | ${vhost_1_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_1}
813 | | ${vhost_2_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_2}
814 | | ${vhost_1_mac}= | Get Interface MAC | ${dut_node} | ${vhost_1_key}
815 | | ${vhost_2_mac}= | Get Interface MAC | ${dut_node} | ${vhost_2_key}
816 | | Set Interface State | ${dut_node} | ${vhost_1} | up
817 | | Set Interface State | ${dut_node} | ${vhost_2} | up
818 | | Set Test Variable | ${${vhost_if1}} | ${vhost_1}
819 | | Set Test Variable | ${${vhost_if2}} | ${vhost_2}
820 | | Set Test Variable | ${${vhost_if1}_mac} | ${vhost_1_mac}
821 | | Set Test Variable | ${${vhost_if2}_mac} | ${vhost_2_mac}
822
823 | Get Vhost dump
824 | | [Documentation] | Get vhost-user dump.
825 | |
826 | | ... | *Arguments:*
827 | | ... | - dut - DUT node data.
828 | | ... | Type: dictionary
829 | |
830 | | [Arguments] | ${dut}
831 | |
832 | | ${vhost_dump}= | Vhost User Dump | ${dut}
833 | | Return From Keyword | ${vhost_dump}