Trending: new daily set
[csit.git] / resources / libraries / robot / l2 / l2_xconnect.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
14 *** Settings ***
15 | Library | resources.libraries.python.L2Util
16 | Library | resources.libraries.python.InterfaceUtil
17
18 *** Keywords ***
19 | Configure L2XC
20 | | [Documentation] | Setup Bidirectional Cross Connect on DUTs
21 | | [Arguments] | ${node} | ${if1} | ${if2} |
22 | | Set Interface State | ${node} | ${if1} | up
23 | | Set Interface State | ${node} | ${if2} | up
24 | | Vpp Setup Bidirectional Cross Connect | ${node} | ${if1} | ${if2}
25
26 | Initialize L2 cross connect on node
27 | | [Documentation]
28 | | ... | Setup L2 cross connect topology by connecting RX/TX of two interfaces
29 | | ... | on each DUT. Interfaces are brought up.
30 | |
31 | | ... | *Arguments:*
32 | | ... | - dut - DUT node. Type: string
33 | | ... | - count - Number of interfaces pairs to connect. Type: integer
34 | |
35 | | ... | *Example:*
36 | |
37 | | ... | \| Initialize L2 cross connect on node \| DUT1 \| 1 \|
38 | |
39 | | [Arguments] | ${dut} | ${count}=${1}
40 | |
41 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
42 | | | ${dut_str}= | Convert To Lowercase | ${dut}
43 | | | VPP Setup Bidirectional Cross Connect | ${nodes['${dut}']}
44 | | | ... | ${${dut_str}_${prev_layer}_${id}_1}
45 | | | ... | ${${dut_str}_${prev_layer}_${id}_2}
46 | | END
47
48 | Initialize L2 cross connect
49 | | [Documentation]
50 | | ... | Setup L2 cross connect topology by connecting RX/TX of two interfaces
51 | | ... | on each DUT. Interfaces are brought up.
52 | |
53 | | ... | *Arguments:*
54 | | ... | - count - Number of interfaces pairs to connect. Type: integer
55 | |
56 | | ... | *Example:*
57 | |
58 | | ... | \| Initialize L2 cross connect \| 1 \|
59 | |
60 | | [Arguments] | ${count}=${1}
61 | |
62 | | FOR | ${dut} | IN | @{duts}
63 | | | Initialize L2 cross connect on node | ${dut} | count=${count}
64 | | END
65
66 | Initialize L2 xconnect in 2-node circular topology
67 | | [Documentation]
68 | | ... | Setup L2 xconnect topology by cross connecting two interfaces on
69 | | ... | each DUT. Interfaces are brought up.
70 | |
71 | | Set interfaces in path up
72 | | VPP Setup Bidirectional Cross Connect | ${dut1} | ${dut1_if1} | ${dut1_if2}
73
74 | Initialize L2 xconnect in 3-node circular topology
75 | | [Documentation]
76 | | ... | Setup L2 xconnect topology by cross connecting two interfaces on
77 | | ... | each DUT. Interfaces are brought up.
78 | | ... |
79 | | Set interfaces in path up
80 | | VPP Setup Bidirectional Cross Connect | ${dut1} | ${dut1_if1} | ${dut1_if2}
81 | | VPP Setup Bidirectional Cross Connect | ${dut2} | ${dut2_if1} | ${dut2_if2}
82
83 | Initialize L2 xconnect with VXLANoIPv4 in 3-node circular topology
84 | | [Documentation]
85 | | ... | Setup L2 xconnect topology with VXLANoIPv4 by cross connecting
86 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
87 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
88 | | ... | between DUTs. VXLAN sub-interfaces has same IPv4 address as
89 | | ... | interfaces.
90 | |
91 | | Set interfaces in path up
92 | | VPP Interface Set IP Address | ${dut1} | ${dut1_if2} | 172.16.0.1 | 24
93 | | VPP Interface Set IP Address | ${dut2} | ${dut2_if1} | 172.16.0.2 | 24
94 | | VPP Add IP Neighbor | ${dut1} | ${dut1_if2} | 172.16.0.2 | ${dut2_if1_mac}
95 | | VPP Add IP Neighbor | ${dut2} | ${dut2_if1} | 172.16.0.1 | ${dut1_if2_mac}
96 | | ${dut1s_vxlan}= | Create VXLAN interface | ${dut1} | 24
97 | | ... | 172.16.0.1 | 172.16.0.2
98 | | Configure L2XC | ${dut1} | ${dut1_if1} | ${dut1s_vxlan}
99 | | ${dut2s_vxlan}= | Create VXLAN interface | ${dut2} | 24
100 | | ... | 172.16.0.2 | 172.16.0.1
101 | | Configure L2XC | ${dut2} | ${dut2_if2} | ${dut2s_vxlan}
102
103 | Initialize L2 xconnect with Vhost-User on node
104 | | [Documentation]
105 | | ... | Create pairs of Vhost-User interfaces for defined number of VMs on
106 | | ... | defined VPP node. Add each Vhost-User interface into L2 cross-connect
107 | | ... | with with physical inteface or Vhost-User interface of another VM.
108 | |
109 | | ... | *Arguments:*
110 | | ... | - dut - DUT node. Type: string
111 | | ... | - nf_nodes - VM count. Type: integer
112 | |
113 | | ... | *Note:*
114 | | ... | Socket paths for VM are defined in following format:
115 | | ... | - /tmp/sock-\${VM_ID}-1
116 | | ... | - /tmp/sock-\${VM_ID}-2
117 | |
118 | | ... | *Example:*
119 | |
120 | | ... | \| Initialize L2 xconnect with Vhost-User on node \| DUT1 \| 1 \|
121 | |
122 | | [Arguments] | ${dut} | ${nf_nodes}=${1}
123 | |
124 | | FOR | ${number} | IN RANGE | 1 | ${nf_nodes}+1
125 | | | ${sock1}= | Set Variable | /var/run/vpp/sock-${number}-1
126 | | | ${sock2}= | Set Variable | /var/run/vpp/sock-${number}-2
127 | | | ${prev_index}= | Evaluate | ${number}-1
128 | | | Configure vhost interfaces | ${nodes['${dut}']}
129 | | | ... | ${sock1} | ${sock2} | ${dut}-vhost-${number}-if1
130 | | | ... | ${dut}-vhost-${number}-if2
131 | | | ${dut_xconnect_if1}= | Set Variable If | ${number}==1 | ${${dut}_if1}
132 | | | ... | ${${dut}-vhost-${prev_index}-if2}
133 | | | Configure L2XC | ${nodes['${dut}']} | ${dut_xconnect_if1}
134 | | | ... | ${${dut}-vhost-${number}-if1}
135 | | | Run Keyword If | ${number}==${nf_nodes} | Configure L2XC
136 | | | ... | ${nodes['${dut}']} | ${${dut}-vhost-${number}-if2} | ${${dut}_if2}
137 | | END
138
139 | Initialize L2 xconnect with Vhost-User
140 | | [Documentation]
141 | | ... | Create pairs of Vhost-User interfaces for defined number of VMs on
142 | | ... | all VPP nodes. Add each Vhost-User interface into L2 cross-connect
143 | | ... | with with physical inteface or Vhost-User interface of another VM.
144 | |
145 | | ... | *Arguments:*
146 | | ... | - nf_nodes - VM count. Type: integer
147 | |
148 | | ... | *Example:*
149 | |
150 | | ... | \| Initialize L2 xconnect with Vhost-User \| 1 \|
151 | |
152 | | [Arguments] | ${nf_nodes}=${1}
153 | |
154 | | FOR | ${dut} | IN | @{duts}
155 | | | Initialize L2 xconnect with Vhost-User on node | ${dut}
156 | | | ... | nf_nodes=${nf_nodes}
157 | | END
158
159 | Initialize L2 xconnect with Vhost-User and VLAN in circular topology
160 | | [Documentation]
161 | | ... | Create two Vhost-User interfaces on all defined VPP nodes. Cross
162 | | ... | connect each Vhost interface with one physical interface.
163 | | ... | Setup VLAN between DUTs. All interfaces are brought up.
164 | |
165 | | ... | *Arguments:*
166 | | ... | - subid - ID of the sub-interface to be created. Type: string
167 | | ... | - tag_rewrite - Method of tag rewrite. Type: string
168 | |
169 | | ... | *Example:*
170 | |
171 | | ... | \| L2 xconnect with Vhost-User and VLAN initialized in a 3-node\
172 | | ... | circular topology \| 10 \| pop-1 \|
173 | |
174 | | [Arguments] | ${subid} | ${tag_rewrite}
175 | |
176 | | Set interfaces in path up
177 | |
178 | | Run Keyword If | '${dut2_status}' == 'PASS'
179 | | ... | Initialize VLAN dot1q sub-interfaces in circular topology
180 | | ... | ${dut1} | ${dut1_if2} | ${dut2} | ${dut2_if1} | ${subid}
181 | | ... | ELSE | Initialize VLAN dot1q sub-interfaces in circular topology
182 | | ... | ${dut1} | ${dut1_if2} | SUB_ID=${subid}
183 | | Run Keyword If | '${dut2_status}' == 'PASS'
184 | | ... | Configure L2 tag rewrite method on interfaces | ${dut1}
185 | | ... | ${subif_index_1} | ${dut2} | ${subif_index_2} | ${tag_rewrite}
186 | | ... | ELSE | Configure L2 tag rewrite method on interfaces
187 | | ... | ${dut1} | ${subif_index_1} | TAG_REWRITE_METHOD=${tag_rewrite}
188 | |
189 | | Configure vhost interfaces
190 | | ... | ${dut1} | /var/run/vpp/sock-1-1 | /var/run/vpp/sock-1-2
191 | | Configure L2XC | ${dut1} | ${dut1_if1} | ${vhost_if1}
192 | | Configure L2XC | ${dut1} | ${subif_index_1} | ${vhost_if2}
193 | |
194 | | Run Keyword If | '${dut2_status}' == 'PASS'
195 | | ... | Configure vhost interfaces
196 | | ... | ${dut2} | /var/run/vpp/sock-1-1 | /var/run/vpp/sock-1-2
197 | | Run Keyword If | '${dut2_status}' == 'PASS'
198 | | ... | Configure L2XC | ${dut2} | ${subif_index_2} | ${vhost_if1}
199 | | Run Keyword If | '${dut2_status}' == 'PASS'
200 | | ... | Configure L2XC | ${dut2} | ${dut2_if2} | ${vhost_if2}
201
202 | Initialize L2 xconnect with Vhost-User and VLAN with VPP link bonding in 3-node circular topology
203 | | [Documentation]
204 | | ... | Create two Vhost-User interfaces on all defined VPP nodes. Create one
205 | | ... | link bonding (BondEthernet) interface on both VPP nodes. Enslave one
206 | | ... | physical interface towards next DUT by BondEthernet interface. Setup
207 | | ... | VLAN on BondEthernet interfaces between DUTs. Cross connect one Vhost
208 | | ... | interface with physical interface towards TG and other Vhost interface
209 | | ... | with VLAN sub-interface. All interfaces are brought up.
210 | |
211 | | ... | *Arguments:*
212 | | ... | - subid - ID of the sub-interface to be created. Type: string
213 | | ... | - tag_rewrite - Method of tag rewrite. Type: string
214 | | ... | - bond_mode - Link bonding mode. Type: string
215 | | ... | - lb_mode - Load balance mode. Type: string
216 | |
217 | | ... | *Example:*
218 | |
219 | | ... | \| Initialize L2 xconnect with Vhost-User and VLAN with VPP link\
220 | | ... | bonding in 3-node circular topology \| 10 \| pop-1 \| xor \| l34 \|
221 | |
222 | | [Arguments] | ${subid} | ${tag_rewrite} | ${bond_mode} | ${lb_mode}
223 | |
224 | | Set interfaces in path up
225 | | ${dut1_eth_bond_if1}= | VPP Create Bond Interface | ${dut1} | ${bond_mode}
226 | | ... | ${lb_mode}
227 | | Set Interface State | ${dut1} | ${dut1_eth_bond_if1} | up
228 | | VPP Set interface MTU | ${dut1} | ${dut1_eth_bond_if1}
229 | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
230 | | ... | Variable Should Exist | ${dut1_if2}
231 | | Run Keyword If | '${if2_status}' == 'PASS'
232 | | ... | VPP Enslave Physical Interface | ${dut1} | ${dut1_if2}
233 | | ... | ${dut1_eth_bond_if1}
234 | | ... | ELSE
235 | | ... | VPP Enslave Physical Interface | ${dut1} | ${dut1_if2_1}
236 | | ... | ${dut1_eth_bond_if1}
237 | | Run Keyword Unless | '${if2_status}' == 'PASS'
238 | | ... | VPP Enslave Physical Interface | ${dut1} | ${dut1_if2_2}
239 | | ... | ${dut1_eth_bond_if1}
240 | | ${dut2_eth_bond_if1}= | VPP Create Bond Interface | ${dut2} | ${bond_mode}
241 | | ... | ${lb_mode}
242 | | Set Interface State | ${dut2} | ${dut2_eth_bond_if1} | up
243 | | VPP Set interface MTU | ${dut1} | ${dut1_eth_bond_if1}
244 | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
245 | | ... | Variable Should Exist | ${dut2_if1}
246 | | Run Keyword If | '${if1_status}' == 'PASS'
247 | | ... | VPP Enslave Physical Interface | ${dut2} | ${dut2_if1}
248 | | ... | ${dut2_eth_bond_if1}
249 | | ... | ELSE
250 | | ... | VPP Enslave Physical Interface | ${dut2} | ${dut2_if1_1}
251 | | ... | ${dut2_eth_bond_if1}
252 | | Run Keyword Unless | '${if2_status}' == 'PASS'
253 | | ... | VPP Enslave Physical Interface | ${dut2} | ${dut2_if1_2}
254 | | ... | ${dut2_eth_bond_if1}
255 | | VPP Show Bond Data On All Nodes | ${nodes} | verbose=${TRUE}
256 | | Initialize VLAN dot1q sub-interfaces in circular topology
257 | | ... | ${dut1} | ${dut1_eth_bond_if1} | ${dut2} | ${dut2_eth_bond_if1}
258 | | ... | ${subid}
259 | | Configure L2 tag rewrite method on interfaces
260 | | ... | ${dut1} | ${subif_index_1} | ${dut2} | ${subif_index_2}
261 | | ... | ${tag_rewrite}
262 | | Configure vhost interfaces
263 | | ... | ${dut1} | /var/run/vpp/sock-1-1 | /var/run/vpp/sock-1-2
264 | | Configure L2XC | ${dut1} | ${dut1_if1} | ${vhost_if1}
265 | | Configure L2XC | ${dut1} | ${subif_index_1} | ${vhost_if2}
266 | | Configure vhost interfaces
267 | | ... | ${dut2} | /var/run/vpp/sock-1-1 | /var/run/vpp/sock-1-2
268 | | Configure L2XC | ${dut2} | ${subif_index_2} | ${vhost_if1}
269 | | Configure L2XC | ${dut2} | ${dut2_if2} | ${vhost_if2}
270
271 | Initialize L2 xconnect with memif pairs on DUT node
272 | | [Documentation]
273 | | ... | Create pairs of Memif interfaces on DUT node. Cross connect each Memif
274 | | ... | interface with one physical interface or virtual interface to create
275 | | ... | a chain accross DUT node.
276 | |
277 | | ... | *Arguments:*
278 | | ... | - dut - DUT node. Type: dictionary
279 | | ... | - count - Number of memif pairs (containers). Type: integer
280 | |
281 | | ... | *Note:*
282 | | ... | Socket paths for Memif are defined in following format:
283 | | ... | - /tmp/memif-\${dut}_CNF\${number}-\${sid}
284 | |
285 | | ... | KW uses test variable \${rxq_count_int} set by KW Add worker threads
286 | | ... | and rxqueues to all DUTs
287 | |
288 | | ... | *Example:*
289 | |
290 | | ... | \| Initialize L2 xconnect with memif pairs on DUT node \| ${dut} \
291 | | ... | \| ${1} \|
292 | |
293 | | [Arguments] | ${dut} | ${count}
294 | |
295 | | FOR | ${number} | IN RANGE | 1 | ${count}+1
296 | | | ${sock1}= | Set Variable | memif-${dut}_CNF
297 | | | ${sock2}= | Set Variable | memif-${dut}_CNF
298 | | | ${prev_index}= | Evaluate | ${number}-1
299 | | | Set up memif interfaces on DUT node | ${nodes['${dut}']}
300 | | | ... | ${sock1} | ${sock2} | ${number} | ${dut}-memif-${number}-if1
301 | | | ... | ${dut}-memif-${number}-if2 | ${rxq_count_int} | ${rxq_count_int}
302 | | | ${xconnect_if1}= | Set Variable If | ${number}==1 | ${${dut}_if1}
303 | | | ... | ${${dut}-memif-${prev_index}-if2}
304 | | | Configure L2XC | ${nodes['${dut}']} | ${xconnect_if1}
305 | | | ... | ${${dut}-memif-${number}-if1}
306 | | | Run Keyword If | ${number}==${count} | Configure L2XC
307 | | | ... | ${nodes['${dut}']} | ${${dut}-memif-${number}-if2} | ${${dut}_if2}
308 | | END
309
310 | Initialize L2 xconnect with memif pairs
311 | | [Documentation]
312 | | ... | Create pairs of Memif interfaces on all defined VPP nodes. Cross
313 | | ... | connect each Memif interface with one physical interface or virtual
314 | | ... | interface to create a chain accross DUT node.
315 | |
316 | | ... | *Arguments:*
317 | | ... | - count - Number of memif pairs (containers). Type: integer
318 | |
319 | | ... | *Example:*
320 | |
321 | | ... | \| Initialize L2 xconnect with memif pairs \| ${1} \|
322 | |
323 | | [Arguments] | ${count}=${1}
324 | |
325 | | FOR | ${dut} | IN | @{duts}
326 | | | Initialize L2 xconnect with memif pairs on DUT node | ${dut} | ${count}
327 | | END
328 | | Set interfaces in path up
329 | | Show Memif on all DUTs | ${nodes}
330 | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=memif
331
332 | Initialize L2 xconnect for single memif
333 | | [Documentation]
334 | | ... | Create single Memif interface on all defined VPP nodes. Cross
335 | | ... | connect Memif interface with one physical interface.
336 | |
337 | | ... | *Arguments:*
338 | | ... | - number - Memif ID. Type: integer
339 | |
340 | | ... | *Note:*
341 | | ... | Socket paths for Memif are defined in following format:
342 | | ... | - /tmp/memif-DUT1_CNF\${number}-\${sid}
343 | |
344 | | ... | KW uses test variable ${rxq_count_int} set by KW Add worker threads
345 | | ... | and rxqueues to all DUTs
346 | |
347 | | ... | *Example:*
348 | |
349 | | ... | \| Initialize L2 xconnect for single memif \| 1 \|
350 | |
351 | | [Arguments] | ${number}=${1}
352 | |
353 | | FOR | ${dut} | IN | @{duts}
354 | | | ${sock}= | Set Variable | memif-${dut}_CNF
355 | | | ${sid}= | Evaluate | (${number} * ${2}) - ${1}
356 | | | Set up single memif interface on DUT node | ${nodes['${dut}']} | ${sock}
357 | | | ... | mid=${number} | sid=${sid} | memif_if=${dut}-memif-${number}-if1
358 | | | ... | rxq=${rxq_count_int} | txq=${rxq_count_int}
359 | | | Configure L2XC | ${nodes['${dut}']} | ${${dut}_if1}
360 | | | ... | ${${dut}-memif-${number}-if1}
361 | | END
362 | | Set single interfaces in path up
363 | | Show Memif on all DUTs | ${nodes}
364 | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=memif