Changes in VPNService CSIT Scripts for NeutronDHCP
[integration/test.git] / csit / suites / netvirt / Netvirt_Vpnservice / 03_basic_ipv6_vpnservice.robot
1 *** Settings ***
2 Documentation     Test suite to validate IPv6 vpnservice functionality in an Openstack integrated environment.
3 ...               The assumption of this suite is that the environment is already configured with the proper
4 ...               integration bridges and vxlan tunnels.
5 Suite Setup       Basic Vpnservice Suite Setup
6 Suite Teardown    Basic Vpnservice Suite Teardown
7 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
8 Test Teardown     Get Test Teardown Debugs
9 Library           OperatingSystem
10 Library           RequestsLibrary
11 Resource          ../../../libraries/Utils.robot
12 Resource          ../../../libraries/OpenStackOperations.robot
13 Resource          ../../../libraries/DevstackUtils.robot
14 Resource          ../../../libraries/VpnOperations.robot
15 Resource          ../../../libraries/OVSDB.robot
16 Resource          ../../../libraries/SetupUtils.robot
17 Resource          ../../../libraries/Tcpdump.robot
18 Resource          ../../../variables/Variables.robot
19 Resource          ../../../variables/netvirt/Variables.robot
20
21 *** Variables ***
22 @{NETWORKS}       NET1_IPV6    NET2_IPV6
23 @{SUBNETS}        SUBNET1_IPV6    SUBNET2_IPV6
24 @{SUBNETS_CIDR}    2001:db8:0:2::/64    2001:db8:0:3::/64
25 @{PORT_LIST}      PORT11_IPV6    PORT21_IPV6    PORT12_IPV6    PORT22_IPV6
26 @{VM_INSTANCES_NET10}    VM11_IPV6    VM21_IPV6
27 @{VM_INSTANCES_NET20}    VM12_IPV6    VM22_IPV6
28 @{ROUTERS}        ROUTER_1_IPV6
29 @{EXTRA_NW_IP}    2001:db9:cafe:d::10    2001:db9:abcd:d::20
30 @{EXTRA_NW_SUBNET}    2001:db9:cafe:d::/64    2001:db9:abcd:d::/64
31 ${NET1_ADDR_POOL}    --allocation-pool start=2001:db8:0:2::2,end=2001:db8:0:2:ffff:ffff:ffff:fffe
32 ${NET2_ADDR_POOL}    --allocation-pool start=2001:db8:0:3::2,end=2001:db8:0:3:ffff:ffff:ffff:fffe
33 ${SECURITY_GROUP}    sg-ipv6-vpnservice
34 ${UPDATE_NETWORK}    UpdateNetwork
35 ${UPDATE_SUBNET}    UpdateSubnet
36 ${UPDATE_PORT}    UpdatePort
37
38 *** Test Cases ***
39 Create Neutron Networks
40     [Documentation]    Create two networks
41     Create Network    ${NETWORKS[0]}
42     Create Network    ${NETWORKS[1]}
43     ${NET_LIST}    List Networks
44     Log    ${NET_LIST}
45     Should Contain    ${NET_LIST}    ${NETWORKS[0]}
46     Should Contain    ${NET_LIST}    ${NETWORKS[1]}
47     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${NETWORK_URL}    ${NETWORKS}
48     Update Network    ${NETWORKS[0]}    additional_args=--description ${UPDATE_NETWORK}
49     ${output} =    Show Network    ${NETWORKS[0]}
50     Should Contain    ${output}    ${UPDATE_NETWORK}
51
52 Create Neutron Subnets
53     [Documentation]    Create two subnets for previously created networks
54     ${net1_additional_args}=    Catenate    --ip-version=6 --ipv6-address-mode=slaac --ipv6-ra-mode=slaac ${NET1_ADDR_POOL}
55     ${net2_additional_args}=    Catenate    --ip-version=6 --ipv6-address-mode=slaac --ipv6-ra-mode=slaac ${NET2_ADDR_POOL}
56     Create SubNet    ${NETWORKS[0]}    ${SUBNETS[0]}    ${SUBNETS_CIDR[0]}    ${net1_additional_args}
57     Create SubNet    ${NETWORKS[1]}    ${SUBNETS[1]}    ${SUBNETS_CIDR[1]}    ${net2_additional_args}
58     ${SUB_LIST}    List Subnets
59     Log    ${SUB_LIST}
60     Should Contain    ${SUB_LIST}    ${SUBNETS[0]}
61     Should Contain    ${SUB_LIST}    ${SUBNETS[1]}
62     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${SUBNETWORK_URL}    ${SUBNETS}
63     Update SubNet    ${SUBNETS[0]}    additional_args=--description ${UPDATE_SUBNET}
64     ${output} =    Show SubNet    ${SUBNETS[0]}
65     Should Contain    ${output}    ${UPDATE_SUBNET}
66
67 Create Routers
68     [Documentation]    Create Router
69     Create Router    ${ROUTERS[0]}
70     ${router_output} =    List Router
71     Log    ${router_output}
72     Should Contain    ${router_output}    ${ROUTERS[0]}
73     ${router_list} =    Create List    ${ROUTERS[0]}
74     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${ROUTER_URL}    ${router_list}
75
76 Add Interfaces To Router
77     [Documentation]    Add Interfaces
78     : FOR    ${INTERFACE}    IN    @{SUBNETS}
79     \    Add Router Interface    ${ROUTERS[0]}    ${INTERFACE}
80     ${interface_output} =    Show Router Interface    ${ROUTERS[0]}
81     : FOR    ${INTERFACE}    IN    @{SUBNETS}
82     \    ${subnet_id} =    Get Subnet Id    ${INTERFACE}    ${devstack_conn_id}
83     \    Should Contain    ${interface_output}    ${subnet_id}
84     ${GWMAC_ADDRS}    ${GWIP_ADDRS} =    Get Gateway MAC And IP Address    ${ROUTERS[0]}
85     Log    ${GWMAC_ADDRS}
86     Set Suite Variable    ${GWMAC_ADDRS}
87     Log    ${GWIP_ADDRS}
88     Set Suite Variable    ${GWIP_ADDRS}
89
90 Add Ssh V6 Allow Rule
91     [Documentation]    Allow all TCP/UDP/ICMP6 packets for this suite
92     Neutron Security Group Create    ${SECURITY_GROUP}
93     Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    ethertype=IPv6    port_range_max=65535    port_range_min=1    protocol=tcp
94     Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    ethertype=IPv6    port_range_max=65535    port_range_min=1    protocol=tcp
95     Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    ethertype=IPv6    protocol=icmp
96     Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    ethertype=IPv6    protocol=icmp
97     Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    ethertype=IPv6    port_range_max=65535    port_range_min=1    protocol=udp
98     Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    ethertype=IPv6    port_range_max=65535    port_range_min=1    protocol=udp
99
100 Create Neutron Ports
101     [Documentation]    Create four ports under previously created subnets
102     ${allowed_address_pairs_args}=    Set Variable    --allowed-address-pairs type=dict list=true ip_address=${EXTRA_NW_SUBNET[0]} ip_address=${EXTRA_NW_SUBNET[1]}
103     Create Port    ${NETWORKS[0]}    ${PORT_LIST[0]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
104     Create Port    ${NETWORKS[0]}    ${PORT_LIST[1]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
105     Create Port    ${NETWORKS[1]}    ${PORT_LIST[2]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
106     Create Port    ${NETWORKS[1]}    ${PORT_LIST[3]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
107     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${PORT_URL}    ${PORT_LIST}
108     Update Port    ${PORT_LIST[0]}    additional_args=--name ${UPDATE_PORT}
109     ${output} =    Show Port    ${UPDATE_PORT}
110     Should Contain    ${output}    ${UPDATE_PORT}
111     Update Port    ${UPDATE_PORT}    additional_args=--name ${PORT_LIST[0]}
112
113 Create Nova VMs
114     [Documentation]    Create Vm instances on compute node with port
115     Create Vm Instance With Port On Compute Node    ${PORT_LIST[0]}    ${VM_INSTANCES_NET10[0]}    ${OS_COMPUTE_1_IP}    sg=${SECURITY_GROUP}
116     Create Vm Instance With Port On Compute Node    ${PORT_LIST[1]}    ${VM_INSTANCES_NET10[1]}    ${OS_COMPUTE_2_IP}    sg=${SECURITY_GROUP}
117     Create Vm Instance With Port On Compute Node    ${PORT_LIST[2]}    ${VM_INSTANCES_NET20[0]}    ${OS_COMPUTE_1_IP}    sg=${SECURITY_GROUP}
118     Create Vm Instance With Port On Compute Node    ${PORT_LIST[3]}    ${VM_INSTANCES_NET20[1]}    ${OS_COMPUTE_2_IP}    sg=${SECURITY_GROUP}
119     ${VM_INSTANCES}=    Create List    @{VM_INSTANCES_NET10}    @{VM_INSTANCES_NET20}
120     : FOR    ${VM}    IN    @{VM_INSTANCES}
121     \    Wait Until Keyword Succeeds    25s    5s    Verify VM Is ACTIVE    ${VM}
122     Log    Check for routes
123     Wait Until Keyword Succeeds    30s    10s    Wait For Routes To Propogate    ${NETWORKS}    ${SUBNETS_CIDR}
124     ${prefix_net10}=    Replace String    ${SUBNETS_CIDR[0]}    ::/64    (:[a-f0-9]{,4}){,4}
125     Log    ${prefix_net10}
126     ${status}    ${message}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    5x    60s    Collect VM IPv6 SLAAC Addresses
127     ...    true    ${prefix_net10}    @{VM_INSTANCES_NET10}
128     ${prefix_net20}=    Replace String    ${SUBNETS_CIDR[1]}    ::/64    (:[a-f0-9]{,4}){,4}
129     Log    ${prefix_net20}
130     ${status}    ${message}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    5x    60s    Collect VM IPv6 SLAAC Addresses
131     ...    true    ${prefix_net20}    @{VM_INSTANCES_NET20}
132     ${VM_IP_NET10}=    Collect VM IPv6 SLAAC Addresses    false    ${prefix_net10}    @{VM_INSTANCES_NET10}
133     ${VM_IP_NET20}=    Collect VM IPv6 SLAAC Addresses    false    ${prefix_net20}    @{VM_INSTANCES_NET20}
134     Log    ${VM_IP_NET10}
135     Log    ${VM_IP_NET20}
136     ${VM_INSTANCES}=    Collections.Combine Lists    ${VM_INSTANCES_NET10}    ${VM_INSTANCES_NET20}
137     ${VM_IPS}=    Collections.Combine Lists    ${VM_IP_NET10}    ${VM_IP_NET20}
138     Log Many    Obtained IPs    ${VM_IPS}
139     ${LOOP_COUNT}    Get Length    ${VM_INSTANCES_NET10}
140     : FOR    ${index}    IN RANGE    0    ${LOOP_COUNT}
141     \    ${status}    ${message}    Run Keyword And Ignore Error    Should Not Contain    @{VM_IPS}[${index}]    None
142     \    Run Keyword If    '${status}' == 'FAIL'    Write Commands Until Prompt    nova console-log @{VM_INSTANCES}[${index}]    30s
143     Log    ${VM_IP_NET10}
144     Set Suite Variable    ${VM_IP_NET10}
145     Log    ${VM_IP_NET20}
146     Set Suite Variable    ${VM_IP_NET20}
147     Should Not Contain    ${VM_IP_NET10}    None
148     Should Not Contain    ${VM_IP_NET20}    None
149     [Teardown]    Run Keywords    Show Debugs    @{VM_INSTANCES_NET10}    @{VM_INSTANCES_NET20}
150     ...    AND    Get Suite Teardown Debugs
151
152 Check ELAN Datapath Traffic Within The Networks
153     [Documentation]    Checks datapath within the same network with different vlans.
154     ${output}=    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ping6 -c 3 ${VM_IP_NET10[1]}
155     Should Contain    ${output}    64 bytes
156     ${output}=    Execute Command on VM Instance    @{NETWORKS}[1]    ${VM_IP_NET20[0]}    ping6 -c 3 ${VM_IP_NET20[1]}
157     Should Contain    ${output}    64 bytes
158
159 Check L3_Datapath Traffic Across Networks With Router
160     [Documentation]    Datapath test across the networks using router for L3.
161     Log    Verification of FIB Entries and Flow
162     ${cn1_conn_id} =    Start Packet Capture on Node    ${OS_COMPUTE_1_IP}    file_Name=tcpDumpCN1
163     ${cn2_conn_id} =    Start Packet Capture on Node    ${OS_COMPUTE_2_IP}    file_Name=tcpDumpCN2
164     ${os_conn_id} =    Start Packet Capture on Node    ${OS_CONTROL_NODE_IP}    file_Name=tcpDumpOS
165     ${vm_instances} =    Create List    @{VM_IP_NET10}    @{VM_IP_NET20}
166     Wait Until Keyword Succeeds    30s    5s    Check For Elements At URI    ${FIB_ENTRY_URL}    ${vm_instances}
167     Wait Until Keyword Succeeds    30s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_1_IP}    ${VM_IP_NET10}
168     Wait Until Keyword Succeeds    30s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_1_IP}    ${VM_IP_NET20}
169     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Entry On ODL    ${GWMAC_ADDRS}
170     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Flow Entry On Flow Table    ${OS_COMPUTE_1_IP}
171     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Flow Entry On Flow Table    ${OS_COMPUTE_2_IP}
172     Log    L3 Datapath test across the networks using router
173     ${dst_ip_list} =    Create List    ${VM_IP_NET10[1]}    @{VM_IP_NET20}
174     Log Many    Destination IPs list    ${dst_ip_list}
175     Log Many    Source IP    ${VM_IP_NET10[1]}
176     Test Operations From Vm Instance    ${NETWORKS[0]}    ${VM_IP_NET10[0]}    ${dst_ip_list}
177     ${dst_ip_list} =    Create List    ${VM_IP_NET20[1]}    @{VM_IP_NET10}
178     Log Many    Destination IPs list    ${dst_ip_list}
179     Log Many    Source IP    ${VM_IP_NET20[0]}
180     Test Operations From Vm Instance    ${NETWORKS[1]}    ${VM_IP_NET20[0]}    ${dst_ip_list}
181     [Teardown]    Test Teardown With Tcpdump Stop    ${cn1_conn_id}    ${cn2_conn_id}    ${os_conn_id}
182
183 Add Multiple Extra Routes And Check Datapath Before L3VPN Creation
184     [Documentation]    Add multiple extra routes and check data path before L3VPN creation
185     Log    "Adding extra one route to VM"
186     ${CONFIG_EXTRA_ROUTE_IP1} =    Catenate    sudo ip -6 addr add ${EXTRA_NW_IP[0]}/64 dev eth0
187     Log    ${CONFIG_EXTRA_ROUTE_IP1}
188     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP1}
189     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ip -6 a
190     ${CONFIG_EXTRA_ROUTE_IP2} =    Catenate    sudo ip -6 addr add ${EXTRA_NW_IP[1]}/64 dev eth0
191     Log    ${CONFIG_EXTRA_ROUTE_IP2}
192     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP2}
193     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ip -6 a
194     ${EXT_RT1} =    Set Variable    destination=${EXTRA_NW_SUBNET[0]},gateway=${VM_IP_NET10[0]}
195     ${EXT_RT2} =    Set Variable    destination=${EXTRA_NW_SUBNET[1]},gateway=${VM_IP_NET10[0]}
196     ${cmd} =    Catenate    ${RT_OPTIONS}    ${EXT_RT1}    ${RT_OPTIONS}    ${EXT_RT2}
197     Update Router    @{ROUTERS}[0]    ${cmd}
198     Show Router    @{ROUTERS}[0]    -D
199     Log    "Verify FIB table"
200     ${vm_instances} =    Create List    @{EXTRA_NW_SUBNET}
201     Wait Until Keyword Succeeds    30s    5s    Check For Elements At URI    ${FIB_ENTRY_URL}    ${vm_instances}
202     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[1]}    ping6 -c 3 @{EXTRA_NW_IP}[1]
203     Should Contain    ${output}    64 bytes
204     ${output} =    Execute Command on VM Instance    @{NETWORKS}[1]    ${VM_IP_NET20[1]}    ping6 -c 3 @{EXTRA_NW_IP}[1]
205     Should Contain    ${output}    64 bytes
206     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[1]}    ping6 -c 3 @{EXTRA_NW_IP}[0]
207     Should Contain    ${output}    64 bytes
208
209 Delete Extra Route
210     [Documentation]    Delete the extra routes
211     Update Router    @{ROUTERS}[0]    ${RT_CLEAR}
212     Show Router    @{ROUTERS}[0]    -D
213
214 Delete And Recreate Extra Route
215     [Documentation]    Recreate multiple extra route and check data path before L3VPN creation
216     Log    "Adding extra route to VM"
217     ${CONFIG_EXTRA_ROUTE_IP1} =    Catenate    sudo ip -6 addr add ${EXTRA_NW_IP[1]}/64 dev eth0
218     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP1}
219     ${EXT_RT1} =    Set Variable    destination=${EXTRA_NW_SUBNET[0]},gateway=${VM_IP_NET10[0]}
220     ${cmd} =    Catenate    ${RT_OPTIONS}    ${EXT_RT1}
221     Update Router    @{ROUTERS}[0]    ${cmd}
222     Show Router    @{ROUTERS}[0]    -D
223     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[1]}    ping6 -c 3 @{EXTRA_NW_IP}[0]
224     Should Contain    ${output}    64 bytes
225     # clear off extra-routes before the next set of tests
226     [Teardown]    Run Keywords    Update Router    @{ROUTERS}[0]    ${RT_CLEAR}
227     ...    AND    Show Router    @{ROUTERS}[0]    -D
228     ...    AND    Get Test Teardown Debugs
229
230 Create L3VPN
231     [Documentation]    Creates L3VPN and verify the same
232     ${net_id} =    Get Net Id    @{NETWORKS}[0]    ${devstack_conn_id}
233     ${tenant_id} =    Get Tenant ID From Network    ${net_id}
234     VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID[0]}    name=${VPN_NAME[0]}    rd=@{RDS}[0]    exportrt=@{RDS}[0]    importrt=@{RDS}[0]    tenantid=${tenant_id}
235     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
236     Should Contain    ${resp}    ${VPN_INSTANCE_ID[0]}
237
238 Associate L3VPN To Routers
239     [Documentation]    Associating router to L3VPN
240     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
241     Associate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID[0]}
242     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
243     Should Contain    ${resp}    ${router_id}
244
245 Verify L3VPN Datapath With Router Association
246     [Documentation]    Datapath test across the networks using L3VPN with router association.
247     Log    Verify VPN interfaces, FIB entries and Flow table
248     ${vm_instances} =    Create List    @{VM_IP_NET10}    @{VM_IP_NET20}
249     Wait Until Keyword Succeeds    30s    5s    Check For Elements At URI    ${VPN_IFACES_URL}    ${vm_instances}
250     ${RD} =    Strip String    ${RDS[0]}    characters="[]
251     Log    ${RD}
252     Wait Until Keyword Succeeds    60s    5s    Check For Elements At URI    ${CONFIG_API}/odl-fib:fibEntries/vrfTables/${RD}/    ${vm_instances}
253     Wait Until Keyword Succeeds    60s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_1_IP}    ${vm_instances}
254     Wait Until Keyword Succeeds    60s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_2_IP}    ${vm_instances}
255     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Entry On ODL    ${GWMAC_ADDRS}
256     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Flow Entry On Flow Table    ${OS_COMPUTE_1_IP}
257     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Flow Entry On Flow Table    ${OS_COMPUTE_2_IP}
258     Log    Check datapath from network1 to network2
259     ${dst_ip_list} =    Create List    @{VM_IP_NET10}[1]    @{VM_IP_NET20}
260     Log    ${dst_ip_list}
261     Test Operations From Vm Instance    ${NETWORKS[0]}    @{VM_IP_NET10}[0]    ${dst_ip_list}
262     Log    Check datapath from network2 to network1
263     ${dst_ip_list} =    Create List    @{VM_IP_NET20}[1]    @{VM_IP_NET10}
264     Log    ${dst_ip_list}
265     Test Operations From Vm Instance    ${NETWORKS[1]}    @{VM_IP_NET20}[0]    ${dst_ip_list}
266
267 Dissociate L3VPN From Routers
268     [Documentation]    Dissociating router from L3VPN
269     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
270     Dissociate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID[0]}
271     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
272     Should Not Contain    ${resp}    ${router_id}
273
274 Delete Router And Router Interfaces With L3VPN
275     [Documentation]    Delete Router and Interface to the subnets with L3VPN associate
276     # Asscoiate router with L3VPN
277     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
278     Associate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID[0]}
279     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
280     Should Contain    ${resp}    ${router_id}
281     #Delete Interface
282     : FOR    ${INTERFACE}    IN    @{SUBNETS}
283     \    Remove Interface    ${ROUTERS[0]}    ${INTERFACE}
284     ${interface_output} =    Show Router Interface    ${ROUTERS[0]}
285     : FOR    ${INTERFACE}    IN    @{SUBNETS}
286     \    ${subnet_id} =    Get Subnet Id    ${INTERFACE}    ${devstack_conn_id}
287     \    Should Not Contain    ${interface_output}    ${subnet_id}
288     # Delete Router and Interface to the subnets.
289     Delete Router    ${ROUTERS[0]}
290     ${router_output} =    List Router
291     Log    ${router_output}
292     Should Not Contain    ${router_output}    ${ROUTERS[0]}
293     ${router_list} =    Create List    ${ROUTERS[0]}
294     Wait Until Keyword Succeeds    3s    1s    Check For Elements Not At URI    ${ROUTER_URL}    ${router_list}
295     # Verify Router Entry removed from L3VPN
296     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
297     Should Not Contain    ${resp}    ${router_id}
298     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Flow Entry Removed From Flow Table    ${OS_COMPUTE_1_IP}
299     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Flow Entry Removed From Flow Table    ${OS_COMPUTE_2_IP}
300
301 Delete Router With NonExistentRouter Name
302     [Documentation]    Delete router with nonExistentRouter name
303     ${rc}    ${output}=    Run And Return Rc And Output    neutron router-delete nonExistentRouter
304     Log    ${output}
305     Log    ${rc}
306     Should Match Regexp    ${output}    Unable to find router with name or id 'nonExistentRouter'|Unable to find router\\(s\\) with id\\(s\\) 'nonExistentRouter'
307
308 Associate L3VPN To Networks
309     [Documentation]    Associates L3VPN to networks and verify
310     ${network1_id} =    Get Net Id    ${NETWORKS[0]}    ${devstack_conn_id}
311     ${network2_id} =    Get Net Id    ${NETWORKS[1]}    ${devstack_conn_id}
312     Associate L3VPN To Network    networkid=${network1_id}    vpnid=${VPN_INSTANCE_ID[0]}
313     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
314     Should Contain    ${resp}    ${network1_id}
315     Associate L3VPN To Network    networkid=${network2_id}    vpnid=${VPN_INSTANCE_ID[0]}
316     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
317     Should Contain    ${resp}    ${network2_id}
318
319 Dissociate L3VPN From Networks
320     [Documentation]    Dissociate L3VPN from networks
321     ${network1_id} =    Get Net Id    ${NETWORKS[0]}    ${devstack_conn_id}
322     ${network2_id} =    Get Net Id    ${NETWORKS[1]}    ${devstack_conn_id}
323     Dissociate L3VPN From Networks    networkid=${network1_id}    vpnid=${VPN_INSTANCE_ID[0]}
324     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
325     Should Not Contain    ${resp}    ${network1_id}
326     Dissociate L3VPN From Networks    networkid=${network2_id}    vpnid=${VPN_INSTANCE_ID[0]}
327     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
328     Should Not Contain    ${resp}    ${network2_id}
329
330 Delete L3VPN
331     [Documentation]    Delete L3VPN
332     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
333
334 Create Multiple L3VPN
335     [Documentation]    Creates three L3VPNs and then verify the same
336     ${net_id} =    Get Net Id    @{NETWORKS}[0]    ${devstack_conn_id}
337     ${tenant_id} =    Get Tenant ID From Network    ${net_id}
338     VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID[0]}    name=${VPN_NAME[0]}    rd=${RDS[0]}    exportrt=${RDS[0]}    importrt=${RDS[0]}    tenantid=${tenant_id}
339     VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID[1]}    name=${VPN_NAME[1]}    rd=${RDS[1]}    exportrt=${RDS[1]}    importrt=${RDS[1]}    tenantid=${tenant_id}
340     VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID[2]}    name=${VPN_NAME[2]}    rd=${RDS[2]}    exportrt=${RDS[2]}    importrt=${RDS[2]}    tenantid=${tenant_id}
341     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
342     Should Contain    ${resp}    ${VPN_INSTANCE_ID[0]}
343     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[1]}
344     Should Contain    ${resp}    ${VPN_INSTANCE_ID[1]}
345     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[2]}
346     Should Contain    ${resp}    ${VPN_INSTANCE_ID[2]}
347
348 Delete Multiple L3VPN
349     [Documentation]    Delete three L3VPNs created using Multiple L3VPN Test
350     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
351     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[1]}
352     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[2]}
353
354 *** Keywords ***
355 Test Teardown With Tcpdump Stop
356     [Arguments]    ${cn1_conn_id}    ${cn2_conn_id}    ${os_conn_id}
357     Stop Packet Capture on Node    ${cn1_conn_id}
358     Stop Packet Capture on Node    ${cn2_conn_id}
359     Stop Packet Capture on Node    ${os_conn_id}
360     Get Test Teardown Debugs
361
362 Get Gateway MAC And IP Address
363     [Arguments]    ${router_Name}
364     [Documentation]    Get Gateway mac and IP Address
365     ${output} =    Write Commands Until Prompt    neutron router-port-list ${router_Name}    30s
366     @{MacAddr-list} =    Get Regexp Matches    ${output}    ${MAC_REGEX}
367     @{IpAddr-list} =    Get Regexp Matches    ${output}    ${IP6_REGEX}
368     [Return]    ${MacAddr-list}    ${IpAddr-list}
369
370 Verify GWMAC Flow Entry On Flow Table
371     [Arguments]    ${cnIp}
372     [Documentation]    Verify the GWMAC Table, ARP Response table and Dispatcher table.
373     ${flow_output}=    Run Command On Remote System    ${cnIp}    sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
374     Log    ${flow_output}
375     ${group_output}=    Run Command On Remote System    ${cnIp}    sudo ovs-ofctl -O OpenFlow13 dump-groups br-int
376     Log    ${group_output}
377     Should Contain    ${flow_output}    table=${DISPATCHER_TABLE}
378     ${dispatcher_table} =    Get Lines Containing String    ${flow_output}    table=${DISPATCHER_TABLE}
379     Log    ${dispatcher_table}
380     Should Contain    ${dispatcher_table}    goto_table:${GWMAC_TABLE}
381     Should Not Contain    ${dispatcher_table}    goto_table:${ARP_RESPONSE_TABLE}
382     Should Contain    ${flow_output}    table=${GWMAC_TABLE}
383     ${gwmac_table} =    Get Lines Containing String    ${flow_output}    table=${GWMAC_TABLE}
384     Log    ${gwmac_table}
385     #Verify GWMAC address present in table 19
386     : FOR    ${macAdd}    IN    @{GWMAC_ADDRS}
387     \    Should Contain    ${gwmac_table}    dl_dst=${macAdd} actions=goto_table:${L3_TABLE}
388     #verify Miss entry
389     Should Contain    ${gwmac_table}    actions=resubmit(,17)
390     #Verify ARP_CHECK_TABLE - 43
391     #arp request and response
392     ${arpchk_table} =    Get Lines Containing String    ${flow_output}    table=${ARP_CHECK_TABLE}
393     Should Match Regexp    ${arpchk_table}    ${ARP_RESPONSE_REGEX}
394     ${match} =    Should Match Regexp    ${arpchk_table}    ${ARP_REQUEST_REGEX}
395     ${groupID} =    Split String    ${match}    separator=:
396     Log    groupID
397     Should Contain    ${flow_output}    table=${IPV6_TABLE}
398     ${icmp_ipv6_flows} =    Get Lines Containing String    ${flow_output}    icmp_type=135
399     Log    ${icmp_ipv6_flows}
400     : FOR    ${ip_addr}    IN    @{GWIP_ADDRS}
401     \    ${rule} =    Set Variable    icmp_type=135,icmp_code=0,nd_target=${ip_addr} actions=CONTROLLER:65535
402     \    Should Match Regexp    ${icmp_ipv6_flows}    ${rule}