e925ccb13331caa3bb4eff9780c1f0e7c0aeff90
[integration/test.git] / csit / suites / groupbasedpolicy / GBP / 3-node / gbp1 / 020_http.robot
1 *** Settings ***
2 Documentation       Tests for HTTP flow
3
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 Suite Setup         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_4    same_webserver_ip=10.0.36.4
13 ...                     same_webserver_mac=00:00:00:00:36:04    diff_webserver_switch_ip=${GBP3}    diff_webserver_docker=h36_3    diff_webserver_ip=10.0.36.3    diff_webserver_mac=00:00:00:00:36:03
14
15 Default Tags        single-tenant    http    single-tenant-main
16
17
18 *** Variables ***
19 ${timeout}      10s
20
21
22 *** Test Cases ***
23 Same switch, start SimpleHttpServer on h36_4
24     [Documentation]    Same Switch (sw1)
25     # Same subnet tests are not supported by current topology configuration;
26     # clients and webservers are put in two different subnets
27     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
28     DockerUtils.Start HTTP Service on Docker    ${SAME_WEBSERVER_DOCKER}    80
29     SSHLibrary.Close Connection
30
31 Same switch, curl once from h35_2 to h36_4
32     [Documentation]    Test HTTP req/resp from h35_2 to h36_4.
33     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
34     DockerUtils.Curl from Docker    ${CLIENT_DOCKER}    ${SAME_WEBSERVER_IP}    80
35     SSHLibrary.Close Connection
36
37 Same switch, start endless curl from h35_2 to h36_4
38     [Documentation]    Init of endless HTTP session for purposes of traffic inspection.
39     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
40     DockerUtils.Start Endless Curl from Docker    ${CLIENT_DOCKER}    ${SAME_WEBSERVER_IP}    80
41     SSHLibrary.Close Connection
42
43 Same switch, HTTP request ovs-dpctl output check on sw1
44     [Documentation]    Assert matches and actions on megaflow of HTTP request from h35_2 to h36_4
45     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
46     @{matches}    Create List
47     @{actions}    Create List
48     Append In Port Check    ${matches}    4
49     Append Inner MAC Check    ${matches}    src_addr=${CLIENT_MAC}
50     Append Ether-Type Check    ${matches}    0x0800
51     Append Inner IPs Check    ${matches}    ${CLIENT_IP}    ${SAME_WEBSERVER_IP}
52     Append Proto Check    ${matches}    6
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}    6
56     Append Out Port Check    ${actions}    6
57     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
58     SSHLibrary.Close Connection
59
60 Same switch, HTTP reply ovs-dpctl output check on sw1
61     [Documentation]    Assert matches and actions on megaflow of HTTP reply from h36_4 to h35_2
62     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
63     @{matches}    Create List
64     @{actions}    Create List
65     Append In Port Check    ${matches}    6
66     Append Inner MAC Check    ${matches}    src_addr=${SAME_WEBSERVER_MAC}
67     Append Ether-Type Check    ${matches}    0x0800
68     Append Inner IPs Check    ${matches}    ${SAME_WEBSERVER_IP}    ${CLIENT_IP}
69     Append Proto Check    ${matches}    6
70     Append Inner MAC Check    ${actions}    dst_addr=${CLIENT_MAC}
71     Append Inner IPs Check    ${actions}    ${SAME_WEBSERVER_IP}    ${CLIENT_IP}
72     Append Proto Check    ${actions}    6
73     Append Out Port Check    ${actions}    4
74     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
75     SSHLibrary.Close Connection
76
77 Same switch, stop endless curl from h35_2 to h36_4
78     [Documentation]    Stopping endless HTTP session when traffic inspection finishes.
79     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
80     DockerUtils.Stop Endless Curl from Docker    ${CLIENT_DOCKER}
81     SSHLibrary.Close Connection
82
83 Same switch, stop SimpleHttpServer on h36_4
84     [Documentation]    Shutting down HTTP service on h36_4.
85     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
86     DockerUtils.Stop HTTP Service on Docker    ${SAME_WEBSERVER_DOCKER}
87     SSHLibrary.Close Connection
88
89 Different switches, start SimpleHttpServer on h36_3
90     [Documentation]    Different switches (sw1 -> sw3)
91     ConnUtils.Connect and Login    ${DIFF_WEBSERVER_SWITCH_IP}    timeout=${timeout}
92     DockerUtils.Start HTTP Service on Docker    ${DIFF_WEBSERVER_DOCKER}    80
93     SSHLibrary.Close Connection
94
95 Different switches, curl once from h35_2 to h36_3
96     [Documentation]    Test HTTP req/resp from h35_2 to h36_3.
97     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
98     DockerUtils.Curl from Docker    ${CLIENT_DOCKER}    ${DIFF_WEBSERVER_IP}    80
99     SSHLibrary.Close Connection
100
101 Different switches, start endless curl from h35_2 to h36_3
102     [Documentation]    Init of endless HTTP session for purposes of traffic inspection.
103     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
104     DockerUtils.Start Endless Curl from Docker    ${CLIENT_DOCKER}    ${DIFF_WEBSERVER_IP}    80
105     SSHLibrary.Close Connection
106
107 Different switches, HTTP request ovs-dpctl output check on sw1
108     [Documentation]    Assert matches and actions on megaflow of HTTP request from h35_2 to h36_3
109     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
110     @{matches}    Create List
111     @{actions}    Create List
112     Append In Port Check    ${matches}    4
113     Append Inner MAC Check    ${matches}    src_addr=${CLIENT_MAC}
114     Append Ether-Type Check    ${matches}    0x0800
115     Append Inner IPs Check    ${matches}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
116     Append Proto Check    ${matches}    6
117     Append Tunnel Set Check    ${actions}
118     Append Inner MAC Check    ${actions}    dst_addr=${DIFF_WEBSERVER_MAC}
119     Append Inner IPs Check    ${actions}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
120     Append Proto Check    ${actions}    6
121     Append Out Port Check    ${actions}    3
122     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
123     SSHLibrary.Close Connection
124
125 Different switches, HTTP request ovs-dpctl output check on sw3
126     [Documentation]    Assert matches and actions on megaflow of HTTP request from h35_2 to h36_3
127     ConnUtils.Connect and Login    ${DIFF_WEBSERVER_SWITCH_IP}    timeout=${timeout}
128     @{matches}    Create List
129     @{actions}    Create List
130     Append Tunnel Set Check    ${matches}
131     Append Outer IPs Check    ${matches}    src_ip=${CLIENT_SWITCH_IP}
132     Append Outer IPs Check    ${matches}    dst_ip=${DIFF_WEBSERVER_SWITCH_IP}
133     Append In Port Check    ${matches}    3
134     Append Inner MAC Check    ${matches}    dst_addr=${DIFF_WEBSERVER_MAC}
135     Append Ether-Type Check    ${matches}    0x0800
136     Append Inner IPs Check    ${matches}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
137     Append Proto Check    ${matches}    6
138     Append Inner IPs Check    ${actions}    ${CLIENT_IP}    ${DIFF_WEBSERVER_IP}
139     Append Proto Check    ${actions}    6
140     Append Out Port Check    ${actions}    5
141     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
142     SSHLibrary.Close Connection
143
144 Different switches, HTTP reply ovs-dpctl output check on sw3
145     [Documentation]    Assert matches and actions on megaflow of HTTP reply from h36_3 to h35_2
146     ConnUtils.Connect and Login    ${DIFF_WEBSERVER_SWITCH_IP}    timeout=${timeout}
147     @{matches}    Create List
148     @{actions}    Create List
149     Append In Port Check    ${matches}    5
150     Append Inner MAC Check    ${matches}    src_addr=${DIFF_WEBSERVER_MAC}
151     Append Ether-Type Check    ${matches}    0x0800
152     Append Inner IPs Check    ${matches}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
153     Append Proto Check    ${matches}    6
154     Append Tunnel Set Check    ${actions}
155     Append Inner MAC Check    ${actions}    dst_addr=${CLIENT_MAC}
156     Append Inner IPs Check    ${actions}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
157     Append Proto Check    ${actions}    6
158     Append Out Port Check    ${actions}    3
159     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
160     SSHLibrary.Close Connection
161
162 Different switches, HTTP reply ovs-dpctl output check on sw1
163     [Documentation]    Assert matches and actions on megaflow of HTTP request from h36_3 to h35_2
164     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
165     @{matches}    Create List
166     @{actions}    Create List
167     Append Tunnel Set Check    ${matches}
168     Append Outer IPs Check    ${matches}    src_ip=${DIFF_WEBSERVER_SWITCH_IP}
169     Append Outer IPs Check    ${matches}    dst_ip=${CLIENT_SWITCH_IP}
170     Append In Port Check    ${matches}    3
171     Append Inner MAC Check    ${matches}    dst_addr=${CLIENT_MAC}
172     Append Ether-Type Check    ${matches}    0x0800
173     Append Inner IPs Check    ${matches}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
174     Append Proto Check    ${matches}    6
175     Append Inner IPs Check    ${actions}    ${DIFF_WEBSERVER_IP}    ${CLIENT_IP}
176     Append Proto Check    ${actions}    6
177     Append Out Port Check    ${actions}    4
178     ${output}    Find Flow in DPCTL Output    ${matches}    ${actions}
179     SSHLibrary.Close Connection
180
181 Different switches, stop endless curl from h35_2 to h36_3
182     [Documentation]    Stopping endless HTTP session when traffic inspection finishes.
183     ConnUtils.Connect and Login    ${CLIENT_SWITCH_IP}    timeout=${timeout}
184     DockerUtils.Stop Endless Curl from Docker    ${CLIENT_DOCKER}
185     SSHLibrary.Close Connection
186
187 Different switches, stop SimpleHttpServer on h36_3
188     [Documentation]    Shutting down HTTP service on h36_3.
189     ConnUtils.Connect and Login    ${DIFF_WEBSERVER_SWITCH_IP}    timeout=${timeout}
190     DockerUtils.Stop HTTP Service on Docker    ${DIFF_WEBSERVER_DOCKER}
191     SSHLibrary.Close Connection