2 Documentation This test finds the leader for shards in a 3-Node cluster and executes CRUD operations on them
5 Library ../../../libraries/RequestsLibrary.py
6 Library ../../../libraries/Common.py
7 Library ../../../libraries/CrudLibrary.py
8 Library ../../../libraries/SettingsLibrary.py
9 Library ../../../libraries/UtilLibrary.py
10 Library ../../../libraries/ClusterStateLibrary.py
11 Variables ../../../variables/Variables.py
15 ${REST_CONTEXT} /restconf/config/
16 ${SHARD_CAR_NAME} shard-car-config
17 ${SHARD_PEOPLE_NAME} shard-people-config
18 ${SHARD_CAR_PERSON_NAME} shard-car-people-config
22 Add cars and get cars from Leader
23 [Documentation] Add some cars and get added cars from Leader
24 ${CURRENT_CAR_LEADER} GetLeader ${SHARD_CAR_NAME} ${3} ${3} ${1} ${PORT} ${MEMBER1} ${MEMBER2} ${MEMBER3}
25 Log CURRENT_CAR_SHARD_LEADER ${CURRENT_CAR_LEADER}
26 Should Not Be Equal As Strings ${CURRENT_CAR_LEADER} None
27 Set Suite Variable ${CURRENT_CAR_LEADER}
28 ${resp} AddCar ${CURRENT_CAR_LEADER} ${PORT} ${NUM_ENTRIES}
29 ${resp} Getcars ${CURRENT_CAR_LEADER} ${PORT} ${0}
30 Should Be Equal As Strings ${resp.status_code} 200
31 :FOR ${i} IN RANGE 1 ${NUM_ENTRIES}
32 \ Should Contain ${resp.content} manufacturer${i}
34 Get added cars using Follower1
35 [Documentation] Get added cars using Follower1
36 ${FOLLOWERS} GetFollowers ${SHARD_CAR_PERSON_NAME} ${3} ${3} ${1} ${PORT} ${MEMBER1} ${MEMBER2} ${MEMBER3}
38 SET SUITE VARIABLE ${FOLLOWERS}
39 ${resp} Getcars @{FOLLOWERS}[0] ${PORT} ${0}
40 Should Be Equal As Strings ${resp.status_code} 200
41 :FOR ${i} IN RANGE 1 ${NUM_ENTRIES}
42 \ Should Contain ${resp.content} manufacturer${i}
44 Get added cars using Follower2
45 [Documentation] Get added cars using Follower2
46 ${resp} Getcars @{FOLLOWERS}[1] ${PORT} ${0}
47 Should Be Equal As Strings ${resp.status_code} 200
48 :FOR ${i} IN RANGE 1 ${NUM_ENTRIES}
49 \ Should Contain ${resp.content} manufacturer${i}
51 Add persons and get persons from Leader
52 [Documentation] Add some persons and get persons
53 [Documentation] Note: There should be one person added first to enable rpc
54 ${CURRENT_PEOPLE_LEADER} GetLeader ${SHARD_PEOPLE_NAME} ${3} ${3} ${1} ${PORT} ${MEMBER1} ${MEMBER2} ${MEMBER3}
55 Log CURRENT_PEOPLE_SHARD_LEADER ${CURRENT_PEOPLE_LEADER}
56 Should Not Be Equal As Strings ${CURRENT_PEOPLE_LEADER} None
57 Set Suite Variable ${CURRENT_PEOPLE_LEADER}
58 ${resp} AddPerson ${CURRENT_PEOPLE_LEADER} ${PORT} ${0}
59 Should Be Equal As Strings ${resp.status_code} 204
60 ${resp} AddPerson ${CURRENT_PEOPLE_LEADER} ${PORT} ${NUM_ENTRIES}
61 ${resp} GetPersons ${CURRENT_PEOPLE_LEADER} ${PORT} ${0}
62 Should Be Equal As Strings ${resp.status_code} 200
63 :FOR ${i} IN RANGE 1 ${NUM_ENTRIES}
64 \ Should Contain ${resp.content} user${i}
66 Add car-person mapping and get car-person mapping from Leader
67 [Documentation] Add car-person and get car-person from Leader
68 [Documentation] Note: This is done to enable working of rpc
69 ${CURRENT_CAR_PERSON_LEADER} GetLeader ${SHARD_CAR_PERSON_NAME} ${3} ${3} ${1} ${PORT} ${MEMBER1} ${MEMBER2} ${MEMBER3}
70 Set Suite Variable ${CURRENT_CAR_PERSON_LEADER}
71 ${resp} AddCarPerson ${CURRENT_CAR_PERSON_LEADER} ${PORT} ${0}
73 ${resp} GetCarPersonMappings ${CURRENT_CAR_PERSON_LEADER} ${PORT} ${0}
74 Should Be Equal As Strings ${resp.status_code} 200
75 Should Contain ${resp.content} user0
77 Purchase cars using Leader
78 [Documentation] Purchase some cars using Leader
79 ${resp} BuyCar ${CURRENT_CAR_PERSON_LEADER} ${PORT} ${NUM_ENTRIES}
82 Get car-person mappings using Leader
83 [Documentation] Get car-person mappings using Leader to see 100 entry
84 ${resp} GetCarPersonMappings ${CURRENT_CAR_PERSON_LEADER} ${PORT} ${0}
85 Should Be Equal As Strings ${resp.status_code} 200
86 :FOR ${i} IN RANGE 1 ${NUM_ENTRIES}
87 \ Should Contain ${resp.content} user${i}
89 Get car-person mappings using Follower1
90 [Documentation] Get car-person mappings using Follower1 to see 100 entry
91 ${resp} GetCarPersonMappings @{FOLLOWERS}[0] ${PORT} ${0}
92 Should Be Equal As Strings ${resp.status_code} 200
93 :FOR ${i} IN RANGE 1 ${NUM_ENTRIES}
94 \ Should Contain ${resp.content} user${i}
96 Get car-person mappings using Follower2
97 [Documentation] Get car-person mappings using Follower2 to see 100 entry
98 ${resp} GetCarPersonMappings @{FOLLOWERS}[1] ${PORT} ${0}
99 Should Be Equal As Strings ${resp.status_code} 200
100 :FOR ${i} IN RANGE 1 ${NUM_ENTRIES}
101 \ Should Contain ${resp.content} user${i}