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