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