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 # pass this test until ovs 2.9 is ready
147 BuiltIn.Pass Execution
148 ${dst_ip} = BuiltIn.Create List @{VM_FLOATING_IPS}[1]
149 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_FIP_VM_IPS}[2] ${dst_ip}
151 Ping Vm Instance1 Floating IP From SNAT VM Instance1
152 [Documentation] Check reachability of VM instance floating IP from another VM without Floating IP
153 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
154 ${dst_ip} = BuiltIn.Create List @{VM_FLOATING_IPS}[0]
155 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[0] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
156 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[1] @{NET2_SNAT_VM_IPS}[0] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
158 Ping Vm Instance1 Floating IP From SNAT VM Instance2
159 [Documentation] Check reachability of VM instance floating IP from another VM without Floating IP
160 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
161 ${dst_ip} = BuiltIn.Create List @{VM_FLOATING_IPS}[0]
162 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[1] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
164 Ping Vm Instance2 Floating IP From SNAT VM Instance1
165 [Documentation] Check reachability of VM instance floating IP from another VM without Floating IP
166 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
167 ${dst_ip} = BuiltIn.Create List @{VM_FLOATING_IPS}[1]
168 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[0] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
169 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[1] @{NET2_SNAT_VM_IPS}[0] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
171 Ping Vm Instance2 Floating IP From SNAT VM Instance2
172 [Documentation] Check reachability of VM instance floating IP from another VM without Floating IP
173 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
174 ${dst_ip} = BuiltIn.Create List @{VM_FLOATING_IPS}[1]
175 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[1] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
177 Ping External Network PNF from Vm Instance 1 After Floating IP Assignment
178 [Documentation] Check reachability of External Network PNF from VM instance (with ttl=1 to make sure no router hops)
179 ${dst_ip} = BuiltIn.Create List ${EXTERNAL_PNF}
180 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_FIP_VM_IPS}[0] ${dst_ip} ttl=1
182 SNAT - TCP connection to External Gateway From SNAT VM Instance1
183 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT
184 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY}
186 SNAT - UDP connection to External Gateway From SNAT VM Instance1
187 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT
188 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY} -u
190 SNAT - TCP connection to External Gateway From SNAT VM Instance2
191 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT
192 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[1] ${EXTERNAL_GATEWAY}
194 SNAT - UDP connection to External Gateway From SNAT VM Instance2
195 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT
196 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[1] ${EXTERNAL_GATEWAY} -u
198 SNAT - TCP connection to External Gateway From SNAT VM Instance3
199 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT
200 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[1] @{NET2_SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY}
202 SNAT - UDP connection to External Gateway From SNAT VM Instance3
203 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT
204 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[1] @{NET2_SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY} -u
206 Ping External Network PNF from SNAT VM Instance1
207 [Documentation] Check reachability of External Network PNF from SNAT VM Instance1
208 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
209 ${dst_ip} = BuiltIn.Create List ${EXTERNAL_PNF}
210 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[0] ${dst_ip} ping_should_succeed=${expect_ping_to_work}
212 Ping External Network PNF from SNAT VM Instance2
213 [Documentation] Check reachability of External Network PNF from SNAT VM Instance2
214 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
215 ${dst_ip} = BuiltIn.Create List ${EXTERNAL_PNF}
216 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[1] ${dst_ip} ping_should_succeed=${expect_ping_to_work}
218 Remove Floating Ip from VM Instance 1
219 [Documentation] Delete FIP from VM Instance 1
220 OpenStackOperations.Remove Floating Ip From Vm @{NET1_FIP_VMS}[0] @{VM_FLOATING_IPS}[0]
222 Remove Floating Ip from VM Instance 2
223 [Documentation] Delete FIP from VM Instance 2
224 OpenStackOperations.Remove Floating Ip From Vm @{NET1_FIP_VMS}[1] @{VM_FLOATING_IPS}[1]
226 Ping External Network PNF from Vm Instance 1 After Floating IP Removal
227 [Documentation] Check reachability of External Network PNF from VM instance (with ttl=1 to make sure no router hops)
228 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
229 ${dst_ip} = BuiltIn.Create List ${EXTERNAL_PNF}
230 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_FIP_VM_IPS}[0] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
232 Ping External Network PNF from Vm Instance 2 After Floating IP Removal
233 [Documentation] Check reachability of External Network PNF from VM instance (with ttl=1 to make sure no router hops)
234 ${expect_ping_to_work} = Set Variable If "skip_if_controller" in @{TEST_TAGS} False True
235 ${dst_ip} = BuiltIn.Create List ${EXTERNAL_PNF}
236 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_FIP_VM_IPS}[1] ${dst_ip} ttl=1 ping_should_succeed=${expect_ping_to_work}
239 [Documentation] Delete Vm instances using instance names.
240 : FOR ${vm} IN @{NET1_FIP_VMS}
241 \ OpenStackOperations.Delete Vm Instance ${vm}
242 : FOR ${vm} IN @{SNAT_VMS}
243 \ OpenStackOperations.Delete Vm Instance ${vm}
245 Delete Router Interfaces
246 [Documentation] Remove Interface to the subnets.
247 : FOR ${router} ${interface} IN ZIP ${ROUTERS} ${SUBNETS}
248 \ OpenStackOperations.Remove Interface ${router} ${interface}
251 [Documentation] Delete Router and Interface to the subnets.
252 : FOR ${router} IN @{ROUTERS}
253 \ OpenStackOperations.Delete Router ${router}
255 Verify Deleted Router
256 [Documentation] Check deleted router using northbound rest call
257 ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API}
259 : FOR ${router} IN @{ROUTERS}
260 \ BuiltIn.Should Not Contain ${data} ${ROUTER}
263 [Documentation] Delete Networks with neutron request.
264 : FOR ${network} IN @{NETWORKS}
265 \ OpenStackOperations.Delete Network ${network}
266 OpenStackOperations.Delete Network ${EXTERNAL_NET_NAME}
268 Delete Security Group
269 [Documentation] Delete security groups with neutron request
270 OpenStackOperations.Delete SecurityGroup ${SECURITY_GROUP}
273 [Documentation] Verify that flows have been cleaned up properly after removing all neutron configurations
274 DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes