Add Bridge And Tap Interface in Openstack Ovs
[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 Library           ../../../libraries/Common.py
15 Variables         ../../../variables/Variables.py
16 Resource          ../../../libraries/ClusterKeywords.robot
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     ClusterKeywords.Create Controller Sessions
35
36 Create Cluster List
37     [Documentation]    Create original cluster list.
38     ${original_cluster_list}    ClusterKeywords.Create Controller Index List
39     Set Suite Variable    ${original_cluster_list}
40     Log    ${original_cluster_list}
41
42 Check OVS Manager Connection Status
43     [Documentation]    This will verify if the OVS manager is connected
44     ${output}=    Wait Until Keyword Succeeds    5s    1s    Verify OVS Reports Connected    ${OS_CONTROL_NODE_IP}
45     Log    ${output}
46     Set Suite Variable    ${status}    is_connected: true
47     ${dictionary}=    Create Dictionary    ${status}=9
48     Utils.Check Item Occurrence    ${output}    ${dictionary}
49
50 Create Networks
51     [Documentation]    Create Network with neutron request.
52     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
53     \    Create Network    ${NetworkElement}
54
55 Create Subnets For l2_net_1
56     [Documentation]    Create Sub Nets for the Networks with neutron request.
57     Create SubNet    l2_net_1    l2_sub_net_1    @{SUBNETS_RANGE}[0]
58
59 Create Subnets For l2_net_2
60     [Documentation]    Create Sub Nets for the Networks with neutron request.
61     Create SubNet    l2_net_2    l2_sub_net_2    @{SUBNETS_RANGE}[1]
62
63 Create Bridge Manually and Verify Before Fail
64     [Documentation]    Create bridge with OVS command and verify it gets applied from all instances.
65     ClusterOvsdb.Create Sample Bridge Manually And Verify    ${original_cluster_list}    ${OS_CONTROL_NODE_IP}
66
67 Add Tap Device Manually and Verify Before Fail
68     [Documentation]    Add tap devices to the bridge with OVS command and verify it gets applied from all instances.
69     ClusterOvsdb.Add Sample Tap Device To The Manual Bridge And Verify    ${original_cluster_list}    ${OS_CONTROL_NODE_IP}
70
71 Delete the Bridge Manually and Verify Before Fail
72     [Documentation]    Delete bridge with OVS command and verify it gets deleted from all instances.
73     ClusterOvsdb.Delete Sample Bridge Manually And Verify    ${original_cluster_list}    ${OS_CONTROL_NODE_IP}
74
75 Take Down ODL1
76     [Documentation]    Kill the karaf in First Controller
77     ClusterKeywords.Kill Multiple Controllers    1
78     ${new_cluster_list}    ClusterKeywords.Create Controller Index List
79     Remove From List    ${new_cluster_list}    0
80     Set Suite Variable    ${new_cluster_list}
81
82 Create Bridge Manually and Verify After Fail
83     [Documentation]    Create bridge with OVS command and verify it gets applied from all instances.
84     ClusterOvsdb.Create Sample Bridge Manually And Verify    ${new_cluster_list}    ${OS_CONTROL_NODE_IP}
85
86 Add Tap Device Manually and Verify After Fail
87     [Documentation]    Add tap devices to the bridge with OVS command and verify it gets applied from all instances.
88     ClusterOvsdb.Add Sample Tap Device To The Manual Bridge And Verify    ${new_cluster_list}    ${OS_CONTROL_NODE_IP}
89
90 Delete the Bridge Manually and Verify After Fail
91     [Documentation]    Delete bridge with OVS command and verify it gets deleted from all instances.
92     ClusterOvsdb.Delete Sample Bridge Manually And Verify    ${new_cluster_list}    ${OS_CONTROL_NODE_IP}
93
94 Create Vm Instances For l2_net_1
95     [Documentation]    Create Vm instances using flavor and image names for a network.
96     Log    ${devstack_conn_id}
97     Create Vm Instances    l2_net_1    ${NET_1_VM_INSTANCES}
98     [Teardown]    Show Debugs    ${NET_1_VM_INSTANCES}
99
100 Bring Up ODL1
101     [Documentation]    Bring up ODL1 again
102     ClusterKeywords.Start Multiple Controllers    300s    1
103     ${new_cluster_list}    ClusterKeywords.Create Controller Index List
104     Set Suite Variable    ${new_cluster_list}
105
106 Create Bridge Manually and Verify After Recover
107     [Documentation]    Create bridge with OVS command and verify it gets applied from all instances.
108     ClusterOvsdb.Create Sample Bridge Manually And Verify    ${original_cluster_list}    ${OS_CONTROL_NODE_IP}
109
110 Add Tap Device Manually and Verify After Recover
111     [Documentation]    Add tap devices to the bridge with OVS command and verify it gets applied from all instances.
112     ClusterOvsdb.Add Sample Tap Device To The Manual Bridge And Verify    ${original_cluster_list}    ${OS_CONTROL_NODE_IP}
113
114 Delete the Bridge Manually and Verify After Recover
115     [Documentation]    Delete bridge with OVS command and verify it gets deleted from all instances.
116     ClusterOvsdb.Delete Sample Bridge Manually And Verify    ${original_cluster_list}    ${OS_CONTROL_NODE_IP}
117
118 Take Down ODL2
119     [Documentation]    Kill the karaf in Second Controller
120     ClusterKeywords.Kill Multiple Controllers    2
121     ${new_cluster_list}    ClusterKeywords.Create Controller Index List
122     Remove From List    ${new_cluster_list}    1
123     Set Suite Variable    ${new_cluster_list}
124
125 Create Vm Instances For l2_net_2
126     [Documentation]    Create Vm instances using flavor and image names for a network.
127     Create Vm Instances    l2_net_2    ${NET_2_VM_INSTANCES}
128     [Teardown]    Show Debugs    ${NET_2_VM_INSTANCES}
129
130 Bring Up ODL2
131     [Documentation]    Bring up ODL2 again
132     ClusterKeywords.Start Multiple Controllers    300s    2
133     ${new_cluster_list}    ClusterKeywords.Create Controller Index List
134     Set Suite Variable    ${new_cluster_list}
135
136 Ping Vm Instance1 In l2_net_1
137     [Documentation]    Check reachability of vm instances by pinging to them.
138     Ping Vm From DHCP Namespace    l2_net_1    @{NET_1_VM_IPS}[0]
139
140 Ping Vm Instance2 In l2_net_1
141     [Documentation]    Check reachability of vm instances by pinging to them.
142     Ping Vm From DHCP Namespace    l2_net_1    @{NET_1_VM_IPS}[1]
143
144 Ping Vm Instance3 In l2_net_1
145     [Documentation]    Check reachability of vm instances by pinging to them.
146     Ping Vm From DHCP Namespace    l2_net_1    @{NET_1_VM_IPS}[2]
147
148 Ping Vm Instance1 In l2_net_2
149     [Documentation]    Check reachability of vm instances by pinging to them.
150     Ping Vm From DHCP Namespace    l2_net_2    @{NET_2_VM_IPS}[0]
151
152 Ping Vm Instance2 In l2_net_2
153     [Documentation]    Check reachability of vm instances by pinging to them.
154     Ping Vm From DHCP Namespace    l2_net_2    @{NET_2_VM_IPS}[1]
155
156 Ping Vm Instance3 In l2_net_2
157     [Documentation]    Check reachability of vm instances by pinging to them.
158     Ping Vm From DHCP Namespace    l2_net_2    @{NET_2_VM_IPS}[2]
159
160 Take Down ODL3
161     [Documentation]    Kill the karaf in Third Controller
162     ClusterKeywords.Kill Multiple Controllers    3
163     ${new_cluster_list}    ClusterKeywords.Create Controller Index List
164     Remove From List    ${new_cluster_list}    2
165     Set Suite Variable    ${new_cluster_list}
166
167 Connectivity Tests From Vm Instance1 In l2_net_1
168     [Documentation]    Logging to the vm instance using generated key pair.
169     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[1]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
170     Log    ${dst_ip_list}
171     Test Operations From Vm Instance    l2_net_1    @{NET_1_VM_IPS}[0]    ${dst_ip_list}
172
173 Connectivity Tests From Vm Instance2 In l2_net_1
174     [Documentation]    Logging to the vm instance using generated key pair.
175     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
176     Log    ${dst_ip_list}
177     Test Operations From Vm Instance    l2_net_1    @{NET_1_VM_IPS}[1]    ${dst_ip_list}
178
179 Connectivity Tests From Vm Instance3 In l2_net_1
180     [Documentation]    Logging to the vm instance using generated key pair.
181     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]
182     Log    ${dst_ip_list}
183     Test Operations From Vm Instance    l2_net_1    @{NET_1_VM_IPS}[2]    ${dst_ip_list}
184
185 Bring Up ODL3
186     [Documentation]    Bring up ODL3 again
187     ClusterKeywords.Start Multiple Controllers    300s    3
188     ${new_cluster_list}    ClusterKeywords.Create Controller Index List
189     Set Suite Variable    ${new_cluster_list}
190
191 Take Down ODL1 and ODL2
192     [Documentation]    Kill the karaf in First and Second Controller
193     : FOR    ${index}    IN    @{cluster_down_list}
194     \    ClusterKeywords.Kill Multiple Controllers    ${index}
195
196 Connectivity Tests From Vm Instance1 In l2_net_2
197     [Documentation]    Logging to the vm instance using generated key pair.
198     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[1]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
199     Log    ${dst_ip_list}
200     Test Operations From Vm Instance    l2_net_2    @{NET_2_VM_IPS}[0]    ${dst_ip_list}
201
202 Connectivity Tests From Vm Instance2 In l2_net_2
203     [Documentation]    Logging to the vm instance using generated key pair.
204     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
205     Log    ${dst_ip_list}
206     Test Operations From Vm Instance    l2_net_2    @{NET_2_VM_IPS}[1]    ${dst_ip_list}
207
208 Connectivity Tests From Vm Instance3 In l2_net_2
209     [Documentation]    Logging to the vm instance using generated key pair.
210     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[1]
211     Log    ${dst_ip_list}
212     Test Operations From Vm Instance    l2_net_2    @{NET_2_VM_IPS}[2]    ${dst_ip_list}
213
214 Bring Up ODL1 and ODL2
215     [Documentation]    Bring up ODL1 and ODL2 again.
216     : FOR    ${index}    IN    @{cluster_down_list}
217     \    ClusterKeywords.Start Multiple Controllers    300s    ${index}
218
219 Delete Vm Instance
220     [Documentation]    Delete Vm instances using instance names.
221     Delete Vm Instance    VmInstance1_l2_net_1
222
223 No Ping For Deleted Vm
224     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
225     ${output}=    Ping From DHCP Should Not Succeed    l2_network_1    @{NET_1_VM_IPS}[0]
226
227 Delete Vm Instances In network_1
228     [Documentation]    Delete Vm instances using instance names in network_1.
229     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
230     \    Delete Vm Instance    ${VmElement}
231
232 Delete Vm Instances In network_2
233     [Documentation]    Delete Vm instances using instance names in network_2.
234     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
235     \    Delete Vm Instance    ${VmElement}
236
237 Delete Sub Networks In network_1
238     [Documentation]    Delete Sub Nets for the Networks with neutron request.
239     Delete SubNet    l2_sub_net_1
240
241 Delete Sub Networks In network_2
242     [Documentation]    Delete Sub Nets for the Networks with neutron request.
243     Delete SubNet    l2_sub_net_2
244
245 Delete Networks
246     [Documentation]    Delete Networks with neutron request.
247     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
248     \    Delete Network    ${NetworkElement}