optimizing connectivity suite test case execution 61/47861/13
authorJamo Luhrsen <jluhrsen@redhat.com>
Wed, 2 Nov 2016 22:41:33 +0000 (15:41 -0700)
committerVenkatrangan Govindarajan <venkatrangang@hcl.com>
Thu, 10 Nov 2016 20:47:44 +0000 (20:47 +0000)
not polling on ACTIVE after instance creation, but rather looking at the
instance console logs and polling on when it "obtains" it's ip address

also removing debug collection from every test case and running only
in the most needed places

Change-Id: I705ff00faad2e6f5c8d2c1f4908bbe2698f5a98c
Signed-off-by: Jamo Luhrsen <jluhrsen@redhat.com>
csit/libraries/OpenStackOperations.robot
csit/suites/openstack/connectivity/01_l2_tests.robot
csit/suites/openstack/connectivity/02_l3_tests.robot

index 83446a3161430e65f2c9549452fc936210b9b2c6..157cc941e34304c8e2042564fd71e8db75db5f81 100644 (file)
@@ -194,7 +194,6 @@ Create Vm Instances
     : FOR    ${VmElement}    IN    @{vm_instance_names}
     \    ${output}=    Write Commands Until Prompt    nova boot --image ${image} --flavor ${flavor} --nic net-id=${net_id} ${VmElement} --security-groups ${sg}    30s
     \    Log    ${output}
-    \    Wait Until Keyword Succeeds    25s    5s    Verify VM Is ACTIVE    ${VmElement}
 
 Create Vm Instance With Port On Compute Node
     [Arguments]    ${port_name}    ${vm_instance_name}    ${compute_node}    ${image}=cirros-0.3.4-x86_64-uec    ${flavor}=m1.nano    ${sg}=default
@@ -210,10 +209,24 @@ Create Vm Instance With Port On Compute Node
 Verify VM Is ACTIVE
     [Arguments]    ${vm_name}
     [Documentation]    Run these commands to check whether the created vm instance is active or not.
+    ${devstack_conn_id}=    Get ControlNode Connection
+    Switch Connection    ${devstack_conn_id}
     ${output}=    Write Commands Until Prompt    nova show ${vm_name} | grep OS-EXT-STS:vm_state    30s
     Log    ${output}
     Should Contain    ${output}    active
 
+Verify VMs Received DHCP Lease
+    [Arguments]    @{vm_list}
+    [Documentation]    Using nova console-log on the provided ${vm_name} to search for the string "obtained" which
+    ...    correlates to the instance receiving it's IP address via DHCP. This should provide a good indication
+    ...    that the instance is fully up and ready.
+    ${devstack_conn_id}=    Get ControlNode Connection
+    Switch Connection    ${devstack_conn_id}
+    : FOR    ${vm}    IN    @{vm_list}
+    \    ${output}=    Write Commands Until Prompt    nova console-log ${vm} | grep -i "obtained"    30s
+    \    Log    ${output}
+    \    Should Contain    ${output}    obtained
+
 View Vm Console
     [Arguments]    ${vm_instance_names}
     [Documentation]    View Console log of the created vm instances using nova show.
index ccecc86793414d56bc53b097278d90b22678e62d..6a8db15f2eb9910aed96febe060f44984812efbe 100644 (file)
@@ -4,9 +4,7 @@ Suite Setup       BuiltIn.Run Keywords    SetupUtils.Setup_Utils_For_Setup_And_T
 ...               AND    DevstackUtils.Devstack Suite Setup Tests
 Suite Teardown    Close All Connections
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-Test Teardown     Run Keywords    Show Debugs    ${NET_1_VM_INSTANCES}
-...               AND    Show Debugs    ${NET_2_VM_INSTANCES}
-...               AND    Get OvsDebugInfo
+Test Teardown     Get OvsDebugInfo
 Library           SSHLibrary
 Library           OperatingSystem
 Library           RequestsLibrary
@@ -59,76 +57,77 @@ 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}    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]
 
 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]
 
 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]
 
 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]
 
 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]
 
 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]
 
 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}
 
 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}
 
 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}
 
 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}
 
 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}
 
 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}
 
 Delete A Vm Instance
@@ -137,7 +136,6 @@ 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]
 
 Delete Vm Instances In l2_network_1
@@ -149,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.
index a8d2ae9df035f8421ab42ac8ee67512598d128e9..50cf045d5eb10bf78585adfa1e8fcac8fd8f9e80 100644 (file)
@@ -4,9 +4,7 @@ Suite Setup       BuiltIn.Run Keywords    SetupUtils.Setup_Utils_For_Setup_And_T
 ...               AND    DevstackUtils.Devstack Suite Setup Tests
 Suite Teardown    Close All Connections
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-Test Teardown     Run Keywords    Show Debugs    ${NET_1_VM_INSTANCES}
-...               AND    Show Debugs    ${NET_2_VM_INSTANCES}
-...               AND    Get OvsDebugInfo
+Test Teardown     Get OvsDebugInfo
 Library           SSHLibrary
 Library           OperatingSystem
 Library           RequestsLibrary
@@ -48,6 +46,19 @@ Create Vm Instances For network_2
     [Documentation]    Create Four Vm instances using flavor and image names for a network.
     Create Vm Instances    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
+
 Create Routers
     [Documentation]    Create Router
     Create Router    router_1
@@ -59,32 +70,26 @@ Add Interfaces To Router
 
 Ping Vm Instance1 In network_2 From network_1
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Get OvsDebugInfo
     Ping Vm From DHCP Namespace    network_1    @{NET_2_VM_IPS}[0]
 
 Ping Vm Instance2 In network_2 From network_1
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Get OvsDebugInfo
     Ping Vm From DHCP Namespace    network_1    @{NET_2_VM_IPS}[1]
 
 Ping Vm Instance3 In network_2 From network_1
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Get OvsDebugInfo
     Ping Vm From DHCP Namespace    network_1    @{NET_2_VM_IPS}[2]
 
 Ping Vm Instance1 In network_1 From network_2
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Get OvsDebugInfo
     Ping Vm From DHCP Namespace    network_2    @{NET_1_VM_IPS}[0]
 
 Ping Vm Instance2 In network_1 From network_2
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Get OvsDebugInfo
     Ping Vm From DHCP Namespace    network_2    @{NET_1_VM_IPS}[1]
 
 Ping Vm Instance3 In network_1 From network_2
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Get OvsDebugInfo
     Ping Vm From DHCP Namespace    network_2    @{NET_1_VM_IPS}[2]
 
 Connectivity Tests From Vm Instance1 In network_1
@@ -93,7 +98,6 @@ Connectivity Tests From Vm Instance1 In network_1
     Log    ${dst_ip_list}
     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
     Log    ${other_dst_ip_list}
-    Get OvsDebugInfo
     Test Operations From Vm Instance    network_1    @{NET_1_VM_IPS}[0]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
 
 Connectivity Tests From Vm Instance2 In network_1
@@ -102,7 +106,6 @@ Connectivity Tests From Vm Instance2 In network_1
     Log    ${dst_ip_list}
     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
     Log    ${other_dst_ip_list}
-    Get OvsDebugInfo
     Test Operations From Vm Instance    network_1    @{NET_1_VM_IPS}[1]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
 
 Connectivity Tests From Vm Instance3 In network_1
@@ -111,7 +114,6 @@ Connectivity Tests From Vm Instance3 In network_1
     Log    ${dst_ip_list}
     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
     Log    ${other_dst_ip_list}
-    Get OvsDebugInfo
     Test Operations From Vm Instance    network_1    @{NET_1_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
 
 Connectivity Tests From Vm Instance1 In network_2
@@ -120,7 +122,6 @@ Connectivity Tests From Vm Instance1 In network_2
     Log    ${dst_ip_list}
     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
     Log    ${other_dst_ip_list}
-    Get OvsDebugInfo
     Test Operations From Vm Instance    network_2    @{NET_2_VM_IPS}[0]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
 
 Connectivity Tests From Vm Instance2 In network_2
@@ -129,7 +130,6 @@ Connectivity Tests From Vm Instance2 In network_2
     Log    ${dst_ip_list}
     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
     Log    ${other_dst_ip_list}
-    Get OvsDebugInfo
     Test Operations From Vm Instance    network_2    @{NET_2_VM_IPS}[1]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
 
 Connectivity Tests From Vm Instance3 In network_2
@@ -138,7 +138,6 @@ Connectivity Tests From Vm Instance3 In network_2
     Log    ${dst_ip_list}
     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
     Log    ${other_dst_ip_list}
-    Get OvsDebugInfo
     Test Operations From Vm Instance    network_2    @{NET_2_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
 
 Delete Vm Instances In network_1
@@ -150,6 +149,9 @@ Delete Vm Instances In network_2
     [Documentation]    Delete Vm instances using instance names in 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 Router Interfaces
     [Documentation]    Remove Interface to the subnets.