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