Use openstack cli instead of nova console-log cli
[integration/test.git] / csit / suites / netvirt / Netvirt_Vpnservice / 01_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       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}       NET10    NET20
23 @{SUBNETS}        SUBNET1    SUBNET2
24 @{SUBNETS_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 @{EXTRA_NW_IP}    40.1.1.2    50.1.1.2
30 @{EXTRA_NW_SUBNET}    40.1.1.0/24    50.1.1.0/24
31 ${SECURITY_GROUP}    sg-vpnservice
32 ${UPDATE_NETWORK}    UpdateNetwork
33 ${UPDATE_SUBNET}    UpdateSubnet
34 ${UPDATE_PORT}    UpdatePort
35
36 *** Test Cases ***
37 Create Neutron Networks
38     [Documentation]    Create two networks
39     Create Network    ${NETWORKS[0]}
40     Create Network    ${NETWORKS[1]}
41     ${NET_LIST}    List Networks
42     Log    ${NET_LIST}
43     Should Contain    ${NET_LIST}    ${NETWORKS[0]}
44     Should Contain    ${NET_LIST}    ${NETWORKS[1]}
45     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${NETWORK_URL}    ${NETWORKS}
46     Update Network    ${NETWORKS[0]}    additional_args=--description ${UPDATE_NETWORK}
47     ${output} =    Show Network    ${NETWORKS[0]}
48     Should Contain    ${output}    ${UPDATE_NETWORK}
49
50 Create Neutron Subnets
51     [Documentation]    Create two subnets for previously created networks
52     Create SubNet    ${NETWORKS[0]}    ${SUBNETS[0]}    ${SUBNETS_CIDR[0]}
53     Create SubNet    ${NETWORKS[1]}    ${SUBNETS[1]}    ${SUBNETS_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    ${SUBNETWORK_URL}    ${SUBNETS}
59     Update SubNet    ${SUBNETS[0]}    additional_args=--description ${UPDATE_SUBNET}
60     ${output} =    Show SubNet    ${SUBNETS[0]}
61     Should Contain    ${output}    ${UPDATE_SUBNET}
62
63 Add Ssh Allow Rule
64     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
65     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
66
67 Create Neutron Ports
68     [Documentation]    Create four ports under previously created subnets
69     ${allowed_address_pairs_args}=    Set Variable If    '${OPENSTACK_BRANCH}'=='stable/newton'    --allowed-address ip_address=${EXTRA_NW_SUBNET[0]} --allowed-address ip_address=${EXTRA_NW_SUBNET[1]}    --allowed-address ip-address=${EXTRA_NW_SUBNET[0]} --allowed-address ip-address=${EXTRA_NW_SUBNET[1]}
70     Create Port    ${NETWORKS[0]}    ${PORT_LIST[0]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
71     Create Port    ${NETWORKS[0]}    ${PORT_LIST[1]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
72     Create Port    ${NETWORKS[1]}    ${PORT_LIST[2]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
73     Create Port    ${NETWORKS[1]}    ${PORT_LIST[3]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
74     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${CONFIG_API}/neutron:neutron/ports/    ${PORT_LIST}
75     ${PORTS_MACADDR} =    Get Ports MacAddr    ${PORT_LIST}
76     Set Suite Variable    ${PORTS_MACADDR}
77     Update Port    ${PORT_LIST[0]}    additional_args=--description ${UPDATE_PORT}
78     ${output} =    Show Port    ${PORT_LIST[0]}
79
80 Create Nova VMs
81     [Documentation]    Create Vm instances on compute node with port
82     Create Vm Instance With Port On Compute Node    ${PORT_LIST[0]}    ${VM_INSTANCES_NET10[0]}    ${OS_COMPUTE_1_IP}    sg=${SECURITY_GROUP}
83     Create Vm Instance With Port On Compute Node    ${PORT_LIST[1]}    ${VM_INSTANCES_NET10[1]}    ${OS_COMPUTE_2_IP}    sg=${SECURITY_GROUP}
84     Create Vm Instance With Port On Compute Node    ${PORT_LIST[2]}    ${VM_INSTANCES_NET20[0]}    ${OS_COMPUTE_1_IP}    sg=${SECURITY_GROUP}
85     Create Vm Instance With Port On Compute Node    ${PORT_LIST[3]}    ${VM_INSTANCES_NET20[1]}    ${OS_COMPUTE_2_IP}    sg=${SECURITY_GROUP}
86     ${VM_INSTANCES} =    Create List    @{VM_INSTANCES_NET10}    @{VM_INSTANCES_NET20}
87     : FOR    ${VM}    IN    @{VM_INSTANCES}
88     \    Poll VM Is ACTIVE    ${VM}
89     Log    Check for routes
90     Wait Until Keyword Succeeds    30s    10s    Wait For Routes To Propogate    ${NETWORKS}    ${SUBNETS_CIDR}
91     ${status}    ${message}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    60s    5s    Collect VM IP Addresses
92     ...    true    @{VM_INSTANCES_NET10}
93     ${status}    ${message}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    60s    5s    Collect VM IP Addresses
94     ...    true    @{VM_INSTANCES_NET20}
95     ${VM_IP_NET10}    ${DHCP_IP1}    Collect VM IP Addresses    false    @{VM_INSTANCES_NET10}
96     ${VM_IP_NET20}    ${DHCP_IP2}    Collect VM IP Addresses    false    @{VM_INSTANCES_NET20}
97     ${VM_INSTANCES}=    Collections.Combine Lists    ${VM_INSTANCES_NET10}    ${VM_INSTANCES_NET20}
98     ${VM_IPS}=    Collections.Combine Lists    ${VM_IP_NET10}    ${VM_IP_NET20}
99     Log Many    Obtained IPs    ${VM_IPS}
100     ${LOOP_COUNT}    Get Length    ${VM_INSTANCES_NET10}
101     : FOR    ${index}    IN RANGE    0    ${LOOP_COUNT}
102     \    ${status}    ${message}    Run Keyword And Ignore Error    Should Not Contain    @{VM_IPS}[${index}]    None
103     \    Run Keyword If    '${status}' == 'FAIL'    Write Commands Until Prompt    openstack console log show @{VM_INSTANCES}[${index}]    30s
104     Log    ${VM_IP_NET10}
105     Set Suite Variable    ${VM_IP_NET10}
106     Log    ${VM_IP_NET20}
107     Set Suite Variable    ${VM_IP_NET20}
108     Should Not Contain    ${VM_IP_NET10}    None
109     Should Not Contain    ${VM_IP_NET20}    None
110     [Teardown]    Run Keywords    Show Debugs    @{VM_INSTANCES_NET10}    @{VM_INSTANCES_NET20}
111     ...    AND    Get Test Teardown Debugs
112
113 Check ELAN Datapath Traffic Within The Networks
114     [Documentation]    Checks datapath within the same network with different vlans.
115     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ping -c 3 ${VM_IP_NET10[1]}
116     Should Contain    ${output}    64 bytes
117     ${output} =    Execute Command on VM Instance    @{NETWORKS}[1]    ${VM_IP_NET20[0]}    ping -c 3 ${VM_IP_NET20[1]}
118     Should Contain    ${output}    64 bytes
119
120 Create Routers
121     [Documentation]    Create Router
122     Create Router    ${ROUTERS[0]}
123     ${router_output} =    List Router
124     Log    ${router_output}
125     Should Contain    ${router_output}    ${ROUTERS[0]}
126     ${router_list} =    Create List    ${ROUTERS[0]}
127     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${ROUTER_URL}    ${router_list}
128
129 Add Interfaces To Router
130     [Documentation]    Add Interfaces
131     : FOR    ${INTERFACE}    IN    @{SUBNETS}
132     \    Add Router Interface    ${ROUTERS[0]}    ${INTERFACE}
133     ${interface_output} =    Show Router Interface    ${ROUTERS[0]}
134     ${GWMAC_ADDRS}    ${GWIP_ADDRS} =    Get Gateway MAC And IP Address    ${ROUTERS[0]}
135     Log    ${GWMAC_ADDRS}
136     Set Suite Variable    ${GWMAC_ADDRS}
137     Log    ${GWIP_ADDRS}
138     Set Suite Variable    ${GWIP_ADDRS}
139
140 Check L3_Datapath Traffic Across Networks With Router
141     [Documentation]    Datapath test across the networks using router for L3.
142     Log    Verification of FIB Entries and Flow
143     ${cn1_conn_id} =    Start Packet Capture on Node    ${OS_COMPUTE_1_IP}    file_Name=tcpDumpCN1
144     ${cn2_conn_id} =    Start Packet Capture on Node    ${OS_COMPUTE_2_IP}    file_Name=tcpDumpCN2
145     ${os_conn_id} =    Start Packet Capture on Node    ${OS_CONTROL_NODE_IP}    file_Name=tcpDumpOS
146     ${vm_instances} =    Create List    @{VM_IP_NET10}    @{VM_IP_NET20}
147     Wait Until Keyword Succeeds    30s    5s    Check For Elements At URI    ${FIB_ENTRY_URL}    ${vm_instances}
148     Wait Until Keyword Succeeds    30s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_1_IP}    ${vm_instances}
149     Wait Until Keyword Succeeds    30s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_2_IP}    ${vm_instances}
150     #Verify GWMAC Table
151     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Entry On ODL    ${GWMAC_ADDRS}
152     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Flow Entry On Flow Table    ${OS_COMPUTE_1_IP}
153     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Flow Entry On Flow Table    ${OS_COMPUTE_2_IP}
154     Log    L3 Datapath test across the networks using router
155     ${dst_ip_list} =    Create List    ${VM_IP_NET10[1]}    @{VM_IP_NET20}
156     Log    ${dst_ip_list}
157     Test Operations From Vm Instance    ${NETWORKS[0]}    ${VM_IP_NET10[0]}    ${dst_ip_list}
158     ${dst_ip_list} =    Create List    ${VM_IP_NET20[1]}    @{VM_IP_NET10}
159     Log    ${dst_ip_list}
160     Test Operations From Vm Instance    ${NETWORKS[1]}    ${VM_IP_NET20[0]}    ${dst_ip_list}
161     [Teardown]    Test Teardown With Tcpdump Stop    ${cn1_conn_id}    ${cn2_conn_id}    ${os_conn_id}
162
163 Add Multiple Extra Routes And Check Datapath Before L3VPN Creation
164     [Documentation]    Add multiple extra routes and check data path before L3VPN creation
165     Log    "Adding extra one route to VM"
166     ${CONFIG_EXTRA_ROUTE_IP1} =    Catenate    sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
167     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP1}
168     ${CONFIG_EXTRA_ROUTE_IP2} =    Catenate    sudo ifconfig eth0:2 @{EXTRA_NW_IP}[1] netmask 255.255.255.0 up
169     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP2}
170     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ifconfig
171     ${EXT_RT1} =    Set Variable    destination=40.1.1.0/24,gateway=${VM_IP_NET10[0]}
172     ${EXT_RT2} =    Set Variable    destination=50.1.1.0/24,gateway=${VM_IP_NET10[0]}
173     ${cmd} =    Catenate    ${RT_OPTIONS}    ${EXT_RT1}    ${RT_OPTIONS}    ${EXT_RT2}
174     Update Router    @{ROUTERS}[0]    ${cmd}
175     Show Router    @{ROUTERS}[0]    -D
176     Log    "Verify FIB table"
177     ${vm_instances} =    Create List    @{EXTRA_NW_SUBNET}
178     Wait Until Keyword Succeeds    30s    5s    Check For Elements At URI    ${FIB_ENTRY_URL}    ${vm_instances}
179     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[1]}    ping -c 3 @{EXTRA_NW_IP}[1]
180     Should Contain    ${output}    64 bytes
181     ${output} =    Execute Command on VM Instance    @{NETWORKS}[1]    ${VM_IP_NET20[1]}    ping -c 3 @{EXTRA_NW_IP}[1]
182     Should Contain    ${output}    64 bytes
183     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[1]}    ping -c 3 @{EXTRA_NW_IP}[0]
184     Should Contain    ${output}    64 bytes
185
186 Delete Extra Route
187     [Documentation]    Delete the extra routes
188     Update Router    @{ROUTERS}[0]    ${RT_CLEAR}
189     Show Router    @{ROUTERS}[0]    -D
190
191 Delete And Recreate Extra Route
192     [Documentation]    Recreate multiple extra route and check data path before L3VPN creation
193     Log    "Adding extra route to VM"
194     ${CONFIG_EXTRA_ROUTE_IP1} =    Catenate    sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
195     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP1}
196     ${EXT_RT1} =    Set Variable    destination=40.1.1.0/24,gateway=${VM_IP_NET10[0]}
197     ${cmd} =    Catenate    ${RT_OPTIONS}    ${EXT_RT1}
198     Update Router    @{ROUTERS}[0]    ${cmd}
199     Show Router    @{ROUTERS}[0]    -D
200     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[1]}    ping -c 3 @{EXTRA_NW_IP}[0]
201     Should Contain    ${output}    64 bytes
202     # clear off extra-routes before the next set of tests
203     [Teardown]    Run Keywords    Update Router    @{ROUTERS}[0]    ${RT_CLEAR}
204     ...    AND    Show Router    @{ROUTERS}[0]    -D
205     ...    AND    Get Test Teardown Debugs
206
207 Create L3VPN
208     [Documentation]    Creates L3VPN and verify the same
209     ${net_id} =    Get Net Id    @{NETWORKS}[0]    ${devstack_conn_id}
210     ${tenant_id} =    Get Tenant ID From Network    ${net_id}
211     Log    @{RDS}[0]
212     VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID[0]}    name=${VPN_NAME[0]}    rd=@{RDS}[0]    exportrt=@{RDS}[0]    importrt=@{RDS}[0]    tenantid=${tenant_id}
213     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
214     Should Contain    ${resp}    ${VPN_INSTANCE_ID[0]}
215
216 Associate L3VPN To Routers
217     [Documentation]    Associating router to L3VPN
218     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
219     Associate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID[0]}
220     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
221     Should Contain    ${resp}    ${router_id}
222
223 Verify L3VPN Datapath With Router Association
224     [Documentation]    Datapath test across the networks using L3VPN with router association.
225     Log    Verify VPN interfaces, FIB entries and Flow table
226     ${vm_instances} =    Create List    @{VM_IP_NET10}    @{VM_IP_NET20}
227     Wait Until Keyword Succeeds    30s    5s    Check For Elements At URI    ${VPN_IFACES_URL}    ${vm_instances}
228     ${RD} =    Strip String    ${RDS[0]}    characters="[]
229     Log    ${RD}
230     Wait Until Keyword Succeeds    60s    5s    Check For Elements At URI    ${CONFIG_API}/odl-fib:fibEntries/vrfTables/${RD}/    ${vm_instances}
231     Wait Until Keyword Succeeds    60s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_1_IP}    ${vm_instances}
232     Wait Until Keyword Succeeds    60s    5s    Verify Flows Are Present For L3VPN    ${OS_COMPUTE_2_IP}    ${vm_instances}
233     #Verify GWMAC Table
234     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Entry On ODL    ${GWMAC_ADDRS}
235     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Flow Entry On Flow Table    ${OS_COMPUTE_1_IP}
236     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Flow Entry On Flow Table    ${OS_COMPUTE_2_IP}
237     Log    Check datapath from network1 to network2
238     ${dst_ip_list} =    Create List    @{VM_IP_NET10}[1]    @{VM_IP_NET20}
239     Log    ${dst_ip_list}
240     Test Operations From Vm Instance    ${NETWORKS[0]}    @{VM_IP_NET10}[0]    ${dst_ip_list}
241     Log    Check datapath from network2 to network1
242     ${dst_ip_list} =    Create List    @{VM_IP_NET20}[1]    @{VM_IP_NET10}
243     Log    ${dst_ip_list}
244     Test Operations From Vm Instance    ${NETWORKS[1]}    @{VM_IP_NET20}[0]    ${dst_ip_list}
245
246 Dissociate L3VPN From Routers
247     [Documentation]    Dissociating router from L3VPN
248     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
249     Dissociate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID[0]}
250     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
251     Should Not Contain    ${resp}    ${router_id}
252
253 Delete Router And Router Interfaces With L3VPN
254     [Documentation]    Delete Router and Interface to the subnets with L3VPN assciate
255     # Asscoiate router with L3VPN
256     ${router_id}=    Get Router Id    ${ROUTERS[0]}    ${devstack_conn_id}
257     Associate VPN to Router    routerid=${router_id}    vpnid=${VPN_INSTANCE_ID[0]}
258     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
259     Should Contain    ${resp}    ${router_id}
260     #Delete Interface
261     : FOR    ${INTERFACE}    IN    @{SUBNETS}
262     \    Remove Interface    ${ROUTERS[0]}    ${INTERFACE}
263     ${interface_output} =    Show Router Interface    ${ROUTERS[0]}
264     : FOR    ${INTERFACE}    IN    @{SUBNETS}
265     \    ${subnet_id} =    Get Subnet Id    ${INTERFACE}    ${devstack_conn_id}
266     \    Should Not Contain    ${interface_output}    ${subnet_id}
267     # Delete Router and Interface to the subnets.
268     Delete Router    ${ROUTERS[0]}
269     ${router_output} =    List Router
270     Log    ${router_output}
271     Should Not Contain    ${router_output}    ${ROUTERS[0]}
272     ${router_list} =    Create List    ${ROUTERS[0]}
273     Wait Until Keyword Succeeds    3s    1s    Check For Elements Not At URI    ${ROUTER_URL}    ${router_list}
274     # Verify Router Entry removed from L3VPN
275     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
276     Should Not Contain    ${resp}    ${router_id}
277     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Flow Entry Removed From Flow Table    ${OS_COMPUTE_1_IP}
278     Wait Until Keyword Succeeds    30s    5s    Verify GWMAC Flow Entry Removed From Flow Table    ${OS_COMPUTE_2_IP}
279
280 Delete Router With NonExistentRouter Name
281     [Documentation]    Delete router with nonExistentRouter name
282     ${rc}    ${output}=    Run And Return Rc And Output    neutron router-delete nonExistentRouter
283     Log    ${output}
284     Log    ${rc}
285     Should Match Regexp    ${output}    Unable to find router with name or id 'nonExistentRouter'|Unable to find router\\(s\\) with id\\(s\\) 'nonExistentRouter'
286
287 Associate L3VPN To Networks
288     [Documentation]    Associates L3VPN to networks and verify
289     ${network1_id} =    Get Net Id    ${NETWORKS[0]}    ${devstack_conn_id}
290     ${network2_id} =    Get Net Id    ${NETWORKS[1]}    ${devstack_conn_id}
291     Associate L3VPN To Network    networkid=${network1_id}    vpnid=${VPN_INSTANCE_ID[0]}
292     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
293     Should Contain    ${resp}    ${network1_id}
294     Associate L3VPN To Network    networkid=${network2_id}    vpnid=${VPN_INSTANCE_ID[0]}
295     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
296     Should Contain    ${resp}    ${network2_id}
297
298 Dissociate L3VPN From Networks
299     [Documentation]    Dissociate L3VPN from networks
300     ${network1_id} =    Get Net Id    ${NETWORKS[0]}    ${devstack_conn_id}
301     ${network2_id} =    Get Net Id    ${NETWORKS[1]}    ${devstack_conn_id}
302     Dissociate L3VPN From Networks    networkid=${network1_id}    vpnid=${VPN_INSTANCE_ID[0]}
303     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
304     Should Not Contain    ${resp}    ${network1_id}
305     Dissociate L3VPN From Networks    networkid=${network2_id}    vpnid=${VPN_INSTANCE_ID[0]}
306     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
307     Should Not Contain    ${resp}    ${network2_id}
308
309 Delete L3VPN
310     [Documentation]    Delete L3VPN
311     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
312
313 Create Multiple L3VPN
314     [Documentation]    Creates three L3VPNs and then verify the same
315     ${net_id} =    Get Net Id    @{NETWORKS}[0]    ${devstack_conn_id}
316     ${tenant_id} =    Get Tenant ID From Network    ${net_id}
317     VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID[0]}    name=${VPN_NAME[0]}    rd=${RDS[0]}    exportrt=${RDS[0]}    importrt=${RDS[0]}    tenantid=${tenant_id}
318     VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID[1]}    name=${VPN_NAME[1]}    rd=${RDS[1]}    exportrt=${RDS[1]}    importrt=${RDS[1]}    tenantid=${tenant_id}
319     VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID[2]}    name=${VPN_NAME[2]}    rd=${RDS[2]}    exportrt=${RDS[2]}    importrt=${RDS[2]}    tenantid=${tenant_id}
320     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
321     Should Contain    ${resp}    ${VPN_INSTANCE_ID[0]}
322     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[1]}
323     Should Contain    ${resp}    ${VPN_INSTANCE_ID[1]}
324     ${resp}=    VPN Get L3VPN    vpnid=${VPN_INSTANCE_ID[2]}
325     Should Contain    ${resp}    ${VPN_INSTANCE_ID[2]}
326
327 Check Datapath Traffic Across Networks With L3VPN
328     [Documentation]    Datapath Test Across the networks with VPN.
329     [Tags]    exclude
330     Log    This test will be added in the next patch
331
332 Delete Multiple L3VPN
333     [Documentation]    Delete three L3VPNs created using Multiple L3VPN Test
334     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
335     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[1]}
336     VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[2]}
337
338 *** Keywords ***
339 Test Teardown With Tcpdump Stop
340     [Arguments]    ${cn1_conn_id}    ${cn2_conn_id}    ${os_conn_id}
341     Stop Packet Capture on Node    ${cn1_conn_id}
342     Stop Packet Capture on Node    ${cn2_conn_id}
343     Stop Packet Capture on Node    ${os_conn_id}
344     Get Test Teardown Debugs
345
346 Get Gateway MAC And IP Address
347     [Arguments]    ${router_Name}
348     [Documentation]    Get Gateway mac and IP Address
349     ${output} =    Write Commands Until Prompt    neutron router-port-list ${router_Name}    30s
350     @{MacAddr-list} =    Get Regexp Matches    ${output}    ${MAC_REGEX}
351     @{IpAddr-list} =    Get Regexp Matches    ${output}    ${IP_REGEX}
352     [Return]    ${MacAddr-list}    ${IpAddr-list}
353
354 Verify GWMAC Flow Entry On Flow Table
355     [Arguments]    ${cnIp}
356     [Documentation]    Verify the GWMAC Table, ARP Response table and Dispatcher table.
357     ${flow_output}=    Run Command On Remote System    ${cnIp}    sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
358     Log    ${flow_output}
359     ${group_output}=    Run Command On Remote System    ${cnIp}    sudo ovs-ofctl -O OpenFlow13 dump-groups br-int
360     Log    ${group_output}
361     #Verify DISPATCHER_TABLE - 17
362     Should Contain    ${flow_output}    table=${DISPATCHER_TABLE}
363     ${dispatcher_table} =    Get Lines Containing String    ${flow_output}    table=${DISPATCHER_TABLE}
364     Log    ${dispatcher_table}
365     Should Contain    ${dispatcher_table}    goto_table:${GWMAC_TABLE}
366     Should Not Contain    ${dispatcher_table}    goto_table:${ARP_RESPONSE_TABLE}
367     #Verify GWMAC_TABLE - 19
368     Should Contain    ${flow_output}    table=${GWMAC_TABLE}
369     ${gwmac_table} =    Get Lines Containing String    ${flow_output}    table=${GWMAC_TABLE}
370     Log    ${gwmac_table}
371     #Verify GWMAC address present in table 19
372     : FOR    ${macAdd}    IN    @{GWMAC_ADDRS}
373     \    Should Contain    ${gwmac_table}    dl_dst=${macAdd} actions=goto_table:${L3_TABLE}
374     #verify Miss entry
375     Should Contain    ${gwmac_table}    actions=resubmit(,17)
376     #Verify ARP_CHECK_TABLE - 43
377     #arp request and response
378     ${arpchk_table} =    Get Lines Containing String    ${flow_output}    table=${ARP_CHECK_TABLE}
379     Should Match Regexp    ${arpchk_table}    ${ARP_RESPONSE_REGEX}
380     ${match} =    Should Match Regexp    ${arpchk_table}    ${ARP_REQUEST_REGEX}
381     ${groupID} =    Split String    ${match}    separator=:
382     Log    groupID
383     Verify ARP REQUEST in groupTable    ${group_output}    ${groupID[1]}
384     #Verify ARP_RESPONSE_TABLE - 81
385     Should Contain    ${flow_output}    table=${ARP_RESPONSE_TABLE}
386     ${arpResponder_table} =    Get Lines Containing String    ${flow_output}    table=${ARP_RESPONSE_TABLE}
387     Log    ${arpResponder_table}
388     Should Contain    ${arpResponder_table}    priority=0 actions=drop
389     : FOR    ${macAdd}    ${ipAdd}    IN ZIP    ${GWMAC_ADDRS}    ${GWIP_ADDRS}
390     \    ${ARP_RESPONSE_IP_MAC_REGEX} =    Set Variable    arp_tpa=${ipAdd},arp_op=1 actions=.*,set_field:${macAdd}->eth_src
391     \    Should Match Regexp    ${arpResponder_table}    ${ARP_RESPONSE_IP_MAC_REGEX}