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