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