Replace deprecated variables in suites/controller (1).
[integration/test.git] / csit / suites / controller / Clustering_Datastore / 140_recovery_restart_follower.robot
index a57141c37178a786a08385aa515e8cd890e88169..8a9a3130819b417f542ccceb45db7e54bd8f7be6 100644 (file)
@@ -3,65 +3,74 @@ Documentation     This test kills any of the followers and verifies that when th
 Default Tags      3-node-cluster
 Library           Collections
 Library           RequestsLibrary
-Library           ../../../libraries/Common.py
 Library           ../../../libraries/CrudLibrary.py
-Library           ../../../libraries/SettingsLibrary.py
-Library           ../../../libraries/UtilLibrary.py
-Library           ../../../libraries/ClusterStateLibrary.py
 Resource          ../../../libraries/ClusterKeywords.robot
+Resource          ../../../libraries/CarsAndPeople.robot
 Variables         ../../../variables/Variables.py
 
 *** Variables ***
 ${CAR_SHARD}      shard-car-config
 ${NUM_CARS}       ${60}
-@{controllers}    ${CONTROLLER}    ${CONTROLLER1}    ${CONTROLLER2}
+@{controllers}    ${ODL_SYSTEM_IP}    ${ODL_SYSTEM_2_IP}    ${ODL_SYSTEM_3_IP}
 ${KARAF_HOME}     ${WORKSPACE}/${BUNDLEFOLDER}
+${START_TIMEOUT}    300s
+${STOP_TIMEOUT}    180s
 
 *** Test Cases ***
 Stop All Controllers
     [Documentation]    Stop all the controllers in the cluster
     Stop One Or More Controllers    @{controllers}
+    Wait For Cluster Down    ${STOP_TIMEOUT}    @{controllers}
 
 Clean All Journals
     [Documentation]    Clean the journals of all the controllers in the cluster
     Clean One Or More Journals    @{controllers}
+    Clean One Or More Snapshots    @{controllers}
 
 Start All Controllers
     [Documentation]    Start all the controllers in the cluster
     Start One Or More Controllers    @{controllers}
+    Wait For Cluster Sync    ${START_TIMEOUT}    @{controllers}
 
-Get car leader and followers
-    ${CURRENT_CAR_LEADER}    Wait For Leader To Be Found    ${CAR_SHARD}
+Get Car Leader And Followers
+    [Documentation]    Find leader and followers in the car shard
+    ${CURRENT_CAR_LEADER}    Get Leader And Verify    ${CAR_SHARD}
     Set Suite Variable    ${CURRENT_CAR_LEADER}
     ${CAR_FOLLOWERS}    Get All Followers    ${CAR_SHARD}
     Set Suite Variable    ${CAR_FOLLOWERS}
 
-Stop both of the followers
+Verify No Cars On Leader After Restart
+    [Documentation]    Verify no cars after restart
+    Wait Until Keyword Succeeds    ${START_TIMEOUT}    2s    Check Cars Deleted    ${CURRENT_CAR_LEADER}
+
+Stop Both Of The Followers
+    [Documentation]    Stop car followers
     @{followers} =    Create List    @{CAR_FOLLOWERS}[0]    @{CAR_FOLLOWERS}[1]
     Stop One Or More Controllers    @{followers}
+    Wait For Cluster Down    ${STOP_TIMEOUT}    @{followers}
 
-Attempt to add a car to the leader
-    [Documentation]    Should fail as both followers are down
-    AddCar    ${CURRENT_CAR_LEADER}    ${RESTCONFPORT}    ${1}    500
+Attempt To Add A Car To The Leader
+    [Documentation]    Add car should fail as both followers are down
+    AddCar    ${CURRENT_CAR_LEADER}    ${RESTCONFPORT}    ${1}    500    503
     Sleep    2
     ${resp}    Getcars    ${CURRENT_CAR_LEADER}    ${RESTCONFPORT}    ${1}
     Should Not Be Equal As Strings    ${resp.status_code}    200
 
-Restart the first follower
+Restart The First Follower
+    [Documentation]    Start one follower
     Start One Or More Controllers    @{CAR_FOLLOWERS}[0]
+    Wait For Controller Sync    ${START_TIMEOUT}    @{CAR_FOLLOWERS}[0]
 
-Add cars to the first follower
+Add Cars To The First Follower
+    [Documentation]    Add cars to the follower and verify
     Log    Adding ${NUM_CARS} cars to @{CAR_FOLLOWERS}[0]
-    Add Cars And Verify Without Init    @{CAR_FOLLOWERS}[0]    ${NUM_CARS}    4s
+    Wait Until Keyword Succeeds    ${START_TIMEOUT}    2s    Add Cars And Verify Without Init    @{CAR_FOLLOWERS}[0]    ${NUM_CARS}
 
-Restart the second follower
+Restart The Second Follower
+    [Documentation]    Start another follower
     Start One Or More Controllers    @{CAR_FOLLOWERS}[1]
+    Wait For Controller Sync    ${START_TIMEOUT}    @{CAR_FOLLOWERS}[1]
 
-Get all the cars from the second follower
-    Get Cars And Verify    @{CAR_FOLLOWERS}[1]    ${NUM_CARS}
-
-*** Keywords ***
-Expect No Leader
-    ${leader}    GetLeader    ${CAR_SHARD}    ${3}    ${1}    ${1}    ${RESTCONFPORT}
-    ...    ${CURRENT_CAR_LEADER}
-    Should Be Equal As Strings    ${leader}    None
+Get All The Cars From The Second Follower
+    [Documentation]    Add cars to the follower and verify
+    Wait Until Keyword Succeeds    ${START_TIMEOUT}    2s    Get Cars And Verify    @{CAR_FOLLOWERS}[1]    ${NUM_CARS}