netvirt-csit: Show neutron debugs only once
[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    source_pwd=yes
4 Suite Teardown    Close All Connections
5 Test Teardown     Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
6 ...               AND    Get OvsDebugInfo
7 Library           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
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}    sg=csit
65
66 Bring Up ODL2
67     [Documentation]    Bring up ODL2 again
68     ClusterManagement.Start Single Member    2
69
70 Take Down ODL3
71     [Documentation]    Kill the karaf in Third Controller
72     ClusterManagement.Kill Single Member    3
73
74 Create Router router_2
75     [Documentation]    Create Router and Add Interface to the subnets. this fails sometimes.
76     OpenStackOperations.Create Router    router_2
77     [Teardown]    Report_Failure_Due_To_Bug    6117
78
79 Create Router router_3
80     [Documentation]    Create Router and Add Interface to the subnets.
81     OpenStackOperations.Create Router    router_3
82
83 Add Interfaces To Router
84     [Documentation]    Add Interfaces
85     : FOR    ${interface}    IN    @{SUBNETS_NAME}
86     \    OpenStackOperations.Add Router Interface    router_3    ${interface}
87
88 Verify Created Routers
89     [Documentation]    Check created routers using northbound rest calls
90     ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
91     Log    ${data}
92     Should Contain    ${data}    router_3
93
94 Bring Up ODL3
95     [Documentation]    Bring up ODL3 again
96     ClusterManagement.Start Single Member    3
97
98 Ping Vm Instance1 In l3_net_2 From l3_net_1
99     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
100     Get OvsDebugInfo
101     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_1    @{NET_2_VM_IPS}[0]
102
103 Ping Vm Instance2 In l3_net_2 From l3_net_1
104     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
105     Get OvsDebugInfo
106     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_1    @{NET_2_VM_IPS}[1]
107
108 Ping Vm Instance3 In l3_net_2 From l3_net_1
109     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
110     Get OvsDebugInfo
111     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_1    @{NET_2_VM_IPS}[2]
112
113 Ping Vm Instance1 In l3_net_1 From l3_net_2
114     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
115     Get OvsDebugInfo
116     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_2    @{NET_1_VM_IPS}[0]
117
118 Ping Vm Instance2 In l3_net_1 From l3_net_2
119     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
120     Get OvsDebugInfo
121     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_2    @{NET_1_VM_IPS}[1]
122
123 Ping Vm Instance3 In l3_net_1 From l3_net_2
124     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
125     Get OvsDebugInfo
126     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_2    @{NET_1_VM_IPS}[2]
127
128 Take Down ODL1 and ODL2
129     [Documentation]    Kill the karaf in First and Second Controller
130     ClusterManagement.Kill Members From List Or All    ${odl_1_and_2_down}
131
132 Connectivity Tests From Vm Instance1 In l3_net_1
133     [Documentation]    Logging to the vm instance using generated key pair.
134     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[1]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
135     Log    ${dst_ip_list}
136     ${other_dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]    @{NET_2_VM_IPS}[1]
137     Log    ${other_dst_ip_list}
138     Get OvsDebugInfo
139     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}
140
141 Connectivity Tests From Vm Instance2 In l3_net_1
142     [Documentation]    Logging to the vm instance using generated key pair.
143     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
144     Log    ${dst_ip_list}
145     ${other_dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
146     Log    ${other_dst_ip_list}
147     Get OvsDebugInfo
148     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}
149
150 Connectivity Tests From Vm Instance3 In l3_net_1
151     [Documentation]    Logging to the vm instance using generated key pair.
152     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]
153     Log    ${dst_ip_list}
154     ${other_dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
155     Log    ${other_dst_ip_list}
156     Get OvsDebugInfo
157     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}
158
159 Bring Up ODL1 and ODL2
160     [Documentation]    Bring up ODL1 and ODL2 again
161     ClusterManagement.Start Members From List Or All    ${odl_1_and_2_down}
162
163 Take Down ODL2 and ODL3
164     [Documentation]    Kill the karaf in First and Second Controller
165     ClusterManagement.Kill Members From List Or All    ${odl_2_and_3_down}
166
167 Connectivity Tests From Vm Instance1 In l3_net_2
168     [Documentation]    Logging to the vm instance using generated key pair.
169     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[1]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
170     Log    ${dst_ip_list}
171     ${other_dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
172     Log    ${other_dst_ip_list}
173     Get OvsDebugInfo
174     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}
175
176 Connectivity Tests From Vm Instance2 In l3_net_2
177     [Documentation]    Logging to the vm instance using generated key pair.
178     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
179     Log    ${dst_ip_list}
180     ${other_dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
181     Log    ${other_dst_ip_list}
182     Get OvsDebugInfo
183     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}
184
185 Connectivity Tests From Vm Instance3 In l3_net_2
186     [Documentation]    Logging to the vm instance using generated key pair.
187     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[1]
188     Log    ${dst_ip_list}
189     ${other_dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
190     Log    ${other_dst_ip_list}
191     Get OvsDebugInfo
192     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}
193
194 Bring Up ODL2 and ODL3
195     [Documentation]    Bring up ODL2 and ODL3 again.
196     ClusterManagement.Start Members From List Or All    ${odl_2_and_3_down}
197
198 Delete Vm Instances In l3_net_1
199     [Documentation]    Delete Vm instances using instance names in l3_net_1.
200     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
201     \    OpenStackOperations.Delete Vm Instance    ${VmElement}
202
203 Delete Vm Instances In l3_net_2
204     [Documentation]    Delete Vm instances using instance names in l3_net_2.
205     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
206     \    OpenStackOperations.Delete Vm Instance    ${VmElement}
207
208 Delete Router Interfaces
209     [Documentation]    Remove Interface to the subnets.
210     : FOR    ${interface}    IN    @{SUBNETS_NAME}
211     \    OpenStackOperations.Remove Interface    router_3    ${interface}
212
213 Delete Routers
214     [Documentation]    Delete Router and Interface to the subnets.
215     OpenStackOperations.Delete Router    router_2
216     OpenStackOperations.Delete Router    router_3
217
218 Verify Deleted Routers
219     [Documentation]    Check deleted routers using northbound rest calls
220     ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
221     Log    ${data}
222     Should Not Contain    ${data}    router_3
223
224 Delete Sub Networks In l3_net_1
225     [Documentation]    Delete Sub Nets for the Networks with neutron request.
226     OpenStackOperations.Delete SubNet    l3_sub_net_1
227
228 Delete Sub Networks In l3_net_2
229     [Documentation]    Delete Sub Nets for the Networks with neutron request.
230     OpenStackOperations.Delete SubNet    l3_sub_net_2
231
232 Delete Networks
233     [Documentation]    Delete Networks with neutron request.
234     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
235     \    OpenStackOperations.Delete Network    ${NetworkElement}