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