Update Robot Framework format - step 13
[integration/test.git] / csit / suites / openstack / clustering / ha_l3_block_port.robot
1 *** Settings ***
2 Documentation       Test suite to check connectivity while disrupting connection between cluster nodes
3
4 Library             SSHLibrary
5 Library             OperatingSystem
6 Library             RequestsLibrary
7 Library             Collections
8 Resource            ../../../libraries/Utils.robot
9 Resource            ../../../libraries/OpenStackOperations.robot
10 Resource            ../../../libraries/DevstackUtils.robot
11 Resource            ../../../libraries/OVSDB.robot
12 Resource            ../../../libraries/ClusterOvsdb.robot
13 Resource            ../../../libraries/ClusterManagement.robot
14 Resource            ../../../libraries/SetupUtils.robot
15 Resource            ../../../variables/Variables.robot
16
17 Suite Setup         OpenStackOperations.OpenStack Suite Setup
18 Suite Teardown      Close All Connections
19 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
20 Test Teardown       OpenStackOperations.Get Test Teardown Debugs
21
22
23 *** Variables ***
24 ${SECURITY_GROUP}       cl3_bp_sg
25 @{NETWORKS}             cl3_bp_net_1    cl3_bp_net_2
26 @{SUBNETS}              cl3_bp_sub_1    cl3_bp_sub_2
27 @{ROUTERS}              cl3_bp_router_1    cl3_bp_router_2    cl3_bp_router_3
28 @{NET_1_VMS}            cl3_bp_net_1_vm_1    cl3_bp_net_1_vm_2    cl3_bp_net_1_vm_3
29 @{NET_2_VMS}            cl3_bp_net_2_vm_1    cl3_bp_net_2_vm_2    cl3_bp_net_2_vm_3
30 @{SUBNET_CIDRS}         38.0.0.0/24    39.0.0.0/24
31 @{GATEWAY_IPS}          38.0.0.1    39.0.0.1
32
33
34 *** Test Cases ***
35 Create All Controller Sessions
36     [Documentation]    Create sessions for all three controllers.
37     ClusterManagement.ClusterManagement Setup
38
39 Create Networks
40     [Documentation]    Create Network with neutron request.
41     FOR    ${network}    IN    @{NETWORKS}
42         OpenStackOperations.Create Network    ${network}
43     END
44
45 Create Subnets For net_1
46     [Documentation]    Create Sub Nets for the Networks with neutron request.
47     OpenStackOperations.Create SubNet    ${NETWORKS}[0]    ${SUBNETS}[0]    ${SUBNET_CIDRS}[0]
48
49 Create Subnets For net_2
50     [Documentation]    Create Sub Nets for the Networks with neutron request.
51     OpenStackOperations.Create SubNet    ${NETWORKS}[1]    ${SUBNETS}[1]    ${SUBNET_CIDRS}[1]
52
53 Add Ssh Allow All Rule
54     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
55     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
56
57 Block Port On ODL1
58     [Documentation]    Block connection on first controller
59     ClusterManagement.Isolate_Member_From_List_Or_All    ${1}    protocol=tcp    port=${ODL_AKKA_PORT}
60
61 Create Vm Instances For net_1
62     [Documentation]    Create Vm instances using flavor and image names for a network.
63     OpenStackOperations.Create Vm Instance On Compute Node
64     ...    ${NETWORKS}[0]
65     ...    ${NET_1_VMS}[0]
66     ...    ${OS_CMP1_HOSTNAME}
67     ...    sg=${SECURITY_GROUP}
68     OpenStackOperations.Create Vm Instance On Compute Node
69     ...    ${NETWORKS}[0]
70     ...    ${NET_1_VMS}[1]
71     ...    ${OS_CMP1_HOSTNAME}
72     ...    sg=${SECURITY_GROUP}
73     OpenStackOperations.Create Vm Instance On Compute Node
74     ...    ${NETWORKS}[0]
75     ...    ${NET_1_VMS}[2]
76     ...    ${OS_CMP2_HOSTNAME}
77     ...    sg=${SECURITY_GROUP}
78
79 Allow Port On ODL1
80     [Documentation]    Allow connection on first controller
81     ClusterManagement.Rejoin_Member_From_List_Or_All    ${1}    protocol=tcp    port=${ODL_AKKA_PORT}
82
83 Block Port On ODL2
84     [Documentation]    Block connection on second controller
85     ClusterManagement.Isolate_Member_From_List_Or_All    ${2}    protocol=tcp    port=${ODL_AKKA_PORT}
86
87 Create Vm Instances For net_2
88     [Documentation]    Create Vm instances using flavor and image names for a network.
89     OpenStackOperations.Create Vm Instance On Compute Node
90     ...    ${NETWORKS}[1]
91     ...    ${NET_2_VMS}[0]
92     ...    ${OS_CMP1_HOSTNAME}
93     ...    sg=${SECURITY_GROUP}
94     OpenStackOperations.Create Vm Instance On Compute Node
95     ...    ${NETWORKS}[1]
96     ...    ${NET_2_VMS}[1]
97     ...    ${OS_CMP2_HOSTNAME}
98     ...    sg=${SECURITY_GROUP}
99     OpenStackOperations.Create Vm Instance On Compute Node
100     ...    ${NETWORKS}[1]
101     ...    ${NET_2_VMS}[2]
102     ...    ${OS_CMP2_HOSTNAME}
103     ...    sg=${SECURITY_GROUP}
104
105 Check Vm Instances Have Ip Address
106     @{NET_1_L3_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
107     @{NET_2_L3_VM_IPS}    ${NET_2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
108     BuiltIn.Set Suite Variable    @{NET_1_L3_VM_IPS}
109     BuiltIn.Set Suite Variable    @{NET_2_L3_VM_IPS}
110     BuiltIn.Should Not Contain    ${NET_1_L3_VM_IPS}    None
111     BuiltIn.Should Not Contain    ${NET_2_L3_VM_IPS}    None
112     BuiltIn.Should Not Contain    ${NET_1_DHCP_IP}    None
113     BuiltIn.Should Not Contain    ${NET_2_DHCP_IP}    None
114     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
115     ...    AND    OpenStackOperations.Get Test Teardown Debugs
116
117 Allow Port On ODL2
118     [Documentation]    Allow connection on second controller
119     ClusterManagement.Rejoin_Member_From_List_Or_All    ${2}    protocol=tcp    port=${ODL_AKKA_PORT}
120
121 Block Port On ODL3
122     [Documentation]    Block connection on third controller
123     ClusterManagement.Isolate_Member_From_List_Or_All    ${3}    protocol=tcp    port=${ODL_AKKA_PORT}
124
125 Create Router router_2
126     [Documentation]    Create Router and Add Interface to the subnets.
127     OpenStackOperations.Create Router    ${ROUTERS}[1]
128     [Teardown]    Report_Failure_Due_To_Bug    6117
129
130 Create Router router_3
131     [Documentation]    Create Router and Add Interface to the subnets.
132     OpenStackOperations.Create Router    ${ROUTERS}[2]
133
134 Add Interfaces To Router
135     [Documentation]    Add Interfaces
136     FOR    ${interface}    IN    @{SUBNETS}
137         OpenStackOperations.Add Router Interface    ${ROUTERS}[2]    ${interface}
138     END
139
140 Verify Created Routers
141     [Documentation]    Check created routers using northbound rest calls
142     ${data} =    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
143     BuiltIn.Log    ${data}
144     Should Contain    ${data}    ${ROUTERS}[2]
145
146 Allow Port On ODL3
147     [Documentation]    Allow connection on third controller
148     ClusterManagement.Rejoin_Member_From_List_Or_All    ${3}    protocol=tcp    port=${ODL_AKKA_PORT}
149
150 Ping Vm Instance1 In net_2 From net_1
151     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
152     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[0]    ${NET_2_L3_VM_IPS}[0]
153
154 Ping Vm Instance2 In net_2 From net_1
155     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
156     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[0]    ${NET_2_L3_VM_IPS}[1]
157
158 Ping Vm Instance3 In net_2 From net_1
159     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
160     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[0]    ${NET_2_L3_VM_IPS}[2]
161
162 Ping Vm Instance1 In net_1 From net_2
163     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
164     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[1]    ${NET_1_L3_VM_IPS}[0]
165
166 Ping Vm Instance2 In net_1 From net_2
167     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
168     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[1]    ${NET_1_L3_VM_IPS}[1]
169
170 Ping Vm Instance3 In net_1 From net_2
171     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
172     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[1]    ${NET_1_L3_VM_IPS}[2]
173
174 Block Port On ODL1 Again
175     [Documentation]    Block connection on first controller the second time
176     ClusterManagement.Isolate_Member_From_List_Or_All    ${1}    protocol=tcp    port=${ODL_AKKA_PORT}
177     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
178
179 Block Port On ODL2 Again
180     [Documentation]    Block connection on second controller the second time
181     ClusterManagement.Isolate_Member_From_List_Or_All    ${2}    protocol=tcp    port=${ODL_AKKA_PORT}
182     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
183
184 Connectivity Tests From Vm Instance1 In net_1
185     [Documentation]    ssh to the VM instance and test operations.
186     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
187     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[0]    ${NET_1_L3_VM_IPS}[0]    ${dst_list}
188     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
189
190 Connectivity Tests From Vm Instance2 In net_1
191     [Documentation]    ssh to the VM instance and test operations.
192     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
193     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[0]    ${NET_1_L3_VM_IPS}[1]    ${dst_list}
194     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
195
196 Connectivity Tests From Vm Instance3 In net_1
197     [Documentation]    ssh to the VM instance and test operations.
198     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
199     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[0]    ${NET_1_L3_VM_IPS}[2]    ${dst_list}
200     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
201
202 Allow Port On ODL1 Again
203     [Documentation]    Allow connection on first controller the second time
204     BuiltIn.Run_Keyword_And_Ignore_Error
205     ...    ClusterManagement.Rejoin_Member_From_List_Or_All
206     ...    ${1}
207     ...    protocol=tcp
208     ...    port=${ODL_AKKA_PORT}
209
210 Allow Port On ODL2 Again
211     [Documentation]    Allow connection on the second controller the second time
212     ClusterManagement.Rejoin_Member_From_List_Or_All    ${2}    protocol=tcp    port=${ODL_AKKA_PORT}
213
214 Block Port On ODL2 Finally
215     [Documentation]    Block connection on second controller for the last time
216     ClusterManagement.Isolate_Member_From_List_Or_All    ${2}    protocol=tcp    port=${ODL_AKKA_PORT}
217     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
218
219 Block Port On ODL3 Again
220     [Documentation]    Block connection on the third controller for the second time
221     ClusterManagement.Isolate_Member_From_List_Or_All    ${3}    protocol=tcp    port=${ODL_AKKA_PORT}
222     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
223
224 Connectivity Tests From Vm Instance1 In net_2
225     [Documentation]    ssh to the VM instance and test operations.
226     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
227     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[1]    ${NET_2_L3_VM_IPS}[0]    ${dst_list}
228     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
229
230 Connectivity Tests From Vm Instance2 In net_2
231     [Documentation]    ssh to the VM instance and test operations.
232     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
233     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[1]    ${NET_2_L3_VM_IPS}[1]    ${dst_list}
234     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
235
236 Connectivity Tests From Vm Instance3 In net_2
237     [Documentation]    ssh to the VM instance and test operations.
238     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
239     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[1]    ${NET_2_L3_VM_IPS}[2]    ${dst_list}
240     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
241
242 Allow Port On ODL2 Finally
243     [Documentation]    Allow connection on second controller for the last time
244     BuiltIn.Run_Keyword_And_Ignore_Error
245     ...    ClusterManagement.Rejoin_Member_From_List_Or_All
246     ...    ${2}
247     ...    protocol=tcp
248     ...    port=${ODL_AKKA_PORT}
249
250 Allow Port On ODL3 Again
251     [Documentation]    Allow connection on the third controller for the second time
252     ClusterManagement.Rejoin_Member_From_List_Or_All    ${3}    protocol=tcp    port=${ODL_AKKA_PORT}
253
254 Delete Vm Instances In net_1
255     [Documentation]    Delete Vm instances using instance names in net_1.
256     FOR    ${vm}    IN    @{NET_1_VMS}
257         OpenStackOperations.Delete Vm Instance    ${vm}
258     END
259
260 Delete Vm Instances In net_2
261     [Documentation]    Delete Vm instances using instance names in net_2.
262     FOR    ${vm}    IN    @{NET_2_VMS}
263         OpenStackOperations.Delete Vm Instance    ${vm}
264     END
265
266 Delete Router Interfaces
267     [Documentation]    Remove Interface to the subnets.
268     FOR    ${interface}    IN    @{SUBNETS}
269         OpenStackOperations.Remove Interface    ${ROUTERS}[2]    ${interface}
270     END
271
272 Delete Routers
273     [Documentation]    Delete Router and Interface to the subnets.
274     OpenStackOperations.Delete Router    ${ROUTERS}[1]
275     OpenStackOperations.Delete Router    ${ROUTERS}[2]
276
277 Verify Deleted Routers
278     [Documentation]    Check deleted routers using northbound rest calls
279     ${data} =    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
280     BuiltIn.Log    ${data}
281     BuiltIn.Should Not Contain    ${data}    ${ROUTERS}[2]
282
283 Delete Sub Network In net_1
284     [Documentation]    Delete Sub Nets for the Networks with neutron request.
285     OpenStackOperations.Delete SubNet    ${SUBNETS}[0]
286
287 Delete Sub Network In net_2
288     [Documentation]    Delete Sub Nets for the Networks with neutron request.
289     OpenStackOperations.Delete SubNet    ${SUBNETS}[1]
290
291 Delete Networks
292     [Documentation]    Delete Networks with neutron request.
293     FOR    ${network}    IN    @{NETWORKS}
294         OpenStackOperations.Delete Network    ${network}
295     END
296
297 Delete Security Group
298     [Documentation]    Delete security groups with neutron request
299     OpenStackOperations.Delete SecurityGroup    ${SECURITY_GROUP}
300
301 Verify Flows Cleanup
302     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
303     DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes