2 Documentation Openstack library. This library is useful for tests to create network, subnet, router and vm instances
5 Resource TemplatedRequests.robot
6 Resource KarafKeywords.robot
7 Resource ../variables/Variables.robot
10 Library OperatingSystem
13 &{ITM_CREATE_DEFAULT} tunneltype=vxlan vlanid=0 prefix=1.1.1.1/24 gateway=0.0.0.0 dpnid1=1 portname1=BR1-eth1 ipaddress1=2.2.2.2
14 ... dpnid2=2 portname2= BR2-eth1 ipaddress2=3.3.3.3
15 &{L3VPN_CREATE_DEFAULT} vpnid=4ae8cd92-48ca-49b5-94e1-b2921a261111 name=vpn1 rd=["2200:1"] exportrt=["2200:1","8800:1"] importrt=["2200:1","8800:1"] tenantid=6c53df3a-3456-11e5-a151-feff819cdc9f
16 ${VAR_BASE} ${CURDIR}/../variables/vpnservice/
17 ${ODL_FLOWTABLE_L3VPN} 21
20 ${STATE_UNKNOWN} UNKNOWN
21 ${STATE_ENABLE} ENABLED
22 ${STATE_DISABLE} DISABLE
27 [Documentation] Create an L3VPN using the Json using the list of optional arguments received.
28 Run keyword if "routerid" in ${Kwargs} Collections.Set_To_Dictionary ${Kwargs} router=, "router-id":"${Kwargs['routerid']}"
29 ... ELSE Collections.Set_To_Dictionary ${Kwargs} router=${empty}
30 &{L3vpn_create_actual_val} = Collections.Copy_Dictionary ${L3VPN_CREATE_DEFAULT}
31 Collections.Set_To_Dictionary ${L3vpn_create_actual_val} &{Kwargs}
32 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/l3vpn_create mapping=${L3vpn_create_actual_val} session=session
36 [Documentation] Will return detailed list of the L3VPN_ID received
37 ${resp} = TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/get_l3vpn mapping=${Kwargs} session=session
41 Associate L3VPN To Network
43 [Documentation] Associate the created L3VPN to a network-id received as dictionary argument
44 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/assoc_l3vpn mapping=${Kwargs} session=session
46 Dissociate L3VPN From Networks
48 [Documentation] Disssociate the already associated networks from L3VPN
49 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/dissoc_l3vpn mapping=${Kwargs} session=session
51 Associate VPN to Router
53 [Documentation] Associate the created L3VPN to a router-id received as argument
54 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/assoc_router_l3vpn mapping=${Kwargs} session=session
56 Dissociate VPN to Router
58 [Documentation] Dissociate the already associated routers from L3VPN
59 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/dissoc_router_l3vpn mapping=${Kwargs} session=session
63 [Documentation] Delete the created L3VPN
64 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/l3vpn_delete mapping=${Kwargs} session=session
68 [Documentation] Creates Tunnel between the two DPNs received in the dictionary argument
69 &{Itm_actual_val} = Collections.Copy_Dictionary ${ITM_CREATE_DEFAULT}
70 Collections.Set_To_Dictionary ${Itm_actual_val} &{Kwargs}
71 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/itm_create mapping=${Itm_actual_val} session=session
74 [Documentation] Get all Tunnels and return the contents
75 ${resp} = RequestsLibrary.Get Request session ${CONFIG_API}/itm:transport-zones/
77 Should Be Equal As Strings ${resp.status_code} 200
78 [Return] ${resp.content}
81 [Arguments] ${zone-name}
82 [Documentation] Delete Tunnels created under the transport-zone
83 ${resp} = RequestsLibrary.Delete Request session ${CONFIG_API}/itm:transport-zones/transport-zone/${zone-name}/
85 Should Be Equal As Strings ${resp.status_code} 200
86 [Return] ${resp.content}
88 Verify Flows Are Present For L3VPN
89 [Arguments] ${ip} ${vm_ips}
90 [Documentation] Verify Flows Are Present For L3VPN
91 ${flow_output}= Run Command On Remote System ${ip} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
93 Should Contain ${flow_output} table=${ODL_FLOWTABLE_L3VPN}
94 ${l3vpn_table} = Get Lines Containing String ${flow_output} table=${ODL_FLOWTABLE_L3VPN},
96 : FOR ${i} IN @{vm_ips}
97 \ ${resp}= Should Contain ${l3vpn_table} ${i}
99 Verify Tunnel Status as UP
100 [Documentation] Verify that the tunnels are UP
101 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
103 Should Contain ${output} ${STATE_UP}
104 Should Not Contain ${output} ${STATE_DOWN}
105 Should Not Contain ${output} ${STATE_UNKNOWN}
107 Verify Tunnel Status as DOWN
108 [Documentation] Verify that the tunnels are DOWN
109 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
111 Should Contain ${output} ${STATE_DOWN}
112 Should Not Contain ${output} ${STATE_UP}
113 Should Not Contain ${output} ${STATE_UNKNOWN}
115 Verify Tunnel Status as UNKNOWN
116 [Documentation] Verify that the tunnels are in Unknown state
117 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
119 Should Not Contain ${output} ${STATE_UP}
120 Should Not Contain ${output} ${STATE_DOWN}
121 Should Contain ${output} ${STATE_UNKNOWN}
123 Verify VXLAN interface
124 [Documentation] Verify that the VXLAN interfaces are Enabled
125 ${output}= Issue Command On Karaf Console ${VXLAN_SHOW}
127 Should Contain ${output} ${STATE_UP}
128 Should Contain ${output} ${STATE_ENABLE}
129 Should Not Contain ${output} ${STATE_DISABLE}