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