59199b6c900b6e56798750ff69482100ef23d4fb
[csit.git] / resources / libraries / robot / l2 / l2_xconnect.robot
1 # Copyright (c) 2021 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
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. Add one
221 | | ... | physical interface towards next DUT as a member of BondEthernet
222 | | ... | interface. Setup VLAN on BondEthernet interfaces between DUTs. Cross
223 | | ... | connect one Vhost interface with physical interface towards TG and
224 | | ... | other Vhost interface with VLAN sub-interface. All interfaces are
225 | | ... | brought up.
226 | |
227 | | ... | *Arguments:*
228 | | ... | - subid - ID of the sub-interface to be created. Type: string
229 | | ... | - tag_rewrite - Method of tag rewrite. Type: string
230 | | ... | - bond_mode - Link bonding mode. Type: string
231 | | ... | - lb_mode - Load balance mode. Type: string
232 | | ... | - virtio_feature_mask - Enabled Virtio features (Optional).
233 | | ... | Type: integer
234 | |
235 | | ... | *Example:*
236 | |
237 | | ... | \| Initialize L2 xconnect with Vhost-User and VLAN with VPP link\
238 | | ... | bonding in 3-node circular topology \| 10 \| pop-1 \| xor \| l34 \|
239 | |
240 | | [Arguments] | ${subid} | ${tag_rewrite} | ${bond_mode} | ${lb_mode}
241 | | ... | ${virtio_feature_mask}=${None}
242 | |
243 | | Set interfaces in path up
244 | | ${dut1_eth_bond_if1}= | VPP Create Bond Interface
245 | | ... | ${dut1} | ${bond_mode} | ${lb_mode}
246 | | Set Interface State | ${dut1} | ${dut1_eth_bond_if1} | up
247 | | VPP Set interface MTU | ${dut1} | ${dut1_eth_bond_if1}
248 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
249 | | | ${_even}= | Evaluate | ${pf} % 2
250 | | | Run Keyword Unless | ${even}
251 | | | ... | VPP Add Bond Member
252 | | | ... | ${dut1} | ${DUT1_${int}${pf}}[0] | ${dut1_eth_bond_if1}
253 | | END
254 | | ${dut2_eth_bond_if1}= | VPP Create Bond Interface
255 | | ... | ${dut2} | ${bond_mode} | ${lb_mode}
256 | | Set Interface State | ${dut2} | ${dut2_eth_bond_if1} | up
257 | | VPP Set interface MTU | ${dut2} | ${dut2_eth_bond_if1}
258 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
259 | | | ${_even}= | Evaluate | ${pf} % 2
260 | | | Run Keyword If | ${even}
261 | | | ... | VPP Add Bond Member
262 | | | ... | ${dut2} | ${DUT2_${int}${pf}}[0] | ${dut2_eth_bond_if1}
263 | | END
264 | | VPP Show Bond Data On All Nodes | ${nodes} | verbose=${TRUE}
265 | | Initialize VLAN dot1q sub-interfaces in circular topology
266 | | ... | ${dut1} | ${dut1_eth_bond_if1}
267 | | ... | ${dut2} | ${dut2_eth_bond_if1} | ${subid}
268 | | Configure L2 tag rewrite method on interfaces
269 | | ... | ${dut1} | ${subif_index_1}
270 | | ... | ${dut2} | ${subif_index_2} | ${tag_rewrite}
271 | | Configure vhost interfaces
272 | | ... | ${dut1} | /run/vpp/sock-1-1 | /run/vpp/sock-1-2
273 | | ... | virtio_feature_mask=${virtio_feature_mask}
274 | | Configure L2XC
275 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${vhost_if1}
276 | | Configure L2XC
277 | | ... | ${dut1} | ${subif_index_1} | ${vhost_if2}
278 | | Configure vhost interfaces
279 | | ... | ${dut2} | /run/vpp/sock-1-1 | /run/vpp/sock-1-2
280 | | ... | virtio_feature_mask=${virtio_feature_mask}
281 | | Configure L2XC
282 | | ... | ${dut2} | ${subif_index_2} | ${vhost_if1}
283 | | Configure L2XC
284 | | ... | ${dut2} | ${DUT2_${int}2}[0] | ${vhost_if2}
285
286 | Initialize L2 xconnect with memif pairs on DUT node
287 | | [Documentation]
288 | | ... | Create pairs of Memif interfaces on DUT node. Cross connect each Memif
289 | | ... | interface with one physical interface or virtual interface to create
290 | | ... | a chain accross DUT node.
291 | |
292 | | ... | *Arguments:*
293 | | ... | - dut - DUT node. Type: dictionary
294 | | ... | - count - Number of memif pairs (containers). Type: integer
295 | |
296 | | ... | *Note:*
297 | | ... | Socket paths for Memif are defined in following format:
298 | | ... | - /tmp/memif-\${dut}_CNF\${number}-\${sid}
299 | |
300 | | ... | KW uses test variable \${rxq_count_int} set by KW Add worker threads
301 | | ... | and rxqueues to all DUTs
302 | |
303 | | ... | *Example:*
304 | |
305 | | ... | \| Initialize L2 xconnect with memif pairs on DUT node \| ${dut} \
306 | | ... | \| ${1} \|
307 | |
308 | | [Arguments] | ${dut} | ${count}
309 | |
310 | | FOR | ${number} | IN RANGE | 1 | ${count}+1
311 | | | ${sock1}= | Set Variable | memif-${dut}_CNF
312 | | | ${sock2}= | Set Variable | memif-${dut}_CNF
313 | | | ${prev_index}= | Evaluate | ${number}-1
314 | | | Set up memif interfaces on DUT node | ${nodes['${dut}']}
315 | | | ... | ${sock1} | ${sock2} | ${number} | ${dut}-memif-${number}-if1
316 | | | ... | ${dut}-memif-${number}-if2 | ${rxq_count_int} | ${rxq_count_int}
317 | | | ${xconnect_if1}= | Set Variable If | ${number}==1
318 | | | ... | ${${dut}_${int}1}[0] | ${${dut}-memif-${prev_index}-if2}
319 | | | Configure L2XC | ${nodes['${dut}']} | ${xconnect_if1}
320 | | | ... | ${${dut}-memif-${number}-if1}
321 | | | Run Keyword If | ${number}==${count} | Configure L2XC
322 | | | ... | ${nodes['${dut}']} | ${${dut}-memif-${number}-if2}
323 | | | ... | ${${dut}_${int}2}[0]
324 | | END
325
326 | Initialize L2 xconnect with memif pairs
327 | | [Documentation]
328 | | ... | Create pairs of Memif interfaces on all defined VPP nodes. Cross
329 | | ... | connect each Memif interface with one physical interface or virtual
330 | | ... | interface to create a chain accross DUT node.
331 | |
332 | | ... | *Arguments:*
333 | | ... | - count - Number of memif pairs (containers). Type: integer
334 | |
335 | | ... | *Example:*
336 | |
337 | | ... | \| Initialize L2 xconnect with memif pairs \| ${1} \|
338 | |
339 | | [Arguments] | ${count}=${1}
340 | |
341 | | FOR | ${dut} | IN | @{duts}
342 | | | Initialize L2 xconnect with memif pairs on DUT node | ${dut} | ${count}
343 | | END
344 | | Set interfaces in path up
345 | | Show Memif on all DUTs | ${nodes}
346 | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=memif