2 Documentation Openstack library. This library is useful for tests to create network, subnet, router and vm instances
6 Resource TemplatedRequests.robot
7 Resource KarafKeywords.robot
8 Resource ../variables/Variables.robot
11 Library OperatingSystem
21 ... portname1=BR1-eth1
22 ... ipaddress1=2.2.2.2
24 ... portname2= BR2-eth1
25 ... ipaddress2=3.3.3.3
26 &{L3VPN_CREATE_DEFAULT}
27 ... vpnid=4ae8cd92-48ca-49b5-94e1-b2921a261111
30 ... exportrt=["2200:1","8800:1"]
31 ... importrt=["2200:1","8800:1"]
32 ... tenantid=6c53df3a-3456-11e5-a151-feff819cdc9f
33 ${VAR_BASE} ${CURDIR}/../variables/vpnservice/
34 ${ODL_FLOWTABLE_L3VPN} 21
37 ${STATE_UNKNOWN} UNKNOWN
38 ${STATE_ENABLE} ENABLED
39 ${STATE_DISABLE} DISABLE
41 ${INTEGRATION_BRIDGE} br-int
44 ${ARP_RESPONSE_TABLE} 81
45 ${ARP_REQUEST_GROUP_REGEX_FLUORINE} actions=resubmit\\(,${ARP_RESPONSE_TABLE}\\)
46 ${TEP_SHOW_STATE} tep:show-state
48 ... (([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])
49 ${MAC_REGEX} ([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})
50 ${ARP_RESPONSE_REGEX_FLUORINE}
51 ... arp,arp_op=2 actions=resubmit\\(,${ARP_PUNT_TABLE}\\),resubmit\\(,${ARP_LEARN_TABLE}\\),resubmit\\(,${ELAN_BASETABLE}\\)
52 ${ARP_PUNT_RESPONSE_REGEX} arp actions=CONTROLLER:65535,learn
53 ${ARP_REQUEST_REGEX} arp,arp_op=1 actions=group:\\d+
58 OpenStackOperations.OpenStack Suite Setup
59 TemplatedRequests.Create Default Session timeout=${SESSION_TIMEOUT}
61 Basic Vpnservice Suite Cleanup
62 [Arguments] ${vpn_instance_ids}=@{EMPTY} ${vms}=@{EMPTY} ${networks}=@{EMPTY} ${subnets}=@{EMPTY} ${ports}=@{EMPTY} ${sgs}=@{EMPTY}
63 FOR ${vpn_instance_id} IN @{vpn_instance_ids}
64 BuiltIn.Run Keyword And Ignore Error VPN Delete L3VPN vpnid=${vpn_instance_id}
66 OpenStackOperations.Neutron Cleanup ${vms} ${networks} ${subnets} ${ports} ${sgs}
69 [Documentation] Create an L3VPN using the Json using the list of optional arguments received.
71 IF "routerid" in ${Kwargs}
72 Collections.Set_To_Dictionary ${Kwargs} router=, "router-id":"${Kwargs['routerid']}"
74 Collections.Set_To_Dictionary ${Kwargs} router=${empty}
76 &{L3vpn_create_actual_val} = Collections.Copy_Dictionary ${L3VPN_CREATE_DEFAULT}
77 Collections.Set_To_Dictionary ${L3vpn_create_actual_val} &{Kwargs}
78 TemplatedRequests.Post_As_Json_Templated
79 ... folder=${VAR_BASE}/l3vpn_create
80 ... mapping=${L3vpn_create_actual_val}
82 ... http_timeout=${SESSION_TIMEOUT}
85 [Documentation] Will return detailed list of the L3VPN_ID received
87 ${resp} = TemplatedRequests.Post_As_Json_Templated
88 ... folder=${VAR_BASE}/get_l3vpn
91 ... http_timeout=${SESSION_TIMEOUT}
96 [Documentation] Check that sub interface ip has been learnt after ARP request
98 ${resp} = RequestsLibrary.Get Request session ${VPN_REST}
99 BuiltIn.Log ${resp.text}
100 @{list_any_matches} = String.Get_Regexp_Matches
102 ... \"vpn-instance-name\":\"${VPN_INSTANCE_ID}\",.*"vrf-id":"${vrf_id}",\"vpn-id\":(\\d+)
104 ${result} = Evaluate ${list_any_matches[0]} * 2
105 ${vpn_id_hex} = BuiltIn.Convert To Hex ${result}
106 RETURN ${vpn_id_hex.lower()}
109 [Documentation] To verify L3VPN on ODL for given vpn ids
111 FOR ${vpn} IN @{vpns}
112 ${resp} = VpnOperations.VPN Get L3VPN vpnid=${vpn}
113 BuiltIn.Should Contain ${resp} ${vpn}
116 Associate L3VPN To Network
117 [Documentation] Associate the created L3VPN to a network-id received as dictionary argument
118 [Arguments] &{Kwargs}
119 TemplatedRequests.Post_As_Json_Templated
120 ... folder=${VAR_BASE}/assoc_l3vpn
121 ... mapping=${Kwargs}
123 ... http_timeout=${SESSION_TIMEOUT}
125 Associate L3VPNs To Networks
126 [Documentation] Associates multiple networks to L3VPN and verify the same
127 [Arguments] ${vpnid_list} ${network_list}
128 FOR ${network} ${vpnid} IN ZIP ${network_list} ${vpnid_list}
129 ${network_id} = OpenStackOperations.Get Net Id ${network}
130 VpnOperations.Associate L3VPN To Network networkid=${network_id} vpnid=${vpnid}
131 ${resp} = VpnOperations.VPN Get L3VPN vpnid=${vpnid}
132 BuiltIn.Should Contain ${resp} ${network_id}
135 Dissociate L3VPN From Networks
136 [Documentation] Disssociate the already associated networks from L3VPN
137 [Arguments] &{Kwargs}
138 TemplatedRequests.Post_As_Json_Templated
139 ... folder=${VAR_BASE}/dissoc_l3vpn
140 ... mapping=${Kwargs}
142 ... http_timeout=${SESSION_TIMEOUT}
144 Associate VPN to Router
145 [Documentation] Associate the created L3VPN to a router-id received as argument
146 [Arguments] &{Kwargs}
147 TemplatedRequests.Post_As_Json_Templated
148 ... folder=${VAR_BASE}/assoc_two_router_l3vpn
149 ... mapping=${Kwargs}
151 ... http_timeout=${SESSION_TIMEOUT}
153 Dissociate VPN to Router
154 [Documentation] Dissociate the already associated routers from L3VPN
155 [Arguments] &{Kwargs}
156 TemplatedRequests.Post_As_Json_Templated
157 ... folder=${VAR_BASE}/dissoc_two_router_l3vpn
158 ... mapping=${Kwargs}
160 ... http_timeout=${SESSION_TIMEOUT}
163 [Documentation] Delete the created L3VPN
164 [Arguments] &{Kwargs}
165 TemplatedRequests.Post_As_Json_Templated
166 ... folder=${VAR_BASE}/l3vpn_delete
167 ... mapping=${Kwargs}
169 ... http_timeout=${SESSION_TIMEOUT}
172 [Documentation] Creates Tunnel between the two DPNs received in the dictionary argument
173 [Arguments] &{Kwargs}
174 &{Itm_actual_val} = Collections.Copy_Dictionary ${ITM_CREATE_DEFAULT}
175 Collections.Set_To_Dictionary ${Itm_actual_val} &{Kwargs}
176 TemplatedRequests.Post_As_Json_Templated
177 ... folder=${VAR_BASE}/itm_create
178 ... mapping=${Itm_actual_val}
180 ... http_timeout=${SESSION_TIMEOUT}
183 [Documentation] Get all Tunnels and return the contents
184 ${resp} = RequestsLibrary.Get Request session ${CONFIG_API}/itm:transport-zones/
186 Should Be Equal As Strings ${resp.status_code} 200
190 [Documentation] Delete Tunnels created under the transport-zone
191 [Arguments] ${zone-name}
192 ${resp} = RequestsLibrary.Delete Request
194 ... ${CONFIG_API}/itm:transport-zones/transport-zone/${zone-name}/
196 Should Be Equal As Strings ${resp.status_code} 200
199 Verify Flows Are Present For L3VPN
200 [Documentation] Verify Flows Are Present For L3VPN
201 [Arguments] ${ip} ${vm_ips}
202 ${flow_output} = Run Command On Remote System And Log
204 ... sudo ovs-ofctl -O OpenFlow13 dump-flows ${INTEGRATION_BRIDGE}
205 Should Contain ${flow_output} table=${ODL_FLOWTABLE_L3VPN}
206 ${l3vpn_table} = Get Lines Containing String ${flow_output} table=${ODL_FLOWTABLE_L3VPN},
208 FOR ${i} IN @{vm_ips}
209 ${resp} = Should Contain ${l3vpn_table} ${i}
212 Verify Flows Are Present For L3VPN On All Compute Nodes
213 [Documentation] Verify Flows Are Present For L3VPN On All Compute Nodes
214 [Arguments] ${vm_ips}
215 FOR ${ip} IN @{OS_CMP_IPS}
216 BuiltIn.Wait Until Keyword Succeeds
219 ... VpnOperations.Verify Flows Are Present For L3VPN
224 Verify GWMAC Entry On ODL
225 [Documentation] get ODL GWMAC table entry
226 [Arguments] ${GWMAC_ADDRS}
227 ${resp} = RequestsLibrary.Get Request session ${VPN_PORT_DATA_URL}
229 Should Be Equal As Strings ${resp.status_code} 200
230 FOR ${macAdd} IN @{GWMAC_ADDRS}
231 Should Contain ${resp.text} ${macAdd}
234 Verify GWMAC Flow Entry Removed From Flow Table
235 [Documentation] Verify the GWMAC Table, ARP Response table and Dispatcher table.
237 ${flow_output} = Run Command On Remote System And Log
239 ... sudo ovs-ofctl -O OpenFlow13 dump-flows ${INTEGRATION_BRIDGE}
240 Should Contain ${flow_output} table=${GWMAC_TABLE}
241 ${gwmac_table} = Get Lines Containing String ${flow_output} table=${GWMAC_TABLE}
243 #Verify GWMAC address present in table 19
244 FOR ${macAdd} IN @{GWMAC_ADDRS}
245 Should Not Contain ${gwmac_table} dl_dst=${macAdd} actions=goto_table:${L3_TABLE}
248 Verify GWMAC Flow Entry Removed From Flow Table On All Compute Nodes
249 [Documentation] Verify the GWMAC Table, ARP Response table and Dispatcher table.
250 FOR ${ip} IN @{OS_CMP_IPS}
251 BuiltIn.Wait Until Keyword Succeeds 30s 10s Verify GWMAC Flow Entry Removed From Flow Table ${ip}
254 Verify ARP REQUEST in groupTable
255 [Documentation] get flow dump for group ID
256 [Arguments] ${group_output} ${Group-ID}
257 Should Contain ${group_output} group_id=${Group-ID}
258 ${arp_group} = Get Lines Containing String ${group_output} group_id=${Group-ID}
260 BuiltIn.Should Match Regexp
262 ... ${ARP_REQUEST_GROUP_REGEX_FLUORINE}
264 Verify Tunnel Status as UP
265 [Documentation] Verify that the tunnels are UP
266 IF ${OS_NODE_CNT} == ${1} RETURN ${True}
267 ${output} = Issue Command On Karaf Console ${TEP_SHOW_STATE}
269 Should Contain ${output} ${STATE_UP}
270 Should Not Contain ${output} ${STATE_DOWN}
271 Should Not Contain ${output} ${STATE_UNKNOWN}
273 Verify Tunnel Status as DOWN
274 [Documentation] Verify that the tunnels are DOWN
275 ${output} = Issue Command On Karaf Console ${TEP_SHOW_STATE}
277 Should Contain ${output} ${STATE_DOWN}
278 Should Not Contain ${output} ${STATE_UP}
279 Should Not Contain ${output} ${STATE_UNKNOWN}
281 Verify Tunnel Status as UNKNOWN
282 [Documentation] Verify that the tunnels are in Unknown state
283 ${output} = Issue Command On Karaf Console ${TEP_SHOW_STATE}
285 Should Not Contain ${output} ${STATE_UP}
286 Should Not Contain ${output} ${STATE_DOWN}
287 Should Contain ${output} ${STATE_UNKNOWN}
289 Verify VXLAN interface
290 [Documentation] Verify that the VXLAN interfaces are Enabled
291 ${output} = Issue Command On Karaf Console ${VXLAN_SHOW}
293 Should Contain ${output} ${STATE_UP}
294 Should Contain ${output} ${STATE_ENABLE}
295 Should Not Contain ${output} ${STATE_DISABLE}
298 [Documentation] Get Fib table entries from ODL session
299 [Arguments] ${session}
300 ${resp} = RequestsLibrary.Get Request ${session} ${FIB_ENTRIES_URL}
304 Get Gateway MAC And IP Address
305 [Documentation] Get Gateway mac and IP Address
306 [Arguments] ${router_Name} ${ip_regex}=${IP_REGEX}
307 ${output} = OpenStack CLI openstack port list --router ${router_Name}
308 @{MacAddr-list} = Get Regexp Matches ${output} ${MAC_REGEX}
309 @{IpAddr-list} = Get Regexp Matches ${output} ${ip_regex}
310 RETURN ${MacAddr-list} ${IpAddr-list}
312 Test Teardown With Tcpdump Stop
313 [Arguments] ${conn_ids}=@{EMPTY}
314 OpenStackOperations.Stop Packet Capture On Nodes ${conn_ids}
315 Get Test Teardown Debugs
317 Verify IPv4 GWMAC Flow Entry On Flow Table
318 [Arguments] ${group_output} ${group_id} ${flow_output}
319 Verify ARP REQUEST in groupTable ${group_output} ${groupID[1]}
320 #Verify ARP_RESPONSE_TABLE - 81
321 Should Contain ${flow_output} table=${ARP_RESPONSE_TABLE}
322 ${arpResponder_table} = Get Lines Containing String ${flow_output} table=${ARP_RESPONSE_TABLE}
323 Should Contain ${arpResponder_table} priority=0 actions=drop
324 FOR ${macAdd} ${ipAdd} IN ZIP ${GWMAC_ADDRS} ${GWIP_ADDRS}
325 ${ARP_RESPONSE_IP_MAC_REGEX} = Set Variable
326 ... arp_tpa=${ipAdd},arp_op=1 actions=.*,set_field:${macAdd}->eth_src
327 Should Match Regexp ${arpResponder_table} ${ARP_RESPONSE_IP_MAC_REGEX}
330 Verify IPv6 GWMAC Flow Entry On Flow Table
331 [Arguments] ${flow_output}
332 Should Contain ${flow_output} table=${IPV6_TABLE}
333 ${icmp_ipv6_flows} = Get Lines Containing String ${flow_output} icmp_type=135
334 FOR ${ip_addr} IN @{GWIP_ADDRS}
335 ${rule} = Set Variable icmp_type=135,icmp_code=0,nd_target=${ip_addr} actions=CONTROLLER:65535
336 Should Match Regexp ${icmp_ipv6_flows} ${rule}
339 Verify GWMAC Flow Entry On Flow Table
340 [Documentation] Verify the GWMAC Table, ARP Response table and Dispatcher table.
341 [Arguments] ${cnIp} ${ipv}=ipv4
342 ${flow_output} = Run Command On Remote System
344 ... sudo ovs-ofctl -O OpenFlow13 dump-flows ${INTEGRATION_BRIDGE}
345 ${group_output} = Run Command On Remote System
347 ... sudo ovs-ofctl -O OpenFlow13 dump-groups ${INTEGRATION_BRIDGE}
348 Should Contain ${flow_output} table=${DISPATCHER_TABLE}
349 ${dispatcher_table} = Get Lines Containing String ${flow_output} table=${DISPATCHER_TABLE}
350 Should Contain ${dispatcher_table} goto_table:${GWMAC_TABLE}
351 Should Not Contain ${dispatcher_table} goto_table:${ARP_RESPONSE_TABLE}
352 Should Contain ${flow_output} table=${GWMAC_TABLE}
353 ${gwmac_table} = Get Lines Containing String ${flow_output} table=${GWMAC_TABLE}
354 #Verify GWMAC address present in table 19
355 FOR ${macAdd} IN @{GWMAC_ADDRS}
356 Should Contain ${gwmac_table} dl_dst=${macAdd} actions=goto_table:${L3_TABLE}
359 Should Contain ${gwmac_table} actions=resubmit(,17)
360 #Verify ARP_CHECK_TABLE - 43
361 #arp request and response
362 ${arpchk_table} = Get Lines Containing String ${flow_output} table=${ARP_CHECK_TABLE}
363 BuiltIn.Should Match Regexp
365 ... ${ARP_RESPONSE_REGEX_FLUORINE}
366 ${arppunt_table} = String.Get Lines Containing String ${flow_output} table=${ARP_PUNT_TABLE}
367 BuiltIn.Should Match Regexp
369 ... ${ARP_PUNT_RESPONSE_REGEX}
370 ${match} = Should Match Regexp ${arpchk_table} ${ARP_REQUEST_REGEX}
371 ${groupID} = Split String ${match} separator=:
372 IF '${ipv}' == 'ipv4'
373 Verify IPv4 GWMAC Flow Entry On Flow Table ${group_output} ${group_id} ${flow_output}
375 Verify IPv6 GWMAC Flow Entry On Flow Table ${flow_output}
378 Verify GWMAC Flow Entry On Flow Table On All Compute Nodes
379 [Documentation] Verify the GWMAC Table, ARP Response table and Dispatcher table.
380 [Arguments] ${ipv}=ipv4
381 FOR ${ip} IN @{OS_CMP_IPS}
382 BuiltIn.Wait Until Keyword Succeeds
385 ... VpnOperations.Verify GWMAC Flow Entry On Flow Table
390 Delete Multiple L3VPNs
391 [Documentation] Delete three L3VPNs created using Multiple L3VPN Test
393 FOR ${vpn} IN @{vpns}
394 VPN Delete L3VPN vpnid=${vpn}
398 IF "${OPENSTACK_TOPO}" == "1cmb-0ctl-0cmp" RETURN
399 SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
402 IF "${OPENSTACK_TOPO}" == "1cmb-0ctl-0cmp" RETURN
403 OpenStackOperations.Get Test Teardown Debugs