blob: 4df8d9461edf3f3a52ebd7be6c76ac6a625b59ef [file] [log] [blame]
Vijaybc331e22020-02-27 04:17:37 -06001*** Settings ***
2
Sushil Singhd03f2ce2020-09-17 08:54:41 -05003Documentation Test lock management feature of management console on BMC.
Vijaybc331e22020-02-27 04:17:37 -06004
Sushil Singhd03f2ce2020-09-17 08:54:41 -05005Resource ../../lib/resource.robot
6Resource ../../lib/openbmc_ffdc.robot
7Resource ../../lib/bmc_redfish_utils.robot
8Resource ../../lib/external_intf/management_console_utils.robot
Sushil Singh977f8f52020-11-20 06:32:50 -06009Resource ../../lib/rest_response_code.robot
Sushil Singh728ef9c2020-10-28 04:25:39 -050010Library ../../lib/bmc_network_utils.py
Vijaybc331e22020-02-27 04:17:37 -060011
Sushil Singhd03f2ce2020-09-17 08:54:41 -050012Suite Setup Run Keyword And Ignore Error Delete All Redfish Sessions
Sushil Singhdf390b62021-01-19 00:50:05 -060013Suite Teardown Run Keyword And Ignore Error Delete All Redfish Sessions
Sushil Singhd03f2ce2020-09-17 08:54:41 -050014Test Setup Printn
15Test Teardown FFDC On Test Case Fail
Vijaybc331e22020-02-27 04:17:37 -060016
17*** Variables ***
18
Sushil Singhd03f2ce2020-09-17 08:54:41 -050019${BAD_REQUEST} Bad Request
Vijaybc331e22020-02-27 04:17:37 -060020
21*** Test Cases ***
22
Sushil Singhd03f2ce2020-09-17 08:54:41 -050023Acquire Read Write Lock
Vijaybc331e22020-02-27 04:17:37 -060024 [Documentation] Acquire and release different read locks.
Sushil Singhd03f2ce2020-09-17 08:54:41 -050025 [Tags] Acquire_Read_Write_Lock
26 [Template] Acquire Lock On Resource
Vijaybc331e22020-02-27 04:17:37 -060027
Sushil Singhd03f2ce2020-09-17 08:54:41 -050028 # client_id lock_type reboot_flag
29 HMCID-01 ReadCase1 False
30 HMCID-01 ReadCase2 False
31 HMCID-01 ReadCase3 False
32 HMCID-01 WriteCase1 False
33 HMCID-01 WriteCase2 False
34 HMCID-01 WriteCase3 False
Vijaybc331e22020-02-27 04:17:37 -060035
36
Sushil Singhd03f2ce2020-09-17 08:54:41 -050037Check Lock Persistency On BMC Reboot
38 [Documentation] Acquire lock and check after reboot it remain same.
39 [Tags] Check_Lock_Persistency_On_BMC_Reboot
40 [Template] Acquire Lock On Resource
Vijaybc331e22020-02-27 04:17:37 -060041
Sushil Singhd03f2ce2020-09-17 08:54:41 -050042 # client_id lock_type reboot_flag
43 HMCID-01 ReadCase1 True
44 HMCID-01 ReadCase2 True
45 HMCID-01 ReadCase3 True
46 HMCID-01 WriteCase1 True
47 HMCID-01 WriteCase2 True
48 HMCID-01 WriteCase3 True
Vijaybc331e22020-02-27 04:17:37 -060049
50
Sushil Singhd03f2ce2020-09-17 08:54:41 -050051Acquire Read Lock On Read Lock
52 [Documentation] Acquire read lock on another read lock.
53 [Tags] Acquire_Read_Lock_On_Read_Lock
54 [Template] Acquire Lock On Another Lock
Vijaybc331e22020-02-27 04:17:37 -060055
Sushil Singhd03f2ce2020-09-17 08:54:41 -050056 # client_id
57 HMCID-01
Vijaybc331e22020-02-27 04:17:37 -060058
59
Sushil Singhd03f2ce2020-09-17 08:54:41 -050060Fail To Acquire Lock On Another Lock
61 [Documentation] Fail to acquire another lock.
62 [Tags] Fail_To_Acquire_Lock_On_Another_Lock
63 [Template] Verify Acquire Lock Fails On Another Lock
Vijay85610ee2020-04-03 05:30:28 -050064
Sushil Singhd03f2ce2020-09-17 08:54:41 -050065 # client_id lock_type
66 HMCID-01 ReadCase2,WriteCase2
67 HMCID-01 WriteCase2,WriteCase2
68 HMCID-01 WriteCase2,ReadCase2
George Keishing566daaf2020-07-02 06:18:50 -050069
70
Sushil Singhe33c6e62020-09-29 06:34:35 -050071Acquire Lock After Reboot
72 [Documentation] Acquire and release read and write locks after reboot.
73 [Tags] Acquire_Lock_After_Reboot
74 [Template] Verify Acquire Lock After Reboot
75
76 # client_id lock_type
77 HMCID-01 ReadCase1
78 HMCID-01 ReadCase2
79 HMCID-01 ReadCase3
80 HMCID-01 WriteCase1
81 HMCID-01 WriteCase2
82 HMCID-01 WriteCase3
83
84
Sushil Singhd03f2ce2020-09-17 08:54:41 -050085Acquire And Release Lock In Loop
86 [Documentation] Acquire and release read, write locks in loop.
87 [Tags] Acquire_And_Release_Lock_In_Loop
88 [Template] Verify Acquire And Release Lock In Loop
George Keishing566daaf2020-07-02 06:18:50 -050089
Sushil Singhd03f2ce2020-09-17 08:54:41 -050090 # client_id lock_type
91 HMCID-01 ReadCase1
92 HMCID-01 ReadCase2
93 HMCID-01 ReadCase3
94 HMCID-01 WriteCase1
95 HMCID-01 WriteCase2
96 HMCID-01 WriteCase3
Vijay85610ee2020-04-03 05:30:28 -050097
98
Sushil Singh977f8f52020-11-20 06:32:50 -060099Fail To Acquire Read And Write In Single Request
100 [Documentation] Fail to acquire read and write lock in single request.
101 [Tags] Fail_To_Acquire_Read_And_Write_In_Single_Request
102 [Template] Verify Fail To Acquire Read And Write In Single Request
103
104 # client_id lock_type
105 HMCID-01 ReadCase1,WriteCase1
106 HMCID-01 WriteCase1,ReadCase1
107
108
Sushil Singhdf390b62021-01-19 00:50:05 -0600109Acquire Multiple Lock Request At CEC Level
110 [Documentation] Acquire write lock on read lock under CEC level.
111 [Tags] Acquire_Multiple_Lock_Request_At_CEC_Level
112 [Template] Verify Acquire Multiple Lock Request At CEC Level
113
114 # client_id lock_type
115 HMCID-01 ReadCase4,WriteCase4
116 HMCID-01 WriteCase5,ReadCase5
117 HMCID-01 ReadCase6,WriteCase6
118 HMCID-01 WriteCase7,ReadCase7
119
120
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500121Verify Release Of Valid Locks
122 [Documentation] Release all valid locks.
123 [Tags] Verify_Release_Of_Valid_Locks
124 [Template] Acquire And Release Multiple Locks
Vijayafdd2a12020-04-09 02:03:20 -0500125
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500126 # client_id lock_type release_lock_type
127 HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction
128 HMCID-02 ReadCase1,ReadCase1,ReadCase1 Session
Vijayafdd2a12020-04-09 02:03:20 -0500129
130
Sushil Singh59011d02021-01-27 23:00:20 -0600131Fail To Release Lock With Invalid TransactionID
132 [Documentation] Fail to release lock with invalid transaction id.
133 [Tags] Fail_To_Release_Lock_With_Invalid_TransactionID
134 [Template] Verify Fail To Release Lock With Invalid TransactionID
135
susilsi743b0c062021-03-02 04:24:19 -0600136 # client_id lock_type release_lock_type
137 HMCID-01 ReadCase1 Transaction
138 HMCID-01 WriteCase1 Transaction
Sushil Singh59011d02021-01-27 23:00:20 -0600139
140
Sushil Singh1b590532021-01-20 05:13:54 -0600141Fail To Release Multiple Lock With Invalid TransactionID
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500142 [Documentation] Release in-valid lock result in fail.
Sushil Singh1b590532021-01-20 05:13:54 -0600143 [Tags] Fail_To_Release_Multiple_Lock_With_Invalid_TransactionID
144 [Template] Verify Fail To Release Multiple Lock With Invalid TransactionID
Vijayafdd2a12020-04-09 02:03:20 -0500145
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500146 # client_id lock_type release_lock_type
147 HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction
148 12345 ReadCase2,ReadCase2,ReadCase2 Transaction
149 HMCID ReadCase3,ReadCase3,ReadCase3 Transaction
Vijayafdd2a12020-04-09 02:03:20 -0500150
151
Sushil Singh8bee3582021-01-27 23:46:48 -0600152Fail To Release Multiple Lock With Valid And Invalid TransactionID
153 [Documentation] Release multiple lock with valid and invalid trasaction.
154 [Tags] Fail_To_Release_Multiple_Lock_With_Valid_And_Invalid_TransactionID
155 [Template] Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID
156
157 # client_id lock_type release_lock_type
158 HMCID-01 ReadCase1,ReadCase1 Transaction
159
160
susilsi71d7b9962021-03-02 03:06:18 -0600161Fail To Release Lock With String As TransactionID Data Type
162 [Documentation] Fail to release lock with string as transaction id data type.
163 [Tags] Fail_To_Release_Lock_With_String_As_TransactionID_Data_Type
164 [Template] Verify Fail To Release Lock With TransactionID As String Type
165
166 # client_id lock_type release_lock_type
167 HMCID-01 ReadCase1 Transaction
168 HMCID-01 WriteCase1 Transaction
169
170
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500171Fail To Release Lock For Another Session
172 [Documentation] Failed to release locks from another session.
173 [Tags] Fail_To_Release_Lock_For_Another_Session
174 [Template] Verify Fail To Release Lock For Another Session
Vijayafdd2a12020-04-09 02:03:20 -0500175
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500176 # client_id lock_type
177 HMCID-01,HMCID-02 ReadCase1,ReadCase1
Vijayafdd2a12020-04-09 02:03:20 -0500178
179
Sushil Singhe33c6e62020-09-29 06:34:35 -0500180Test Invalid Resource ID Data Type Locking
181 [Documentation] Failed to acquire lock for invalid resource id data type.
182 [Tags] Test_Invalid_Resource_ID_Data_Type_Locking
183 [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type
184
185 # client_id lock_type
186 HMCID-01 ReadCase1
187 HMCID-01 ReadCase2
188 HMCID-01 ReadCase3
189 HMCID-01 WriteCase1
190 HMCID-01 WriteCase2
191 HMCID-01 WriteCase3
192
193
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500194Fail To Acquire Lock For Invalid Lock Type
195 [Documentation] Failed to acquire read, write lock for invalid lock data passed.
196 [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type
197 [Template] Verify Fail To Acquire Lock For Invalid Lock Data
Vijayafdd2a12020-04-09 02:03:20 -0500198
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500199 # client_id lock_type message
200 HMCID-01 ReadCase1 ${BAD_REQUEST}
201 HMCID-01 ReadCase2 ${BAD_REQUEST}
202 HMCID-01 ReadCase3 ${BAD_REQUEST}
203 HMCID-01 ReadCase4 ${BAD_REQUEST}
204 HMCID-01 ReadCase5 ${BAD_REQUEST}
205 HMCID-01 WriteCase1 ${BAD_REQUEST}
206 HMCID-01 WriteCase2 ${BAD_REQUEST}
207 HMCID-01 WriteCase3 ${BAD_REQUEST}
208 HMCID-01 WriteCase4 ${BAD_REQUEST}
209 HMCID-01 WriteCase5 ${BAD_REQUEST}
Vijayafdd2a12020-04-09 02:03:20 -0500210
Vijayafdd2a12020-04-09 02:03:20 -0500211
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500212Fail To Acquire Lock For Invalid Lock Flag
213 [Documentation] Failed to acquire read write lock for invalid lock flag passed.
214 [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag
215 [Template] Verify Fail To Acquire Lock For Invalid Lock Data
Vijayafdd2a12020-04-09 02:03:20 -0500216
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500217 # client_id lock_type message
218 HMCID-01 ReadCase6 ${BAD_REQUEST}
219 HMCID-01 ReadCase7 ${BAD_REQUEST}
220 HMCID-01 ReadCase8 ${BAD_REQUEST}
221 HMCID-01 ReadCase9 ${BAD_REQUEST}
222 HMCID-01 ReadCase10 ${BAD_REQUEST}
223 HMCID-01 ReadCase11 ${BAD_REQUEST}
224 HMCID-01 WriteCase6 ${BAD_REQUEST}
225 HMCID-01 WriteCase7 ${BAD_REQUEST}
226 HMCID-01 WriteCase8 ${BAD_REQUEST}
227 HMCID-01 WriteCase9 ${BAD_REQUEST}
228 HMCID-01 WriteCase10 ${BAD_REQUEST}
229 HMCID-01 WriteCase11 ${BAD_REQUEST}
Vijayafdd2a12020-04-09 02:03:20 -0500230
Vijayafdd2a12020-04-09 02:03:20 -0500231
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500232Fail To Acquire Lock For Invalid Segment Flag
233 [Documentation] Failed to acquire read write lock for invalid segment flag passed.
234 [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag
235 [Template] Verify Fail To Acquire Lock For Invalid Lock Data
236
237 # client_id lock_type message
238 HMCID-01 ReadCase12 ${BAD_REQUEST}
239 HMCID-01 ReadCase13 ${BAD_REQUEST}
240 HMCID-01 ReadCase14 ${BAD_REQUEST}
241 HMCID-01 WriteCase12 ${BAD_REQUEST}
242 HMCID-01 WriteCase13 ${BAD_REQUEST}
243 HMCID-01 WriteCase14 ${BAD_REQUEST}
Vijayafdd2a12020-04-09 02:03:20 -0500244
Sushil Singhbace3002020-10-08 08:12:58 -0500245
Sushil Singh3b3a7ec2020-11-23 03:54:06 -0600246Fail To Acquire Lock For Invalid Segment Data Type Flag
247 [Documentation] Failed to acquire read write lock for invalid segment flag passed.
248 [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Data_Type_Flag
249 [Template] Verify Fail To Acquire Lock For Invalid Lock Data
250
251 # client_id lock_type message
252 HMCID-01 ReadCase15 ${EMPTY}
253 HMCID-01 ReadCase16 ${EMPTY}
254 HMCID-01 ReadCase17 ${EMPTY}
255 HMCID-01 ReadCase18 ${EMPTY}
256 HMCID-01 WriteCase15 ${EMPTY}
257 HMCID-01 WriteCase16 ${EMPTY}
258 HMCID-01 WriteCase17 ${EMPTY}
259 HMCID-01 WriteCase18 ${EMPTY}
260
261
Sushil Singhbace3002020-10-08 08:12:58 -0500262Get Empty Lock Records For Session Where No Locks Acquired
263 [Documentation] If session does not acquire locks then get lock should return
264 ... empty lock records.
265 [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired
266 [Template] Verify No Locks Records For Session With No Acquired Lock
267
268 # client_id
269 HMCID-01
270
Sushil Singh728ef9c2020-10-28 04:25:39 -0500271
Sushil Singhf9a536c2020-11-09 07:33:17 -0600272Get Lock Records Empty For Invalid Session
273 [Documentation] Record of lock list is empty for invalid session.
274 [Tags] Get_Lock_Records_Empty_For_Invalid_Session
275 [Template] Verify Empty Lock Records For Invalid Session
276
277 # client_id
278 HMCID-01
279
280
Sushil Singh728ef9c2020-10-28 04:25:39 -0500281Get Lock Records For Multiple Session
282 [Documentation] Get lock records of multiple session.
283 [Tags] Get_Lock_Records_For_Multiple_Session
284 [Template] Verify Lock Records Of Multiple Session
285
286 # client_ids lock_type
287 HMCID-01,HMCID-02 ReadCase1,ReadCase1
288
289
Sushil Singhf9a536c2020-11-09 07:33:17 -0600290Get Lock Records For Multiple Invalid Session
291 [Documentation] Record of lock list is empty for list of invalid session.
292 [Tags] Get_Lock_Records_For_Multiple_Invalid_Session
293 [Template] Verify Lock Records For Multiple Invalid Session
294
295 # client_id
296 HMCID-01
297
Sushil Singh11949a22020-11-13 06:12:16 -0600298
299Get Lock Records For Multiple Invalid And Valid Session
300 [Documentation] Get record of lock from invalid and valid session.
301 [Tags] Get_Lock_Records_For_Multiple_Invalid_And_Valid_Session
302 [Template] Verify Lock Records For Multiple Invalid And Valid Session
303
304 # client_id lock_type
305 HMCID-01,HMCID-02 ReadCase1
306
Vijaybc331e22020-02-27 04:17:37 -0600307*** Keywords ***
308
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500309Create Redfish Session With ClientID
310 [Documentation] Create redifish session with client id.
311 [Arguments] ${client_id}
Vijay85610ee2020-04-03 05:30:28 -0500312
313 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500314 # client_id This client id can contain string value
315 # (e.g. 12345, "HMCID").
Vijay85610ee2020-04-03 05:30:28 -0500316
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500317 ${session_info}= Create Dictionary
318 ${session}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}}
Vijay85610ee2020-04-03 05:30:28 -0500319
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500320 Set To Dictionary ${session_info} SessionIDs ${session['Id']}
321 Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]}
Vijay85610ee2020-04-03 05:30:28 -0500322
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500323 [Return] ${session_info}
Vijay85610ee2020-04-03 05:30:28 -0500324
325
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500326RW General Dictionary
George Keishing16b3c7b2021-01-28 09:23:37 -0600327 [Documentation] Create dictionary of lock request.
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500328 [Arguments] ${read_case} ${res_id}
Vijaybc331e22020-02-27 04:17:37 -0600329
330 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500331 # read_case Read or Write lock type.
332 # res_id Resource id.
Vijaybc331e22020-02-27 04:17:37 -0600333
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500334 ${request_dict}= Create Dictionary
George Keishing566daaf2020-07-02 06:18:50 -0500335
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500336 FOR ${key} IN @{read_case.keys()}
337 Set To Dictionary ${request_dict} LockType ${key}
338 Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]}
339 END
Vijaybc331e22020-02-27 04:17:37 -0600340
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500341 Set To Dictionary ${request_dict} ResourceID ${res_id}
342
343 [Return] ${request_dict}
Vijaybc331e22020-02-27 04:17:37 -0600344
345
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500346Return Description Of Response
347 [Documentation] Return description of REST response.
Vijaybc331e22020-02-27 04:17:37 -0600348 [Arguments] ${resp_text}
349
350 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500351 # resp_text REST response body.
Vijaybc331e22020-02-27 04:17:37 -0600352
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500353 # resp_text after successful partition file upload looks like:
354 # {
355 # "Description": "File Created"
356 # }
Vijaybc331e22020-02-27 04:17:37 -0600357
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500358 ${message}= Evaluate json.loads('''${resp_text}''') json
359
360 [Return] ${message}
Vijaybc331e22020-02-27 04:17:37 -0600361
362
Sushil Singha7d71f02020-11-02 05:24:22 -0600363Verify Redfish Session Deleted
364 [Documentation] Verify the redfish session is deleted.
365 [Arguments] ${session_info}
366
367 # Description of argument(s):
368 # session_info Session information are stored in dictionary.
369
370 # ${session_info} = {
371 # 'SessionIDs': 'XXXXXXXXX',
372 # 'ClientID': 'XXXXXX',
373 # 'SessionToken': 'XXXXXXXXX',
374 # 'SessionResp': session response from redfish login
375 # }
376
377 # SessionIDs : Session IDs
378 # ClientID : Client ID
379 # SessionToken : Session token
380 # SessionResp : Response of creating an redfish login session
381
382 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions
383
384 FOR ${session} IN @{sessions['Members']}
385 Should Not Be Equal As Strings session ['/redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}']
386 END
387
388
389Verify Redfish List Of Session Deleted
390 [Documentation] Verify all the list of redfish session is deleted.
391 [Arguments] ${session_info_list}
392
393 # Description of argument(s):
394 # session_info_list List contains individual session record are stored in dictionary.
395
396 # ${session_info_list} = [{
397 # 'SessionIDs': 'XXXXXXXXX',
398 # 'ClientID': 'XXXXXX',
399 # 'SessionToken': 'XXXXXXXXX',
400 # 'SessionResp': session response from redfish login
401 # }]
402
403 # SessionIDs : Session IDs
404 # ClientID : Client ID
405 # SessionToken : Session token
406 # SessionResp : Response of creating an redfish login session
407
408 FOR ${session_record} IN @{session_info_list}
409 Verify Redfish Session Deleted ${session_record}
410 END
411
412
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500413Redfish Post Acquire Lock
414 [Documentation] Acquire and release lock.
415 [Arguments] ${lock_type} ${status_code}=${HTTP_OK}
Vijaybc331e22020-02-27 04:17:37 -0600416
417 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500418 # lock_type Read lock or Write lock.
419 # status_code HTTP status code.
Vijaybc331e22020-02-27 04:17:37 -0600420
Sushil Singhe33c6e62020-09-29 06:34:35 -0500421 ${lock_dict_param}= Form Data To Acquire Lock ${lock_type}
422 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500423 Should Be Equal As Strings ${resp.status_code} ${status_code}
Sushil Singhdf390b62021-01-19 00:50:05 -0600424
425 Run Keyword If ${status_code} == ${HTTP_BAD_REQUEST}
426 ... Valid Value ${BAD_REQUEST} ['${resp.content}']
427 ... ELSE
428 ... Run Keyword And Return Return Description Of Response ${resp.content}
Vijaybc331e22020-02-27 04:17:37 -0600429
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500430 [Return] ${resp}
Vijaybc331e22020-02-27 04:17:37 -0600431
432
Sushil Singh977f8f52020-11-20 06:32:50 -0600433Redfish Post Acquire List Lock
434 [Documentation] Acquire and release lock.
435 [Arguments] ${lock_type} ${status_code}=${HTTP_OK}
436
437 # Description of argument(s):
438 # lock_type Read lock or Write lock.
439 # status_code HTTP status code.
440
441 ${lock_dict_param}= Create Data To Acquire List Of Lock ${lock_type}
442 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param}
443 Should Be Equal As Strings ${resp.status_code} ${status_code}
444
445 [Return] ${resp}
446
447
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500448Redfish Post Acquire Invalid Lock
449 [Documentation] Redfish to post request to acquire in-valid lock.
450 [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK}
Vijaybc331e22020-02-27 04:17:37 -0600451
452 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500453 # lock_type Read lock or Write lock.
454 # message Return message from URI.
455 # status_code HTTP status code.
Vijaybc331e22020-02-27 04:17:37 -0600456
Sushil Singhe33c6e62020-09-29 06:34:35 -0500457 ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type}
458 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500459 Should Be Equal As Strings ${resp.status_code} ${status_code}
Sushil Singh3b3a7ec2020-11-23 03:54:06 -0600460 Run Keyword If '${message}' != '${EMPTY}'
461 ... Valid Value message ['${resp.content}']
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500462
463 [Return] ${resp}
Vijaybc331e22020-02-27 04:17:37 -0600464
465
Sushil Singhe33c6e62020-09-29 06:34:35 -0500466Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID
467 [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id.
468 [Arguments] ${lock_type} ${status_code}=${HTTP_OK}
469
470 # Description of argument(s):
471 # lock_type Read lock or Write lock.
472 # status_code HTTP status code.
473
474 ${lock_dict_param}= Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type}
475 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param}
476 Should Be Equal As Strings ${resp.status_code} ${status_code}
477
478 [Return] ${resp}
479
480
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500481Form Data To Acquire Lock
George Keishing16b3c7b2021-01-28 09:23:37 -0600482 [Documentation] Create a dictionary for lock request.
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500483 [Arguments] ${lock_type}
484
485 # Description of argument(s):
486 # lock_type Read lock or Write lock.
487
488 ${lock_res_info}= Get Lock Resource Information
489 ${resp}= RW General Dictionary
490 ... ${lock_res_info["Valid Case"]["${lock_type}"]}
491 ... ${lock_res_info["Valid Case"]["ResourceID"]}
492 ${temp_list}= Create List ${resp}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500493 ${lock_request_dict}= Create Dictionary Request=${temp_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500494
Sushil Singhe33c6e62020-09-29 06:34:35 -0500495 [Return] ${lock_request_dict}
496
497
Sushil Singh977f8f52020-11-20 06:32:50 -0600498Create Data To Acquire List Of Lock
George Keishing16b3c7b2021-01-28 09:23:37 -0600499 [Documentation] Create a dictionary for list of lock request.
Sushil Singh977f8f52020-11-20 06:32:50 -0600500 [Arguments] ${lock_type_list}
501
502 # Description of argument(s):
503 # lock_type Read lock or Write lock.
504
505 ${temp_list}= Create List
506 ${lock_res_info}= Get Lock Resource Information
507
508 FOR ${lock_type} IN @{lock_type_list}
509 ${resp}= RW General Dictionary
510 ... ${lock_res_info["Valid Case"]["${lock_type}"]}
511 ... ${lock_res_info["Valid Case"]["ResourceID"]}
512 Append To List ${temp_list} ${resp}
513 END
514
515 ${lock_request_dict}= Create Dictionary Request=${temp_list}
516
517 [Return] ${lock_request_dict}
518
519
Sushil Singhe33c6e62020-09-29 06:34:35 -0500520Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID
George Keishing16b3c7b2021-01-28 09:23:37 -0600521 [Documentation] Create a dictionary for in-valid lock request.
Sushil Singhe33c6e62020-09-29 06:34:35 -0500522 [Arguments] ${lock_type}
523
524 # Description of argument(s):
525 # lock_type Read lock or Write lock.
526
527 ${lock_res_info}= Get Lock Resource Information
528 ${resp}= RW General Dictionary
529 ... ${lock_res_info["Valid Case"]["${lock_type}"]}
530 ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]}
531 ${temp_list}= Create List ${resp}
532 ${lock_request_dict}= Create Dictionary Request=${temp_list}
533
534 [Return] ${lock_request_dict}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500535
536
537Form Data To Acquire Invalid Lock
George Keishing16b3c7b2021-01-28 09:23:37 -0600538 [Documentation] Create a dictionary for in-valid lock request.
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500539 [Arguments] ${lock_type}
540
541 # Description of argument(s):
542 # lock_type Read lock or Write lock.
543
544 ${lock_res_info}= Get Lock Resource Information
545 ${resp}= RW General Dictionary
546 ... ${lock_res_info["Invalid Case"]["${lock_type}"]}
547 ... ${lock_res_info["Valid Case"]["ResourceID"]}
548 ${temp_list}= Create List ${resp}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500549 ${lock_request_dict}= Create Dictionary Request=${temp_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500550
Sushil Singhe33c6e62020-09-29 06:34:35 -0500551 [Return] ${lock_request_dict}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500552
553
554Get Locks List On Resource
Vijaybc331e22020-02-27 04:17:37 -0600555 [Documentation] Get locks list.
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500556 [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK}
Vijaybc331e22020-02-27 04:17:37 -0600557
558 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500559 # session_info Session information in dict.
560 # exp_status_code Expected HTTP status code.
Vijaybc331e22020-02-27 04:17:37 -0600561
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500562 ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]}
George Keishing566daaf2020-07-02 06:18:50 -0500563 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList
564 ... data=${data}
Vijaybc331e22020-02-27 04:17:37 -0600565 ${locks}= Evaluate json.loads('''${resp.text}''') json
566
567 [Return] ${locks["Records"]}
568
569
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500570Verify Lock On Resource
571 [Documentation] Verify lock on resource.
572 [Arguments] ${session_info} ${transaction_id}
Vijaybc331e22020-02-27 04:17:37 -0600573
574 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500575 # session_info Session information in dict.
576 # transaction_id Transaction id in list stored in dict.
Vijaybc331e22020-02-27 04:17:37 -0600577
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500578 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']}
579 Rprint Vars sessions
580 ${lock_list}= Get Locks List On Resource ${session_info}
581 ${lock_length}= Get Length ${lock_list}
582 ${tran_id_length}= Get Length ${transaction_id}
583 Should Be Equal As Integers ${tran_id_length} ${lock_length}
Vijayafdd2a12020-04-09 02:03:20 -0500584
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500585 FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list}
586 Valid Value session_info['ClientID'] ['${lock['HMCID']}']
587 Valid Value session_info['SessionIDs'] ['${lock['SessionID']}']
588 Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']}
Vijaybc331e22020-02-27 04:17:37 -0600589 END
590
Vijaybc331e22020-02-27 04:17:37 -0600591
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500592Acquire Lock On Resource
593 [Documentation] Acquire lock on resource.
594 [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False
Vijaybc331e22020-02-27 04:17:37 -0600595
596 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500597 # client_id This client id can contain string value
598 # (e.g. 12345, "HMCID").
599 # lock_type Read lock or Write lock.
600 # reboot_flag Flag is used to run reboot the BMC code.
601 # (e.g. True or False).
Vijaybc331e22020-02-27 04:17:37 -0600602
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500603 ${trans_id_list}= Create List
604 ${session_info}= Create Redfish Session With ClientID ${client_id}
605 ${trans_id}= Redfish Post Acquire Lock ${lock_type}
606 Append To List ${trans_id_list} ${trans_id}
607 Verify Lock On Resource ${session_info} ${trans_id_list}
George Keishing566daaf2020-07-02 06:18:50 -0500608
Sushil Singhe33c6e62020-09-29 06:34:35 -0500609 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
Vijaybc331e22020-02-27 04:17:37 -0600610
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500611 Run Keyword If '${reboot_flag}' == 'True'
612 ... Run Keywords Redfish OBMC Reboot (off) AND
613 ... Redfish Login AND
Sushil Singhe33c6e62020-09-29 06:34:35 -0500614 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500615 ... Verify Lock On Resource ${session_info} ${trans_id_list} AND
616 ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK}
Vijaybc331e22020-02-27 04:17:37 -0600617
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500618 Run Keyword If '${reboot_flag}' == 'False'
619 ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK}
Vijaybc331e22020-02-27 04:17:37 -0600620
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500621 ${trans_id_emptylist}= Create List
622 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
623 Redfish Delete Session ${session_info}
Vijaybc331e22020-02-27 04:17:37 -0600624
Vijaybc331e22020-02-27 04:17:37 -0600625
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500626Form Data To Release Lock
627 [Documentation] Create a dictonay to release lock.
628 [Arguments] ${trans_id_list}
Vijay355daac2020-03-26 12:06:08 -0500629
630 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500631 # trans_id_list
Vijay355daac2020-03-26 12:06:08 -0500632
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500633 @{tran_ids}= Create List
Vijay355daac2020-03-26 12:06:08 -0500634
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500635 FOR ${item} IN @{trans_id_list}
636 Append To List ${tran_ids} ${item['TransactionID']}
637 END
638
639 [Return] ${tran_ids}
640
641
642Release Locks On Resource
643 [Documentation] Redfish request to release a lock.
644 [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction ${status_code}=${HTTP_OK}
645
646 # Description of argument(s):
647 # session_info Session information in dict.
648 # trans_id_list Transaction id list.
649 # release_lock_type Release lock by Transaction, Session.
650 # status_code HTTP status code.
651
652 ${tran_ids}= Form Data To Release Lock ${trans_id_list}
653 ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}}
654 ${data}= Evaluate json.dumps(${data}) json
655 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data}
656 Should Be Equal As Strings ${resp.status_code} ${status_code}
657
658
Sushil Singhdf390b62021-01-19 00:50:05 -0600659Release locks And Delete Session
660 [Documentation] Release locks and delete redfish session.
661 [Arguments] ${session_info} ${trans_id_list}
662
663 Release Locks On Resource ${session_info} ${trans_id_list}
664
665 ${trans_id_emptylist}= Create List
666 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
667
668 Redfish Delete Session ${session_info}
669
670
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500671Acquire Lock On Another Lock
672 [Documentation] Acquire lock on another lock.
673 [Arguments] ${client_id}
674
675 # Description of argument(s):
676 # client_id This client id can contain string value
677 # (e.g. 12345, "HMCID").
678
679 ${trans_id_list}= Create List
680 ${session_info}= Create Redfish Session With ClientID ${client_id}
681
682 ${trans_id}= Redfish Post Acquire Lock ReadCase1
683 Append To List ${trans_id_list} ${trans_id}
684
685 ${trans_id}= Redfish Post Acquire Lock ReadCase1
686 Append To List ${trans_id_list} ${trans_id}
687
688 Verify Lock On Resource ${session_info} ${trans_id_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500689
Sushil Singhdf390b62021-01-19 00:50:05 -0600690 Release locks And Delete Session ${session_info} ${trans_id_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500691
692
Sushil Singh977f8f52020-11-20 06:32:50 -0600693Verify Fail To Acquire Read And Write In Single Request
694 [Documentation] Verify fail to acquire read and write lock passed in single request.
695 [Arguments] ${client_id} ${lock_type}
696
697 # Description of argument(s):
698 # client_id This client id can contain string value
699 # (e.g. 12345, "HMCID").
700 # lock_type Read lock or Write lock.
701
702 ${lock_type_list}= Split String ${lock_type} ,
703
704 ${session_info}= Create Redfish Session With ClientID ${client_id}
705 ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list} status_code=${HTTP_BAD_REQUEST}
706 Redfish Delete Session ${session_info}
707
708
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500709Verify Empty Lock Records For Invalid Session
710 [Documentation] Verify no lock record found for invalid session.
711 [Arguments] ${client_id}
712
713 # Description of argument(s):
714 # client_id This client id can contain string value
715 # (e.g. 12345, "HMCID").
716
717 ${session_info1}= Create Redfish Session With ClientID ${client_id}
718
719 ${lock_list1}= Get Locks List On Resource ${session_info1}
720 ${lock_length1}= Get Length ${lock_list1}
721
722 ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True
723 set to dictionary ${session_info2} SessionIDs xxyXyyYZZz
724
725 ${lock_list2}= Get Locks List On Resource ${session_info2}
Sushil Singhf9a536c2020-11-09 07:33:17 -0600726 ${lock_length2}= Get Length ${lock_list2}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500727
Sushil Singhf9a536c2020-11-09 07:33:17 -0600728 Should Be Equal As Integers ${lock_length1} ${lock_length2}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500729
730 Redfish Delete Session ${session_info1}
731
732
733Verify Acquire Lock Fails On Another Lock
734 [Documentation] Verify acquire lock on another lock fails.
735 [Arguments] ${client_id} ${lock_type}
736
737 # Description of argument(s):
738 # client_id This client id can contain string value
739 # (e.g. 12345, "HMCID").
740 # lock_type Read lock or Write lock.
741
742 @{lock_type_list}= Split String ${lock_type} ,
743 ${session_info}= Create Redfish Session With ClientID ${client_id}
744 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
745
746 ${trans_id_list}= Create List
747 Append To List ${trans_id_list} ${trans_id}
748
749 Verify Lock On Resource ${session_info} ${trans_id_list}
750 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500751
Sushil Singhdf390b62021-01-19 00:50:05 -0600752 Release locks And Delete Session ${session_info} ${trans_id_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500753
754
Sushil Singhe33c6e62020-09-29 06:34:35 -0500755Verify Acquire Lock After Reboot
756 [Documentation] Acquire read and write lock after the reboot and release lock.
757 [Arguments] ${client_id} ${lock_type}
758
759 # Description of argument(s):
760 # client_id This client id can contain string value
761 # (e.g. 12345, "HMCID").
762 # lock_type Read lock or Write lock.
763
764 ${trans_id_list}= Create List
Sushil Singhf9a536c2020-11-09 07:33:17 -0600765 ${session_info}= Create Session With ClientID ${client_id}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500766 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
767 Redfish OBMC Reboot (off)
768 Redfish Login
769 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
770
771 ${trans_id}= Redfish Post Acquire Lock ${lock_type}
772 Append To List ${trans_id_list} ${trans_id}
773 Verify Lock On Resource ${session_info} ${trans_id_list}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500774
Sushil Singhdf390b62021-01-19 00:50:05 -0600775 Release locks And Delete Session ${session_info} ${trans_id_list}
776
777
778Verify Acquire Multiple Lock Request At CEC Level
779 [Documentation] Acquire lock in loop.
780 [Arguments] ${client_id} ${lock_type}
781
782 # Description of argument(s):
783 # client_id This client id can contain string value
784 # (e.g. 12345, "HMCID").
785 # lock_type Read lock or Write lock.
786
787 ${trans_id_list}= Create List
788 @{lock_type_list}= Split String ${lock_type} ,
789 ${session_info}= Create Redfish Session With ClientID ${client_id}
790
791 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
792 Append To List ${trans_id_list} ${trans_id}
793
794 Verify Lock On Resource ${session_info} ${trans_id_list}
795
796 Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT}
797
798 Release locks And Delete Session ${session_info} ${trans_id_list}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500799
800
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500801Verify Acquire And Release Lock In Loop
802 [Documentation] Acquire lock in loop.
803 [Arguments] ${client_id} ${lock_type}
804
805 # Description of argument(s):
806 # client_id This client id can contain string value
807 # (e.g. 12345, "HMCID").
808 # lock_type Read lock or Write lock.
809
810 FOR ${count} IN RANGE 1 11
811 ${trans_id_list}= Create List
812 ${session_info}= Create Redfish Session With ClientID ${client_id}
813 ${trans_id}= Redfish Post Acquire Lock ${lock_type}
814 Append To List ${trans_id_list} ${trans_id}
815 Verify Lock On Resource ${session_info} ${trans_id_list}
816 Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK}
817 ${trans_id_emptylist}= Create List
818 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
819 END
820
821 Redfish Delete Session ${session_info}
822
823
824Acquire And Release Multiple Locks
825 [Documentation] Acquire mutilple locks on resource.
826 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
827
828 # Description of argument(s):
829 # client_id This client id can contain string value
830 # (e.g. 12345, "HMCID").
831 # lock_type Read lock or Write lock.
832 # release_lock_type The value can be Transaction or Session.
833
834 @{lock_type_list}= Split String ${lock_type} ,
835 ${session_info}= Create Redfish Session With ClientID ${client_id}
836 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
837
838 ${trans_id_list}= Create List
839
840 Append To List ${trans_id_list} ${trans_id}
841 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
842
843 Append To List ${trans_id_list} ${trans_id}
844 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2]
845
846 Append To List ${trans_id_list} ${trans_id}
847 Verify Lock On Resource ${session_info} ${trans_id_list}
848 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type}
849
850 ${trans_id_emptylist}= Create List
851 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
852 Redfish Delete Session ${session_info}
853
854
Sushil Singh59011d02021-01-27 23:00:20 -0600855Verify Fail To Release Lock With Invalid TransactionID
George Keishing16b3c7b2021-01-28 09:23:37 -0600856 [Documentation] Verify fail to be release lock with invalid transaction ID.
Sushil Singh59011d02021-01-27 23:00:20 -0600857 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
858
859 # Description of argument(s):
860 # client_id This client id can contain string value
861 # (e.g. 12345, "HMCID").
862 # lock_type Read lock or Write lock.
863 # release_lock_type The value can be Transaction or Session.
864
865 ${trans_id_list}= Create List
866 @{lock_type_list}= Split String ${lock_type} ,
867
868 ${session_info}= Create Redfish Session With ClientID ${client_id}
869
870 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
871 ${value}= Get From Dictionary ${trans_id} TransactionID
872 ${value}= Evaluate ${value} + 10
873 Set To Dictionary ${trans_id} TransactionID ${value}
874 Append To List ${trans_id_list} ${trans_id}
875
876 Release Locks On Resource
877 ... ${session_info} ${trans_id_list}
878 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST}
879 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session
880
881 ${trans_id_emptylist}= Create List
882 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
883 Redfish Delete Session ${session_info}
884
885
Sushil Singh1b590532021-01-20 05:13:54 -0600886Verify Fail To Release Multiple Lock With Invalid TransactionID
887 [Documentation] Verify release multiple locks with invalid transaction ID fails.
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500888 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
889
890 # Description of argument(s):
891 # client_id This client id can contain string value
892 # (e.g. 12345, "HMCID").
893 # lock_type Read lock or Write lock.
894 # release_lock_type The value can be Transaction or Session.
895
896 ${trans_id_list}= Create List
897 @{lock_type_list}= Split String ${lock_type} ,
898
899 ${session_info}= Create Redfish Session With ClientID ${client_id}
900
901 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
902 ${value}= Get From Dictionary ${trans_id} TransactionID
903 ${value}= Evaluate ${value} + 10
904 Set To Dictionary ${trans_id} TransactionID ${value}
905 Append To List ${trans_id_list} ${trans_id}
906
907 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
908 ${value}= Get From Dictionary ${trans_id} TransactionID
909 ${value}= Evaluate ${value} + 10
910 Set To Dictionary ${trans_id} TransactionID ${value}
911 Append To List ${trans_id_list} ${trans_id}
912
913 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2]
914 ${value}= Get From Dictionary ${trans_id} TransactionID
915 ${value}= Evaluate ${value} + 10
916 Set To Dictionary ${trans_id} TransactionID ${value}
917 Append To List ${trans_id_list} ${trans_id}
918
919 Release Locks On Resource
920 ... ${session_info} ${trans_id_list}
921 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST}
922 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session
923
924 ${trans_id_emptylist}= Create List
925 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
926 Redfish Delete Session ${session_info}
927
928
Sushil Singh8bee3582021-01-27 23:46:48 -0600929Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID
930 [Documentation] Verify fail to be release multiple lock with valid and invalid trasaction ID.
931 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
932
933 # Description of argument(s):
934 # client_id This client id can contain string value
935 # (e.g. 12345, "HMCID").
936 # lock_type Read lock or Write lock.
937 # release_lock_type The value can be Transaction or Session.
938
939 ${trans_id_list}= Create List
940 @{lock_type_list}= Split String ${lock_type} ,
941
942 ${session_info}= Create Redfish Session With ClientID ${client_id}
943
944 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
945 Append To List ${trans_id_list} ${trans_id}
946
947 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
948 ${value}= Get From Dictionary ${trans_id} TransactionID
949 ${value}= Evaluate ${value} + 10
950 Set To Dictionary ${trans_id} TransactionID ${value}
951 Append To List ${trans_id_list} ${trans_id}
952
953 Release Locks On Resource
954 ... ${session_info} ${trans_id_list}
955 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST}
956 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session
957
958 ${trans_id_emptylist}= Create List
959 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
960 Redfish Delete Session ${session_info}
961
962
susilsi71d7b9962021-03-02 03:06:18 -0600963Verify Fail To Release Lock With TransactionID As String Type
964 [Documentation] Verify fail to be release lock with trasaction ID as string data type.
965 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
966
967 # Description of argument(s):
968 # client_id This client id can contain string value
969 # (e.g. 12345, "HMCID").
970 # lock_type Read lock or Write lock.
971 # release_lock_type The value can be Transaction or Session.
972
973 ${trans_id_list}= Create List
974 @{lock_type_list}= Split String ${lock_type} ,
975
976 ${session_info}= Create Redfish Session With ClientID ${client_id}
977
978 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
979
980 Append To List ${trans_id_list} ${trans_id}
981
982 ${temp_trans_id_list}= Copy Dictionary ${trans_id_list} deepcopy=True
983
984 ${value}= Get From Dictionary ${trans_id_list}[0] TransactionID
985 ${value}= Set Variable \'${value}\'
986 Set To Dictionary ${temp_trans_id_list}[0] TransactionID ${value}
987
988 Release Locks On Resource
989 ... ${session_info} ${temp_trans_id_list}
990 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST}
991
992 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type}
993
994 ${trans_id_emptylist}= Create List
995 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
996 Redfish Delete Session ${session_info}
997
998
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500999Verify Fail To Release Lock For Another Session
1000 [Documentation] Verify failed to release the lock form another session.
1001 [Arguments] ${client_id} ${lock_type}
1002
1003 # Description of argument(s):
1004 # client_id This client id can contain string value
1005 # (e.g. 12345, "HMCID").
1006 # lock_type Read lock or Write lock.
1007
1008 ${client_ids}= Split String ${client_id} ,
1009 ${lock_type_list}= Split String ${lock_type} ,
1010 ${trans_id_list1}= Create List
1011 ${trans_id_list2}= Create List
1012
1013 ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0]
1014
1015 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1016 Append To List ${trans_id_list1} ${trans_id}
1017 Verify Lock On Resource ${session_info1} ${trans_id_list1}
1018
1019 ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1]
1020 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
1021 Append To List ${trans_id_list2} ${trans_id}
1022 Verify Lock On Resource ${session_info2} ${trans_id_list2}
1023
1024 Release Locks On Resource
1025 ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_UNAUTHORIZED}
1026 Verify Lock On Resource ${session_info1} ${trans_id_list1}
1027 Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session
1028 Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session
1029 Redfish Delete Session ${session_info1}
1030 Redfish Delete Session ${session_info2}
1031
1032
Sushil Singhe33c6e62020-09-29 06:34:35 -05001033Verify Fail To Acquire Lock For Invalid Resource ID Data Type
1034 [Documentation] Verify fail to acquire the lock with invalid resource id data type.
1035 [Arguments] ${client_id} ${lock_type}
1036
1037 # Description of argument(s):
1038 # client_id This client id can contain string value
1039 # (e.g. 12345, "HMCID").
1040 # lock_type Read lock or Write lock.
1041
1042 ${session_info}= Create Redfish Session With ClientID ${client_id}
1043 Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID
1044 ... ${lock_type} status_code=${HTTP_BAD_REQUEST}
1045 Redfish Delete Session ${session_info}
1046
1047
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001048Verify Fail To Acquire Lock For Invalid Lock Data
George Keishing16b3c7b2021-01-28 09:23:37 -06001049 [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segment flags.
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001050 [Arguments] ${client_id} ${lock_type} ${message}
1051
1052 # Description of argument(s):
1053 # client_id This client id can contain string value
1054 # (e.g. 12345, "HMCID").
1055 # lock_type Read lock or Write lock.
1056 # message Return message from URI.
1057
1058 ${session_info}= Create Redfish Session With ClientID ${client_id}
1059 ${trans_id}= Redfish Post Acquire Invalid Lock ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST}
1060 Redfish Delete Session ${session_info}
Sushil Singhbace3002020-10-08 08:12:58 -05001061
1062
1063Verify No Locks Records For Session With No Acquired Lock
1064 [Documentation] Verify no records found for a session where no lock is acquired.
1065 [Arguments] ${client_id}
1066
1067 # Description of argument(s):
1068 # client_id This client id can contain string value
1069 # (e.g. 12345, "HMCID").
1070
1071 ${session_info}= Create Redfish Session With ClientID ${client_id}
1072 ${trans_id_emptylist}= Create List
1073 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
1074 Redfish Delete Session ${session_info}
Sushil Singh728ef9c2020-10-28 04:25:39 -05001075
1076
1077Create List Of Session ID
1078 [Documentation] Create session id list from session dict info.
1079 [Arguments] ${session_dict_info}
1080
1081 # Description of argument(s):
1082 # session_dict_info Session information in dict.
1083
1084 @{session_id_list}= Create List
1085
1086 FOR ${session} IN @{session_dict_info}
1087 Append To List ${session_id_list} ${session["SessionIDs"]}
1088 END
1089
1090 ${num_id}= Get Length ${session_id_list}
1091 Should Not Be Equal As Integers ${num_id} ${0}
1092
1093 ${session_id_list}= Evaluate json.dumps(${session_id_list}) json
1094
1095 [Return] ${session_id_list}
1096
1097
1098Get Locks List On Resource With Session List
1099 [Documentation] Get locks list from session of list.
1100 [Arguments] ${session_id_list} ${exp_status_code}=${HTTP_OK}
1101
1102 # Description of argument(s):
1103 # session_id_list Session ids list.
1104 # exp_status_code Expected HTTP status code.
1105
1106 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList
1107 ... data={"SessionIDs": ${session_id_list}}
1108 ${locks}= Evaluate json.loads('''${resp.text}''') json
1109
1110 [Return] ${locks}
1111
1112
1113Verify List Of Session Lock On Resource
1114 [Documentation] Verify list of lock record from list of sessions.
1115 [Arguments] ${session_dict_info} ${transaction_id_list}
1116
1117 # Description of argument(s):
1118 # session_dict_info Session information in dict.
1119 # transaction_id_list Transaction id in list stored in dict.
1120
1121 ${session_id_list}= Create List Of Session ID ${session_dict_info}
1122 ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list}
1123 ${lock_list}= Set Variable ${lock_list_resp['Records']}
1124
1125 FOR ${session_id} ${tran_id} ${lock_record} IN ZIP ${session_dict_info} ${transaction_id_list} ${lock_list}
1126 Valid Value session_id['SessionIDs'] ['${lock_record['SessionID']}']
1127 Should Be Equal As Integers ${tran_id['TransactionID']} ${lock_record['TransactionID']}
1128 END
1129
1130
1131Verify Lock Records Of Multiple Session
1132 [Documentation] Verify all records found for a multiple sessions.
1133 [Arguments] ${client_ids} ${lock_type}
1134
1135 # Description of argument(s):
1136 # client_ids This client id can contain string value
1137 # (e.g. 12345, "HMCID").
1138 # lock_type Read lock or Write lock.
1139
1140 ${client_id_list}= Split String ${client_ids} ,
1141 ${lock_type_list}= Split String ${lock_type} ,
1142 ${trans_id_list1}= Create List
1143 ${trans_id_list2}= Create List
1144
1145 ${session_dict_list}= Create List
1146 ${lock_list}= Create List
1147
1148 ${client_id1}= Create List
1149 Append To List ${client_id1} ${client_id_list}[0]
1150 ${session_info1}= Create Session With List Of ClientID ${client_id1}
1151 Append To List ${session_dict_list} ${session_info1}[0]
1152 Verify A Session Created With ClientID ${client_id1} ${session_info1}
1153
1154 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1155 Append To List ${trans_id_list1} ${trans_id}
1156 Append To List ${lock_list} ${trans_id}
1157 Verify Lock On Resource ${session_info1}[0] ${trans_id_list1}
1158
1159
1160 ${client_id2}= Create List
1161 Append To List ${client_id2} ${client_id_list}[1]
1162 ${session_info2}= Create Session With List Of ClientID ${client_id2}
1163 Append To List ${session_dict_list} ${session_info2}[0]
1164 Verify A Session Created With ClientID ${client_id2} ${session_info2}
1165
1166 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
1167 Append To List ${trans_id_list2} ${trans_id}
1168 Append To List ${lock_list} ${trans_id}
1169 Verify Lock On Resource ${session_info2}[0] ${trans_id_list2}
1170
1171 Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list}
1172
1173 ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken
1174 Set Global Variable ${XAUTH_TOKEN} ${session_token}
1175
1176 Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction
1177
1178 ${session_token}= Get From Dictionary ${session_info2}[0] SessionToken
1179 Set Global Variable ${XAUTH_TOKEN} ${session_token}
1180
1181 Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Transaction
1182
1183 ${trans_id_emptylist}= Create List
1184 Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist}
1185 Verify Lock On Resource ${session_info2}[0] ${trans_id_emptylist}
1186
1187 Redfish Delete List Of Session ${session_dict_list}
Sushil Singhf9a536c2020-11-09 07:33:17 -06001188
1189
1190Verify Lock Records For Multiple Invalid Session
1191 [Documentation] Verify no lock record found for multiple invalid session.
1192 [Arguments] ${client_id}
1193
1194 # Description of argument(s):
1195 # client_id This client id can contain string value
1196 # (e.g. 12345, "HMCID").
1197
1198 ${session_dict_list}= Create List
1199 ${invalid_session_ids}= Create List xxyXyyYZZz xXyXYyYZzz
1200
1201 ${session_info1}= Create Session With ClientID ${client_id}
1202
1203 ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True
1204 set to dictionary ${session_info2} SessionIDs ${invalid_session_ids}[0]
1205 Append To List ${session_dict_list} ${session_info2}
1206
1207 ${session_info3}= Copy Dictionary ${session_info1} deepcopy=True
1208 set to dictionary ${session_info3} SessionIDs ${invalid_session_ids}[0]
1209 Append To List ${session_dict_list} ${session_info3}
1210
1211 ${lock_list1}= Get Locks List On Resource ${session_info1}
1212 ${lock_length1}= Get Length ${lock_list1}
1213
1214 ${session_id_list}= Create List Of Session ID ${session_dict_list}
1215 ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list}
1216 ${lock_length2}= Get Length ${lock_list_resp['Records']}
1217
1218 Should Be Equal As Integers ${lock_length1} ${lock_length2}
1219
1220 Redfish Delete Session ${session_info1}
Sushil Singh11949a22020-11-13 06:12:16 -06001221
1222
1223Verify Lock Records For Multiple Invalid And Valid Session
1224 [Documentation] Verify all records found for a valid and invalid sessions.
1225 [Arguments] ${client_ids} ${lock_type}
1226
1227 # Description of argument(s):
1228 # client_ids This client id can contain string value
1229 # (e.g. 12345, "HMCID").
1230 # lock_type Read lock or Write lock.
1231
1232 ${client_id_list}= Split String ${client_ids} ,
1233 ${lock_type_list}= Split String ${lock_type} ,
1234 ${trans_id_list1}= Create List
1235 ${invalid_session_ids}= Create List xxyXyyYZZz
1236
1237 ${session_dict_list}= Create List
1238 ${lock_list}= Create List
1239
1240 ${client_id1}= Create List
1241 Append To List ${client_id1} ${client_id_list}[0]
1242 ${session_info1}= Create Session With List Of ClientID ${client_id1}
1243 Append To List ${session_dict_list} ${session_info1}[0]
1244 Verify A Session Created With ClientID ${client_id1} ${session_info1}
1245
1246 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1247 Append To List ${trans_id_list1} ${trans_id}
1248 Append To List ${lock_list} ${trans_id}
1249 Verify Lock On Resource ${session_info1}[0] ${trans_id_list1}
1250
1251 ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True
1252 set to dictionary ${session_info2}[0] SessionIDs ${invalid_session_ids}[0]
1253 Append To List ${session_dict_list} ${session_info2}[0]
1254
1255 Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list}
1256
1257 ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken
1258 Set Global Variable ${XAUTH_TOKEN} ${session_token}
1259
1260 Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction
1261
1262 ${trans_id_emptylist}= Create List
1263 Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist}
1264
1265 Redfish Delete Session ${session_info1}[0]