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