optimizing connectivity suite test case execution
[integration/test.git] / csit / suites / openstack / connectivity / 01_l2_tests.robot
index d98779b7afcedd862ee5eeea43b4b596ca76e3e9..6a8db15f2eb9910aed96febe060f44984812efbe 100644 (file)
@@ -1,14 +1,17 @@
 *** Settings ***
 Documentation     Test suite to verify packet flows between vm instances.
-Suite Setup       Devstack Suite Setup Tests
+Suite Setup       BuiltIn.Run Keywords    SetupUtils.Setup_Utils_For_Setup_And_Teardown
+...               AND    DevstackUtils.Devstack Suite Setup Tests
 Suite Teardown    Close All Connections
-Test Setup        Log Testcase Start To Controller Karaf
+Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+Test Teardown     Get OvsDebugInfo
 Library           SSHLibrary
 Library           OperatingSystem
 Library           RequestsLibrary
 Resource          ../../../libraries/Utils.robot
 Resource          ../../../libraries/OpenStackOperations.robot
 Resource          ../../../libraries/DevstackUtils.robot
+Resource          ../../../libraries/SetupUtils.robot
 
 *** Variables ***
 @{NETWORKS_NAME}    l2_network_1    l2_network_2
@@ -36,100 +39,96 @@ Create Subnets For l2_network_2
     [Documentation]    Create Sub Nets for the Networks with neutron request.
     Create SubNet    l2_network_2    l2_subnet_2    @{SUBNETS_RANGE}[1]
 
+Add Ssh Allow Rule
+    [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
+    Neutron Security Group Create    csit
+    Neutron Security Group Rule Create    csit    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    csit    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    csit    direction=ingress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    csit    direction=egress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    csit    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    csit    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
+
 Create Vm Instances For l2_network_1
     [Documentation]    Create Four Vm instances using flavor and image names for a network.
-    Create Vm Instances    l2_network_1    ${NET_1_VM_INSTANCES}
-    [Teardown]    Show Debugs    ${NET_1_VM_INSTANCES}
+    Create Vm Instances    l2_network_1    ${NET_1_VM_INSTANCES}    sg=csit
 
 Create Vm Instances For l2_network_2
     [Documentation]    Create Four Vm instances using flavor and image names for a network.
-    Create Vm Instances    l2_network_2    ${NET_2_VM_INSTANCES}
-    [Teardown]    Show Debugs    ${NET_2_VM_INSTANCES}
-    Get OvsDebugInfo
+    Create Vm Instances    l2_network_2    ${NET_2_VM_INSTANCES}    sg=csit
+
+Check Vm Instances Have Ip Address
+    [Documentation]    Test case to verify that all created VMs are ready and have received their ip addresses.
+    ...    We are polling first and longest on the last VM created assuming that if it's received it's address
+    ...    already the other instances should have theirs already or at least shortly thereafter.
+    # first, ensure all VMs are in ACTIVE state.    if not, we can just fail the test case and not waste time polling
+    # for dhcp addresses
+    : FOR    ${vm}    IN    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
+    \    Wait Until Keyword Succeeds    15s    5s    Verify VM Is ACTIVE    ${vm}
+    Wait Until Keyword Succeeds    180s    10s    Verify VMs Received DHCP Lease    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
+    [Teardown]    Run Keywords    Show Debugs    ${NET_1_VM_INSTANCES}
+    ...    AND    Show Debugs    ${NET_2_VM_INSTANCES}
+    ...    AND    Get OvsDebugInfo
 
 Ping Vm Instance1 In l2_network_1
     [Documentation]    Check reachability of vm instances by pinging to them.
-    Get OvsDebugInfo
     Ping Vm From DHCP Namespace    l2_network_1    @{NET_1_VM_IPS}[0]
-    Get OvsDebugInfo
 
 Ping Vm Instance2 In l2_network_1
     [Documentation]    Check reachability of vm instances by pinging to them.
-    Get OvsDebugInfo
     Ping Vm From DHCP Namespace    l2_network_1    @{NET_1_VM_IPS}[1]
-    Get OvsDebugInfo
 
 Ping Vm Instance3 In l2_network_1
     [Documentation]    Check reachability of vm instances by pinging to them.
-    Get OvsDebugInfo
     Ping Vm From DHCP Namespace    l2_network_1    @{NET_1_VM_IPS}[2]
-    Get OvsDebugInfo
 
 Ping Vm Instance1 In l2_network_2
     [Documentation]    Check reachability of vm instances by pinging to them.
-    Get OvsDebugInfo
     Ping Vm From DHCP Namespace    l2_network_2    @{NET_2_VM_IPS}[0]
-    Get OvsDebugInfo
 
 Ping Vm Instance2 In l2_network_2
     [Documentation]    Check reachability of vm instances by pinging to them.
-    Get OvsDebugInfo
     Ping Vm From DHCP Namespace    l2_network_2    @{NET_2_VM_IPS}[1]
-    Get OvsDebugInfo
 
 Ping Vm Instance3 In l2_network_2
     [Documentation]    Check reachability of vm instances by pinging to them.
-    Get OvsDebugInfo
     Ping Vm From DHCP Namespace    l2_network_2    @{NET_2_VM_IPS}[2]
-    Get OvsDebugInfo
 
 Connectivity Tests From Vm Instance1 In l2_network_1
     [Documentation]    Logging to the vm instance1
     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[1]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
     Log    ${dst_ip_list}
-    Get OvsDebugInfo
     Test Operations From Vm Instance    l2_network_1    @{NET_1_VM_IPS}[0]    ${dst_ip_list}
-    Get OvsDebugInfo
 
 Connectivity Tests From Vm Instance2 In l2_network_1
     [Documentation]    Logging to the vm instance2
     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
     Log    ${dst_ip_list}
-    Get OvsDebugInfo
     Test Operations From Vm Instance    l2_network_1    @{NET_1_VM_IPS}[1]    ${dst_ip_list}
-    Get OvsDebugInfo
 
 Connectivity Tests From Vm Instance3 In l2_network_1
     [Documentation]    Logging to the vm instance2
     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]
     Log    ${dst_ip_list}
-    Get OvsDebugInfo
     Test Operations From Vm Instance    l2_network_1    @{NET_1_VM_IPS}[2]    ${dst_ip_list}
-    Get OvsDebugInfo
 
 Connectivity Tests From Vm Instance1 In l2_network_2
     [Documentation]    Logging to the vm instance using generated key pair.
     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[1]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
     Log    ${dst_ip_list}
-    Get OvsDebugInfo
     Test Operations From Vm Instance    l2_network_2    @{NET_2_VM_IPS}[0]    ${dst_ip_list}
-    Get OvsDebugInfo
 
 Connectivity Tests From Vm Instance2 In l2_network_2
     [Documentation]    Logging to the vm instance using generated key pair.
     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
     Log    ${dst_ip_list}
-    Get OvsDebugInfo
     Test Operations From Vm Instance    l2_network_2    @{NET_2_VM_IPS}[1]    ${dst_ip_list}
-    Get OvsDebugInfo
 
 Connectivity Tests From Vm Instance3 In l2_network_2
     [Documentation]    Logging to the vm instance using generated key pair.
     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[1]
     Log    ${dst_ip_list}
-    Get OvsDebugInfo
     Test Operations From Vm Instance    l2_network_2    @{NET_2_VM_IPS}[2]    ${dst_ip_list}
-    Get OvsDebugInfo
 
 Delete A Vm Instance
     [Documentation]    Delete Vm instances using instance names.
@@ -137,9 +136,7 @@ Delete A Vm Instance
 
 No Ping For Deleted Vm
     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
-    Get OvsDebugInfo
     ${output}=    Ping From DHCP Should Not Succeed    l2_network_1    @{NET_1_VM_IPS}[0]
-    Get OvsDebugInfo
 
 Delete Vm Instances In l2_network_1
     [Documentation]    Delete Vm instances using instance names in l2_network_1.
@@ -150,6 +147,9 @@ Delete Vm Instances In l2_network_2
     [Documentation]    Delete Vm instances using instance names in l2_network_2.
     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
     \    Delete Vm Instance    ${VmElement}
+    [Teardown]    Run Keywords    Show Debugs    ${NET_1_VM_INSTANCES}
+    ...    AND    Show Debugs    ${NET_2_VM_INSTANCES}
+    ...    AND    Get OvsDebugInfo
 
 Delete Sub Networks In l2_network_1
     [Documentation]    Delete Sub Nets for the Networks with neutron request.
@@ -163,4 +163,3 @@ Delete Networks
     [Documentation]    Delete Networks with neutron request.
     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
     \    Delete Network    ${NetworkElement}
-    Get OvsDebugInfo