b7ad7bbdffb79c291dc60c41cc5887d49b9b8bc5
[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_IPS}
6 ...               AND    Show Debugs    ${NET_2_VM_IPS}
7 ...               AND    Get OvsDebugInfoLibrary           SSHLibrary
8 Library           OperatingSystem
9 Library           RequestsLibrary
10 Resource          ../../../libraries/Utils.robot
11 Resource          ../../../libraries/OpenStackOperations.robot
12 Resource          ../../../libraries/DevstackUtils.robot
13 Resource          ../../../libraries/ClusterManagement.robot
14
15 *** Variables ***
16 @{NETWORKS_NAME}    l3_net_1    l3_net_2
17 @{SUBNETS_NAME}    l3_sub_net_1    l3_sub_net_2
18 @{NET_1_VM_INSTANCES}    VmInstance1_net_1    VmInstance2_net_1    VmInstance3_net_1
19 @{NET_2_VM_INSTANCES}    VmInstance1_net_2    VmInstance2_net_2    VmInstance3_net_2
20 @{NET_1_VM_IPS}    90.0.0.3    90.0.0.4    90.0.0.5
21 @{NET_2_VM_IPS}    100.0.0.3    100.0.0.4    100.0.0.5
22 @{GATEWAY_IPS}    90.0.0.1    100.0.0.1
23 @{DHCP_IPS}       90.0.0.2    100.0.0.2
24 @{SUBNETS_RANGE}    90.0.0.0/24    100.0.0.0/24
25 @{odl_1_and_2_down}    ${1}    ${2}
26 @{odl_2_and_3_down}    ${2}    ${3}
27
28 *** Test Cases ***
29 Create All Controller Sessions
30     [Documentation]    Create sessions for all three contorllers.
31     ClusterManagement.ClusterManagement Setup
32
33 Create Networks
34     [Documentation]    Create Network with neutron request.
35     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
36     \    OpenStackOperations.Create Network    ${NetworkElement}
37
38 Create Subnets For l3_net_1
39     [Documentation]    Create Sub Nets for the Networks with neutron request.
40     OpenStackOperations.Create SubNet    l3_net_1    l3_sub_net_1    @{SUBNETS_RANGE}[0]
41
42 Create Subnets For l3_net_2
43     [Documentation]    Create Sub Nets for the Networks with neutron request.
44     OpenStackOperations.Create SubNet    l3_net_2    l3_sub_net_2    @{SUBNETS_RANGE}[1]
45
46 Take Down ODL1
47     [Documentation]    Kill the karaf in First Controller
48     ClusterManagement.Kill Single Member    1
49
50 Create Vm Instances For l3_net_1
51     [Documentation]    Create Four Vm instances using flavor and image names for a network.
52     OpenStackOperations.Create Vm Instances    l3_net_1    ${NET_1_VM_INSTANCES}     sg=csit
53     [Teardown]    OpenStackOperations.Show Debugs    ${NET_1_VM_INSTANCES}
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     [Teardown]    Show Debugs    ${NET_2_VM_INSTANCES}
67
68 Bring Up ODL2
69     [Documentation]    Bring up ODL2 again
70     ClusterManagement.Start Single Member    2
71
72 Take Down ODL3
73     [Documentation]    Kill the karaf in Third Controller
74     ClusterManagement.Kill Single Member    3
75
76 Create Router router_2
77     [Documentation]    Create Router and Add Interface to the subnets. this fails sometimes.
78     OpenStackOperations.Create Router    router_2
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}