Tidy after recent merges
[integration/test.git] / csit / suites / openstack / clustering / 02_l3_tests.robot
1 *** Settings ***
2 Documentation     Test suite to check connectivity in L3 using routers.
3 Suite Setup       Devstack Suite Setup Tests    source_pwd=yes
4 Suite Teardown    Close All Connections
5 Test Teardown     Run Keywords    Show Debugs    ${NET_1_VM_INSTANCES}
6 ...               AND    Show Debugs    ${NET_2_VM_INSTANCES}
7 ...               AND    Get OvsDebugInfo
8 Library           SSHLibrary
9 Library           OperatingSystem
10 Library           RequestsLibrary
11 Resource          ../../../libraries/Utils.robot
12 Resource          ../../../libraries/OpenStackOperations.robot
13 Resource          ../../../libraries/DevstackUtils.robot
14 Resource          ../../../libraries/ClusterManagement.robot
15
16 *** Variables ***
17 @{NETWORKS_NAME}    l3_net_1    l3_net_2
18 @{SUBNETS_NAME}    l3_sub_net_1    l3_sub_net_2
19 @{NET_1_VM_INSTANCES}    VmInstance1_net_1    VmInstance2_net_1    VmInstance3_net_1
20 @{NET_2_VM_INSTANCES}    VmInstance1_net_2    VmInstance2_net_2    VmInstance3_net_2
21 @{NET_1_VM_IPS}    90.0.0.3    90.0.0.4    90.0.0.5
22 @{NET_2_VM_IPS}    100.0.0.3    100.0.0.4    100.0.0.5
23 @{GATEWAY_IPS}    90.0.0.1    100.0.0.1
24 @{DHCP_IPS}       90.0.0.2    100.0.0.2
25 @{SUBNETS_RANGE}    90.0.0.0/24    100.0.0.0/24
26 @{odl_1_and_2_down}    ${1}    ${2}
27 @{odl_2_and_3_down}    ${2}    ${3}
28
29 *** Test Cases ***
30 Create All Controller Sessions
31     [Documentation]    Create sessions for all three contorllers.
32     ClusterManagement.ClusterManagement Setup
33
34 Create Networks
35     [Documentation]    Create Network with neutron request.
36     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
37     \    OpenStackOperations.Create Network    ${NetworkElement}
38
39 Create Subnets For l3_net_1
40     [Documentation]    Create Sub Nets for the Networks with neutron request.
41     OpenStackOperations.Create SubNet    l3_net_1    l3_sub_net_1    @{SUBNETS_RANGE}[0]
42
43 Create Subnets For l3_net_2
44     [Documentation]    Create Sub Nets for the Networks with neutron request.
45     OpenStackOperations.Create SubNet    l3_net_2    l3_sub_net_2    @{SUBNETS_RANGE}[1]
46
47 Take Down ODL1
48     [Documentation]    Kill the karaf in First Controller
49     ClusterManagement.Kill Single Member    1
50
51 Create Vm Instances For l3_net_1
52     [Documentation]    Create Four Vm instances using flavor and image names for a network.
53     OpenStackOperations.Create Vm Instances    l3_net_1    ${NET_1_VM_INSTANCES}    sg=csit
54
55 Bring Up ODL1
56     [Documentation]    Bring up ODL1 again
57     ClusterManagement.Start Single Member    1
58
59 Take Down ODL2
60     [Documentation]    Kill the karaf in Second Controller
61     ClusterManagement.Kill Single Member    2
62
63 Create Vm Instances For l3_net_2
64     [Documentation]    Create Four Vm instances using flavor and image names for a network.
65     OpenStackOperations.Create Vm Instances    l3_net_2    ${NET_2_VM_INSTANCES}    sg=csit
66
67 Bring Up ODL2
68     [Documentation]    Bring up ODL2 again
69     ClusterManagement.Start Single Member    2
70
71 Take Down ODL3
72     [Documentation]    Kill the karaf in Third Controller
73     ClusterManagement.Kill Single Member    3
74
75 Create Router router_2
76     [Documentation]    Create Router and Add Interface to the subnets. this fails sometimes.
77     OpenStackOperations.Create Router    router_2
78     [Teardown]    Report_Failure_Due_To_Bug    6117
79
80 Create Router router_3
81     [Documentation]    Create Router and Add Interface to the subnets.
82     OpenStackOperations.Create Router    router_3
83
84 Add Interfaces To Router
85     [Documentation]    Add Interfaces
86     : FOR    ${interface}    IN    @{SUBNETS_NAME}
87     \    OpenStackOperations.Add Router Interface    router_3    ${interface}
88
89 Verify Created Routers
90     [Documentation]    Check created routers using northbound rest calls
91     ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
92     Log    ${data}
93     Should Contain    ${data}    router_3
94
95 Bring Up ODL3
96     [Documentation]    Bring up ODL3 again
97     ClusterManagement.Start Single Member    3
98
99 Ping Vm Instance1 In l3_net_2 From l3_net_1
100     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
101     Get OvsDebugInfo
102     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_1    @{NET_2_VM_IPS}[0]
103
104 Ping Vm Instance2 In l3_net_2 From l3_net_1
105     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
106     Get OvsDebugInfo
107     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_1    @{NET_2_VM_IPS}[1]
108
109 Ping Vm Instance3 In l3_net_2 From l3_net_1
110     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
111     Get OvsDebugInfo
112     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_1    @{NET_2_VM_IPS}[2]
113
114 Ping Vm Instance1 In l3_net_1 From l3_net_2
115     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
116     Get OvsDebugInfo
117     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_2    @{NET_1_VM_IPS}[0]
118
119 Ping Vm Instance2 In l3_net_1 From l3_net_2
120     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
121     Get OvsDebugInfo
122     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_2    @{NET_1_VM_IPS}[1]
123
124 Ping Vm Instance3 In l3_net_1 From l3_net_2
125     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
126     Get OvsDebugInfo
127     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_2    @{NET_1_VM_IPS}[2]
128
129 Take Down ODL1 and ODL2
130     [Documentation]    Kill the karaf in First and Second Controller
131     ClusterManagement.Kill Members From List Or All    ${odl_1_and_2_down}
132
133 Connectivity Tests From Vm Instance1 In l3_net_1
134     [Documentation]    Logging to the vm instance using generated key pair.
135     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[1]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
136     Log    ${dst_ip_list}
137     ${other_dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]    @{NET_2_VM_IPS}[1]
138     Log    ${other_dst_ip_list}
139     Get OvsDebugInfo
140     OpenStackOperations.Test Operations From Vm Instance    l3_net_1    @{NET_1_VM_IPS}[0]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
141
142 Connectivity Tests From Vm Instance2 In l3_net_1
143     [Documentation]    Logging to the vm instance using generated key pair.
144     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
145     Log    ${dst_ip_list}
146     ${other_dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
147     Log    ${other_dst_ip_list}
148     Get OvsDebugInfo
149     OpenStackOperations.Test Operations From Vm Instance    l3_net_1    @{NET_1_VM_IPS}[1]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
150
151 Connectivity Tests From Vm Instance3 In l3_net_1
152     [Documentation]    Logging to the vm instance using generated key pair.
153     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]
154     Log    ${dst_ip_list}
155     ${other_dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
156     Log    ${other_dst_ip_list}
157     Get OvsDebugInfo
158     OpenStackOperations.Test Operations From Vm Instance    l3_net_1    @{NET_1_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
159
160 Bring Up ODL1 and ODL2
161     [Documentation]    Bring up ODL1 and ODL2 again
162     ClusterManagement.Start Members From List Or All    ${odl_1_and_2_down}
163
164 Take Down ODL2 and ODL3
165     [Documentation]    Kill the karaf in First and Second Controller
166     ClusterManagement.Kill Members From List Or All    ${odl_2_and_3_down}
167
168 Connectivity Tests From Vm Instance1 In l3_net_2
169     [Documentation]    Logging to the vm instance using generated key pair.
170     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[1]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
171     Log    ${dst_ip_list}
172     ${other_dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
173     Log    ${other_dst_ip_list}
174     Get OvsDebugInfo
175     OpenStackOperations.Test Operations From Vm Instance    l3_net_2    @{NET_2_VM_IPS}[0]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
176
177 Connectivity Tests From Vm Instance2 In l3_net_2
178     [Documentation]    Logging to the vm instance using generated key pair.
179     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
180     Log    ${dst_ip_list}
181     ${other_dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
182     Log    ${other_dst_ip_list}
183     Get OvsDebugInfo
184     OpenStackOperations.Test Operations From Vm Instance    l3_net_2    @{NET_2_VM_IPS}[1]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
185
186 Connectivity Tests From Vm Instance3 In l3_net_2
187     [Documentation]    Logging to the vm instance using generated key pair.
188     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[1]
189     Log    ${dst_ip_list}
190     ${other_dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
191     Log    ${other_dst_ip_list}
192     Get OvsDebugInfo
193     OpenStackOperations.Test Operations From Vm Instance    l3_net_2    @{NET_2_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
194
195 Bring Up ODL2 and ODL3
196     [Documentation]    Bring up ODL2 and ODL3 again.
197     ClusterManagement.Start Members From List Or All    ${odl_2_and_3_down}
198
199 Delete Vm Instances In l3_net_1
200     [Documentation]    Delete Vm instances using instance names in l3_net_1.
201     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
202     \    OpenStackOperations.Delete Vm Instance    ${VmElement}
203
204 Delete Vm Instances In l3_net_2
205     [Documentation]    Delete Vm instances using instance names in l3_net_2.
206     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
207     \    OpenStackOperations.Delete Vm Instance    ${VmElement}
208
209 Delete Router Interfaces
210     [Documentation]    Remove Interface to the subnets.
211     : FOR    ${interface}    IN    @{SUBNETS_NAME}
212     \    OpenStackOperations.Remove Interface    router_3    ${interface}
213
214 Delete Routers
215     [Documentation]    Delete Router and Interface to the subnets.
216     OpenStackOperations.Delete Router    router_2
217     OpenStackOperations.Delete Router    router_3
218
219 Verify Deleted Routers
220     [Documentation]    Check deleted routers using northbound rest calls
221     ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
222     Log    ${data}
223     Should Not Contain    ${data}    router_3
224
225 Delete Sub Networks In l3_net_1
226     [Documentation]    Delete Sub Nets for the Networks with neutron request.
227     OpenStackOperations.Delete SubNet    l3_sub_net_1
228
229 Delete Sub Networks In l3_net_2
230     [Documentation]    Delete Sub Nets for the Networks with neutron request.
231     OpenStackOperations.Delete SubNet    l3_sub_net_2
232
233 Delete Networks
234     [Documentation]    Delete Networks with neutron request.
235     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
236     \    OpenStackOperations.Delete Network    ${NetworkElement}