567eb3f37b6bb68a1fbc383aa264df95977f3b40
[integration/test.git] / test / csit / suites / controller / MD_SAL_Cluster_Datastore / 130_recovery_restart_leader.txt
1 *** Settings ***
2 Documentation     This test kills the leader and verifies that on restart the old leader is able to rejoin the cluster
3 Library           Collections
4 Library           ../../../libraries/RequestsLibrary.py
5 Library           ../../../libraries/Common.py
6 Library           ../../../libraries/CrudLibrary.py
7 Library           ../../../libraries/SettingsLibrary.py
8 Library           ../../../libraries/UtilLibrary.py
9 Library           ../../../libraries/ClusterStateLibrary.py
10 Variables         ../../../variables/Variables.py
11
12 *** Variables ***
13 ${REST_CONTEXT}    /restconf/config/
14 ${KARAF_HOME}      /root/odl/dist
15 ${USER_NAME}       root
16 ${PASSWORD}        Ecp123
17 ${CAR_SHARD}       shard-car-config
18
19 *** Test Cases *** 
20 Stop All Controllers
21     [Documentation]    Stop all the controllers in the cluster
22     Stopcontroller    ${MEMBER1}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
23     Stopcontroller    ${MEMBER2}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
24     Stopcontroller    ${MEMBER3}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
25     Sleep    30
26     KillController    ${MEMBER1}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
27     KillController    ${MEMBER2}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
28     KillController    ${MEMBER3}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
29
30
31 Clean All Journals
32     [Documentation]    Clean the journals of all the controllers in the cluster
33     CleanJournal    ${MEMBER1}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
34     CleanJournal    ${MEMBER2}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
35     CleanJournal    ${MEMBER3}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
36     Sleep    5
37
38 Start All Controllers
39     [Documentation]    Start all the controllers in the cluster
40     Startcontroller    ${MEMBER1}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
41     Startcontroller    ${MEMBER2}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
42     Startcontroller    ${MEMBER3}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
43     Sleep    120
44
45 Delete all cars
46     [Documentation]    Delete all the cars from the system
47         ${resp}         DeleteAllCars   ${MEMBER1}      ${PORT}         0
48         ${resp}         GetCars ${MEMBER1}      ${PORT}         0
49         Should Be Equal As Strings    ${resp.status_code}    404
50         
51
52 Delete all people
53     [Documentation]    Delete all the people from the system
54         ${resp}         DeleteAllPersons        ${MEMBER1}      ${PORT}         0
55         ${resp}         GetPersons      ${MEMBER1}      ${PORT}    0    
56         Should Be Equal As Strings    ${resp.status_code}    404
57
58 Add 200 cars
59     [Documentation]    Add 200 cars
60         ${resp}         AddCar  ${MEMBER1}      ${PORT}  ${200}
61         Should Be Equal As Strings    ${resp.status_code}    204
62
63 Add 200 people
64     [Documentation]    Add 200 people
65         ${resp}         AddPerson       ${MEMBER1}      ${PORT} ${0}    
66         ${resp}         AddPerson       ${MEMBER1}      ${PORT}  ${200}
67         Should Be Equal As Strings    ${resp.status_code}    204
68
69 Add Car Person mapping
70     [Documentation]    Add Car Persons
71         ${resp}         AddCarPerson    ${MEMBER1}      ${PORT} ${0}    
72         ${resp}         BuyCar  ${MEMBER1}      ${PORT} ${200}  
73
74 Stop the Leader
75     ${CAR_LEADER}  GetLeader  ${CAR_SHARD}  ${3}  ${3}  ${1}  8181  ${MEMBER1}  ${MEMBER2}  ${MEMBER3}
76     Set Suite Variable    ${CAR_LEADER}
77     Stopcontroller    ${CAR_LEADER}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
78     Sleep    30
79     KillController    ${CAR_LEADER}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
80
81 Get all the cars from Follower 1
82     ${followers}  GetFollowers  ${CAR_SHARD}  ${3}  ${3}  ${1}  8181  ${MEMBER1}  ${MEMBER2}  ${MEMBER3}
83         ${resp}         Getcars ${followers[0]} ${PORT} ${0}
84         Should Be Equal As Strings    ${resp.status_code}    200
85         Should Contain     ${resp.content}   manufacturer1
86
87 Restart the Leader
88     Startcontroller   ${CAR_LEADER}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
89     Sleep    120
90
91 Get all the cars from Leader
92         ${resp}         Getcars ${CAR_LEADER}   ${PORT} ${0}
93         Should Be Equal As Strings    ${resp.status_code}    200
94         Should Contain     ${resp.content}   manufacturer1
95
96 Cleanup All Controllers 
97     [Documentation]    Stop all the controllers in the cluster
98     Stopcontroller    ${MEMBER1}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
99     Stopcontroller    ${MEMBER2}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
100     Stopcontroller    ${MEMBER3}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
101     Sleep    30
102
103
104