Add network datapath check to vpnbasic suite.
[integration/test.git] / csit / suites / netvirt / vpnservice / vpn_basic.robot
index 742978469aeed35553d2ce8c82988c7e466f4050..8c7f9e84f99e6790f44123ed4d42212c4243e27f 100644 (file)
@@ -35,6 +35,9 @@ ${UPDATE_PORT}    UpdatePort
 @{VPN_INSTANCE_IDS}    4ae8cd92-48ca-49b5-94e1-b2921a261441    4ae8cd92-48ca-49b5-94e1-b2921a261442    4ae8cd92-48ca-49b5-94e1-b2921a261443
 @{VPN_NAMES}      vpn_1    vpn_2    vpn_3
 @{RDS}            ["2200:2"]    ["2300:2"]    ["2400:2"]
+${PORT_NEW}       vpn_net_1_port_new
+${VM_NAME_NEW}    vpn_net_1_vm_new
+${INVALID_VPN_INSTANCE_ID}    AAAAAAAAAA-4848-4949-9494-666666666666
 
 *** Test Cases ***
 Create Neutron Networks
@@ -64,7 +67,7 @@ Create Neutron Ports
     Create Port    @{NETWORKS}[0]    @{PORTS}[1]    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
     Create Port    @{NETWORKS}[1]    @{PORTS}[2]    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
     Create Port    @{NETWORKS}[1]    @{PORTS}[3]    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
-    Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${CONFIG_API}/neutron:neutron/ports/    ${PORTS}
+    Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${PORT_URL}    ${PORTS}
     ${PORTS_MACADDR} =    Get Ports MacAddr    ${PORTS}
     Set Suite Variable    ${PORTS_MACADDR}
     Update Port    @{PORTS}[0]    additional_args=--description ${UPDATE_PORT}
@@ -167,7 +170,7 @@ Create L3VPN
     ${tenant_id} =    OpenStackOperations.Get Tenant ID From Network    ${net_id}
     BuiltIn.Log    @{RDS}[0]
     VpnOperations.VPN Create L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]    name=@{VPN_NAMES}[0]    rd=@{RDS}[0]    exportrt=@{RDS}[0]    importrt=@{RDS}[0]    tenantid=${tenant_id}
-    ${resp}=    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]
+    ${resp} =    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]
     BuiltIn.Should Contain    ${resp}    @{VPN_INSTANCE_IDS}[0]
 
 Associate L3VPN To Routers
@@ -194,8 +197,8 @@ Verify L3VPN Datapath With Router Association
     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[0]    ${dst_ip_list}
 
 Delete Router Failure When Associated With L3VPN
-    ${router_id}=    OpenStackOperations.Get Router Id    ${ROUTER}
-    ${rc}    ${output}=    Run And Return Rc And Output    openstack router delete ${ROUTER}
+    ${router_id} =    OpenStackOperations.Get Router Id    ${ROUTER}
+    ${rc}    ${output} =    Run And Return Rc And Output    openstack router delete ${ROUTER}
     BuiltIn.Should Match Regexp    ${output}    Failed to delete router.*${ROUTER}
     BuiltIn.Should Be True    '${rc}' == '1'
     ${router_output} =    OpenStackOperations.List Routers
@@ -208,7 +211,7 @@ Delete Router Failure When Associated With L3VPN
     BuiltIn.Wait Until Keyword Succeeds    30s    15s    VpnOperations.Verify GWMAC Flow Entry On Flow Table    ${OS_COMPUTE_2_IP}
 
 Remove Router Interfaces
-    ${router_id}=    OpenStackOperations.Get Router Id    ${ROUTER}
+    ${router_id} =    OpenStackOperations.Get Router Id    ${ROUTER}
     : FOR    ${INTERFACE}    IN    @{SUBNETS}
     \    OpenStackOperations.Remove Interface    ${ROUTER}    ${INTERFACE}
     ${interface_output} =    OpenStackOperations.Show Router Interface    ${ROUTER}
@@ -217,9 +220,9 @@ Remove Router Interfaces
     \    BuiltIn.Should Not Contain    ${interface_output}    ${subnet_id}
 
 Disassociate L3VPN From Router
-    ${router_id}=    OpenStackOperations.Get Router Id    ${ROUTER}
+    ${router_id} =    OpenStackOperations.Get Router Id    ${ROUTER}
     VpnOperations.Dissociate VPN to Router    routerid=${router_id}    vpnid=@{VPN_INSTANCE_IDS}[0]
-    ${resp}=    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]
+    ${resp} =    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]
     BuiltIn.Should Not Contain    ${resp}    ${router_id}
 
 Delete Router
@@ -235,10 +238,10 @@ Delete Router
 
 Delete Router With NonExistentRouter Name
     [Documentation]    Delete router with nonExistentRouter name
-    ${rc}    ${output}=    Run And Return Rc And Output    neutron router-delete nonExistentRouter
+    ${rc}    ${output} =    Run And Return Rc And Output    neutron router-delete nonExistentRouter
     BuiltIn.Should Match Regexp    ${output}    Unable Not At URIto find router with name or id 'nonExistentRouter'|Unable to find router\\(s\\) with id\\(s\\) 'nonExistentRouter'
 
-Associate L3VPN To Networks
+Associate Networks To L3VPN
     [Documentation]    Associates L3VPN to networks and verify
     ${network1_id} =    OpenStackOperations.Get Net Id    @{NETWORKS}[0]
     ${network2_id} =    OpenStackOperations.Get Net Id    @{NETWORKS}[1]
@@ -249,6 +252,44 @@ Associate L3VPN To Networks
     ${resp} =    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]
     BuiltIn.Should Contain    ${resp}    ${network2_id}
 
+Check Datapath Traffic Across Networks With L3VPN
+    [Documentation]    Datapath Test Across the networks with VPN.
+    ${output} =    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]    ping -c 20 @{NET_1_VM_IPS}[1]
+    BuiltIn.Should Contain    ${output}    64 bytes
+    ${output} =    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]    ping -c 20 @{NET_2_VM_IPS}[1]
+    BuiltIn.Should Contain    ${output}    64 bytes
+    ${output} =    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]    ping -c 20 @{NET_2_VM_IPS}[0]
+    BuiltIn.Should Contain    ${output}    64 bytes
+
+Verification of route update after VM port removed and re added to VPN
+    [Documentation]    Verify route update after VM port removed and re added to VPN
+    OpenStackOperations.Delete Port    @{PORTS}[0]
+    ${net_list} =    BuiltIn.Create List    ${NET_1_VM_IPS[0]}
+    BuiltIn.Wait Until Keyword Succeeds    30s    10s    Utils.Check For Elements Not At URI    ${FIB_ENTRY_URL}    ${net_list}
+    OpenStackOperations.Delete Vm Instance    @{NET_1_VMS}[0]
+    OpenStackOperations.Create Port    @{NETWORKS}[0]    @{PORTS}[0]    sg=${SECURITY_GROUP}
+    BuiltIn.Wait Until Keyword Succeeds    3s    1s    Utils.Check For Elements At URI    ${PORT_URL}    ${PORTS}
+    OpenStackOperations.Create Vm Instance With Port On Compute Node    @{PORTS}[0]    @{NET_1_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
+    @{NET_1_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
+    BuiltIn.Set Suite Variable    @{NET_1_VM_IPS}
+    BuiltIn.Wait Until Keyword Succeeds    30s    10s    Utils.Check For Elements At URI    ${FIB_ENTRY_URL}    ${NET_1_VM_IPS}
+    ${output} =    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]    ping -c 10 @{NET_1_VM_IPS}[1]
+    BuiltIn.Should Contain    ${output}    64 bytes
+    ${output} =    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]    ping -c 10 @{NET_2_VM_IPS}[0]
+    BuiltIn.Should Contain    ${output}    64 bytes
+
+Verification of route update after reconfiguring vpn by adding new ports
+    [Documentation]    Verify route update after reconfiguring vpn by creating new VM with new port on openvswitch1
+    OpenStackOperations.Create Port    @{NETWORKS}[0]    ${PORT_NEW}    sg=${SECURITY_GROUP}
+    OpenStackOperations.Create Vm Instance With Port On Compute Node    ${PORT_NEW}    ${VM_NAME_NEW}    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
+    OpenStackOperations.Poll VM Is ACTIVE    ${VM_NAME_NEW}
+    ${status}    ${ips_and_console_log} =    BuiltIn.Run Keyword And Ignore Error    BuiltIn.Wait Until Keyword Succeeds    180s    15s    OpenStackOperations.Get VM IP
+    ...    true    ${VM_NAME_NEW}
+    ${output} =    VpnOperations.Get Fib Entries    session
+    BuiltIn.Should Contain    ${output}    ${ips_and_console_log[0]}
+    OpenStackOperations.Delete Vm Instance    ${VM_NAME_NEW}
+    OpenStackOperations.Delete Port    ${PORT_NEW}
+
 Dissociate L3VPN From Networks
     [Documentation]    Dissociate L3VPN from networks
     ${network1_id} =    OpenStackOperations.Get Net Id    @{NETWORKS}[0]
@@ -257,9 +298,14 @@ Dissociate L3VPN From Networks
     ${resp} =    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]
     BuiltIn.Should Not Contain    ${resp}    ${network1_id}
     VpnOperations.Dissociate L3VPN From Networks    networkid=${network2_id}    vpnid=@{VPN_INSTANCE_IDS}[0]
-    ${resp}=    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]
+    ${resp} =    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]
     BuiltIn.Should Not Contain    ${resp}    ${network2_id}
 
+Delete Unknown L3VPN
+    [Documentation]    Verification of a failure response with deletion of an unknown L3VPN
+    ${status}    ${message} =    BuiltIn.Run Keyword And Ignore Error    VpnOperations.VPN Delete L3VPN    vpnid=${INVALID_VPN_INSTANCE_ID}
+    BuiltIn.Should Contain    ${status}    FAIL
+
 Delete L3VPN
     [Documentation]    Delete L3VPN
     VpnOperations.VPN Delete L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]
@@ -271,18 +317,13 @@ Create Multiple L3VPN
     VpnOperations.VPN Create L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]    name=@{VPN_NAMES}[0]    rd=@{RDS}[0]    exportrt=@{RDS}[0]    importrt=@{RDS}[0]    tenantid=${tenant_id}
     VpnOperations.VPN Create L3VPN    vpnid=@{VPN_INSTANCE_IDS}[1]    name=@{VPN_NAMES}[1]    rd=@{RDS}[1]    exportrt=@{RDS}[1]    importrt=@{RDS}[1]    tenantid=${tenant_id}
     VpnOperations.VPN Create L3VPN    vpnid=@{VPN_INSTANCE_IDS}[2]    name=@{VPN_NAMES}[2]    rd=@{RDS}[2]    exportrt=@{RDS}[2]    importrt=@{RDS}[2]    tenantid=${tenant_id}
-    ${resp}=    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]
+    ${resp} =    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]
     BuiltIn.Should Contain    ${resp}    @{VPN_INSTANCE_IDS}[0]
-    ${resp}=    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[1]
+    ${resp} =    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[1]
     BuiltIn.Should Contain    ${resp}    @{VPN_INSTANCE_IDS}[1]
-    ${resp}=    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[2]
+    ${resp} =    VpnOperations.VPN Get L3VPN    vpnid=@{VPN_INSTANCE_IDS}[2]
     BuiltIn.Should Contain    ${resp}    @{VPN_INSTANCE_IDS}[2]
 
-Check Datapath Traffic Across Networks With L3VPN
-    [Documentation]    Datapath Test Across the networks with VPN.
-    [Tags]    exclude
-    BuiltIn.Log    This test will be added in the next patch
-
 Delete Multiple L3VPN
     [Documentation]    Delete three L3VPNs created using Multiple L3VPN Test
     VpnOperations.VPN Delete L3VPN    vpnid=@{VPN_INSTANCE_IDS}[0]