42520124dada7a7b6961444d6f323f09aacb06b3
[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 Instances    @{NETWORKS}[0]    ${NET_1_VMS}    sg=${SECURITY_GROUP}
106
107 Create Vm Instances For net_2
108     [Documentation]    Create Vm instances using flavor and image names for a network.
109     OpenStackOperations.Create Vm Instances    @{NETWORKS}[1]    ${NET_2_VMS}    sg=${SECURITY_GROUP}
110
111 Check Vm Instances Have Ip Address
112     @{NET_1_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
113     @{NET_2_VM_IPS}    ${NET_2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
114     BuiltIn.Set Suite Variable    @{NET_1_VM_IPS}
115     BuiltIn.Set Suite Variable    @{NET_2_VM_IPS}
116     BuiltIn.Should Not Contain    ${NET_1_VM_IPS}    None
117     BuiltIn.Should Not Contain    ${NET_2_VM_IPS}    None
118     BuiltIn.Should Not Contain    ${NET_1_DHCP_IP}    None
119     BuiltIn.Should Not Contain    ${NET_2_DHCP_IP}    None
120     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
121     ...    AND    OpenStackOperations.Get Test Teardown Debugs
122
123 Bring Up ODL2
124     [Documentation]    Bring up ODL2 again
125     ClusterManagement.Start Single Member    2
126
127 Ping Vm Instance1 In net_1
128     [Documentation]    Check reachability of vm instances by pinging to them.
129     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]
130
131 Ping Vm Instance2 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}[1]
134
135 Ping Vm Instance3 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}[2]
138
139 Ping Vm Instance1 In net_2
140     [Documentation]    Check reachability of vm instances by pinging to them.
141     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_2_VM_IPS}[0]
142
143 Ping Vm Instance2 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}[1]
146
147 Ping Vm Instance3 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}[2]
150
151 Take Down ODL3
152     [Documentation]    Kill the karaf in Third Controller
153     ClusterManagement.Kill Single Member    3
154
155 Connectivity Tests From Vm Instance1 In net_1
156     [Documentation]    Logging to the vm instance using generated key pair.
157     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]    ${NET_1_VM_IPS}
158
159 Connectivity Tests From Vm Instance2 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}[1]    ${NET_1_VM_IPS}
162
163 Connectivity Tests From Vm Instance3 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}[2]    ${NET_1_VM_IPS}
166
167 Bring Up ODL3
168     [Documentation]    Bring up ODL3 again
169     ClusterManagement.Start Single Member    3
170
171 Take Down ODL1 and ODL2
172     [Documentation]    Kill the karaf in First and Second Controller
173     ClusterManagement.Kill Members From List Or All    ${CLUSTER_DOWN_LIST}
174
175 Connectivity Tests From Vm Instance1 In net_2
176     [Documentation]    Logging to the vm instance using generated key pair.
177     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[0]    ${NET_2_VM_IPS}
178
179 Connectivity Tests From Vm Instance2 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}[1]    ${NET_2_VM_IPS}
182
183 Connectivity Tests From Vm Instance3 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}[2]    ${NET_2_VM_IPS}
186
187 Bring Up ODL1 and ODL2
188     [Documentation]    Bring up ODL1 and ODL2 again.
189     ClusterManagement.Start Members From List Or All    ${CLUSTER_DOWN_LIST}
190
191 Delete Vm Instance
192     [Documentation]    Delete Vm instances using instance names.
193     OpenStackOperations.Delete Vm Instance    @{NET_1_VMS}[0]
194
195 No Ping For Deleted Vm
196     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
197     ${output} =    OpenStackOperations.Ping From DHCP Should Not Succeed    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]
198
199 Delete Vm Instances In net_1
200     [Documentation]    Delete Vm instances using instance names in network_1.
201     : FOR    ${vm}    IN    @{NET_1_VMS}
202     \    OpenStackOperations.Delete Vm Instance    ${vm}
203
204 Delete Vm Instances In net_2
205     [Documentation]    Delete Vm instances using instance names in network_2.
206     : FOR    ${vm}    IN    @{NET_2_VMS}
207     \    OpenStackOperations.Delete Vm Instance    ${vm}
208
209 Delete Sub Networks In net_1
210     [Documentation]    Delete Sub Nets for the Networks with neutron request.
211     OpenStackOperations.Delete SubNet    @{SUBNETS}[0]
212
213 Delete Sub Networks In net_2
214     [Documentation]    Delete Sub Nets for the Networks with neutron request.
215     OpenStackOperations.Delete SubNet    @{SUBNETS}[1]
216
217 Delete Networks
218     [Documentation]    Delete Networks with neutron request.
219     : FOR    ${network}    IN    @{NETWORKS}
220     \    OpenStackOperations.Delete Network    ${network}
221
222 Delete Security Group
223     [Documentation]    Delete security groups with neutron request
224     OpenStackOperations.Delete SecurityGroup    ${SECURITY_GROUP}
225
226 Verify Flows Cleanup
227     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
228     DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes