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
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
17 ${SECURITY_GROUP} l3_ext_sg
18 @{NETWORKS} l3_ext_net
20 ${ROUTER} l3_ext_router
21 @{FIP_VMS} fip_vm_1 fip_vm_2
22 @{SNAT_VMS} snat_vm_1 snat_vm_2
23 @{SUBNET_CIDRS} 41.0.0.0/24
24 # Parameter values below are based on releng/builder - changing them requires updates in releng/builder as well
25 ${EXTERNAL_GATEWAY} 10.10.10.250
26 ${EXTERNAL_PNF} 10.10.10.253
27 ${EXTERNAL_SUBNET} 10.10.10.0/24
28 ${EXTERNAL_SUBNET_ALLOCATION_POOL} start=10.10.10.2,end=10.10.10.249
29 ${EXTERNAL_INTERNET_ADDR} 10.9.9.9
30 ${EXTERNAL_NET_NAME} external-net
31 ${EXTERNAL_SUBNET_NAME} external-subnet
34 Create All Controller Sessions
35 [Documentation] Create sessions for all three controllers
36 ClusterManagement.ClusterManagement Setup
38 Create Private Network
39 [Documentation] Create Network with neutron request.
40 : FOR ${network} IN @{NETWORKS}
41 \ OpenStackOperations.Create Network ${network}
43 Create Subnet For Private Network
44 [Documentation] Create Sub Net for the Network with neutron request.
45 OpenStackOperations.Create SubNet @{NETWORKS}[0] @{SUBNETS}[0] @{SUBNET_CIDRS}[0]
48 [Documentation] Allow all TCP/UDP/ICMP packets for this suite
49 OpenStackOperations.Create Allow All SecurityGroup ${SECURITY_GROUP}
52 [Documentation] Create VM instances using flavor and image names for a network.
53 OpenStackOperations.Create Vm Instance On Compute Node @{NETWORKS}[0] @{FIP_VMS}[0] ${OS_CMP1_HN} sg=${SECURITY_GROUP}
54 OpenStackOperations.Create Vm Instance On Compute Node @{NETWORKS}[0] @{FIP_VMS}[1] ${OS_CMP2_HN} sg=${SECURITY_GROUP}
55 OpenStackOperations.Create Vm Instance On Compute Node @{NETWORKS}[0] @{SNAT_VMS}[0] ${OS_CMP1_HN} sg=${SECURITY_GROUP}
56 OpenStackOperations.Create Vm Instance On Compute Node @{NETWORKS}[0] @{SNAT_VMS}[1] ${OS_CMP2_HN} sg=${SECURITY_GROUP}
58 Check Vm Instances Have Ip Address
59 @{FIP_VM_IPS} ${FLOATING_DHCP_IP} = OpenStackOperations.Get VM IPs @{FIP_VMS}
60 @{SNAT_VM_IPS} ${SNAT_DHCP_IP} = OpenStackOperations.Get VM IPs @{SNAT_VMS}
61 BuiltIn.Set Suite Variable @{FIP_VM_IPS}
62 BuiltIn.Set Suite Variable @{SNAT_VM_IPS}
63 BuiltIn.Should Not Contain ${FIP_VM_IPS} None
64 BuiltIn.Should Not Contain ${SNAT_VM_IPS} None
65 BuiltIn.Should Not Contain ${FLOATING_DHCP_IP} None
66 BuiltIn.Should Not Contain ${SNAT_DHCP_IP} None
67 [Teardown] BuiltIn.Run Keywords OpenStackOperations.Show Debugs @{FIP_VMS} @{SNAT_VMS}
68 ... AND OpenStackOperations.Get Test Teardown Debugs
70 Create External Network And Subnet
71 OpenStackOperations.Create Network ${EXTERNAL_NET_NAME} --provider-network-type flat --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK}
72 OpenStackOperations.Update Network ${EXTERNAL_NET_NAME} --external
73 OpenStackOperations.Create Subnet ${EXTERNAL_NET_NAME} ${EXTERNAL_SUBNET_NAME} ${EXTERNAL_SUBNET} --gateway ${EXTERNAL_GATEWAY} --allocation-pool ${EXTERNAL_SUBNET_ALLOCATION_POOL}
76 [Documentation] Create Router and Add Interface to the subnets.
77 OpenStackOperations.Create Router ${ROUTER}
79 Add Interfaces To Router
80 [Documentation] Add Interfaces
81 : FOR ${interface} IN @{SUBNETS}
82 \ OpenStackOperations.Add Router Interface ${ROUTER} ${interface}
84 Add Router Gateway To Router
85 [Documentation] OpenStackOperations.Add Router Gateway
86 OpenStackOperations.Add Router Gateway ${ROUTER} ${EXTERNAL_NET_NAME}
89 [Documentation] Check created routers using northbound rest calls
90 ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API}
92 Should Contain ${data} ${ROUTER}
94 Create And Associate Floating IPs for VMs
95 [Documentation] Create and associate a floating IP for the VM
96 ${VM_FLOATING_IPS} = OpenStackOperations.Create And Associate Floating IPs ${EXTERNAL_NET_NAME} @{FIP_VMS}
97 BuiltIn.Set Suite Variable ${VM_FLOATING_IPS}
98 [Teardown] BuiltIn.Run Keywords OpenStackOperations.Show Debugs @{FIP_VMS}
99 ... AND OpenStackOperations.Get Test Teardown Debugs
101 Ping External Gateway From Control Node
102 [Documentation] Check reachability of external gateway by pinging it from the control node.
103 OpenStackOperations.Ping Vm From Control Node ${EXTERNAL_GATEWAY} additional_args=-I ${EXTERNAL_INTERNET_ADDR}
105 Ping Vm Instance1 Floating IP From Control Node
106 [Documentation] Check reachability of VM instance through floating IP by pinging them.
107 OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[0] additional_args=-I ${EXTERNAL_INTERNET_ADDR}
109 Ping Vm Instance2 Floating IP From Control Node
110 [Documentation] Check reachability of VM instance through floating IP by pinging them.
111 OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[1] additional_args=-I ${EXTERNAL_INTERNET_ADDR}
113 Ping Vm Instance2 Floating IP From Vm Instance1 With Floating IP (Hairpinning)
114 [Documentation] Check reachability of VM instance floating IP from another VM instance with FIP (with ttl=1 to make sure no router hops)
115 ${dst_ip}= BuiltIn.Create List @{VM_FLOATING_IPS}[1]
116 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{FIP_VM_IPS}[0] ${dst_ip} ttl=1
118 Ping External Network PNF from Vm Instance 1
119 [Documentation] Check reachability of External Network PNF from VM instance (with ttl=1 to make sure no router hops)
120 ${dst_ip}= BuiltIn.Create List ${EXTERNAL_PNF}
121 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{FIP_VM_IPS}[0] ${dst_ip} ttl=1
123 SNAT - TCP connection to External Gateway From SNAT VM Instance1
124 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT
125 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY}
127 SNAT - UDP connection to External Gateway From SNAT VM Instance1
128 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT
129 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY} -u
131 SNAT - TCP connection to External Gateway From SNAT VM Instance2
132 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT
133 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{SNAT_VM_IPS}[1] ${EXTERNAL_GATEWAY}
135 SNAT - UDP connection to External Gateway From SNAT VM Instance2
136 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT
137 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{SNAT_VM_IPS}[1] ${EXTERNAL_GATEWAY} -u
140 [Documentation] Delete Vm instances using instance names.
141 : FOR ${vm} IN @{FIP_VMS}
142 \ OpenStackOperations.Delete Vm Instance ${vm}
143 : FOR ${vm} IN @{SNAT_VMS}
144 \ OpenStackOperations.Delete Vm Instance ${vm}
146 Delete Router Interfaces
147 [Documentation] Remove Interface to the subnets.
148 : FOR ${interface} IN @{SUBNETS}
149 \ OpenStackOperations.Remove Interface ${ROUTER} ${interface}
152 [Documentation] Delete Router and Interface to the subnets.
153 OpenStackOperations.Delete Router ${ROUTER}
155 Verify Deleted Router
156 [Documentation] Check deleted router using northbound rest call
157 ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API}
159 BuiltIn.Should Not Contain ${data} ${ROUTER}
162 [Documentation] Delete Sub Net for the Network with neutron request.
163 OpenStackOperations.Delete SubNet @{SUBNETS}[0]
166 [Documentation] Delete Networks with neutron request.
167 : FOR ${network} IN @{NETWORKS}
168 \ OpenStackOperations.Delete Network ${network}
169 OpenStackOperations.Delete Network ${EXTERNAL_NET_NAME}
171 Delete Security Group
172 [Documentation] Delete security groups with neutron request
173 OpenStackOperations.Delete SecurityGroup ${SECURITY_GROUP}
176 [Documentation] Verify that flows have been cleaned up properly after removing all neutron configurations
177 DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes