Update Robot Framework format - step 13
[integration/test.git] / csit / suites / openstack / connectivity / l3.robot
1 *** Settings ***
2 Documentation       Test suite to check connectivity in L3 using routers.
3
4 Library             SSHLibrary
5 Library             OperatingSystem
6 Library             RequestsLibrary
7 Resource            ../../../libraries/DevstackUtils.robot
8 Resource            ../../../libraries/DataModels.robot
9 Resource            ../../../libraries/OpenStackOperations.robot
10 Resource            ../../../libraries/SetupUtils.robot
11 Resource            ../../../libraries/Utils.robot
12 Resource            ../../../variables/netvirt/Variables.robot
13
14 Suite Setup         Suite Setup
15 Suite Teardown      OpenStackOperations.OpenStack Suite Teardown
16 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
17 Test Teardown       OpenStackOperations.Get Test Teardown Debugs
18
19
20 *** Variables ***
21 ${SECURITY_GROUP}       l3_sg
22 @{NETWORKS}             l3_net_1    l3_net_2    l3_net_3    l3_net_4    l3_net_5
23 @{SUBNETS_1}            l3_sub_1    l3_sub_2    l3_sub_3
24 @{SUBNETS_2}            l3_sub_4    l3_sub_5
25 @{ROUTER}               l3_router1    l3_router2
26 @{NET_1_VMS}            l3_net_1_vm_1    l3_net_1_vm_2    l3_net_1_vm_3
27 @{NET_2_VMS}            l3_net_2_vm_1    l3_net_2_vm_2    l3_net_2_vm_3
28 @{NET_3_VMS}            l3_net_3_vm_1    l3_net_3_vm_2    l3_net_3_vm_3
29 @{NET_4_VMS}            l3_net_4_vm_1
30 @{NET_5_VMS}            l3_net_5_vm_1
31 @{SUBNET_CIDRS}         31.0.0.0/24    32.0.0.0/24    33.0.0.0/24    34.0.0.0/24    35.0.0.0/24
32 @{NET_VLAN_ID}          1131    1132    1133
33
34
35 *** Test Cases ***
36 Ping Vm Instance1 In net_2 From net_1 (vxlan to vlan)
37     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
38     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[0]    ${NET_2_L3_VM_IPS}[0]
39
40 Ping Vm Instance2 In net_2 From net_1 (vxlan to vlan)
41     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
42     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[0]    ${NET_2_L3_VM_IPS}[1]
43
44 Ping Vm Instance3 In net_2 From net_1 (vxlan to vlan)
45     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
46     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[0]    ${NET_2_L3_VM_IPS}[2]
47
48 Ping Vm Instance1 In net_1 From net_2 (vlan to vxlan)
49     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
50     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[1]    ${NET_1_L3_VM_IPS}[0]
51
52 Ping Vm Instance2 In net_1 From net_2 (vlan to vxlan)
53     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
54     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[1]    ${NET_1_L3_VM_IPS}[1]
55
56 Ping Vm Instance3 In net_1 From net_2 (vlan to vxlan)
57     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
58     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[1]    ${NET_1_L3_VM_IPS}[2]
59
60 Ping Vm Instance1 In net_3 From net_2 (vxlan to vxlan)
61     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
62     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[1]    ${NET_3_L3_VM_IPS}[0]
63
64 Ping Vm Instance2 In net_3 From net_2 (vxlan to vxlan)
65     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
66     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[1]    ${NET_3_L3_VM_IPS}[1]
67
68 Ping Vm Instance3 In net_3 From net_2 (vxlan to vxlan)
69     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
70     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[1]    ${NET_3_L3_VM_IPS}[2]
71
72 Connectivity Tests From Vm Instance1 In net_1
73     [Documentation]    Login to the VM instance and test operations
74     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
75     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[0]    ${NET_1_L3_VM_IPS}[0]    ${dst_list}
76
77 Connectivity Tests From Vm Instance2 In net_1
78     [Documentation]    Login to the vm instance and test operations
79     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
80     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[0]    ${NET_1_L3_VM_IPS}[1]    ${dst_list}
81
82 Connectivity Tests From Vm Instance3 In net_1
83     [Documentation]    Login to the vm instance and test operations
84     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
85     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[0]    ${NET_1_L3_VM_IPS}[2]    ${dst_list}
86
87 Connectivity Tests From Vm Instance1 In net_2
88     [Documentation]    Login to the vm instance and test operations
89     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
90     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[1]    ${NET_2_L3_VM_IPS}[0]    ${dst_list}
91
92 Connectivity Tests From Vm Instance2 In net_2
93     [Documentation]    Logging to the vm instance using generated key pair.
94     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
95     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[1]    ${NET_2_L3_VM_IPS}[1]    ${dst_list}
96
97 Connectivity Tests From Vm Instance3 In net_2
98     [Documentation]    Logging to the vm instance using generated key pair.
99     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
100     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[1]    ${NET_2_L3_VM_IPS}[2]    ${dst_list}
101
102 Delete Vm Instances In net_1
103     [Documentation]    Delete Vm instances using instance names in net_1.
104     [Tags]    non_gate
105     FOR    ${vm}    IN    @{NET_1_VMS}
106         OpenStackOperations.Delete Vm Instance    ${vm}
107     END
108
109 Delete Vm Instances In net_2
110     [Documentation]    Delete Vm instances using instance names in net_2.
111     [Tags]    non_gate
112     FOR    ${vm}    IN    @{NET_2_VMS}
113         OpenStackOperations.Delete Vm Instance    ${vm}
114     END
115
116 Delete Vm Instances In net_3
117     [Documentation]    Delete Vm instances using instance names in net_3.
118     [Tags]    non_gate
119     FOR    ${vm}    IN    @{NET_3_VMS}
120         OpenStackOperations.Delete Vm Instance    ${vm}
121     END
122
123 Create Vm Instances For net_4
124     [Documentation]    Create VM instances using flavor and image names for a network.
125     [Tags]    non_gate
126     OpenStackOperations.Create Vm Instance On Compute Node
127     ...    ${NETWORKS}[3]
128     ...    ${NET_4_VMS}[0]
129     ...    ${OS_CMP1_HOSTNAME}
130     ...    sg=${SECURITY_GROUP}
131
132 Create Vm Instances For net_5
133     [Documentation]    Create VM instances using flavor and image names for a network.
134     [Tags]    non_gate
135     OpenStackOperations.Create Vm Instance On Compute Node
136     ...    ${NETWORKS}[4]
137     ...    ${NET_5_VMS}[0]
138     ...    ${OS_CMP2_HOSTNAME}
139     ...    sg=${SECURITY_GROUP}
140
141 Create Router2
142     [Documentation]    Create Router
143     [Tags]    non_gate
144     OpenStackOperations.Create Router    ${ROUTER}[1]
145
146 Add net_4 Interfaces To Router2
147     [Documentation]    Add Interfaces
148     [Tags]    non_gate
149     OpenStackOperations.Add Router Interface    ${ROUTER}[1]    ${SUBNETS_2}[0]
150
151 Check Vm Instances on net_4 and net_5 Have Ip Address
152     [Tags]    non_gate
153     @{NET_4_L3_VM_IPS}    ${NET_4_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_4_VMS}
154     @{NET_5_L3_VM_IPS}    ${NET_5_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_5_VMS}
155     BuiltIn.Set Suite Variable    @{NET_4_L3_VM_IPS}
156     BuiltIn.Set Suite Variable    @{NET_5_L3_VM_IPS}
157     BuiltIn.Should Not Contain    ${NET_4_L3_VM_IPS}    None
158     BuiltIn.Should Not Contain    ${NET_5_L3_VM_IPS}    None
159     BuiltIn.Should Not Contain    ${NET_4_L3_DHCP_IP}    None
160     BuiltIn.Should Not Contain    ${NET_5_L3_DHCP_IP}    None
161     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_4_VMS}    @{NET_5_VMS}
162     ...    AND    OpenStackOperations.Get Test Teardown Debugs
163
164 Add net_5 Interfaces To Router2
165     [Documentation]    Add Interfaces
166     [Tags]    non_gate
167     OpenStackOperations.Add Router Interface    ${ROUTER}[1]    ${SUBNETS_2}[1]
168
169 Ping Vm Instance5 In net_5 From net_4 (vlan to vlan)
170     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
171     [Tags]    non_gate
172     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[3]    ${NET_5_L3_VM_IPS}[0]
173
174 Ping Vm Instance5 In net_4 From net_5 (vlan to vlan)
175     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
176     [Tags]    non_gate
177     OpenStackOperations.Ping Vm From DHCP Namespace    ${NETWORKS}[4]    ${NET_4_L3_VM_IPS}[0]
178
179 Connectivity Tests From Vm Instance4 In net_5
180     [Documentation]    Check reachability of vm instance on a different network with one vlan vm in source and destination.
181     [Tags]    non_gate
182     ${dst_list} =    BuiltIn.Create List    @{NET_4_L3_VM_IPS}
183     OpenStackOperations.Test Operations From Vm Instance    ${NETWORKS}[4]    ${NET_5_L3_VM_IPS}[0]    ${dst_list}
184
185
186 *** Keywords ***
187 Suite Setup
188     OpenStackOperations.OpenStack Suite Setup
189     OpenStackOperations.Create Network
190     ...    ${NETWORKS}[0]
191     ...    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${NET_VLAN_ID}[0]
192     OpenStackOperations.Create SubNet    ${NETWORKS}[0]    ${SUBNETS_1}[0]    ${SUBNET_CIDRS}[0]
193     OpenStackOperations.Create Network    ${NETWORKS}[1]
194     OpenStackOperations.Create SubNet    ${NETWORKS}[1]    ${SUBNETS_1}[1]    ${SUBNET_CIDRS}[1]
195     OpenStackOperations.Create Network    ${NETWORKS}[2]
196     OpenStackOperations.Create SubNet    ${NETWORKS}[2]    ${SUBNETS_1}[2]    ${SUBNET_CIDRS}[2]
197     OpenStackOperations.Create Network
198     ...    ${NETWORKS}[3]
199     ...    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${NET_VLAN_ID}[1]
200     OpenStackOperations.Create SubNet    ${NETWORKS}[3]    ${SUBNETS_2}[0]    ${SUBNET_CIDRS}[3]
201     OpenStackOperations.Create Network
202     ...    ${NETWORKS}[4]
203     ...    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${NET_VLAN_ID}[2]
204     OpenStackOperations.Create SubNet    ${NETWORKS}[4]    ${SUBNETS_2}[1]    ${SUBNET_CIDRS}[4]
205     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
206     OpenStackOperations.Create Vm Instance On Compute Node
207     ...    ${NETWORKS}[0]
208     ...    ${NET_1_VMS}[0]
209     ...    ${OS_CMP1_HOSTNAME}
210     ...    sg=${SECURITY_GROUP}
211     OpenStackOperations.Create Vm Instance On Compute Node
212     ...    ${NETWORKS}[0]
213     ...    ${NET_1_VMS}[1]
214     ...    ${OS_CMP1_HOSTNAME}
215     ...    sg=${SECURITY_GROUP}
216     OpenStackOperations.Create Vm Instance On Compute Node
217     ...    ${NETWORKS}[0]
218     ...    ${NET_1_VMS}[2]
219     ...    ${OS_CMP2_HOSTNAME}
220     ...    sg=${SECURITY_GROUP}
221     OpenStackOperations.Create Vm Instance On Compute Node
222     ...    ${NETWORKS}[1]
223     ...    ${NET_2_VMS}[0]
224     ...    ${OS_CMP1_HOSTNAME}
225     ...    sg=${SECURITY_GROUP}
226     OpenStackOperations.Create Vm Instance On Compute Node
227     ...    ${NETWORKS}[1]
228     ...    ${NET_2_VMS}[1]
229     ...    ${OS_CMP2_HOSTNAME}
230     ...    sg=${SECURITY_GROUP}
231     OpenStackOperations.Create Vm Instance On Compute Node
232     ...    ${NETWORKS}[1]
233     ...    ${NET_2_VMS}[2]
234     ...    ${OS_CMP2_HOSTNAME}
235     ...    sg=${SECURITY_GROUP}
236     OpenStackOperations.Create Vm Instance On Compute Node
237     ...    ${NETWORKS}[2]
238     ...    ${NET_3_VMS}[0]
239     ...    ${OS_CMP1_HOSTNAME}
240     ...    sg=${SECURITY_GROUP}
241     OpenStackOperations.Create Vm Instance On Compute Node
242     ...    ${NETWORKS}[2]
243     ...    ${NET_3_VMS}[1]
244     ...    ${OS_CMP1_HOSTNAME}
245     ...    sg=${SECURITY_GROUP}
246     OpenStackOperations.Create Vm Instance On Compute Node
247     ...    ${NETWORKS}[2]
248     ...    ${NET_3_VMS}[2]
249     ...    ${OS_CMP2_HOSTNAME}
250     ...    sg=${SECURITY_GROUP}
251     @{NET_1_L3_VM_IPS}    ${NET_1_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
252     @{NET_2_L3_VM_IPS}    ${NET_2_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
253     @{NET_3_L3_VM_IPS}    ${NET_3_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_3_VMS}
254     BuiltIn.Set Suite Variable    @{NET_1_L3_VM_IPS}
255     BuiltIn.Set Suite Variable    @{NET_2_L3_VM_IPS}
256     BuiltIn.Set Suite Variable    @{NET_3_L3_VM_IPS}
257     BuiltIn.Should Not Contain    ${NET_1_L3_VM_IPS}    None
258     BuiltIn.Should Not Contain    ${NET_2_L3_VM_IPS}    None
259     BuiltIn.Should Not Contain    ${NET_3_L3_VM_IPS}    None
260     BuiltIn.Should Not Contain    ${NET_1_L3_DHCP_IP}    None
261     BuiltIn.Should Not Contain    ${NET_2_L3_DHCP_IP}    None
262     BuiltIn.Should Not Contain    ${NET_3_L3_DHCP_IP}    None
263     OpenStackOperations.Create Router    ${ROUTER}[0]
264     FOR    ${interface}    IN    @{SUBNETS_1}
265         OpenStackOperations.Add Router Interface    ${ROUTER}[0]    ${interface}
266     END
267     OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}    @{NET_3_VMS}
268     OpenStackOperations.Get Suite Debugs