98d24cb52f1bbfd2ce762fefcf377d03a7b8464f
[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     ${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]}
73     Create Port    ${NETWORKS[0]}    ${PORT_LIST[0]}    sg=sg-vpnservice    additional_args=${allowed_address_pairs_args}
74     Create Port    ${NETWORKS[0]}    ${PORT_LIST[1]}    sg=sg-vpnservice    additional_args=${allowed_address_pairs_args}
75     Create Port    ${NETWORKS[1]}    ${PORT_LIST[2]}    sg=sg-vpnservice    additional_args=${allowed_address_pairs_args}
76     Create Port    ${NETWORKS[1]}    ${PORT_LIST[3]}    sg=sg-vpnservice    additional_args=${allowed_address_pairs_args}
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     : FOR    ${index}    IN RANGE    1    5
91     \    ${VM_IP_NET10}    ${DHCP_IP1}    Wait Until Keyword Succeeds    30s    10s    Verify VMs Received DHCP Lease
92     \    ...    @{VM_INSTANCES_NET10}
93     \    ${VM_IP_NET20}    ${DHCP_IP2}    Wait Until Keyword Succeeds    30s    10s    Verify VMs Received DHCP Lease
94     \    ...    @{VM_INSTANCES_NET20}
95     \    ${VM_IPS}=    Collections.Combine Lists    ${VM_IP_NET10}    ${VM_IP_NET20}
96     \    ${status}    ${message}    Run Keyword And Ignore Error    List Should Not Contain Value    ${VM_IPS}    None
97     \    Exit For Loop If    '${status}' == 'PASS'
98     \    BuiltIn.Sleep    5s
99     : FOR    ${vm}    IN    @{VM_INSTANCES_NET10}    @{VM_INSTANCES_NET20}
100     \    Write Commands Until Prompt    nova console-log ${vm}    30s
101     Log    ${VM_IP_NET10}
102     Set Suite Variable    ${VM_IP_NET10}
103     Log    ${VM_IP_NET20}
104     Set Suite Variable    ${VM_IP_NET20}
105     Should Not Contain    ${VM_IP_NET10)    None
106     Should Not Contain    ${VM_IP_NET20}    None
107     [Teardown]    Run Keywords    Show Debugs    @{VM_INSTANCES_NET10}    @{VM_INSTANCES_NET20}
108     ...    AND    Get Suite Teardown Debugs
109
110 Check ELAN Datapath Traffic Within The Networks
111     [Documentation]    Checks datapath within the same network with different vlans.
112     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ping -c 3 ${VM_IP_NET10[1]}
113     Should Contain    ${output}    64 bytes
114     ${output} =    Execute Command on VM Instance    @{NETWORKS}[1]    ${VM_IP_NET20[0]}    ping -c 3 ${VM_IP_NET20[1]}
115     Should Contain    ${output}    64 bytes
116
117 Create Routers
118     [Documentation]    Create Router
119     Create Router    ${ROUTERS[0]}
120     ${router_output} =    List Router
121     Log    ${router_output}
122     Should Contain    ${router_output}    ${ROUTERS[0]}
123     ${router_list} =    Create List    ${ROUTERS[0]}
124     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${CONFIG_API}/neutron:neutron/routers/    ${router_list}
125
126 Add Interfaces To Router
127     [Documentation]    Add Interfaces
128     ${devstack_conn_id} =    Get ControlNode Connection
129     : FOR    ${INTERFACE}    IN    @{SUBNETS}
130     \    Add Router Interface    ${ROUTERS[0]}    ${INTERFACE}
131     ${interface_output} =    Show Router Interface    ${ROUTERS[0]}
132     : FOR    ${INTERFACE}    IN    @{SUBNETS}
133     \    ${subnet_id} =    Get Subnet Id    ${INTERFACE}    ${devstack_conn_id}
134     \    Should Contain    ${interface_output}    ${subnet_id}
135
136 Check L3_Datapath Traffic Across Networks With Router
137     [Documentation]    Datapath test across the networks using router for L3.
138     Log    Verification of FIB Entries and Flow
139     ${vm_instances} =    Create List    @{VM_IP_NET10}    @{VM_IP_NET20}
140     Wait Until Keyword Succeeds    30s    5s    Check For Elements At URI    ${CONFIG_API}/odl-fib:fibEntries/    ${vm_instances}
141     Wait Until Keyword Succeeds    30s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_1_IP}    ${VM_IP_NET10}
142     Wait Until Keyword Succeeds    30s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_1_IP}    ${VM_IP_NET20}
143     Log    L3 Datapath test across the networks using router
144     ${dst_ip_list} =    Create List    ${VM_IP_NET10[1]}    @{VM_IP_NET20}
145     Log    ${dst_ip_list}
146     Test Operations From Vm Instance    ${NETWORKS[0]}    ${VM_IP_NET10[1]}    ${dst_ip_list}
147     ${dst_ip_list} =    Create List    ${VM_IP_NET20[1]}    @{VM_IP_NET10}
148     Log    ${dst_ip_list}
149     Test Operations From Vm Instance    ${NETWORKS[1]}    ${VM_IP_NET20[0]}    ${dst_ip_list}
150
151 Add Multiple Extra Routes And Check Datapath Before L3VPN Creation
152     [Documentation]    Add multiple extra routes and check data path before L3VPN creation
153     Log    "Adding extra one route to VM"
154     ${CONFIG_EXTRA_ROUTE_IP1} =    Catenate    sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
155     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP1}
156     ${CONFIG_EXTRA_ROUTE_IP2} =    Catenate    sudo ifconfig eth0:2 @{EXTRA_NW_IP}[1] netmask 255.255.255.0 up
157     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP2}
158     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ifconfig
159     ${EXT_RT1} =    Set Variable    destination=40.1.1.0/24,nexthop=${VM_IP_NET10[0]}
160     ${EXT_RT2} =    Set Variable    destination=50.1.1.0/24,nexthop=${VM_IP_NET10[0]}
161     ${cmd} =    Catenate    ${RT_OPTIONS}    ${EXT_RT1}    ${EXT_RT2}
162     Update Router    @{ROUTERS}[0]    ${cmd}
163     Show Router    @{ROUTERS}[0]    -D
164     Log    "Verify FIB table"
165     ${vm_instances} =    Create List    @{EXTRA_NW_SUBNET}
166     Wait Until Keyword Succeeds    30s    5s    Check For Elements At URI    ${CONFIG_API}/odl-fib:fibEntries/    ${vm_instances}
167     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[1]}    ping -c 3 @{EXTRA_NW_IP}[1]
168     Should Contain    ${output}    64 bytes
169     ${output} =    Execute Command on VM Instance    @{NETWORKS}[1]    ${VM_IP_NET20[1]}    ping -c 3 @{EXTRA_NW_IP}[1]
170     Should Contain    ${output}    64 bytes
171     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[1]}    ping -c 3 @{EXTRA_NW_IP}[0]
172     Should Contain    ${output}    64 bytes
173
174 Delete Extra Route
175     [Documentation]    Delete the extra routes
176     Update Router    @{ROUTERS}[0]    ${RT_CLEAR}
177     Show Router    @{ROUTERS}[0]    -D
178
179 Delete And Recreate Extra Route
180     [Documentation]    Recreate multiple extra route and check data path before L3VPN creation
181     Log    "Adding extra route to VM"
182     ${CONFIG_EXTRA_ROUTE_IP1} =    Catenate    sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
183     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP1}
184     ${EXT_RT1} =    Set Variable    destination=40.1.1.0/24,nexthop=${VM_IP_NET10[0]}
185     ${cmd} =    Catenate    ${RT_OPTIONS}    ${EXT_RT1}
186     Update Router    @{ROUTERS}[0]    ${cmd}
187     Show Router    @{ROUTERS}[0]    -D
188     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[1]}    ping -c 3 @{EXTRA_NW_IP}[0]
189     Should Contain    ${output}    64 bytes
190     # clear off extra-routes before the next set of tests
191     [Teardown]    Run Keywords    Update Router    @{ROUTERS}[0]    ${RT_CLEAR}
192     ...    AND    Show Router    @{ROUTERS}[0]    -D
193     ...    AND    Get Test Teardown Debugs
194
195 Create L3VPN
196     [Documentation]    Creates L3VPN and verify the same
197     ${devstack_conn_id} =    Get ControlNode Connection
198     Switch Connection    ${devstack_conn_id}
199     ${net_id} =    Get Net Id    @{NETWORKS}[0]    ${devstack_conn_id}
200     ${tenant_id} =    Get Tenant ID From Network    ${net_id}
201     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}
202     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
203     Should Contain    ${resp}    ${VPN_INSTANCE_ID[0]}
204
205 Associate L3VPN To Routers
206     [Documentation]    Associating router to L3VPN
207     ${devstack_conn_id}=    Get ControlNode Connection
208     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
209     Associate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID[0]}
210     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
211     Should Contain    ${resp}    ${router_id}
212
213 Verify L3VPN Datapath With Router Association
214     [Documentation]    Datapath test across the networks using L3VPN with router association.
215     Log    Verify VPN interfaces, FIB entries and Flow table
216     ${vm_instances} =    Create List    @{VM_IP_NET10}    @{VM_IP_NET20}
217     Wait Until Keyword Succeeds    30s    5s    Check For Elements At URI    ${CONFIG_API}/l3vpn:vpn-interfaces/    ${vm_instances}
218     ${RD} =    Strip String    ${CREATE_RD[0]}    characters="[]
219     Log    ${RD}
220     Wait Until Keyword Succeeds    60s    5s    Check For Elements At URI    ${CONFIG_API}/odl-fib:fibEntries/vrfTables/${RD}/    ${vm_instances}
221     Wait Until Keyword Succeeds    60s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_1_IP}    ${vm_instances}
222     Wait Until Keyword Succeeds    60s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_2_IP}    ${vm_instances}
223     Log    Check datapath from network1 to network2
224     ${dst_ip_list} =    Create List    @{VM_IP_NET10}[1]    @{VM_IP_NET20}
225     Log    ${dst_ip_list}
226     Test Operations From Vm Instance    ${NETWORKS[0]}    @{VM_IP_NET10}[0]    ${dst_ip_list}
227     Log    Check datapath from network2 to network1
228     ${dst_ip_list} =    Create List    @{VM_IP_NET20}[1]    @{VM_IP_NET10}
229     Log    ${dst_ip_list}
230     Test Operations From Vm Instance    ${NETWORKS[1]}    @{VM_IP_NET20}[0]    ${dst_ip_list}
231
232 Dissociate L3VPN From Routers
233     [Documentation]    Dissociating router from L3VPN
234     ${devstack_conn_id}=    Get ControlNode Connection
235     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
236     Dissociate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID[0]}
237     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
238     Should Not Contain    ${resp}    ${router_id}
239
240 Delete Router And Router Interfaces With L3VPN
241     [Documentation]    Delete Router and Interface to the subnets with L3VPN assciate
242     # Asscoiate router with L3VPN
243     ${devstack_conn_id} =    Get ControlNode Connection
244     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
245     Associate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID[0]}
246     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
247     Should Contain    ${resp}    ${router_id}
248     #Delete Interface
249     : FOR    ${INTERFACE}    IN    @{SUBNETS}
250     \    Remove Interface    ${ROUTERS[0]}    ${INTERFACE}
251     ${interface_output} =    Show Router Interface    ${ROUTERS[0]}
252     : FOR    ${INTERFACE}    IN    @{SUBNETS}
253     \    ${subnet_id} =    Get Subnet Id    ${INTERFACE}    ${devstack_conn_id}
254     \    Should Not Contain    ${interface_output}    ${subnet_id}
255     # Delete Router and Interface to the subnets.
256     Delete Router    ${ROUTERS[0]}
257     ${router_output} =    List Router
258     Log    ${router_output}
259     Should Not Contain    ${router_output}    ${ROUTERS[0]}
260     ${router_list} =    Create List    ${ROUTERS[0]}
261     Wait Until Keyword Succeeds    3s    1s    Check For Elements Not At URI    ${CONFIG_API}/neutron:neutron/routers/    ${router_list}
262     # Verify Router Entry removed from L3VPN
263     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
264     Should Not Contain    ${resp}    ${router_id}
265
266 Delete Router With NonExistentRouter Name
267     [Documentation]    Delete router with nonExistentRouter name
268     ${devstack_conn_id}=    Get ControlNode Connection
269     Switch Connection    ${devstack_conn_id}
270     ${output} =    Write Commands Until Prompt    neutron router-delete nonExistentRouter    30s
271     Close Connection
272     Should Match Regexp    ${output}    Unable to find router with name or id 'nonExistentRouter'|Unable to find router\\(s\\) with id\\(s\\) 'nonExistentRouter'
273
274 Associate L3VPN To Networks
275     [Documentation]    Associates L3VPN to networks and verify
276     ${devstack_conn_id} =    Get ControlNode Connection
277     ${network1_id} =    Get Net Id    ${NETWORKS[0]}    ${devstack_conn_id}
278     ${network2_id} =    Get Net Id    ${NETWORKS[1]}    ${devstack_conn_id}
279     Associate L3VPN To Network    networkid=${network1_id}    vpnid=${VPN_INSTANCE_ID[0]}
280     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
281     Should Contain    ${resp}    ${network1_id}
282     Associate L3VPN To Network    networkid=${network2_id}    vpnid=${VPN_INSTANCE_ID[0]}
283     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
284     Should Contain    ${resp}    ${network2_id}
285
286 Dissociate L3VPN From Networks
287     [Documentation]    Dissociate L3VPN from networks
288     ${devstack_conn_id} =    Get ControlNode Connection
289     ${network1_id} =    Get Net Id    ${NETWORKS[0]}    ${devstack_conn_id}
290     ${network2_id} =    Get Net Id    ${NETWORKS[1]}    ${devstack_conn_id}
291     Dissociate L3VPN From Networks    networkid=${network1_id}    vpnid=${VPN_INSTANCE_ID[0]}
292     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
293     Should Not Contain    ${resp}    ${network1_id}
294     Dissociate L3VPN From Networks    networkid=${network2_id}    vpnid=${VPN_INSTANCE_ID[0]}
295     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
296     Should Not Contain    ${resp}    ${network2_id}
297
298 Delete L3VPN
299     [Documentation]    Delete L3VPN
300     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
301
302 Create Multiple L3VPN
303     [Documentation]    Creates three L3VPNs and then verify the same
304     ${devstack_conn_id} =    Get ControlNode Connection
305     Switch Connection    ${devstack_conn_id}
306     ${net_id} =    Get Net Id    @{NETWORKS}[0]    ${devstack_conn_id}
307     ${tenant_id} =    Get Tenant ID From Network    ${net_id}
308     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}
309     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}
310     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}
311     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
312     Should Contain    ${resp}    ${VPN_INSTANCE_ID[0]}
313     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[1]}
314     Should Contain    ${resp}    ${VPN_INSTANCE_ID[1]}
315     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[2]}
316     Should Contain    ${resp}    ${VPN_INSTANCE_ID[2]}
317
318 Delete Multiple L3VPN
319     [Documentation]    Delete three L3VPNs created using Multiple L3VPN Test
320     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
321     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[1]}
322     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[2]}
323
324 Check Datapath Traffic Across Networks With L3VPN
325     [Documentation]    Datapath Test Across the networks with VPN.
326     [Tags]    exclude
327     Log    This test will be added in the next patch
328
329 Delete Vm Instances
330     [Documentation]    Delete Vm instances in the given Instance List
331     ${VM_INSTANCES} =    Create List    @{VM_INSTANCES_NET10}    @{VM_INSTANCES_NET20}
332     : FOR    ${VmInstance}    IN    @{VM_INSTANCES}
333     \    Delete Vm Instance    ${VmInstance}
334
335 Delete Neutron Ports
336     [Documentation]    Delete Neutron Ports in the given Port List.
337     : FOR    ${Port}    IN    @{PORT_LIST}
338     \    Delete Port    ${Port}
339
340 Delete Sub Networks
341     [Documentation]    Delete Sub Nets in the given Subnet List.
342     : FOR    ${Subnet}    IN    @{SUBNETS}
343     \    Delete SubNet    ${Subnet}
344
345 Delete Networks
346     [Documentation]    Delete Networks in the given Net List
347     : FOR    ${Network}    IN    @{NETWORKS}
348     \    Delete Network    ${Network}
349
350 Create ITM Tunnel
351     [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.
352     ${node_1_dpid} =    Get DPID    ${OS_COMPUTE_1_IP}
353     ${node_2_dpid} =    Get DPID    ${OS_COMPUTE_2_IP}
354     ${node_1_adapter} =    Get Ethernet Adapter    ${OS_COMPUTE_1_IP}
355     ${node_2_adapter} =    Get Ethernet Adapter    ${OS_COMPUTE_2_IP}
356     ${subnet} =    Get Subnet    ${OS_COMPUTE_1_IP}
357     ${gateway} =    Get Default Gateway    ${OS_COMPUTE_1_IP}
358     ITM Create Tunnel    tunneltype=vxlan    vlanid=0    prefix=${subnet}    gateway=${gateway}    ipaddress1=${OS_COMPUTE_1_IP}    dpnid1=${node_1_dpid}
359     ...    portname1=${node_1_adapter}    ipaddress2=${OS_COMPUTE_2_IP}    dpnid2=${node_2_dpid}    portname2=${node_2_adapter}
360     Get DumpFlows And Ovsconfig    ${OS_COMPUTE_1_IP}
361     Get DumpFlows And Ovsconfig    ${OS_COMPUTE_2_IP}
362     ${output} =    ITM Get Tunnels
363     Log    ${output}
364
365 Delete ITM Tunnel
366     [Documentation]    Delete tunnels with specific transport-zone.
367     ITM Delete Tunnel    TZA
368
369 *** Keywords ***
370 Basic Vpnservice Suite Setup
371     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
372
373 Basic Vpnservice Suite Teardown
374     Delete All Sessions
375
376 Wait For Routes To Propogate
377     ${devstack_conn_id} =    Get ControlNode Connection
378     Switch Connection    ${devstack_conn_id}
379     ${net_id} =    Get Net Id    @{NETWORKS}[0]    ${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}[0]
382     ${net_id} =    Get Net Id    @{NETWORKS}[1]    ${devstack_conn_id}
383     ${output} =    Write Commands Until Expected Prompt    sudo ip netns exec qdhcp-${net_id} ip route    ]>
384     Should Contain    ${output}    @{SUBNET_CIDR}[1]