2 Documentation Tests for ICMP flow
3 Force Tags multi-tenant icmp multi-tenant-main
5 Resource ../../../../../libraries/Utils.robot
6 Resource ../../../../../libraries/GBP/ConnUtils.robot
7 Resource ../../../../../libraries/GBP/DockerUtils.robot
8 Resource ../../../../../libraries/GBP/OpenFlowUtils.robot
9 Variables ../../../../../variables/Variables.py
10 Resource ../Variables.robot
17 Setting Variables For Tenant 1
18 [Documentation] Setting variables for tenant 1 related test cases.
19 Set Test Variables client_switch_ip=${GBP1} client_docker=h35_2 client_ip=10.0.35.2
20 ... client_mac=00:00:00:00:35:02 same_webserver_docker=h36_3 same_webserver_ip=10.0.36.3
21 ... same_webserver_mac=00:00:00:00:36:03 diff_webserver_switch_ip=${GBP3}
22 ... diff_webserver_docker=h36_2 diff_webserver_ip=10.0.36.2
23 ... diff_webserver_mac=00:00:00:00:36:02
25 Tenant 1 Same switch, ping once from h35_2 to h36_3
27 [Documentation] Ping between endpoints located on the same switch "sw1".
28 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
29 DockerUtils.Ping From Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP}
30 SSHLibrary.Close Connection
32 Tenant 1 Same switch, start endless ping from h35_2 to h36_3
34 [Documentation] Start endless ping from h35_2 to h36_4 so that icmp traffic
36 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
37 DockerUtils.Start Endless Ping from Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP}
38 SSHLibrary.Close Connection
40 Tenant 1 Same switch, ICMP request ovs-dpctl output check on sw1
41 [Documentation] Assert matches and actions on megaflow of ICMP request from h35_2 to h36_3
43 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
45 @{matches} Create List
46 @{actions} Create List
47 Append In Port Check ${matches} 4
48 Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC}
49 Append Ether-Type Check ${matches} 0x0800
50 Append Inner IPs Check ${matches} ${CLIENT_IP} ${SAME_WEBSERVER_IP}
51 Append Proto Check ${matches} 1
53 Append Inner MAC Check ${actions} dst_addr=${SAME_WEBSERVER_MAC}
54 Append Inner IPs Check ${actions} ${CLIENT_IP} ${SAME_WEBSERVER_IP}
55 Append Proto Check ${actions} 1
56 Append Out Port Check ${actions} 7
58 ${output} Find Flow in DPCTL Output ${matches} ${actions}
60 SSHLibrary.Close Connection
62 Tenant 1 Same switch, ICMP reply ovs-dpctl output check on sw1
63 [Documentation] Assert matches and actions on megaflow of ICMP reply from h36_3 to h35_2.
65 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
67 @{matches} Create List
68 @{actions} Create List
69 Append In Port Check ${matches} 7
70 Append Inner MAC Check ${matches} src_addr=${SAME_WEBSERVER_MAC}
71 Append Ether-Type Check ${matches} 0x0800
72 Append Inner IPs Check ${matches} ${SAME_WEBSERVER_IP} ${CLIENT_IP}
73 Append Proto Check ${matches} 1
75 Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC}
76 Append Inner IPs Check ${actions} ${SAME_WEBSERVER_IP} ${CLIENT_IP}
77 Append Proto Check ${actions} 1
78 Append Out Port Check ${actions} 4
80 ${output} Find Flow in DPCTL Output ${matches} ${actions}
82 SSHLibrary.Close Connection
84 Tenant 1 Same switch, stop endless ping from h35_2 to h36_3
86 [Documentation] Stops endless pinging from h35_8 to h36_6 when traffic inspection finishes.
87 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
88 DockerUtils.Stop Endless Ping from Docker to Address ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP}
89 SSHLibrary.Close Connection
92 Tenant 1 Different switches, ping once from h35_2 to h36_2
93 [Documentation] Different switches (sw1 -> sw3)
95 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
96 DockerUtils.Ping From Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP}
97 SSHLibrary.Close Connection
99 Tenant 1 Different switches, start endless ping from h35_2 to h36_2
100 [Documentation] Different switches (sw1 -> sw3)
102 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
103 DockerUtils.Start Endless Ping from Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP}
104 SSHLibrary.Close Connection
106 Tenant 1 Different switches, ICMP request ovs-dpctl output check on sw1
107 [Documentation] Assert matches and actions on megaflow of ICMP request from h35_2 to h36_2
109 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
111 @{matches} Create List
112 @{actions} Create List
113 Append In Port Check ${matches} 4
114 Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC}
115 Append Ether-Type Check ${matches} 0x0800
116 Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP}
117 Append Proto Check ${matches} 1
119 Append Tunnel Set Check ${actions}
120 Append Inner MAC Check ${actions} dst_addr=${DIFF_WEBSERVER_MAC}
121 Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP}
122 Append Proto Check ${actions} 1
123 Append Out Port Check ${actions} 3
125 ${output} Find Flow in DPCTL Output ${matches} ${actions}
127 SSHLibrary.Close Connection
129 Tenant 1 Different switches, ICMP request ovs-dpctl output check on sw3
130 [Documentation] Assert matches and actions on megaflow of ICMP request from h35_2 to h36_2
131 ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout}
133 @{matches} Create List
134 @{actions} Create List
135 Append Tunnel Set Check ${matches}
136 Append Outer IPs Check ${matches} src_ip=${CLIENT_SWITCH_IP}
137 Append Outer IPs Check ${matches} dst_ip=${DIFF_WEBSERVER_SWITCH_IP}
138 Append In Port Check ${matches} 3
139 Append Inner MAC Check ${matches} dst_addr=${DIFF_WEBSERVER_MAC}
140 Append Ether-Type Check ${matches} 0x0800
141 Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP}
142 Append Proto Check ${matches} 1
144 Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP}
145 Append Proto Check ${actions} 1
146 Append Out Port Check ${actions} 6
148 ${output} Find Flow in DPCTL Output ${matches} ${actions}
150 SSHLibrary.Close Connection
152 Tenant 1 Different switches, ICMP reply ovs-dpctl output check on sw3
153 [Documentation] Assert matches and actions on megaflow of ICMP request from h36_2 to h35_2
155 ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout}
157 @{matches} Create List
158 @{actions} Create List
159 Append In Port Check ${matches} 6
160 Append Inner MAC Check ${matches} src_addr=${DIFF_WEBSERVER_MAC}
161 Append Ether-Type Check ${matches} 0x0800
162 Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP}
163 Append Proto Check ${matches} 1
165 Append Tunnel Set Check ${actions}
166 Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC}
167 Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP}
168 Append Proto Check ${actions} 1
169 Append Out Port Check ${actions} 3
171 ${output} Find Flow in DPCTL Output ${matches} ${actions}
173 SSHLibrary.Close Connection
175 Tenant 1 Different switches, ICMP reply ovs-dpctl output check on sw1
176 [Documentation] Assert matches and actions on megaflow of ICMP reply from h36_2 to h35_2
177 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
179 @{matches} Create List
180 @{actions} Create List
181 Append Tunnel Set Check ${matches}
182 Append Outer IPs Check ${matches} src_ip=${DIFF_WEBSERVER_SWITCH_IP}
183 Append Outer IPs Check ${matches} dst_ip=${CLIENT_SWITCH_IP}
184 Append In Port Check ${matches} 3
185 Append Inner MAC Check ${matches} dst_addr=${CLIENT_MAC}
186 Append Ether-Type Check ${matches} 0x0800
187 Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP}
188 Append Proto Check ${matches} 1
190 Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP}
191 Append Proto Check ${actions} 1
192 Append Out Port Check ${actions} 4
194 ${output} Find Flow in DPCTL Output ${matches} ${actions}
196 SSHLibrary.Close Connection
198 Tenant 1 Different switches, stop endless ping from h35_2 to h36_2
200 [Documentation] Stops endless pinging from h35_2 to h36_2 when traffic inspection finishes.
201 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
202 DockerUtils.Stop Endless Ping from Docker to Address ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP}
203 SSHLibrary.Close Connection
205 Setting Variables For Tenant 2
206 [Documentation] Setting variables for tenant 2 related test cases.
207 Set Test Variables client_switch_ip=${GBP1} client_docker=h35_8 client_ip=10.0.35.8
208 ... client_mac=00:00:00:00:35:08 same_webserver_docker=h36_6 same_webserver_ip=10.0.36.6
209 ... same_webserver_mac=00:00:00:00:36:06 diff_webserver_switch_ip=${GBP2}
210 ... diff_webserver_docker=h36_7 diff_webserver_ip=10.0.36.7
211 ... diff_webserver_mac=00:00:00:00:36:07
213 Tenant 2 Same switch, ping once from h35_8 to h36_6
214 [Documentation] Same switch (sw1)
216 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
217 DockerUtils.Ping From Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP}
218 SSHLibrary.Close Connection
220 Tenant 2 Same switch, start endless ping from h35_8 to h36_6
222 [Documentation] Starting icmp between hosts on the same switch so that
223 ... traffic can be inspected.
224 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
225 DockerUtils.Start Endless Ping from Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP}
226 SSHLibrary.Close Connection
228 Tenant 2 Same switch, ICMP request ovs-dpctl output check on sw1
229 [Documentation] Assert matches and actions on megaflow of ICMP request from h35_8 to h36_6
231 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
233 @{matches} Create List
234 @{actions} Create List
235 Append In Port Check ${matches} 6
236 Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC}
237 Append Ether-Type Check ${matches} 0x0800
238 Append Inner IPs Check ${matches} ${CLIENT_IP} ${SAME_WEBSERVER_IP}
239 Append Proto Check ${matches} 1
241 Append Inner MAC Check ${actions} dst_addr=${SAME_WEBSERVER_MAC}
242 Append Inner IPs Check ${actions} ${CLIENT_IP} ${SAME_WEBSERVER_IP}
243 Append Proto Check ${actions} 1
244 Append Out Port Check ${actions} 8
246 ${output} Find Flow in DPCTL Output ${matches} ${actions}
248 SSHLibrary.Close Connection
250 Tenant 2 Same switch, ICMP reply ovs-dpctl output check on sw1
251 [Documentation] Assert matches and actions on megaflow of ICMP reply from h35_8 to h36_6
253 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
255 @{matches} Create List
256 @{actions} Create List
257 Append In Port Check ${matches} 8
258 Append Inner MAC Check ${matches} src_addr=${SAME_WEBSERVER_MAC}
259 Append Ether-Type Check ${matches} 0x0800
260 Append Inner IPs Check ${matches} ${SAME_WEBSERVER_IP} ${CLIENT_IP}
261 Append Proto Check ${matches} 1
263 Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC}
264 Append Inner IPs Check ${actions} ${SAME_WEBSERVER_IP} ${CLIENT_IP}
265 Append Proto Check ${actions} 1
266 Append Out Port Check ${actions} 6
268 ${output} Find Flow in DPCTL Output ${matches} ${actions}
270 SSHLibrary.Close Connection
272 Tenant 2 Same switch, stop endless ping from h35_8 to h36_6
274 [Documentation] Stops endless pinging from h35_8 to h36_6 when traffic inspection finishes.
275 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
276 DockerUtils.Stop Endless Ping from Docker to Address ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP}
277 SSHLibrary.Close Connection
280 Tenant 2 Different switches, ping once from h35_8 to h36_7
281 [Documentation] Different switches (sw1 -> sw3)
283 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
284 DockerUtils.Ping From Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP}
285 SSHLibrary.Close Connection
287 Tenant 2 Different switches, start endless ping from h35_8 to h36_7
288 [Documentation] Different switches (sw1 -> sw3)
290 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
291 DockerUtils.Start Endless Ping from Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP}
292 SSHLibrary.Close Connection
294 Tenant 2 Different switches, ICMP request ovs-dpctl output check on sw1
295 [Documentation] Assert matches and actions on megaflow of ICMP request from h35_8 to h36_7
297 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
299 @{matches} Create List
300 @{actions} Create List
301 Append In Port Check ${matches} 6
302 Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC}
303 Append Ether-Type Check ${matches} 0x0800
304 Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP}
305 Append Proto Check ${matches} 1
307 Append Tunnel Set Check ${actions}
308 Append Inner MAC Check ${actions} dst_addr=${DIFF_WEBSERVER_MAC}
309 Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP}
310 Append Proto Check ${actions} 1
311 Append Out Port Check ${actions} 3
313 ${output} Find Flow in DPCTL Output ${matches} ${actions}
315 SSHLibrary.Close Connection
317 Tenant 2 Different switches, ICMP request ovs-dpctl output check on sw3
318 [Documentation] Assert matches and actions on megaflow of ICMP request from h35_8 to h36_7
319 ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout}
321 @{matches} Create List
322 @{actions} Create List
323 Append Tunnel Set Check ${matches}
324 Append Outer IPs Check ${matches} src_ip=${CLIENT_SWITCH_IP}
325 Append Outer IPs Check ${matches} dst_ip=${DIFF_WEBSERVER_SWITCH_IP}
326 Append In Port Check ${matches} 3
327 Append Inner MAC Check ${matches} dst_addr=${DIFF_WEBSERVER_MAC}
328 Append Ether-Type Check ${matches} 0x0800
329 Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP}
330 Append Proto Check ${matches} 1
332 Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP}
333 Append Proto Check ${actions} 1
334 Append Out Port Check ${actions} 8
336 ${output} Find Flow in DPCTL Output ${matches} ${actions}
338 SSHLibrary.Close Connection
340 Tenant 2 Different switches, ICMP reply ovs-dpctl output check on sw3
341 [Documentation] Assert matches and actions on megaflow of ICMP request from h36_7 to h35_8
343 ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout}
345 @{matches} Create List
346 @{actions} Create List
347 Append In Port Check ${matches} 8
348 Append Inner MAC Check ${matches} src_addr=${DIFF_WEBSERVER_MAC}
349 Append Ether-Type Check ${matches} 0x0800
350 Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP}
351 Append Proto Check ${matches} 1
353 Append Tunnel Set Check ${actions}
354 Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC}
355 Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP}
356 Append Proto Check ${actions} 1
357 Append Out Port Check ${actions} 3
359 ${output} Find Flow in DPCTL Output ${matches} ${actions}
361 SSHLibrary.Close Connection
363 Tenant 2 Different switches, ICMP reply ovs-dpctl output check on sw1
364 [Documentation] Assert matches and actions on megaflow of ICMP reply from h36_7 to h35_8
365 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
367 @{matches} Create List
368 @{actions} Create List
369 Append Tunnel Set Check ${matches}
370 Append Outer IPs Check ${matches} src_ip=${DIFF_WEBSERVER_SWITCH_IP}
371 Append Outer IPs Check ${matches} dst_ip=${CLIENT_SWITCH_IP}
372 Append In Port Check ${matches} 3
373 Append Inner MAC Check ${matches} dst_addr=${CLIENT_MAC}
374 Append Ether-Type Check ${matches} 0x0800
375 Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP}
376 Append Proto Check ${matches} 1
378 Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP}
379 Append Proto Check ${actions} 1
380 Append Out Port Check ${actions} 6
382 ${output} Find Flow in DPCTL Output ${matches} ${actions}
384 SSHLibrary.Close Connection
386 Tenant 2 Different switches, stop endless ping from h35_8 to h36_7
387 [Documentation] Stops endless pinging from h35_8 to h36_7 when traffic inspection finishes.
389 ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout}
390 DockerUtils.Stop Endless Ping from Docker to Address ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP}
391 SSHLibrary.Close Connection