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 Tests
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} VM11 VM21 VM12 VM22
26 @{NET10_VM_IPS} 10.1.1.3 10.1.1.4
27 @{NET20_VM_IPS} 20.1.1.3 20.1.1.4
28 @{ROUTERS} ROUTER_1 ROUTER_2
29 # Values passed by the calling method to API
30 @{CREATE_ID} "4ae8cd92-48ca-49b5-94e1-b2921a261111" "4ae8cd92-48ca-49b5-94e1-b2921a261112" "4ae8cd92-48ca-49b5-94e1-b2921a261113"
31 @{CREATE_NAME} "vpn1" "vpn2" "vpn3"
32 ${CREATE_ROUTER_DISTINGUISHER} ["2200:2"]
33 ${CREATE_EXPORT_RT} ["3300:2","8800:2"]
34 ${CREATE_IMPORT_RT} ["3300:2","8800:2"]
35 ${CREATE_TENANT_ID} "6c53df3a-3456-11e5-a151-feff819c1111"
36 @{VPN_INSTANCE} vpn_instance_template.json
37 @{VPN_INSTANCE_NAME} 4ae8cd92-48ca-49b5-94e1-b2921a2661c7 4ae8cd92-48ca-49b5-94e1-b2921a261111
38 @{EXTRA_NW_IP} 40.1.1.2 50.1.1.2
39 # Values passed for extra routes
40 ${EXT_RT1} destination=40.1.1.0/24,nexthop=10.1.1.3
41 ${EXT_RT2} destination=50.1.1.0/24,nexthop=10.1.1.3
42 ${RT_OPTIONS} --routes type=dict list=true
43 ${RT_CLEAR} --routes action=clear
46 Create Neutron Networks
47 [Documentation] Create two networks
48 Create Network ${NETWORKS[0]}
49 Create Network ${NETWORKS[1]}
50 ${NET_LIST} List Networks
52 Should Contain ${NET_LIST} ${NETWORKS[0]}
53 Should Contain ${NET_LIST} ${NETWORKS[1]}
55 Create Neutron Subnets
56 [Documentation] Create two subnets for previously created networks
57 Create SubNet ${NETWORKS[0]} ${SUBNETS[0]} ${SUBNET_CIDR[0]}
58 Create SubNet ${NETWORKS[1]} ${SUBNETS[1]} ${SUBNET_CIDR[1]}
59 ${SUB_LIST} List Subnets
61 Should Contain ${SUB_LIST} ${SUBNETS[0]}
62 Should Contain ${SUB_LIST} ${SUBNETS[1]}
65 [Documentation] Create four ports under previously created subnets
66 Create Port ${NETWORKS[0]} ${PORT_LIST[0]}
67 Create Port ${NETWORKS[0]} ${PORT_LIST[1]}
68 Create Port ${NETWORKS[1]} ${PORT_LIST[2]}
69 Create Port ${NETWORKS[1]} ${PORT_LIST[3]}
71 Check OpenDaylight Neutron Ports
72 [Documentation] Checking OpenDaylight Neutron API for known ports
73 ${resp} RequestsLibrary.Get Request session ${NEUTRON_PORTS_API}
75 Should be Equal As Strings ${resp.status_code} 200
78 [Documentation] Create Vm instances on compute node with port
79 Create Vm Instance With Port On Compute Node ${PORT_LIST[0]} ${VM_INSTANCES[0]} ${OS_COMPUTE_1_IP}
80 Create Vm Instance With Port On Compute Node ${PORT_LIST[1]} ${VM_INSTANCES[1]} ${OS_COMPUTE_2_IP}
81 Create Vm Instance With Port On Compute Node ${PORT_LIST[2]} ${VM_INSTANCES[2]} ${OS_COMPUTE_1_IP}
82 Create Vm Instance With Port On Compute Node ${PORT_LIST[3]} ${VM_INSTANCES[3]} ${OS_COMPUTE_2_IP}
84 Wait Until Keyword Succeeds 30s 10s Wait For Routes To Propogate
86 Check ELAN Datapath Traffic Within The Networks
87 [Documentation] Checks datapath within the same network with different vlans.
88 ${output} = Execute Command on VM Instance @{NETWORKS}[0] @{NET10_VM_IPS}[0] ping -c 3 @{NET10_VM_IPS}[1]
89 Should Contain ${output} 64 bytes
90 ${output} = Execute Command on VM Instance @{NETWORKS}[1] @{NET20_VM_IPS}[0] ping -c 3 @{NET20_VM_IPS}[1]
91 Should Contain ${output} 64 bytes
94 [Documentation] Create Router
95 Create Router ${ROUTERS[0]}
97 Add Interfaces To Router
98 [Documentation] Add Interfaces
99 : FOR ${INTERFACE} IN @{SUBNETS}
100 \ Add Router Interface ${ROUTERS[0]} ${INTERFACE}
102 Check L3_Datapath Traffic Across Networks With Router
103 [Documentation] Datapath test across the networks using router for L3.
104 ${dst_ip_list} = Create List @{NET10_VM_IPS}[1]
106 ${other_dst_ip_list} = Create List @{NET20_VM_IPS}[0] @{NET20_VM_IPS}[1]
107 Log ${other_dst_ip_list}
108 Test Operations From Vm Instance ${NETWORKS[0]} @{NET10_VM_IPS}[0] ${dst_ip_list} l2_or_l3=l3 list_of_external_dst_ips=${other_dst_ip_list}
109 ${dst_ip_list} = Create List @{NET20_VM_IPS}[1]
111 ${other_dst_ip_list} = Create List @{NET10_VM_IPS}[0] @{NET10_VM_IPS}[1]
112 Log ${other_dst_ip_list}
113 Test Operations From Vm Instance ${NETWORKS[1]} @{NET20_VM_IPS}[0] ${dst_ip_list} l2_or_l3=l3 list_of_external_dst_ips=${other_dst_ip_list}
115 Add Multiple Extra Routes And Check Datapath Before L3VPN Creation
116 [Documentation] Add multiple extra routes and check data path before L3VPN creation
117 Log "Adding extra one route to VM"
118 ${CONFIG_EXTRA_ROUTE_IP1} = Catenate sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
119 ${output} = Execute Command on VM Instance @{NETWORKS}[0] @{NET10_VM_IPS}[0] ${CONFIG_EXTRA_ROUTE_IP1}
120 ${CONFIG_EXTRA_ROUTE_IP2} = Catenate sudo ifconfig eth0:2 @{EXTRA_NW_IP}[1] netmask 255.255.255.0 up
121 ${output} = Execute Command on VM Instance @{NETWORKS}[0] @{NET10_VM_IPS}[0] ${CONFIG_EXTRA_ROUTE_IP2}
122 ${output} = Execute Command on VM Instance @{NETWORKS}[0] @{NET10_VM_IPS}[0] ifconfig
123 ${cmd} = Catenate ${RT_OPTIONS} ${EXT_RT1} ${EXT_RT2}
124 Update Router @{ROUTERS}[0] ${cmd}
125 Show Router @{ROUTERS}[0] -D
126 ${output} = Execute Command on VM Instance @{NETWORKS}[0] @{NET10_VM_IPS}[1] ping -c 3 @{EXTRA_NW_IP}[1]
127 Should Contain ${output} 64 bytes
128 ${output} = Execute Command on VM Instance @{NETWORKS}[1] @{NET20_VM_IPS}[1] ping -c 3 @{EXTRA_NW_IP}[1]
129 Should Contain ${output} 64 bytes
130 ${output} = Execute Command on VM Instance @{NETWORKS}[0] @{NET10_VM_IPS}[1] ping -c 3 @{EXTRA_NW_IP}[0]
131 Should Contain ${output} 64 bytes
134 [Documentation] Delete the extra routes
135 Update Router @{ROUTERS}[0] ${RT_CLEAR}
137 Delete Router Interfaces
138 [Documentation] Remove Interface to the subnets.
139 : FOR ${INTERFACE} IN @{SUBNETS}
140 \ Remove Interface ${ROUTERS[0]} ${INTERFACE}
143 [Documentation] Creates L3VPN and verify the same
144 VPN Create L3VPN ${VPN_INSTANCE[0]} CREATE_ID=${CREATE_ID[0]} CREATE_EXPORT_RT=${CREATE_EXPORT_RT} CREATE_IMPORT_RT=${CREATE_IMPORT_RT} CREATE_TENANT_ID=${CREATE_TENANT_ID}
145 VPN Get L3VPN ${CREATE_ID[0]}
147 Associate L3VPN to Routers
148 [Documentation] Associating router to L3VPN
150 ${devstack_conn_id}= Get ControlNode Connection
151 ${router_id}= Get Router Id ${ROUTERS[0]} ${devstack_conn_id}
152 Associate VPN to Router ${router_id} ${VPN_INSTANCE_NAME[1]}
154 Dissociate L3VPN to Routers
155 [Documentation] Dissociating router to L3VPN
157 ${devstack_conn_id}= Get ControlNode Connection
158 ${router_id}= Get Router Id ${ROUTERS[0]} ${devstack_conn_id}
159 Dissociate VPN to Router ${router_id} ${VPN_INSTANCE_NAME[1]}
161 Associate L3VPN To Networks
162 [Documentation] Associates L3VPN to networks and verify
163 ${devstack_conn_id} = Get ControlNode Connection
164 ${network1_id} = Get Net Id ${NETWORKS[0]} ${devstack_conn_id}
165 ${network2_id} = Get Net Id ${NETWORKS[1]} ${devstack_conn_id}
166 Associate L3VPN To Network networkid=${network1_id} vpnid=${VPN_INSTANCE_NAME[1]}
167 Associate L3VPN To Network networkid=${network2_id} vpnid=${VPN_INSTANCE_NAME[1]}
169 Dissociate L3VPN From Networks
170 [Documentation] Dissociate L3VPN from networks
171 ${devstack_conn_id} = Get ControlNode Connection
172 ${network1_id} = Get Net Id ${NETWORKS[0]} ${devstack_conn_id}
173 ${network2_id} = Get Net Id ${NETWORKS[1]} ${devstack_conn_id}
174 Dissociate L3VPN From Networks networkid=${network1_id} vpnid=${VPN_INSTANCE_NAME[1]}
175 Dissociate L3VPN From Networks networkid=${network2_id} vpnid=${VPN_INSTANCE_NAME[1]}
178 [Documentation] Delete L3VPN
179 VPN Delete L3VPN ${CREATE_ID[0]}
182 [Documentation] Delete Router and Interface to the subnets.
183 Delete Router ${ROUTERS[0]}
185 Create Multiple L3VPN
186 [Documentation] Creates three L3VPNs and then verify the same
187 VPN Create L3VPN ${VPN_INSTANCE[0]} CREATE_ID=${CREATE_ID[0]} CREATE_EXPORT_RT=${CREATE_EXPORT_RT} CREATE_IMPORT_RT=${CREATE_IMPORT_RT} CREATE_TENANT_ID=${CREATE_TENANT_ID}
188 VPN Create L3VPN ${VPN_INSTANCE[0]} CREATE_ID=${CREATE_ID[1]} CREATE_EXPORT_RT=${CREATE_EXPORT_RT} CREATE_IMPORT_RT=${CREATE_IMPORT_RT} CREATE_TENANT_ID=${CREATE_TENANT_ID}
189 VPN Create L3VPN ${VPN_INSTANCE[0]} CREATE_ID=${CREATE_ID[2]} CREATE_EXPORT_RT=${CREATE_EXPORT_RT} CREATE_IMPORT_RT=${CREATE_IMPORT_RT} CREATE_TENANT_ID=${CREATE_TENANT_ID}
190 VPN Get L3VPN ${CREATE_ID[0]}
191 VPN Get L3VPN ${CREATE_ID[1]}
192 VPN Get L3VPN ${CREATE_ID[2]}
194 Delete Multiple L3VPN
195 [Documentation] Delete three L3VPNs
196 VPN Delete L3VPN ${CREATE_ID[0]}
197 VPN Delete L3VPN ${CREATE_ID[1]}
198 VPN Delete L3VPN ${CREATE_ID[2]}
200 Check Datapath Traffic Across Networks With L3VPN
201 [Documentation] Datapath Test Across the networks with VPN.
203 Log This test will be added in the next patch
206 [Documentation] Delete Vm instances in the given Instance List
207 : FOR ${VmInstance} IN @{VM_INSTANCES}
208 \ Delete Vm Instance ${VmInstance}
211 [Documentation] Delete Neutron Ports in the given Port List.
212 : FOR ${Port} IN @{PORT_LIST}
213 \ Delete Port ${Port}
216 [Documentation] Delete Sub Nets in the given Subnet List.
217 : FOR ${Subnet} IN @{SUBNETS}
218 \ Delete SubNet ${Subnet}
221 [Documentation] Delete Networks in the given Net List
222 : FOR ${Network} IN @{NETWORKS}
223 \ Delete Network ${Network}
226 [Documentation] Checks that vxlan tunnels are created successfully. The proc expects that the two DPNs are in the same network and populates the gateway accordingly.
227 ${node_1_dpid} = Get DPID ${OS_COMPUTE_1_IP}
228 ${node_2_dpid} = Get DPID ${OS_COMPUTE_2_IP}
229 ${node_1_adapter} = Get Ethernet Adapter ${OS_COMPUTE_1_IP}
230 ${node_2_adapter} = Get Ethernet Adapter ${OS_COMPUTE_2_IP}
231 ${first_two_octets} ${third_octet} ${last_octet}= Split String From Right ${OS_COMPUTE_1_IP} . 2
232 ${subnet} = Set Variable ${first_two_octets}.0.0/16
233 ${gateway} = Get Default Gateway ${OS_COMPUTE_1_IP}
234 ITM Create Tunnel tunnel-type=vxlan vlan-id=0 ip-address1="${OS_COMPUTE_1_IP}" dpn-id1=${node_1_dpid} portname1="${node_1_adapter}" ip-address2="${OS_COMPUTE_2_IP}"
235 ... dpn-id2=${node_2_dpid} portname2="${node_2_adapter}" prefix="${subnet}" gateway-ip="${gateway}"
236 Get DumpFlows And Ovsconfig ${OS_COMPUTE_1_IP}
237 Get DumpFlows And Ovsconfig ${OS_COMPUTE_2_IP}
238 ${output} = ITM Get Tunnels
242 [Documentation] Delete tunnels with specific transport-zone.
243 ITM Delete Tunnel TZA
246 Basic Vpnservice Suite Setup
247 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
249 Basic Vpnservice Suite Teardown
252 Wait For Routes To Propogate
253 ${devstack_conn_id} = Get ControlNode Connection
254 Switch Connection ${devstack_conn_id}
255 ${net_id} = Get Net Id @{NETWORKS}[0] ${devstack_conn_id}
256 ${output} = Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ip route ]>
257 Should Contain ${output} @{SUBNET_CIDR}[0]
258 ${net_id} = Get Net Id @{NETWORKS}[1] ${devstack_conn_id}
259 ${output} = Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ip route ]>
260 Should Contain ${output} @{SUBNET_CIDR}[1]