Use vm instance names for Show Debugs
[integration/test.git] / csit / suites / openstack / clustering / 02_l3_tests.robot
index 53a29103e2e313bb41b96de8a8889ec0b3258dce..88c9835d9f5d517cfd80963a32eb147712d65042 100644 (file)
@@ -2,13 +2,16 @@
 Documentation     Test suite to check connectivity in L3 using routers.
 Suite Setup       Devstack Suite Setup Tests    source_pwd=yes
 Suite Teardown    Close All Connections
+Test Teardown     Run Keywords    Show Debugs    ${NET_1_VM_INSTANCES}
+...               AND    Show Debugs    ${NET_2_VM_INSTANCES}
+...               AND    Get OvsDebugInfo
 Library           SSHLibrary
 Library           OperatingSystem
 Library           RequestsLibrary
 Resource          ../../../libraries/Utils.robot
 Resource          ../../../libraries/OpenStackOperations.robot
 Resource          ../../../libraries/DevstackUtils.robot
-Resource          ../../../libraries/ClusterKeywords.robot
+Resource          ../../../libraries/ClusterManagement.robot
 
 *** Variables ***
 @{NETWORKS_NAME}    l3_net_1    l3_net_2
@@ -20,75 +23,68 @@ Resource          ../../../libraries/ClusterKeywords.robot
 @{GATEWAY_IPS}    90.0.0.1    100.0.0.1
 @{DHCP_IPS}       90.0.0.2    100.0.0.2
 @{SUBNETS_RANGE}    90.0.0.0/24    100.0.0.0/24
-@{odl_1_and_2_down}    1    2
-@{odl_2_and_3_down}    2    3
+@{odl_1_and_2_down}    ${1}    ${2}
+@{odl_2_and_3_down}    ${2}    ${3}
 
 *** Test Cases ***
+Create All Controller Sessions
+    [Documentation]    Create sessions for all three contorllers.
+    ClusterManagement.ClusterManagement Setup
+
 Create Networks
     [Documentation]    Create Network with neutron request.
     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
-    \    Create Network    ${NetworkElement}
+    \    OpenStackOperations.Create Network    ${NetworkElement}
 
 Create Subnets For l3_net_1
     [Documentation]    Create Sub Nets for the Networks with neutron request.
-    Create SubNet    l3_net_1    l3_sub_net_1    @{SUBNETS_RANGE}[0]
+    OpenStackOperations.Create SubNet    l3_net_1    l3_sub_net_1    @{SUBNETS_RANGE}[0]
 
 Create Subnets For l3_net_2
     [Documentation]    Create Sub Nets for the Networks with neutron request.
-    Create SubNet    l3_net_2    l3_sub_net_2    @{SUBNETS_RANGE}[1]
+    OpenStackOperations.Create SubNet    l3_net_2    l3_sub_net_2    @{SUBNETS_RANGE}[1]
 
 Take Down ODL1
     [Documentation]    Kill the karaf in First Controller
-    ClusterKeywords.Kill Multiple Controllers    1
-    ${new_cluster_list}    ClusterKeywords.Create Controller Index List
-    Remove Values From List    ${new_cluster_list}    1
-    Set Suite Variable    ${new_cluster_list}
+    ClusterManagement.Kill Single Member    1
 
 Create Vm Instances For l3_net_1
     [Documentation]    Create Four Vm instances using flavor and image names for a network.
-    Create Vm Instances    l3_net_1    ${NET_1_VM_INSTANCES}
-    [Teardown]    Show Debugs    ${NET_1_VM_INSTANCES}
+    OpenStackOperations.Create Vm Instances    l3_net_1    ${NET_1_VM_INSTANCES}     sg=csit
 
 Bring Up ODL1
     [Documentation]    Bring up ODL1 again
-    ClusterKeywords.Start Multiple Controllers    300s    1
-    ${new_cluster_list}    ClusterKeywords.Create Controller Index List
-    Set Suite Variable    ${new_cluster_list}
+    ClusterManagement.Start Single Member    1
 
 Take Down ODL2
     [Documentation]    Kill the karaf in Second Controller
-    ClusterKeywords.Kill Multiple Controllers    2
-    ${new_cluster_list}    ClusterKeywords.Create Controller Index List
-    Remove Values From List    ${new_cluster_list}    2
-    Set Suite Variable    ${new_cluster_list}
+    ClusterManagement.Kill Single Member    2
 
 Create Vm Instances For l3_net_2
     [Documentation]    Create Four Vm instances using flavor and image names for a network.
-    Create Vm Instances    l3_net_2    ${NET_2_VM_INSTANCES}
-    [Teardown]    Show Debugs    ${NET_2_VM_INSTANCES}
+    OpenStackOperations.Create Vm Instances    l3_net_2    ${NET_2_VM_INSTANCES}     sg=csit
 
 Bring Up ODL2
     [Documentation]    Bring up ODL2 again
-    ClusterKeywords.Start Multiple Controllers    300s    2
-    ${new_cluster_list}    ClusterKeywords.Create Controller Index List
-    Set Suite Variable    ${new_cluster_list}
+    ClusterManagement.Start Single Member    2
 
 Take Down ODL3
     [Documentation]    Kill the karaf in Third Controller
-    ClusterKeywords.Kill Multiple Controllers    3
-    ${new_cluster_list}    ClusterKeywords.Create Controller Index List
-    Remove Values From List    ${new_cluster_list}    3
-    Set Suite Variable    ${new_cluster_list}
+    ClusterManagement.Kill Single Member    3
+
+Create Router router_2
+    [Documentation]    Create Router and Add Interface to the subnets. this fails sometimes.
+    OpenStackOperations.Create Router    router_2
+    [Teardown]    Report_Failure_Due_To_Bug     6117
 
-Create Routers
+Create Router router_3
     [Documentation]    Create Router and Add Interface to the subnets.
-    Create Router    router_2
-    Create Router    router_3
+    OpenStackOperations.Create Router    router_3
 
 Add Interfaces To Router
     [Documentation]    Add Interfaces
     : FOR    ${interface}    IN    @{SUBNETS_NAME}
-    \    Add Router Interface    router_3    ${interface}
+    \    OpenStackOperations.Add Router Interface    router_3    ${interface}
 
 Verify Created Routers
     [Documentation]    Check created routers using northbound rest calls
@@ -98,38 +94,41 @@ Verify Created Routers
 
 Bring Up ODL3
     [Documentation]    Bring up ODL3 again
-    ClusterKeywords.Start Multiple Controllers    300s    3
-    ${new_cluster_list}    ClusterKeywords.Create Controller Index List
-    Set Suite Variable    ${new_cluster_list}
+    ClusterManagement.Start Single Member    3
 
 Ping Vm Instance1 In l3_net_2 From l3_net_1
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Ping Vm From DHCP Namespace    l3_net_1    @{NET_2_VM_IPS}[0]
+    Get OvsDebugInfo
+    OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_1    @{NET_2_VM_IPS}[0]
 
 Ping Vm Instance2 In l3_net_2 From l3_net_1
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Ping Vm From DHCP Namespace    l3_net_1    @{NET_2_VM_IPS}[1]
+    Get OvsDebugInfo
+    OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_1    @{NET_2_VM_IPS}[1]
 
 Ping Vm Instance3 In l3_net_2 From l3_net_1
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Ping Vm From DHCP Namespace    l3_net_1    @{NET_2_VM_IPS}[2]
+    Get OvsDebugInfo
+    OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_1    @{NET_2_VM_IPS}[2]
 
 Ping Vm Instance1 In l3_net_1 From l3_net_2
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Ping Vm From DHCP Namespace    l3_net_2    @{NET_1_VM_IPS}[0]
+    Get OvsDebugInfo
+    OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_2    @{NET_1_VM_IPS}[0]
 
 Ping Vm Instance2 In l3_net_1 From l3_net_2
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Ping Vm From DHCP Namespace    l3_net_2    @{NET_1_VM_IPS}[1]
+    Get OvsDebugInfo
+    OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_2    @{NET_1_VM_IPS}[1]
 
 Ping Vm Instance3 In l3_net_1 From l3_net_2
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Ping Vm From DHCP Namespace    l3_net_2    @{NET_1_VM_IPS}[2]
+    Get OvsDebugInfo
+    OpenStackOperations.Ping Vm From DHCP Namespace    l3_net_2    @{NET_1_VM_IPS}[2]
 
 Take Down ODL1 and ODL2
     [Documentation]    Kill the karaf in First and Second Controller
-    : FOR    ${index}    IN    @{odl_1_and_2_down}
-    \    ClusterKeywords.Kill Multiple Controllers    ${index}
+    ClusterManagement.Kill Members From List Or All    ${odl_1_and_2_down}
 
 Connectivity Tests From Vm Instance1 In l3_net_1
     [Documentation]    Logging to the vm instance using generated key pair.
@@ -137,7 +136,8 @@ Connectivity Tests From Vm Instance1 In l3_net_1
     Log    ${dst_ip_list}
     ${other_dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]    @{NET_2_VM_IPS}[1]
     Log    ${other_dst_ip_list}
-    Test Operations From Vm Instance    l3_net_1    @{NET_1_VM_IPS}[0]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
+    Get OvsDebugInfo
+    OpenStackOperations.Test Operations From Vm Instance    l3_net_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 l3_net_1
     [Documentation]    Logging to the vm instance using generated key pair.
@@ -145,7 +145,8 @@ Connectivity Tests From Vm Instance2 In l3_net_1
     Log    ${dst_ip_list}
     ${other_dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
     Log    ${other_dst_ip_list}
-    Test Operations From Vm Instance    l3_net_1    @{NET_1_VM_IPS}[1]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
+    Get OvsDebugInfo
+    OpenStackOperations.Test Operations From Vm Instance    l3_net_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 l3_net_1
     [Documentation]    Logging to the vm instance using generated key pair.
@@ -153,17 +154,16 @@ Connectivity Tests From Vm Instance3 In l3_net_1
     Log    ${dst_ip_list}
     ${other_dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
     Log    ${other_dst_ip_list}
-    Test Operations From Vm Instance    l3_net_1    @{NET_1_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
+    Get OvsDebugInfo
+    OpenStackOperations.Test Operations From Vm Instance    l3_net_1    @{NET_1_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
 
 Bring Up ODL1 and ODL2
     [Documentation]    Bring up ODL1 and ODL2 again
-    : FOR    ${index}    IN    @{odl_1_and_2_down}
-    \    ClusterKeywords.Start Multiple Controllers    300s    ${index}
+    ClusterManagement.Start Members From List Or All    ${odl_1_and_2_down}
 
 Take Down ODL2 and ODL3
     [Documentation]    Kill the karaf in First and Second Controller
-    : FOR    ${index}    IN    @{odl_2_and_3_down}
-    \    ClusterKeywords.Kill Multiple Controllers    ${index}
+    ClusterManagement.Kill Members From List Or All    ${odl_2_and_3_down}
 
 Connectivity Tests From Vm Instance1 In l3_net_2
     [Documentation]    Logging to the vm instance using generated key pair.
@@ -171,7 +171,8 @@ Connectivity Tests From Vm Instance1 In l3_net_2
     Log    ${dst_ip_list}
     ${other_dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
     Log    ${other_dst_ip_list}
-    Test Operations From Vm Instance    l3_net_2    @{NET_2_VM_IPS}[0]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
+    Get OvsDebugInfo
+    OpenStackOperations.Test Operations From Vm Instance    l3_net_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 l3_net_2
     [Documentation]    Logging to the vm instance using generated key pair.
@@ -179,7 +180,8 @@ Connectivity Tests From Vm Instance2 In l3_net_2
     Log    ${dst_ip_list}
     ${other_dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
     Log    ${other_dst_ip_list}
-    Test Operations From Vm Instance    l3_net_2    @{NET_2_VM_IPS}[1]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
+    Get OvsDebugInfo
+    OpenStackOperations.Test Operations From Vm Instance    l3_net_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 l3_net_2
     [Documentation]    Logging to the vm instance using generated key pair.
@@ -187,32 +189,32 @@ Connectivity Tests From Vm Instance3 In l3_net_2
     Log    ${dst_ip_list}
     ${other_dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
     Log    ${other_dst_ip_list}
-    Test Operations From Vm Instance    l3_net_2    @{NET_2_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
+    Get OvsDebugInfo
+    OpenStackOperations.Test Operations From Vm Instance    l3_net_2    @{NET_2_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
 
 Bring Up ODL2 and ODL3
     [Documentation]    Bring up ODL2 and ODL3 again.
-    : FOR    ${index}    IN    @{odl_2_and_3_down}
-    \    ClusterKeywords.Start Multiple Controllers    300s    ${index}
+    ClusterManagement.Start Members From List Or All    ${odl_2_and_3_down}
 
 Delete Vm Instances In l3_net_1
     [Documentation]    Delete Vm instances using instance names in l3_net_1.
     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
-    \    Delete Vm Instance    ${VmElement}
+    \    OpenStackOperations.Delete Vm Instance    ${VmElement}
 
 Delete Vm Instances In l3_net_2
     [Documentation]    Delete Vm instances using instance names in l3_net_2.
     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
-    \    Delete Vm Instance    ${VmElement}
+    \    OpenStackOperations.Delete Vm Instance    ${VmElement}
 
 Delete Router Interfaces
     [Documentation]    Remove Interface to the subnets.
     : FOR    ${interface}    IN    @{SUBNETS_NAME}
-    \    Remove Interface    router_3    ${interface}
+    \    OpenStackOperations.Remove Interface    router_3    ${interface}
 
 Delete Routers
     [Documentation]    Delete Router and Interface to the subnets.
-    Delete Router    router_2
-    Delete Router    router_3
+    OpenStackOperations.Delete Router    router_2
+    OpenStackOperations.Delete Router    router_3
 
 Verify Deleted Routers
     [Documentation]    Check deleted routers using northbound rest calls
@@ -222,13 +224,13 @@ Verify Deleted Routers
 
 Delete Sub Networks In l3_net_1
     [Documentation]    Delete Sub Nets for the Networks with neutron request.
-    Delete SubNet    l3_sub_net_1
+    OpenStackOperations.Delete SubNet    l3_sub_net_1
 
 Delete Sub Networks In l3_net_2
     [Documentation]    Delete Sub Nets for the Networks with neutron request.
-    Delete SubNet    l3_sub_net_2
+    OpenStackOperations.Delete SubNet    l3_sub_net_2
 
 Delete Networks
     [Documentation]    Delete Networks with neutron request.
     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
-    \    Delete Network    ${NetworkElement}
+    \    OpenStackOperations.Delete Network    ${NetworkElement}