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