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}
47 | Initialize L2 cross connect
49 | | ... | Setup L2 cross connect topology by connecting RX/TX of two interfaces
50 | | ... | on each DUT. Interfaces are brought up.
52 | | ... | *Arguments:*
53 | | ... | - count - Number of interfaces pairs to connect. Type: integer
57 | | ... | \| Initialize L2 cross connect \| 1 \|
59 | | [Arguments] | ${count}=${1}
61 | | :FOR | ${dut} | IN | @{duts}
62 | | | Initialize L2 cross connect on node | ${dut} | count=${count}
64 | Initialize L2 xconnect in 2-node circular topology
66 | | ... | Setup L2 xconnect topology by cross connecting two interfaces on
67 | | ... | each DUT. Interfaces are brought up.
69 | | Set interfaces in path up
70 | | VPP Setup Bidirectional Cross Connect | ${dut1} | ${dut1_if1} | ${dut1_if2}
72 | Initialize L2 xconnect in 3-node circular topology
74 | | ... | Setup L2 xconnect topology by cross connecting two interfaces on
75 | | ... | each DUT. Interfaces are brought up.
77 | | Set interfaces in path up
78 | | VPP Setup Bidirectional Cross Connect | ${dut1} | ${dut1_if1} | ${dut1_if2}
79 | | VPP Setup Bidirectional Cross Connect | ${dut2} | ${dut2_if1} | ${dut2_if2}
81 | Initialize L2 xconnect with VXLANoIPv4 in 3-node circular topology
83 | | ... | Setup L2 xconnect topology with VXLANoIPv4 by cross connecting
84 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
85 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
86 | | ... | between DUTs. VXLAN sub-interfaces has same IPv4 address as
89 | | Set interfaces in path up
90 | | VPP Interface Set IP Address | ${dut1} | ${dut1_if2} | 172.16.0.1 | 24
91 | | VPP Interface Set IP Address | ${dut2} | ${dut2_if1} | 172.16.0.2 | 24
92 | | VPP Add IP Neighbor | ${dut1} | ${dut1_if2} | 172.16.0.2 | ${dut2_if1_mac}
93 | | VPP Add IP Neighbor | ${dut2} | ${dut2_if1} | 172.16.0.1 | ${dut1_if2_mac}
94 | | ${dut1s_vxlan}= | Create VXLAN interface | ${dut1} | 24
95 | | ... | 172.16.0.1 | 172.16.0.2
96 | | Configure L2XC | ${dut1} | ${dut1_if1} | ${dut1s_vxlan}
97 | | ${dut2s_vxlan}= | Create VXLAN interface | ${dut2} | 24
98 | | ... | 172.16.0.2 | 172.16.0.1
99 | | Configure L2XC | ${dut2} | ${dut2_if2} | ${dut2s_vxlan}
101 | Initialize L2 xconnect with Vhost-User on node
103 | | ... | Create pairs of Vhost-User interfaces for defined number of VMs on
104 | | ... | defined VPP node. Add each Vhost-User interface into L2 cross-connect
105 | | ... | with with physical inteface or Vhost-User interface of another VM.
107 | | ... | *Arguments:*
108 | | ... | - dut - DUT node. Type: string
109 | | ... | - nf_nodes - VM count. Type: integer
112 | | ... | Socket paths for VM are defined in following format:
113 | | ... | - /tmp/sock-\${VM_ID}-1
114 | | ... | - /tmp/sock-\${VM_ID}-2
118 | | ... | \| Initialize L2 xconnect with Vhost-User on node \| DUT1 \| 1 \|
120 | | [Arguments] | ${dut} | ${nf_nodes}=${1}
122 | | :FOR | ${number} | IN RANGE | 1 | ${nf_nodes}+1
123 | | | ${sock1}= | Set Variable | /var/run/vpp/sock-${number}-1
124 | | | ${sock2}= | Set Variable | /var/run/vpp/sock-${number}-2
125 | | | ${prev_index}= | Evaluate | ${number}-1
126 | | | Configure vhost interfaces | ${nodes['${dut}']}
127 | | | ... | ${sock1} | ${sock2} | ${dut}-vhost-${number}-if1
128 | | | ... | ${dut}-vhost-${number}-if2
129 | | | ${dut_xconnect_if1}= | Set Variable If | ${number}==1 | ${${dut}_if1}
130 | | | ... | ${${dut}-vhost-${prev_index}-if2}
131 | | | Configure L2XC | ${nodes['${dut}']} | ${dut_xconnect_if1}
132 | | | ... | ${${dut}-vhost-${number}-if1}
133 | | | Run Keyword If | ${number}==${nf_nodes} | Configure L2XC
134 | | | ... | ${nodes['${dut}']} | ${${dut}-vhost-${number}-if2} | ${${dut}_if2}
136 | Initialize L2 xconnect with Vhost-User
138 | | ... | Create pairs of Vhost-User interfaces for defined number of VMs on
139 | | ... | all VPP nodes. Add each Vhost-User interface into L2 cross-connect
140 | | ... | with with physical inteface or Vhost-User interface of another VM.
142 | | ... | *Arguments:*
143 | | ... | - nf_nodes - VM count. Type: integer
147 | | ... | \| Initialize L2 xconnect with Vhost-User \| 1 \|
149 | | [Arguments] | ${nf_nodes}=${1}
151 | | :FOR | ${dut} | IN | @{duts}
152 | | | Initialize L2 xconnect with Vhost-User on node | ${dut}
153 | | | ... | nf_nodes=${nf_nodes}
155 | Initialize L2 xconnect with Vhost-User and VLAN in 3-node circular topology
157 | | ... | Create two Vhost-User interfaces on all defined VPP nodes. Cross
158 | | ... | connect each Vhost interface with one physical interface.
159 | | ... | Setup VLAN between DUTs. All interfaces are brought up.
161 | | ... | *Arguments:*
162 | | ... | - subid - ID of the sub-interface to be created. Type: string
163 | | ... | - tag_rewrite - Method of tag rewrite. Type: string
167 | | ... | \| L2 xconnect with Vhost-User and VLAN initialized in a 3-node\
168 | | ... | circular topology \| 10 \| pop-1 \|
170 | | [Arguments] | ${subid} | ${tag_rewrite}
172 | | Set interfaces in path up
173 | | Initialize VLAN dot1q sub-interfaces in circular topology
174 | | ... | ${dut1} | ${dut1_if2} | ${dut2} | ${dut2_if1} | ${subid}
175 | | Configure L2 tag rewrite method on interfaces
176 | | ... | ${dut1} | ${subif_index_1} | ${dut2} | ${subif_index_2}
177 | | ... | ${tag_rewrite}
178 | | Configure vhost interfaces
179 | | ... | ${dut1} | /var/run/vpp/sock-1-1 | /var/run/vpp/sock-1-2
180 | | Configure L2XC | ${dut1} | ${dut1_if1} | ${vhost_if1}
181 | | Configure L2XC | ${dut1} | ${subif_index_1} | ${vhost_if2}
182 | | Configure vhost interfaces
183 | | ... | ${dut2} | /var/run/vpp/sock-1-1 | /var/run/vpp/sock-1-2
184 | | Configure L2XC | ${dut2} | ${subif_index_2} | ${vhost_if1}
185 | | Configure L2XC | ${dut2} | ${dut2_if2} | ${vhost_if2}
187 | Initialize L2 xconnect with Vhost-User and VLAN with VPP link bonding in 3-node circular topology
189 | | ... | Create two Vhost-User interfaces on all defined VPP nodes. Create one
190 | | ... | link bonding (BondEthernet) interface on both VPP nodes. Enslave one
191 | | ... | physical interface towards next DUT by BondEthernet interface. Setup
192 | | ... | VLAN on BondEthernet interfaces between DUTs. Cross connect one Vhost
193 | | ... | interface with physical interface towards TG and other Vhost interface
194 | | ... | with VLAN sub-interface. All interfaces are brought up.
196 | | ... | *Arguments:*
197 | | ... | - subid - ID of the sub-interface to be created. Type: string
198 | | ... | - tag_rewrite - Method of tag rewrite. Type: string
199 | | ... | - bond_mode - Link bonding mode. Type: string
200 | | ... | - lb_mode - Load balance mode. Type: string
204 | | ... | \| Initialize L2 xconnect with Vhost-User and VLAN with VPP link\
205 | | ... | bonding in 3-node circular topology \| 10 \| pop-1 \| xor \| l34 \|
207 | | [Arguments] | ${subid} | ${tag_rewrite} | ${bond_mode} | ${lb_mode}
209 | | Set interfaces in path up
210 | | ${dut1_eth_bond_if1}= | VPP Create Bond Interface | ${dut1} | ${bond_mode}
212 | | Set Interface State | ${dut1} | ${dut1_eth_bond_if1} | up
213 | | VPP Set interface MTU | ${dut1} | ${dut1_eth_bond_if1}
214 | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
215 | | ... | Variable Should Exist | ${dut1_if2}
216 | | Run Keyword If | '${if2_status}' == 'PASS'
217 | | ... | VPP Enslave Physical Interface | ${dut1} | ${dut1_if2}
218 | | ... | ${dut1_eth_bond_if1}
220 | | ... | VPP Enslave Physical Interface | ${dut1} | ${dut1_if2_1}
221 | | ... | ${dut1_eth_bond_if1}
222 | | Run Keyword Unless | '${if2_status}' == 'PASS'
223 | | ... | VPP Enslave Physical Interface | ${dut1} | ${dut1_if2_2}
224 | | ... | ${dut1_eth_bond_if1}
225 | | ${dut2_eth_bond_if1}= | VPP Create Bond Interface | ${dut2} | ${bond_mode}
227 | | Set Interface State | ${dut2} | ${dut2_eth_bond_if1} | up
228 | | VPP Set interface MTU | ${dut1} | ${dut1_eth_bond_if1}
229 | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
230 | | ... | Variable Should Exist | ${dut2_if1}
231 | | Run Keyword If | '${if1_status}' == 'PASS'
232 | | ... | VPP Enslave Physical Interface | ${dut2} | ${dut2_if1}
233 | | ... | ${dut2_eth_bond_if1}
235 | | ... | VPP Enslave Physical Interface | ${dut2} | ${dut2_if1_1}
236 | | ... | ${dut2_eth_bond_if1}
237 | | Run Keyword Unless | '${if2_status}' == 'PASS'
238 | | ... | VPP Enslave Physical Interface | ${dut2} | ${dut2_if1_2}
239 | | ... | ${dut2_eth_bond_if1}
240 | | VPP Show Bond Data On All Nodes | ${nodes} | verbose=${TRUE}
241 | | Initialize VLAN dot1q sub-interfaces in circular topology
242 | | ... | ${dut1} | ${dut1_eth_bond_if1} | ${dut2} | ${dut2_eth_bond_if1}
244 | | Configure L2 tag rewrite method on interfaces
245 | | ... | ${dut1} | ${subif_index_1} | ${dut2} | ${subif_index_2}
246 | | ... | ${tag_rewrite}
247 | | Configure vhost interfaces
248 | | ... | ${dut1} | /var/run/vpp/sock-1-1 | /var/run/vpp/sock-1-2
249 | | Configure L2XC | ${dut1} | ${dut1_if1} | ${vhost_if1}
250 | | Configure L2XC | ${dut1} | ${subif_index_1} | ${vhost_if2}
251 | | Configure vhost interfaces
252 | | ... | ${dut2} | /var/run/vpp/sock-1-1 | /var/run/vpp/sock-1-2
253 | | Configure L2XC | ${dut2} | ${subif_index_2} | ${vhost_if1}
254 | | Configure L2XC | ${dut2} | ${dut2_if2} | ${vhost_if2}
256 | Initialize L2 xconnect with memif pairs on DUT node
258 | | ... | Create pairs of Memif interfaces on DUT node. Cross connect each Memif
259 | | ... | interface with one physical interface or virtual interface to create
260 | | ... | a chain accross DUT node.
262 | | ... | *Arguments:*
263 | | ... | - dut - DUT node. Type: dictionary
264 | | ... | - count - Number of memif pairs (containers). Type: integer
267 | | ... | Socket paths for Memif are defined in following format:
268 | | ... | - /tmp/memif-\${dut}_CNF\${number}-\${sid}
270 | | ... | KW uses test variable \${rxq_count_int} set by KW Add worker threads
271 | | ... | and rxqueues to all DUTs
275 | | ... | \| Initialize L2 xconnect with memif pairs on DUT node \| ${dut} \
278 | | [Arguments] | ${dut} | ${count}
280 | | :FOR | ${number} | IN RANGE | 1 | ${count}+1
281 | | | ${sock1}= | Set Variable | memif-${dut}_CNF
282 | | | ${sock2}= | Set Variable | memif-${dut}_CNF
283 | | | ${prev_index}= | Evaluate | ${number}-1
284 | | | Set up memif interfaces on DUT node | ${nodes['${dut}']}
285 | | | ... | ${sock1} | ${sock2} | ${number} | ${dut}-memif-${number}-if1
286 | | | ... | ${dut}-memif-${number}-if2 | ${rxq_count_int} | ${rxq_count_int}
287 | | | ${xconnect_if1}= | Set Variable If | ${number}==1 | ${${dut}_if1}
288 | | | ... | ${${dut}-memif-${prev_index}-if2}
289 | | | Configure L2XC | ${nodes['${dut}']} | ${xconnect_if1}
290 | | | ... | ${${dut}-memif-${number}-if1}
291 | | | Run Keyword If | ${number}==${count} | Configure L2XC
292 | | | ... | ${nodes['${dut}']} | ${${dut}-memif-${number}-if2} | ${${dut}_if2}
294 | Initialize L2 xconnect with memif pairs
296 | | ... | Create pairs of Memif interfaces on all defined VPP nodes. Cross
297 | | ... | connect each Memif interface with one physical interface or virtual
298 | | ... | interface to create a chain accross DUT node.
300 | | ... | *Arguments:*
301 | | ... | - count - Number of memif pairs (containers). Type: integer
305 | | ... | \| Initialize L2 xconnect with memif pairs \| ${1} \|
307 | | [Arguments] | ${count}=${1}
309 | | :FOR | ${dut} | IN | @{duts}
310 | | | Initialize L2 xconnect with memif pairs on DUT node | ${dut} | ${count}
311 | | Set interfaces in path up
312 | | Show Memif on all DUTs | ${nodes}
313 | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=memif
315 | Initialize L2 xconnect for single memif
317 | | ... | Create single Memif interface on all defined VPP nodes. Cross
318 | | ... | connect Memif interface with one physical interface.
320 | | ... | *Arguments:*
321 | | ... | - number - Memif ID. Type: integer
324 | | ... | Socket paths for Memif are defined in following format:
325 | | ... | - /tmp/memif-DUT1_CNF\${number}-\${sid}
327 | | ... | KW uses test variable ${rxq_count_int} set by KW Add worker threads
328 | | ... | and rxqueues to all DUTs
332 | | ... | \| Initialize L2 xconnect for single memif \| 1 \|
334 | | [Arguments] | ${number}=${1}
336 | | :FOR | ${dut} | IN | @{duts}
337 | | | ${sock}= | Set Variable | memif-${dut}_CNF
338 | | | ${sid}= | Evaluate | (${number} * ${2}) - ${1}
339 | | | Set up single memif interface on DUT node | ${nodes['${dut}']} | ${sock}
340 | | | ... | mid=${number} | sid=${sid} | memif_if=${dut}-memif-${number}-if1
341 | | | ... | rxq=${rxq_count_int} | txq=${rxq_count_int}
342 | | | Configure L2XC | ${nodes['${dut}']} | ${${dut}_if1}
343 | | | ... | ${${dut}-memif-${number}-if1}
344 | | Set single interfaces in path up
345 | | Show Memif on all DUTs | ${nodes}
346 | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=memif