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:
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
21 | | ... | Setup Bidirectional Cross Connect on DUTs
23 | | ... | *Arguments:*
24 | | ... | - dut - DUT node. Type: string
25 | | ... | - if1 - First interface. Type: string
26 | | ... | - if2 - Second interface. Type: string
30 | | ... | \| Initialize L2 cross connect on node \| DUT1 \| 1 \|
32 | | [Arguments] | ${dut} | ${if1} | ${if2}
34 | | Set Interface State | ${dut} | ${if1} | up
35 | | Set Interface State | ${dut} | ${if2} | up
36 | | Vpp Setup Bidirectional Cross Connect | ${dut} | ${if1} | ${if2}
38 | Initialize L2 cross connect on node
40 | | ... | Setup L2 cross connect topology by connecting RX/TX of two interfaces
41 | | ... | on each DUT. Interfaces are brought up.
43 | | ... | *Arguments:*
44 | | ... | - dut - DUT node. Type: string
45 | | ... | - count - Number of interfaces pairs to connect. Type: integer
49 | | ... | \| Initialize L2 cross connect on node \| DUT1 \| 1 \|
51 | | [Arguments] | ${dut} | ${count}=${1}
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]
58 | Initialize L2 cross connect
60 | | ... | Setup L2 cross connect topology by connecting RX/TX of two interfaces
61 | | ... | on each DUT. Interfaces are brought up.
63 | | ... | *Arguments:*
64 | | ... | - count - Number of interfaces pairs to connect. Type: integer
68 | | ... | \| Initialize L2 cross connect \| 1 \|
70 | | [Arguments] | ${count}=${1}
72 | | FOR | ${dut} | IN | @{duts}
73 | | | Initialize L2 cross connect on node | ${dut} | count=${count}
76 | Initialize L2 xconnect with VXLANoIPv4 in 3-node circular topology
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
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
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
100 | | ... | ${dut2} | ${DUT2_${int}2}[0] | ${dut2s_vxlan}
102 | Initialize L2 xconnect with Vhost-User on node
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.
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
115 | | ... | Socket paths for VM are defined in following format:
116 | | ... | - /tmp/sock-\${VM_ID}-1
117 | | ... | - /tmp/sock-\${VM_ID}-2
121 | | ... | \| Initialize L2 xconnect with Vhost-User on node \| DUT1 \| 1 \|
123 | | [Arguments] | ${dut} | ${nf_nodes}=${1} | ${virtio_feature_mask}=${None}
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]
143 | Initialize L2 xconnect with Vhost-User
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.
149 | | ... | *Arguments:*
150 | | ... | - nf_nodes - VM count. Type: integer
151 | | ... | - virtio_feature_mask - Enabled Virtio features (Optional).
152 | | ... | Type: integer
156 | | ... | \| Initialize L2 xconnect with Vhost-User \| 1 \|
158 | | [Arguments] | ${nf_nodes}=${1} | ${virtio_feature_mask}=${None}
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}
165 | Initialize L2 xconnect with Vhost-User and VLAN in circular topology
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.
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
179 | | ... | \| L2 xconnect with Vhost-User and VLAN initialized in a 3-node\
180 | | ... | circular topology \| 10 \| pop-1 \|
182 | | [Arguments] | ${subid} | ${tag_rewrite} | ${virtio_feature_mask}=${None}
184 | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error
185 | | ... | Variable Should Exist | ${dut2}
187 | | Set interfaces in path up
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}
205 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${vhost_if1}
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}
217 | Initialize L2 xconnect with Vhost-User and VLAN with VPP link bonding in 3-node circular topology
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.
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
236 | | ... | \| Initialize L2 xconnect with Vhost-User and VLAN with VPP link\
237 | | ... | bonding in 3-node circular topology \| 10 \| pop-1 \| xor \| l34 \|
239 | | [Arguments] | ${subid} | ${tag_rewrite} | ${bond_mode} | ${lb_mode}
240 | | ... | ${virtio_feature_mask}=${None}
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}
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}
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}
274 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${vhost_if1}
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}
281 | | ... | ${dut2} | ${subif_index_2} | ${vhost_if1}
283 | | ... | ${dut2} | ${DUT2_${int}2}[0] | ${vhost_if2}
285 | Initialize L2 xconnect with memif pairs on DUT node
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.
291 | | ... | *Arguments:*
292 | | ... | - dut - DUT node. Type: dictionary
293 | | ... | - count - Number of memif pairs (containers). Type: integer
296 | | ... | Socket paths for Memif are defined in following format:
297 | | ... | - /tmp/memif-\${dut}_CNF\${number}-\${sid}
299 | | ... | KW uses test variable \${rxq_count_int} set by KW Add worker threads
300 | | ... | and rxqueues to all DUTs
304 | | ... | \| Initialize L2 xconnect with memif pairs on DUT node \| ${dut} \
307 | | [Arguments] | ${dut} | ${count}
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]
325 | Initialize L2 xconnect with memif pairs
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.
331 | | ... | *Arguments:*
332 | | ... | - count - Number of memif pairs (containers). Type: integer
336 | | ... | \| Initialize L2 xconnect with memif pairs \| ${1} \|
338 | | [Arguments] | ${count}=${1}
340 | | FOR | ${dut} | IN | @{duts}
341 | | | Initialize L2 xconnect with memif pairs on DUT node | ${dut} | ${count}
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