4 Vhosts setup test
[csit.git] / tests / suites / fds_related_tests / provider_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
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 | *Provider 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 | ${bid_b}= | 23
46 | ${bid_r}= | 24
47
48 | ${vlan_red}= | 50
49 | ${vlan_blue}= | 60
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 | Provider network test cases with provider physical networks (VLAN)
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 | ${nodes['TG']} | ${nodes['DUT1']}
78 | | ... | ${nodes['DUT2']} | ${nodes['TG']}
79 | | And Set Interface Address | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if_ip}
80 | | ... | ${prefix_length}
81 | | And Set Interface Address | ${dut2_node} | ${dut2_to_dut1} | ${dut2_if_ip}
82 | | ... | ${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 VLAN and BD on Dut | ${dut1_node} | ${dut1_to_dut2}
130 | | ... | @{dut1_vhosts}
131 | | And Setup VLAN and BD on Dut | ${dut2_node} | ${dut2_to_dut1}
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 VLAN and BD on Dut
144 | | [Documentation] | Setup VLAN and bridge domain on specific DUT and
145 | | ...             | subsequently interconnect them properly. Also set VLAN tag
146 | | ...             | rewrite on vhosts.
147 | | ...
148 | | ... | *Arguments:*
149 | | ... | - dut_node - Node where to setup VLAN and BD. Type: dict
150 | | ... | - interface - Interface where to create VLAN sub-interface.
151 | | ... |               Type: string
152 | | ... | - vhosts - List containing vhost interfaces.
153 | | ...
154 | | ... | *Example:*
155 | | ...
156 | | ... | \| Setup VLAN and BD on Dut \| ${dut_node} \| GigabitEthernet0/6/0 \
157 | | ... | \| @{vhosts} \|
158 | | ...
159 | | [Arguments] | ${dut_node} | ${interface} | @{vhosts}
160 | | Bridge domain on DUT node is created | ${dut_node} | ${bid_b} | learn=${TRUE}
161 | | Bridge domain on DUT node is created | ${dut_node} | ${bid_r} | learn=${TRUE}
162 | | ${vlan1_name} | ${vlan1_index}= | Create Vlan Subinterface
163 | | ... | ${dut_node} | ${interface} | ${vlan_blue}
164 | | ${vlan2_name} | ${vlan2_index}= | Create Vlan Subinterface
165 | | ... | ${dut_node} | ${interface} | ${vlan_red}
166 | | L2 Tag Rewrite | ${dut_node} | @{vhosts}[0] | push-1 | ${vlan_blue}
167 | | L2 Tag Rewrite | ${dut_node} | @{vhosts}[1] | push-1 | ${vlan_blue}
168 | | L2 Tag Rewrite | ${dut_node} | @{vhosts}[2] | push-1 | ${vlan_red}
169 | | L2 Tag Rewrite | ${dut_node} | @{vhosts}[3] | push-1 | ${vlan_red}
170 | | Interface is added to bridge domain | ${dut_node}
171 | | ... | ${vlan1_index} | ${bid_b} | 0
172 | | Interface is added to bridge domain | ${dut_node}
173 | | ... | @{vhosts}[0] | ${bid_b} | 0
174 | | Interface is added to bridge domain | ${dut_node}
175 | | ... | @{vhosts}[1] | ${bid_b} | 0
176 | | Interface is added to bridge domain | ${dut_node}
177 | | ... | ${vlan2_index} | ${bid_r} | 0
178 | | Interface is added to bridge domain | ${dut_node}
179 | | ... | @{vhosts}[2] | ${bid_r} | 0
180 | | Interface is added to bridge domain | ${dut_node}
181 | | ... | @{vhosts}[3] | ${bid_r} | 0
182
183 | Positive Scenario Ping From DUT1 - Intra network
184 | | [Documentation] | Send ping packets from specified namespaces to other in
185 | | ...             | order to test connectivity.
186 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue2} | ${namespace1}
187 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue1} | ${namespace2}
188 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red2} | ${namespace3}
189 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red1} | ${namespace4}
190
191 | Positive Scenario Ping From DUT1 - Inter network
192 | | [Documentation] | Send ping packets from specified namespaces to other in
193 | | ...             | order to test connectivity.
194 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue1} | ${namespace1}
195 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue2} | ${namespace1}
196 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue1} | ${namespace2}
197 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue2} | ${namespace2}
198 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red1} | ${namespace3}
199 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red2} | ${namespace3}
200 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red1} | ${namespace4}
201 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red2} | ${namespace4}
202
203 | Positive Scenario Ping From DUT2 - Intra network
204 | | [Documentation] | Send ping packets from specified namespaces to other in
205 | | ...             | order to test connectivity.
206 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue2} | ${namespace1}
207 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue1} | ${namespace2}
208 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red2} | ${namespace3}
209 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red1} | ${namespace4}
210
211 | Positive Scenario Ping From DUT2 - Inter network
212 | | [Documentation] | Send ping packets from specified namespaces to other in
213 | | ...             | order to test connectivity.
214 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue1} | ${namespace1}
215 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue2} | ${namespace1}
216 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue1} | ${namespace2}
217 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue2} | ${namespace2}
218 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red1} | ${namespace3}
219 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red2} | ${namespace3}
220 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red1} | ${namespace4}
221 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red2} | ${namespace4}
222
223 | Negative Scenario Ping From DUT1 - Intra network
224 | | [Documentation] | Send ping packets from specified namespaces to other in
225 | | ...             | order to test unreachability of namespaces.
226 | | Run keyword and expect error | Ping Not Successful
227 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red1}
228 | | ... | ${namespace1}
229 | | Run keyword and expect error | Ping Not Successful
230 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red2}
231 | | ... | ${namespace1}
232 | | Run keyword and expect error | Ping Not Successful
233 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red1}
234 | | ... | ${namespace2}
235 | | Run keyword and expect error | Ping Not Successful
236 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red2}
237 | | ... | ${namespace2}
238 | | Run keyword and expect error | Ping Not Successful
239 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue1}
240 | | ... | ${namespace3}
241 | | Run keyword and expect error | Ping Not Successful
242 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue2}
243 | | ... | ${namespace3}
244 | | Run keyword and expect error | Ping Not Successful
245 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue1}
246 | | ... | ${namespace4}
247 | | Run keyword and expect error | Ping Not Successful
248 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue2}
249 | | ... | ${namespace4}
250
251
252 | Negative Scenario Ping From DUT1 - Inter network
253 | | [Documentation] | Send ping packets from specified namespaces to other in
254 | | ...             | order to test unreachability of namespaces.
255 | | Run keyword and expect error | Ping Not Successful
256 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red1}
257 | | ... | ${namespace1}
258 | | Run keyword and expect error | Ping Not Successful
259 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red2}
260 | | ... | ${namespace1}
261 | | Run keyword and expect error | Ping Not Successful
262 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red1}
263 | | ... | ${namespace2}
264 | | Run keyword and expect error | Ping Not Successful
265 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red2}
266 | | ... | ${namespace2}
267 | | Run keyword and expect error | Ping Not Successful
268 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue1}
269 | | ... | ${namespace3}
270 | | Run keyword and expect error | Ping Not Successful
271 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue2}
272 | | ... | ${namespace3}
273 | | Run keyword and expect error | Ping Not Successful
274 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue1}
275 | | ... | ${namespace4}
276 | | Run keyword and expect error | Ping Not Successful
277 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue2}
278 | | ... | ${namespace4}
279
280 | Negative Scenario Ping From DUT2 - Intra network
281 | | [Documentation] | Send ping packets from specified namespaces to other in
282 | | ...             | order to test unreachability of namespaces.
283 | | Run keyword and expect error | Ping Not Successful
284 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red1}
285 | | ... | ${namespace1}
286 | | Run keyword and expect error | Ping Not Successful
287 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red2}
288 | | ... | ${namespace1}
289 | | Run keyword and expect error | Ping Not Successful
290 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red1}
291 | | ... | ${namespace2}
292 | | Run keyword and expect error | Ping Not Successful
293 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red2}
294 | | ... | ${namespace2}
295 | | Run keyword and expect error | Ping Not Successful
296 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue1}
297 | | ... | ${namespace3}
298 | | Run keyword and expect error | Ping Not Successful
299 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue2}
300 | | ... | ${namespace3}
301 | | Run keyword and expect error | Ping Not Successful
302 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue1}
303 | | ... | ${namespace4}
304 | | Run keyword and expect error | Ping Not Successful
305 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue2}
306 | | ... | ${namespace4}
307
308
309 | Negative Scenario Ping From DUT2 - Inter network
310 | | [Documentation] | Send ping packets from specified namespaces to other in
311 | | ...             | order to test unreachability of namespaces.
312 | | Run keyword and expect error | Ping Not Successful
313 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red1}
314 | | ... | ${namespace1}
315 | | Run keyword and expect error | Ping Not Successful
316 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red2}
317 | | ... | ${namespace1}
318 | | Run keyword and expect error | Ping Not Successful
319 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red1}
320 | | ... | ${namespace2}
321 | | Run keyword and expect error | Ping Not Successful
322 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red2}
323 | | ... | ${namespace2}
324 | | Run keyword and expect error | Ping Not Successful
325 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue1}
326 | | ... | ${namespace3}
327 | | Run keyword and expect error | Ping Not Successful
328 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue2}
329 | | ... | ${namespace3}
330 | | Run keyword and expect error | Ping Not Successful
331 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue1}
332 | | ... | ${namespace4}
333 | | Run keyword and expect error | Ping Not Successful
334 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue2}
335 | | ... | ${namespace4}