60133279243fdb5374c2a4e2f733f2f57d4016bf
[integration/test.git] / csit / suites / openstack / clustering / ha_l2.robot
1 *** Settings ***
2 Documentation       Test suite to verify packet flows between vm instances.
3
4 Library             SSHLibrary
5 Library             OperatingSystem
6 Library             RequestsLibrary
7 Library             Collections
8 Resource            ../../../libraries/Utils.robot
9 Resource            ../../../libraries/OpenStackOperations.robot
10 Resource            ../../../libraries/DevstackUtils.robot
11 Resource            ../../../libraries/OVSDB.robot
12 Resource            ../../../libraries/ClusterOvsdb.robot
13 Resource            ../../../libraries/ClusterManagement.robot
14 Resource            ../../../libraries/SetupUtils.robot
15 Resource            ../../../variables/Variables.robot
16
17 Suite Setup         OpenStackOperations.OpenStack Suite Setup
18 Suite Teardown      OpenStackOperations.OpenStack Suite Teardown
19 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
20 Test Teardown       OpenStackOperations.Get Test Teardown Debugs
21
22
23 *** Variables ***
24 ${SECURITY_GROUP}       cl2_sg
25 @{NETWORKS}             cl2_net_1    cl2_net_2
26 @{SUBNETS}              cl2_sub_1    cl2_sub_2
27 @{NET_1_VMS}            cl2_net_1_vm_1    cl2_net_1_vm_2    cl2_net_1_vm_3
28 @{NET_2_VMS}            cl2_net_2_vm_1    cl2_net_2_vm_2    cl2_net_2_vm_3
29 @{SUBNET_CIDRS}         26.0.0.0/24    27.0.0.0/24
30 @{CLUSTER_DOWN_LIST}    ${1}    ${2}
31
32
33 *** Test Cases ***
34 Create All Controller Sessions
35     [Documentation]    Create sessions for all three controllers.
36     ClusterManagement.ClusterManagement Setup
37
38 Create Network net_1
39     [Documentation]    Create Network with neutron request.
40     OpenStackOperations.Create Network    ${NETWORKS}[0]
41
42 Create Subnet For net_1
43     [Documentation]    Create Sub Net for the Network with neutron request.
44     OpenStackOperations.Create SubNet    ${NETWORKS}[0]    ${SUBNETS}[0]    ${SUBNET_CIDRS}[0]
45
46 Create Network net_2
47     [Documentation]    Create Network with neutron request.
48     OpenStackOperations.Create Network    ${NETWORKS}[1]
49
50 Create Subnet For net_2
51     [Documentation]    Create Sub Net for the Network with neutron request.
52     OpenStackOperations.Create SubNet    ${NETWORKS}[1]    ${SUBNETS}[1]    ${SUBNET_CIDRS}[1]
53
54 Add Ssh Allow All Rule
55     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
56     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
57
58 Create Bridge Manually and Verify Before Fail
59     [Documentation]    Create bridge with OVS command and verify it gets applied from all instances.
60     ClusterOvsdb.Create Sample Bridge Manually And Verify    ${OS_CNTL_IP}
61
62 Add Tap Device Manually and Verify Before Fail
63     [Documentation]    Add tap devices to the bridge with OVS command and verify it gets applied from all instances.
64     ClusterOvsdb.Add Sample Tap Device To The Manual Bridge And Verify    ${OS_CNTL_IP}
65
66 Delete the Bridge Manually and Verify Before Fail
67     [Documentation]    Delete bridge with OVS command and verify it gets deleted from all instances.
68     ClusterOvsdb.Delete Sample Bridge Manually And Verify    ${OS_CNTL_IP}
69
70 Take Down ODL1
71     [Documentation]    Stop the karaf in First Controller
72     ${new_cluster_list} =    ClusterManagement.Stop Single Member    1    msg=up: ODL1, ODL2, ODL3, down=none
73     BuiltIn.Set Suite Variable    ${new_cluster_list}
74
75 Create Bridge Manually and Verify After Fail
76     [Documentation]    Create bridge with OVS command and verify it gets applied from all instances.
77     ClusterOvsdb.Create Sample Bridge Manually And Verify    ${OS_CNTL_IP}    ${new_cluster_list}
78
79 Add Tap Device Manually and Verify After Fail
80     [Documentation]    Add tap devices to the bridge with OVS command and verify it gets applied from all instances.
81     ClusterOvsdb.Add Sample Tap Device To The Manual Bridge And Verify    ${OS_CNTL_IP}    ${new_cluster_list}
82
83 Delete the Bridge Manually and Verify After Fail
84     [Documentation]    Delete bridge with OVS command and verify it gets deleted from all instances.
85     ClusterOvsdb.Delete Sample Bridge Manually And Verify    ${OS_CNTL_IP}    ${new_cluster_list}
86
87 Bring Up ODL1
88     [Documentation]    Bring up ODL1 again
89     ClusterManagement.Start Single Member    1    msg=up: ODL2, ODL3, down: ODL1
90
91 Create Bridge Manually and Verify After Recover
92     [Documentation]    Create bridge with OVS command and verify it gets applied from all instances.
93     ClusterOvsdb.Create Sample Bridge Manually And Verify    ${OS_CNTL_IP}
94
95 Add Tap Device Manually and Verify After Recover
96     [Documentation]    Add tap devices to the bridge with OVS command and verify it gets applied from all instances.
97     ClusterOvsdb.Add Sample Tap Device To The Manual Bridge And Verify    ${OS_CNTL_IP}
98
99 Delete the Bridge Manually and Verify After Recover
100     [Documentation]    Delete bridge with OVS command and verify it gets deleted from all instances.
101     ClusterOvsdb.Delete Sample Bridge Manually And Verify    ${OS_CNTL_IP}
102
103 Take Down ODL2
104     [Documentation]    Stop the karaf in Second Controller
105     ClusterManagement.Stop Single Member    2    msg=up: ODL1, ODL2, ODL3, down=none
106
107 Create Vm Instances For net_1
108     [Documentation]    Create Vm instances using flavor and image names for a network.
109     OpenStackOperations.Create Vm Instance On Compute Node
110     ...    ${NETWORKS}[0]
111     ...    ${NET_1_VMS}[0]
112     ...    ${OS_CMP1_HOSTNAME}
113     ...    sg=${SECURITY_GROUP}
114     OpenStackOperations.Create Vm Instance On Compute Node
115     ...    ${NETWORKS}[0]
116     ...    ${NET_1_VMS}[1]
117     ...    ${OS_CMP1_HOSTNAME}
118     ...    sg=${SECURITY_GROUP}
119     OpenStackOperations.Create Vm Instance On Compute Node
120     ...    ${NETWORKS}[0]
121     ...    ${NET_1_VMS}[2]
122     ...    ${OS_CMP2_HOSTNAME}
123     ...    sg=${SECURITY_GROUP}
124
125 Create Vm Instances For net_2
126     [Documentation]    Create Vm instances using flavor and image names for a network.
127     OpenStackOperations.Create Vm Instance On Compute Node
128     ...    ${NETWORKS}[1]
129     ...    ${NET_2_VMS}[0]
130     ...    ${OS_CMP1_HOSTNAME}
131     ...    sg=${SECURITY_GROUP}
132     OpenStackOperations.Create Vm Instance On Compute Node
133     ...    ${NETWORKS}[1]
134     ...    ${NET_2_VMS}[1]
135     ...    ${OS_CMP2_HOSTNAME}
136     ...    sg=${SECURITY_GROUP}
137     OpenStackOperations.Create Vm Instance On Compute Node
138     ...    ${NETWORKS}[1]
139     ...    ${NET_2_VMS}[2]
140     ...    ${OS_CMP2_HOSTNAME}
141     ...    sg=${SECURITY_GROUP}
142
143 Check Vm Instances Have Ip Address
144     @{NET_1_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
145     @{NET_2_VM_IPS}    ${NET_2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
146     BuiltIn.Set Suite Variable    @{NET_1_VM_IPS}
147     BuiltIn.Set Suite Variable    @{NET_2_VM_IPS}
148     BuiltIn.Should Not Contain    ${NET_1_VM_IPS}    None
149     BuiltIn.Should Not Contain    ${NET_2_VM_IPS}    None
150     BuiltIn.Should Not Contain    ${NET_1_DHCP_IP}    None
151     BuiltIn.Should Not Contain    ${NET_2_DHCP_IP}    None
152     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
153     ...    AND    OpenStackOperations.Get Test Teardown Debugs
154
155 Bring Up ODL2
156     [Documentation]    Bring up ODL2 again
157     ClusterManagement.Start Single Member    2    msg=up: ODL1, ODL3, down: ODL2
158
159 Ping Vm Instance1 In net_1
160     [Documentation]    Check reachability of vm instances by pinging to them.
161     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[0]    ${NET_1_VM_IPS}[0]
162
163 Ping Vm Instance2 In net_1
164     [Documentation]    Check reachability of vm instances by pinging to them.
165     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[0]    ${NET_1_VM_IPS}[1]
166
167 Ping Vm Instance3 In net_1
168     [Documentation]    Check reachability of vm instances by pinging to them.
169     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[0]    ${NET_1_VM_IPS}[2]
170
171 Ping Vm Instance1 In net_2
172     [Documentation]    Check reachability of vm instances by pinging to them.
173     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[1]    ${NET_2_VM_IPS}[0]
174
175 Ping Vm Instance2 In net_2
176     [Documentation]    Check reachability of vm instances by pinging to them.
177     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[1]    ${NET_2_VM_IPS}[1]
178
179 Ping Vm Instance3 In net_2
180     [Documentation]    Check reachability of vm instances by pinging to them.
181     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[1]    ${NET_2_VM_IPS}[2]
182
183 Take Down ODL3
184     [Documentation]    Stop the karaf in Third Controller
185     ClusterManagement.Stop Single Member    3    msg=up: ODL1, ODL2, ODL3, down=none
186
187 Connectivity Tests From Vm Instance1 In net_1
188     [Documentation]    Logging to the vm instance using generated key pair.
189     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[0]    ${NET_1_VM_IPS}[0]    ${NET_1_VM_IPS}
190
191 Connectivity Tests From Vm Instance2 In net_1
192     [Documentation]    Logging to the vm instance using generated key pair.
193     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[0]    ${NET_1_VM_IPS}[1]    ${NET_1_VM_IPS}
194
195 Connectivity Tests From Vm Instance3 In net_1
196     [Documentation]    Logging to the vm instance using generated key pair.
197     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[0]    ${NET_1_VM_IPS}[2]    ${NET_1_VM_IPS}
198
199 Bring Up ODL3
200     [Documentation]    Bring up ODL3 again
201     ClusterManagement.Start Single Member    3    msg=up: ODL1, ODL2, down: ODL3
202
203 Connectivity Tests From Vm Instance1 In net_2 In Healthy Cluster
204     [Documentation]    Logging to the vm instance using generated key pair.
205     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[1]    ${NET_2_VM_IPS}[0]    ${NET_2_VM_IPS}
206
207 Connectivity Tests From Vm Instance2 In net_2 In Healthy Cluster
208     [Documentation]    Logging to the vm instance using generated key pair.
209     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[1]    ${NET_2_VM_IPS}[1]    ${NET_2_VM_IPS}
210
211 Connectivity Tests From Vm Instance3 In net_2 In Healthy Cluster
212     [Documentation]    Logging to the vm instance using generated key pair.
213     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[1]    ${NET_2_VM_IPS}[2]    ${NET_2_VM_IPS}
214
215 Take Down ODL1 and ODL2
216     [Documentation]    Stop the karaf in First and Second Controller
217     BuiltIn.Run Keyword And Ignore Error
218     ...    ClusterManagement.Stop Single Member
219     ...    1
220     ...    msg=up: ODL1, ODL2, ODL3, down=none
221     BuiltIn.Run Keyword And Ignore Error    ClusterManagement.Stop Single Member    2    msg=up: ODL2, ODL3, down=ODL1
222
223 Connectivity Tests From Vm Instance1 In net_2 With Two ODLs Down
224     [Documentation]    Logging to the vm instance using generated key pair.
225     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[1]    ${NET_2_VM_IPS}[0]    ${NET_2_VM_IPS}
226
227 Connectivity Tests From Vm Instance2 In net_2 With Two ODLs Down
228     [Documentation]    Logging to the vm instance using generated key pair.
229     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[1]    ${NET_2_VM_IPS}[1]    ${NET_2_VM_IPS}
230
231 Connectivity Tests From Vm Instance3 In net_2 With Two ODLs Down
232     [Documentation]    Logging to the vm instance using generated key pair.
233     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[1]    ${NET_2_VM_IPS}[2]    ${NET_2_VM_IPS}
234
235 Bring Up ODL1 and ODL2
236     [Documentation]    Bring up ODL1 and ODL2 again. Do not check for cluster sync until all nodes are
237     ...    up. akka will not let nodes join until they are all back up if two were down.
238     ClusterManagement.Start Single Member    1    msg=up: ODL3, down: ODL1, ODL2    wait_for_sync=False
239     ClusterManagement.Start Single Member    2    msg=up: ODL1, ODL3, down: ODL2
240
241 Delete Vm Instance
242     [Documentation]    Delete Vm instances using instance names. Also remove the VM from the
243     ...    list so that later cleanup will not try to delete it.
244     OpenStackOperations.Delete Vm Instance    ${NET_1_VMS}[0]
245     Remove From List    ${NET_1_VMS}    0
246
247 No Ping For Deleted Vm
248     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
249     ${output} =    OpenStackOperations.Ping From DHCP Should Not Succeed    ${NETWORKS}[0]    ${NET_1_VM_IPS}[0]
250
251 Delete Vm Instances In net_1
252     [Documentation]    Delete Vm instances using instance names in network_1.
253     FOR    ${vm}    IN    @{NET_1_VMS}
254         OpenStackOperations.Delete Vm Instance    ${vm}
255     END
256
257 Delete Vm Instances In net_2
258     [Documentation]    Delete Vm instances using instance names in network_2.
259     FOR    ${vm}    IN    @{NET_2_VMS}
260         OpenStackOperations.Delete Vm Instance    ${vm}
261     END
262
263 Delete Sub Networks In net_1
264     [Documentation]    Delete Sub Nets for the Networks with neutron request.
265     OpenStackOperations.Delete SubNet    ${SUBNETS}[0]
266
267 Delete Sub Networks In net_2
268     [Documentation]    Delete Sub Nets for the Networks with neutron request.
269     OpenStackOperations.Delete SubNet    ${SUBNETS}[1]
270
271 Delete Networks
272     [Documentation]    Delete Networks with neutron request.
273     FOR    ${network}    IN    @{NETWORKS}
274         OpenStackOperations.Delete Network    ${network}
275     END
276
277 Delete Security Group
278     [Documentation]    Delete security groups with neutron request
279     OpenStackOperations.Delete SecurityGroup    ${SECURITY_GROUP}
280
281 Verify Flows Cleanup
282     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
283     DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes