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 Basic Vpnservice Suite Setup
6 Suite Teardown Basic Vpnservice Suite Teardown
7 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
8 Test Teardown Get Test Teardown Debugs
9 Library OperatingSystem
10 Library RequestsLibrary
11 Resource ../../../libraries/Utils.robot
12 Resource ../../../libraries/OpenStackOperations.robot
13 Resource ../../../libraries/DevstackUtils.robot
14 Resource ../../../libraries/VpnOperations.robot
15 Resource ../../../libraries/OVSDB.robot
16 Resource ../../../libraries/SetupUtils.robot
17 Resource ../../../libraries/Tcpdump.robot
18 Resource ../../../variables/Variables.robot
19 Resource ../../../variables/netvirt/Variables.robot
22 @{NETWORKS} NET10 NET20
23 @{SUBNETS} SUBNET1 SUBNET2
24 @{SUBNETS_CIDR} 10.1.1.0/24 20.1.1.0/24
25 @{PORT_LIST} PORT11 PORT21 PORT12 PORT22
26 @{VM_INSTANCES_NET10} VM11 VM21
27 @{VM_INSTANCES_NET20} VM12 VM22
29 @{EXTRA_NW_IP} 40.1.1.2 50.1.1.2
30 @{EXTRA_NW_SUBNET} 40.1.1.0/24 50.1.1.0/24
31 ${SECURITY_GROUP} sg-vpnservice
32 ${UPDATE_NETWORK} UpdateNetwork
33 ${UPDATE_SUBNET} UpdateSubnet
34 ${UPDATE_PORT} UpdatePort
37 Create Neutron Networks
38 [Documentation] Create two networks
39 # TODO: Many of these steps to verify if updates occurred should be in a different suite
40 # that is checking for such operations.
41 Create Network ${NETWORKS[0]}
42 Create Network ${NETWORKS[1]}
43 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${NETWORK_URL} ${NETWORKS}
44 Update Network ${NETWORKS[0]} additional_args=--description ${UPDATE_NETWORK}
45 ${output} = Show Network ${NETWORKS[0]}
46 Should Contain ${output} ${UPDATE_NETWORK}
48 Create Neutron Subnets
49 [Documentation] Create two subnets for previously created networks
50 Create SubNet ${NETWORKS[0]} ${SUBNETS[0]} ${SUBNETS_CIDR[0]}
51 Create SubNet ${NETWORKS[1]} ${SUBNETS[1]} ${SUBNETS_CIDR[1]}
52 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${SUBNETWORK_URL} ${SUBNETS}
53 Update SubNet ${SUBNETS[0]} additional_args=--description ${UPDATE_SUBNET}
54 ${output} = Show SubNet ${SUBNETS[0]}
55 Should Contain ${output} ${UPDATE_SUBNET}
58 [Documentation] Allow all TCP/UDP/ICMP packets for this suite
59 OpenStackOperations.Create Allow All SecurityGroup ${SECURITY_GROUP}
62 [Documentation] Create four ports under previously created subnets
63 ${allowed_address_pairs_args}= Set Variable If '${OPENSTACK_BRANCH}'=='stable/newton' --allowed-address ip_address=${EXTRA_NW_SUBNET[0]} --allowed-address ip_address=${EXTRA_NW_SUBNET[1]} --allowed-address ip-address=${EXTRA_NW_SUBNET[0]} --allowed-address ip-address=${EXTRA_NW_SUBNET[1]}
64 Create Port ${NETWORKS[0]} ${PORT_LIST[0]} sg=${SECURITY_GROUP} additional_args=${allowed_address_pairs_args}
65 Create Port ${NETWORKS[0]} ${PORT_LIST[1]} sg=${SECURITY_GROUP} additional_args=${allowed_address_pairs_args}
66 Create Port ${NETWORKS[1]} ${PORT_LIST[2]} sg=${SECURITY_GROUP} additional_args=${allowed_address_pairs_args}
67 Create Port ${NETWORKS[1]} ${PORT_LIST[3]} sg=${SECURITY_GROUP} additional_args=${allowed_address_pairs_args}
68 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${CONFIG_API}/neutron:neutron/ports/ ${PORT_LIST}
69 ${PORTS_MACADDR} = Get Ports MacAddr ${PORT_LIST}
70 Set Suite Variable ${PORTS_MACADDR}
71 Update Port ${PORT_LIST[0]} additional_args=--description ${UPDATE_PORT}
72 ${output} = Show Port ${PORT_LIST[0]}
73 Should Contain ${output} ${UPDATE_PORT}
76 [Documentation] Create Vm instances on compute node with port
77 Create Vm Instance With Port On Compute Node ${PORT_LIST[0]} ${VM_INSTANCES_NET10[0]} ${OS_COMPUTE_1_IP} sg=${SECURITY_GROUP}
78 Create Vm Instance With Port On Compute Node ${PORT_LIST[1]} ${VM_INSTANCES_NET10[1]} ${OS_COMPUTE_2_IP} sg=${SECURITY_GROUP}
79 Create Vm Instance With Port On Compute Node ${PORT_LIST[2]} ${VM_INSTANCES_NET20[0]} ${OS_COMPUTE_1_IP} sg=${SECURITY_GROUP}
80 Create Vm Instance With Port On Compute Node ${PORT_LIST[3]} ${VM_INSTANCES_NET20[1]} ${OS_COMPUTE_2_IP} sg=${SECURITY_GROUP}
81 @{VM_IP_NET10} ${DHCP_IP1} = Get VM IPs @{VM_INSTANCES_NET10}
82 @{VM_IP_NET20} ${DHCP_IP2} = Get VM IPs @{VM_INSTANCES_NET20}
83 Set Suite Variable @{VM_IP_NET10}
84 Set Suite Variable @{VM_IP_NET20}
85 Should Not Contain ${VM_IP_NET10} None
86 Should Not Contain ${VM_IP_NET20} None
87 Should Not Contain ${DHCP_IP1} None
88 Should Not Contain ${DHCP_IP2} None
89 Wait Until Keyword Succeeds 30s 10s Wait For Routes To Propogate ${NETWORKS} ${SUBNETS_CIDR}
90 [Teardown] Run Keywords Show Debugs @{VM_INSTANCES_NET10} @{VM_INSTANCES_NET20}
91 ... AND Get Test Teardown Debugs
93 Check ELAN Datapath Traffic Within The Networks
94 [Documentation] Checks datapath within the same network with different vlans.
95 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ping -c 3 ${VM_IP_NET10[1]}
96 Should Contain ${output} 64 bytes
97 ${output} = Execute Command on VM Instance @{NETWORKS}[1] ${VM_IP_NET20[0]} ping -c 3 ${VM_IP_NET20[1]}
98 Should Contain ${output} 64 bytes
101 [Documentation] Create Router
102 Create Router ${ROUTERS[0]}
103 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${ROUTER_URL} ${ROUTERS}
105 Add Interfaces To Router
106 [Documentation] Add Interfaces
107 : FOR ${INTERFACE} IN @{SUBNETS}
108 \ Add Router Interface ${ROUTERS[0]} ${INTERFACE}
109 ${interface_output} = Show Router Interface ${ROUTERS[0]}
110 ${GWMAC_ADDRS} ${GWIP_ADDRS} = VpnOperations.Get Gateway MAC And IP Address ${ROUTERS[0]}
111 Set Suite Variable ${GWMAC_ADDRS}
112 Set Suite Variable ${GWIP_ADDRS}
114 Check L3_Datapath Traffic Across Networks With Router
115 [Documentation] Datapath test across the networks using router for L3.
116 Log Verification of FIB Entries and Flow
117 ${cn1_conn_id} = Start Packet Capture on Node ${OS_COMPUTE_1_IP} file_Name=tcpDumpCN1
118 ${cn2_conn_id} = Start Packet Capture on Node ${OS_COMPUTE_2_IP} file_Name=tcpDumpCN2
119 ${os_conn_id} = Start Packet Capture on Node ${OS_CONTROL_NODE_IP} file_Name=tcpDumpOS
120 ${vm_instances} = Create List @{VM_IP_NET10} @{VM_IP_NET20}
121 Wait Until Keyword Succeeds 30s 10s Check For Elements At URI ${FIB_ENTRY_URL} ${vm_instances}
122 Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For L3VPN ${OS_COMPUTE_1_IP} ${vm_instances}
123 Wait Until Keyword Succeeds 30s 10s Verify Flows Are Present For L3VPN ${OS_COMPUTE_2_IP} ${vm_instances}
124 Wait Until Keyword Succeeds 30s 10s Verify GWMAC Entry On ODL ${GWMAC_ADDRS}
125 Wait Until Keyword Succeeds 30s 10s Verify GWMAC Flow Entry On Flow Table ${OS_COMPUTE_1_IP}
126 Wait Until Keyword Succeeds 30s 10s Verify GWMAC Flow Entry On Flow Table ${OS_COMPUTE_2_IP}
127 ${dst_ip_list} = Create List ${VM_IP_NET10[1]} @{VM_IP_NET20}
128 Test Operations From Vm Instance ${NETWORKS[0]} ${VM_IP_NET10[0]} ${dst_ip_list}
129 ${dst_ip_list} = Create List ${VM_IP_NET20[1]} @{VM_IP_NET10}
130 Test Operations From Vm Instance ${NETWORKS[1]} ${VM_IP_NET20[0]} ${dst_ip_list}
131 [Teardown] VpnOperations.Test Teardown With Tcpdump Stop ${cn1_conn_id} ${cn2_conn_id} ${os_conn_id}
133 Add Multiple Extra Routes And Check Datapath Before L3VPN Creation
134 [Documentation] Add multiple extra routes and check data path before L3VPN creation
135 ${CONFIG_EXTRA_ROUTE_IP1} = Catenate sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
136 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ${CONFIG_EXTRA_ROUTE_IP1}
137 ${CONFIG_EXTRA_ROUTE_IP2} = Catenate sudo ifconfig eth0:2 @{EXTRA_NW_IP}[1] netmask 255.255.255.0 up
138 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ${CONFIG_EXTRA_ROUTE_IP2}
139 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ifconfig
140 ${EXT_RT1} = Set Variable destination=40.1.1.0/24,gateway=${VM_IP_NET10[0]}
141 ${EXT_RT2} = Set Variable destination=50.1.1.0/24,gateway=${VM_IP_NET10[0]}
142 ${cmd} = Catenate ${RT_OPTIONS} ${EXT_RT1} ${RT_OPTIONS} ${EXT_RT2}
143 Update Router @{ROUTERS}[0] ${cmd}
144 Show Router @{ROUTERS}[0] -D
145 ${vm_instances} = Create List @{EXTRA_NW_SUBNET}
146 Wait Until Keyword Succeeds 30s 10s Check For Elements At URI ${FIB_ENTRY_URL} ${vm_instances}
147 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[1]} ping -c 3 @{EXTRA_NW_IP}[1]
148 Should Contain ${output} 64 bytes
149 ${output} = Execute Command on VM Instance @{NETWORKS}[1] ${VM_IP_NET20[1]} ping -c 3 @{EXTRA_NW_IP}[1]
150 Should Contain ${output} 64 bytes
151 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[1]} ping -c 3 @{EXTRA_NW_IP}[0]
152 Should Contain ${output} 64 bytes
155 [Documentation] Delete the extra routes
156 Update Router @{ROUTERS}[0] ${RT_CLEAR}
157 Show Router @{ROUTERS}[0] -D
159 Delete And Recreate Extra Route
160 [Documentation] Recreate multiple extra route and check data path before L3VPN creation
161 ${CONFIG_EXTRA_ROUTE_IP1} = Catenate sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
162 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ${CONFIG_EXTRA_ROUTE_IP1}
163 ${EXT_RT1} = Set Variable destination=40.1.1.0/24,gateway=${VM_IP_NET10[0]}
164 ${cmd} = Catenate ${RT_OPTIONS} ${EXT_RT1}
165 Update Router @{ROUTERS}[0] ${cmd}
166 Show Router @{ROUTERS}[0] -D
167 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[1]} ping -c 3 @{EXTRA_NW_IP}[0]
168 Should Contain ${output} 64 bytes
169 # clear off extra-routes before the next set of tests
170 [Teardown] Run Keywords Update Router @{ROUTERS}[0] ${RT_CLEAR}
171 ... AND Show Router @{ROUTERS}[0] -D
172 ... AND Get Test Teardown Debugs
175 [Documentation] Creates L3VPN and verify the same
176 ${net_id} = Get Net Id @{NETWORKS}[0] ${devstack_conn_id}
177 ${tenant_id} = Get Tenant ID From Network ${net_id}
179 VPN Create L3VPN vpnid=${VPN_INSTANCE_ID[0]} name=${VPN_NAME[0]} rd=@{RDS}[0] exportrt=@{RDS}[0] importrt=@{RDS}[0] tenantid=${tenant_id}
180 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
181 Should Contain ${resp} ${VPN_INSTANCE_ID[0]}
183 Associate L3VPN To Routers
184 [Documentation] Associating router to L3VPN
185 ${router_id}= Get Router Id ${ROUTERS[0]} ${devstack_conn_id}
186 Associate VPN to Router routerid=${router_id} vpnid=${VPN_INSTANCE_ID[0]}
187 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
188 Should Contain ${resp} ${router_id}
190 Verify L3VPN Datapath With Router Association
191 [Documentation] Datapath test across the networks using L3VPN with router association.
192 ${vm_instances} = Create List @{VM_IP_NET10} @{VM_IP_NET20}
193 Wait Until Keyword Succeeds 30s 10s Check For Elements At URI ${VPN_IFACES_URL} ${vm_instances}
194 ${RD} = Strip String ${RDS[0]} characters="[]
195 Wait Until Keyword Succeeds 60s 15s Check For Elements At URI ${CONFIG_API}/odl-fib:fibEntries/vrfTables/${RD}/ ${vm_instances}
196 Wait Until Keyword Succeeds 60s 15s Verify Flows Are Present For L3VPN ${OS_COMPUTE_1_IP} ${vm_instances}
197 Wait Until Keyword Succeeds 60s 15s Verify Flows Are Present For L3VPN ${OS_COMPUTE_2_IP} ${vm_instances}
198 Wait Until Keyword Succeeds 30s 15s Verify GWMAC Entry On ODL ${GWMAC_ADDRS}
199 Wait Until Keyword Succeeds 30s 15s Verify GWMAC Flow Entry On Flow Table ${OS_COMPUTE_1_IP}
200 Wait Until Keyword Succeeds 30s 15s Verify GWMAC Flow Entry On Flow Table ${OS_COMPUTE_2_IP}
201 Log Check datapath from network1 to network2
202 ${dst_ip_list} = Create List @{VM_IP_NET10}[1] @{VM_IP_NET20}
203 Test Operations From Vm Instance ${NETWORKS[0]} @{VM_IP_NET10}[0] ${dst_ip_list}
204 Log Check datapath from network2 to network1
205 ${dst_ip_list} = Create List @{VM_IP_NET20}[1] @{VM_IP_NET10}
206 Test Operations From Vm Instance ${NETWORKS[1]} @{VM_IP_NET20}[0] ${dst_ip_list}
208 Dissociate L3VPN From Routers
209 [Documentation] Dissociating router from L3VPN
210 ${router_id}= Get Router Id ${ROUTERS[0]} ${devstack_conn_id}
211 Dissociate VPN to Router routerid=${router_id} vpnid=${VPN_INSTANCE_ID[0]}
212 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
213 Should Not Contain ${resp} ${router_id}
215 Delete Router And Router Interfaces With L3VPN
216 [Documentation] Delete Router and Interface to the subnets with L3VPN assciate
217 ${router_id}= Get Router Id ${ROUTERS[0]} ${devstack_conn_id}
218 Associate VPN to Router routerid=${router_id} vpnid=${VPN_INSTANCE_ID[0]}
219 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
220 Should Contain ${resp} ${router_id}
221 : FOR ${INTERFACE} IN @{SUBNETS}
222 \ Remove Interface ${ROUTERS[0]} ${INTERFACE}
223 ${interface_output} = Show Router Interface ${ROUTERS[0]}
224 : FOR ${INTERFACE} IN @{SUBNETS}
225 \ ${subnet_id} = Get Subnet Id ${INTERFACE} ${devstack_conn_id}
226 \ Should Not Contain ${interface_output} ${subnet_id}
227 Delete Router ${ROUTERS[0]}
228 ${router_output} = List Router
229 Should Not Contain ${router_output} ${ROUTERS[0]}
230 ${router_list} = Create List ${ROUTERS[0]}
231 Wait Until Keyword Succeeds 3s 1s Check For Elements Not At URI ${ROUTER_URL} ${router_list}
232 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
233 Should Not Contain ${resp} ${router_id}
234 Wait Until Keyword Succeeds 30s 10s Verify GWMAC Flow Entry Removed From Flow Table ${OS_COMPUTE_1_IP}
235 Wait Until Keyword Succeeds 30s 10s Verify GWMAC Flow Entry Removed From Flow Table ${OS_COMPUTE_2_IP}
237 Delete Router With NonExistentRouter Name
238 [Documentation] Delete router with nonExistentRouter name
239 ${rc} ${output}= Run And Return Rc And Output neutron router-delete nonExistentRouter
240 Should Match Regexp ${output} Unable to find router with name or id 'nonExistentRouter'|Unable to find router\\(s\\) with id\\(s\\) 'nonExistentRouter'
242 Associate L3VPN To Networks
243 [Documentation] Associates L3VPN to networks and verify
244 ${network1_id} = Get Net Id ${NETWORKS[0]} ${devstack_conn_id}
245 ${network2_id} = Get Net Id ${NETWORKS[1]} ${devstack_conn_id}
246 Associate L3VPN To Network networkid=${network1_id} vpnid=${VPN_INSTANCE_ID[0]}
247 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
248 Should Contain ${resp} ${network1_id}
249 Associate L3VPN To Network networkid=${network2_id} vpnid=${VPN_INSTANCE_ID[0]}
250 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
251 Should Contain ${resp} ${network2_id}
253 Dissociate L3VPN From Networks
254 [Documentation] Dissociate L3VPN from networks
255 ${network1_id} = Get Net Id ${NETWORKS[0]} ${devstack_conn_id}
256 ${network2_id} = Get Net Id ${NETWORKS[1]} ${devstack_conn_id}
257 Dissociate L3VPN From Networks networkid=${network1_id} vpnid=${VPN_INSTANCE_ID[0]}
258 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
259 Should Not Contain ${resp} ${network1_id}
260 Dissociate L3VPN From Networks networkid=${network2_id} vpnid=${VPN_INSTANCE_ID[0]}
261 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
262 Should Not Contain ${resp} ${network2_id}
265 [Documentation] Delete L3VPN
266 VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[0]}
268 Create Multiple L3VPN
269 [Documentation] Creates three L3VPNs and then verify the same
270 ${net_id} = Get Net Id @{NETWORKS}[0] ${devstack_conn_id}
271 ${tenant_id} = Get Tenant ID From Network ${net_id}
272 VPN Create L3VPN vpnid=${VPN_INSTANCE_ID[0]} name=${VPN_NAME[0]} rd=${RDS[0]} exportrt=${RDS[0]} importrt=${RDS[0]} tenantid=${tenant_id}
273 VPN Create L3VPN vpnid=${VPN_INSTANCE_ID[1]} name=${VPN_NAME[1]} rd=${RDS[1]} exportrt=${RDS[1]} importrt=${RDS[1]} tenantid=${tenant_id}
274 VPN Create L3VPN vpnid=${VPN_INSTANCE_ID[2]} name=${VPN_NAME[2]} rd=${RDS[2]} exportrt=${RDS[2]} importrt=${RDS[2]} tenantid=${tenant_id}
275 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
276 Should Contain ${resp} ${VPN_INSTANCE_ID[0]}
277 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[1]}
278 Should Contain ${resp} ${VPN_INSTANCE_ID[1]}
279 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[2]}
280 Should Contain ${resp} ${VPN_INSTANCE_ID[2]}
282 Check Datapath Traffic Across Networks With L3VPN
283 [Documentation] Datapath Test Across the networks with VPN.
285 Log This test will be added in the next patch
287 Delete Multiple L3VPN
288 [Documentation] Delete three L3VPNs created using Multiple L3VPN Test
289 VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[0]}
290 VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[1]}
291 VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[2]}