5751a3c046eabe05bfdccae631d3c10989f277fe
[csit.git] / tests / suites / fds_related_tests / tenant_network.robot
1 # Copyright (c) 2016 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 | Resource | resources/libraries/robot/default.robot
16 | Resource | resources/libraries/robot/ipv4.robot
17 | Resource | resources/libraries/robot/bridge_domain.robot
18 | Resource | resources/libraries/robot/testing_path.robot
19 | Resource | resources/libraries/robot/double_qemu_setup.robot
20 | Resource | resources/libraries/robot/qemu.robot
21 | Library  | resources.libraries.python.Trace
22 | Force Tags | HW_ENV | VM_ENV | SKIP_PATCH
23 | Test Setup | Run Keywords | Setup all DUTs before test
24 | ...        | AND          | Setup all TGs before traffic script
25 | Test Teardown | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
26 | ...          | AND | Qemu Teardown | ${dut1_node} | ${qemu_node1} | qemu_node1
27 | ...          | AND | Qemu Teardown | ${dut2_node} | ${qemu_node2} | qemu_node2
28 | Documentation | *Tenant network FDS related.*
29 | ...
30 | ... | Test suite uses 3-node topology TG - DUT1 - DUT2 - TG
31 | ... | with one link between nodes. Test packets are sent in both directions
32 | ... | between namespaces in DUT1 and DUT2 with both positive and negative
33 | ... | scenarios tested.
34
35 *** Variables ***
36 | ${bd_id1}= | 1
37 | ${bd_id2}= | 2
38 | ${shg1}= | 3
39 | ${shg2}= | 4
40 | ${sock1}= | /tmp/sock1
41 | ${sock2}= | /tmp/sock2
42 | ${sock3}= | /tmp/sock3
43 | ${sock4}= | /tmp/sock4
44
45 | ${vni_blue}= | 23
46 | ${vni_red}= | 24
47
48 | ${bid_b}= | 23
49 | ${bid_r}= | 24
50
51 | ${dut1_if_ip}= | 16.0.0.1
52 | ${dut2_if_ip}= | 16.0.0.2
53
54 | ${dut1_blue1}= | 16.0.10.1
55 | ${dut1_blue2}= | 16.0.10.2
56 | ${dut1_red1}= | 16.0.10.3
57 | ${dut1_red2}= | 16.0.10.4
58
59 | ${dut2_blue1}= | 16.0.20.1
60 | ${dut2_blue2}= | 16.0.20.2
61 | ${dut2_red1}= | 16.0.20.3
62 | ${dut2_red2}= | 16.0.20.4
63
64 | ${namespace1}= | nmspace1
65 | ${namespace2}= | nmspace2
66 | ${namespace3}= | nmspace3
67 | ${namespace4}= | nmspace4
68
69 | ${prefix_length}= | 16
70
71 *** Test Cases ***
72 | L2 test cases with tenant networks (VXLAN)
73 | | [Documentation] | Ping among all ports inside the same network should pass.
74 | | ...             | a) test l2 connectivity inside every network
75 | | ...             | b) test l2 connectivity between networks
76 | | [Tags] | 3_NODE_DOUBLE_LINK_TOPO | VPP_VM_ENV
77 | | Given Path for 3-node testing is set
78 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
79 | | And Set Interface Address
80 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if_ip} | ${prefix_length}
81 | | And Set Interface Address
82 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_if_ip} | ${prefix_length}
83 | | And Set Interface State | ${dut1_node} | ${dut1_to_dut2} | up
84 | | And Set Interface State | ${dut2_node} | ${dut2_to_dut1} | up
85 | | ${vhost_if1_DUT1}= | And Vpp Create Vhost User Interface
86 | | ... | ${dut1_node} | ${sock1}
87 | | ${vhost_if2_DUT1}= | And Vpp Create Vhost User Interface
88 | | ... | ${dut1_node} | ${sock2}
89 | | ${vhost_if3_DUT1}= | And Vpp Create Vhost User Interface
90 | | ... | ${dut1_node} | ${sock3}
91 | | ${vhost_if4_DUT1}= | And Vpp Create Vhost User Interface
92 | | ... | ${dut1_node} | ${sock4}
93 | | ${dut1_vhosts}= | And Create List | ${vhost_if1_DUT1} | ${vhost_if2_DUT1}
94 | | ... | ${vhost_if3_DUT1} | ${vhost_if4_DUT1}
95 | | ${vhost_if1_DUT2}= | And Vpp Create Vhost User Interface
96 | | ... | ${dut2_node} | ${sock1}
97 | | ${vhost_if2_DUT2}= | And Vpp Create Vhost User Interface
98 | | ... | ${dut2_node} | ${sock2}
99 | | ${vhost_if3_DUT2}= | And Vpp Create Vhost User Interface
100 | | ... | ${dut2_node} | ${sock3}
101 | | ${vhost_if4_DUT2}= | And Vpp Create Vhost User Interface
102 | | ... | ${dut2_node} | ${sock4}
103 | | ${dut2_vhosts}= | And Create List | ${vhost_if1_DUT2} | ${vhost_if2_DUT2}
104 | | ... | ${vhost_if3_DUT2} | ${vhost_if4_DUT2}
105 | | When Setup QEMU Vhost and Run | ${dut1_node}
106 | | ...                   | ${sock1}
107 | | ...                   | ${sock2}
108 | | ...                   | ${sock3}
109 | | ...                   | ${sock4}
110 | | ...                   | ${dut1_blue1}
111 | | ...                   | ${dut1_blue2}
112 | | ...                   | ${dut1_red1}
113 | | ...                   | ${dut1_red2}
114 | | ...                   | ${prefix_length}
115 | | ...                   | qemu_node1
116 | | ...                   | 04
117 | | And Setup QEMU Vhost and Run | ${dut2_node}
118 | | ...                   | ${sock1}
119 | | ...                   | ${sock2}
120 | | ...                   | ${sock3}
121 | | ...                   | ${sock4}
122 | | ...                   | ${dut2_blue1}
123 | | ...                   | ${dut2_blue2}
124 | | ...                   | ${dut2_red1}
125 | | ...                   | ${dut2_red2}
126 | | ...                   | ${prefix_length}
127 | | ...                   | qemu_node2
128 | | ...                   | 06
129 | | And Setup VXLAN and BD on Dut | ${dut1_node} | ${dut1_if_ip} | ${dut2_if_ip}
130 | | ... | @{dut1_vhosts}
131 | | And Setup VXLAN and BD on Dut | ${dut2_node} | ${dut2_if_ip} | ${dut1_if_ip}
132 | | ... | @{dut2_vhosts}
133 | | Then Positive Scenario Ping From DUT1 - Intra network
134 | | And Positive Scenario Ping From DUT1 - Inter network
135 | | And Positive Scenario Ping From DUT2 - Intra network
136 | | And Positive Scenario Ping From DUT2 - Inter network
137 | | And Negative Scenario Ping From DUT1 - Intra network
138 | | And Negative Scenario Ping From DUT1 - Inter network
139 | | And Negative Scenario Ping From DUT2 - Intra network
140 | | And Negative Scenario Ping From DUT2 - Inter network
141
142 *** Keywords ***
143 | Setup VXLAN and BD on Dut
144 | | [Documentation] | Setup VXLAN and bridge domain on specific DUT and
145 | | ...             | subsequently interconnect them properly.
146 | | ...
147 | | ... | *Arguments:*
148 | | ... | - dut_node - Node where to setup vxlan and BD. Type: dict
149 | | ... | - src_ip - Source IP for VXLAN. Type: string
150 | | ... | - dst_ip - Destination IP for vxlan. Type: string
151 | | ... | - vhosts - List containing vhost interfaces.
152 | | ...
153 | | ... | *Example:*
154 | | ...
155 | | ... | \| Setup VXLAN and BD on Dut \| ${dut_node} \| 16.0.0.1 \| 16.0.0.1 \
156 | | ... | \| @{vhosts} \|
157 | | ...
158 | | [Arguments] | ${dut_node} | ${src_ip} | ${dst_ip} | @{vhosts}
159 | | Bridge domain on DUT node is created
160 | | ... | ${dut_node} | ${bid_b} | learn=${TRUE}
161 | | Bridge domain on DUT node is created
162 | | ... | ${dut_node} | ${bid_r} | learn=${TRUE}
163 | | ${vxlan1_if}= | Create VXLAN interface     | ${dut_node} | ${vni_blue}
164 | |                 | ...  | ${src_ip} | ${dst_ip}
165 | | ${vxlan2_if}= | Create VXLAN interface     | ${dut_node} | ${vni_red}
166 | |                 | ...  | ${src_ip} | ${dst_ip}
167 | | Interface is added to bridge domain
168 | | ... | ${dut_node} | ${vxlan1_if} | ${bid_b} | 0
169 | | Interface is added to bridge domain
170 | | ... | ${dut_node} | @{vhosts}[0] | ${bid_b} | 0
171 | | Interface is added to bridge domain
172 | | ... | ${dut_node} | @{vhosts}[1] | ${bid_b} | 0
173 | | Interface is added to bridge domain
174 | | ... | ${dut_node} | ${vxlan2_if} | ${bid_r} | 0
175 | | Interface is added to bridge domain
176 | | ... | ${dut_node} | @{vhosts}[2] | ${bid_r} | 0
177 | | Interface is added to bridge domain
178 | | ... | ${dut_node} | @{vhosts}[3] | ${bid_r} | 0
179
180 | Positive Scenario Ping From DUT1 - Intra network
181 | | [Documentation] | Send ping packets from specified namespaces to other in
182 | | ...             | order to test connectivity.
183 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue2} | ${namespace1}
184 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue1} | ${namespace2}
185 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red2} | ${namespace3}
186 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red1} | ${namespace4}
187
188 | Positive Scenario Ping From DUT1 - Inter network
189 | | [Documentation] | Send ping packets from specified namespaces to other in
190 | | ...             | order to test connectivity.
191 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue1} | ${namespace1}
192 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue2} | ${namespace1}
193 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue1} | ${namespace2}
194 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue2} | ${namespace2}
195 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red1} | ${namespace3}
196 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red2} | ${namespace3}
197 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red1} | ${namespace4}
198 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red2} | ${namespace4}
199
200 | Positive Scenario Ping From DUT2 - Intra network
201 | | [Documentation] | Send ping packets from specified namespaces to other in
202 | | ...             | order to test connectivity.
203 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue2} | ${namespace1}
204 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue1} | ${namespace2}
205 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red2} | ${namespace3}
206 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red1} | ${namespace4}
207
208 | Positive Scenario Ping From DUT2 - Inter network
209 | | [Documentation] | Send ping packets from specified namespaces to other in
210 | | ...             | order to test connectivity.
211 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue1} | ${namespace1}
212 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue2} | ${namespace1}
213 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue1} | ${namespace2}
214 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue2} | ${namespace2}
215 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red1} | ${namespace3}
216 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red2} | ${namespace3}
217 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red1} | ${namespace4}
218 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red2} | ${namespace4}
219
220 | Negative Scenario Ping From DUT1 - Intra network
221 | | [Documentation] | Send ping packets from specified namespaces to other in
222 | | ...             | order to test unreachability of namespaces.
223 | | Run keyword and expect error | Ping Not Successful
224 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red1}
225 | | ... | ${namespace1}
226 | | Run keyword and expect error | Ping Not Successful
227 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red2}
228 | | ... | ${namespace1}
229 | | Run keyword and expect error | Ping Not Successful
230 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red1}
231 | | ... | ${namespace2}
232 | | Run keyword and expect error | Ping Not Successful
233 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red2}
234 | | ... | ${namespace2}
235 | | Run keyword and expect error | Ping Not Successful
236 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue1}
237 | | ... | ${namespace3}
238 | | Run keyword and expect error | Ping Not Successful
239 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue2}
240 | | ... | ${namespace3}
241 | | Run keyword and expect error | Ping Not Successful
242 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue1}
243 | | ... | ${namespace4}
244 | | Run keyword and expect error | Ping Not Successful
245 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue2}
246 | | ... | ${namespace4}
247
248
249 | Negative Scenario Ping From DUT1 - Inter network
250 | | [Documentation] | Send ping packets from specified namespaces to other in
251 | | ...             | order to test unreachability of namespaces.
252 | | Run keyword and expect error | Ping Not Successful
253 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red1}
254 | | ... | ${namespace1}
255 | | Run keyword and expect error | Ping Not Successful
256 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red2}
257 | | ... | ${namespace1}
258 | | Run keyword and expect error | Ping Not Successful
259 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red1}
260 | | ... | ${namespace2}
261 | | Run keyword and expect error | Ping Not Successful
262 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red2}
263 | | ... | ${namespace2}
264 | | Run keyword and expect error | Ping Not Successful
265 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue1}
266 | | ... | ${namespace3}
267 | | Run keyword and expect error | Ping Not Successful
268 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue2}
269 | | ... | ${namespace3}
270 | | Run keyword and expect error | Ping Not Successful
271 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue1}
272 | | ... | ${namespace4}
273 | | Run keyword and expect error | Ping Not Successful
274 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue2}
275 | | ... | ${namespace4}
276
277 | Negative Scenario Ping From DUT2 - Intra network
278 | | [Documentation] | Send ping packets from specified namespaces to other in
279 | | ...             | order to test unreachability of namespaces.
280 | | Run keyword and expect error | Ping Not Successful
281 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red1}
282 | | ... | ${namespace1}
283 | | Run keyword and expect error | Ping Not Successful
284 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red2}
285 | | ... | ${namespace1}
286 | | Run keyword and expect error | Ping Not Successful
287 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red1}
288 | | ... | ${namespace2}
289 | | Run keyword and expect error | Ping Not Successful
290 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red2}
291 | | ... | ${namespace2}
292 | | Run keyword and expect error | Ping Not Successful
293 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue1}
294 | | ... | ${namespace3}
295 | | Run keyword and expect error | Ping Not Successful
296 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue2}
297 | | ... | ${namespace3}
298 | | Run keyword and expect error | Ping Not Successful
299 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue1}
300 | | ... | ${namespace4}
301 | | Run keyword and expect error | Ping Not Successful
302 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue2}
303 | | ... | ${namespace4}
304
305
306 | Negative Scenario Ping From DUT2 - Inter network
307 | | [Documentation] | Send ping packets from specified namespaces to other in
308 | | ...             | order to test unreachability of namespaces.
309 | | Run keyword and expect error | Ping Not Successful
310 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red1}
311 | | ... | ${namespace1}
312 | | Run keyword and expect error | Ping Not Successful
313 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red2}
314 | | ... | ${namespace1}
315 | | Run keyword and expect error | Ping Not Successful
316 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red1}
317 | | ... | ${namespace2}
318 | | Run keyword and expect error | Ping Not Successful
319 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red2}
320 | | ... | ${namespace2}
321 | | Run keyword and expect error | Ping Not Successful
322 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue1}
323 | | ... | ${namespace3}
324 | | Run keyword and expect error | Ping Not Successful
325 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue2}
326 | | ... | ${namespace3}
327 | | Run keyword and expect error | Ping Not Successful
328 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue1}
329 | | ... | ${namespace4}
330 | | Run keyword and expect error | Ping Not Successful
331 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue2}
332 | | ... | ${namespace4}