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
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} l3_ext_net_1 l3_ext_net_2
20 @{SUBNETS} l3_ext_sub_1 l3_ext_sub_2
21 @{ROUTERS} l3_ext_router_1 l3_ext_router_2
22 @{NET1_FIP_VMS} l3_ext_net_1_fip_vm_1 l3_ext_net_1_fip_vm_2
23 @{NET1_SNAT_VMS} l3_ext_net_1_snat_vm_1 l3_ext_net_1_snat_vm_2
24 @{NET2_SNAT_VMS} l3_ext_net_2_snat_vm_3
25 @{SNAT_VMS} @{NET1_SNAT_VMS} @{NET2_SNAT_VMS}
26 @{SUBNET_CIDRS} 41.0.0.0/24 42.0.0.0/24
27 # Parameter values below are based on releng/builder - changing them requires updates in releng/builder as well
28 ${EXTERNAL_GATEWAY} 10.10.10.250
29 ${EXTERNAL_PNF} 10.10.10.253
30 ${EXTERNAL_SUBNET} 10.10.10.0/24
31 ${EXTERNAL_SUBNET_ALLOCATION_POOL} start=10.10.10.2,end=10.10.10.249
32 ${EXTERNAL_INTERNET_ADDR} 10.9.9.9
33 ${EXTERNAL_NET_NAME} external-net
34 ${EXTERNAL_SUBNET_NAME} external-subnet
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] @{NET_1_SNAT_VMS}[0] ${OS_CMP1_HOSTNAME} sg=${SECURITY_GROUP}
61 OpenStackOperations.Create Vm Instance On Compute Node @{NETWORKS}[0] @{NET_1_SNAT_VMS}[1] ${OS_CMP1_HOSTNAME} sg=${SECURITY_GROUP}
62 OpenStackOperations.Create Vm Instance On Compute Node @{NETWORKS}[1] @{NET_2_SNAT_VMS}[0] ${OS_CMP2_HOSTNAME} sg=${SECURITY_GROUP}
64 Check Vm Instances Have Ip Address
65 @{NET1_FIP_VM_IPS} ${NET1_FIP_DHCP_IP} = OpenStackOperations.Get VM IPs @{NET1_FIP_VMS}
66 @{NET1_SNAT_VM_IPS} ${NET1_SNAT_DHCP_IP} = OpenStackOperations.Get VM IPs @{NET1_SNAT_VMS}
67 @{NET2_SNAT_VM_IPS} ${NET2_SNAT_DHCP_IP} = OpenStackOperations.Get VM IPs @{NET2_SNAT_VMS}
68 BuiltIn.Set Suite Variable @{NET1_FIP_VM_IPS}
69 BuiltIn.Set Suite Variable @{NET1_SNAT_VM_IPS}
70 BuiltIn.Set Suite Variable @{NET2_SNAT_VM_IPS}
71 BuiltIn.Should Not Contain ${NET1_FIP_VM_IPS} None
72 BuiltIn.Should Not Contain ${NET1_SNAT_VM_IPS} None
73 BuiltIn.Should Not Contain ${NET2_SNAT_VM_IPS} None
74 BuiltIn.Should Not Contain ${NET1_FIP_DHCP_IP} None
75 BuiltIn.Should Not Contain ${NET1_SNAT_DHCP_IP} None
76 BuiltIn.Should Not Contain ${NET2_SNAT_DHCP_IP} None
77 [Teardown] BuiltIn.Run Keywords OpenStackOperations.Show Debugs @{NET1_FIP_VMS} @{SNAT_VMS}
78 ... AND OpenStackOperations.Get Test Teardown Debugs
80 Create External Network And Subnet
81 OpenStackOperations.Create Network ${EXTERNAL_NET_NAME} --provider-network-type flat --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK}
82 OpenStackOperations.Update Network ${EXTERNAL_NET_NAME} --external
83 OpenStackOperations.Create Subnet ${EXTERNAL_NET_NAME} ${EXTERNAL_SUBNET_NAME} ${EXTERNAL_SUBNET} --gateway ${EXTERNAL_GATEWAY} --allocation-pool ${EXTERNAL_SUBNET_ALLOCATION_POOL}
86 [Documentation] Create Router and Add Interface to the subnets.
87 : FOR ${router} IN @{ROUTERS}
88 \ OpenStackOperations.Create Router ${router}
90 Add Interfaces To Router
91 [Documentation] Add Interfaces
92 : FOR ${router} ${interface} IN ZIP ${ROUTERS} ${SUBNETS}
93 \ OpenStackOperations.Add Router Interface ${router} ${interface}
95 Add Router Gateway To Router
96 [Documentation] OpenStackOperations.Add Router Gateway
97 : FOR ${router} IN @{ROUTERS}
98 \ OpenStackOperations.Add Router Gateway ${router} ${EXTERNAL_NET_NAME}
100 Verify Created Routers
101 [Documentation] Check created routers using northbound rest calls
102 ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API}
104 : FOR ${router} IN @{ROUTERS}
105 \ Should Contain ${data} ${router}
107 Create And Associate Floating IPs for VMs
108 [Documentation] Create and associate a floating IP for the VM
109 ${VM_FLOATING_IPS} = OpenStackOperations.Create And Associate Floating IPs ${EXTERNAL_NET_NAME} @{NET1_FIP_VMS}
110 BuiltIn.Set Suite Variable ${VM_FLOATING_IPS}
111 [Teardown] BuiltIn.Run Keywords OpenStackOperations.Show Debugs @{NET1_FIP_VMS}
112 ... AND OpenStackOperations.Get Test Teardown Debugs
114 Ping External Gateway From Control Node
115 [Documentation] Check reachability of external gateway by pinging it from the control node.
116 OpenStackOperations.Ping Vm From Control Node ${EXTERNAL_GATEWAY} additional_args=-I ${EXTERNAL_INTERNET_ADDR}
118 Ping Vm Instance1 Floating IP From Control Node
119 [Documentation] Check reachability of VM instance through floating IP by pinging them.
120 OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[0] additional_args=-I ${EXTERNAL_INTERNET_ADDR}
122 Ping Vm Instance2 Floating IP From Control Node
123 [Documentation] Check reachability of VM instance through floating IP by pinging them.
124 OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[1] additional_args=-I ${EXTERNAL_INTERNET_ADDR}
126 Ping Vm Instance2 Floating IP From Vm Instance1 With Floating IP (Hairpinning)
127 [Documentation] Check reachability of VM instance floating IP from another VM instance with FIP (with ttl=1 to make sure no router hops)
128 ${dst_ip}= BuiltIn.Create List @{VM_FLOATING_IPS}[1]
129 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_FIP_VM_IPS}[0] ${dst_ip} ttl=1
131 Ping External Network PNF from Vm Instance 1
132 [Documentation] Check reachability of External Network PNF from VM instance (with ttl=1 to make sure no router hops)
133 ${dst_ip}= BuiltIn.Create List ${EXTERNAL_PNF}
134 OpenStackOperations.Test Operations From Vm Instance @{NETWORKS}[0] @{NET1_FIP_VM_IPS}[0] ${dst_ip} ttl=1
136 SNAT - TCP connection to External Gateway From SNAT VM Instance1
137 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT
138 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY}
140 SNAT - UDP connection to External Gateway From SNAT VM Instance1
141 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT
142 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY} -u
144 SNAT - TCP connection to External Gateway From SNAT VM Instance2
145 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT
146 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[1] ${EXTERNAL_GATEWAY}
148 SNAT - UDP connection to External Gateway From SNAT VM Instance2
149 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT
150 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[0] @{NET1_SNAT_VM_IPS}[1] ${EXTERNAL_GATEWAY} -u
152 SNAT - TCP connection to External Gateway From SNAT VM Instance3
153 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT
154 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[1] @{NET2_SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY}
156 SNAT - UDP connection to External Gateway From SNAT VM Instance3
157 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT
158 OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS}[1] @{NET2_SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY} -u
161 [Documentation] Delete Vm instances using instance names.
162 : FOR ${vm} IN @{NET1_FIP_VMS}
163 \ OpenStackOperations.Delete Vm Instance ${vm}
164 : FOR ${vm} IN @{SNAT_VMS}
165 \ OpenStackOperations.Delete Vm Instance ${vm}
167 Delete Router Interfaces
168 [Documentation] Remove Interface to the subnets.
169 : FOR ${router} ${interface} IN ZIP ${ROUTERS} ${SUBNETS}
170 \ OpenStackOperations.Remove Interface ${router} ${interface}
173 [Documentation] Delete Router and Interface to the subnets.
174 : FOR ${router} IN @{ROUTERS}
175 \ OpenStackOperations.Delete Router ${router}
177 Verify Deleted Router
178 [Documentation] Check deleted router using northbound rest call
179 ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API}
181 : FOR ${router} IN @{ROUTERS}
182 \ BuiltIn.Should Not Contain ${data} ${ROUTER}
185 [Documentation] Delete Networks with neutron request.
186 : FOR ${network} IN @{NETWORKS}
187 \ OpenStackOperations.Delete Network ${network}
188 OpenStackOperations.Delete Network ${EXTERNAL_NET_NAME}
190 Delete Security Group
191 [Documentation] Delete security groups with neutron request
192 OpenStackOperations.Delete SecurityGroup ${SECURITY_GROUP}
195 [Documentation] Verify that flows have been cleaned up properly after removing all neutron configurations
196 DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes