412eb510f50c6c978572ff04906814adea358281
[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]    Kill 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     ClusterManagement.Kill Single Member    ${cluster_leader}
43
44 Create Networks
45     [Documentation]    Create Network with neutron request.
46     : FOR    ${NetworkElement}    IN    @{NETWORKS}
47     \    OpenStackOperations.Create Network    ${NetworkElement}
48
49 Create Subnets For net_1
50     [Documentation]    Create Sub Nets for the Networks with neutron request.
51     OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS}[0]    @{SUBNET_CIDRS}[0]
52
53 Create Subnets For net_2
54     [Documentation]    Create Sub Nets for the Networks with neutron request.
55     OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS}[1]    @{SUBNET_CIDRS}[1]
56
57 Bring Up Leader Of Default Shard
58     [Documentation]    Bring up on cluster leader
59     ClusterManagement.Start Single Member    member=${cluster_leader}    check_system_status=True    service_list=@{NETVIRT_DIAG_SERVICES}
60
61 Add Ssh Allow All Rule
62     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
63     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
64
65 Take Down ODL1
66     [Documentation]    Kill the karaf in First Controller
67     ClusterManagement.Kill Single Member    1
68
69 Create Vm Instances For net_1
70     [Documentation]    Create Vm instances using flavor and image names for a network.
71     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
72     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[1]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
73     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
74
75 Bring Up ODL1
76     [Documentation]    Bring up ODL1 again
77     ClusterManagement.Start Single Member    member=1    check_system_status=True    service_list=@{NETVIRT_DIAG_SERVICES}
78
79 Take Down ODL2
80     [Documentation]    Kill the karaf in Second Controller
81     ClusterManagement.Kill Single Member    2
82
83 Create Vm Instances For net_2
84     [Documentation]    Create Vm instances using flavor and image names for a network.
85     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
86     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[1]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
87     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
88
89 Check Vm Instances Have Ip Address
90     @{NET_1_L3_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
91     @{NET_2_L3_VM_IPS}    ${NET_2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
92     BuiltIn.Set Suite Variable    @{NET_1_L3_VM_IPS}
93     BuiltIn.Set Suite Variable    @{NET_2_L3_VM_IPS}
94     BuiltIn.Should Not Contain    ${NET_1_L3_VM_IPS}    None
95     BuiltIn.Should Not Contain    ${NET_2_L3_VM_IPS}    None
96     BuiltIn.Should Not Contain    ${NET_1_DHCP_IP}    None
97     BuiltIn.Should Not Contain    ${NET_2_DHCP_IP}    None
98     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
99     ...    AND    OpenStackOperations.Get Test Teardown Debugs
100
101 Bring Up ODL2
102     [Documentation]    Bring up ODL2 again
103     ClusterManagement.Start Single Member    member=2    check_system_status=True    service_list=@{NETVIRT_DIAG_SERVICES}
104
105 Take Down ODL3
106     [Documentation]    Kill the karaf in Third Controller
107     ClusterManagement.Kill Single Member    3
108
109 Create Router router_2
110     [Documentation]    Create Router and Add Interface to the subnets.
111     OpenStackOperations.Create Router    @{ROUTERS}[1]
112     [Teardown]    Report_Failure_Due_To_Bug    6117
113
114 Create Router router_3
115     [Documentation]    Create Router and Add Interface to the subnets.
116     OpenStackOperations.Create Router    @{ROUTERS}[2]
117
118 Add Interfaces To Router
119     [Documentation]    Add Interfaces
120     : FOR    ${interface}    IN    @{SUBNETS}
121     \    OpenStackOperations.Add Router Interface    @{ROUTERS}[2]    ${interface}
122
123 Verify Created Routers
124     [Documentation]    Check created routers using northbound rest calls
125     ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
126     BuiltIn.Log    ${data}
127     Should Contain    ${data}    @{ROUTERS}[2]
128
129 Bring Up ODL3
130     [Documentation]    Bring up ODL3 again
131     ClusterManagement.Start Single Member    member=3    check_system_status=True    service_list=@{NETVIRT_DIAG_SERVICES}
132
133 Ping Vm Instance1 In net_2 From net_1
134     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
135     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_2_L3_VM_IPS}[0]
136
137 Ping Vm Instance2 In net_2 From net_1
138     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
139     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_2_L3_VM_IPS}[1]
140
141 Ping Vm Instance3 In net_2 From net_1
142     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
143     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_2_L3_VM_IPS}[2]
144
145 Ping Vm Instance1 In net_1 From net_2
146     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
147     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[0]
148
149 Ping Vm Instance2 In net_1 From net_2
150     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
151     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[1]
152
153 Ping Vm Instance3 In net_1 From net_2
154     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
155     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[2]
156
157 Take Down ODL1 and ODL2
158     [Documentation]    Kill the karaf in First and Second Controller
159     ClusterManagement.Kill Members From List Or All    ${ODL_1_AND_2_DOWN}
160     [Teardown]    OpenStackOperations.Get OvsDebugInfo
161
162 Connectivity Tests From Vm Instance1 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}[0]    ${dst_list}
166     [Teardown]    OpenStackOperations.Get OvsDebugInfo
167
168 Connectivity Tests From Vm Instance2 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}[1]    ${dst_list}
172     [Teardown]    OpenStackOperations.Get OvsDebugInfo
173
174 Connectivity Tests From Vm Instance3 In net_1
175     [Documentation]    ssh to the VM instance and test operations.
176     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
177     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[2]    ${dst_list}
178     [Teardown]    OpenStackOperations.Get OvsDebugInfo
179
180 Bring Up ODL1 and ODL2
181     [Documentation]    Bring up ODL1 and ODL2 again
182     ClusterManagement.Start Members From List Or All    member_index_list=${ODL_1_AND_2_DOWN}    check_system_status=True    service_list=@{NETVIRT_DIAG_SERVICES}
183
184 Take Down ODL2 and ODL3
185     [Documentation]    Kill the karaf in First and Second Controller
186     ClusterManagement.Kill Members From List Or All    ${ODL_2_AND_3_DOWN}
187     [Teardown]    OpenStackOperations.Get OvsDebugInfo
188
189 Connectivity Tests From Vm Instance1 In net_2
190     [Documentation]    ssh to the VM instance and test operations.
191     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
192     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[0]    ${dst_list}
193     [Teardown]    OpenStackOperations.Get OvsDebugInfo
194
195 Connectivity Tests From Vm Instance2 In net_2
196     [Documentation]    ssh to the VM instance and test operations.
197     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
198     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[1]    ${dst_list}
199     [Teardown]    OpenStackOperations.Get OvsDebugInfo
200
201 Connectivity Tests From Vm Instance3 In net_2
202     [Documentation]    ssh to the VM instance and test operations.
203     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
204     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[2]    ${dst_list}
205     [Teardown]    OpenStackOperations.Get OvsDebugInfo
206
207 Bring Up ODL2 and ODL3
208     [Documentation]    Bring up ODL2 and ODL3 again.
209     ClusterManagement.Start Members From List Or All    member_index_list=${ODL_2_AND_3_DOWN}    check_system_status=True    service_list=@{NETVIRT_DIAG_SERVICES}
210
211 Take Down All Instances
212     [Documentation]    Stop karaf on all controllers
213     ClusterManagement.Kill Members From List Or All
214
215 Bring Up All Instances
216     [Documentation]    Bring up all controllers
217     ClusterManagement.Start Members From List Or All    check_system_status=True    service_list=@{NETVIRT_DIAG_SERVICES}
218
219 Connectivity Tests From Vm Instance2 In net_2 after recovering all nodes
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 OvsDebugInfo
224
225 Connectivity Tests From Vm Instance3 In net_2 after recovering all nodes
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 OvsDebugInfo
230
231 Delete Vm Instances In net_1
232     [Documentation]    Delete Vm instances using instance names in net_1.
233     : FOR    ${vm}    IN    @{NET_1_VMS}
234     \    OpenStackOperations.Delete Vm Instance    ${vm}
235
236 Delete Vm Instances In net_2
237     [Documentation]    Delete Vm instances using instance names in net_2.
238     : FOR    ${vm}    IN    @{NET_2_VMS}
239     \    OpenStackOperations.Delete Vm Instance    ${vm}
240
241 Delete Router Interfaces
242     [Documentation]    Remove Interface to the subnets.
243     : FOR    ${interface}    IN    @{SUBNETS}
244     \    OpenStackOperations.Remove Interface    @{ROUTERS}[2]    ${interface}
245
246 Delete Routers
247     [Documentation]    Delete Router and Interface to the subnets.
248     OpenStackOperations.Delete Router    @{ROUTERS}[1]
249     OpenStackOperations.Delete Router    @{ROUTERS}[2]
250
251 Verify Deleted Routers
252     [Documentation]    Check deleted routers using northbound rest calls
253     ${data} =    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
254     BuiltIn.Log    ${data}
255     BuiltIn.Should Not Contain    ${data}    @{ROUTERS}[2]
256
257 Delete Sub Network In net_1
258     [Documentation]    Delete Sub Nets for the Networks with neutron request.
259     OpenStackOperations.Delete SubNet    @{SUBNETS}[0]
260
261 Delete Sub Network In net_2
262     [Documentation]    Delete Sub Nets for the Networks with neutron request.
263     OpenStackOperations.Delete SubNet    @{SUBNETS}[1]
264
265 Delete Networks
266     [Documentation]    Delete Networks with neutron request.
267     : FOR    ${network}    IN    @{NETWORKS}
268     \    OpenStackOperations.Delete Network    ${network}
269
270 Delete Security Group
271     [Documentation]    Delete security groups with neutron request
272     OpenStackOperations.Delete SecurityGroup    ${SECURITY_GROUP}
273
274 Verify Flows Cleanup
275     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
276     DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes