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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 | Library | resources.libraries.python.L2Util
16 | Library | resources.libraries.python.InterfaceUtil
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}
26 | Initialize L2 cross connect on node
28 | | ... | Setup L2 cross connect topology by connecting RX/TX of two interfaces
29 | | ... | on each DUT. Interfaces are brought up.
31 | | ... | *Arguments:*
32 | | ... | - dut - DUT node. Type: string
33 | | ... | - count - Number of interfaces pairs to connect. Type: integer
37 | | ... | \| Initialize L2 cross connect on node \| DUT1 \| 1 \|
39 | | [Arguments] | ${dut} | ${count}=${1}
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}
48 | Initialize L2 cross connect
50 | | ... | Setup L2 cross connect topology by connecting RX/TX of two interfaces
51 | | ... | on each DUT. Interfaces are brought up.
53 | | ... | *Arguments:*
54 | | ... | - count - Number of interfaces pairs to connect. Type: integer
58 | | ... | \| Initialize L2 cross connect \| 1 \|
60 | | [Arguments] | ${count}=${1}
62 | | FOR | ${dut} | IN | @{duts}
63 | | | Initialize L2 cross connect on node | ${dut} | count=${count}
66 | Initialize L2 xconnect in 2-node circular topology
68 | | ... | Setup L2 xconnect topology by cross connecting two interfaces on
69 | | ... | each DUT. Interfaces are brought up.
71 | | Set interfaces in path up
72 | | VPP Setup Bidirectional Cross Connect | ${dut1} | ${dut1_if1} | ${dut1_if2}
74 | Initialize L2 xconnect in 3-node circular topology
76 | | ... | Setup L2 xconnect topology by cross connecting two interfaces on
77 | | ... | each DUT. Interfaces are brought up.
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}
83 | Initialize L2 xconnect with VXLANoIPv4 in 3-node circular topology
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
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}
103 | Initialize L2 xconnect with Vhost-User on node
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.
109 | | ... | *Arguments:*
110 | | ... | - dut - DUT node. Type: string
111 | | ... | - nf_nodes - VM count. Type: integer
114 | | ... | Socket paths for VM are defined in following format:
115 | | ... | - /tmp/sock-\${VM_ID}-1
116 | | ... | - /tmp/sock-\${VM_ID}-2
120 | | ... | \| Initialize L2 xconnect with Vhost-User on node \| DUT1 \| 1 \|
122 | | [Arguments] | ${dut} | ${nf_nodes}=${1}
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}
139 | Initialize L2 xconnect with Vhost-User
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.
145 | | ... | *Arguments:*
146 | | ... | - nf_nodes - VM count. Type: integer
150 | | ... | \| Initialize L2 xconnect with Vhost-User \| 1 \|
152 | | [Arguments] | ${nf_nodes}=${1}
154 | | FOR | ${dut} | IN | @{duts}
155 | | | Initialize L2 xconnect with Vhost-User on node | ${dut}
156 | | | ... | nf_nodes=${nf_nodes}
159 | Initialize L2 xconnect with Vhost-User and VLAN in 3-node circular topology
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.
165 | | ... | *Arguments:*
166 | | ... | - subid - ID of the sub-interface to be created. Type: string
167 | | ... | - tag_rewrite - Method of tag rewrite. Type: string
171 | | ... | \| L2 xconnect with Vhost-User and VLAN initialized in a 3-node\
172 | | ... | circular topology \| 10 \| pop-1 \|
174 | | [Arguments] | ${subid} | ${tag_rewrite}
176 | | Set interfaces in path up
177 | | Initialize VLAN dot1q sub-interfaces in circular topology
178 | | ... | ${dut1} | ${dut1_if2} | ${dut2} | ${dut2_if1} | ${subid}
179 | | Configure L2 tag rewrite method on interfaces
180 | | ... | ${dut1} | ${subif_index_1} | ${dut2} | ${subif_index_2}
181 | | ... | ${tag_rewrite}
182 | | Configure vhost interfaces
183 | | ... | ${dut1} | /var/run/vpp/sock-1-1 | /var/run/vpp/sock-1-2
184 | | Configure L2XC | ${dut1} | ${dut1_if1} | ${vhost_if1}
185 | | Configure L2XC | ${dut1} | ${subif_index_1} | ${vhost_if2}
186 | | Configure vhost interfaces
187 | | ... | ${dut2} | /var/run/vpp/sock-1-1 | /var/run/vpp/sock-1-2
188 | | Configure L2XC | ${dut2} | ${subif_index_2} | ${vhost_if1}
189 | | Configure L2XC | ${dut2} | ${dut2_if2} | ${vhost_if2}
191 | Initialize L2 xconnect with Vhost-User and VLAN with VPP link bonding in 3-node circular topology
193 | | ... | Create two Vhost-User interfaces on all defined VPP nodes. Create one
194 | | ... | link bonding (BondEthernet) interface on both VPP nodes. Enslave one
195 | | ... | physical interface towards next DUT by BondEthernet interface. Setup
196 | | ... | VLAN on BondEthernet interfaces between DUTs. Cross connect one Vhost
197 | | ... | interface with physical interface towards TG and other Vhost interface
198 | | ... | with VLAN sub-interface. All interfaces are brought up.
200 | | ... | *Arguments:*
201 | | ... | - subid - ID of the sub-interface to be created. Type: string
202 | | ... | - tag_rewrite - Method of tag rewrite. Type: string
203 | | ... | - bond_mode - Link bonding mode. Type: string
204 | | ... | - lb_mode - Load balance mode. Type: string
208 | | ... | \| Initialize L2 xconnect with Vhost-User and VLAN with VPP link\
209 | | ... | bonding in 3-node circular topology \| 10 \| pop-1 \| xor \| l34 \|
211 | | [Arguments] | ${subid} | ${tag_rewrite} | ${bond_mode} | ${lb_mode}
213 | | Set interfaces in path up
214 | | ${dut1_eth_bond_if1}= | VPP Create Bond Interface | ${dut1} | ${bond_mode}
216 | | Set Interface State | ${dut1} | ${dut1_eth_bond_if1} | up
217 | | VPP Set interface MTU | ${dut1} | ${dut1_eth_bond_if1}
218 | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
219 | | ... | Variable Should Exist | ${dut1_if2}
220 | | Run Keyword If | '${if2_status}' == 'PASS'
221 | | ... | VPP Enslave Physical Interface | ${dut1} | ${dut1_if2}
222 | | ... | ${dut1_eth_bond_if1}
224 | | ... | VPP Enslave Physical Interface | ${dut1} | ${dut1_if2_1}
225 | | ... | ${dut1_eth_bond_if1}
226 | | Run Keyword Unless | '${if2_status}' == 'PASS'
227 | | ... | VPP Enslave Physical Interface | ${dut1} | ${dut1_if2_2}
228 | | ... | ${dut1_eth_bond_if1}
229 | | ${dut2_eth_bond_if1}= | VPP Create Bond Interface | ${dut2} | ${bond_mode}
231 | | Set Interface State | ${dut2} | ${dut2_eth_bond_if1} | up
232 | | VPP Set interface MTU | ${dut1} | ${dut1_eth_bond_if1}
233 | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
234 | | ... | Variable Should Exist | ${dut2_if1}
235 | | Run Keyword If | '${if1_status}' == 'PASS'
236 | | ... | VPP Enslave Physical Interface | ${dut2} | ${dut2_if1}
237 | | ... | ${dut2_eth_bond_if1}
239 | | ... | VPP Enslave Physical Interface | ${dut2} | ${dut2_if1_1}
240 | | ... | ${dut2_eth_bond_if1}
241 | | Run Keyword Unless | '${if2_status}' == 'PASS'
242 | | ... | VPP Enslave Physical Interface | ${dut2} | ${dut2_if1_2}
243 | | ... | ${dut2_eth_bond_if1}
244 | | VPP Show Bond Data On All Nodes | ${nodes} | verbose=${TRUE}
245 | | Initialize VLAN dot1q sub-interfaces in circular topology
246 | | ... | ${dut1} | ${dut1_eth_bond_if1} | ${dut2} | ${dut2_eth_bond_if1}
248 | | Configure L2 tag rewrite method on interfaces
249 | | ... | ${dut1} | ${subif_index_1} | ${dut2} | ${subif_index_2}
250 | | ... | ${tag_rewrite}
251 | | Configure vhost interfaces
252 | | ... | ${dut1} | /var/run/vpp/sock-1-1 | /var/run/vpp/sock-1-2
253 | | Configure L2XC | ${dut1} | ${dut1_if1} | ${vhost_if1}
254 | | Configure L2XC | ${dut1} | ${subif_index_1} | ${vhost_if2}
255 | | Configure vhost interfaces
256 | | ... | ${dut2} | /var/run/vpp/sock-1-1 | /var/run/vpp/sock-1-2
257 | | Configure L2XC | ${dut2} | ${subif_index_2} | ${vhost_if1}
258 | | Configure L2XC | ${dut2} | ${dut2_if2} | ${vhost_if2}
260 | Initialize L2 xconnect with memif pairs on DUT node
262 | | ... | Create pairs of Memif interfaces on DUT node. Cross connect each Memif
263 | | ... | interface with one physical interface or virtual interface to create
264 | | ... | a chain accross DUT node.
266 | | ... | *Arguments:*
267 | | ... | - dut - DUT node. Type: dictionary
268 | | ... | - count - Number of memif pairs (containers). Type: integer
271 | | ... | Socket paths for Memif are defined in following format:
272 | | ... | - /tmp/memif-\${dut}_CNF\${number}-\${sid}
274 | | ... | KW uses test variable \${rxq_count_int} set by KW Add worker threads
275 | | ... | and rxqueues to all DUTs
279 | | ... | \| Initialize L2 xconnect with memif pairs on DUT node \| ${dut} \
282 | | [Arguments] | ${dut} | ${count}
284 | | FOR | ${number} | IN RANGE | 1 | ${count}+1
285 | | | ${sock1}= | Set Variable | memif-${dut}_CNF
286 | | | ${sock2}= | Set Variable | memif-${dut}_CNF
287 | | | ${prev_index}= | Evaluate | ${number}-1
288 | | | Set up memif interfaces on DUT node | ${nodes['${dut}']}
289 | | | ... | ${sock1} | ${sock2} | ${number} | ${dut}-memif-${number}-if1
290 | | | ... | ${dut}-memif-${number}-if2 | ${rxq_count_int} | ${rxq_count_int}
291 | | | ${xconnect_if1}= | Set Variable If | ${number}==1 | ${${dut}_if1}
292 | | | ... | ${${dut}-memif-${prev_index}-if2}
293 | | | Configure L2XC | ${nodes['${dut}']} | ${xconnect_if1}
294 | | | ... | ${${dut}-memif-${number}-if1}
295 | | | Run Keyword If | ${number}==${count} | Configure L2XC
296 | | | ... | ${nodes['${dut}']} | ${${dut}-memif-${number}-if2} | ${${dut}_if2}
299 | Initialize L2 xconnect with memif pairs
301 | | ... | Create pairs of Memif interfaces on all defined VPP nodes. Cross
302 | | ... | connect each Memif interface with one physical interface or virtual
303 | | ... | interface to create a chain accross DUT node.
305 | | ... | *Arguments:*
306 | | ... | - count - Number of memif pairs (containers). Type: integer
310 | | ... | \| Initialize L2 xconnect with memif pairs \| ${1} \|
312 | | [Arguments] | ${count}=${1}
314 | | FOR | ${dut} | IN | @{duts}
315 | | | Initialize L2 xconnect with memif pairs on DUT node | ${dut} | ${count}
317 | | Set interfaces in path up
318 | | Show Memif on all DUTs | ${nodes}
319 | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=memif
321 | Initialize L2 xconnect for single memif
323 | | ... | Create single Memif interface on all defined VPP nodes. Cross
324 | | ... | connect Memif interface with one physical interface.
326 | | ... | *Arguments:*
327 | | ... | - number - Memif ID. Type: integer
330 | | ... | Socket paths for Memif are defined in following format:
331 | | ... | - /tmp/memif-DUT1_CNF\${number}-\${sid}
333 | | ... | KW uses test variable ${rxq_count_int} set by KW Add worker threads
334 | | ... | and rxqueues to all DUTs
338 | | ... | \| Initialize L2 xconnect for single memif \| 1 \|
340 | | [Arguments] | ${number}=${1}
342 | | FOR | ${dut} | IN | @{duts}
343 | | | ${sock}= | Set Variable | memif-${dut}_CNF
344 | | | ${sid}= | Evaluate | (${number} * ${2}) - ${1}
345 | | | Set up single memif interface on DUT node | ${nodes['${dut}']} | ${sock}
346 | | | ... | mid=${number} | sid=${sid} | memif_if=${dut}-memif-${number}-if1
347 | | | ... | rxq=${rxq_count_int} | txq=${rxq_count_int}
348 | | | Configure L2XC | ${nodes['${dut}']} | ${${dut}_if1}
349 | | | ... | ${${dut}-memif-${number}-if1}
351 | | Set single interfaces in path up
352 | | Show Memif on all DUTs | ${nodes}
353 | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=memif