Fix up CSIT such that extra-route is cleared correctly.
[integration/test.git] / csit / suites / netvirt / Netvirt_Vpnservice / basic_vpnservice.robot
1 *** Settings ***
2 Documentation     Test suite to validate 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       BuiltIn.Run Keywords    SetupUtils.Setup_Utils_For_Setup_And_Teardown
6 ...               AND    DevstackUtils.Devstack Suite Setup
7 ...               AND    Enable ODL Karaf Log
8 Suite Teardown    Close All Connections
9 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
10 Test Teardown     Get Test Teardown Debugs
11 Library           OperatingSystem
12 Library           RequestsLibrary
13 Resource          ../../../libraries/Utils.robot
14 Resource          ../../../libraries/OpenStackOperations.robot
15 Resource          ../../../libraries/DevstackUtils.robot
16 Resource          ../../../libraries/VpnOperations.robot
17 Resource          ../../../libraries/OVSDB.robot
18 Resource          ../../../libraries/SetupUtils.robot
19 Resource          ../../../variables/Variables.robot
20
21 *** Variables ***
22 @{NETWORKS}       NET10    NET20
23 @{SUBNETS}        SUBNET1    SUBNET2
24 @{SUBNET_CIDR}    10.1.1.0/24    20.1.1.0/24
25 @{PORT_LIST}      PORT11    PORT21    PORT12    PORT22
26 @{VM_INSTANCES_NET10}    VM11    VM21
27 @{VM_INSTANCES_NET20}    VM12    VM22
28 @{ROUTERS}        ROUTER_1    ROUTER_2
29 @{VPN_INSTANCE_ID}    4ae8cd92-48ca-49b5-94e1-b2921a261111    4ae8cd92-48ca-49b5-94e1-b2921a261112    4ae8cd92-48ca-49b5-94e1-b2921a261113
30 @{VPN_NAME}       vpn1    vpn2    vpn3
31 @{CREATE_RD}      ["2200:2"]    ["2300:2"]    ["2400:2"]
32 @{CREATE_EXPORT_RT}    ["2200:2"]    ["2300:2"]    ["2400:2"]
33 @{CREATE_IMPORT_RT}    ["2200:2"]    ["2300:2"]    ["2400:2"]
34 @{EXTRA_NW_IP}    40.1.1.2    50.1.1.2
35 @{EXTRA_NW_SUBNET}    40.1.1.0/24    50.1.1.0/24
36 # Values passed for extra routes
37 ${RT_OPTIONS}     --routes type=dict list=true
38 ${RT_CLEAR}       --routes action=clear
39
40 *** Test Cases ***
41 Create Neutron Networks
42     [Documentation]    Create two networks
43     Create Network    ${NETWORKS[0]}
44     Create Network    ${NETWORKS[1]}
45     ${NET_LIST}    List Networks
46     Log    ${NET_LIST}
47     Should Contain    ${NET_LIST}    ${NETWORKS[0]}
48     Should Contain    ${NET_LIST}    ${NETWORKS[1]}
49     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${CONFIG_API}/neutron:neutron/networks/    ${NETWORKS}
50
51 Create Neutron Subnets
52     [Documentation]    Create two subnets for previously created networks
53     Create SubNet    ${NETWORKS[0]}    ${SUBNETS[0]}    ${SUBNET_CIDR[0]}
54     Create SubNet    ${NETWORKS[1]}    ${SUBNETS[1]}    ${SUBNET_CIDR[1]}
55     ${SUB_LIST}    List Subnets
56     Log    ${SUB_LIST}
57     Should Contain    ${SUB_LIST}    ${SUBNETS[0]}
58     Should Contain    ${SUB_LIST}    ${SUBNETS[1]}
59     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${CONFIG_API}/neutron:neutron/subnets/    ${SUBNETS}
60
61 Add Ssh Allow Rule
62     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
63     Neutron Security Group Create    sg-vpnservice
64     Neutron Security Group Rule Create    sg-vpnservice    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
65     Neutron Security Group Rule Create    sg-vpnservice    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
66     Neutron Security Group Rule Create    sg-vpnservice    direction=ingress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
67     Neutron Security Group Rule Create    sg-vpnservice    direction=egress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
68     Neutron Security Group Rule Create    sg-vpnservice    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
69     Neutron Security Group Rule Create    sg-vpnservice    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
70
71 Create Neutron Ports
72     [Documentation]    Create four ports under previously created subnets
73     Create Port    ${NETWORKS[0]}    ${PORT_LIST[0]}    sg=sg-vpnservice
74     Create Port    ${NETWORKS[0]}    ${PORT_LIST[1]}    sg=sg-vpnservice
75     Create Port    ${NETWORKS[1]}    ${PORT_LIST[2]}    sg=sg-vpnservice
76     Create Port    ${NETWORKS[1]}    ${PORT_LIST[3]}    sg=sg-vpnservice
77     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${CONFIG_API}/neutron:neutron/ports/    ${PORT_LIST}
78
79 Create Nova VMs
80     [Documentation]    Create Vm instances on compute node with port
81     Create Vm Instance With Port On Compute Node    ${PORT_LIST[0]}    ${VM_INSTANCES_NET10[0]}    ${OS_COMPUTE_1_IP}    sg=sg-vpnservice
82     Create Vm Instance With Port On Compute Node    ${PORT_LIST[1]}    ${VM_INSTANCES_NET10[1]}    ${OS_COMPUTE_2_IP}    sg=sg-vpnservice
83     Create Vm Instance With Port On Compute Node    ${PORT_LIST[2]}    ${VM_INSTANCES_NET20[0]}    ${OS_COMPUTE_1_IP}    sg=sg-vpnservice
84     Create Vm Instance With Port On Compute Node    ${PORT_LIST[3]}    ${VM_INSTANCES_NET20[1]}    ${OS_COMPUTE_2_IP}    sg=sg-vpnservice
85     ${VM_INSTANCES} =    Create List    @{VM_INSTANCES_NET10}    @{VM_INSTANCES_NET20}
86     : FOR    ${VM}    IN    @{VM_INSTANCES}
87     \    Wait Until Keyword Succeeds    25s    5s    Verify VM Is ACTIVE    ${VM}
88     Log    Check for routes
89     Wait Until Keyword Succeeds    30s    10s    Wait For Routes To Propogate
90     ${VM_IP_NET10}    ${DHCP_IP1}    Wait Until Keyword Succeeds    30s    10s    Verify VMs Received DHCP Lease    @{VM_INSTANCES_NET10}
91     Log    ${VM_IP_NET10}
92     Set Suite Variable    ${VM_IP_NET10}
93     ${VM_IP_NET20}    ${DHCP_IP2}    Wait Until Keyword Succeeds    30s    10s    Verify VMs Received DHCP Lease    @{VM_INSTANCES_NET20}
94     Log    ${VM_IP_NET20}
95     Set Suite Variable    ${VM_IP_NET20}
96
97 Check ELAN Datapath Traffic Within The Networks
98     [Documentation]    Checks datapath within the same network with different vlans.
99     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ping -c 3 ${VM_IP_NET10[1]}
100     Should Contain    ${output}    64 bytes
101     ${output} =    Execute Command on VM Instance    @{NETWORKS}[1]    ${VM_IP_NET20[0]}    ping -c 3 ${VM_IP_NET20[1]}
102     Should Contain    ${output}    64 bytes
103
104 Create Routers
105     [Documentation]    Create Router
106     Create Router    ${ROUTERS[0]}
107     ${router_output} =    List Router
108     Log    ${router_output}
109     Should Contain    ${router_output}    ${ROUTERS[0]}
110     ${router_list} =    Create List    ${ROUTERS[0]}
111     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${CONFIG_API}/neutron:neutron/routers/    ${router_list}
112
113 Add Interfaces To Router
114     [Documentation]    Add Interfaces
115     ${devstack_conn_id} =    Get ControlNode Connection
116     : FOR    ${INTERFACE}    IN    @{SUBNETS}
117     \    Add Router Interface    ${ROUTERS[0]}    ${INTERFACE}
118     ${interface_output} =    Show Router Interface    ${ROUTERS[0]}
119     : FOR    ${INTERFACE}    IN    @{SUBNETS}
120     \    ${subnet_id} =    Get Subnet Id    ${INTERFACE}    ${devstack_conn_id}
121     \    Should Contain    ${interface_output}    ${subnet_id}
122
123 Check L3_Datapath Traffic Across Networks With Router
124     [Documentation]    Datapath test across the networks using router for L3.
125     Log    Verification of FIB Entries and Flow
126     ${vm_instances} =    Create List    @{VM_IP_NET10}    @{VM_IP_NET20}
127     Wait Until Keyword Succeeds    30s    5s    Check For Elements At URI    ${CONFIG_API}/odl-fib:fibEntries/    ${vm_instances}
128     Wait Until Keyword Succeeds    30s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_1_IP}    ${VM_IP_NET10}
129     Wait Until Keyword Succeeds    30s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_1_IP}    ${VM_IP_NET20}
130     Log    L3 Datapath test across the networks using router
131     ${dst_ip_list} =    Create List    ${VM_IP_NET10[1]}    @{VM_IP_NET20}
132     Log    ${dst_ip_list}
133     Test Operations From Vm Instance    ${NETWORKS[0]}    ${VM_IP_NET10[1]}    ${dst_ip_list}
134     ${dst_ip_list} =    Create List    ${VM_IP_NET20[1]}    @{VM_IP_NET10}
135     Log    ${dst_ip_list}
136     Test Operations From Vm Instance    ${NETWORKS[1]}    ${VM_IP_NET20[0]}    ${dst_ip_list}
137
138 Add Multiple Extra Routes And Check Datapath Before L3VPN Creation
139     [Documentation]    Add multiple extra routes and check data path before L3VPN creation
140     Log    "Adding extra one route to VM"
141     ${CONFIG_EXTRA_ROUTE_IP1} =    Catenate    sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
142     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP1}
143     ${CONFIG_EXTRA_ROUTE_IP2} =    Catenate    sudo ifconfig eth0:2 @{EXTRA_NW_IP}[1] netmask 255.255.255.0 up
144     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP2}
145     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ifconfig
146     ${EXT_RT1} =    Set Variable    destination=40.1.1.0/24,nexthop=${VM_IP_NET10[0]}
147     ${EXT_RT2} =    Set Variable    destination=50.1.1.0/24,nexthop=${VM_IP_NET10[0]}
148     ${cmd} =    Catenate    ${RT_OPTIONS}    ${EXT_RT1}    ${EXT_RT2}
149     Update Router    @{ROUTERS}[0]    ${cmd}
150     Show Router    @{ROUTERS}[0]    -D
151     Log    "Verify FIB table"
152     ${vm_instances} =    Create List    @{EXTRA_NW_SUBNET}
153     Wait Until Keyword Succeeds    30s    5s    Check For Elements At URI    ${CONFIG_API}/odl-fib:fibEntries/    ${vm_instances}
154     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[1]}    ping -c 3 @{EXTRA_NW_IP}[1]
155     Should Contain    ${output}    64 bytes
156     ${output} =    Execute Command on VM Instance    @{NETWORKS}[1]    ${VM_IP_NET20[1]}    ping -c 3 @{EXTRA_NW_IP}[1]
157     Should Contain    ${output}    64 bytes
158     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[1]}    ping -c 3 @{EXTRA_NW_IP}[0]
159     Should Contain    ${output}    64 bytes
160
161 Delete Extra Route
162     [Documentation]    Delete the extra routes
163     Update Router    @{ROUTERS}[0]    ${RT_CLEAR}
164     Show Router    @{ROUTERS}[0]    -D
165
166 Delete And Recreate Extra Route
167     [Documentation]    Recreate multiple extra route and check data path before L3VPN creation
168     Log    "Adding extra route to VM"
169     ${CONFIG_EXTRA_ROUTE_IP1} =    Catenate    sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
170     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP1}
171     ${EXT_RT1} =    Set Variable    destination=40.1.1.0/24,nexthop=${VM_IP_NET10[0]}
172     ${cmd} =    Catenate    ${RT_OPTIONS}    ${EXT_RT1}
173     Update Router    @{ROUTERS}[0]    ${cmd}
174     Show Router    @{ROUTERS}[0]    -D
175     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[1]}    ping -c 3 @{EXTRA_NW_IP}[0]
176     Should Contain    ${output}    64 bytes
177     # clear off extra-routes before the next set of tests
178     [Teardown]    Run Keywords    Update Router    @{ROUTERS}[0]    ${RT_CLEAR}
179     ...    AND    Show Router    @{ROUTERS}[0]    -D
180     ...    AND    Get Test Teardown Debugs
181
182 Create L3VPN
183     [Documentation]    Creates L3VPN and verify the same
184     ${devstack_conn_id} =    Get ControlNode Connection
185     Switch Connection    ${devstack_conn_id}
186     ${net_id} =    Get Net Id    @{NETWORKS}[0]    ${devstack_conn_id}
187     ${tenant_id} =    Get Tenant ID From Network    ${net_id}
188     VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID[0]}    name=${VPN_NAME[0]}    rd=${CREATE_RD[0]}    exportrt=${CREATE_EXPORT_RT[0]}    importrt=${CREATE_IMPORT_RT[0]}    tenantid=${tenant_id}
189     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
190     Should Contain    ${resp}    ${VPN_INSTANCE_ID[0]}
191
192 Associate L3VPN To Routers
193     [Documentation]    Associating router to L3VPN
194     ${devstack_conn_id}=    Get ControlNode Connection
195     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
196     Associate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID[0]}
197     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
198     Should Contain    ${resp}    ${router_id}
199
200 Verify L3VPN Datapath With Router Association
201     [Documentation]    Datapath test across the networks using L3VPN with router association.
202     Log    Verify VPN interfaces, FIB entries and Flow table
203     ${vm_instances} =    Create List    @{VM_IP_NET10}    @{VM_IP_NET20}
204     Wait Until Keyword Succeeds    30s    5s    Check For Elements At URI    ${CONFIG_API}/l3vpn:vpn-interfaces/    ${vm_instances}
205     ${RD} =    Strip String    ${CREATE_RD[0]}    characters="[]
206     Log    ${RD}
207     Wait Until Keyword Succeeds    60s    5s    Check For Elements At URI    ${CONFIG_API}/odl-fib:fibEntries/vrfTables/${RD}/    ${vm_instances}
208     Wait Until Keyword Succeeds    60s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_1_IP}    ${vm_instances}
209     Wait Until Keyword Succeeds    60s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_2_IP}    ${vm_instances}
210     Log    Check datapath from network1 to network2
211     ${dst_ip_list} =    Create List    @{VM_IP_NET10}[1]    @{VM_IP_NET20}
212     Log    ${dst_ip_list}
213     Test Operations From Vm Instance    ${NETWORKS[0]}    @{VM_IP_NET10}[0]    ${dst_ip_list}
214     Log    Check datapath from network2 to network1
215     ${dst_ip_list} =    Create List    @{VM_IP_NET20}[1]    @{VM_IP_NET10}
216     Log    ${dst_ip_list}
217     Test Operations From Vm Instance    ${NETWORKS[1]}    @{VM_IP_NET20}[0]    ${dst_ip_list}
218
219 Dissociate L3VPN From Routers
220     [Documentation]    Dissociating router from L3VPN
221     ${devstack_conn_id}=    Get ControlNode Connection
222     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
223     Dissociate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID[0]}
224     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
225     Should Not Contain    ${resp}    ${router_id}
226
227 Delete Router And Router Interfaces With L3VPN
228     [Documentation]    Delete Router and Interface to the subnets with L3VPN assciate
229     # Asscoiate router with L3VPN
230     ${devstack_conn_id} =    Get ControlNode Connection
231     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
232     Associate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID[0]}
233     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
234     Should Contain    ${resp}    ${router_id}
235     #Delete Interface
236     : FOR    ${INTERFACE}    IN    @{SUBNETS}
237     \    Remove Interface    ${ROUTERS[0]}    ${INTERFACE}
238     ${interface_output} =    Show Router Interface    ${ROUTERS[0]}
239     : FOR    ${INTERFACE}    IN    @{SUBNETS}
240     \    ${subnet_id} =    Get Subnet Id    ${INTERFACE}    ${devstack_conn_id}
241     \    Should Not Contain    ${interface_output}    ${subnet_id}
242     # Delete Router and Interface to the subnets.
243     Delete Router    ${ROUTERS[0]}
244     ${router_output} =    List Router
245     Log    ${router_output}
246     Should Not Contain    ${router_output}    ${ROUTERS[0]}
247     ${router_list} =    Create List    ${ROUTERS[0]}
248     Wait Until Keyword Succeeds    3s    1s    Check For Elements Not At URI    ${CONFIG_API}/neutron:neutron/routers/    ${router_list}
249     # Verify Router Entry removed from L3VPN
250     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
251     Should Not Contain    ${resp}    ${router_id}
252
253 Delete Router With NonExistentRouter Name
254     [Documentation]    Delete router with nonExistentRouter name
255     ${devstack_conn_id}=    Get ControlNode Connection
256     Switch Connection    ${devstack_conn_id}
257     ${output} =    Write Commands Until Prompt    neutron router-delete nonExistentRouter    30s
258     Close Connection
259     Should Match Regexp    ${output}    Unable to find router with name or id 'nonExistentRouter'|Unable to find router\\(s\\) with id\\(s\\) 'nonExistentRouter'
260
261 Associate L3VPN To Networks
262     [Documentation]    Associates L3VPN to networks and verify
263     ${devstack_conn_id} =    Get ControlNode Connection
264     ${network1_id} =    Get Net Id    ${NETWORKS[0]}    ${devstack_conn_id}
265     ${network2_id} =    Get Net Id    ${NETWORKS[1]}    ${devstack_conn_id}
266     Associate L3VPN To Network    networkid=${network1_id}    vpnid=${VPN_INSTANCE_ID[0]}
267     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
268     Should Contain    ${resp}    ${network1_id}
269     Associate L3VPN To Network    networkid=${network2_id}    vpnid=${VPN_INSTANCE_ID[0]}
270     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
271     Should Contain    ${resp}    ${network2_id}
272
273 Dissociate L3VPN From Networks
274     [Documentation]    Dissociate L3VPN from networks
275     ${devstack_conn_id} =    Get ControlNode Connection
276     ${network1_id} =    Get Net Id    ${NETWORKS[0]}    ${devstack_conn_id}
277     ${network2_id} =    Get Net Id    ${NETWORKS[1]}    ${devstack_conn_id}
278     Dissociate L3VPN From Networks    networkid=${network1_id}    vpnid=${VPN_INSTANCE_ID[0]}
279     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
280     Should Not Contain    ${resp}    ${network1_id}
281     Dissociate L3VPN From Networks    networkid=${network2_id}    vpnid=${VPN_INSTANCE_ID[0]}
282     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
283     Should Not Contain    ${resp}    ${network2_id}
284
285 Delete L3VPN
286     [Documentation]    Delete L3VPN
287     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
288
289 Create Multiple L3VPN
290     [Documentation]    Creates three L3VPNs and then verify the same
291     ${devstack_conn_id} =    Get ControlNode Connection
292     Switch Connection    ${devstack_conn_id}
293     ${net_id} =    Get Net Id    @{NETWORKS}[0]    ${devstack_conn_id}
294     ${tenant_id} =    Get Tenant ID From Network    ${net_id}
295     VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID[0]}    name=${VPN_NAME[0]}    rd=${CREATE_RD[0]}    exportrt=${CREATE_EXPORT_RT[0]}    importrt=${CREATE_IMPORT_RT[0]}    tenantid=${tenant_id}
296     VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID[1]}    name=${VPN_NAME[1]}    rd=${CREATE_RD[1]}    exportrt=${CREATE_EXPORT_RT[1]}    importrt=${CREATE_IMPORT_RT[1]}    tenantid=${tenant_id}
297     VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID[2]}    name=${VPN_NAME[2]}    rd=${CREATE_RD[2]}    exportrt=${CREATE_EXPORT_RT[2]}    importrt=${CREATE_IMPORT_RT[2]}    tenantid=${tenant_id}
298     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
299     Should Contain    ${resp}    ${VPN_INSTANCE_ID[0]}
300     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[1]}
301     Should Contain    ${resp}    ${VPN_INSTANCE_ID[1]}
302     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[2]}
303     Should Contain    ${resp}    ${VPN_INSTANCE_ID[2]}
304
305 Delete Multiple L3VPN
306     [Documentation]    Delete three L3VPNs created using Multiple L3VPN Test
307     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
308     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[1]}
309     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[2]}
310
311 Check Datapath Traffic Across Networks With L3VPN
312     [Documentation]    Datapath Test Across the networks with VPN.
313     [Tags]    exclude
314     Log    This test will be added in the next patch
315
316 Delete Vm Instances
317     [Documentation]    Delete Vm instances in the given Instance List
318     ${VM_INSTANCES} =    Create List    @{VM_INSTANCES_NET10}    @{VM_INSTANCES_NET20}
319     : FOR    ${VmInstance}    IN    @{VM_INSTANCES}
320     \    Delete Vm Instance    ${VmInstance}
321
322 Delete Neutron Ports
323     [Documentation]    Delete Neutron Ports in the given Port List.
324     : FOR    ${Port}    IN    @{PORT_LIST}
325     \    Delete Port    ${Port}
326
327 Delete Sub Networks
328     [Documentation]    Delete Sub Nets in the given Subnet List.
329     : FOR    ${Subnet}    IN    @{SUBNETS}
330     \    Delete SubNet    ${Subnet}
331
332 Delete Networks
333     [Documentation]    Delete Networks in the given Net List
334     : FOR    ${Network}    IN    @{NETWORKS}
335     \    Delete Network    ${Network}
336
337 Create ITM Tunnel
338     [Documentation]    Checks that vxlan tunnels are created successfully. This testcase expects that the two DPNs are in the same network hence populates the gateway accordingly.
339     ${node_1_dpid} =    Get DPID    ${OS_COMPUTE_1_IP}
340     ${node_2_dpid} =    Get DPID    ${OS_COMPUTE_2_IP}
341     ${node_1_adapter} =    Get Ethernet Adapter    ${OS_COMPUTE_1_IP}
342     ${node_2_adapter} =    Get Ethernet Adapter    ${OS_COMPUTE_2_IP}
343     ${subnet} =    Get Subnet    ${OS_COMPUTE_1_IP}
344     ${gateway} =    Get Default Gateway    ${OS_COMPUTE_1_IP}
345     ITM Create Tunnel    tunneltype=vxlan    vlanid=0    prefix=${subnet}    gateway=${gateway}    ipaddress1=${OS_COMPUTE_1_IP}    dpnid1=${node_1_dpid}
346     ...    portname1=${node_1_adapter}    ipaddress2=${OS_COMPUTE_2_IP}    dpnid2=${node_2_dpid}    portname2=${node_2_adapter}
347     Get DumpFlows And Ovsconfig    ${OS_COMPUTE_1_IP}
348     Get DumpFlows And Ovsconfig    ${OS_COMPUTE_2_IP}
349     ${output} =    ITM Get Tunnels
350     Log    ${output}
351
352 Delete ITM Tunnel
353     [Documentation]    Delete tunnels with specific transport-zone.
354     ITM Delete Tunnel    TZA
355
356 *** Keywords ***
357 Basic Vpnservice Suite Setup
358     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
359
360 Basic Vpnservice Suite Teardown
361     Delete All Sessions
362
363 Wait For Routes To Propogate
364     ${devstack_conn_id} =    Get ControlNode Connection
365     Switch Connection    ${devstack_conn_id}
366     ${net_id} =    Get Net Id    @{NETWORKS}[0]    ${devstack_conn_id}
367     ${output} =    Write Commands Until Expected Prompt    sudo ip netns exec qdhcp-${net_id} ip route    ]>
368     Should Contain    ${output}    @{SUBNET_CIDR}[0]
369     ${net_id} =    Get Net Id    @{NETWORKS}[1]    ${devstack_conn_id}
370     ${output} =    Write Commands Until Expected Prompt    sudo ip netns exec qdhcp-${net_id} ip route    ]>
371     Should Contain    ${output}    @{SUBNET_CIDR}[1]
372
373 Enable ODL Karaf Log
374     [Documentation]    Uses log:set TRACE org.opendaylight.netvirt to enable log
375     Log    "Enabled ODL Karaf log for org.opendaylight.netvirt"
376     ${output}=    Issue Command On Karaf Console    log:set TRACE org.opendaylight.netvirt
377     Log    ${output}