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