Additional cases for clustering HA L3 tests
[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
20 *** Variables ***
21 ${SECURITY_GROUP}    cl3_sg
22 @{NETWORKS}       cl3_net_1    cl3_net_2
23 @{SUBNETS}        cl3_sub_1    cl3_sub_2
24 @{ROUTERS}        cl3_router_1    cl3_router_2    cl3_router_3
25 @{NET_1_VMS}      cl3_net_1_vm_1    cl3_net_1_vm_2    cl3_net_1_vm_3
26 @{NET_2_VMS}      cl3_net_2_vm_1    cl3_net_2_vm_2    cl3_net_2_vm_3
27 @{SUBNET_CIDRS}    36.0.0.0/24    37.0.0.0/24
28 @{GATEWAY_IPS}    36.0.0.1    37.0.0.1
29 @{ODL_1_AND_2_DOWN}    ${1}    ${2}
30 @{ODL_2_AND_3_DOWN}    ${2}    ${3}
31
32 *** Test Cases ***
33 Create All Controller Sessions
34     [Documentation]    Create sessions for all three contorllers.
35     ClusterManagement.ClusterManagement Setup
36
37 Take Down Leader Of Default Shard
38     [Documentation]    Kill the karaf on ODL cluster leader
39     ${cluster_leader}    ${followers} =    ClusterManagement.Get Leader And Followers For Shard    shard_type=config
40     BuiltIn.Set Suite Variable    ${cluster_leader}
41     ClusterManagement.Kill Single Member    ${cluster_leader}
42
43 Create Networks
44     [Documentation]    Create Network with neutron request.
45     : FOR    ${NetworkElement}    IN    @{NETWORKS}
46     \    OpenStackOperations.Create Network    ${NetworkElement}
47
48 Create Subnets For net_1
49     [Documentation]    Create Sub Nets for the Networks with neutron request.
50     OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS}[0]    @{SUBNET_CIDRS}[0]
51
52 Create Subnets For net_2
53     [Documentation]    Create Sub Nets for the Networks with neutron request.
54     OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS}[1]    @{SUBNET_CIDRS}[1]
55
56 Bring Up Leader Of Default Shard
57     [Documentation]    Bring up on cluster leader
58     ClusterManagement.Start Single Member    ${cluster_leader}
59
60 Add Ssh Allow All Rule
61     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
62     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
63
64 Take Down ODL1
65     [Documentation]    Kill the karaf in First Controller
66     ClusterManagement.Kill Single Member    1
67
68 Create Vm Instances For net_1
69     [Documentation]    Create Vm instances using flavor and image names for a network.
70     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
71     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[1]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
72     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
73
74 Bring Up ODL1
75     [Documentation]    Bring up ODL1 again
76     ClusterManagement.Start Single Member    1
77
78 Take Down ODL2
79     [Documentation]    Kill the karaf in Second Controller
80     ClusterManagement.Kill Single Member    2
81
82 Create Vm Instances For net_2
83     [Documentation]    Create Vm instances using flavor and image names for a network.
84     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
85     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[1]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
86     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
87
88 Check Vm Instances Have Ip Address
89     @{NET_1_L3_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
90     @{NET_2_L3_VM_IPS}    ${NET_2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
91     BuiltIn.Set Suite Variable    @{NET_1_L3_VM_IPS}
92     BuiltIn.Set Suite Variable    @{NET_2_L3_VM_IPS}
93     BuiltIn.Should Not Contain    ${NET_1_L3_VM_IPS}    None
94     BuiltIn.Should Not Contain    ${NET_2_L3_VM_IPS}    None
95     BuiltIn.Should Not Contain    ${NET_1_DHCP_IP}    None
96     BuiltIn.Should Not Contain    ${NET_2_DHCP_IP}    None
97     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
98     ...    AND    OpenStackOperations.Get Test Teardown Debugs
99
100 Bring Up ODL2
101     [Documentation]    Bring up ODL2 again
102     ClusterManagement.Start Single Member    2
103
104 Take Down ODL3
105     [Documentation]    Kill the karaf in Third Controller
106     ClusterManagement.Kill Single Member    3
107
108 Create Router router_2
109     [Documentation]    Create Router and Add Interface to the subnets.
110     OpenStackOperations.Create Router    @{ROUTERS}[1]
111     [Teardown]    Report_Failure_Due_To_Bug    6117
112
113 Create Router router_3
114     [Documentation]    Create Router and Add Interface to the subnets.
115     OpenStackOperations.Create Router    @{ROUTERS}[2]
116
117 Add Interfaces To Router
118     [Documentation]    Add Interfaces
119     : FOR    ${interface}    IN    @{SUBNETS}
120     \    OpenStackOperations.Add Router Interface    @{ROUTERS}[2]    ${interface}
121
122 Verify Created Routers
123     [Documentation]    Check created routers using northbound rest calls
124     ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
125     BuiltIn.Log    ${data}
126     Should Contain    ${data}    @{ROUTERS}[2]
127
128 Bring Up ODL3
129     [Documentation]    Bring up ODL3 again
130     ClusterManagement.Start Single Member    3
131
132 Ping Vm Instance1 In net_2 From net_1
133     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
134     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_2_L3_VM_IPS}[0]
135
136 Ping Vm Instance2 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}[1]
139
140 Ping Vm Instance3 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}[2]
143
144 Ping Vm Instance1 In net_1 From net_2
145     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
146     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[0]
147
148 Ping Vm Instance2 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}[1]
151
152 Ping Vm Instance3 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}[2]
155
156 Take Down ODL1 and ODL2
157     [Documentation]    Kill the karaf in First and Second Controller
158     ClusterManagement.Kill Members From List Or All    ${ODL_1_AND_2_DOWN}
159     [Teardown]    OpenStackOperations.Get OvsDebugInfo
160
161 Connectivity Tests From Vm Instance1 In net_1
162     [Documentation]    ssh to the VM instance and test operations.
163     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
164     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[0]    ${dst_list}
165     [Teardown]    OpenStackOperations.Get OvsDebugInfo
166
167 Connectivity Tests From Vm Instance2 In net_1
168     [Documentation]    ssh to the VM instance and test operations.
169     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
170     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[1]    ${dst_list}
171     [Teardown]    OpenStackOperations.Get OvsDebugInfo
172
173 Connectivity Tests From Vm Instance3 In net_1
174     [Documentation]    ssh to the VM instance and test operations.
175     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
176     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[2]    ${dst_list}
177     [Teardown]    OpenStackOperations.Get OvsDebugInfo
178
179 Bring Up ODL1 and ODL2
180     [Documentation]    Bring up ODL1 and ODL2 again
181     ClusterManagement.Start Members From List Or All    ${ODL_1_AND_2_DOWN}
182
183 Take Down ODL2 and ODL3
184     [Documentation]    Kill the karaf in First and Second Controller
185     ClusterManagement.Kill Members From List Or All    ${ODL_2_AND_3_DOWN}
186     [Teardown]    OpenStackOperations.Get OvsDebugInfo
187
188 Connectivity Tests From Vm Instance1 In net_2
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}[1]    @{NET_2_L3_VM_IPS}[0]    ${dst_list}
192     [Teardown]    OpenStackOperations.Get OvsDebugInfo
193
194 Connectivity Tests From Vm Instance2 In net_2
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}[1]    @{NET_2_L3_VM_IPS}[1]    ${dst_list}
198     [Teardown]    OpenStackOperations.Get OvsDebugInfo
199
200 Connectivity Tests From Vm Instance3 In net_2
201     [Documentation]    ssh to the VM instance and test operations.
202     ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
203     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[2]    ${dst_list}
204     [Teardown]    OpenStackOperations.Get OvsDebugInfo
205
206 Bring Up ODL2 and ODL3
207     [Documentation]    Bring up ODL2 and ODL3 again.
208     ClusterManagement.Start Members From List Or All    ${ODL_2_AND_3_DOWN}
209
210 Take Down All Instances
211     [Documentation]    Stop karaf on all controllers
212     ClusterManagement.Kill Members From List Or All
213
214 Bring Up All Instances
215     [Documentation]    Bring up all controllers
216     ClusterManagement.Start Members From List Or All
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
223 Delete Vm Instances In net_2
224     [Documentation]    Delete Vm instances using instance names in net_2.
225     : FOR    ${vm}    IN    @{NET_2_VMS}
226     \    OpenStackOperations.Delete Vm Instance    ${vm}
227
228 Delete Router Interfaces
229     [Documentation]    Remove Interface to the subnets.
230     : FOR    ${interface}    IN    @{SUBNETS}
231     \    OpenStackOperations.Remove Interface    @{ROUTERS}[2]    ${interface}
232
233 Delete Routers
234     [Documentation]    Delete Router and Interface to the subnets.
235     OpenStackOperations.Delete Router    @{ROUTERS}[1]
236     OpenStackOperations.Delete Router    @{ROUTERS}[2]
237
238 Verify Deleted Routers
239     [Documentation]    Check deleted routers using northbound rest calls
240     ${data} =    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
241     BuiltIn.Log    ${data}
242     BuiltIn.Should Not Contain    ${data}    @{ROUTERS}[2]
243
244 Delete Sub Network In net_1
245     [Documentation]    Delete Sub Nets for the Networks with neutron request.
246     OpenStackOperations.Delete SubNet    @{SUBNETS}[0]
247
248 Delete Sub Network In net_2
249     [Documentation]    Delete Sub Nets for the Networks with neutron request.
250     OpenStackOperations.Delete SubNet    @{SUBNETS}[1]
251
252 Delete Networks
253     [Documentation]    Delete Networks with neutron request.
254     : FOR    ${network}    IN    @{NETWORKS}
255     \    OpenStackOperations.Delete Network    ${network}
256
257 Delete Security Group
258     [Documentation]    Delete security groups with neutron request
259     OpenStackOperations.Delete SecurityGroup    ${SECURITY_GROUP}
260
261 Verify Flows Cleanup
262     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
263     DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes