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