Add Security Rule to allow SSH and fix CSIT
[integration/test.git] / csit / suites / openstack / clustering / 01_l2_tests.robot
1 *** Settings ***
2 Documentation     Test suite to verify packet flows between vm instances.
3 Suite Setup       Devstack Suite Setup Tests    source_pwd=yes
4 Suite Teardown    Close All Connections
5 Library           SSHLibrary
6 Library           OperatingSystem
7 Library           RequestsLibrary
8 Library           Collections
9 Resource          ../../../libraries/Utils.robot
10 Resource          ../../../libraries/OpenStackOperations.robot
11 Resource          ../../../libraries/DevstackUtils.robot
12 Resource          ../../../libraries/OVSDB.robot
13 Resource          ../../../libraries/ClusterOvsdb.robot
14 Resource          ../../../libraries/ClusterManagement.robot
15 Variables         ../../../variables/Variables.py
16
17 *** Variables ***
18 @{NETWORKS_NAME}    l2_net_1    l2_net_2
19 @{SUBNETS_NAME}    l2_sub_net_1    l2_sub_net_2
20 @{NET_1_VM_INSTANCES}    VmInstance1_l2_net_1    VmInstance2_net_1    VmInstance3_net_1
21 @{NET_2_VM_INSTANCES}    VmInstance1_l2_net_2    VmInstance2_net_2    VmInstance3_net_2
22 @{NET_1_VM_IPS}    70.0.0.3    70.0.0.4    70.0.0.5
23 @{NET_2_VM_IPS}    80.0.0.3    80.0.0.4    80.0.0.5
24 @{VM_IPS_NOT_DELETED}    70.0.0.4
25 @{GATEWAY_IPS}    70.0.0.1    80.0.0.1
26 @{DHCP_IPS}       70.0.0.2    80.0.0.2
27 @{cluster_down_list}    ${1}    ${2}
28 @{SUBNETS_RANGE}    70.0.0.0/24    80.0.0.0/24
29
30 *** Test Cases ***
31 Create All Controller Sessions
32     [Documentation]    Create sessions for all three contorllers.
33     ClusterManagement.ClusterManagement Setup
34
35 Check OVS Manager Connection Status
36     [Documentation]    This will verify if the OVS manager is connected
37     ${output}=    Wait Until Keyword Succeeds    5s    1s    Ovsdb.Verify OVS Reports Connected    ${OS_CONTROL_NODE_IP}
38     Log    ${output}
39     Set Suite Variable    ${status}    is_connected: true
40     ${dictionary}=    Create Dictionary    ${status}=9
41     Utils.Check Item Occurrence    ${output}    ${dictionary}
42
43 Create Networks
44     [Documentation]    Create Network with neutron request.
45     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
46     \    OpenStackOperations.Create Network    ${NetworkElement}
47
48 Create Subnets For l2_net_1
49     [Documentation]    Create Sub Nets for the Networks with neutron request.
50     OpenStackOperations.Create SubNet    l2_net_1    l2_sub_net_1    @{SUBNETS_RANGE}[0]
51
52 Create Subnets For l2_net_2
53     [Documentation]    Create Sub Nets for the Networks with neutron request.
54     OpenStackOperations.Create SubNet    l2_net_2    l2_sub_net_2    @{SUBNETS_RANGE}[1]
55
56 Create Bridge Manually and Verify Before Fail
57     [Documentation]    Create bridge with OVS command and verify it gets applied from all instances.
58     ClusterOvsdb.Create Sample Bridge Manually And Verify    ${OS_CONTROL_NODE_IP}
59
60 Add Tap Device Manually and Verify Before Fail
61     [Documentation]    Add tap devices to the bridge with OVS command and verify it gets applied from all instances.
62     ClusterOvsdb.Add Sample Tap Device To The Manual Bridge And Verify    ${OS_CONTROL_NODE_IP}
63
64 Delete the Bridge Manually and Verify Before Fail
65     [Documentation]    Delete bridge with OVS command and verify it gets deleted from all instances.
66     ClusterOvsdb.Delete Sample Bridge Manually And Verify    ${OS_CONTROL_NODE_IP}
67
68 Take Down ODL1
69     [Documentation]    Kill the karaf in First Controller
70     ${new_cluster_list} =    ClusterManagement.Kill Single Member    1
71     Set Suite Variable    ${new_cluster_list}
72
73 Create Bridge Manually and Verify After Fail
74     [Documentation]    Create bridge with OVS command and verify it gets applied from all instances.
75     ClusterOvsdb.Create Sample Bridge Manually And Verify    ${OS_CONTROL_NODE_IP}    ${new_cluster_list}
76
77 Add Tap Device Manually and Verify After Fail
78     [Documentation]    Add tap devices to the bridge with OVS command and verify it gets applied from all instances.
79     ClusterOvsdb.Add Sample Tap Device To The Manual Bridge And Verify    ${OS_CONTROL_NODE_IP}    ${new_cluster_list}
80
81 Delete the Bridge Manually and Verify After Fail
82     [Documentation]    Delete bridge with OVS command and verify it gets deleted from all instances.
83     ClusterOvsdb.Delete Sample Bridge Manually And Verify    ${OS_CONTROL_NODE_IP}    ${new_cluster_list}
84
85 Create Vm Instances For l2_net_1
86     [Documentation]    Create Vm instances using flavor and image names for a network.
87     Log    ${devstack_conn_id}
88     OpenStackOperations.Create Vm Instances    l2_net_1    ${NET_1_VM_INSTANCES}     sg=csit
89     [Teardown]    OpenStackOperations.Show Debugs    ${NET_1_VM_INSTANCES}
90
91 Bring Up ODL1
92     [Documentation]    Bring up ODL1 again
93     ClusterManagement.Start Single Member    1
94
95 Create Bridge Manually and Verify After Recover
96     [Documentation]    Create bridge with OVS command and verify it gets applied from all instances.
97     ClusterOvsdb.Create Sample Bridge Manually And Verify    ${OS_CONTROL_NODE_IP}
98
99 Add Tap Device Manually and Verify After Recover
100     [Documentation]    Add tap devices to the bridge with OVS command and verify it gets applied from all instances.
101     ClusterOvsdb.Add Sample Tap Device To The Manual Bridge And Verify    ${OS_CONTROL_NODE_IP}
102
103 Delete the Bridge Manually and Verify After Recover
104     [Documentation]    Delete bridge with OVS command and verify it gets deleted from all instances.
105     ClusterOvsdb.Delete Sample Bridge Manually And Verify    ${OS_CONTROL_NODE_IP}
106
107 Take Down ODL2
108     [Documentation]    Kill the karaf in Second Controller
109     ClusterManagement.Kill Single Member    2
110
111 Create Vm Instances For l2_net_2
112     [Documentation]    Create Vm instances using flavor and image names for a network.
113     OpenStackOperations.Create Vm Instances    l2_net_2    ${NET_2_VM_INSTANCES}      sg=csit
114     [Teardown]    OpenStackOperations.Show Debugs    ${NET_2_VM_INSTANCES}
115
116 Bring Up ODL2
117     [Documentation]    Bring up ODL2 again
118     ClusterManagement.Start Single Member    2
119
120 Ping Vm Instance1 In l2_net_1
121     [Documentation]    Check reachability of vm instances by pinging to them.
122     OpenStackOperations.Ping Vm From DHCP Namespace    l2_net_1    @{NET_1_VM_IPS}[0]
123
124 Ping Vm Instance2 In l2_net_1
125     [Documentation]    Check reachability of vm instances by pinging to them.
126     OpenStackOperations.Ping Vm From DHCP Namespace    l2_net_1    @{NET_1_VM_IPS}[1]
127
128 Ping Vm Instance3 In l2_net_1
129     [Documentation]    Check reachability of vm instances by pinging to them.
130     OpenStackOperations.Ping Vm From DHCP Namespace    l2_net_1    @{NET_1_VM_IPS}[2]
131
132 Ping Vm Instance1 In l2_net_2
133     [Documentation]    Check reachability of vm instances by pinging to them.
134     OpenStackOperations.Ping Vm From DHCP Namespace    l2_net_2    @{NET_2_VM_IPS}[0]
135
136 Ping Vm Instance2 In l2_net_2
137     [Documentation]    Check reachability of vm instances by pinging to them.
138     OpenStackOperations.Ping Vm From DHCP Namespace    l2_net_2    @{NET_2_VM_IPS}[1]
139
140 Ping Vm Instance3 In l2_net_2
141     [Documentation]    Check reachability of vm instances by pinging to them.
142     OpenStackOperations.Ping Vm From DHCP Namespace    l2_net_2    @{NET_2_VM_IPS}[2]
143
144 Take Down ODL3
145     [Documentation]    Kill the karaf in Third Controller
146     ClusterManagement.Kill Single Member    3
147
148 Connectivity Tests From Vm Instance1 In l2_net_1
149     [Documentation]    Logging to the vm instance using generated key pair.
150     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[1]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
151     Log    ${dst_ip_list}
152     OpenStackOperations.Test Operations From Vm Instance    l2_net_1    @{NET_1_VM_IPS}[0]    ${dst_ip_list}
153
154 Connectivity Tests From Vm Instance2 In l2_net_1
155     [Documentation]    Logging to the vm instance using generated key pair.
156     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
157     Log    ${dst_ip_list}
158     OpenStackOperations.Test Operations From Vm Instance    l2_net_1    @{NET_1_VM_IPS}[1]    ${dst_ip_list}
159
160 Connectivity Tests From Vm Instance3 In l2_net_1
161     [Documentation]    Logging to the vm instance using generated key pair.
162     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]
163     Log    ${dst_ip_list}
164     OpenStackOperations.Test Operations From Vm Instance    l2_net_1    @{NET_1_VM_IPS}[2]    ${dst_ip_list}
165
166 Bring Up ODL3
167     [Documentation]    Bring up ODL3 again
168     ClusterManagement.Start Single Member    3
169
170 Take Down ODL1 and ODL2
171     [Documentation]    Kill the karaf in First and Second Controller
172     ClusterManagement.Kill Members From List Or All    ${cluster_down_list}
173
174 Connectivity Tests From Vm Instance1 In l2_net_2
175     [Documentation]    Logging to the vm instance using generated key pair.
176     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[1]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
177     Log    ${dst_ip_list}
178     OpenStackOperations.Test Operations From Vm Instance    l2_net_2    @{NET_2_VM_IPS}[0]    ${dst_ip_list}
179
180 Connectivity Tests From Vm Instance2 In l2_net_2
181     [Documentation]    Logging to the vm instance using generated key pair.
182     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
183     Log    ${dst_ip_list}
184     OpenStackOperations.Test Operations From Vm Instance    l2_net_2    @{NET_2_VM_IPS}[1]    ${dst_ip_list}
185
186 Connectivity Tests From Vm Instance3 In l2_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     OpenStackOperations.Test Operations From Vm Instance    l2_net_2    @{NET_2_VM_IPS}[2]    ${dst_ip_list}
191
192 Bring Up ODL1 and ODL2
193     [Documentation]    Bring up ODL1 and ODL2 again.
194     ClusterManagement.Start Members From List Or All    ${cluster_down_list}
195
196 Delete Vm Instance
197     [Documentation]    Delete Vm instances using instance names.
198     OpenStackOperations.Delete Vm Instance    VmInstance1_l2_net_1
199
200 No Ping For Deleted Vm
201     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
202     ${output}=    OpenStackOperations.Ping From DHCP Should Not Succeed    l2_network_1    @{NET_1_VM_IPS}[0]
203
204 Delete Vm Instances In network_1
205     [Documentation]    Delete Vm instances using instance names in network_1.
206     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
207     \    OpenStackOperations.Delete Vm Instance    ${VmElement}
208
209 Delete Vm Instances In network_2
210     [Documentation]    Delete Vm instances using instance names in network_2.
211     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
212     \    OpenStackOperations.Delete Vm Instance    ${VmElement}
213
214 Delete Sub Networks In network_1
215     [Documentation]    Delete Sub Nets for the Networks with neutron request.
216     OpenStackOperations.Delete SubNet    l2_sub_net_1
217
218 Delete Sub Networks In network_2
219     [Documentation]    Delete Sub Nets for the Networks with neutron request.
220     OpenStackOperations.Delete SubNet    l2_sub_net_2
221
222 Delete Networks
223     [Documentation]    Delete Networks with neutron request.
224     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
225     \    OpenStackOperations.Delete Network    ${NetworkElement}