Update remaining tests for combos
[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 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]    Kill the karaf in First Controller
69     ${new_cluster_list} =    ClusterManagement.Kill Single Member    1
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    member=1    check_system_status=True    service_list=@{NETVIRT_DIAG_SERVICES}
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]    Kill the karaf in Second Controller
102     ClusterManagement.Kill Single Member    2
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    member=2    check_system_status=True    service_list=@{NETVIRT_DIAG_SERVICES}
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]    Kill the karaf in Third Controller
158     ClusterManagement.Kill Single Member    3
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    member=3    check_system_status=True    service_list=@{NETVIRT_DIAG_SERVICES}
175
176 Take Down ODL1 and ODL2
177     [Documentation]    Kill the karaf in First and Second Controller
178     ClusterManagement.Kill Members From List Or All    ${CLUSTER_DOWN_LIST}
179
180 Connectivity Tests From Vm Instance1 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}[0]    ${NET_2_VM_IPS}
183
184 Connectivity Tests From Vm Instance2 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}[1]    ${NET_2_VM_IPS}
187
188 Connectivity Tests From Vm Instance3 In net_2
189     [Documentation]    Logging to the vm instance using generated key pair.
190     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[2]    ${NET_2_VM_IPS}
191
192 Bring Up ODL1 and ODL2
193     [Documentation]    Bring up ODL1 and ODL2 again.
194     ClusterManagement.Start Members From List Or All    member_index_list=${CLUSTER_DOWN_LIST}    check_system_status=True    service_list=@{NETVIRT_DIAG_SERVICES}
195
196 Delete Vm Instance
197     [Documentation]    Delete Vm instances using instance names. Also remove the VM from the
198     ...    list so that later cleanup will not try to delete it.
199     OpenStackOperations.Delete Vm Instance    @{NET_1_VMS}[0]
200     Remove From List    ${NET_1_VMS}    0
201
202 No Ping For Deleted Vm
203     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
204     ${output} =    OpenStackOperations.Ping From DHCP Should Not Succeed    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]
205
206 Delete Vm Instances In net_1
207     [Documentation]    Delete Vm instances using instance names in network_1.
208     : FOR    ${vm}    IN    @{NET_1_VMS}
209     \    OpenStackOperations.Delete Vm Instance    ${vm}
210
211 Delete Vm Instances In net_2
212     [Documentation]    Delete Vm instances using instance names in network_2.
213     : FOR    ${vm}    IN    @{NET_2_VMS}
214     \    OpenStackOperations.Delete Vm Instance    ${vm}
215
216 Delete Sub Networks In net_1
217     [Documentation]    Delete Sub Nets for the Networks with neutron request.
218     OpenStackOperations.Delete SubNet    @{SUBNETS}[0]
219
220 Delete Sub Networks In net_2
221     [Documentation]    Delete Sub Nets for the Networks with neutron request.
222     OpenStackOperations.Delete SubNet    @{SUBNETS}[1]
223
224 Delete Networks
225     [Documentation]    Delete Networks with neutron request.
226     : FOR    ${network}    IN    @{NETWORKS}
227     \    OpenStackOperations.Delete Network    ${network}
228
229 Delete Security Group
230     [Documentation]    Delete security groups with neutron request
231     OpenStackOperations.Delete SecurityGroup    ${SECURITY_GROUP}
232
233 Verify Flows Cleanup
234     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
235     DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes