Add missing create sg in ha l3
[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 Add Ssh Allow Rule
50     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
51     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
52
53 Take Down ODL1
54     [Documentation]    Kill the karaf in First Controller
55     ClusterManagement.Kill Single Member    1
56
57 Create Vm Instances For l3_net_1
58     [Documentation]    Create Four Vm instances using flavor and image names for a network.
59     OpenStackOperations.Create Vm Instances    l3_net_1    ${NET_1_VM_INSTANCES}    sg=${SECURITY_GROUP}
60
61 Bring Up ODL1
62     [Documentation]    Bring up ODL1 again
63     ClusterManagement.Start Single Member    1
64
65 Take Down ODL2
66     [Documentation]    Kill the karaf in Second Controller
67     ClusterManagement.Kill Single Member    2
68
69 Create Vm Instances For l3_net_2
70     [Documentation]    Create Four Vm instances using flavor and image names for a network.
71     OpenStackOperations.Create Vm Instances    l3_net_2    ${NET_2_VM_INSTANCES}    sg=${SECURITY_GROUP}
72
73 Check Vm Instances Have Ip Address
74     [Documentation]    Test case to verify that all created VMs are ready and have received their ip addresses.
75     ...    We are polling first and longest on the last VM created assuming that if it's received it's address
76     ...    already the other instances should have theirs already or at least shortly thereafter.
77     # first, ensure all VMs are in ACTIVE state.    if not, we can just fail the test case and not waste time polling
78     # for dhcp addresses
79     @{NET1_L3_VM_IPS}    ${NET1_DHCP_IP} =    Get VM IPs    @{NET_1_VM_INSTANCES}
80     @{NET2_L3_VM_IPS}    ${NET2_DHCP_IP} =    Get VM IPs    @{NET_2_VM_INSTANCES}
81     Set Suite Variable    @{NET1_L3_VM_IPS}
82     Set Suite Variable    @{NET2_L3_VM_IPS}
83     Should Not Contain    ${NET1_L3_VM_IPS}    None
84     Should Not Contain    ${NET2_L3_VM_IPS}    None
85     Should Not Contain    ${NET1_DHCP_IP}    None
86     Should Not Contain    ${NET2_DHCP_IP}    None
87     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
88     ...    AND    Get Test Teardown Debugs
89
90 Bring Up ODL2
91     [Documentation]    Bring up ODL2 again
92     ClusterManagement.Start Single Member    2
93
94 Take Down ODL3
95     [Documentation]    Kill the karaf in Third Controller
96     ClusterManagement.Kill Single Member    3
97
98 Create Router router_2
99     [Documentation]    Create Router and Add Interface to the subnets. this fails sometimes.
100     OpenStackOperations.Create Router    router_2
101     [Teardown]    Report_Failure_Due_To_Bug    6117
102
103 Create Router router_3
104     [Documentation]    Create Router and Add Interface to the subnets.
105     OpenStackOperations.Create Router    router_3
106
107 Add Interfaces To Router
108     [Documentation]    Add Interfaces
109     : FOR    ${interface}    IN    @{SUBNETS_NAME}
110     \    OpenStackOperations.Add Router Interface    router_3    ${interface}
111
112 Verify Created Routers
113     [Documentation]    Check created routers using northbound rest calls
114     ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
115     Log    ${data}
116     Should Contain    ${data}    router_3
117
118 Bring Up ODL3
119     [Documentation]    Bring up ODL3 again
120     ClusterManagement.Start Single Member    3
121
122 Ping Vm Instance1 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}[0]
125
126 Ping Vm Instance2 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}[1]
129
130 Ping Vm Instance3 In l3_net_2 From l3_net_1
131     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
132     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_1    @{NET2_L3_VM_IPS}[2]
133
134 Ping Vm Instance1 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}[0]
137
138 Ping Vm Instance2 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}[1]
141
142 Ping Vm Instance3 In l3_net_1 From l3_net_2
143     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
144     OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_2    @{NET1_L3_VM_IPS}[2]
145
146 Take Down ODL1 and ODL2
147     [Documentation]    Kill the karaf in First and Second Controller
148     ClusterManagement.Kill Members From List Or All    ${odl_1_and_2_down}
149     [Teardown]    Get OvsDebugInfo
150
151 Connectivity Tests From Vm Instance1 In l3_net_1
152     [Documentation]    ssh to the VM instance and test operations.
153     ${dst_ip_list}=    Create List    @{NET2_L3_VM_IPS}    @{NET1_L3_VM_IPS}
154     Log    ${dst_ip_list}
155     OpenStackOperations.Test Operations From Vm Instance    l3_net_1    @{NET1_L3_VM_IPS}[0]    ${dst_ip_list}
156     [Teardown]    Get OvsDebugInfo
157
158 Connectivity Tests From Vm Instance2 In l3_net_1
159     [Documentation]    ssh to the VM instance and test operations.
160     ${dst_ip_list}=    Create List    @{NET2_L3_VM_IPS}    @{NET1_L3_VM_IPS}
161     Log    ${dst_ip_list}
162     OpenStackOperations.Test Operations From Vm Instance    l3_net_1    @{NET1_L3_VM_IPS}[1]    ${dst_ip_list}
163     [Teardown]    Get OvsDebugInfo
164
165 Connectivity Tests From Vm Instance3 In l3_net_1
166     [Documentation]    ssh to the VM instance and test operations.
167     ${dst_ip_list}=    Create List    @{NET2_L3_VM_IPS}    @{NET1_L3_VM_IPS}
168     Log    ${dst_ip_list}
169     OpenStackOperations.Test Operations From Vm Instance    l3_net_1    @{NET1_L3_VM_IPS}[2]    ${dst_ip_list}
170     [Teardown]    Get OvsDebugInfo
171
172 Bring Up ODL1 and ODL2
173     [Documentation]    Bring up ODL1 and ODL2 again
174     ClusterManagement.Start Members From List Or All    ${odl_1_and_2_down}
175
176 Take Down ODL2 and ODL3
177     [Documentation]    Kill the karaf in First and Second Controller
178     ClusterManagement.Kill Members From List Or All    ${odl_2_and_3_down}
179     [Teardown]    Get OvsDebugInfo
180
181 Connectivity Tests From Vm Instance1 In l3_net_2
182     [Documentation]    ssh to the VM instance and test operations.
183     ${dst_ip_list}=    Create List    @{NET2_L3_VM_IPS}    @{NET1_L3_VM_IPS}
184     Log    ${dst_ip_list}
185     OpenStackOperations.Test Operations From Vm Instance    l3_net_2    @{NET2_L3_VM_IPS}[0]    ${dst_ip_list}
186     [Teardown]    Get OvsDebugInfo
187
188 Connectivity Tests From Vm Instance2 In l3_net_2
189     [Documentation]    ssh to the VM instance and test operations.
190     ${dst_ip_list}=    Create List    @{NET2_L3_VM_IPS}    @{NET1_L3_VM_IPS}
191     Log    ${dst_ip_list}
192     OpenStackOperations.Test Operations From Vm Instance    l3_net_2    @{NET2_L3_VM_IPS}[1]    ${dst_ip_list}
193     [Teardown]    Get OvsDebugInfo
194
195 Connectivity Tests From Vm Instance3 In l3_net_2
196     [Documentation]    ssh to the VM instance and test operations.
197     ${dst_ip_list}=    Create List    @{NET2_L3_VM_IPS}    @{NET1_L3_VM_IPS}
198     Log    ${dst_ip_list}
199     OpenStackOperations.Test Operations From Vm Instance    l3_net_2    @{NET2_L3_VM_IPS}[2]    ${dst_ip_list}
200     [Teardown]    Get OvsDebugInfo
201
202 Bring Up ODL2 and ODL3
203     [Documentation]    Bring up ODL2 and ODL3 again.
204     ClusterManagement.Start Members From List Or All    ${odl_2_and_3_down}
205
206 Delete Vm Instances In l3_net_1
207     [Documentation]    Delete Vm instances using instance names in l3_net_1.
208     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
209     \    OpenStackOperations.Delete Vm Instance    ${VmElement}
210
211 Delete Vm Instances In l3_net_2
212     [Documentation]    Delete Vm instances using instance names in l3_net_2.
213     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
214     \    OpenStackOperations.Delete Vm Instance    ${VmElement}
215
216 Delete Router Interfaces
217     [Documentation]    Remove Interface to the subnets.
218     : FOR    ${interface}    IN    @{SUBNETS_NAME}
219     \    OpenStackOperations.Remove Interface    router_3    ${interface}
220
221 Delete Routers
222     [Documentation]    Delete Router and Interface to the subnets.
223     OpenStackOperations.Delete Router    router_2
224     OpenStackOperations.Delete Router    router_3
225
226 Verify Deleted Routers
227     [Documentation]    Check deleted routers using northbound rest calls
228     ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
229     Log    ${data}
230     Should Not Contain    ${data}    router_3
231
232 Delete Sub Networks In l3_net_1
233     [Documentation]    Delete Sub Nets for the Networks with neutron request.
234     OpenStackOperations.Delete SubNet    l3_sub_net_1
235
236 Delete Sub Networks In l3_net_2
237     [Documentation]    Delete Sub Nets for the Networks with neutron request.
238     OpenStackOperations.Delete SubNet    l3_sub_net_2
239
240 Delete Networks
241     [Documentation]    Delete Networks with neutron request.
242     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
243     \    OpenStackOperations.Delete Network    ${NetworkElement}
244
245 Delete Security Group
246     [Documentation]    Delete security groups with neutron request
247     Delete SecurityGroup    ${SECURITY_GROUP}
248
249 Verify Flows Cleanup
250     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
251     Verify Flows Are Cleaned Up On All OpenStack Nodes