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