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