54201f6ad28ddcdc390487f87a2245e790ce7cd6
[integration/test.git] / csit / suites / openstack / clustering / ha_l3.robot
1 *** Settings ***
2 Documentation     Test suite to check connectivity in L3 using routers.
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}    cl3_sg
23 @{NETWORKS}       cl3_net_1    cl3_net_2
24 @{SUBNETS}        cl3_sub_1    cl3_sub_2
25 @{ROUTERS}        cl3_router_1    cl3_router_2    cl3_router_3
26 @{NET_1_VMS}      cl3_net_1_vm_1    cl3_net_1_vm_2    cl3_net_1_vm_3
27 @{NET_2_VMS}      cl3_net_2_vm_1    cl3_net_2_vm_2    cl3_net_2_vm_3
28 @{SUBNET_CIDRS}    36.0.0.0/24    37.0.0.0/24
29 @{GATEWAY_IPS}    36.0.0.1    37.0.0.1
30 @{ODL_1_AND_2_DOWN}    ${1}    ${2}
31 @{ODL_2_AND_3_DOWN}    ${2}    ${3}
32
33 *** Test Cases ***
34 Create All Controller Sessions
35     [Documentation]    Create sessions for all three controllers.
36     ClusterManagement.ClusterManagement Setup
37
38 Take Down Leader Of Default Shard
39     [Documentation]    Stop the karaf on ODL cluster leader
40     ${cluster_leader}    ${followers} =    ClusterManagement.Get Leader And Followers For Shard    shard_type=config
41     BuiltIn.Set Suite Variable    ${cluster_leader}
42     ${new_cluster_list} =    ClusterManagement.Stop Single Member    ${cluster_leader}    msg=up: ODL1, ODL2, ODL3, down=none
43     BuiltIn.Set Suite Variable    ${new_cluster_list}
44
45 Create Networks
46     [Documentation]    Create Network with neutron request.
47     : FOR    ${NetworkElement}    IN    @{NETWORKS}
48     \    OpenStackOperations.Create Network    ${NetworkElement}
49
50 Create Subnets For net_1
51     [Documentation]    Create Sub Nets for the Networks with neutron request.
52     OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS}[0]    @{SUBNET_CIDRS}[0]
53
54 Create Subnets For net_2
55     [Documentation]    Create Sub Nets for the Networks with neutron request.
56     OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS}[1]    @{SUBNET_CIDRS}[1]
57
58 Bring Up Leader Of Default Shard
59     [Documentation]    Bring up on cluster leader
60     ClusterManagement.Start Single Member    ${cluster_leader}    msg=up: ${new_cluster_list}, down: ${cluster_leader}
61
62 Add Ssh Allow All Rule
63     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
64     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
65
66 Take Down ODL1
67     [Documentation]    Stop the karaf in First Controller
68     ClusterManagement.Stop Single Member    1    msg=up: ODL1, ODL2, ODL3, down=none
69
70 Create Vm Instances For net_1
71     [Documentation]    Create Vm instances using flavor and image names for a network.
72     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
73     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[1]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
74     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
75
76 Bring Up ODL1
77     [Documentation]    Bring up ODL1 again
78     ClusterManagement.Start Single Member    1    msg=up: ODL2, ODL3, down: ODL1
79
80 Take Down ODL2
81     [Documentation]    Stop the karaf in Second Controller
82     ClusterManagement.Stop Single Member    2    msg=up: ODL1, ODL2, ODL3, down=none
83
84 Create Vm Instances For net_2
85     [Documentation]    Create Vm instances using flavor and image names for a network.
86     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
87     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[1]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
88     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
89
90 Check Vm Instances Have Ip Address
91     @{NET_1_L3_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
92     @{NET_2_L3_VM_IPS}    ${NET_2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
93     BuiltIn.Set Suite Variable    @{NET_1_L3_VM_IPS}
94     BuiltIn.Set Suite Variable    @{NET_2_L3_VM_IPS}
95     BuiltIn.Should Not Contain    ${NET_1_L3_VM_IPS}    None
96     BuiltIn.Should Not Contain    ${NET_2_L3_VM_IPS}    None
97     BuiltIn.Should Not Contain    ${NET_1_DHCP_IP}    None
98     BuiltIn.Should Not Contain    ${NET_2_DHCP_IP}    None
99     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
100     ...    AND    OpenStackOperations.Get Test Teardown Debugs
101
102 Bring Up ODL2
103     [Documentation]    Bring up ODL2 again
104     ClusterManagement.Start Single Member    2    msg=up: ODL1, ODL3, down: ODL2
105
106 Take Down ODL3
107     [Documentation]    Stop the karaf in Third Controller
108     ClusterManagement.Stop Single Member    3    msg=up: ODL1, ODL2, ODL3, down=none
109
110 Create Router router_2
111     [Documentation]    Create Router and Add Interface to the subnets.
112     OpenStackOperations.Create Router    @{ROUTERS}[1]
113     [Teardown]    Report_Failure_Due_To_Bug    6117
114
115 Create Router router_3
116     [Documentation]    Create Router and Add Interface to the subnets.
117     OpenStackOperations.Create Router    @{ROUTERS}[2]
118
119 Add Interfaces To Router
120     [Documentation]    Add Interfaces
121     : FOR    ${interface}    IN    @{SUBNETS}
122     \    OpenStackOperations.Add Router Interface    @{ROUTERS}[2]    ${interface}
123
124 Verify Created Routers
125     [Documentation]    Check created routers using northbound rest calls
126     ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
127     BuiltIn.Log    ${data}
128     Should Contain    ${data}    @{ROUTERS}[2]
129
130 Bring Up ODL3
131     [Documentation]    Bring up ODL3 again
132     ClusterManagement.Start Single Member    3    msg=up: ODL1, ODL2, down: ODL3
133
134 Ping Vm Instance1 In net_2 From net_1
135     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
136     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_2_L3_VM_IPS}[0]
137
138 Ping Vm Instance2 In net_2 From net_1
139     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
140     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_2_L3_VM_IPS}[1]
141
142 Ping Vm Instance3 In net_2 From net_1
143     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
144     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_2_L3_VM_IPS}[2]
145
146 Ping Vm Instance1 In net_1 From net_2
147     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
148     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[0]
149
150 Ping Vm Instance2 In net_1 From net_2
151     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
152     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[1]
153
154 Ping Vm Instance3 In net_1 From net_2
155     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
156     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[2]
157
158 Connectivity Tests From Vm Instance1 In net_1 In Healthy Cluster
159     [Documentation]    ssh to the VM instance and test operations.
160     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
161     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[0]    ${dst_list}
162     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
163
164 Connectivity Tests From Vm Instance2 In net_1 In Healthy Cluster
165     [Documentation]    ssh to the VM instance and test operations.
166     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
167     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[1]    ${dst_list}
168     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
169
170 Connectivity Tests From Vm Instance3 In net_1 In Healthy Cluster
171     [Documentation]    ssh to the VM instance and test operations.
172     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
173     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[2]    ${dst_list}
174     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
175
176 Take Down ODL1 and ODL2
177     [Documentation]    Stop the karaf in First and Second Controller
178     ClusterManagement.Stop Single Member    1    msg=up: ODL1, ODL2, ODL3, down=none
179     ClusterManagement.Stop Single Member    2    msg=up: ODL2, ODL3, down=ODL1
180     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
181
182 Connectivity Tests From Vm Instance1 In net_1 With Two ODLs Down
183     [Documentation]    ssh to the VM instance and test operations.
184     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
185     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[0]    ${dst_list}
186     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
187
188 Connectivity Tests From Vm Instance2 In net_1 With Two ODLs Down
189     [Documentation]    ssh to the VM instance and test operations.
190     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
191     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[1]    ${dst_list}
192     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
193
194 Connectivity Tests From Vm Instance3 In net_1 With Two ODLs Down
195     [Documentation]    ssh to the VM instance and test operations.
196     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
197     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[2]    ${dst_list}
198     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
199
200 Bring Up ODL1 and ODL2
201     [Documentation]    Bring up ODL1 and ODL2 again. Do not check for cluster sync until all nodes are
202     ...    up. akka will not let nodes join until they are all back up if two were down.
203     ClusterManagement.Start Single Member    1    msg=up: ODL3, down: ODL1, ODL2    wait_for_sync=False
204     ClusterManagement.Start Single Member    2    msg=up: ODL1, ODL3, down: ODL2
205     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
206
207 Take Down ODL2 and ODL3
208     [Documentation]    Stop the karaf in First and Second Controller
209     ClusterManagement.Stop Single Member    2    msg=up: ODL1, ODL2, ODL3, down=none
210     ClusterManagement.Stop Single Member    3    msg=up: ODL1, ODL3, down=ODL2
211     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
212
213 Connectivity Tests From Vm Instance1 In net_2
214     [Documentation]    ssh to the VM instance and test operations.
215     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
216     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[0]    ${dst_list}
217     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
218
219 Connectivity Tests From Vm Instance2 In net_2
220     [Documentation]    ssh to the VM instance and test operations.
221     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
222     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[1]    ${dst_list}
223     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
224
225 Connectivity Tests From Vm Instance3 In net_2
226     [Documentation]    ssh to the VM instance and test operations.
227     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
228     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[2]    ${dst_list}
229     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
230
231 Bring Up ODL2 and ODL3
232     [Documentation]    Bring up ODL2 and ODL3 again. Do not check for cluster sync until all nodes are
233     ...    up. akka will not let nodes join until they are all back up if two were down.
234     ClusterManagement.Start Single Member    2    msg=up: ODL1, down: ODL2, ODL3    wait_for_sync=False
235     ClusterManagement.Start Single Member    3    msg=up: ODL1, ODL2, down: ODL3
236     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
237
238 Take Down All Instances
239     [Documentation]    Stop karaf on all controllers
240     ClusterManagement.Stop Single Member    1    msg=up: ODL1, ODL2, ODL3, down=none
241     ClusterManagement.Stop Single Member    2    msg=up: ODL2, ODL3, down=ODL1
242     ClusterManagement.Stop Single Member    3    msg=up: ODL3, down=ODL1, ODL2
243     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
244
245 Bring Up All Instances
246     [Documentation]    Bring up all controllers. Do not check for cluster sync until all nodes are
247     ...    up. akka will not let nodes join until they are all back up if two were down.
248     ClusterManagement.Start Single Member    1    msg=up: none, down: ODL1, ODL2, ODL3    wait_for_sync=False
249     ClusterManagement.Start Single Member    2    msg=up: ~ODL1, down: ODL2, ODL3    wait_for_sync=False
250     ClusterManagement.Start Single Member    3    msg=up: ~ODL1, ~ODL2, down: ODL3
251     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
252
253 Connectivity Tests From Vm Instance2 In net_2 after recovering all nodes
254     [Documentation]    ssh to the VM instance and test operations.
255     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
256     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[1]    ${dst_list}
257     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
258
259 Connectivity Tests From Vm Instance3 In net_2 after recovering all nodes
260     [Documentation]    ssh to the VM instance and test operations.
261     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
262     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[2]    ${dst_list}
263     [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
264
265 Delete Vm Instances In net_1
266     [Documentation]    Delete Vm instances using instance names in net_1.
267     : FOR    ${vm}    IN    @{NET_1_VMS}
268     \    OpenStackOperations.Delete Vm Instance    ${vm}
269
270 Delete Vm Instances In net_2
271     [Documentation]    Delete Vm instances using instance names in net_2.
272     : FOR    ${vm}    IN    @{NET_2_VMS}
273     \    OpenStackOperations.Delete Vm Instance    ${vm}
274
275 Delete Router Interfaces
276     [Documentation]    Remove Interface to the subnets.
277     : FOR    ${interface}    IN    @{SUBNETS}
278     \    OpenStackOperations.Remove Interface    @{ROUTERS}[2]    ${interface}
279
280 Delete Routers
281     [Documentation]    Delete Router and Interface to the subnets.
282     OpenStackOperations.Delete Router    @{ROUTERS}[1]
283     OpenStackOperations.Delete Router    @{ROUTERS}[2]
284
285 Verify Deleted Routers
286     [Documentation]    Check deleted routers using northbound rest calls
287     ${data} =    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
288     BuiltIn.Log    ${data}
289     BuiltIn.Should Not Contain    ${data}    @{ROUTERS}[2]
290
291 Delete Sub Network In net_1
292     [Documentation]    Delete Sub Nets for the Networks with neutron request.
293     OpenStackOperations.Delete SubNet    @{SUBNETS}[0]
294
295 Delete Sub Network In net_2
296     [Documentation]    Delete Sub Nets for the Networks with neutron request.
297     OpenStackOperations.Delete SubNet    @{SUBNETS}[1]
298
299 Delete Networks
300     [Documentation]    Delete Networks with neutron request.
301     : FOR    ${network}    IN    @{NETWORKS}
302     \    OpenStackOperations.Delete Network    ${network}
303
304 Delete Security Group
305     [Documentation]    Delete security groups with neutron request
306     OpenStackOperations.Delete SecurityGroup    ${SECURITY_GROUP}
307
308 Verify Flows Cleanup
309     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
310     DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes