8f72f38750d1a11f59007c84ddb124929ca391b5
[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    Close All Connections
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 Variables         ../../../variables/Variables.py
19
20 *** Variables ***
21 ${SECURITY_GROUP}    cl2_sg
22 @{NETWORKS}       cl2_net_1    cl2_net_2
23 @{SUBNETS}        cl2_sub_1    cl2_sub_2
24 @{NET_1_VMS}      cl2_net_1_vm_1    cl2_net_1_vm_2    cl2_net_1_vm_3
25 @{NET_2_VMS}      cl2_net_2_vm_1    cl2_net_2_vm_2    cl2_net_2_vm_3
26 @{SUBNET_CIDRS}    26.0.0.0/24    27.0.0.0/24
27 @{CLUSTER_DOWN_LIST}    ${1}    ${2}
28
29 *** Test Cases ***
30 Create All Controller Sessions
31     [Documentation]    Create sessions for all three contorllers.
32     ClusterManagement.ClusterManagement Setup
33
34 Create Network net_1
35     [Documentation]    Create Network with neutron request.
36     OpenStackOperations.Create Network    @{NETWORKS}[0]
37
38 Create Subnet For net_1
39     [Documentation]    Create Sub Net for the Network with neutron request.
40     OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS}[0]    @{SUBNET_CIDRS}[0]
41
42 Create Network net_2
43     [Documentation]    Create Network with neutron request.
44     OpenStackOperations.Create Network    @{NETWORKS}[1]
45
46 Create Subnet For net_2
47     [Documentation]    Create Sub Net for the Network with neutron request.
48     OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS}[1]    @{SUBNET_CIDRS}[1]
49
50 Add Ssh Allow All Rule
51     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
52     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
53
54 Create Bridge Manually and Verify Before Fail
55     [Documentation]    Create bridge with OVS command and verify it gets applied from all instances.
56     ClusterOvsdb.Create Sample Bridge Manually And Verify    ${OS_CONTROL_NODE_IP}
57
58 Add Tap Device Manually and Verify Before Fail
59     [Documentation]    Add tap devices to the bridge with OVS command and verify it gets applied from all instances.
60     ClusterOvsdb.Add Sample Tap Device To The Manual Bridge And Verify    ${OS_CONTROL_NODE_IP}
61
62 Delete the Bridge Manually and Verify Before Fail
63     [Documentation]    Delete bridge with OVS command and verify it gets deleted from all instances.
64     ClusterOvsdb.Delete Sample Bridge Manually And Verify    ${OS_CONTROL_NODE_IP}
65
66 Take Down ODL1
67     [Documentation]    Kill the karaf in First Controller
68     ${new_cluster_list} =    ClusterManagement.Kill Single Member    1
69     BuiltIn.Set Suite Variable    ${new_cluster_list}
70
71 Create Bridge Manually and Verify After Fail
72     [Documentation]    Create bridge with OVS command and verify it gets applied from all instances.
73     ClusterOvsdb.Create Sample Bridge Manually And Verify    ${OS_CONTROL_NODE_IP}    ${new_cluster_list}
74
75 Add Tap Device Manually and Verify After Fail
76     [Documentation]    Add tap devices to the bridge with OVS command and verify it gets applied from all instances.
77     ClusterOvsdb.Add Sample Tap Device To The Manual Bridge And Verify    ${OS_CONTROL_NODE_IP}    ${new_cluster_list}
78
79 Delete the Bridge Manually and Verify After Fail
80     [Documentation]    Delete bridge with OVS command and verify it gets deleted from all instances.
81     ClusterOvsdb.Delete Sample Bridge Manually And Verify    ${OS_CONTROL_NODE_IP}    ${new_cluster_list}
82
83 Bring Up ODL1
84     [Documentation]    Bring up ODL1 again
85     ClusterManagement.Start Single Member    1
86
87 Create Bridge Manually and Verify After Recover
88     [Documentation]    Create bridge with OVS command and verify it gets applied from all instances.
89     ClusterOvsdb.Create Sample Bridge Manually And Verify    ${OS_CONTROL_NODE_IP}
90
91 Add Tap Device Manually and Verify After Recover
92     [Documentation]    Add tap devices to the bridge with OVS command and verify it gets applied from all instances.
93     ClusterOvsdb.Add Sample Tap Device To The Manual Bridge And Verify    ${OS_CONTROL_NODE_IP}
94
95 Delete the Bridge Manually and Verify After Recover
96     [Documentation]    Delete bridge with OVS command and verify it gets deleted from all instances.
97     ClusterOvsdb.Delete Sample Bridge Manually And Verify    ${OS_CONTROL_NODE_IP}
98
99 Take Down ODL2
100     [Documentation]    Kill the karaf in Second Controller
101     ClusterManagement.Kill Single Member    2
102
103 Create Vm Instances For net_1
104     [Documentation]    Create Vm instances using flavor and image names for a network.
105     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
106     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[1]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
107     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
108
109 Create Vm Instances For net_2
110     [Documentation]    Create Vm instances using flavor and image names for a network.
111     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
112     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[1]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
113     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
114
115 Check Vm Instances Have Ip Address
116     @{NET_1_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
117     @{NET_2_VM_IPS}    ${NET_2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
118     BuiltIn.Set Suite Variable    @{NET_1_VM_IPS}
119     BuiltIn.Set Suite Variable    @{NET_2_VM_IPS}
120     BuiltIn.Should Not Contain    ${NET_1_VM_IPS}    None
121     BuiltIn.Should Not Contain    ${NET_2_VM_IPS}    None
122     BuiltIn.Should Not Contain    ${NET_1_DHCP_IP}    None
123     BuiltIn.Should Not Contain    ${NET_2_DHCP_IP}    None
124     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
125     ...    AND    OpenStackOperations.Get Test Teardown Debugs
126
127 Bring Up ODL2
128     [Documentation]    Bring up ODL2 again
129     ClusterManagement.Start Single Member    2
130
131 Ping Vm Instance1 In net_1
132     [Documentation]    Check reachability of vm instances by pinging to them.
133     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]
134
135 Ping Vm Instance2 In net_1
136     [Documentation]    Check reachability of vm instances by pinging to them.
137     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_1_VM_IPS}[1]
138
139 Ping Vm Instance3 In net_1
140     [Documentation]    Check reachability of vm instances by pinging to them.
141     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_1_VM_IPS}[2]
142
143 Ping Vm Instance1 In net_2
144     [Documentation]    Check reachability of vm instances by pinging to them.
145     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_2_VM_IPS}[0]
146
147 Ping Vm Instance2 In net_2
148     [Documentation]    Check reachability of vm instances by pinging to them.
149     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_2_VM_IPS}[1]
150
151 Ping Vm Instance3 In net_2
152     [Documentation]    Check reachability of vm instances by pinging to them.
153     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_2_VM_IPS}[2]
154
155 Take Down ODL3
156     [Documentation]    Kill the karaf in Third Controller
157     ClusterManagement.Kill Single Member    3
158
159 Connectivity Tests From Vm Instance1 In net_1
160     [Documentation]    Logging to the vm instance using generated key pair.
161     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]    ${NET_1_VM_IPS}
162
163 Connectivity Tests From Vm Instance2 In net_1
164     [Documentation]    Logging to the vm instance using generated key pair.
165     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[1]    ${NET_1_VM_IPS}
166
167 Connectivity Tests From Vm Instance3 In net_1
168     [Documentation]    Logging to the vm instance using generated key pair.
169     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[2]    ${NET_1_VM_IPS}
170
171 Bring Up ODL3
172     [Documentation]    Bring up ODL3 again
173     ClusterManagement.Start Single Member    3
174
175 Take Down ODL1 and ODL2
176     [Documentation]    Kill the karaf in First and Second Controller
177     ClusterManagement.Kill Members From List Or All    ${CLUSTER_DOWN_LIST}
178
179 Connectivity Tests From Vm Instance1 In net_2
180     [Documentation]    Logging to the vm instance using generated key pair.
181     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[0]    ${NET_2_VM_IPS}
182
183 Connectivity Tests From Vm Instance2 In net_2
184     [Documentation]    Logging to the vm instance using generated key pair.
185     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[1]    ${NET_2_VM_IPS}
186
187 Connectivity Tests From Vm Instance3 In net_2
188     [Documentation]    Logging to the vm instance using generated key pair.
189     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[2]    ${NET_2_VM_IPS}
190
191 Bring Up ODL1 and ODL2
192     [Documentation]    Bring up ODL1 and ODL2 again.
193     ClusterManagement.Start Members From List Or All    ${CLUSTER_DOWN_LIST}
194
195 Delete Vm Instance
196     [Documentation]    Delete Vm instances using instance names.
197     OpenStackOperations.Delete Vm Instance    @{NET_1_VMS}[0]
198
199 No Ping For Deleted Vm
200     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
201     ${output} =    OpenStackOperations.Ping From DHCP Should Not Succeed    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]
202
203 Delete Vm Instances In net_1
204     [Documentation]    Delete Vm instances using instance names in network_1.
205     : FOR    ${vm}    IN    @{NET_1_VMS}
206     \    OpenStackOperations.Delete Vm Instance    ${vm}
207
208 Delete Vm Instances In net_2
209     [Documentation]    Delete Vm instances using instance names in network_2.
210     : FOR    ${vm}    IN    @{NET_2_VMS}
211     \    OpenStackOperations.Delete Vm Instance    ${vm}
212
213 Delete Sub Networks In net_1
214     [Documentation]    Delete Sub Nets for the Networks with neutron request.
215     OpenStackOperations.Delete SubNet    @{SUBNETS}[0]
216
217 Delete Sub Networks In net_2
218     [Documentation]    Delete Sub Nets for the Networks with neutron request.
219     OpenStackOperations.Delete SubNet    @{SUBNETS}[1]
220
221 Delete Networks
222     [Documentation]    Delete Networks with neutron request.
223     : FOR    ${network}    IN    @{NETWORKS}
224     \    OpenStackOperations.Delete Network    ${network}
225
226 Delete Security Group
227     [Documentation]    Delete security groups with neutron request
228     OpenStackOperations.Delete SecurityGroup    ${SECURITY_GROUP}
229
230 Verify Flows Cleanup
231     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
232     DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes