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