Make sure ip forward is enabled on SFC full deploy
[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     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}    sg-clustering
22 @{NETWORKS_NAME}    l3_net_1    l3_net_2
23 @{SUBNETS_NAME}    l3_sub_net_1    l3_sub_net_2
24 @{NET_1_VM_INSTANCES}    VmInstance1_net_1    VmInstance2_net_1    VmInstance3_net_1
25 @{NET_2_VM_INSTANCES}    VmInstance1_net_2    VmInstance2_net_2    VmInstance3_net_2
26 @{GATEWAY_IPS}    90.0.0.1    100.0.0.1
27 @{SUBNETS_RANGE}    90.0.0.0/24    100.0.0.0/24
28 @{odl_1_and_2_down}    ${1}    ${2}
29 @{odl_2_and_3_down}    ${2}    ${3}
30
31 *** Test Cases ***
32 Create All Controller Sessions
33     [Documentation]    Create sessions for all three contorllers.
34     ClusterManagement.ClusterManagement Setup
35
36 Create Networks
37     [Documentation]    Create Network with neutron request.
38     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
39     \    OpenStackOperations.Create Network    ${NetworkElement}
40
41 Create Subnets For l3_net_1
42     [Documentation]    Create Sub Nets for the Networks with neutron request.
43     OpenStackOperations.Create SubNet    l3_net_1    l3_sub_net_1    @{SUBNETS_RANGE}[0]
44
45 Create Subnets For l3_net_2
46     [Documentation]    Create Sub Nets for the Networks with neutron request.
47     OpenStackOperations.Create SubNet    l3_net_2    l3_sub_net_2    @{SUBNETS_RANGE}[1]
48
49 Take Down ODL1
50     [Documentation]    Kill the karaf in First Controller
51     ClusterManagement.Kill Single Member    1
52
53 Create Vm Instances For l3_net_1
54     [Documentation]    Create Four Vm instances using flavor and image names for a network.
55     OpenStackOperations.Create Vm Instances    l3_net_1    ${NET_1_VM_INSTANCES}    sg=${SECURITY_GROUP}
56
57 Bring Up ODL1
58     [Documentation]    Bring up ODL1 again
59     ClusterManagement.Start Single Member    1
60
61 Take Down ODL2
62     [Documentation]    Kill the karaf in Second Controller
63     ClusterManagement.Kill Single Member    2
64
65 Create Vm Instances For l3_net_2
66     [Documentation]    Create Four Vm instances using flavor and image names for a network.
67     OpenStackOperations.Create Vm Instances    l3_net_2    ${NET_2_VM_INSTANCES}    sg=${SECURITY_GROUP}
68
69 Check Vm Instances Have Ip Address
70     [Documentation]    Test case to verify that all created VMs are ready and have received their ip addresses.
71     ...    We are polling first and longest on the last VM created assuming that if it's received it's address
72     ...    already the other instances should have theirs already or at least shortly thereafter.
73     # first, ensure all VMs are in ACTIVE state.    if not, we can just fail the test case and not waste time polling
74     # for dhcp addresses
75     @{NET1_L3_VM_IPS}    ${NET1_DHCP_IP} =    Get VM IPs    @{NET_1_VM_INSTANCES}
76     @{NET2_L3_VM_IPS}    ${NET2_DHCP_IP} =    Get VM IPs    @{NET_2_VM_INSTANCES}
77     Set Suite Variable    @{NET1_L3_VM_IPS}
78     Set Suite Variable    @{NET2_L3_VM_IPS}
79     Should Not Contain    ${NET1_L3_VM_IPS}    None
80     Should Not Contain    ${NET2_L3_VM_IPS}    None
81     Should Not Contain    ${NET1_DHCP_IP}    None
82     Should Not Contain    ${NET2_DHCP_IP}    None
83     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
84     ...    AND    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. this fails sometimes.
96     OpenStackOperations.Create Router    router_2
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    router_3
102
103 Add Interfaces To Router
104     [Documentation]    Add Interfaces
105     : FOR    ${interface}    IN    @{SUBNETS_NAME}
106     \    OpenStackOperations.Add Router Interface    router_3    ${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     Log    ${data}
112     Should Contain    ${data}    router_3
113
114 Bring Up ODL3
115     [Documentation]    Bring up ODL3 again
116     ClusterManagement.Start Single Member    3
117
118 Ping Vm Instance1 In l3_net_2 From l3_net_1
119     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
120     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_1    @{NET2_L3_VM_IPS}[0]
121
122 Ping Vm Instance2 In l3_net_2 From l3_net_1
123     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
124     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_1    @{NET2_L3_VM_IPS}[1]
125
126 Ping Vm Instance3 In l3_net_2 From l3_net_1
127     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
128     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_1    @{NET2_L3_VM_IPS}[2]
129
130 Ping Vm Instance1 In l3_net_1 From l3_net_2
131     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
132     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_2    @{NET1_L3_VM_IPS}[0]
133
134 Ping Vm Instance2 In l3_net_1 From l3_net_2
135     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
136     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_2    @{NET1_L3_VM_IPS}[1]
137
138 Ping Vm Instance3 In l3_net_1 From l3_net_2
139     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
140     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_2    @{NET1_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]    Get OvsDebugInfo
146
147 Connectivity Tests From Vm Instance1 In l3_net_1
148     [Documentation]    ssh to the VM instance and test operations.
149     ${dst_ip_list}=    Create List    @{NET2_L3_VM_IPS}    @{NET1_L3_VM_IPS}
150     Log    ${dst_ip_list}
151     OpenStackOperations.Test Operations From Vm Instance    l3_net_1    @{NET1_L3_VM_IPS}[0]    ${dst_ip_list}
152     [Teardown]    Get OvsDebugInfo
153
154 Connectivity Tests From Vm Instance2 In l3_net_1
155     [Documentation]    ssh to the VM instance and test operations.
156     ${dst_ip_list}=    Create List    @{NET2_L3_VM_IPS}    @{NET1_L3_VM_IPS}
157     Log    ${dst_ip_list}
158     OpenStackOperations.Test Operations From Vm Instance    l3_net_1    @{NET1_L3_VM_IPS}[1]    ${dst_ip_list}
159     [Teardown]    Get OvsDebugInfo
160
161 Connectivity Tests From Vm Instance3 In l3_net_1
162     [Documentation]    ssh to the VM instance and test operations.
163     ${dst_ip_list}=    Create List    @{NET2_L3_VM_IPS}    @{NET1_L3_VM_IPS}
164     Log    ${dst_ip_list}
165     OpenStackOperations.Test Operations From Vm Instance    l3_net_1    @{NET1_L3_VM_IPS}[2]    ${dst_ip_list}
166     [Teardown]    Get OvsDebugInfo
167
168 Bring Up ODL1 and ODL2
169     [Documentation]    Bring up ODL1 and ODL2 again
170     ClusterManagement.Start Members From List Or All    ${odl_1_and_2_down}
171
172 Take Down ODL2 and ODL3
173     [Documentation]    Kill the karaf in First and Second Controller
174     ClusterManagement.Kill Members From List Or All    ${odl_2_and_3_down}
175     [Teardown]    Get OvsDebugInfo
176
177 Connectivity Tests From Vm Instance1 In l3_net_2
178     [Documentation]    ssh to the VM instance and test operations.
179     ${dst_ip_list}=    Create List    @{NET2_L3_VM_IPS}    @{NET1_L3_VM_IPS}
180     Log    ${dst_ip_list}
181     OpenStackOperations.Test Operations From Vm Instance    l3_net_2    @{NET2_L3_VM_IPS}[0]    ${dst_ip_list}
182     [Teardown]    Get OvsDebugInfo
183
184 Connectivity Tests From Vm Instance2 In l3_net_2
185     [Documentation]    ssh to the VM instance and test operations.
186     ${dst_ip_list}=    Create List    @{NET2_L3_VM_IPS}    @{NET1_L3_VM_IPS}
187     Log    ${dst_ip_list}
188     OpenStackOperations.Test Operations From Vm Instance    l3_net_2    @{NET2_L3_VM_IPS}[1]    ${dst_ip_list}
189     [Teardown]    Get OvsDebugInfo
190
191 Connectivity Tests From Vm Instance3 In l3_net_2
192     [Documentation]    ssh to the VM instance and test operations.
193     ${dst_ip_list}=    Create List    @{NET2_L3_VM_IPS}    @{NET1_L3_VM_IPS}
194     Log    ${dst_ip_list}
195     OpenStackOperations.Test Operations From Vm Instance    l3_net_2    @{NET2_L3_VM_IPS}[2]    ${dst_ip_list}
196     [Teardown]    Get OvsDebugInfo
197
198 Bring Up ODL2 and ODL3
199     [Documentation]    Bring up ODL2 and ODL3 again.
200     ClusterManagement.Start Members From List Or All    ${odl_2_and_3_down}
201
202 Delete Vm Instances In l3_net_1
203     [Documentation]    Delete Vm instances using instance names in l3_net_1.
204     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
205     \    OpenStackOperations.Delete Vm Instance    ${VmElement}
206
207 Delete Vm Instances In l3_net_2
208     [Documentation]    Delete Vm instances using instance names in l3_net_2.
209     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
210     \    OpenStackOperations.Delete Vm Instance    ${VmElement}
211
212 Delete Router Interfaces
213     [Documentation]    Remove Interface to the subnets.
214     : FOR    ${interface}    IN    @{SUBNETS_NAME}
215     \    OpenStackOperations.Remove Interface    router_3    ${interface}
216
217 Delete Routers
218     [Documentation]    Delete Router and Interface to the subnets.
219     OpenStackOperations.Delete Router    router_2
220     OpenStackOperations.Delete Router    router_3
221
222 Verify Deleted Routers
223     [Documentation]    Check deleted routers using northbound rest calls
224     ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
225     Log    ${data}
226     Should Not Contain    ${data}    router_3
227
228 Delete Sub Networks In l3_net_1
229     [Documentation]    Delete Sub Nets for the Networks with neutron request.
230     OpenStackOperations.Delete SubNet    l3_sub_net_1
231
232 Delete Sub Networks In l3_net_2
233     [Documentation]    Delete Sub Nets for the Networks with neutron request.
234     OpenStackOperations.Delete SubNet    l3_sub_net_2
235
236 Delete Networks
237     [Documentation]    Delete Networks with neutron request.
238     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
239     \    OpenStackOperations.Delete Network    ${NetworkElement}
240
241 Verify Flows Cleanup
242     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
243     Verify Flows Are Cleaned Up On All OpenStack Nodes