Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / groupbasedpolicy / GBP / 3-node / gbp2-multitenant / 010_icmp.robot
1 *** Settings ***
2 Documentation     Tests for ICMP flow
3 Force Tags        multi-tenant    icmp    multi-tenant-main
4 Library           SSHLibrary
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
11
12 *** Variables ***
13 ${timeout}        10s
14
15 *** Test Cases ***
16 Setting Variables For Tenant 1
17     [Documentation]    Setting variables for tenant 1 related test cases.
18     Set Test Variables    client_switch_ip=${GBP1}    client_docker=h35_2    client_ip=10.0.35.2    client_mac=00:00:00:00:35:02    same_webserver_docker=h36_3    same_webserver_ip=10.0.36.3
19     ...    same_webserver_mac=00:00:00:00:36:03    diff_webserver_switch_ip=${GBP3}    diff_webserver_docker=h36_2    diff_webserver_ip=10.0.36.2    diff_webserver_mac=00:00:00:00:36:02
20
21 Tenant 1 Same switch, ping once from h35_2 to h36_3
22     [Documentation]    Ping between endpoints located on the same switch "sw1".
23     [Tags]    tenant1
24     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
25     DockerUtils.Ping From Docker    ${CLIENT_DOCKER}    ${SAME_WEBSERVER_IP}
26     SSHLibrary.Close Connection
27
28 Tenant 1 Same switch, start endless ping from h35_2 to h36_3
29     [Documentation]    Start endless ping from h35_2 to h36_4 so that icmp traffic
30     ...    can be inspected.
31     [Tags]    tenant1
32     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
33     DockerUtils.Start Endless Ping from Docker    ${CLIENT_DOCKER}    ${SAME_WEBSERVER_IP}
34     SSHLibrary.Close Connection
35
36 Tenant 1 Same switch, ICMP request ovs-dpctl output check on sw1
37     [Documentation]    Assert matches and actions on megaflow of ICMP request from h35_2 to h36_3
38     [Tags]    tenant1
39     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
40     @{matches}    Create List
41     @{actions}    Create List
42     Append In Port Check    ${matches}    4
43     Append Inner MAC Check    ${matches}    src_addr=${CLIENT_MAC}
44     Append Ether-Type Check    ${matches}    0x0800
45     Append Inner IPs Check    ${matches}    ${CLIENT_IP}    ${SAME_WEBSERVER_IP}
46     Append Proto Check    ${matches}    1
47     Append Inner MAC Check    ${actions}    dst_addr=${SAME_WEBSERVER_MAC}
48     Append Inner IPs Check    ${actions}    ${CLIENT_IP}    ${SAME_WEBSERVER_IP}
49     Append Proto Check    ${actions}    1
50     Append Out Port Check    ${actions}    7
51     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
52     SSHLibrary.Close Connection
53
54 Tenant 1 Same switch, ICMP reply ovs-dpctl output check on sw1
55     [Documentation]    Assert matches and actions on megaflow of ICMP reply from h36_3 to h35_2.
56     [Tags]    tenant1
57     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
58     @{matches}    Create List
59     @{actions}    Create List
60     Append In Port Check    ${matches}    7
61     Append Inner MAC Check    ${matches}    src_addr=${SAME_WEBSERVER_MAC}
62     Append Ether-Type Check    ${matches}    0x0800
63     Append Inner IPs Check    ${matches}    ${SAME_WEBSERVER_IP}    ${CLIENT_IP}
64     Append Proto Check    ${matches}    1
65     Append Inner MAC Check    ${actions}    dst_addr=${CLIENT_MAC}
66     Append Inner IPs Check    ${actions}    ${SAME_WEBSERVER_IP}    ${CLIENT_IP}
67     Append Proto Check    ${actions}    1
68     Append Out Port Check    ${actions}    4
69     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
70     SSHLibrary.Close Connection
71
72 Tenant 1 Same switch, stop endless ping from h35_2 to h36_3
73     [Documentation]    Stops endless pinging from h35_8 to h36_6 when traffic inspection finishes.
74     [Tags]    tenant1
75     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
76     DockerUtils.Stop Endless Ping from Docker to Address    ${CLIENT_DOCKER}    ${SAME_WEBSERVER_IP}
77     SSHLibrary.Close Connection
78
79 Tenant 1 Different switches, ping once from h35_2 to h36_2
80     [Documentation]    Different switches (sw1 -> sw3)
81     [Tags]    tenant1
82     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
83     DockerUtils.Ping From Docker    ${CLIENT_DOCKER}    ${DIFF_WEBSERVER_IP}
84     SSHLibrary.Close Connection
85
86 Tenant 1 Different switches, start endless ping from h35_2 to h36_2
87     [Documentation]    Different switches (sw1 -> sw3)
88     [Tags]    tenant1
89     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
90     DockerUtils.Start Endless Ping from Docker    ${CLIENT_DOCKER}    ${DIFF_WEBSERVER_IP}
91     SSHLibrary.Close Connection
92
93 Tenant 1 Different switches, ICMP request ovs-dpctl output check on sw1
94     [Documentation]    Assert matches and actions on megaflow of ICMP request from h35_2 to h36_2
95     [Tags]    tenant1
96     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
97     @{matches}    Create List
98     @{actions}    Create List
99     Append In Port Check    ${matches}    4
100     Append Inner MAC Check    ${matches}    src_addr=${CLIENT_MAC}
101     Append Ether-Type Check    ${matches}    0x0800
102     Append Inner IPs Check    ${matches}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
103     Append Proto Check    ${matches}    1
104     Append Tunnel Set Check    ${actions}
105     Append Inner MAC Check    ${actions}    dst_addr=${DIFF_WEBSERVER_MAC}
106     Append Inner IPs Check    ${actions}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
107     Append Proto Check    ${actions}    1
108     Append Out Port Check    ${actions}    3
109     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
110     SSHLibrary.Close Connection
111
112 Tenant 1 Different switches, ICMP request ovs-dpctl output check on sw3
113     [Documentation]    Assert matches and actions on megaflow of ICMP request from h35_2 to h36_2
114     ConnUtils.Connect and Login    ${DIFF_WEBSERVER_SWITCH_IP}    timeout=${timeout}
115     @{matches}    Create List
116     @{actions}    Create List
117     Append Tunnel Set Check    ${matches}
118     Append Outer IPs Check    ${matches}    src_ip=${CLIENT_SWITCH_IP}
119     Append Outer IPs Check    ${matches}    dst_ip=${DIFF_WEBSERVER_SWITCH_IP}
120     Append In Port Check    ${matches}    3
121     Append Inner MAC Check    ${matches}    dst_addr=${DIFF_WEBSERVER_MAC}
122     Append Ether-Type Check    ${matches}    0x0800
123     Append Inner IPs Check    ${matches}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
124     Append Proto Check    ${matches}    1
125     Append Inner IPs Check    ${actions}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
126     Append Proto Check    ${actions}    1
127     Append Out Port Check    ${actions}    6
128     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
129     SSHLibrary.Close Connection
130
131 Tenant 1 Different switches, ICMP reply ovs-dpctl output check on sw3
132     [Documentation]    Assert matches and actions on megaflow of ICMP request from h36_2 to h35_2
133     [Tags]    tenant1
134     ConnUtils.Connect and Login    ${DIFF_WEBSERVER_SWITCH_IP}    timeout=${timeout}
135     @{matches}    Create List
136     @{actions}    Create List
137     Append In Port Check    ${matches}    6
138     Append Inner MAC Check    ${matches}    src_addr=${DIFF_WEBSERVER_MAC}
139     Append Ether-Type Check    ${matches}    0x0800
140     Append Inner IPs Check    ${matches}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
141     Append Proto Check    ${matches}    1
142     Append Tunnel Set Check    ${actions}
143     Append Inner MAC Check    ${actions}    dst_addr=${CLIENT_MAC}
144     Append Inner IPs Check    ${actions}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
145     Append Proto Check    ${actions}    1
146     Append Out Port Check    ${actions}    3
147     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
148     SSHLibrary.Close Connection
149
150 Tenant 1 Different switches, ICMP reply ovs-dpctl output check on sw1
151     [Documentation]    Assert matches and actions on megaflow of ICMP reply from h36_2 to h35_2
152     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
153     @{matches}    Create List
154     @{actions}    Create List
155     Append Tunnel Set Check    ${matches}
156     Append Outer IPs Check    ${matches}    src_ip=${DIFF_WEBSERVER_SWITCH_IP}
157     Append Outer IPs Check    ${matches}    dst_ip=${CLIENT_SWITCH_IP}
158     Append In Port Check    ${matches}    3
159     Append Inner MAC Check    ${matches}    dst_addr=${CLIENT_MAC}
160     Append Ether-Type Check    ${matches}    0x0800
161     Append Inner IPs Check    ${matches}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
162     Append Proto Check    ${matches}    1
163     Append Inner IPs Check    ${actions}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
164     Append Proto Check    ${actions}    1
165     Append Out Port Check    ${actions}    4
166     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
167     SSHLibrary.Close Connection
168
169 Tenant 1 Different switches, stop endless ping from h35_2 to h36_2
170     [Documentation]    Stops endless pinging from h35_2 to h36_2 when traffic inspection finishes.
171     [Tags]    tenant1
172     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
173     DockerUtils.Stop Endless Ping from Docker to Address    ${CLIENT_DOCKER}    ${DIFF_WEBSERVER_IP}
174     SSHLibrary.Close Connection
175
176 Setting Variables For Tenant 2
177     [Documentation]    Setting variables for tenant 2 related test cases.
178     Set Test Variables    client_switch_ip=${GBP1}    client_docker=h35_8    client_ip=10.0.35.8    client_mac=00:00:00:00:35:08    same_webserver_docker=h36_6    same_webserver_ip=10.0.36.6
179     ...    same_webserver_mac=00:00:00:00:36:06    diff_webserver_switch_ip=${GBP2}    diff_webserver_docker=h36_7    diff_webserver_ip=10.0.36.7    diff_webserver_mac=00:00:00:00:36:07
180
181 Tenant 2 Same switch, ping once from h35_8 to h36_6
182     [Documentation]    Same switch (sw1)
183     [Tags]    tenant2
184     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
185     DockerUtils.Ping From Docker    ${CLIENT_DOCKER}    ${SAME_WEBSERVER_IP}
186     SSHLibrary.Close Connection
187
188 Tenant 2 Same switch, start endless ping from h35_8 to h36_6
189     [Documentation]    Starting icmp between hosts on the same switch so that
190     ...    traffic can be inspected.
191     [Tags]    tenant2
192     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
193     DockerUtils.Start Endless Ping from Docker    ${CLIENT_DOCKER}    ${SAME_WEBSERVER_IP}
194     SSHLibrary.Close Connection
195
196 Tenant 2 Same switch, ICMP request ovs-dpctl output check on sw1
197     [Documentation]    Assert matches and actions on megaflow of ICMP request from h35_8 to h36_6
198     [Tags]    tenant2
199     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
200     @{matches}    Create List
201     @{actions}    Create List
202     Append In Port Check    ${matches}    6
203     Append Inner MAC Check    ${matches}    src_addr=${CLIENT_MAC}
204     Append Ether-Type Check    ${matches}    0x0800
205     Append Inner IPs Check    ${matches}    ${CLIENT_IP}    ${SAME_WEBSERVER_IP}
206     Append Proto Check    ${matches}    1
207     Append Inner MAC Check    ${actions}    dst_addr=${SAME_WEBSERVER_MAC}
208     Append Inner IPs Check    ${actions}    ${CLIENT_IP}    ${SAME_WEBSERVER_IP}
209     Append Proto Check    ${actions}    1
210     Append Out Port Check    ${actions}    8
211     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
212     SSHLibrary.Close Connection
213
214 Tenant 2 Same switch, ICMP reply ovs-dpctl output check on sw1
215     [Documentation]    Assert matches and actions on megaflow of ICMP reply from h35_8 to h36_6
216     [Tags]    tenant2
217     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
218     @{matches}    Create List
219     @{actions}    Create List
220     Append In Port Check    ${matches}    8
221     Append Inner MAC Check    ${matches}    src_addr=${SAME_WEBSERVER_MAC}
222     Append Ether-Type Check    ${matches}    0x0800
223     Append Inner IPs Check    ${matches}    ${SAME_WEBSERVER_IP}    ${CLIENT_IP}
224     Append Proto Check    ${matches}    1
225     Append Inner MAC Check    ${actions}    dst_addr=${CLIENT_MAC}
226     Append Inner IPs Check    ${actions}    ${SAME_WEBSERVER_IP}    ${CLIENT_IP}
227     Append Proto Check    ${actions}    1
228     Append Out Port Check    ${actions}    6
229     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
230     SSHLibrary.Close Connection
231
232 Tenant 2 Same switch, stop endless ping from h35_8 to h36_6
233     [Documentation]    Stops endless pinging from h35_8 to h36_6 when traffic inspection finishes.
234     [Tags]    tenant2
235     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
236     DockerUtils.Stop Endless Ping from Docker to Address    ${CLIENT_DOCKER}    ${SAME_WEBSERVER_IP}
237     SSHLibrary.Close Connection
238
239 Tenant 2 Different switches, ping once from h35_8 to h36_7
240     [Documentation]    Different switches (sw1 -> sw3)
241     [Tags]    tenant2
242     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
243     DockerUtils.Ping From Docker    ${CLIENT_DOCKER}    ${DIFF_WEBSERVER_IP}
244     SSHLibrary.Close Connection
245
246 Tenant 2 Different switches, start endless ping from h35_8 to h36_7
247     [Documentation]    Different switches (sw1 -> sw3)
248     [Tags]    tenant2
249     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
250     DockerUtils.Start Endless Ping from Docker    ${CLIENT_DOCKER}    ${DIFF_WEBSERVER_IP}
251     SSHLibrary.Close Connection
252
253 Tenant 2 Different switches, ICMP request ovs-dpctl output check on sw1
254     [Documentation]    Assert matches and actions on megaflow of ICMP request from h35_8 to h36_7
255     [Tags]    tenant2
256     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
257     @{matches}    Create List
258     @{actions}    Create List
259     Append In Port Check    ${matches}    6
260     Append Inner MAC Check    ${matches}    src_addr=${CLIENT_MAC}
261     Append Ether-Type Check    ${matches}    0x0800
262     Append Inner IPs Check    ${matches}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
263     Append Proto Check    ${matches}    1
264     Append Tunnel Set Check    ${actions}
265     Append Inner MAC Check    ${actions}    dst_addr=${DIFF_WEBSERVER_MAC}
266     Append Inner IPs Check    ${actions}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
267     Append Proto Check    ${actions}    1
268     Append Out Port Check    ${actions}    3
269     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
270     SSHLibrary.Close Connection
271
272 Tenant 2 Different switches, ICMP request ovs-dpctl output check on sw3
273     [Documentation]    Assert matches and actions on megaflow of ICMP request from h35_8 to h36_7
274     ConnUtils.Connect and Login    ${DIFF_WEBSERVER_SWITCH_IP}    timeout=${timeout}
275     @{matches}    Create List
276     @{actions}    Create List
277     Append Tunnel Set Check    ${matches}
278     Append Outer IPs Check    ${matches}    src_ip=${CLIENT_SWITCH_IP}
279     Append Outer IPs Check    ${matches}    dst_ip=${DIFF_WEBSERVER_SWITCH_IP}
280     Append In Port Check    ${matches}    3
281     Append Inner MAC Check    ${matches}    dst_addr=${DIFF_WEBSERVER_MAC}
282     Append Ether-Type Check    ${matches}    0x0800
283     Append Inner IPs Check    ${matches}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
284     Append Proto Check    ${matches}    1
285     Append Inner IPs Check    ${actions}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
286     Append Proto Check    ${actions}    1
287     Append Out Port Check    ${actions}    8
288     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
289     SSHLibrary.Close Connection
290
291 Tenant 2 Different switches, ICMP reply ovs-dpctl output check on sw3
292     [Documentation]    Assert matches and actions on megaflow of ICMP request from h36_7 to h35_8
293     [Tags]    tenant2
294     ConnUtils.Connect and Login    ${DIFF_WEBSERVER_SWITCH_IP}    timeout=${timeout}
295     @{matches}    Create List
296     @{actions}    Create List
297     Append In Port Check    ${matches}    8
298     Append Inner MAC Check    ${matches}    src_addr=${DIFF_WEBSERVER_MAC}
299     Append Ether-Type Check    ${matches}    0x0800
300     Append Inner IPs Check    ${matches}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
301     Append Proto Check    ${matches}    1
302     Append Tunnel Set Check    ${actions}
303     Append Inner MAC Check    ${actions}    dst_addr=${CLIENT_MAC}
304     Append Inner IPs Check    ${actions}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
305     Append Proto Check    ${actions}    1
306     Append Out Port Check    ${actions}    3
307     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
308     SSHLibrary.Close Connection
309
310 Tenant 2 Different switches, ICMP reply ovs-dpctl output check on sw1
311     [Documentation]    Assert matches and actions on megaflow of ICMP reply from h36_7 to h35_8
312     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
313     @{matches}    Create List
314     @{actions}    Create List
315     Append Tunnel Set Check    ${matches}
316     Append Outer IPs Check    ${matches}    src_ip=${DIFF_WEBSERVER_SWITCH_IP}
317     Append Outer IPs Check    ${matches}    dst_ip=${CLIENT_SWITCH_IP}
318     Append In Port Check    ${matches}    3
319     Append Inner MAC Check    ${matches}    dst_addr=${CLIENT_MAC}
320     Append Ether-Type Check    ${matches}    0x0800
321     Append Inner IPs Check    ${matches}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
322     Append Proto Check    ${matches}    1
323     Append Inner IPs Check    ${actions}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
324     Append Proto Check    ${actions}    1
325     Append Out Port Check    ${actions}    6
326     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
327     SSHLibrary.Close Connection
328
329 Tenant 2 Different switches, stop endless ping from h35_8 to h36_7
330     [Documentation]    Stops endless pinging from h35_8 to h36_7 when traffic inspection finishes.
331     [Tags]    tenant2
332     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
333     DockerUtils.Stop Endless Ping from Docker to Address    ${CLIENT_DOCKER}    ${DIFF_WEBSERVER_IP}
334     SSHLibrary.Close Connection