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_INSTANCES} = Create List @{VM_INSTANCES_NET10} @{VM_INSTANCES_NET20}
82 : FOR ${VM} IN @{VM_INSTANCES}
83 \ Poll VM Is ACTIVE ${VM}
84 Wait Until Keyword Succeeds 30s 10s Wait For Routes To Propogate ${NETWORKS} ${SUBNETS_CIDR}
85 ${status} ${message} Run Keyword And Ignore Error Wait Until Keyword Succeeds 60s 5s Collect VM IP Addresses
86 ... true @{VM_INSTANCES_NET10}
87 ${status} ${message} Run Keyword And Ignore Error Wait Until Keyword Succeeds 60s 5s Collect VM IP Addresses
88 ... true @{VM_INSTANCES_NET20}
89 ${VM_IP_NET10} ${DHCP_IP1} Collect VM IP Addresses false @{VM_INSTANCES_NET10}
90 ${VM_IP_NET20} ${DHCP_IP2} Collect VM IP Addresses false @{VM_INSTANCES_NET20}
91 ${VM_INSTANCES}= Collections.Combine Lists ${VM_INSTANCES_NET10} ${VM_INSTANCES_NET20}
92 ${VM_IPS}= Collections.Combine Lists ${VM_IP_NET10} ${VM_IP_NET20}
93 ${LOOP_COUNT} Get Length ${VM_INSTANCES_NET10}
94 : FOR ${index} IN RANGE 0 ${LOOP_COUNT}
95 \ ${status} ${message} Run Keyword And Ignore Error Should Not Contain @{VM_IPS}[${index}] None
96 \ Run Keyword If '${status}' == 'FAIL' Write Commands Until Prompt openstack console log show @{VM_INSTANCES}[${index}] 30s
97 Set Suite Variable ${VM_IP_NET10}
98 Set Suite Variable ${VM_IP_NET20}
99 Should Not Contain ${VM_IP_NET10} None
100 Should Not Contain ${VM_IP_NET20} None
101 [Teardown] Run Keywords Show Debugs @{VM_INSTANCES_NET10} @{VM_INSTANCES_NET20}
102 ... AND Get Test Teardown Debugs
104 Check ELAN Datapath Traffic Within The Networks
105 [Documentation] Checks datapath within the same network with different vlans.
106 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ping -c 3 ${VM_IP_NET10[1]}
107 Should Contain ${output} 64 bytes
108 ${output} = Execute Command on VM Instance @{NETWORKS}[1] ${VM_IP_NET20[0]} ping -c 3 ${VM_IP_NET20[1]}
109 Should Contain ${output} 64 bytes
112 [Documentation] Create Router
113 Create Router ${ROUTERS[0]}
114 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${ROUTER_URL} ${ROUTERS}
116 Add Interfaces To Router
117 [Documentation] Add Interfaces
118 : FOR ${INTERFACE} IN @{SUBNETS}
119 \ Add Router Interface ${ROUTERS[0]} ${INTERFACE}
120 ${interface_output} = Show Router Interface ${ROUTERS[0]}
121 ${GWMAC_ADDRS} ${GWIP_ADDRS} = VpnOperations.Get Gateway MAC And IP Address ${ROUTERS[0]}
122 Set Suite Variable ${GWMAC_ADDRS}
123 Set Suite Variable ${GWIP_ADDRS}
125 Check L3_Datapath Traffic Across Networks With Router
126 [Documentation] Datapath test across the networks using router for L3.
127 Log Verification of FIB Entries and Flow
128 ${cn1_conn_id} = Start Packet Capture on Node ${OS_COMPUTE_1_IP} file_Name=tcpDumpCN1
129 ${cn2_conn_id} = Start Packet Capture on Node ${OS_COMPUTE_2_IP} file_Name=tcpDumpCN2
130 ${os_conn_id} = Start Packet Capture on Node ${OS_CONTROL_NODE_IP} file_Name=tcpDumpOS
131 ${vm_instances} = Create List @{VM_IP_NET10} @{VM_IP_NET20}
132 Wait Until Keyword Succeeds 30s 5s Check For Elements At URI ${FIB_ENTRY_URL} ${vm_instances}
133 Wait Until Keyword Succeeds 30s 5s Verify Flows Are Present For L3VPN ${OS_COMPUTE_1_IP} ${vm_instances}
134 Wait Until Keyword Succeeds 30s 5s Verify Flows Are Present For L3VPN ${OS_COMPUTE_2_IP} ${vm_instances}
135 Wait Until Keyword Succeeds 30s 5s Verify GWMAC Entry On ODL ${GWMAC_ADDRS}
136 Wait Until Keyword Succeeds 30s 5s Verify GWMAC Flow Entry On Flow Table ${OS_COMPUTE_1_IP}
137 Wait Until Keyword Succeeds 30s 5s Verify GWMAC Flow Entry On Flow Table ${OS_COMPUTE_2_IP}
138 ${dst_ip_list} = Create List ${VM_IP_NET10[1]} @{VM_IP_NET20}
139 Test Operations From Vm Instance ${NETWORKS[0]} ${VM_IP_NET10[0]} ${dst_ip_list}
140 ${dst_ip_list} = Create List ${VM_IP_NET20[1]} @{VM_IP_NET10}
141 Test Operations From Vm Instance ${NETWORKS[1]} ${VM_IP_NET20[0]} ${dst_ip_list}
142 [Teardown] VpnOperations.Test Teardown With Tcpdump Stop ${cn1_conn_id} ${cn2_conn_id} ${os_conn_id}
144 Add Multiple Extra Routes And Check Datapath Before L3VPN Creation
145 [Documentation] Add multiple extra routes and check data path before L3VPN creation
146 ${CONFIG_EXTRA_ROUTE_IP1} = Catenate sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
147 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ${CONFIG_EXTRA_ROUTE_IP1}
148 ${CONFIG_EXTRA_ROUTE_IP2} = Catenate sudo ifconfig eth0:2 @{EXTRA_NW_IP}[1] netmask 255.255.255.0 up
149 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ${CONFIG_EXTRA_ROUTE_IP2}
150 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ifconfig
151 ${EXT_RT1} = Set Variable destination=40.1.1.0/24,gateway=${VM_IP_NET10[0]}
152 ${EXT_RT2} = Set Variable destination=50.1.1.0/24,gateway=${VM_IP_NET10[0]}
153 ${cmd} = Catenate ${RT_OPTIONS} ${EXT_RT1} ${RT_OPTIONS} ${EXT_RT2}
154 Update Router @{ROUTERS}[0] ${cmd}
155 Show Router @{ROUTERS}[0] -D
156 ${vm_instances} = Create List @{EXTRA_NW_SUBNET}
157 Wait Until Keyword Succeeds 30s 5s Check For Elements At URI ${FIB_ENTRY_URL} ${vm_instances}
158 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[1]} ping -c 3 @{EXTRA_NW_IP}[1]
159 Should Contain ${output} 64 bytes
160 ${output} = Execute Command on VM Instance @{NETWORKS}[1] ${VM_IP_NET20[1]} ping -c 3 @{EXTRA_NW_IP}[1]
161 Should Contain ${output} 64 bytes
162 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[1]} ping -c 3 @{EXTRA_NW_IP}[0]
163 Should Contain ${output} 64 bytes
166 [Documentation] Delete the extra routes
167 Update Router @{ROUTERS}[0] ${RT_CLEAR}
168 Show Router @{ROUTERS}[0] -D
170 Delete And Recreate Extra Route
171 [Documentation] Recreate multiple extra route and check data path before L3VPN creation
172 ${CONFIG_EXTRA_ROUTE_IP1} = Catenate sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
173 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[0]} ${CONFIG_EXTRA_ROUTE_IP1}
174 ${EXT_RT1} = Set Variable destination=40.1.1.0/24,gateway=${VM_IP_NET10[0]}
175 ${cmd} = Catenate ${RT_OPTIONS} ${EXT_RT1}
176 Update Router @{ROUTERS}[0] ${cmd}
177 Show Router @{ROUTERS}[0] -D
178 ${output} = Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET10[1]} ping -c 3 @{EXTRA_NW_IP}[0]
179 Should Contain ${output} 64 bytes
180 # clear off extra-routes before the next set of tests
181 [Teardown] Run Keywords Update Router @{ROUTERS}[0] ${RT_CLEAR}
182 ... AND Show Router @{ROUTERS}[0] -D
183 ... AND Get Test Teardown Debugs
186 [Documentation] Creates L3VPN and verify the same
187 ${net_id} = Get Net Id @{NETWORKS}[0] ${devstack_conn_id}
188 ${tenant_id} = Get Tenant ID From Network ${net_id}
190 VPN Create L3VPN vpnid=${VPN_INSTANCE_ID[0]} name=${VPN_NAME[0]} rd=@{RDS}[0] exportrt=@{RDS}[0] importrt=@{RDS}[0] tenantid=${tenant_id}
191 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
192 Should Contain ${resp} ${VPN_INSTANCE_ID[0]}
194 Associate L3VPN To Routers
195 [Documentation] Associating router to L3VPN
196 ${router_id}= Get Router Id ${ROUTERS[0]} ${devstack_conn_id}
197 Associate VPN to Router routerid=${router_id} vpnid=${VPN_INSTANCE_ID[0]}
198 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
199 Should Contain ${resp} ${router_id}
201 Verify L3VPN Datapath With Router Association
202 [Documentation] Datapath test across the networks using L3VPN with router association.
203 ${vm_instances} = Create List @{VM_IP_NET10} @{VM_IP_NET20}
204 Wait Until Keyword Succeeds 30s 5s Check For Elements At URI ${VPN_IFACES_URL} ${vm_instances}
205 ${RD} = Strip String ${RDS[0]} characters="[]
206 Wait Until Keyword Succeeds 60s 5s Check For Elements At URI ${CONFIG_API}/odl-fib:fibEntries/vrfTables/${RD}/ ${vm_instances}
207 Wait Until Keyword Succeeds 60s 5s Verify Flows Are Present For L3VPN ${OS_COMPUTE_1_IP} ${vm_instances}
208 Wait Until Keyword Succeeds 60s 5s Verify Flows Are Present For L3VPN ${OS_COMPUTE_2_IP} ${vm_instances}
209 Wait Until Keyword Succeeds 30s 5s Verify GWMAC Entry On ODL ${GWMAC_ADDRS}
210 Wait Until Keyword Succeeds 30s 5s Verify GWMAC Flow Entry On Flow Table ${OS_COMPUTE_1_IP}
211 Wait Until Keyword Succeeds 30s 5s Verify GWMAC Flow Entry On Flow Table ${OS_COMPUTE_2_IP}
212 Log Check datapath from network1 to network2
213 ${dst_ip_list} = Create List @{VM_IP_NET10}[1] @{VM_IP_NET20}
214 Test Operations From Vm Instance ${NETWORKS[0]} @{VM_IP_NET10}[0] ${dst_ip_list}
215 Log Check datapath from network2 to network1
216 ${dst_ip_list} = Create List @{VM_IP_NET20}[1] @{VM_IP_NET10}
217 Test Operations From Vm Instance ${NETWORKS[1]} @{VM_IP_NET20}[0] ${dst_ip_list}
219 Dissociate L3VPN From Routers
220 [Documentation] Dissociating router from L3VPN
221 ${router_id}= Get Router Id ${ROUTERS[0]} ${devstack_conn_id}
222 Dissociate VPN to Router routerid=${router_id} vpnid=${VPN_INSTANCE_ID[0]}
223 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
224 Should Not Contain ${resp} ${router_id}
226 Delete Router And Router Interfaces With L3VPN
227 [Documentation] Delete Router and Interface to the subnets with L3VPN assciate
228 ${router_id}= Get Router Id ${ROUTERS[0]} ${devstack_conn_id}
229 Associate VPN to Router routerid=${router_id} vpnid=${VPN_INSTANCE_ID[0]}
230 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
231 Should Contain ${resp} ${router_id}
232 : FOR ${INTERFACE} IN @{SUBNETS}
233 \ Remove Interface ${ROUTERS[0]} ${INTERFACE}
234 ${interface_output} = Show Router Interface ${ROUTERS[0]}
235 : FOR ${INTERFACE} IN @{SUBNETS}
236 \ ${subnet_id} = Get Subnet Id ${INTERFACE} ${devstack_conn_id}
237 \ Should Not Contain ${interface_output} ${subnet_id}
238 Delete Router ${ROUTERS[0]}
239 ${router_output} = List Router
240 Should Not Contain ${router_output} ${ROUTERS[0]}
241 ${router_list} = Create List ${ROUTERS[0]}
242 Wait Until Keyword Succeeds 3s 1s Check For Elements Not At URI ${ROUTER_URL} ${router_list}
243 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
244 Should Not Contain ${resp} ${router_id}
245 Wait Until Keyword Succeeds 30s 5s Verify GWMAC Flow Entry Removed From Flow Table ${OS_COMPUTE_1_IP}
246 Wait Until Keyword Succeeds 30s 5s Verify GWMAC Flow Entry Removed From Flow Table ${OS_COMPUTE_2_IP}
248 Delete Router With NonExistentRouter Name
249 [Documentation] Delete router with nonExistentRouter name
250 ${rc} ${output}= Run And Return Rc And Output neutron router-delete nonExistentRouter
251 Should Match Regexp ${output} Unable to find router with name or id 'nonExistentRouter'|Unable to find router\\(s\\) with id\\(s\\) 'nonExistentRouter'
253 Associate L3VPN To Networks
254 [Documentation] Associates L3VPN to networks and verify
255 ${network1_id} = Get Net Id ${NETWORKS[0]} ${devstack_conn_id}
256 ${network2_id} = Get Net Id ${NETWORKS[1]} ${devstack_conn_id}
257 Associate L3VPN To Network networkid=${network1_id} vpnid=${VPN_INSTANCE_ID[0]}
258 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
259 Should Contain ${resp} ${network1_id}
260 Associate L3VPN To Network networkid=${network2_id} vpnid=${VPN_INSTANCE_ID[0]}
261 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
262 Should Contain ${resp} ${network2_id}
264 Dissociate L3VPN From Networks
265 [Documentation] Dissociate L3VPN from networks
266 ${network1_id} = Get Net Id ${NETWORKS[0]} ${devstack_conn_id}
267 ${network2_id} = Get Net Id ${NETWORKS[1]} ${devstack_conn_id}
268 Dissociate L3VPN From Networks networkid=${network1_id} vpnid=${VPN_INSTANCE_ID[0]}
269 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
270 Should Not Contain ${resp} ${network1_id}
271 Dissociate L3VPN From Networks networkid=${network2_id} vpnid=${VPN_INSTANCE_ID[0]}
272 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
273 Should Not Contain ${resp} ${network2_id}
276 [Documentation] Delete L3VPN
277 VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[0]}
279 Create Multiple L3VPN
280 [Documentation] Creates three L3VPNs and then verify the same
281 ${net_id} = Get Net Id @{NETWORKS}[0] ${devstack_conn_id}
282 ${tenant_id} = Get Tenant ID From Network ${net_id}
283 VPN Create L3VPN vpnid=${VPN_INSTANCE_ID[0]} name=${VPN_NAME[0]} rd=${RDS[0]} exportrt=${RDS[0]} importrt=${RDS[0]} tenantid=${tenant_id}
284 VPN Create L3VPN vpnid=${VPN_INSTANCE_ID[1]} name=${VPN_NAME[1]} rd=${RDS[1]} exportrt=${RDS[1]} importrt=${RDS[1]} tenantid=${tenant_id}
285 VPN Create L3VPN vpnid=${VPN_INSTANCE_ID[2]} name=${VPN_NAME[2]} rd=${RDS[2]} exportrt=${RDS[2]} importrt=${RDS[2]} tenantid=${tenant_id}
286 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[0]}
287 Should Contain ${resp} ${VPN_INSTANCE_ID[0]}
288 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[1]}
289 Should Contain ${resp} ${VPN_INSTANCE_ID[1]}
290 ${resp}= VPN Get L3VPN vpnid=${VPN_INSTANCE_ID[2]}
291 Should Contain ${resp} ${VPN_INSTANCE_ID[2]}
293 Check Datapath Traffic Across Networks With L3VPN
294 [Documentation] Datapath Test Across the networks with VPN.
296 Log This test will be added in the next patch
298 Delete Multiple L3VPN
299 [Documentation] Delete three L3VPNs created using Multiple L3VPN Test
300 VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[0]}
301 VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[1]}
302 VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[2]}