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