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