Fixing mininet reads so that we always clear mininet
[integration/test.git] / test / csit / suites / controller / MD_SAL_Cluster_Datastore / 030_failover_crud_on_new_leader.txt
1 *** Settings ***
2 Documentation     This test brings down the current leader of the "car" shard and then executes CRUD operations on the new leader
3 Library           ../../../libraries/CrudLibrary.py
4 Library           ../../../libraries/UtilLibrary.py
5 Library           ../../../libraries/ClusterStateLibrary.py
6
7 *** Variables ***
8 ${SHARD}    shard-car-config
9
10 *** Test Cases ***
11 Switch Leader
12     [Documentation]    stop leader and elect new leader
13   ${OLD_LEADER}    GetLeader  ${SHARD}  ${3}  ${3}  ${2}  ${8181}  ${MEMBER1}  ${MEMBER2}  ${MEMBER3}
14   Stopcontroller  ${OLD_LEADER}  ${USERNAME}  ${PASSWORD}  ${KARAFHOME}
15   Sleep    30
16   ${NEW_LEADER}    GetLeader  ${SHARD}  ${3}  ${3}  ${2}  ${8181}  ${MEMBER1}  ${MEMBER2}  ${MEMBER3}
17   Log  ${NEW_LEADER}
18   Set Suite Variable    ${NEW_LEADER}
19
20 Delete cars at new leader
21     [Documentation]    delete cars
22   DeleteAllCars  ${NEW_LEADER}  ${PORT}  ${0}
23   ${resp}               Getcars ${NEW_LEADER}   ${PORT} ${0}
24   Should Be Equal As Strings    ${resp.status_code}    404
25
26 Delete people at new leader
27     [Documentation]    delete people
28         DeleteAllPersons  ${NEW_LEADER}  ${PORT}  ${0}
29         ${resp}         GetPersons      ${NEW_LEADER}   ${PORT} ${0}
30   Should Be Equal As Strings    ${resp.status_code}    404
31
32 Add cars and get cars from new leader
33     [Documentation]    Add 50 cars and get added cars from Leader
34         ${resp}         AddCar  ${NEW_LEADER}   ${PORT} ${50}
35         Sleep    10
36         ${resp}         Getcars ${NEW_LEADER}   ${PORT} ${0}
37         Should Be Equal As Strings    ${resp.status_code}    200
38         Should Contain     ${resp.content}   manufacturer1
39         Should Contain     ${resp.content}   manufacturer50
40         Should Not Contain     ${resp.content}   manufacturer60
41
42 Add people and get people from leader
43     [Documentation]    Add 50 persons and get people
44     [Documentation]    Note: There should be one person added first to enable rpc
45         ${resp}         AddPerson       ${NEW_LEADER}   ${PORT} ${0}
46         ${resp}         AddPerson       ${NEW_LEADER}   ${PORT} ${50}
47         Sleep    10
48         ${resp}         GetPersons      ${NEW_LEADER}   ${PORT} ${0}
49         Should Be Equal As Strings    ${resp.status_code}    200
50         Should Contain     ${resp.content}   user2
51         Should Contain     ${resp.content}   user50
52         Should Not Contain     ${resp.content}   user60
53
54 Purchase 50 cars at new leader
55     [Documentation]     Add car-person and get car-person from Leader
56     [Documentation]  Note: This is done to enable working of rpc
57     [Documentation]  Purchase 50 cars using Leader
58   ${resp}               AddCarPerson    ${NEW_LEADER}   ${PORT} ${0}
59         ${resp}         GetCarPersonMappings    ${NEW_LEADER}   ${PORT} ${0}
60         Should Be Equal As Strings    ${resp.status_code}    200
61         Should Contain     ${resp.content}   user0
62         ${resp}         BuyCar  ${NEW_LEADER}   ${PORT} ${50}
63         Sleep    10
64
65 Get car-person mappings at new Leader
66    [Documentation]      Get car-person mappings using new leader to see 50 entry
67         ${resp}         GetCarPersonMappings    ${NEW_LEADER}   ${PORT} ${0}
68         Should Be Equal As Strings    ${resp.status_code}    200
69         Should Contain     ${resp.content}   user5
70         Should Contain     ${resp.content}   user50