FIX: refactor https://gerrit.fd.io/r/#/c/1032
[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 | | ${interface_name}= | Get interface name | ${dut_node} | ${interface}
163 | | ${vlan1_name} | ${vlan1_index}= | Create Vlan Subinterface
164 | | ... | ${dut_node} | ${interface_name} | ${vlan_blue}
165 | | ${vlan2_name} | ${vlan2_index}= | Create Vlan Subinterface
166 | | ... | ${dut_node} | ${interface_name} | ${vlan_red}
167 | | L2 Tag Rewrite | ${dut_node} | @{vhosts}[0] | push-1 | ${vlan_blue}
168 | | L2 Tag Rewrite | ${dut_node} | @{vhosts}[1] | push-1 | ${vlan_blue}
169 | | L2 Tag Rewrite | ${dut_node} | @{vhosts}[2] | push-1 | ${vlan_red}
170 | | L2 Tag Rewrite | ${dut_node} | @{vhosts}[3] | push-1 | ${vlan_red}
171 | | Interface is added to bridge domain | ${dut_node}
172 | | ... | ${vlan1_index} | ${bid_b} | 0
173 | | Interface is added to bridge domain | ${dut_node}
174 | | ... | @{vhosts}[0] | ${bid_b} | 0
175 | | Interface is added to bridge domain | ${dut_node}
176 | | ... | @{vhosts}[1] | ${bid_b} | 0
177 | | Interface is added to bridge domain | ${dut_node}
178 | | ... | ${vlan2_index} | ${bid_r} | 0
179 | | Interface is added to bridge domain | ${dut_node}
180 | | ... | @{vhosts}[2] | ${bid_r} | 0
181 | | Interface is added to bridge domain | ${dut_node}
182 | | ... | @{vhosts}[3] | ${bid_r} | 0
183
184 | Positive Scenario Ping From DUT1 - Intra network
185 | | [Documentation] | Send ping packets from specified namespaces to other in
186 | | ...             | order to test connectivity.
187 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue2} | ${namespace1}
188 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue1} | ${namespace2}
189 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red2} | ${namespace3}
190 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red1} | ${namespace4}
191
192 | Positive Scenario Ping From DUT1 - Inter network
193 | | [Documentation] | Send ping packets from specified namespaces to other in
194 | | ...             | order to test connectivity.
195 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue1} | ${namespace1}
196 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue2} | ${namespace1}
197 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue1} | ${namespace2}
198 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue2} | ${namespace2}
199 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red1} | ${namespace3}
200 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red2} | ${namespace3}
201 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red1} | ${namespace4}
202 | | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red2} | ${namespace4}
203
204 | Positive Scenario Ping From DUT2 - Intra network
205 | | [Documentation] | Send ping packets from specified namespaces to other in
206 | | ...             | order to test connectivity.
207 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue2} | ${namespace1}
208 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue1} | ${namespace2}
209 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red2} | ${namespace3}
210 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red1} | ${namespace4}
211
212 | Positive Scenario Ping From DUT2 - Inter network
213 | | [Documentation] | Send ping packets from specified namespaces to other in
214 | | ...             | order to test connectivity.
215 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue1} | ${namespace1}
216 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue2} | ${namespace1}
217 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue1} | ${namespace2}
218 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue2} | ${namespace2}
219 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red1} | ${namespace3}
220 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red2} | ${namespace3}
221 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red1} | ${namespace4}
222 | | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red2} | ${namespace4}
223
224 | Negative Scenario Ping From DUT1 - Intra network
225 | | [Documentation] | Send ping packets from specified namespaces to other in
226 | | ...             | order to test unreachability of namespaces.
227 | | Run keyword and expect error | Ping Not Successful
228 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red1}
229 | | ... | ${namespace1}
230 | | Run keyword and expect error | Ping Not Successful
231 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red2}
232 | | ... | ${namespace1}
233 | | Run keyword and expect error | Ping Not Successful
234 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red1}
235 | | ... | ${namespace2}
236 | | Run keyword and expect error | Ping Not Successful
237 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_red2}
238 | | ... | ${namespace2}
239 | | Run keyword and expect error | Ping Not Successful
240 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue1}
241 | | ... | ${namespace3}
242 | | Run keyword and expect error | Ping Not Successful
243 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue2}
244 | | ... | ${namespace3}
245 | | Run keyword and expect error | Ping Not Successful
246 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue1}
247 | | ... | ${namespace4}
248 | | Run keyword and expect error | Ping Not Successful
249 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut1_blue2}
250 | | ... | ${namespace4}
251
252
253 | Negative Scenario Ping From DUT1 - Inter network
254 | | [Documentation] | Send ping packets from specified namespaces to other in
255 | | ...             | order to test unreachability of namespaces.
256 | | Run keyword and expect error | Ping Not Successful
257 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red1}
258 | | ... | ${namespace1}
259 | | Run keyword and expect error | Ping Not Successful
260 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red2}
261 | | ... | ${namespace1}
262 | | Run keyword and expect error | Ping Not Successful
263 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red1}
264 | | ... | ${namespace2}
265 | | Run keyword and expect error | Ping Not Successful
266 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_red2}
267 | | ... | ${namespace2}
268 | | Run keyword and expect error | Ping Not Successful
269 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue1}
270 | | ... | ${namespace3}
271 | | Run keyword and expect error | Ping Not Successful
272 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue2}
273 | | ... | ${namespace3}
274 | | Run keyword and expect error | Ping Not Successful
275 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue1}
276 | | ... | ${namespace4}
277 | | Run keyword and expect error | Ping Not Successful
278 | | ... | Send Ping From Node To Dst | ${qemu_node1} | ${dut2_blue2}
279 | | ... | ${namespace4}
280
281 | Negative Scenario Ping From DUT2 - Intra network
282 | | [Documentation] | Send ping packets from specified namespaces to other in
283 | | ...             | order to test unreachability of namespaces.
284 | | Run keyword and expect error | Ping Not Successful
285 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red1}
286 | | ... | ${namespace1}
287 | | Run keyword and expect error | Ping Not Successful
288 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red2}
289 | | ... | ${namespace1}
290 | | Run keyword and expect error | Ping Not Successful
291 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red1}
292 | | ... | ${namespace2}
293 | | Run keyword and expect error | Ping Not Successful
294 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_red2}
295 | | ... | ${namespace2}
296 | | Run keyword and expect error | Ping Not Successful
297 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue1}
298 | | ... | ${namespace3}
299 | | Run keyword and expect error | Ping Not Successful
300 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue2}
301 | | ... | ${namespace3}
302 | | Run keyword and expect error | Ping Not Successful
303 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue1}
304 | | ... | ${namespace4}
305 | | Run keyword and expect error | Ping Not Successful
306 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut2_blue2}
307 | | ... | ${namespace4}
308
309
310 | Negative Scenario Ping From DUT2 - Inter network
311 | | [Documentation] | Send ping packets from specified namespaces to other in
312 | | ...             | order to test unreachability of namespaces.
313 | | Run keyword and expect error | Ping Not Successful
314 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red1}
315 | | ... | ${namespace1}
316 | | Run keyword and expect error | Ping Not Successful
317 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red2}
318 | | ... | ${namespace1}
319 | | Run keyword and expect error | Ping Not Successful
320 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red1}
321 | | ... | ${namespace2}
322 | | Run keyword and expect error | Ping Not Successful
323 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_red2}
324 | | ... | ${namespace2}
325 | | Run keyword and expect error | Ping Not Successful
326 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue1}
327 | | ... | ${namespace3}
328 | | Run keyword and expect error | Ping Not Successful
329 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue2}
330 | | ... | ${namespace3}
331 | | Run keyword and expect error | Ping Not Successful
332 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue1}
333 | | ... | ${namespace4}
334 | | Run keyword and expect error | Ping Not Successful
335 | | ... | Send Ping From Node To Dst | ${qemu_node2} | ${dut1_blue2}
336 | | ... | ${namespace4}