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
25 Basic Vpnservice Suite Setup
26 SetupUtils.Setup_Utils_For_Setup_And_Teardown
27 DevstackUtils.Devstack Suite Setup
29 Basic Vpnservice Suite Teardown
30 # Delete three L3VPNs created using Multiple L3VPN Test
31 Run Keyword And Ignore Error VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[0]}
32 Run Keyword And Ignore Error VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[1]}
33 Run Keyword And Ignore Error VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[2]}
34 # Delete Vm instances from the given Instance List
35 ${VM_INSTANCES} = Create List @{VM_INSTANCES_NET10} @{VM_INSTANCES_NET20}
36 : FOR ${VmInstance} IN @{VM_INSTANCES}
37 \ Run Keyword And Ignore Error Delete Vm Instance ${VmInstance}
38 # Delete Neutron Ports from the given Port List.
39 : FOR ${Port} IN @{PORT_LIST}
40 \ Run Keyword And Ignore Error Delete Port ${Port}
41 # Delete Sub Nets from the given Subnet List.
42 : FOR ${Subnet} IN @{SUBNETS}
43 \ Run Keyword And Ignore Error Delete SubNet ${Subnet}
44 # Delete Networks in the given Net List
45 : FOR ${Network} IN @{NETWORKS}
46 \ Run Keyword And Ignore Error Delete Network ${Network}
47 # Remove security group created earlier
48 Run Keyword And Ignore Error Delete SecurityGroup ${SECURITY_GROUP}
53 [Documentation] Create an L3VPN using the Json using the list of optional arguments received.
54 Run keyword if "routerid" in ${Kwargs} Collections.Set_To_Dictionary ${Kwargs} router=, "router-id":"${Kwargs['routerid']}"
55 ... ELSE Collections.Set_To_Dictionary ${Kwargs} router=${empty}
56 &{L3vpn_create_actual_val} = Collections.Copy_Dictionary ${L3VPN_CREATE_DEFAULT}
57 Collections.Set_To_Dictionary ${L3vpn_create_actual_val} &{Kwargs}
58 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/l3vpn_create mapping=${L3vpn_create_actual_val} session=session
62 [Documentation] Will return detailed list of the L3VPN_ID received
63 ${resp} = TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/get_l3vpn mapping=${Kwargs} session=session
67 Associate L3VPN To Network
69 [Documentation] Associate the created L3VPN to a network-id received as dictionary argument
70 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/assoc_l3vpn mapping=${Kwargs} session=session
72 Dissociate L3VPN From Networks
74 [Documentation] Disssociate the already associated networks from L3VPN
75 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/dissoc_l3vpn mapping=${Kwargs} session=session
77 Associate VPN to Router
79 [Documentation] Associate the created L3VPN to a router-id received as argument
80 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/assoc_router_l3vpn mapping=${Kwargs} session=session
82 Dissociate VPN to Router
84 [Documentation] Dissociate the already associated routers from L3VPN
85 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/dissoc_router_l3vpn mapping=${Kwargs} session=session
89 [Documentation] Delete the created L3VPN
90 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/l3vpn_delete mapping=${Kwargs} session=session
94 [Documentation] Creates Tunnel between the two DPNs received in the dictionary argument
95 &{Itm_actual_val} = Collections.Copy_Dictionary ${ITM_CREATE_DEFAULT}
96 Collections.Set_To_Dictionary ${Itm_actual_val} &{Kwargs}
97 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/itm_create mapping=${Itm_actual_val} session=session
100 [Documentation] Get all Tunnels and return the contents
101 ${resp} = RequestsLibrary.Get Request session ${CONFIG_API}/itm:transport-zones/
103 Should Be Equal As Strings ${resp.status_code} 200
104 [Return] ${resp.content}
107 [Arguments] ${zone-name}
108 [Documentation] Delete Tunnels created under the transport-zone
109 ${resp} = RequestsLibrary.Delete Request session ${CONFIG_API}/itm:transport-zones/transport-zone/${zone-name}/
111 Should Be Equal As Strings ${resp.status_code} 200
112 [Return] ${resp.content}
114 Verify Flows Are Present For L3VPN
115 [Arguments] ${ip} ${vm_ips}
116 [Documentation] Verify Flows Are Present For L3VPN
117 ${flow_output}= Run Command On Remote System ${ip} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
119 Should Contain ${flow_output} table=${ODL_FLOWTABLE_L3VPN}
120 ${l3vpn_table} = Get Lines Containing String ${flow_output} table=${ODL_FLOWTABLE_L3VPN},
122 : FOR ${i} IN @{vm_ips}
123 \ ${resp}= Should Contain ${l3vpn_table} ${i}
125 Verify GWMAC Entry On ODL
126 [Arguments] ${GWMAC_ADDRS}
127 [Documentation] get ODL GWMAC table entry
128 ${resp} = RequestsLibrary.Get Request session ${VPN_PORT_DATA_URL}
130 Should Be Equal As Strings ${resp.status_code} 200
131 : FOR ${macAdd} IN @{GWMAC_ADDRS}
132 \ Should Contain ${resp.content} ${macAdd}
134 Verify GWMAC Flow Entry Removed From Flow Table
136 [Documentation] Verify the GWMAC Table, ARP Response table and Dispatcher table.
137 ${flow_output}= Run Command On Remote System ${cnIp} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
139 Should Contain ${flow_output} table=${GWMAC_TABLE}
140 ${gwmac_table} = Get Lines Containing String ${flow_output} table=${GWMAC_TABLE}
142 #Verify GWMAC address present in table 19
143 : FOR ${macAdd} IN @{GWMAC_ADDRS}
144 \ Should Not Contain ${gwmac_table} dl_dst=${macAdd} actions=goto_table:${L3_TABLE}
146 Verify ARP REQUEST in groupTable
147 [Arguments] ${group_output} ${Group-ID}
148 [Documentation] get flow dump for group ID
149 Should Contain ${group_output} group_id=${Group-ID}
150 ${arp_group} = Get Lines Containing String ${group_output} group_id=${Group-ID}
152 Should Match Regexp ${arp_group} ${ARP_REQUEST_GROUP_REGEX}
154 Verify Tunnel Status as UP
155 [Documentation] Verify that the tunnels are UP
156 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
158 Should Contain ${output} ${STATE_UP}
159 Should Not Contain ${output} ${STATE_DOWN}
160 Should Not Contain ${output} ${STATE_UNKNOWN}
162 Verify Tunnel Status as DOWN
163 [Documentation] Verify that the tunnels are DOWN
164 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
166 Should Contain ${output} ${STATE_DOWN}
167 Should Not Contain ${output} ${STATE_UP}
168 Should Not Contain ${output} ${STATE_UNKNOWN}
170 Verify Tunnel Status as UNKNOWN
171 [Documentation] Verify that the tunnels are in Unknown state
172 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
174 Should Not Contain ${output} ${STATE_UP}
175 Should Not Contain ${output} ${STATE_DOWN}
176 Should Contain ${output} ${STATE_UNKNOWN}
178 Verify VXLAN interface
179 [Documentation] Verify that the VXLAN interfaces are Enabled
180 ${output}= Issue Command On Karaf Console ${VXLAN_SHOW}
182 Should Contain ${output} ${STATE_UP}
183 Should Contain ${output} ${STATE_ENABLE}
184 Should Not Contain ${output} ${STATE_DISABLE}
187 [Arguments] ${session}
188 [Documentation] Get Fib table entries from ODL session
189 ${resp} RequestsLibrary.Get Request ${session} ${FIB_ENTRIES_URL}
191 [Return] ${resp.content}