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