9 [Arguments] ${exclude_controller}=${EMPTY}
10 Log ${exclude_controller}
11 @{searchlist} Create List ${CONTROLLER} ${CONTROLLER1} ${CONTROLLER2}
12 Remove Values From List ${searchlist} ${exclude_controller}
14 [Return] ${searchlist}
17 [Arguments] ${shard_name} ${old_leader}=${EMPTY}
18 [Documentation] Returns the IP addr or hostname of the leader of the specified shard.
19 [Documentation] Controllers are specifed in the pybot command line.
20 ${searchlist} Get Controller List ${old_leader}
21 ${leader} GetLeader ${shard_name} ${3} ${3} ${1} ${PORT} @{searchlist}
22 Should Not Be Equal As Strings ${leader} None
23 Run Keyword If '${old_leader}'!='${EMPTY}' Should Not Be Equal ${old_leader} ${leader}
26 Wait For Leader To Be Found
27 [Arguments] ${shard_name}
28 [Documentation] Waits until the leader of the specified shard is found.
29 ${leader} Wait Until Keyword Succeeds 60s 2s Get Leader And Verify ${shard_name}
34 [Arguments] ${shard_name} ${current_leader}
35 [Documentation] Forces a change of leadership by shutting down the current leader.
36 Stop One Or More Controllers ${current_leader}
37 ${new_leader} Wait Until Keyword Succeeds 60s 2s Get Leader And Verify ${shard_name} ${current_leader}
38 # TODO: Future enhanement: make sure the other controller is a follower and not a master or candidate.
40 [Return] ${new_leader}
43 [Arguments] ${shard_name} ${exclude_controller}=${EMPTY}
44 [Documentation] Returns the IP addresses or hostnames of all followers of the specified shard.
45 ${searchlist} Get Controller List ${exclude_controller}
46 ${followers} GetFollowers ${shard_name} ${3} ${3} ${1} ${PORT} @{searchlist}
48 Should Not Be Empty ${followers}
52 [Documentation] Initializes shard and then adds the specified number of cars and performs a GET as a check.
53 [Arguments] ${controller_ip} ${num_cars} ${timeout}=60s
54 ${resp} InitCar ${controller_ip} ${PORT}
55 Should Be Equal As Strings ${resp.status_code} 204
56 ${resp} AddCar ${controller_ip} ${RESTCONFPORT} ${num_cars} 204
57 Should Be Equal As Strings ${resp.status_code} 204
58 Wait Until Keyword Succeeds ${timeout} 2s Get Cars And Verify ${controller_ip} ${num_cars}
60 Add Cars And Verify Without Init
61 [Documentation] Adds cars to an initialized cars shard then performs a GET as a check.
62 [Arguments] ${controller_ip} ${num_cars} ${timeout}=60s
63 Comment First car add may return 409, but subsequent should be 204
64 ${resp} AddCar ${controller_ip} ${RESTCONFPORT} ${num_cars} 204 409
65 Should Be Equal As Strings ${resp.status_code} 204
66 Wait Until Keyword Succeeds ${timeout} 2s Get Cars And Verify ${controller_ip} ${num_cars}
70 [Arguments] ${controller_ip} ${num_cars}
71 [Documentation] Gets cars and verifies that the manufacturer is correct.
72 # TODO: Future enhanement: verify all fields.
73 ${resp} Getcars ${controller_ip} ${RESTCONFPORT} ${0}
74 Should Be Equal As Strings ${resp.status_code} 200
75 :FOR ${i} IN RANGE 1 ${num_cars}+1
76 \ Should Contain ${resp.content} manufacturer${i}
79 [Arguments] ${controller_ip} ${num_people}
80 [Documentation] Note: The first AddPerson call passed with 0 posts directly to the data store to get
81 [Documentation] the people container created so the subsequent AddPerson RPC calls that put
82 [Documentation] to the person list will succeed.
83 ${resp} AddPerson ${controller_ip} ${RESTCONFPORT} ${0} 204
84 Should Be Equal As Strings ${resp.status_code} 204
85 Wait Until Keyword Succeeds 60s 2s Get One Person And Verify ${controller_ip} ${0}
86 ${resp} AddPerson ${controller_ip} ${RESTCONFPORT} ${num_people} 200
87 Wait Until Keyword Succeeds 60s 2s Get People And Verify ${controller_ip} ${num_people}
89 Get One Person And Verify
90 [Arguments] ${controller_ip} ${number}
91 [Documentation] Gets a person and verifies that the user ID is correct.
92 # TODO: Future enhanement: verify all fields.
93 ${resp} GetPersons ${controller_ip} ${RESTCONFPORT} ${0}
94 Should Be Equal As Strings ${resp.status_code} 200
95 Should Contain ${resp.content} user${number}
98 [Arguments] ${controller_ip} ${num_people}
99 [Documentation] Gets multiple people and verifies that the user IDs are correct.
100 # TODO: Future enhanement: verify all fields.
101 ${resp} GetPersons ${controller_ip} ${RESTCONFPORT} ${0}
102 Should Be Equal As Strings ${resp.status_code} 200
103 :FOR ${i} IN RANGE 1 ${num_people}+1
104 \ Should Contain ${resp.content} user${i}
106 Add Car Person And Verify
107 [Arguments] ${controller_ip}
108 [Documentation] Add a car-person via the data store and get the car-person from Leader.
109 [Documentation] Note: This is done to get the car-people container created so subsequent BuyCar
110 [Documentation] RPC puts to the car-person list will succeed.
111 AddCarPerson ${controller_ip} ${RESTCONFPORT} ${0}
112 Wait Until Keyword Succeeds 60s 2s Get One Car-Person Mapping And Verify ${controller_ip} ${0}
114 Get One Car-Person Mapping And Verify
115 [Arguments] ${controller_ip} ${number}
116 [Documentation] Gets a car person mapping and verifies that the user ID is correct.
117 ${resp} GetCarPersonMappings ${controller_ip} ${RESTCONFPORT} ${0}
118 Should Be Equal As Strings ${resp.status_code} 200
119 Should Contain ${resp.content} user${number}
121 Get Car-Person Mappings And Verify
122 [Arguments] ${controller_ip} ${num_entries}
123 ${resp} GetCarPersonMappings ${controller_ip} ${RESTCONFPORT} ${0}
124 Should Be Equal As Strings ${resp.status_code} 200
125 :FOR ${i} IN RANGE 1 ${num_entries}+1
126 \ Should Contain ${resp.content} user${i}
129 [Arguments] ${controller_ip} ${num_entries} ${start}=${0}
130 Wait Until Keyword Succeeds 60s 2s BuyCar ${controller_ip} ${RESTCONFPORT} ${num_entries} ${start}
133 [Arguments] ${controller_ip}
134 ${resp} Getcars ${controller_ip} ${RESTCONFPORT} ${0}
135 Should Be Equal As Strings ${resp.status_code} 404
137 Delete All Cars And Verify
138 [Arguments] ${controller_ip}
139 DeleteAllCars ${controller_ip} ${RESTCONFPORT} ${0}
140 Wait Until Keyword Succeeds 60s 2s Check Cars Deleted ${controller_ip}
143 [Arguments] ${controller_ip}
144 ${resp} GetPersons ${controller_ip} ${RESTCONFPORT} ${0}
145 Should Be Equal As Strings ${resp.status_code} 404
147 Delete All People And Verify
148 [Arguments] ${controller_ip}
149 DeleteAllPersons ${controller_ip} ${RESTCONFPORT} ${0}
150 Wait Until Keyword Succeeds 60s 2s Check People Deleted ${controller_ip}
152 Check Cars-Persons Deleted
153 [Arguments] ${controller_ip}
154 ${resp} GetCarPersonMappings ${controller_ip} ${RESTCONFPORT} ${0}
155 Should Be Equal As Strings ${resp.status_code} 404
157 Delete All Cars-Persons And Verify
158 [Arguments] ${controller_ip}
159 DeleteAllCarsPersons ${controller_ip} ${RESTCONFPORT} ${0}
160 Wait Until Keyword Succeeds 60s 2s Check Cars-Persons Deleted ${controller_ip}