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