Introduce VPP-IPsec container tests.
[csit.git] / resources / libraries / robot / shared / interfaces.robot
1 # Copyright (c) 2019 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 *** Keywords ***
19 | Set interfaces in path up
20 | | [Documentation]
21 | | ... | *Set UP state on VPP interfaces in path on all DUT nodes and set
22 | | ... | maximal MTU.*
23 | |
24 | | FOR | ${dut} | IN | @{duts}
25 | | | Set interfaces in path up on DUT | ${dut}
26 | | END
27 | | All VPP Interfaces Ready Wait | ${nodes} | retries=${300}
28
29 | Set interfaces in path up on DUT
30 | | [Documentation]
31 | | ... | *Set UP state on VPP interfaces in path on specified DUT node and
32 | | ... | set maximal MTU.*
33 | |
34 | | ... | *Arguments:*
35 | | ... | - dut - DUT node on which to set the interfaces up.
36 | | ... | Type: string
37 | |
38 | | ... | *Example:*
39 | |
40 | | ... | \| Set interfaces in path up on DUT \| DUT1 \|
41 | |
42 | | [Arguments] | ${dut}
43 # TODO: Rework KW to set all interfaces in path UP and set MTU (including
44 # software interfaces. Run KW at the start phase of VPP setup to split
45 # from other "functional" configuration. This will allow modularity of this
46 # library
47 | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
48 | | ... | Variable Should Exist | ${${dut}_if1}
49 | | Run Keyword If | '${if1_status}' == 'PASS'
50 | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1} | up
51 | | ... | ELSE
52 | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1_1} | up
53 | | Run Keyword Unless | '${if1_status}' == 'PASS'
54 | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1_2} | up
55 | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
56 | | ... | Variable Should Exist | ${${dut}_if2}
57 | | Run Keyword If | '${if2_status}' == 'PASS'
58 | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if2} | up
59 | | ... | ELSE
60 | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if2_1} | up
61 | | Run Keyword Unless | '${if2_status}' == 'PASS'
62 | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if2_2} | up
63 | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
64 | | ... | Variable Should Exist | ${${dut}_if1}
65 | | Run Keyword If | '${if1_status}' == 'PASS'
66 | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1}
67 | | ... | ELSE
68 | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1_1}
69 | | Run Keyword Unless | '${if1_status}' == 'PASS'
70 | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1_2}
71 | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
72 | | ... | Variable Should Exist | ${${dut}_if2}
73 | | Run Keyword If | '${if2_status}' == 'PASS'
74 | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if2}
75 | | ... | ELSE
76 | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if2_1}
77 | | Run Keyword Unless | '${if2_status}' == 'PASS'
78 | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if2_2}
79
80 | Set single interfaces in path up
81 | | [Documentation]
82 | | ... | *Set UP state on single VPP interfaces in path on all DUT nodes and set
83 | | ... | maximal MTU.*
84 | |
85 # TODO: Rework KW to set all interfaces in path UP and set MTU (including
86 # software interfaces. Run KW at the start phase of VPP setup to split
87 # from other "functional" configuration. This will allow modularity of this
88 # library
89 | | FOR | ${dut} | IN | @{duts}
90 | | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
91 | | | ... | Variable Should Exist | ${${dut}_if1}
92 | | | Run Keyword If | '${if1_status}' == 'PASS'
93 | | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1} | up
94 | | | ... | ELSE
95 | | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1_1} | up
96 | | | Run Keyword Unless | '${if1_status}' == 'PASS'
97 | | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1_2} | up
98 | | END
99 | | FOR | ${dut} | IN | @{duts}
100 | | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
101 | | | ... | Variable Should Exist | ${${dut}_if1}
102 | | | Run Keyword If | '${if1_status}' == 'PASS'
103 | | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1}
104 | | | ... | ELSE
105 | | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1_1}
106 | | | Run Keyword Unless | '${if1_status}' == 'PASS'
107 | | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1_2}
108 | | END
109 | | All VPP Interfaces Ready Wait | ${nodes}
110
111 | Get Vhost dump
112 | | [Documentation] | Get vhost-user dump.
113 | |
114 | | ... | *Arguments:*
115 | | ... | - node - DUT node data. Type: dictionary
116 | |
117 | | [Arguments] | ${dut_node}
118 | |
119 | | [Return] | ${vhost_dump}
120 | |
121 | | ${vhost_dump}= | Vhost User Dump | ${dut_node}
122
123 | Initialize layer interface on node
124 | | [Documentation]
125 | | ... | Baseline interfaces variables to be created.
126 | |
127 | | ... | *Arguments:*
128 | | ... | - dut - DUT node. Type: string
129 | | ... | - count - Number of baseline interface variables. Type: integer
130 | |
131 | | ... | *Example:*
132 | |
133 | | ... | \| Initialize layer interface on node \| DUT1 \| 1 \|
134 | |
135 | | [Arguments] | ${dut} | ${count}=${1}
136 | |
137 | | ${dut_str}= | Convert To Lowercase | ${dut}
138 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
139 | | | Set Test Variable | ${${dut_str}_if_${id}_1} | ${${dut_str}_if1}
140 | | | Set Test Variable | ${${dut_str}_if_${id}_2} | ${${dut_str}_if2}
141 | | END
142
143 | Initialize layer interface
144 | | [Documentation]
145 | | ... | Physical interfaces variables to be created on all DUTs.
146 | |
147 | | ... | *Arguments:*
148 | | ... | - count - Number of untagged interfaces variables. Type: integer
149 | |
150 | | ... | *Example:*
151 | |
152 | | ... | \| Initialize layer interface \| 1 \|
153 | |
154 | | [Arguments] | ${count}=${1}
155 | |
156 | | FOR | ${dut} | IN | @{duts}
157 | | | Initialize layer interface on node | ${dut} | count=${count}
158 | | END
159 | | Set Test Variable | ${prev_layer} | if
160
161 | Pre-initialize layer driver
162 | | [Documentation]
163 | | ... | Pre-initialize driver based interfaces on each DUT.
164 | |
165 | | ... | *Arguments:*
166 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
167 | | ... | Type: string
168 | |
169 | | ... | *Example:*
170 | |
171 | | ... | \| Pre-initialize layer driver \| vfio-pci \|
172 | |
173 | | [Arguments] | ${driver}
174 | |
175 | | Run Keyword | Pre-initialize layer ${driver} on all DUTs
176
177 | Pre-initialize layer vfio-pci on all DUTs
178 | | [Documentation]
179 | | ... | Pre-initialize vfio-pci driver by adding related sections to startup
180 | | ... | config on all DUTs.
181 | |
182 | | Add DPDK pci devices to all DUTs
183 | | FOR | ${dut} | IN | @{duts}
184 | | | Run Keyword | ${dut}.Add DPDK No Tx Checksum Offload
185 | | | Run Keyword | ${dut}.Add DPDK Log Level | debug
186 | | | Run Keyword | ${dut}.Add DPDK Uio Driver | vfio-pci
187 | | | Run Keyword | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
188 | | | Run Keyword If | not ${jumbo}
189 | | | ... | ${dut}.Add DPDK No Multi Seg
190 | | | Run Keyword If | ${rxd_count_int}
191 | | | ... | ${dut}.Add DPDK Dev Default RXD | ${rxd_count_int}
192 | | | Run Keyword If | ${txd_count_int}
193 | | | ... | ${dut}.Add DPDK Dev Default TXD | ${txd_count_int}
194 | | | Run Keyword If | '${crypto_type}' != '${None}'
195 | | | ... | ${dut}.Add DPDK Cryptodev | ${thr_count_int}
196 | | END
197
198 | Pre-initialize layer avf on all DUTs
199 | | [Documentation]
200 | | ... | Pre-initialize avf driver. Currently no operation.
201 | |
202 | | No operation
203
204 | Pre-initialize layer rdma-core on all DUTs
205 | | [Documentation]
206 | | ... | Pre-initialize rdma-core driver. Currently no operation.
207 | |
208 | | No operation
209
210 | Initialize layer driver
211 | | [Documentation]
212 | | ... | Initialize driver based interfaces on each DUT. Interfaces are
213 | | ... | brought up.
214 | |
215 | | ... | *Arguments:*
216 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
217 | | ... | Type: string
218 | |
219 | | ... | *Example:*
220 | |
221 | | ... | \| Initialize layer driver \| vfio-pci \|
222 | |
223 | | [Arguments] | ${driver}
224 | |
225 | | FOR | ${dut} | IN | @{duts}
226 | | | Run Keyword | Initialize layer ${driver} on node | ${dut}
227 | | END
228 | | Set Test Variable | ${prev_layer} | vf
229 | | Set interfaces in path up
230
231 | Initialize layer vfio-pci on node
232 | | [Documentation]
233 | | ... | Initialize vfio-pci interfaces on DUT. Currently no operation.
234 | |
235 | | ... | *Arguments:*
236 | | ... | - dut - DUT node. Type: string
237 | |
238 | | ... | *Example:*
239 | |
240 | | ... | \| Initialize layer vfio-pci on node \| DUT1 \|
241 | |
242 | | [Arguments] | ${dut}
243 | |
244 | | No operation
245
246 | Initialize layer avf on node
247 | | [Documentation]
248 | | ... | Initialize AVF interfaces on DUT.
249 | |
250 | | ... | *Arguments:*
251 | | ... | - dut - DUT node. Type: string
252 | |
253 | | ... | *Example:*
254 | |
255 | | ... | \| Initialize layer avf on node \| DUT1 \|
256 | |
257 | | [Arguments] | ${dut}
258 | |
259 | | ${dut_str}= | Convert To Lowercase | ${dut}
260 | | ${if1_vlan}= | Get Interface Vlan | ${nodes['${dut}']} | ${${dut}_if1}
261 | | ${if2_vlan}= | Get Interface Vlan | ${nodes['${dut}']} | ${${dut}_if2}
262 | | Set Test Variable | ${${dut_str}_vlan1} | ${if1_vlan}
263 | | Set Test Variable | ${${dut_str}_vlan2} | ${if2_vlan}
264 | | ${if1_pci}= | Get Interface PCI Addr | ${nodes['${dut}']}
265 | | ... | ${${dut}_if1_vf0}
266 | | ${if2_pci}= | Get Interface PCI Addr | ${nodes['${dut}']}
267 | | ... | ${${dut}_if2_vf0}
268 | | ${dut_new_if1}= | VPP Create AVF Interface | ${nodes['${dut}']}
269 | | ... | ${if1_pci} | ${rxq_count_int}
270 | | ${dut_new_if1_mac}= | Get Interface MAC | ${nodes['${dut}']}
271 | | ... | ${dut_new_if1}
272 | | ${dut_new_if2}= | VPP Create AVF Interface | ${nodes['${dut}']}
273 | | ... | ${if2_pci} | ${rxq_count_int}
274 | | ${dut_new_if2_mac}= | Get Interface MAC | ${nodes['${dut}']}
275 | | ... | ${dut_new_if2}
276 | | Set Test Variable | ${${dut_str}_if1} | ${dut_new_if1}
277 | | Set Test Variable | ${${dut_str}_if2} | ${dut_new_if2}
278 | | Set Test Variable | ${${dut_str}_if1_mac} | ${dut_new_if1_mac}
279 | | Set Test Variable | ${${dut_str}_if2_mac} | ${dut_new_if2_mac}
280
281 | Initialize layer rdma-core on node
282 | | [Documentation]
283 | | ... | Initialize rdma-core (MLX) interfaces on DUT.
284 | |
285 | | ... | *Arguments:*
286 | | ... | - dut - DUT node. Type: string
287 | |
288 | | ... | *Example:*
289 | |
290 | | ... | \| Initialize layer rdma-core on node \| DUT1 \|
291 | |
292 | | [Arguments] | ${dut}
293 | |
294 | | ${dut_str}= | Convert To Lowercase | ${dut}
295 | | ${if1_vlan}= | Get Interface Vlan | ${nodes['${dut}']} | ${${dut}_if1}
296 | | ${if2_vlan}= | Get Interface Vlan | ${nodes['${dut}']} | ${${dut}_if2}
297 | | Set Test Variable | ${${dut_str}_vlan1} | ${if1_vlan}
298 | | Set Test Variable | ${${dut_str}_vlan2} | ${if2_vlan}
299 | | ${if1_pci}= | Get Interface PCI Addr | ${nodes['${dut}']}
300 | | ... | ${${dut}_if1}
301 | | ${if2_pci}= | Get Interface PCI Addr | ${nodes['${dut}']}
302 | | ... | ${${dut}_if2}
303 | | ${dut_new_if1}= | VPP Create Rdma Interface | ${nodes['${dut}']}
304 | | ... | ${if1_pci} | ${rxq_count_int}
305 | | ${dut_new_if1_mac}= | Get Interface MAC | ${nodes['${dut}']}
306 | | ... | ${dut_new_if1}
307 | | ${dut_new_if2}= | VPP Create Rdma Interface | ${nodes['${dut}']}
308 | | ... | ${if2_pci} | ${rxq_count_int}
309 | | ${dut_new_if2_mac}= | Get Interface MAC | ${nodes['${dut}']}
310 | | ... | ${dut_new_if2}
311 | | Set Test Variable | ${${dut_str}_if1} | ${dut_new_if1}
312 | | Set Test Variable | ${${dut_str}_if2} | ${dut_new_if2}
313 | | Set Test Variable | ${${dut_str}_if1_mac} | ${dut_new_if1_mac}
314 | | Set Test Variable | ${${dut_str}_if2_mac} | ${dut_new_if2_mac}
315
316 | Initialize layer bonding on node
317 | | [Documentation]
318 | | ... | Bonded interface and variables to be created on across east and
319 | | ... | west DUT's node interfaces.
320 | |
321 | | ... | *Arguments:*
322 | | ... | - dut - DUT node. Type: string
323 | | ... | - bond_mode - Link bonding mode. Type: string
324 | | ... | - lb_mode - Load balance mode. Type: string
325 | | ... | - count - Number of bond interface variables. Type: integer
326 | |
327 | | ... | *Example:*
328 | |
329 | | ... | \| Initialize layer bonding on node \| DUT1 \| xor \| l34 \| 1 \|
330 | |
331 | | [Arguments] | ${dut} | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
332 | |
333 | | ${dut_str}= | Convert To Lowercase | ${dut}
334 | | ${if_index}= | VPP Create Bond Interface
335 | | ... | ${nodes['${dut}']} | ${bond_mode} | load_balance=${lb_mode}
336 | | ... | mac=00:00:00:01:01:01
337 | | Set Interface State | ${nodes['${dut}']} | ${if_index} | up
338 | | VPP Enslave Physical Interface
339 | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_1_1} | ${if_index}
340 | | VPP Enslave Physical Interface
341 | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_1_2} | ${if_index}
342 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
343 | | | Set Test Variable | ${${dut_str}_bond_${id}_1} | ${if_index}
344 | | | Set Test Variable | ${${dut_str}_bond_${id}_2} | ${if_index}
345 | | END
346
347 | Initialize layer bonding
348 | | [Documentation]
349 | | ... | Bonded interfaces and variables to be created on all DUT's interfaces.
350 | |
351 | | ... | *Arguments:*
352 | | ... | - bond_mode - Link bonding mode. Type: string
353 | | ... | - lb_mode - Load balance mode. Type: string
354 | | ... | - count - Number of bond interface variables. Type: integer
355 | |
356 | | ... | *Example:*
357 | |
358 | | ... | \| Initialize layer bonding \| xor \| l34 \| 1 \|
359 | |
360 | | [Arguments] | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
361 | |
362 | | FOR | ${dut} | IN | @{duts}
363 | | | Initialize layer bonding on node
364 | | | ... | ${dut} | bond_mode=${bond_mode} | lb_mode=${lb_mode}
365 | | | ... | count=${count}
366 | | END
367 | | Set Test Variable | ${prev_layer} | bond
368
369 | Initialize layer dot1q on node for chain
370 | | [Documentation]
371 | | ... | Optionally create tag popping subinterface per chain.
372 | | ... | Return interface indices for dot1q layer interfaces,
373 | | ... | or Nones if subinterfaces are not created.
374 | |
375 | | ... | *Arguments:*
376 | | ... | - dut - DUT node. Type: string
377 | | ... | - id - Positive index of the chain. Type: integer
378 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
379 | | ... | Type: boolean
380 | |
381 | | ... | *Example:*
382 | |
383 | | ... | \| Initialize layer dot1q on node for chain \| DUT1 \| 1 \| True \|
384 | |
385 | | [Arguments] | ${dut} | ${id} | ${vlan_per_chain}=${True}
386 | |
387 | | ${dut_str}= | Convert To Lowercase | ${dut}
388 | | Return From Keyword If | ${id} != ${1} and not ${vlan_per_chain}
389 | | ... | ${NONE} | ${NONE}
390 | | # TODO: Is it worth creating Get Variable Value If Not None keyword?
391 | | ${default}= | Evaluate | ${100} + ${id} - ${1}
392 | | ${if1_vlan}= | Get Variable Value | \${${dut_str}_vlan1}
393 | | ${if1_vlan}= | Set Variable If | '${if1_vlan}' != '${NONE}'
394 | | ... | ${if1_vlan} | ${default}
395 | | ${default}= | Evaluate | ${200} + ${id} - ${1}
396 | | ${if2_vlan}= | Get Variable Value | \${${dut_str}_vlan2}
397 | | ${if2_vlan}= | Set Variable If | '${if2_vlan}' != '${NONE}'
398 | | ... | ${if2_vlan} | ${default}
399 | | ${if1_name} | ${if1_index}= | Create Vlan Subinterface
400 | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_1}
401 | | ... | ${if1_vlan}
402 | | ${if2_name} | ${if2_index}= | Create Vlan Subinterface
403 | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_2}
404 | | ... | ${if2_vlan}
405 | | Set Interface State | ${nodes['${dut}']} | ${if1_index} | up
406 | | Set Interface State | ${nodes['${dut}']} | ${if2_index} | up
407 | | Configure L2 tag rewrite method on interfaces
408 | | ... | ${nodes['${dut}']} | ${if1_index} | TAG_REWRITE_METHOD=pop-1
409 | | Configure L2 tag rewrite method on interfaces
410 | | ... | ${nodes['${dut}']} | ${if2_index} | TAG_REWRITE_METHOD=pop-1
411 | | Return From Keyword | ${if1_index} | ${if2_index}
412
413 | Initialize layer dot1q on node
414 | | [Documentation]
415 | | ... | Dot1q interfaces and variables to be created on all DUT's node
416 | | ... | interfaces.
417 | |
418 | | ... | TODO: Unify names for number of chains/pipelines/instances/interfaces.
419 | | ... | Chose names and descriptions that makes sense for both
420 | | ... | nf_density and older tests.
421 | | ... | Note that with vlan_per_chain=False it is not a number of interfaces.
422 | | ... | At least not number of real interfaces, just number of aliases.
423 | | ... | This TODO applies also to all keywords with nf_chains argument.
424 | |
425 | | ... | *Arguments:*
426 | | ... | - dut - DUT node. Type: string
427 | | ... | - count - Number of chains. Type: integer
428 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
429 | | ... | Type: boolean
430 | | ... | - start - Id of first chain, allows adding chains during test.
431 | | ... | Type: integer
432 | |
433 | | ... | *Example:*
434 | |
435 | | ... | \| Initialize layer dot1q on node \| DUT1 \| 3 \| True \| 2 \|
436 | |
437 | | [Arguments] | ${dut} | ${count}=${1} | ${vlan_per_chain}=${True}
438 | | ... | ${start}=${1}
439 | |
440 | | ${dut_str}= | Convert To Lowercase | ${dut}
441 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
442 | | | ${if1_index} | ${if2_index}= | Initialize layer dot1q on node for chain
443 | | | ... | dut=${dut} | id=${id} | vlan_per_chain=${vlan_per_chain}
444 | | | # First id results in non-None indices, after that _1_ are defined.
445 | | | ${if1_index}= | Set Variable If | '${if1_index}' == '${NONE}'
446 | | | ... | ${${dut_str}_dot1q_1_1} | ${if1_index}
447 | | | ${if2_index}= | Set Variable If | '${if2_index}' == '${NONE}'
448 | | | ... | ${${dut_str}_dot1q_1_2} | ${if2_index}
449 | | | Set Test Variable | ${${dut_str}_dot1q_${id}_1} | ${if1_index}
450 | | | Set Test Variable | ${${dut_str}_dot1q_${id}_2} | ${if2_index}
451 | | END
452
453 | Initialize layer dot1q
454 | | [Documentation]
455 | | ... | Dot1q interfaces and variables to be created on all DUT's interfaces.
456 | |
457 | | ... | *Arguments:*
458 | | ... | - count - Number of chains. Type: integer
459 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
460 | | ... | Type: boolean
461 | | ... | - start - Id of first chain, allows adding chains during test.
462 | | ... | Type: integer
463 | |
464 | | ... | \| Initialize layer dot1q \| 3 \| True \| 2 \|
465 | |
466 | | [Arguments] | ${count}=${1} | ${vlan_per_chain}=${True} | ${start}=${1}
467 | |
468 | | FOR | ${dut} | IN | @{duts}
469 | | | Initialize layer dot1q on node | ${dut} | count=${count}
470 | | | ... | vlan_per_chain=${vlan_per_chain} | start=${start}
471 | | END
472 | | Set Test Variable | ${prev_layer} | dot1q
473
474 | Initialize layer ip4vxlan on node
475 | | [Documentation]
476 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
477 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
478 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
479 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
480 | |
481 | | ... | *Arguments:*
482 | | ... | - dut - DUT node. Type: string
483 | | ... | - count - Number of vxlan interfaces. Type: integer
484 | | ... | - start - Id of first chain, allows adding chains during test.
485 | | ... | Type: integer
486 | |
487 | | ... | *Example:*
488 | |
489 | | ... | \| Initialize layer ip4vxlan on node \| DUT1 \| 3 \| 2 \|
490 | |
491 | | [Arguments] | ${dut} | ${count}=${1} | ${start}=${1}
492 | |
493 | | ${dut_str}= | Convert To Lowercase | ${dut}
494 | | Run Keyword If | "${start}" == "1" | VPP Interface Set IP Address
495 | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_1_1}
496 | | ... | 172.16.0.1 | 24
497 | | Run Keyword If | "${start}" == "1" | VPP Interface Set IP Address
498 | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_1_2}
499 | | ... | 172.26.0.1 | 24
500 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
501 | | | ${subnet}= | Evaluate | ${id} - 1
502 | | | ${vni}= | Evaluate | ${id} - 1
503 | | | ${ip4vxlan_1}= | Create VXLAN interface
504 | | | ... | ${nodes['${dut}']} | ${vni} | 172.16.0.1 | 172.17.${subnet}.2
505 | | | ${ip4vxlan_2}= | Create VXLAN interface
506 | | | ... | ${nodes['${dut}']} | ${vni} | 172.26.0.1 | 172.27.${subnet}.2
507 | | | ${prev_mac}= | Set Variable If | '${dut}' == 'DUT1'
508 | | | ... | ${tg_if1_mac} | ${dut1_if2_mac}
509 | | | ${next_mac}= | Set Variable If | '${dut}' == 'DUT1' and ${duts_count} == 2
510 | | | ... | ${dut2_if1_mac} | ${tg_if2_mac}
511 | | | VPP Add IP Neighbor
512 | | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_1}
513 | | | ... | 172.16.${subnet}.2 | ${prev_mac}
514 | | | VPP Add IP Neighbor
515 | | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_2}
516 | | | ... | 172.26.${subnet}.2 | ${next_mac}
517 | | | VPP Route Add
518 | | | ... | ${nodes['${dut}']} | 172.17.${subnet}.0 | 24
519 | | | ... | gateway=172.16.${subnet}.2
520 | | | ... | interface=${${dut_str}_${prev_layer}_${id}_1}
521 | | | VPP Route Add
522 | | | ... | ${nodes['${dut}']} | 172.27.${subnet}.0 | 24
523 | | | ... | gateway=172.26.${subnet}.2
524 | | | ... | interface=${${dut_str}_${prev_layer}_${id}_2}
525 | | | Set VXLAN Bypass
526 | | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_1}
527 | | | Set VXLAN Bypass
528 | | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_2}
529 | | | Set Test Variable
530 | | | ... | ${${dut_str}_ip4vxlan_${id}_1} | ${ip4vxlan_1}
531 | | | Set Test Variable
532 | | | ... | ${${dut_str}_ip4vxlan_${id}_2} | ${ip4vxlan_2}
533 | | END
534
535 | Initialize layer ip4vxlan
536 | | [Documentation]
537 | | ... | VXLAN interfaces and variables to be created on all DUT's interfaces.
538 | |
539 | | ... | *Arguments:*
540 | | ... | - count - Number of vxlan interfaces. Type: integer
541 | | ... | - start - Id of first chain, allows adding chains during test.
542 | | ... | Type: integer
543 | |
544 | | ... | \| Initialize layer ip4vxlan \| 3 \| 2 \|
545 | |
546 | | [Arguments] | ${count}=${1} | ${start}=${1}
547 | |
548 | | FOR | ${dut} | IN | @{duts}
549 | | | Initialize layer ip4vxlan on node | ${dut} | count=${count}
550 | | ... | start=${start}
551 | | END
552 | | Set Test Variable | ${prev_layer} | ip4vxlan
553
554 | Configure vhost interfaces
555 | | [Documentation]
556 | | ... | Create two Vhost-User interfaces on defined VPP node.
557 | |
558 | | ... | *Arguments:*
559 | | ... | - ${dut_node} - DUT node. Type: dictionary
560 | | ... | - ${sock1} - Socket path for first Vhost-User interface. Type: string
561 | | ... | - ${sock2} - Socket path for second Vhost-User interface. Type: string
562 | | ... | - ${vhost_if1} - Name of the first Vhost-User interface (Optional).
563 | | ... | Type: string
564 | | ... | - ${vhost_if2} - Name of the second Vhost-User interface (Optional).
565 | | ... | Type: string
566 | |
567 | | ... | _NOTE:_ This KW sets following test case variable:
568 | | ... | - ${${vhost_if1}} - First Vhost-User interface.
569 | | ... | - ${${vhost_if2}} - Second Vhost-User interface.
570 | |
571 | | ... | *Example:*
572 | |
573 | | ... | \| Configure vhost interfaces \
574 | | ... | \| ${nodes['DUT1']} \| /tmp/sock1 \| /tmp/sock2 \|
575 | | ... | \| Configure vhost interfaces \
576 | | ... | \| ${nodes['DUT2']} \| /tmp/sock1 \| /tmp/sock2 \| dut2_vhost_if1 \
577 | | ... | \| dut2_vhost_if2 \|
578 | |
579 | | [Arguments] | ${dut_node} | ${sock1} | ${sock2} | ${vhost_if1}=vhost_if1
580 | | ... | ${vhost_if2}=vhost_if2
581 | |
582 | | ${vhost_1}= | Vpp Create Vhost User Interface | ${dut_node} | ${sock1}
583 | | ${vhost_2}= | Vpp Create Vhost User Interface | ${dut_node} | ${sock2}
584 | | ${vhost_1_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_1}
585 | | ${vhost_2_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_2}
586 | | ${vhost_1_mac}= | Get Interface MAC | ${dut_node} | ${vhost_1_key}
587 | | ${vhost_2_mac}= | Get Interface MAC | ${dut_node} | ${vhost_2_key}
588 | | Set Interface State | ${dut_node} | ${vhost_1} | up
589 | | Set Interface State | ${dut_node} | ${vhost_2} | up
590 | | Set Test Variable | ${${vhost_if1}} | ${vhost_1}
591 | | Set Test Variable | ${${vhost_if2}} | ${vhost_2}
592 | | Set Test Variable | ${${vhost_if1}_mac} | ${vhost_1_mac}
593 | | Set Test Variable | ${${vhost_if2}_mac} | ${vhost_2_mac}