2 Documentation Test suite to validate vpnservice functionality in an openstack integrated environment.
3 ... The assumption of this suite is that the environment is already configured with the proper
4 ... integration bridges and vxlan tunnels.
5 Suite Setup BuiltIn.Run Keywords SetupUtils.Setup_Utils_For_Setup_And_Teardown
6 ... AND DevstackUtils.Devstack Suite Setup
7 Suite Teardown Close All Connections
8 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
9 Test Teardown Get OvsDebugInfo
10 Library OperatingSystem
11 Library RequestsLibrary
12 Resource ../../../libraries/Utils.robot
13 Resource ../../../libraries/OpenStackOperations.robot
14 Resource ../../../libraries/DevstackUtils.robot
15 Resource ../../../libraries/VpnOperations.robot
16 Resource ../../../libraries/OVSDB.robot
17 Resource ../../../libraries/SetupUtils.robot
18 Variables ../../../variables/Variables.py
21 @{NETWORKS} NET10 NET20
22 @{SUBNETS} SUBNET1 SUBNET2
23 @{SUBNET_CIDR} 10.1.1.0/24 20.1.1.0/24
24 @{PORT_LIST} PORT11 PORT21 PORT12 PORT22
25 @{VM_INSTANCES_NET10} VM11 VM21
26 @{VM_INSTANCES_NET20} VM12 VM22
27 @{ROUTERS} ROUTER_1 ROUTER_2
28 @{VPN_INSTANCE_ID} 4ae8cd92-48ca-49b5-94e1-b2921a261111 4ae8cd92-48ca-49b5-94e1-b2921a261112 4ae8cd92-48ca-49b5-94e1-b2921a261113
29 @{VPN_NAME} vpn1 vpn2 vpn3
30 @{CREATE_RD} ["2200:2"] ["2300:2"] ["2400:2"]
31 @{CREATE_EXPORT_RT} ["2200:2"] ["2300:2"] ["2400:2"]
32 @{CREATE_IMPORT_RT} ["2200:2"] ["2300:2"] ["2400:2"]
33 @{EXTRA_NW_IP} 40.1.1.2 50.1.1.2
34 # Values passed for extra routes
35 ${RT_OPTIONS} --routes type=dict list=true
36 ${RT_CLEAR} --routes action=clear
39 Create Neutron Networks
40 [Documentation] Create two networks
41 Create Network ${NETWORKS[0]}
42 Create Network ${NETWORKS[1]}
43 ${NET_LIST} List Networks
45 Should Contain ${NET_LIST} ${NETWORKS[0]}
46 Should Contain ${NET_LIST} ${NETWORKS[1]}
48 Create Neutron Subnets
49 [Documentation] Create two subnets for previously created networks
50 Create SubNet ${NETWORKS[0]} ${SUBNETS[0]} ${SUBNET_CIDR[0]}
51 Create SubNet ${NETWORKS[1]} ${SUBNETS[1]} ${SUBNET_CIDR[1]}
52 ${SUB_LIST} List Subnets
54 Should Contain ${SUB_LIST} ${SUBNETS[0]}
55 Should Contain ${SUB_LIST} ${SUBNETS[1]}
58 [Documentation] Allow all TCP/UDP/ICMP packets for this suite
59 Neutron Security Group Create sg-vpnservice
60 Neutron Security Group Rule Create sg-vpnservice direction=ingress port_range_max=65535 port_range_min=1 protocol=tcp remote_ip_prefix=0.0.0.0/0
61 Neutron Security Group Rule Create sg-vpnservice direction=egress port_range_max=65535 port_range_min=1 protocol=tcp remote_ip_prefix=0.0.0.0/0
62 Neutron Security Group Rule Create sg-vpnservice direction=ingress protocol=icmp remote_ip_prefix=0.0.0.0/0
63 Neutron Security Group Rule Create sg-vpnservice direction=egress protocol=icmp remote_ip_prefix=0.0.0.0/0
64 Neutron Security Group Rule Create sg-vpnservice direction=ingress port_range_max=65535 port_range_min=1 protocol=udp remote_ip_prefix=0.0.0.0/0
65 Neutron Security Group Rule Create sg-vpnservice direction=egress port_range_max=65535 port_range_min=1 protocol=udp remote_ip_prefix=0.0.0.0/0
68 [Documentation] Create four ports under previously created subnets
69 Create Port ${NETWORKS[0]} ${PORT_LIST[0]} sg=sg-vpnservice
70 Create Port ${NETWORKS[0]} ${PORT_LIST[1]} sg=sg-vpnservice
71 Create Port ${NETWORKS[1]} ${PORT_LIST[2]} sg=sg-vpnservice
72 Create Port ${NETWORKS[1]} ${PORT_LIST[3]} sg=sg-vpnservice
74 Check OpenDaylight Neutron Ports
75 [Documentation] Checking OpenDaylight Neutron API for known ports
76 ${resp} RequestsLibrary.Get Request session ${NEUTRON_PORTS_API}
78 Should be Equal As Strings ${resp.status_code} 200
81 [Documentation] Create Vm instances on compute node with port
82 Create Vm Instance With Port On Compute Node ${PORT_LIST[0]} ${VM_INSTANCES_NET10[0]} ${OS_COMPUTE_1_IP} sg=sg-vpnservice
83 Create Vm Instance With Port On Compute Node ${PORT_LIST[1]} ${VM_INSTANCES_NET10[1]} ${OS_COMPUTE_2_IP} sg=sg-vpnservice
84 Create Vm Instance With Port On Compute Node ${PORT_LIST[2]} ${VM_INSTANCES_NET20[0]} ${OS_COMPUTE_1_IP} sg=sg-vpnservice
85 Create Vm Instance With Port On Compute Node ${PORT_LIST[3]} ${VM_INSTANCES_NET20[1]} ${OS_COMPUTE_2_IP} sg=sg-vpnservice
87 Wait Until Keyword Succeeds 30s 10s Wait For Routes To Propogate
88 ${VM_IP_NET10} ${DHCP_IP1} Wait Until Keyword Succeeds 30s 10s Verify VMs Received DHCP Lease @{VM_INSTANCES_NET10}
90 Set Suite Variable ${VM_IP_NET10}
91 ${VM_IP_NET20} ${DHCP_IP2} Wait Until Keyword Succeeds 30s 10s Verify VMs Received DHCP Lease @{VM_INSTANCES_NET20}
93 Set Suite Variable ${VM_IP_NET20}
95 Check ELAN Datapath Traffic Within The Networks
96 [Documentation] Checks datapath within the same network with different vlans.
97 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ping -c 3 ${VM_IP_NET10[1]}
98 Should Contain ${output} 64 bytes
99 ${output} = Execute Command on VM Instance @{NETWORKS}[1] ${VM_IP_NET20[0]} ping -c 3 ${VM_IP_NET20[1]}
100 Should Contain ${output} 64 bytes
103 [Documentation] Create Router
104 Create Router ${ROUTERS[0]}
106 Add Interfaces To Router
107 [Documentation] Add Interfaces
108 : FOR ${INTERFACE} IN @{SUBNETS}
109 \ Add Router Interface ${ROUTERS[0]} ${INTERFACE}
111 Check L3_Datapath Traffic Across Networks With Router
112 [Documentation] Datapath test across the networks using router for L3.
113 ${dst_ip_list} = Create List ${VM_IP_NET10[1]} ${VM_IP_NET20[0]} ${VM_IP_NET20[1]}
115 Test Operations From Vm Instance ${NETWORKS[0]} ${VM_IP_NET10[1]} ${dst_ip_list}
116 ${dst_ip_list} = Create List ${VM_IP_NET20[1]} ${VM_IP_NET10[0]} ${VM_IP_NET10[1]}
118 Test Operations From Vm Instance ${NETWORKS[1]} ${VM_IP_NET20[0]} ${dst_ip_list}
120 Add Multiple Extra Routes And Check Datapath Before L3VPN Creation
121 [Documentation] Add multiple extra routes and check data path before L3VPN creation
122 Log "Adding extra one route to VM"
123 ${CONFIG_EXTRA_ROUTE_IP1} = Catenate sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
124 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ${CONFIG_EXTRA_ROUTE_IP1}
125 ${CONFIG_EXTRA_ROUTE_IP2} = Catenate sudo ifconfig eth0:2 @{EXTRA_NW_IP}[1] netmask 255.255.255.0 up
126 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ${CONFIG_EXTRA_ROUTE_IP2}
127 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ifconfig
128 ${EXT_RT1} = Set Variable destination=40.1.1.0/24,nexthop=${VM_IP_NET10[0]}
129 ${EXT_RT2} = Set Variable destination=50.1.1.0/24,nexthop=${VM_IP_NET10[0]}
130 ${cmd} = Catenate ${RT_OPTIONS} ${EXT_RT1} ${EXT_RT2}
131 Update Router @{ROUTERS}[0] ${cmd}
132 Show Router @{ROUTERS}[0] -D
133 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[1]} ping -c 3 @{EXTRA_NW_IP}[1]
134 Should Contain ${output} 64 bytes
135 ${output} = Execute Command on VM Instance @{NETWORKS}[1] ${VM_IP_NET20[1]} ping -c 3 @{EXTRA_NW_IP}[1]
136 Should Contain ${output} 64 bytes
137 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[1]} ping -c 3 @{EXTRA_NW_IP}[0]
138 Should Contain ${output} 64 bytes
141 [Documentation] Delete the extra routes
142 Update Router @{ROUTERS}[0] ${RT_CLEAR}
143 Show Router @{ROUTERS}[0] -D
145 Delete And Recreate Extra Route
146 [Documentation] Recreate multiple extra route and check data path before L3VPN creation
147 Log "Adding extra route to VM"
148 ${CONFIG_EXTRA_ROUTE_IP1} = Catenate sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
149 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ${CONFIG_EXTRA_ROUTE_IP1}
150 ${EXT_RT1} = Set Variable destination=40.1.1.0/24,nexthop=${VM_IP_NET10[0]}
151 ${cmd} = Catenate ${RT_OPTIONS} ${EXT_RT1}
152 Update Router @{ROUTERS}[0] ${cmd}
153 Show Router @{ROUTERS}[0] -D
154 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[1]} ping -c 3 @{EXTRA_NW_IP}[0]
155 Should Contain ${output} 64 bytes
156 Update Router @{ROUTERS}[0] ${RT_CLEAR}
157 Show Router @{ROUTERS}[0] -D
159 Delete Router Interfaces
160 [Documentation] Remove Interface to the subnets.
161 : FOR ${INTERFACE} IN @{SUBNETS}
162 \ Remove Interface ${ROUTERS[0]} ${INTERFACE}
165 [Documentation] Creates L3VPN and verify the same
166 ${devstack_conn_id} = Get ControlNode Connection
167 Switch Connection ${devstack_conn_id}
168 ${net_id} = Get Net Id @{NETWORKS}[0] ${devstack_conn_id}
169 ${tenant_id} = Get Tenant ID From Network ${net_id}
170 VPN Create L3VPN vpnid=${VPN_INSTANCE_ID[0]} name=${VPN_NAME[0]} rd=${CREATE_RD[0]} exportrt=${CREATE_EXPORT_RT[0]} importrt=${CREATE_IMPORT_RT[0]} tenantid=${tenant_id}
171 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
172 Should Contain ${resp} ${VPN_INSTANCE_ID[0]}
174 Associate L3VPN To Routers
175 [Documentation] Associating router to L3VPN
176 ${devstack_conn_id}= Get ControlNode Connection
177 ${router_id}= Get Router Id ${ROUTERS[0]} ${devstack_conn_id}
178 Associate VPN to Router routerid=${router_id} vpnid=${VPN_INSTANCE_ID[0]}
179 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
180 Should Contain ${resp} ${router_id}
182 Dissociate L3VPN To Routers
183 [Documentation] Dissociating router from L3VPN
184 ${devstack_conn_id}= Get ControlNode Connection
185 ${router_id}= Get Router Id ${ROUTERS[0]} ${devstack_conn_id}
186 Dissociate VPN to Router routerid=${router_id} vpnid=${VPN_INSTANCE_ID[0]}
187 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
188 Should Not Contain ${resp} ${router_id}
190 Associate L3VPN To Networks
191 [Documentation] Associates L3VPN to networks and verify
192 ${devstack_conn_id} = Get ControlNode Connection
193 ${network1_id} = Get Net Id ${NETWORKS[0]} ${devstack_conn_id}
194 ${network2_id} = Get Net Id ${NETWORKS[1]} ${devstack_conn_id}
195 Associate L3VPN To Network networkid=${network1_id} vpnid=${VPN_INSTANCE_ID[0]}
196 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
197 Should Contain ${resp} ${network1_id}
198 Associate L3VPN To Network networkid=${network2_id} vpnid=${VPN_INSTANCE_ID[0]}
199 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
200 Should Contain ${resp} ${network2_id}
202 Dissociate L3VPN From Networks
203 [Documentation] Dissociate L3VPN from networks
204 ${devstack_conn_id} = Get ControlNode Connection
205 ${network1_id} = Get Net Id ${NETWORKS[0]} ${devstack_conn_id}
206 ${network2_id} = Get Net Id ${NETWORKS[1]} ${devstack_conn_id}
207 Dissociate L3VPN From Networks networkid=${network1_id} vpnid=${VPN_INSTANCE_ID[0]}
208 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
209 Should Not Contain ${resp} ${network1_id}
210 Dissociate L3VPN From Networks networkid=${network2_id} vpnid=${VPN_INSTANCE_ID[0]}
211 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
212 Should Not Contain ${resp} ${network2_id}
215 [Documentation] Delete Router and Interface to the subnets.
216 Delete Router ${ROUTERS[0]}
219 [Documentation] Delete L3VPN
220 VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[0]}
222 Create Multiple L3VPN
223 [Documentation] Creates three L3VPNs and then verify the same
224 ${devstack_conn_id} = Get ControlNode Connection
225 Switch Connection ${devstack_conn_id}
226 ${net_id} = Get Net Id @{NETWORKS}[0] ${devstack_conn_id}
227 ${tenant_id} = Get Tenant ID From Network ${net_id}
228 VPN Create L3VPN vpnid=${VPN_INSTANCE_ID[0]} name=${VPN_NAME[0]} rd=${CREATE_RD[0]} exportrt=${CREATE_EXPORT_RT[0]} importrt=${CREATE_IMPORT_RT[0]} tenantid=${tenant_id}
229 VPN Create L3VPN vpnid=${VPN_INSTANCE_ID[1]} name=${VPN_NAME[1]} rd=${CREATE_RD[1]} exportrt=${CREATE_EXPORT_RT[1]} importrt=${CREATE_IMPORT_RT[1]} tenantid=${tenant_id}
230 VPN Create L3VPN vpnid=${VPN_INSTANCE_ID[2]} name=${VPN_NAME[2]} rd=${CREATE_RD[2]} exportrt=${CREATE_EXPORT_RT[2]} importrt=${CREATE_IMPORT_RT[2]} tenantid=${tenant_id}
231 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
232 Should Contain ${resp} ${VPN_INSTANCE_ID[0]}
233 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[1]}
234 Should Contain ${resp} ${VPN_INSTANCE_ID[1]}
235 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[2]}
236 Should Contain ${resp} ${VPN_INSTANCE_ID[2]}
238 Delete Multiple L3VPN
239 [Documentation] Delete three L3VPNs created using Multiple L3VPN Test
240 VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[0]}
241 VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[1]}
242 VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[2]}
244 Check Datapath Traffic Across Networks With L3VPN
245 [Documentation] Datapath Test Across the networks with VPN.
247 Log This test will be added in the next patch
250 [Documentation] Delete Vm instances in the given Instance List
251 @{VM_INSTANCES} Collections.Combine Lists @{VM_INSTANCES_NET10} @{VM_INSTANCES_NET20}
252 : FOR ${VmInstance} IN @{VM_INSTANCES}
253 \ Delete Vm Instance ${VmInstance}
256 [Documentation] Delete Neutron Ports in the given Port List.
257 : FOR ${Port} IN @{PORT_LIST}
258 \ Delete Port ${Port}
261 [Documentation] Delete Sub Nets in the given Subnet List.
262 : FOR ${Subnet} IN @{SUBNETS}
263 \ Delete SubNet ${Subnet}
266 [Documentation] Delete Networks in the given Net List
267 : FOR ${Network} IN @{NETWORKS}
268 \ Delete Network ${Network}
271 [Documentation] Checks that vxlan tunnels are created successfully. This testcase expects that the two DPNs are in the same network hence populates the gateway accordingly.
272 ${node_1_dpid} = Get DPID ${OS_COMPUTE_1_IP}
273 ${node_2_dpid} = Get DPID ${OS_COMPUTE_2_IP}
274 ${node_1_adapter} = Get Ethernet Adapter ${OS_COMPUTE_1_IP}
275 ${node_2_adapter} = Get Ethernet Adapter ${OS_COMPUTE_2_IP}
276 ${subnet} = Get Subnet ${OS_COMPUTE_1_IP}
277 ${gateway} = Get Default Gateway ${OS_COMPUTE_1_IP}
278 ITM Create Tunnel tunneltype=vxlan vlanid=0 prefix=${subnet} gateway=${gateway} ipaddress1=${OS_COMPUTE_1_IP} dpnid1=${node_1_dpid}
279 ... portname1=${node_1_adapter} ipaddress2=${OS_COMPUTE_2_IP} dpnid2=${node_2_dpid} portname2=${node_2_adapter}
280 Get DumpFlows And Ovsconfig ${OS_COMPUTE_1_IP}
281 Get DumpFlows And Ovsconfig ${OS_COMPUTE_2_IP}
282 ${output} = ITM Get Tunnels
286 [Documentation] Delete tunnels with specific transport-zone.
287 ITM Delete Tunnel TZA
290 Basic Vpnservice Suite Setup
291 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
293 Basic Vpnservice Suite Teardown
296 Wait For Routes To Propogate
297 ${devstack_conn_id} = Get ControlNode Connection
298 Switch Connection ${devstack_conn_id}
299 ${net_id} = Get Net Id @{NETWORKS}[0] ${devstack_conn_id}
300 ${output} = Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ip route ]>
301 Should Contain ${output} @{SUBNET_CIDR}[0]
302 ${net_id} = Get Net Id @{NETWORKS}[1] ${devstack_conn_id}
303 ${output} = Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ip route ]>
304 Should Contain ${output} @{SUBNET_CIDR}[1]