tests: Add GSO enabled tests
[csit.git] / resources / libraries / robot / l2 / l2_xconnect.robot
1 # Copyright (c) 2020 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Settings ***
15 | Library | resources.libraries.python.L2Util
16 | Library | resources.libraries.python.InterfaceUtil
17
18 *** Keywords ***
19 | Configure L2XC
20 | | [Documentation]
21 | | ... | Setup Bidirectional Cross Connect on DUTs
22 | |
23 | | ... | *Arguments:*
24 | | ... | - dut - DUT node. Type: string
25 | | ... | - if1 - First interface. Type: string
26 | | ... | - if2 - Second interface. Type: string
27 | |
28 | | ... | *Example:*
29 | |
30 | | ... | \| Initialize L2 cross connect on node \| DUT1 \| 1 \|
31 | |
32 | | [Arguments] | ${dut} | ${if1} | ${if2}
33 | |
34 | | Set Interface State | ${dut} | ${if1} | up
35 | | Set Interface State | ${dut} | ${if2} | up
36 | | Vpp Setup Bidirectional Cross Connect | ${dut} | ${if1} | ${if2}
37
38 | Initialize L2 cross connect on node
39 | | [Documentation]
40 | | ... | Setup L2 cross connect topology by connecting RX/TX of two interfaces
41 | | ... | on each DUT. Interfaces are brought up.
42 | |
43 | | ... | *Arguments:*
44 | | ... | - dut - DUT node. Type: string
45 | | ... | - count - Number of interfaces pairs to connect. Type: integer
46 | |
47 | | ... | *Example:*
48 | |
49 | | ... | \| Initialize L2 cross connect on node \| DUT1 \| 1 \|
50 | |
51 | | [Arguments] | ${dut} | ${count}=${1}
52 | |
53 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
54 | | | VPP Setup Bidirectional Cross Connect | ${nodes['${dut}']}
55 | | | ... | ${${dut}_${int}1_${id}}[0] | ${${dut}_${int}2_${id}}[0]
56 | | END
57
58 | Initialize L2 cross connect
59 | | [Documentation]
60 | | ... | Setup L2 cross connect topology by connecting RX/TX of two interfaces
61 | | ... | on each DUT. Interfaces are brought up.
62 | |
63 | | ... | *Arguments:*
64 | | ... | - count - Number of interfaces pairs to connect. Type: integer
65 | |
66 | | ... | *Example:*
67 | |
68 | | ... | \| Initialize L2 cross connect \| 1 \|
69 | |
70 | | [Arguments] | ${count}=${1}
71 | |
72 | | FOR | ${dut} | IN | @{duts}
73 | | | Initialize L2 cross connect on node | ${dut} | count=${count}
74 | | END
75
76 | Initialize L2 xconnect with VXLANoIPv4 in 3-node circular topology
77 | | [Documentation]
78 | | ... | Setup L2 xconnect topology with VXLANoIPv4 by cross connecting
79 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
80 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
81 | | ... | between DUTs. VXLAN sub-interfaces has same IPv4 address as
82 | | ... | interfaces.
83 | |
84 | | Set interfaces in path up
85 | | VPP Interface Set IP Address
86 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 172.16.0.1 | 24
87 | | VPP Interface Set IP Address
88 | | ... | ${dut2} | ${DUT2_${int}1}[0] | 172.16.0.2 | 24
89 | | VPP Add IP Neighbor
90 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 172.16.0.2 | ${DUT2_${int}1_mac}[0]
91 | | VPP Add IP Neighbor
92 | | ... | ${dut2} | ${DUT2_${int}1}[0] | 172.16.0.1 | ${DUT1_${int}2_mac}[0]
93 | | ${dut1s_vxlan}= | Create VXLAN interface
94 | | ... | ${dut1} | 24 | 172.16.0.1 | 172.16.0.2
95 | | Configure L2XC
96 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${dut1s_vxlan}
97 | | ${dut2s_vxlan}= | Create VXLAN interface
98 | | ... | ${dut2} | 24 | 172.16.0.2 | 172.16.0.1
99 | | Configure L2XC
100 | | ... | ${dut2} | ${DUT2_${int}2}[0] | ${dut2s_vxlan}
101
102 | Initialize L2 xconnect with Vhost-User on node
103 | | [Documentation]
104 | | ... | Create pairs of Vhost-User interfaces for defined number of VMs on
105 | | ... | defined VPP node. Add each Vhost-User interface into L2 cross-connect
106 | | ... | with with physical inteface or Vhost-User interface of another VM.
107 | |
108 | | ... | *Arguments:*
109 | | ... | - dut - DUT node. Type: string
110 | | ... | - nf_nodes - VM count. Type: integer
111 | | ... | - virtio_feature_mask - Enabled Virtio features (Optional).
112 | | ... | Type: integer
113 | |
114 | | ... | *Note:*
115 | | ... | Socket paths for VM are defined in following format:
116 | | ... | - /tmp/sock-\${VM_ID}-1
117 | | ... | - /tmp/sock-\${VM_ID}-2
118 | |
119 | | ... | *Example:*
120 | |
121 | | ... | \| Initialize L2 xconnect with Vhost-User on node \| DUT1 \| 1 \|
122 | |
123 | | [Arguments] | ${dut} | ${nf_nodes}=${1} | ${virtio_feature_mask}=${None}
124 | |
125 | | FOR | ${number} | IN RANGE | 1 | ${nf_nodes}+1
126 | | | ${sock1}= | Set Variable | /run/vpp/sock-${number}-1
127 | | | ${sock2}= | Set Variable | /run/vpp/sock-${number}-2
128 | | | ${prev_index}= | Evaluate | ${number}-1
129 | | | Configure vhost interfaces | ${nodes['${dut}']}
130 | | | ... | ${sock1} | ${sock2} | ${dut}-vhost-${number}-if1
131 | | | ... | ${dut}-vhost-${number}-if2
132 | | | ... | virtio_feature_mask=${virtio_feature_mask}
133 | | | ${dut_xconnect_if1}= | Set Variable If | ${number}==1
134 | | | ... | ${${dut}_${int}1}[0]
135 | | | ... | ${${dut}-vhost-${prev_index}-if2}
136 | | | Configure L2XC | ${nodes['${dut}']} | ${dut_xconnect_if1}
137 | | | ... | ${${dut}-vhost-${number}-if1}
138 | | | Run Keyword If | ${number}==${nf_nodes} | Configure L2XC
139 | | | ... | ${nodes['${dut}']} | ${${dut}-vhost-${number}-if2}
140 | | | ... | ${${dut}_${int}2}[0]
141 | | END
142
143 | Initialize L2 xconnect with Vhost-User
144 | | [Documentation]
145 | | ... | Create pairs of Vhost-User interfaces for defined number of VMs on
146 | | ... | all VPP nodes. Add each Vhost-User interface into L2 cross-connect
147 | | ... | with with physical inteface or Vhost-User interface of another VM.
148 | |
149 | | ... | *Arguments:*
150 | | ... | - nf_nodes - VM count. Type: integer
151 | | ... | - virtio_feature_mask - Enabled Virtio features (Optional).
152 | | ... | Type: integer
153 | |
154 | | ... | *Example:*
155 | |
156 | | ... | \| Initialize L2 xconnect with Vhost-User \| 1 \|
157 | |
158 | | [Arguments] | ${nf_nodes}=${1} | ${virtio_feature_mask}=${None}
159 | |
160 | | FOR | ${dut} | IN | @{duts}
161 | | | Initialize L2 xconnect with Vhost-User on node | ${dut}
162 | | | ... | nf_nodes=${nf_nodes} | virtio_feature_mask=${virtio_feature_mask}
163 | | END
164
165 | Initialize L2 xconnect with Vhost-User and VLAN in circular topology
166 | | [Documentation]
167 | | ... | Create two Vhost-User interfaces on all defined VPP nodes. Cross
168 | | ... | connect each Vhost interface with one physical interface.
169 | | ... | Setup VLAN between DUTs. All interfaces are brought up.
170 | |
171 | | ... | *Arguments:*
172 | | ... | - subid - ID of the sub-interface to be created. Type: string
173 | | ... | - tag_rewrite - Method of tag rewrite. Type: string
174 | | ... | - virtio_feature_mask - Enabled Virtio features (Optional).
175 | | ... | Type: integer
176 | |
177 | | ... | *Example:*
178 | |
179 | | ... | \| L2 xconnect with Vhost-User and VLAN initialized in a 3-node\
180 | | ... | circular topology \| 10 \| pop-1 \|
181 | |
182 | | [Arguments] | ${subid} | ${tag_rewrite} | ${virtio_feature_mask}=${None}
183 | |
184 | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error
185 | | ... | Variable Should Exist | ${dut2}
186 | |
187 | | Set interfaces in path up
188 | |
189 | | Run Keyword If | '${dut2_status}' == 'PASS'
190 | | ... | Initialize VLAN dot1q sub-interfaces in circular topology
191 | | ... | ${dut1} | ${DUT1_${int}2}[0]
192 | | ... | ${dut2} | ${DUT2_${int}1}[0] | SUB_ID=${subid}
193 | | ... | ELSE | Initialize VLAN dot1q sub-interfaces in circular topology
194 | | ... | ${dut1} | ${DUT1_${int}2}[0] | SUB_ID=${subid}
195 | | Run Keyword If | '${dut2_status}' == 'PASS'
196 | | ... | Configure L2 tag rewrite method on interfaces
197 | | ... | ${dut1} | ${subif_index_1}
198 | | ... | ${dut2} | ${subif_index_2} | TAG_REWRITE_METHOD=${tag_rewrite}
199 | | ... | ELSE | Configure L2 tag rewrite method on interfaces
200 | | ... | ${dut1} | ${subif_index_1} | TAG_REWRITE_METHOD=${tag_rewrite}
201 | | Configure vhost interfaces
202 | | ... | ${dut1} | /run/vpp/sock-1-1 | /run/vpp/sock-1-2
203 | | ... | virtio_feature_mask=${virtio_feature_mask}
204 | | Configure L2XC
205 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${vhost_if1}
206 | | Configure L2XC
207 | | ... | ${dut1} | ${subif_index_1} | ${vhost_if2}
208 | | Run Keyword If | '${dut2_status}' == 'PASS'
209 | | ... | Configure vhost interfaces
210 | | ... | ${dut2} | /run/vpp/sock-1-1 | /run/vpp/sock-1-2
211 | | ... | virtio_feature_mask=${virtio_feature_mask}
212 | | Run Keyword If | '${dut2_status}' == 'PASS'
213 | | ... | Configure L2XC | ${dut2} | ${subif_index_2} | ${vhost_if1}
214 | | Run Keyword If | '${dut2_status}' == 'PASS'
215 | | ... | Configure L2XC | ${dut2} | ${DUT2_${int}2}[0] | ${vhost_if2}
216
217 | Initialize L2 xconnect with Vhost-User and VLAN with VPP link bonding in 3-node circular topology
218 | | [Documentation]
219 | | ... | Create two Vhost-User interfaces on all defined VPP nodes. Create one
220 | | ... | link bonding (BondEthernet) interface on both VPP nodes. Enslave one
221 | | ... | physical interface towards next DUT by BondEthernet interface. Setup
222 | | ... | VLAN on BondEthernet interfaces between DUTs. Cross connect one Vhost
223 | | ... | interface with physical interface towards TG and other Vhost interface
224 | | ... | with VLAN sub-interface. All interfaces are brought up.
225 | |
226 | | ... | *Arguments:*
227 | | ... | - subid - ID of the sub-interface to be created. Type: string
228 | | ... | - tag_rewrite - Method of tag rewrite. Type: string
229 | | ... | - bond_mode - Link bonding mode. Type: string
230 | | ... | - lb_mode - Load balance mode. Type: string
231 | | ... | - virtio_feature_mask - Enabled Virtio features (Optional).
232 | | ... | Type: integer
233 | |
234 | | ... | *Example:*
235 | |
236 | | ... | \| Initialize L2 xconnect with Vhost-User and VLAN with VPP link\
237 | | ... | bonding in 3-node circular topology \| 10 \| pop-1 \| xor \| l34 \|
238 | |
239 | | [Arguments] | ${subid} | ${tag_rewrite} | ${bond_mode} | ${lb_mode}
240 | | ... | ${virtio_feature_mask}=${None}
241 | |
242 | | Set interfaces in path up
243 | | ${dut1_eth_bond_if1}= | VPP Create Bond Interface
244 | | ... | ${dut1} | ${bond_mode} | ${lb_mode}
245 | | Set Interface State | ${dut1} | ${dut1_eth_bond_if1} | up
246 | | VPP Set interface MTU | ${dut1} | ${dut1_eth_bond_if1}
247 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
248 | | | ${_even}= | Evaluate | ${pf} % 2
249 | | | Run Keyword Unless | ${even}
250 | | | ... | VPP Enslave Physical Interface
251 | | | ... | ${dut1} | ${DUT1_${int}${pf}}[0] | ${dut1_eth_bond_if1}
252 | | END
253 | | ${dut2_eth_bond_if1}= | VPP Create Bond Interface
254 | | ... | ${dut2} | ${bond_mode} | ${lb_mode}
255 | | Set Interface State | ${dut2} | ${dut2_eth_bond_if1} | up
256 | | VPP Set interface MTU | ${dut2} | ${dut2_eth_bond_if1}
257 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
258 | | | ${_even}= | Evaluate | ${pf} % 2
259 | | | Run Keyword If | ${even}
260 | | | ... | VPP Enslave Physical Interface
261 | | | ... | ${dut2} | ${DUT2_${int}${pf}}[0] | ${dut2_eth_bond_if1}
262 | | END
263 | | VPP Show Bond Data On All Nodes | ${nodes} | verbose=${TRUE}
264 | | Initialize VLAN dot1q sub-interfaces in circular topology
265 | | ... | ${dut1} | ${dut1_eth_bond_if1}
266 | | ... | ${dut2} | ${dut2_eth_bond_if1} | ${subid}
267 | | Configure L2 tag rewrite method on interfaces
268 | | ... | ${dut1} | ${subif_index_1}
269 | | ... | ${dut2} | ${subif_index_2} | ${tag_rewrite}
270 | | Configure vhost interfaces
271 | | ... | ${dut1} | /run/vpp/sock-1-1 | /run/vpp/sock-1-2
272 | | ... | virtio_feature_mask=${virtio_feature_mask}
273 | | Configure L2XC
274 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${vhost_if1}
275 | | Configure L2XC
276 | | ... | ${dut1} | ${subif_index_1} | ${vhost_if2}
277 | | Configure vhost interfaces
278 | | ... | ${dut2} | /run/vpp/sock-1-1 | /run/vpp/sock-1-2
279 | | ... | virtio_feature_mask=${virtio_feature_mask}
280 | | Configure L2XC
281 | | ... | ${dut2} | ${subif_index_2} | ${vhost_if1}
282 | | Configure L2XC
283 | | ... | ${dut2} | ${DUT2_${int}2}[0] | ${vhost_if2}
284
285 | Initialize L2 xconnect with memif pairs on DUT node
286 | | [Documentation]
287 | | ... | Create pairs of Memif interfaces on DUT node. Cross connect each Memif
288 | | ... | interface with one physical interface or virtual interface to create
289 | | ... | a chain accross DUT node.
290 | |
291 | | ... | *Arguments:*
292 | | ... | - dut - DUT node. Type: dictionary
293 | | ... | - count - Number of memif pairs (containers). Type: integer
294 | |
295 | | ... | *Note:*
296 | | ... | Socket paths for Memif are defined in following format:
297 | | ... | - /tmp/memif-\${dut}_CNF\${number}-\${sid}
298 | |
299 | | ... | KW uses test variable \${rxq_count_int} set by KW Add worker threads
300 | | ... | and rxqueues to all DUTs
301 | |
302 | | ... | *Example:*
303 | |
304 | | ... | \| Initialize L2 xconnect with memif pairs on DUT node \| ${dut} \
305 | | ... | \| ${1} \|
306 | |
307 | | [Arguments] | ${dut} | ${count}
308 | |
309 | | FOR | ${number} | IN RANGE | 1 | ${count}+1
310 | | | ${sock1}= | Set Variable | memif-${dut}_CNF
311 | | | ${sock2}= | Set Variable | memif-${dut}_CNF
312 | | | ${prev_index}= | Evaluate | ${number}-1
313 | | | Set up memif interfaces on DUT node | ${nodes['${dut}']}
314 | | | ... | ${sock1} | ${sock2} | ${number} | ${dut}-memif-${number}-if1
315 | | | ... | ${dut}-memif-${number}-if2 | ${rxq_count_int} | ${rxq_count_int}
316 | | | ${xconnect_if1}= | Set Variable If | ${number}==1
317 | | | ... | ${${dut}_${int}1}[0] | ${${dut}-memif-${prev_index}-if2}
318 | | | Configure L2XC | ${nodes['${dut}']} | ${xconnect_if1}
319 | | | ... | ${${dut}-memif-${number}-if1}
320 | | | Run Keyword If | ${number}==${count} | Configure L2XC
321 | | | ... | ${nodes['${dut}']} | ${${dut}-memif-${number}-if2}
322 | | | ... | ${${dut}_${int}2}[0]
323 | | END
324
325 | Initialize L2 xconnect with memif pairs
326 | | [Documentation]
327 | | ... | Create pairs of Memif interfaces on all defined VPP nodes. Cross
328 | | ... | connect each Memif interface with one physical interface or virtual
329 | | ... | interface to create a chain accross DUT node.
330 | |
331 | | ... | *Arguments:*
332 | | ... | - count - Number of memif pairs (containers). Type: integer
333 | |
334 | | ... | *Example:*
335 | |
336 | | ... | \| Initialize L2 xconnect with memif pairs \| ${1} \|
337 | |
338 | | [Arguments] | ${count}=${1}
339 | |
340 | | FOR | ${dut} | IN | @{duts}
341 | | | Initialize L2 xconnect with memif pairs on DUT node | ${dut} | ${count}
342 | | END
343 | | Set interfaces in path up
344 | | Show Memif on all DUTs | ${nodes}
345 | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=memif