2 Documentation Test suite to check North-South connectivity in L3 using a router and an external network
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 Force Tags skip_if_${ODL_SNAT_MODE}
10 Library OperatingSystem
11 Library RequestsLibrary
12 Resource ../../../libraries/DevstackUtils.robot
13 Resource ../../../libraries/DataModels.robot
14 Resource ../../../libraries/OpenStackOperations.robot
15 Resource ../../../libraries/SetupUtils.robot
16 Resource ../../../libraries/Utils.robot
17 Resource ../../../variables/netvirt/Variables.robot
20 ${SECURITY_GROUP} l3_ext_sg
21 @{NETWORKS} l3_ext_net_1 l3_ext_net_2
22 @{SUBNETS} l3_ext_sub_1 l3_ext_sub_2
23 @{ROUTERS} l3_ext_router_1 l3_ext_router_2
24 @{NET1_FIP_VMS} l3_ext_net_1_fip_vm_1 l3_ext_net_1_fip_vm_2 l3_ext_net_1_fip_vm_3
25 @{NET1_SNAT_VMS} l3_ext_net_1_snat_vm_1 l3_ext_net_1_snat_vm_2
26 @{NET2_SNAT_VMS} l3_ext_net_2_snat_vm_3
27 @{SNAT_VMS} @{NET1_SNAT_VMS} @{NET2_SNAT_VMS}
28 @{SUBNET_CIDRS} 41.0.0.0/24 42.0.0.0/24
29 # Parameter values below are based on releng/builder - changing them requires updates in releng/builder as well
30 ${EXTERNAL_GATEWAY} 10.10.10.250
31 ${EXTERNAL_PNF} 10.10.10.253
32 ${EXTERNAL_SUBNET} 10.10.10.0/24
33 ${EXTERNAL_SUBNET_ALLOCATION_POOL} start=10.10.10.2,end=10.10.10.249
34 ${EXTERNAL_INTERNET_ADDR} 10.9.9.9
37 Create All Controller Sessions
38 [Documentation] Create sessions for all three controllers
39 ClusterManagement.ClusterManagement Setup
41 Create Private Networks
42 [Documentation] Create Network with neutron request.
43 : FOR ${network} IN @{NETWORKS}
44 \ OpenStackOperations.Create Network ${network}
46 Create Subnets For Private Networks
47 [Documentation] Create Sub Net for the Network with neutron request.
48 : FOR ${network} ${subnet} ${cidr} IN ZIP ${NETWORKS} ${SUBNETS}
50 \ OpenStackOperations.Create SubNet ${network} ${subnet} ${cidr}
53 [Documentation] Allow all TCP/UDP/ICMP packets for this suite
54 OpenStackOperations.Create Allow All SecurityGroup ${SECURITY_GROUP}
57 [Documentation] Create VM instances using flavor and image names for a network.
58 OpenStackOperations.Create Vm Instance On Compute Node @{NETWORKS}[0] @{NET1_FIP_VMS}[0] ${OS_CMP1_HOSTNAME} sg=${SECURITY_GROUP}
59 OpenStackOperations.Create Vm Instance On Compute Node @{NETWORKS}[0] @{NET1_FIP_VMS}[1] ${OS_CMP2_HOSTNAME} sg=${SECURITY_GROUP}
60 OpenStackOperations.Create Vm Instance On Compute Node @{NETWORKS}[0] @{NET1_FIP_VMS}[2] ${OS_CMP2_HOSTNAME} sg=${SECURITY_GROUP}
61 OpenStackOperations.Create Vm Instance On Compute Node @{NETWORKS}[0] @{NET_1_SNAT_VMS}[0] ${OS_CMP1_HOSTNAME} sg=${SECURITY_GROUP}
62 OpenStackOperations.Create Vm Instance On Compute Node @{NETWORKS}[0] @{NET_1_SNAT_VMS}[1] ${OS_CMP1_HOSTNAME} sg=${SECURITY_GROUP}
63 OpenStackOperations.Create Vm Instance On Compute Node @{NETWORKS}[1] @{NET_2_SNAT_VMS}[0] ${OS_CMP2_HOSTNAME} sg=${SECURITY_GROUP}
65 Check Vm Instances Have Ip Address
66 @{NET1_FIP_VM_IPS} ${NET1_FIP_DHCP_IP} = OpenStackOperations.Get VM IPs @{NET1_FIP_VMS}
67 @{NET1_SNAT_VM_IPS} ${NET1_SNAT_DHCP_IP} = OpenStackOperations.Get VM IPs @{NET1_SNAT_VMS}
68 @{NET2_SNAT_VM_IPS} ${NET2_SNAT_DHCP_IP} = OpenStackOperations.Get VM IPs @{NET2_SNAT_VMS}
69 BuiltIn.Set Suite Variable @{NET1_FIP_VM_IPS}
70 BuiltIn.Set Suite Variable @{NET1_SNAT_VM_IPS}
71 BuiltIn.Set Suite Variable @{NET2_SNAT_VM_IPS}
72 BuiltIn.Should Not Contain ${NET1_FIP_VM_IPS} None
73 BuiltIn.Should Not Contain ${NET1_SNAT_VM_IPS} None
74 BuiltIn.Should Not Contain ${NET2_SNAT_VM_IPS} None
75 BuiltIn.Should Not Contain ${NET1_FIP_DHCP_IP} None
76 BuiltIn.Should Not Contain ${NET1_SNAT_DHCP_IP} None
77 BuiltIn.Should Not Contain ${NET2_SNAT_DHCP_IP} None
78 [Teardown] BuiltIn.Run Keywords OpenStackOperations.Show Debugs @{NET1_FIP_VMS} @{SNAT_VMS}
79 ... AND OpenStackOperations.Get Test Teardown Debugs
81 Create External Network And Subnet
82 OpenStackOperations.Create Network ${EXTERNAL_NET_NAME} --provider-network-type flat --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK}
83 OpenStackOperations.Update Network ${EXTERNAL_NET_NAME} --external
84 OpenStackOperations.Create Subnet ${EXTERNAL_NET_NAME} ${EXTERNAL_SUBNET_NAME} ${EXTERNAL_SUBNET} --gateway ${EXTERNAL_GATEWAY} --allocation-pool ${EXTERNAL_SUBNET_ALLOCATION_POOL}
87 [Documentation] Create Router and Add Interface to the subnets.
88 : FOR ${router} IN @{ROUTERS}
89 \ OpenStackOperations.Create Router ${router}
91 Add Interfaces To Router
92 [Documentation] Add Interfaces
93 : FOR ${router} ${interface} IN ZIP ${ROUTERS} ${SUBNETS}
94 \ OpenStackOperations.Add Router Interface ${router} ${interface}
96 Add Router Gateway To Router
97 [Documentation] OpenStackOperations.Add Router Gateway
98 : FOR ${router} IN @{ROUTERS}
99 \ OpenStackOperations.Add Router Gateway ${router} ${EXTERNAL_NET_NAME}
101 Verify Created Routers
102 [Documentation] Check created routers using northbound rest calls
103 ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API}
105 : FOR ${router} IN @{ROUTERS}
106 \ Should Contain ${data} ${router}
108 Initial Ping To External Network PNF from Vm Instance 1
109 [Documentation] Check reachability of External Network PNF from VM instance (with ttl=1 to make sure no router hops)
110 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
111 ${dst_ip}= BuiltIn.Create List ${EXTERNAL_PNF}
112 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_FIP_VM_IPS}[0] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
114 Initial Ping To External Network PNF from Vm Instance 2
115 [Documentation] Check reachability of External Network PNF from VM instance (with ttl=1 to make sure no router hops)
116 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
117 ${dst_ip}= BuiltIn.Create List ${EXTERNAL_PNF}
118 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_FIP_VM_IPS}[1] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
120 Create And Associate Floating IPs for VMs
121 [Documentation] Create and associate a floating IP for the VM
122 ${VM_FLOATING_IPS} = OpenStackOperations.Create And Associate Floating IPs ${EXTERNAL_NET_NAME} @{NET1_FIP_VMS}
123 BuiltIn.Set Suite Variable ${VM_FLOATING_IPS}
124 [Teardown] BuiltIn.Run Keywords OpenStackOperations.Show Debugs @{NET1_FIP_VMS}
125 ... AND OpenStackOperations.Get Test Teardown Debugs
127 Ping External Gateway From Control Node
128 [Documentation] Check reachability of external gateway by pinging it from the control node.
129 OpenStackOperations.Ping Vm From Control Node ${EXTERNAL_GATEWAY} additional_args=-I ${EXTERNAL_INTERNET_ADDR}
131 Ping Vm Instance1 Floating IP From Control Node
132 [Documentation] Check reachability of VM instance through floating IP by pinging them.
133 OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[0] additional_args=-I ${EXTERNAL_INTERNET_ADDR}
135 Ping Vm Instance2 Floating IP From Control Node
136 [Documentation] Check reachability of VM instance through floating IP by pinging them.
137 OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[1] additional_args=-I ${EXTERNAL_INTERNET_ADDR}
139 Ping Vm Instance2 Floating IP From Vm Instance1 With Floating IP (Hairpinning)
140 [Documentation] Check reachability of VM instance floating IP from another VM instance with FIP (with ttl=1 to make sure no router hops)
141 ${dst_ip} = BuiltIn.Create List @{VM_FLOATING_IPS}[1]
142 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_FIP_VM_IPS}[0] ${dst_ip} ttl=1
144 Connectivity Tests To Vm Instance2 Floating IP From Vm Instance3 With Floating IP (FIP-FIP in the same compute node)
145 [Documentation] Check reachability of VM instance floating IP from another VM instance with FIP (FIP-FIP in the same compute node)
146 BuiltIn.Pass Execution pass this test until ovs 2.9 is ready
147 ${dst_ip} = BuiltIn.Create List @{VM_FLOATING_IPS}[1]
148 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_FIP_VM_IPS}[2] ${dst_ip}
150 Ping Vm Instance1 Floating IP From SNAT VM Instance1
151 [Documentation] Check reachability of VM instance floating IP from another VM without Floating IP
152 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
153 ${dst_ip} = BuiltIn.Create List @{VM_FLOATING_IPS}[0]
154 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[0] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
155 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[1] @{NET2_SNAT_VM_IPS}[0] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
157 Ping Vm Instance1 Floating IP From SNAT VM Instance2
158 [Documentation] Check reachability of VM instance floating IP from another VM without Floating IP
159 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
160 ${dst_ip} = BuiltIn.Create List @{VM_FLOATING_IPS}[0]
161 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[1] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
163 Ping Vm Instance2 Floating IP From SNAT VM Instance1
164 [Documentation] Check reachability of VM instance floating IP from another VM without Floating IP
165 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
166 ${dst_ip} = BuiltIn.Create List @{VM_FLOATING_IPS}[1]
167 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[0] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
168 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[1] @{NET2_SNAT_VM_IPS}[0] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
170 Ping Vm Instance2 Floating IP From SNAT VM Instance2
171 [Documentation] Check reachability of VM instance floating IP from another VM without Floating IP
172 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
173 ${dst_ip} = BuiltIn.Create List @{VM_FLOATING_IPS}[1]
174 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[1] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
176 Ping External Network PNF from Vm Instance 1 After Floating IP Assignment
177 [Documentation] Check reachability of External Network PNF from VM instance (with ttl=1 to make sure no router hops)
178 ${dst_ip} = BuiltIn.Create List ${EXTERNAL_PNF}
179 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_FIP_VM_IPS}[0] ${dst_ip} ttl=1
181 SNAT - TCP connection to External Gateway From SNAT VM Instance1
182 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT
183 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY}
185 SNAT - UDP connection to External Gateway From SNAT VM Instance1
186 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT
187 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY} -u
189 SNAT - TCP connection to External Gateway From SNAT VM Instance2
190 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT
191 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[1] ${EXTERNAL_GATEWAY}
193 SNAT - UDP connection to External Gateway From SNAT VM Instance2
194 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT
195 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[1] ${EXTERNAL_GATEWAY} -u
197 SNAT - TCP connection to External Gateway From SNAT VM Instance3
198 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT
199 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[1] @{NET2_SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY}
201 SNAT - UDP connection to External Gateway From SNAT VM Instance3
202 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT
203 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[1] @{NET2_SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY} -u
205 Ping External Network PNF from SNAT VM Instance1
206 [Documentation] Check reachability of External Network PNF from SNAT VM Instance1
207 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
208 ${dst_ip} = BuiltIn.Create List ${EXTERNAL_PNF}
209 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[0] ${dst_ip} ping_should_succeed=${expect_ping_to_work}
211 Ping External Network PNF from SNAT VM Instance2
212 [Documentation] Check reachability of External Network PNF from SNAT VM Instance2
213 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
214 ${dst_ip} = BuiltIn.Create List ${EXTERNAL_PNF}
215 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[1] ${dst_ip} ping_should_succeed=${expect_ping_to_work}
217 Remove Floating Ip from VM Instance 1
218 [Documentation] Delete FIP from VM Instance 1
219 OpenStackOperations.Remove Floating Ip From Vm @{NET1_FIP_VMS}[0] @{VM_FLOATING_IPS}[0]
221 Remove Floating Ip from VM Instance 2
222 [Documentation] Delete FIP from VM Instance 2
223 OpenStackOperations.Remove Floating Ip From Vm @{NET1_FIP_VMS}[1] @{VM_FLOATING_IPS}[1]
225 Ping External Network PNF from Vm Instance 1 After Floating IP Removal
226 [Documentation] Check reachability of External Network PNF from VM instance (with ttl=1 to make sure no router hops)
227 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
228 ${dst_ip} = BuiltIn.Create List ${EXTERNAL_PNF}
229 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_FIP_VM_IPS}[0] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
231 Ping External Network PNF from Vm Instance 2 After Floating IP Removal
232 [Documentation] Check reachability of External Network PNF from VM instance (with ttl=1 to make sure no router hops)
233 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
234 ${dst_ip} = BuiltIn.Create List ${EXTERNAL_PNF}
235 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_FIP_VM_IPS}[1] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
238 [Documentation] Delete Vm instances using instance names.
239 : FOR ${vm} IN @{NET1_FIP_VMS}
240 \ OpenStackOperations.Delete Vm Instance ${vm}
241 : FOR ${vm} IN @{SNAT_VMS}
242 \ OpenStackOperations.Delete Vm Instance ${vm}
244 Delete Router Interfaces
245 [Documentation] Remove Interface to the subnets.
246 : FOR ${router} ${interface} IN ZIP ${ROUTERS} ${SUBNETS}
247 \ OpenStackOperations.Remove Interface ${router} ${interface}
250 [Documentation] Delete Router and Interface to the subnets.
251 : FOR ${router} IN @{ROUTERS}
252 \ OpenStackOperations.Delete Router ${router}
254 Verify Deleted Router
255 [Documentation] Check deleted router using northbound rest call
256 ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API}
258 : FOR ${router} IN @{ROUTERS}
259 \ BuiltIn.Should Not Contain ${data} ${ROUTER}
262 [Documentation] Delete Networks with neutron request.
263 : FOR ${network} IN @{NETWORKS}
264 \ OpenStackOperations.Delete Network ${network}
265 OpenStackOperations.Delete Network ${EXTERNAL_NET_NAME}
267 Delete Security Group
268 [Documentation] Delete security groups with neutron request
269 OpenStackOperations.Delete SecurityGroup ${SECURITY_GROUP}
272 [Documentation] Verify that flows have been cleaned up properly after removing all neutron configurations
273 DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes