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 Cleanup
30 [Arguments] ${vpn_instance_ids}=@{EMPTY} ${vms}=@{EMPTY} ${networks}=@{EMPTY} ${subnets}=@{EMPTY} ${ports}=@{EMPTY} ${sgs}=@{EMPTY}
31 : FOR ${vpn_instance_id} IN @{vpn_instance_ids}
32 \ BuiltIn.Run Keyword And Ignore Error VPN Delete L3VPN vpnid=${vpn_instance_id}
33 OpenStackOperations.Neutron Cleanup ${vms} ${networks} ${subnets} ${ports} ${sgs}
37 [Documentation] Create an L3VPN using the Json using the list of optional arguments received.
38 Run keyword if "routerid" in ${Kwargs} Collections.Set_To_Dictionary ${Kwargs} router=, "router-id":"${Kwargs['routerid']}"
39 ... ELSE Collections.Set_To_Dictionary ${Kwargs} router=${empty}
40 &{L3vpn_create_actual_val} = Collections.Copy_Dictionary ${L3VPN_CREATE_DEFAULT}
41 Collections.Set_To_Dictionary ${L3vpn_create_actual_val} &{Kwargs}
42 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/l3vpn_create mapping=${L3vpn_create_actual_val} session=session
46 [Documentation] Will return detailed list of the L3VPN_ID received
47 ${resp} = TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/get_l3vpn mapping=${Kwargs} session=session
51 Associate L3VPN To Network
53 [Documentation] Associate the created L3VPN to a network-id received as dictionary argument
54 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/assoc_l3vpn mapping=${Kwargs} session=session
56 Dissociate L3VPN From Networks
58 [Documentation] Disssociate the already associated networks from L3VPN
59 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/dissoc_l3vpn mapping=${Kwargs} session=session
61 Associate VPN to Router
63 [Documentation] Associate the created L3VPN to a router-id received as argument
64 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/assoc_router_l3vpn mapping=${Kwargs} session=session
66 Dissociate VPN to Router
68 [Documentation] Dissociate the already associated routers from L3VPN
69 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/dissoc_router_l3vpn mapping=${Kwargs} session=session
73 [Documentation] Delete the created L3VPN
74 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/l3vpn_delete mapping=${Kwargs} session=session
78 [Documentation] Creates Tunnel between the two DPNs received in the dictionary argument
79 &{Itm_actual_val} = Collections.Copy_Dictionary ${ITM_CREATE_DEFAULT}
80 Collections.Set_To_Dictionary ${Itm_actual_val} &{Kwargs}
81 TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/itm_create mapping=${Itm_actual_val} session=session
84 [Documentation] Get all Tunnels and return the contents
85 ${resp} = RequestsLibrary.Get Request session ${CONFIG_API}/itm:transport-zones/
87 Should Be Equal As Strings ${resp.status_code} 200
88 [Return] ${resp.content}
91 [Arguments] ${zone-name}
92 [Documentation] Delete Tunnels created under the transport-zone
93 ${resp} = RequestsLibrary.Delete Request session ${CONFIG_API}/itm:transport-zones/transport-zone/${zone-name}/
95 Should Be Equal As Strings ${resp.status_code} 200
96 [Return] ${resp.content}
98 Verify Flows Are Present For L3VPN
99 [Arguments] ${ip} ${vm_ips}
100 [Documentation] Verify Flows Are Present For L3VPN
101 ${flow_output}= Run Command On Remote System And Log ${ip} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
102 Should Contain ${flow_output} table=${ODL_FLOWTABLE_L3VPN}
103 ${l3vpn_table} = Get Lines Containing String ${flow_output} table=${ODL_FLOWTABLE_L3VPN},
105 : FOR ${i} IN @{vm_ips}
106 \ ${resp}= Should Contain ${l3vpn_table} ${i}
108 Verify GWMAC Entry On ODL
109 [Arguments] ${GWMAC_ADDRS}
110 [Documentation] get ODL GWMAC table entry
111 ${resp} = RequestsLibrary.Get Request session ${VPN_PORT_DATA_URL}
113 Should Be Equal As Strings ${resp.status_code} 200
114 : FOR ${macAdd} IN @{GWMAC_ADDRS}
115 \ Should Contain ${resp.content} ${macAdd}
117 Verify GWMAC Flow Entry Removed From Flow Table
119 [Documentation] Verify the GWMAC Table, ARP Response table and Dispatcher table.
120 ${flow_output}= Run Command On Remote System And Log ${cnIp} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
121 Should Contain ${flow_output} table=${GWMAC_TABLE}
122 ${gwmac_table} = Get Lines Containing String ${flow_output} table=${GWMAC_TABLE}
124 #Verify GWMAC address present in table 19
125 : FOR ${macAdd} IN @{GWMAC_ADDRS}
126 \ Should Not Contain ${gwmac_table} dl_dst=${macAdd} actions=goto_table:${L3_TABLE}
128 Verify ARP REQUEST in groupTable
129 [Arguments] ${group_output} ${Group-ID}
130 [Documentation] get flow dump for group ID
131 Should Contain ${group_output} group_id=${Group-ID}
132 ${arp_group} = Get Lines Containing String ${group_output} group_id=${Group-ID}
134 Should Match Regexp ${arp_group} ${ARP_REQUEST_GROUP_REGEX}
136 Verify Tunnel Status as UP
137 [Documentation] Verify that the tunnels are UP
138 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
140 Should Contain ${output} ${STATE_UP}
141 Should Not Contain ${output} ${STATE_DOWN}
142 Should Not Contain ${output} ${STATE_UNKNOWN}
144 Verify Tunnel Status as DOWN
145 [Documentation] Verify that the tunnels are DOWN
146 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
148 Should Contain ${output} ${STATE_DOWN}
149 Should Not Contain ${output} ${STATE_UP}
150 Should Not Contain ${output} ${STATE_UNKNOWN}
152 Verify Tunnel Status as UNKNOWN
153 [Documentation] Verify that the tunnels are in Unknown state
154 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
156 Should Not Contain ${output} ${STATE_UP}
157 Should Not Contain ${output} ${STATE_DOWN}
158 Should Contain ${output} ${STATE_UNKNOWN}
160 Verify VXLAN interface
161 [Documentation] Verify that the VXLAN interfaces are Enabled
162 ${output}= Issue Command On Karaf Console ${VXLAN_SHOW}
164 Should Contain ${output} ${STATE_UP}
165 Should Contain ${output} ${STATE_ENABLE}
166 Should Not Contain ${output} ${STATE_DISABLE}
169 [Arguments] ${session}
170 [Documentation] Get Fib table entries from ODL session
171 ${resp} RequestsLibrary.Get Request ${session} ${FIB_ENTRIES_URL}
173 [Return] ${resp.content}
175 Get Gateway MAC And IP Address
176 [Arguments] ${router_Name} ${ip_regex}=${IP_REGEX}
177 [Documentation] Get Gateway mac and IP Address
178 ${output} = Write Commands Until Prompt neutron router-port-list ${router_Name} 30s
179 @{MacAddr-list} = Get Regexp Matches ${output} ${MAC_REGEX}
180 @{IpAddr-list} = Get Regexp Matches ${output} ${ip_regex}
181 [Return] ${MacAddr-list} ${IpAddr-list}
183 Test Teardown With Tcpdump Stop
184 [Arguments] ${cn1_conn_id} ${cn2_conn_id} ${os_conn_id}
185 Stop Packet Capture on Node ${cn1_conn_id}
186 Stop Packet Capture on Node ${cn2_conn_id}
187 Stop Packet Capture on Node ${os_conn_id}
188 Get Test Teardown Debugs
190 Verify IPv4 GWMAC Flow Entry On Flow Table
191 [Arguments] ${group_output} ${group_id} ${flow_output}
192 Verify ARP REQUEST in groupTable ${group_output} ${groupID[1]}
193 #Verify ARP_RESPONSE_TABLE - 81
194 Should Contain ${flow_output} table=${ARP_RESPONSE_TABLE}
195 ${arpResponder_table} = Get Lines Containing String ${flow_output} table=${ARP_RESPONSE_TABLE}
196 Should Contain ${arpResponder_table} priority=0 actions=drop
197 : FOR ${macAdd} ${ipAdd} IN ZIP ${GWMAC_ADDRS} ${GWIP_ADDRS}
198 \ ${ARP_RESPONSE_IP_MAC_REGEX} = Set Variable arp_tpa=${ipAdd},arp_op=1 actions=.*,set_field:${macAdd}->eth_src
199 \ Should Match Regexp ${arpResponder_table} ${ARP_RESPONSE_IP_MAC_REGEX}
201 Verify IPv6 GWMAC Flow Entry On Flow Table
202 [Arguments] ${flow_output}
203 Should Contain ${flow_output} table=${IPV6_TABLE}
204 ${icmp_ipv6_flows} = Get Lines Containing String ${flow_output} icmp_type=135
205 : FOR ${ip_addr} IN @{GWIP_ADDRS}
206 \ ${rule} = Set Variable icmp_type=135,icmp_code=0,nd_target=${ip_addr} actions=CONTROLLER:65535
207 \ Should Match Regexp ${icmp_ipv6_flows} ${rule}
209 Verify GWMAC Flow Entry On Flow Table
210 [Arguments] ${cnIp} ${ipv}=ipv4
211 [Documentation] Verify the GWMAC Table, ARP Response table and Dispatcher table.
212 ${flow_output}= Run Command On Remote System ${cnIp} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
213 ${group_output}= Run Command On Remote System ${cnIp} sudo ovs-ofctl -O OpenFlow13 dump-groups br-int
214 Should Contain ${flow_output} table=${DISPATCHER_TABLE}
215 ${dispatcher_table} = Get Lines Containing String ${flow_output} table=${DISPATCHER_TABLE}
216 Should Contain ${dispatcher_table} goto_table:${GWMAC_TABLE}
217 Should Not Contain ${dispatcher_table} goto_table:${ARP_RESPONSE_TABLE}
218 Should Contain ${flow_output} table=${GWMAC_TABLE}
219 ${gwmac_table} = Get Lines Containing String ${flow_output} table=${GWMAC_TABLE}
220 #Verify GWMAC address present in table 19
221 : FOR ${macAdd} IN @{GWMAC_ADDRS}
222 \ Should Contain ${gwmac_table} dl_dst=${macAdd} actions=goto_table:${L3_TABLE}
224 Should Contain ${gwmac_table} actions=resubmit(,17)
225 #Verify ARP_CHECK_TABLE - 43
226 #arp request and response
227 ${arpchk_table} = Get Lines Containing String ${flow_output} table=${ARP_CHECK_TABLE}
228 Should Match Regexp ${arpchk_table} ${ARP_RESPONSE_REGEX}
229 ${match} = Should Match Regexp ${arpchk_table} ${ARP_REQUEST_REGEX}
230 ${groupID} = Split String ${match} separator=:
231 BuiltIn.Run Keyword If '${ipv}' == 'ipv4' Verify IPv4 GWMAC Flow Entry On Flow Table ${group_output} ${group_id} ${flow_output}
232 ... ELSE Verify IPv6 GWMAC Flow Entry On Flow Table ${flow_output}
234 Delete Multiple L3VPNs
236 [Documentation] Delete three L3VPNs created using Multiple L3VPN Test
237 : FOR ${vpn} IN ${vpns}
238 \ VPN Delete L3VPN vpnid=${vpn}