Bug 5423: Fix for ERROR messages when intents were deleted.
[integration/test.git] / csit / suites / controller / Clustering_Datastore / 140_recovery_restart_follower.robot
1 *** Settings ***
2 Documentation     This test kills any of the followers and verifies that when that follower is restarted it can join the cluster
3 Default Tags      3-node-cluster
4 Library           Collections
5 Library           RequestsLibrary
6 Library           ../../../libraries/CrudLibrary.py
7 Resource          ../../../libraries/ClusterKeywords.robot
8 Resource          ../../../libraries/CarsAndPeople.robot
9 Variables         ../../../variables/Variables.py
10
11 *** Variables ***
12 ${CAR_SHARD}      shard-car-config
13 ${NUM_CARS}       ${60}
14 @{controllers}    ${ODL_SYSTEM_IP}    ${ODL_SYSTEM_2_IP}    ${ODL_SYSTEM_3_IP}
15 ${KARAF_HOME}     ${WORKSPACE}/${BUNDLEFOLDER}
16 ${START_TIMEOUT}    300s
17 ${STOP_TIMEOUT}    180s
18
19 *** Test Cases ***
20 Stop All Controllers
21     [Documentation]    Stop all the controllers in the cluster
22     Stop One Or More Controllers    @{controllers}
23     Wait For Cluster Down    ${STOP_TIMEOUT}    @{controllers}
24
25 Clean All Journals
26     [Documentation]    Clean the journals of all the controllers in the cluster
27     Clean One Or More Journals    @{controllers}
28     Clean One Or More Snapshots    @{controllers}
29
30 Start All Controllers
31     [Documentation]    Start all the controllers in the cluster
32     Start One Or More Controllers    @{controllers}
33     Wait For Cluster Sync    ${START_TIMEOUT}    @{controllers}
34
35 Get Car Leader And Followers
36     [Documentation]    Find leader and followers in the car shard
37     ${CURRENT_CAR_LEADER}    Get Leader And Verify    ${CAR_SHARD}
38     Set Suite Variable    ${CURRENT_CAR_LEADER}
39     ${CAR_FOLLOWERS}    Get All Followers    ${CAR_SHARD}
40     Set Suite Variable    ${CAR_FOLLOWERS}
41
42 Verify No Cars On Leader After Restart
43     [Documentation]    Verify no cars after restart
44     Wait Until Keyword Succeeds    ${START_TIMEOUT}    2s    Check Cars Deleted    ${CURRENT_CAR_LEADER}
45
46 Stop Both Of The Followers
47     [Documentation]    Stop car followers
48     @{followers} =    Create List    @{CAR_FOLLOWERS}[0]    @{CAR_FOLLOWERS}[1]
49     Stop One Or More Controllers    @{followers}
50     Wait For Cluster Down    ${STOP_TIMEOUT}    @{followers}
51
52 Attempt To Add A Car To The Leader
53     [Documentation]    Add car should fail as both followers are down
54     AddCar    ${CURRENT_CAR_LEADER}    ${RESTCONFPORT}    ${1}    500    503
55     Sleep    2
56     ${resp}    Getcars    ${CURRENT_CAR_LEADER}    ${RESTCONFPORT}    ${1}
57     Should Not Be Equal As Strings    ${resp.status_code}    200
58
59 Restart The First Follower
60     [Documentation]    Start one follower
61     Start One Or More Controllers    @{CAR_FOLLOWERS}[0]
62     Wait For Controller Sync    ${START_TIMEOUT}    @{CAR_FOLLOWERS}[0]
63
64 Add Cars To The First Follower
65     [Documentation]    Add cars to the follower and verify
66     Log    Adding ${NUM_CARS} cars to @{CAR_FOLLOWERS}[0]
67     Wait Until Keyword Succeeds    ${START_TIMEOUT}    2s    Add Cars And Verify Without Init    @{CAR_FOLLOWERS}[0]    ${NUM_CARS}
68
69 Restart The Second Follower
70     [Documentation]    Start another follower
71     Start One Or More Controllers    @{CAR_FOLLOWERS}[1]
72     Wait For Controller Sync    ${START_TIMEOUT}    @{CAR_FOLLOWERS}[1]
73
74 Get All The Cars From The Second Follower
75     [Documentation]    Add cars to the follower and verify
76     Wait Until Keyword Succeeds    ${START_TIMEOUT}    2s    Get Cars And Verify    @{CAR_FOLLOWERS}[1]    ${NUM_CARS}