2 Documentation Test suite to check North-South connectivity in L3 using a router and an external network
3 Suite Setup BuiltIn.Run Keywords SetupUtils.Setup_Utils_For_Setup_And_Teardown
4 ... AND DevstackUtils.Devstack Suite Setup
5 Suite Teardown Close All Connections
6 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
7 Test Teardown OpenStackOperations.Get Test Teardown Debugs
9 Library OperatingSystem
10 Library RequestsLibrary
11 Resource ../../../libraries/DevstackUtils.robot
12 Resource ../../../libraries/DataModels.robot
13 Resource ../../../libraries/OpenStackOperations.robot
14 Resource ../../../libraries/SetupUtils.robot
15 Resource ../../../libraries/Utils.robot
18 ${SECURITY_GROUP} l3_ext_sg
19 @{NETWORKS_NAME} l3_ext_net
20 @{SUBNETS_NAME} l3_ext_sub
21 ${ROUTER_NAME} l3_ext_router
22 @{FIP_VM_INSTANCES} fip_vm_1 fip_vm_2
23 @{SNAT_VM_INSTANCES} snat_vm_1 snat_vm_2
24 @{SUBNETS_RANGE} 41.0.0.0/24
25 # Parameter values below are based on releng/builder - changing them requires updates in releng/builder as well
26 ${EXTERNAL_GATEWAY} 10.10.10.250
27 ${EXTERNAL_PNF} 10.10.10.253
28 ${EXTERNAL_SUBNET} 10.10.10.0/24
29 ${EXTERNAL_SUBNET_ALLOCATION_POOL} start=10.10.10.2,end=10.10.10.249
30 ${EXTERNAL_INTERNET_ADDR} 10.9.9.9
31 ${EXTERNAL_NET_NAME} external-net
32 ${EXTERNAL_SUBNET_NAME} external-subnet
35 Create All Controller Sessions
36 [Documentation] Create sessions for all three controllers
37 ClusterManagement.ClusterManagement Setup
39 Create Private Network
40 [Documentation] Create Network with neutron request.
41 : FOR ${network} IN @{NETWORKS_NAME}
42 \ OpenStackOperations.Create Network ${network}
44 Create Subnet For Private Network
45 [Documentation] Create Sub Net for the Network with neutron request.
46 OpenStackOperations.Create SubNet @{NETWORKS_NAME}[0] @{SUBNETS_NAME}[0] @{SUBNETS_RANGE}[0]
49 [Documentation] Allow all TCP/UDP/ICMP packets for this suite
50 OpenStackOperations.Create Allow All SecurityGroup ${SECURITY_GROUP}
53 [Documentation] Create VM instances using flavor and image names for a network.
54 OpenStackOperations.Create Vm Instances @{NETWORKS_NAME}[0] ${FIP_VM_INSTANCES} sg=${SECURITY_GROUP}
55 OpenStackOperations.Create Vm Instances @{NETWORKS_NAME}[0] ${SNAT_VM_INSTANCES} sg=${SECURITY_GROUP}
57 Check Vm Instances Have Ip Address
58 @{FIP_VM_IPS} ${FLOATING_DHCP_IP} = OpenStackOperations.Get VM IPs @{FIP_VM_INSTANCES}
59 @{SNAT_VM_IPS} ${SNAT_DHCP_IP} = OpenStackOperations.Get VM IPs @{SNAT_VM_INSTANCES}
60 BuiltIn.Set Suite Variable @{FIP_VM_IPS}
61 BuiltIn.Set Suite Variable @{SNAT_VM_IPS}
62 BuiltIn.Should Not Contain ${FIP_VM_IPS} None
63 BuiltIn.Should Not Contain ${SNAT_VM_IPS} None
64 BuiltIn.Should Not Contain ${FLOATING_DHCP_IP} None
65 BuiltIn.Should Not Contain ${SNAT_DHCP_IP} None
66 [Teardown] BuiltIn.Run Keywords OpenStackOperations.Show Debugs @{FIP_VM_INSTANCES} @{SNAT_VM_INSTANCES}
67 ... AND OpenStackOperations.Get Test Teardown Debugs
69 Create External Network And Subnet
70 OpenStackOperations.Create Network ${EXTERNAL_NET_NAME} --provider-network-type flat --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK}
71 OpenStackOperations.Update Network ${EXTERNAL_NET_NAME} --external
72 OpenStackOperations.Create Subnet ${EXTERNAL_NET_NAME} ${EXTERNAL_SUBNET_NAME} ${EXTERNAL_SUBNET} --gateway ${EXTERNAL_GATEWAY} --allocation-pool ${EXTERNAL_SUBNET_ALLOCATION_POOL}
75 [Documentation] Create Router and Add Interface to the subnets.
76 OpenStackOperations.Create Router ${ROUTER_NAME}
78 Add Interfaces To Router
79 [Documentation] Add Interfaces
80 : FOR ${interface} IN @{SUBNETS_NAME}
81 \ OpenStackOperations.Add Router Interface ${ROUTER_NAME} ${interface}
83 Add Router Gateway To Router
84 [Documentation] OpenStackOperations.Add Router Gateway
85 OpenStackOperations.Add Router Gateway ${ROUTER_NAME} ${EXTERNAL_NET_NAME}
88 [Documentation] Check created routers using northbound rest calls
89 ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API}
91 Should Contain ${data} ${ROUTER_NAME}
93 Create And Associate Floating IPs for VMs
94 [Documentation] Create and associate a floating IP for the VM
95 ${VM_FLOATING_IPS} = OpenStackOperations.Create And Associate Floating IPs ${EXTERNAL_NET_NAME} @{FIP_VM_INSTANCES}
96 BuiltIn.Set Suite Variable ${VM_FLOATING_IPS}
97 [Teardown] BuiltIn.Run Keywords OpenStackOperations.Show Debugs @{FIP_VM_INSTANCES}
98 ... AND OpenStackOperations.Get Test Teardown Debugs
100 Ping External Gateway From Control Node
101 [Documentation] Check reachability of external gateway by pinging it from the control node.
102 OpenStackOperations.Ping Vm From Control Node ${EXTERNAL_GATEWAY} additional_args=-I ${EXTERNAL_INTERNET_ADDR}
104 Ping Vm Instance1 Floating IP From Control Node
105 [Documentation] Check reachability of VM instance through floating IP by pinging them.
106 OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[0] additional_args=-I ${EXTERNAL_INTERNET_ADDR}
108 Ping Vm Instance2 Floating IP From Control Node
109 [Documentation] Check reachability of VM instance through floating IP by pinging them.
110 OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[1] additional_args=-I ${EXTERNAL_INTERNET_ADDR}
112 Ping Vm Instance2 Floating IP From Vm Instance1 With Floating IP (Hairpinning)
113 [Documentation] Check reachability of VM instance floating IP from another VM instance with FIP (with ttl=1 to make sure no router hops)
114 ${dst_ip}= BuiltIn.Create List @{VM_FLOATING_IPS}[1]
115 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS_NAME}[0] @{FIP_VM_IPS}[0] ${dst_ip} ttl=1
117 Ping External Network PNF from Vm Instance 1
118 [Documentation] Check reachability of External Network PNF from VM instance (with ttl=1 to make sure no router hops)
119 ${dst_ip}= BuiltIn.Create List ${EXTERNAL_PNF}
120 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS_NAME}[0] @{FIP_VM_IPS}[0] ${dst_ip} ttl=1
122 SNAT - TCP connection to External Gateway From SNAT VM Instance1
123 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT
124 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS_NAME}[0] @{SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY}
126 SNAT - UDP connection to External Gateway From SNAT VM Instance1
127 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT
128 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS_NAME}[0] @{SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY} -u
130 SNAT - TCP connection to External Gateway From SNAT VM Instance2
131 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT
132 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS_NAME}[0] @{SNAT_VM_IPS}[1] ${EXTERNAL_GATEWAY}
134 SNAT - UDP connection to External Gateway From SNAT VM Instance2
135 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT
136 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS_NAME}[0] @{SNAT_VM_IPS}[1] ${EXTERNAL_GATEWAY} -u
139 [Documentation] Delete Vm instances using instance names.
140 : FOR ${vm} IN @{FIP_VM_INSTANCES}
141 \ OpenStackOperations.Delete Vm Instance ${vm}
142 : FOR ${vm} IN @{SNAT_VM_INSTANCES}
143 \ OpenStackOperations.Delete Vm Instance ${vm}
145 Delete Router Interfaces
146 [Documentation] Remove Interface to the subnets.
147 : FOR ${interface} IN @{SUBNETS_NAME}
148 \ OpenStackOperations.Remove Interface ${ROUTER_NAME} ${interface}
151 [Documentation] Delete Router and Interface to the subnets.
152 OpenStackOperations.Delete Router ${ROUTER_NAME}
154 Verify Deleted Router
155 [Documentation] Check deleted router using northbound rest call
156 ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API}
158 BuiltIn.Should Not Contain ${data} ${ROUTER_NAME}
161 [Documentation] Delete Sub Net for the Network with neutron request.
162 OpenStackOperations.Delete SubNet @{SUBNETS_NAME}[0]
165 [Documentation] Delete Networks with neutron request.
166 : FOR ${network} IN @{NETWORKS_NAME}
167 \ OpenStackOperations.Delete Network ${network}
168 OpenStackOperations.Delete Network ${EXTERNAL_NET_NAME}
170 Delete Security Group
171 [Documentation] Delete security groups with neutron request
172 OpenStackOperations.Delete SecurityGroup ${SECURITY_GROUP}
175 [Documentation] Verify that flows have been cleaned up properly after removing all neutron configurations
176 DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes