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