Use graceful start and stop
[integration/test.git] / csit / suites / openstack / clustering / ha_l3.robot
index ecaad95f18b0bebb9c8a8d1c53f4e4178758fa5b..fe8caa4385b142a58aabe16919c330f387db17b9 100644 (file)
@@ -15,7 +15,8 @@ Resource          ../../../libraries/OVSDB.robot
 Resource          ../../../libraries/ClusterOvsdb.robot
 Resource          ../../../libraries/ClusterManagement.robot
 Resource          ../../../libraries/SetupUtils.robot
-Variables         ../../../variables/Variables.py
+Resource          ../../../variables/Variables.robot
+Resource          ../../../variables/netvirt/Variables.robot
 
 *** Variables ***
 ${SECURITY_GROUP}    cl3_sg
@@ -31,9 +32,16 @@ ${SECURITY_GROUP}    cl3_sg
 
 *** Test Cases ***
 Create All Controller Sessions
-    [Documentation]    Create sessions for all three contorllers.
+    [Documentation]    Create sessions for all three controllers.
     ClusterManagement.ClusterManagement Setup
 
+Take Down Leader Of Default Shard
+    [Documentation]    Stop the karaf on ODL cluster leader
+    ${cluster_leader}    ${followers} =    ClusterManagement.Get Leader And Followers For Shard    shard_type=config
+    BuiltIn.Set Suite Variable    ${cluster_leader}
+    ${new_cluster_list} =    ClusterManagement.Stop Single Member    ${cluster_leader}    msg=up: ODL1, ODL2, ODL3, down=none
+    BuiltIn.Set Suite Variable    ${new_cluster_list}
+
 Create Networks
     [Documentation]    Create Network with neutron request.
     : FOR    ${NetworkElement}    IN    @{NETWORKS}
@@ -47,29 +55,37 @@ Create Subnets For net_2
     [Documentation]    Create Sub Nets for the Networks with neutron request.
     OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS}[1]    @{SUBNET_CIDRS}[1]
 
+Bring Up Leader Of Default Shard
+    [Documentation]    Bring up on cluster leader
+    ClusterManagement.Start Single Member    ${cluster_leader}    msg=up: ${new_cluster_list}, down: ${cluster_leader}
+
 Add Ssh Allow All Rule
     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
 
 Take Down ODL1
-    [Documentation]    Kill the karaf in First Controller
-    ClusterManagement.Kill Single Member    1
+    [Documentation]    Stop the karaf in First Controller
+    ClusterManagement.Stop Single Member    1    msg=up: ODL1, ODL2, ODL3, down=none
 
 Create Vm Instances For net_1
     [Documentation]    Create Vm instances using flavor and image names for a network.
-    OpenStackOperations.Create Vm Instances    @{NETWORKS}[0]    ${NET_1_VMS}    sg=${SECURITY_GROUP}
+    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
+    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[1]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
+    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
 
 Bring Up ODL1
     [Documentation]    Bring up ODL1 again
-    ClusterManagement.Start Single Member    1
+    ClusterManagement.Start Single Member    1    msg=up: ODL2, ODL3, down: ODL1
 
 Take Down ODL2
-    [Documentation]    Kill the karaf in Second Controller
-    ClusterManagement.Kill Single Member    2
+    [Documentation]    Stop the karaf in Second Controller
+    ClusterManagement.Stop Single Member    2    msg=up: ODL1, ODL2, ODL3, down=none
 
 Create Vm Instances For net_2
     [Documentation]    Create Vm instances using flavor and image names for a network.
-    OpenStackOperations.Create Vm Instances    @{NETWORKS}[1]    ${NET_2_VMS}    sg=${SECURITY_GROUP}
+    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
+    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[1]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
+    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
 
 Check Vm Instances Have Ip Address
     @{NET_1_L3_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
@@ -85,11 +101,11 @@ Check Vm Instances Have Ip Address
 
 Bring Up ODL2
     [Documentation]    Bring up ODL2 again
-    ClusterManagement.Start Single Member    2
+    ClusterManagement.Start Single Member    2    msg=up: ODL1, ODL3, down: ODL2
 
 Take Down ODL3
-    [Documentation]    Kill the karaf in Third Controller
-    ClusterManagement.Kill Single Member    3
+    [Documentation]    Stop the karaf in Third Controller
+    ClusterManagement.Stop Single Member    3    msg=up: ODL1, ODL2, ODL3, down=none
 
 Create Router router_2
     [Documentation]    Create Router and Add Interface to the subnets.
@@ -113,7 +129,7 @@ Verify Created Routers
 
 Bring Up ODL3
     [Documentation]    Bring up ODL3 again
-    ClusterManagement.Start Single Member    3
+    ClusterManagement.Start Single Member    3    msg=up: ODL1, ODL2, down: ODL3
 
 Ping Vm Instance1 In net_2 From net_1
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
@@ -140,9 +156,10 @@ Ping Vm Instance3 In net_1 From net_2
     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[2]
 
 Take Down ODL1 and ODL2
-    [Documentation]    Kill the karaf in First and Second Controller
-    ClusterManagement.Kill Members From List Or All    ${ODL_1_AND_2_DOWN}
-    [Teardown]    OpenStackOperations.Get OvsDebugInfo
+    [Documentation]    Stop the karaf in First and Second Controller
+    ClusterManagement.Stop Single Member    1    msg=up: ODL1, ODL2, ODL3, down=none
+    ClusterManagement.Stop Single Member    2    msg=up: ODL2, ODL3, down=ODL1
+    [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
 
 Connectivity Tests From Vm Instance1 In net_1
     [Documentation]    ssh to the VM instance and test operations.
@@ -163,13 +180,17 @@ Connectivity Tests From Vm Instance3 In net_1
     [Teardown]    OpenStackOperations.Get OvsDebugInfo
 
 Bring Up ODL1 and ODL2
-    [Documentation]    Bring up ODL1 and ODL2 again
-    ClusterManagement.Start Members From List Or All    ${ODL_1_AND_2_DOWN}
+    [Documentation]    Bring up ODL1 and ODL2 again. Do not check for cluster sync until all nodes are
+    ...    up. akka will not let nodes join until they are all back up if two were down.
+    ClusterManagement.Start Single Member    1    msg=up: ODL3, down: ODL1, ODL2    wait_for_sync=False
+    ClusterManagement.Start Single Member    2    msg=up: ODL1, ODL3, down: ODL2
+    [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
 
 Take Down ODL2 and ODL3
-    [Documentation]    Kill the karaf in First and Second Controller
-    ClusterManagement.Kill Members From List Or All    ${ODL_2_AND_3_DOWN}
-    [Teardown]    OpenStackOperations.Get OvsDebugInfo
+    [Documentation]    Stop the karaf in First and Second Controller
+    ClusterManagement.Stop Single Member    2    msg=up: ODL1, ODL2, ODL3, down=none
+    ClusterManagement.Stop Single Member    3    msg=up: ODL1, ODL3, down=ODL2
+    [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
 
 Connectivity Tests From Vm Instance1 In net_2
     [Documentation]    ssh to the VM instance and test operations.
@@ -190,8 +211,38 @@ Connectivity Tests From Vm Instance3 In net_2
     [Teardown]    OpenStackOperations.Get OvsDebugInfo
 
 Bring Up ODL2 and ODL3
-    [Documentation]    Bring up ODL2 and ODL3 again.
-    ClusterManagement.Start Members From List Or All    ${ODL_2_AND_3_DOWN}
+    [Documentation]    Bring up ODL2 and ODL3 again. Do not check for cluster sync until all nodes are
+    ...    up. akka will not let nodes join until they are all back up if two were down.
+    ClusterManagement.Start Single Member    2    msg=up: ODL1, down: ODL2, ODL3    wait_for_sync=False
+    ClusterManagement.Start Single Member    3    msg=up: ODL1, ODL2, down: ODL3
+    [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
+
+Take Down All Instances
+    [Documentation]    Stop karaf on all controllers
+    ClusterManagement.Stop Single Member    1    msg=up: ODL1, ODL2, ODL3, down=none
+    ClusterManagement.Stop Single Member    2    msg=up: ODL2, ODL3, down=ODL1
+    ClusterManagement.Stop Single Member    3    msg=up: ODL3, down=ODL1, ODL2
+    [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
+
+Bring Up All Instances
+    [Documentation]    Bring up all controllers. Do not check for cluster sync until all nodes are
+    ...    up. akka will not let nodes join until they are all back up if two were down.
+    ClusterManagement.Start Single Member    1    msg=up: none, down: ODL1, ODL2, ODL3    wait_for_sync=False
+    ClusterManagement.Start Single Member    2    msg=up: ~ODL1, down: ODL2, ODL3    wait_for_sync=False
+    ClusterManagement.Start Single Member    3    msg=up: ~ODL1, ~ODL2, down: ODL3
+    [Teardown]    OpenStackOperations.Get Test Teardown Debugs    fail=False
+
+Connectivity Tests From Vm Instance2 In net_2 after recovering all nodes
+    [Documentation]    ssh to the VM instance and test operations.
+    ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
+    OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[1]    ${dst_list}
+    [Teardown]    OpenStackOperations.Get OvsDebugInfo
+
+Connectivity Tests From Vm Instance3 In net_2 after recovering all nodes
+    [Documentation]    ssh to the VM instance and test operations.
+    ${dst_list} =    BuiltIn.Create List    @{NET_2_L3_VM_IPS}    @{NET_1_L3_VM_IPS}
+    OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[2]    ${dst_list}
+    [Teardown]    OpenStackOperations.Get OvsDebugInfo
 
 Delete Vm Instances In net_1
     [Documentation]    Delete Vm instances using instance names in net_1.