blob: 4ca37e5cd733256ebe8273093bde6bb135a05c07 [file] [log] [blame]
Vijaybc331e22020-02-27 04:17:37 -06001*** Settings ***
2
Sushil Singh8d420bf2021-09-06 08:27:41 -05003Documentation Test lock management feature of management console on BMC.
Vijaybc331e22020-02-27 04:17:37 -06004
Sushil Singh8d420bf2021-09-06 08:27:41 -05005Resource ../../lib/resource.robot
6Resource ../../lib/openbmc_ffdc.robot
7Resource ../../lib/bmc_redfish_utils.robot
8Resource ../../lib/external_intf/management_console_utils.robot
9Resource ../../lib/rest_response_code.robot
10Library ../../lib/bmc_network_utils.py
Vijaybc331e22020-02-27 04:17:37 -060011
Sushil Singh8d420bf2021-09-06 08:27:41 -050012Suite Setup Run Keyword And Ignore Error Delete All Redfish Sessions
13Suite Teardown Run Keyword And Ignore Error Delete All Redfish Sessions
14Test Setup Printn
15Test Teardown FFDC On Test Case Fail
Vijaybc331e22020-02-27 04:17:37 -060016
17*** Variables ***
18
Sushil Singhe3f2e3b2022-07-28 05:15:43 -050019${CONFLICT_RQUEST} Conflict
Sushil Singh8d420bf2021-09-06 08:27:41 -050020${BAD_REQUEST} Bad Request
21&{default_trans_id} TransactionID=${1}
Vijaybc331e22020-02-27 04:17:37 -060022
23*** Test Cases ***
24
Sushil Singhd03f2ce2020-09-17 08:54:41 -050025Acquire Read Write Lock
Vijaybc331e22020-02-27 04:17:37 -060026 [Documentation] Acquire and release different read locks.
Sushil Singhd03f2ce2020-09-17 08:54:41 -050027 [Tags] Acquire_Read_Write_Lock
28 [Template] Acquire Lock On Resource
Vijaybc331e22020-02-27 04:17:37 -060029
Sushil Singhd03f2ce2020-09-17 08:54:41 -050030 # client_id lock_type reboot_flag
31 HMCID-01 ReadCase1 False
32 HMCID-01 ReadCase2 False
33 HMCID-01 ReadCase3 False
34 HMCID-01 WriteCase1 False
35 HMCID-01 WriteCase2 False
36 HMCID-01 WriteCase3 False
Vijaybc331e22020-02-27 04:17:37 -060037
38
Sushil Singhd8bf1422021-09-06 05:19:09 -050039Verify Lock Is Not Persistent On BMC Reboot
40 [Documentation] Acquire lock and after reboot the locks are removed as no persistency
41 ... maintained.
42 [Tags] Verify_Lock_Is_Not_Persistent_On_BMC_Reboot
Sushil Singhd03f2ce2020-09-17 08:54:41 -050043 [Template] Acquire Lock On Resource
Vijaybc331e22020-02-27 04:17:37 -060044
Sushil Singhd03f2ce2020-09-17 08:54:41 -050045 # client_id lock_type reboot_flag
46 HMCID-01 ReadCase1 True
47 HMCID-01 ReadCase2 True
48 HMCID-01 ReadCase3 True
49 HMCID-01 WriteCase1 True
50 HMCID-01 WriteCase2 True
51 HMCID-01 WriteCase3 True
Vijaybc331e22020-02-27 04:17:37 -060052
53
Sushil Singh8d420bf2021-09-06 08:27:41 -050054Check After Reboot Transaction ID Set To Default
55 [Documentation] After reboot, the transaction id starts with default i.e. 1,
George Keishing7fd1ac02021-09-23 08:10:33 -050056 ... if any lock is acquired.
Sushil Singh8d420bf2021-09-06 08:27:41 -050057 [Tags] Check_After_Reboot_Transaction_ID_Set_To_Default
58 [Template] Verify Acquire And Release Lock In Loop
59
60 # client_id lock_type reboot_flag
61 HMCID-01 ReadCase1 True
62 HMCID-01 WriteCase1 True
63
64
Sushil Singhd03f2ce2020-09-17 08:54:41 -050065Acquire Read Lock On Read Lock
66 [Documentation] Acquire read lock on another read lock.
67 [Tags] Acquire_Read_Lock_On_Read_Lock
68 [Template] Acquire Lock On Another Lock
Vijaybc331e22020-02-27 04:17:37 -060069
Sushil Singhd03f2ce2020-09-17 08:54:41 -050070 # client_id
71 HMCID-01
Vijaybc331e22020-02-27 04:17:37 -060072
73
Sushil Singhd03f2ce2020-09-17 08:54:41 -050074Fail To Acquire Lock On Another Lock
75 [Documentation] Fail to acquire another lock.
76 [Tags] Fail_To_Acquire_Lock_On_Another_Lock
77 [Template] Verify Acquire Lock Fails On Another Lock
Vijay85610ee2020-04-03 05:30:28 -050078
Sushil Singhd03f2ce2020-09-17 08:54:41 -050079 # client_id lock_type
Sushil Singh5d059942021-09-27 08:41:38 -050080 HMCID-01 ReadCase7,WriteCase6
81 HMCID-01 WriteCase6,WriteCase6
82 HMCID-01 WriteCase6,ReadCase7
George Keishing566daaf2020-07-02 06:18:50 -050083
84
Sushil Singhe33c6e62020-09-29 06:34:35 -050085Acquire Lock After Reboot
86 [Documentation] Acquire and release read and write locks after reboot.
87 [Tags] Acquire_Lock_After_Reboot
88 [Template] Verify Acquire Lock After Reboot
89
90 # 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
97
98
Sushil Singhd03f2ce2020-09-17 08:54:41 -050099Acquire And Release Lock In Loop
100 [Documentation] Acquire and release read, write locks in loop.
101 [Tags] Acquire_And_Release_Lock_In_Loop
102 [Template] Verify Acquire And Release Lock In Loop
George Keishing566daaf2020-07-02 06:18:50 -0500103
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500104 # client_id lock_type
105 HMCID-01 ReadCase1
106 HMCID-01 ReadCase2
107 HMCID-01 ReadCase3
108 HMCID-01 WriteCase1
109 HMCID-01 WriteCase2
110 HMCID-01 WriteCase3
Vijay85610ee2020-04-03 05:30:28 -0500111
112
Sushil Singh977f8f52020-11-20 06:32:50 -0600113Fail To Acquire Read And Write In Single Request
114 [Documentation] Fail to acquire read and write lock in single request.
115 [Tags] Fail_To_Acquire_Read_And_Write_In_Single_Request
116 [Template] Verify Fail To Acquire Read And Write In Single Request
117
Sushil Singhe3f2e3b2022-07-28 05:15:43 -0500118 # client_id lock_type status_code
119 HMCID-01 ReadCase1,WriteCase1 ${HTTP_CONFLICT}
120 HMCID-01 WriteCase1,ReadCase1 ${HTTP_CONFLICT}
121 HMCID-01 WriteCase1,WriteCase1 ${HTTP_CONFLICT}
122
123
124Acquire Read In Single Request
125 [Documentation] Acquire read in single request.
126 [Tags] Acquire_Read_In_Single_Request
127 [Template] Verify Acquire Read In Single Request
128
Sushil Singh977f8f52020-11-20 06:32:50 -0600129 # client_id lock_type
Sushil Singhe3f2e3b2022-07-28 05:15:43 -0500130 HMCID-01 ReadCase1,ReadCase1
Sushil Singh977f8f52020-11-20 06:32:50 -0600131
132
Sushil Singhdf390b62021-01-19 00:50:05 -0600133Acquire Multiple Lock Request At CEC Level
134 [Documentation] Acquire write lock on read lock under CEC level.
135 [Tags] Acquire_Multiple_Lock_Request_At_CEC_Level
136 [Template] Verify Acquire Multiple Lock Request At CEC Level
137
138 # client_id lock_type
139 HMCID-01 ReadCase4,WriteCase4
140 HMCID-01 WriteCase5,ReadCase5
141 HMCID-01 ReadCase6,WriteCase6
142 HMCID-01 WriteCase7,ReadCase7
143
144
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500145Verify Release Of Valid Locks
146 [Documentation] Release all valid locks.
147 [Tags] Verify_Release_Of_Valid_Locks
148 [Template] Acquire And Release Multiple Locks
Vijayafdd2a12020-04-09 02:03:20 -0500149
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500150 # client_id lock_type release_lock_type
151 HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction
152 HMCID-02 ReadCase1,ReadCase1,ReadCase1 Session
Vijayafdd2a12020-04-09 02:03:20 -0500153
154
susilsi794116c62021-03-04 07:57:51 -0600155Release Lock When Session Deleted
156 [Documentation] Release lock when session gets deleted.
157 [Tags] Release_Lock_When_Session_Deleted
158 [Template] Verify Release Lock When Session Deleted
159
160 # client_id lock_type
161 HMCID-01 ReadCase1
162 HMCID-01 WriteCase1
163
164
Sushil Singh59011d02021-01-27 23:00:20 -0600165Fail To Release Lock With Invalid TransactionID
166 [Documentation] Fail to release lock with invalid transaction id.
167 [Tags] Fail_To_Release_Lock_With_Invalid_TransactionID
168 [Template] Verify Fail To Release Lock With Invalid TransactionID
169
susilsi743b0c062021-03-02 04:24:19 -0600170 # client_id lock_type release_lock_type
171 HMCID-01 ReadCase1 Transaction
172 HMCID-01 WriteCase1 Transaction
Sushil Singh59011d02021-01-27 23:00:20 -0600173
174
Sushil Singh1b590532021-01-20 05:13:54 -0600175Fail To Release Multiple Lock With Invalid TransactionID
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500176 [Documentation] Release in-valid lock result in fail.
Sushil Singh1b590532021-01-20 05:13:54 -0600177 [Tags] Fail_To_Release_Multiple_Lock_With_Invalid_TransactionID
178 [Template] Verify Fail To Release Multiple Lock With Invalid TransactionID
Vijayafdd2a12020-04-09 02:03:20 -0500179
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500180 # client_id lock_type release_lock_type
181 HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction
182 12345 ReadCase2,ReadCase2,ReadCase2 Transaction
183 HMCID ReadCase3,ReadCase3,ReadCase3 Transaction
Vijayafdd2a12020-04-09 02:03:20 -0500184
185
Sushil Singh8bee3582021-01-27 23:46:48 -0600186Fail To Release Multiple Lock With Valid And Invalid TransactionID
George Keishing96143832021-03-23 07:55:08 -0500187 [Documentation] Release multiple lock with valid and invalid transaction.
Sushil Singh8bee3582021-01-27 23:46:48 -0600188 [Tags] Fail_To_Release_Multiple_Lock_With_Valid_And_Invalid_TransactionID
189 [Template] Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID
190
191 # client_id lock_type release_lock_type
192 HMCID-01 ReadCase1,ReadCase1 Transaction
193
194
susilsi71d7b9962021-03-02 03:06:18 -0600195Fail To Release Lock With String As TransactionID Data Type
196 [Documentation] Fail to release lock with string as transaction id data type.
197 [Tags] Fail_To_Release_Lock_With_String_As_TransactionID_Data_Type
198 [Template] Verify Fail To Release Lock With TransactionID As String Type
199
200 # client_id lock_type release_lock_type
201 HMCID-01 ReadCase1 Transaction
202 HMCID-01 WriteCase1 Transaction
203
204
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500205Fail To Release Lock For Another Session
206 [Documentation] Failed to release locks from another session.
207 [Tags] Fail_To_Release_Lock_For_Another_Session
208 [Template] Verify Fail To Release Lock For Another Session
Vijayafdd2a12020-04-09 02:03:20 -0500209
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500210 # client_id lock_type
211 HMCID-01,HMCID-02 ReadCase1,ReadCase1
Vijayafdd2a12020-04-09 02:03:20 -0500212
213
Sushil Singhe33c6e62020-09-29 06:34:35 -0500214Test Invalid Resource ID Data Type Locking
215 [Documentation] Failed to acquire lock for invalid resource id data type.
216 [Tags] Test_Invalid_Resource_ID_Data_Type_Locking
217 [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type
218
219 # client_id lock_type
220 HMCID-01 ReadCase1
221 HMCID-01 ReadCase2
222 HMCID-01 ReadCase3
223 HMCID-01 WriteCase1
224 HMCID-01 WriteCase2
225 HMCID-01 WriteCase3
226
227
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500228Fail To Acquire Lock For Invalid Lock Type
229 [Documentation] Failed to acquire read, write lock for invalid lock data passed.
230 [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type
231 [Template] Verify Fail To Acquire Lock For Invalid Lock Data
Vijayafdd2a12020-04-09 02:03:20 -0500232
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500233 # client_id lock_type message
234 HMCID-01 ReadCase1 ${BAD_REQUEST}
235 HMCID-01 ReadCase2 ${BAD_REQUEST}
236 HMCID-01 ReadCase3 ${BAD_REQUEST}
237 HMCID-01 ReadCase4 ${BAD_REQUEST}
238 HMCID-01 ReadCase5 ${BAD_REQUEST}
239 HMCID-01 WriteCase1 ${BAD_REQUEST}
240 HMCID-01 WriteCase2 ${BAD_REQUEST}
241 HMCID-01 WriteCase3 ${BAD_REQUEST}
242 HMCID-01 WriteCase4 ${BAD_REQUEST}
243 HMCID-01 WriteCase5 ${BAD_REQUEST}
Vijayafdd2a12020-04-09 02:03:20 -0500244
Vijayafdd2a12020-04-09 02:03:20 -0500245
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500246Fail To Acquire Lock For Invalid Lock Flag
247 [Documentation] Failed to acquire read write lock for invalid lock flag passed.
248 [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag
249 [Template] Verify Fail To Acquire Lock For Invalid Lock Data
Vijayafdd2a12020-04-09 02:03:20 -0500250
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500251 # client_id lock_type message
252 HMCID-01 ReadCase6 ${BAD_REQUEST}
253 HMCID-01 ReadCase7 ${BAD_REQUEST}
254 HMCID-01 ReadCase8 ${BAD_REQUEST}
255 HMCID-01 ReadCase9 ${BAD_REQUEST}
256 HMCID-01 ReadCase10 ${BAD_REQUEST}
257 HMCID-01 ReadCase11 ${BAD_REQUEST}
258 HMCID-01 WriteCase6 ${BAD_REQUEST}
259 HMCID-01 WriteCase7 ${BAD_REQUEST}
260 HMCID-01 WriteCase8 ${BAD_REQUEST}
261 HMCID-01 WriteCase9 ${BAD_REQUEST}
262 HMCID-01 WriteCase10 ${BAD_REQUEST}
263 HMCID-01 WriteCase11 ${BAD_REQUEST}
Vijayafdd2a12020-04-09 02:03:20 -0500264
Vijayafdd2a12020-04-09 02:03:20 -0500265
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500266Fail To Acquire Lock For Invalid Segment Flag
267 [Documentation] Failed to acquire read write lock for invalid segment flag passed.
268 [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag
269 [Template] Verify Fail To Acquire Lock For Invalid Lock Data
270
271 # client_id lock_type message
272 HMCID-01 ReadCase12 ${BAD_REQUEST}
273 HMCID-01 ReadCase13 ${BAD_REQUEST}
274 HMCID-01 ReadCase14 ${BAD_REQUEST}
275 HMCID-01 WriteCase12 ${BAD_REQUEST}
276 HMCID-01 WriteCase13 ${BAD_REQUEST}
277 HMCID-01 WriteCase14 ${BAD_REQUEST}
Vijayafdd2a12020-04-09 02:03:20 -0500278
Sushil Singhbace3002020-10-08 08:12:58 -0500279
Sushil Singh3b3a7ec2020-11-23 03:54:06 -0600280Fail To Acquire Lock For Invalid Segment Data Type Flag
281 [Documentation] Failed to acquire read write lock for invalid segment flag passed.
282 [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Data_Type_Flag
283 [Template] Verify Fail To Acquire Lock For Invalid Lock Data
284
285 # client_id lock_type message
286 HMCID-01 ReadCase15 ${EMPTY}
287 HMCID-01 ReadCase16 ${EMPTY}
288 HMCID-01 ReadCase17 ${EMPTY}
289 HMCID-01 ReadCase18 ${EMPTY}
290 HMCID-01 WriteCase15 ${EMPTY}
291 HMCID-01 WriteCase16 ${EMPTY}
292 HMCID-01 WriteCase17 ${EMPTY}
293 HMCID-01 WriteCase18 ${EMPTY}
294
295
Sushil Singhbace3002020-10-08 08:12:58 -0500296Get Empty Lock Records For Session Where No Locks Acquired
297 [Documentation] If session does not acquire locks then get lock should return
298 ... empty lock records.
299 [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired
300 [Template] Verify No Locks Records For Session With No Acquired Lock
301
302 # client_id
303 HMCID-01
304
Sushil Singh728ef9c2020-10-28 04:25:39 -0500305
Sushil Singhf9a536c2020-11-09 07:33:17 -0600306Get Lock Records Empty For Invalid Session
307 [Documentation] Record of lock list is empty for invalid session.
308 [Tags] Get_Lock_Records_Empty_For_Invalid_Session
309 [Template] Verify Empty Lock Records For Invalid Session
310
311 # client_id
312 HMCID-01
313
314
Sushil Singh728ef9c2020-10-28 04:25:39 -0500315Get Lock Records For Multiple Session
316 [Documentation] Get lock records of multiple session.
317 [Tags] Get_Lock_Records_For_Multiple_Session
318 [Template] Verify Lock Records Of Multiple Session
319
320 # client_ids lock_type
321 HMCID-01,HMCID-02 ReadCase1,ReadCase1
322
323
Sushil Singhf9a536c2020-11-09 07:33:17 -0600324Get Lock Records For Multiple Invalid Session
325 [Documentation] Record of lock list is empty for list of invalid session.
326 [Tags] Get_Lock_Records_For_Multiple_Invalid_Session
327 [Template] Verify Lock Records For Multiple Invalid Session
328
329 # client_id
330 HMCID-01
331
Sushil Singh11949a22020-11-13 06:12:16 -0600332
333Get Lock Records For Multiple Invalid And Valid Session
334 [Documentation] Get record of lock from invalid and valid session.
335 [Tags] Get_Lock_Records_For_Multiple_Invalid_And_Valid_Session
336 [Template] Verify Lock Records For Multiple Invalid And Valid Session
337
338 # client_id lock_type
339 HMCID-01,HMCID-02 ReadCase1
340
Vijaybc331e22020-02-27 04:17:37 -0600341*** Keywords ***
342
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500343Create Redfish Session With ClientID
344 [Documentation] Create redifish session with client id.
345 [Arguments] ${client_id}
Vijay85610ee2020-04-03 05:30:28 -0500346
347 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500348 # client_id This client id can contain string value
349 # (e.g. 12345, "HMCID").
Vijay85610ee2020-04-03 05:30:28 -0500350
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500351 ${session_info}= Create Dictionary
352 ${session}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}}
Vijay85610ee2020-04-03 05:30:28 -0500353
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500354 Set To Dictionary ${session_info} SessionIDs ${session['Id']}
355 Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]}
Vijay85610ee2020-04-03 05:30:28 -0500356
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500357 [Return] ${session_info}
Vijay85610ee2020-04-03 05:30:28 -0500358
359
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500360RW General Dictionary
George Keishing16b3c7b2021-01-28 09:23:37 -0600361 [Documentation] Create dictionary of lock request.
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500362 [Arguments] ${read_case} ${res_id}
Vijaybc331e22020-02-27 04:17:37 -0600363
364 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500365 # read_case Read or Write lock type.
366 # res_id Resource id.
Vijaybc331e22020-02-27 04:17:37 -0600367
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500368 ${request_dict}= Create Dictionary
George Keishing566daaf2020-07-02 06:18:50 -0500369
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500370 FOR ${key} IN @{read_case.keys()}
371 Set To Dictionary ${request_dict} LockType ${key}
372 Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]}
373 END
Vijaybc331e22020-02-27 04:17:37 -0600374
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500375 Set To Dictionary ${request_dict} ResourceID ${res_id}
376
377 [Return] ${request_dict}
Vijaybc331e22020-02-27 04:17:37 -0600378
379
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500380Return Description Of Response
381 [Documentation] Return description of REST response.
Vijaybc331e22020-02-27 04:17:37 -0600382 [Arguments] ${resp_text}
383
384 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500385 # resp_text REST response body.
Vijaybc331e22020-02-27 04:17:37 -0600386
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500387 # resp_text after successful partition file upload looks like:
388 # {
389 # "Description": "File Created"
390 # }
Vijaybc331e22020-02-27 04:17:37 -0600391
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500392 ${message}= Evaluate json.loads('''${resp_text}''') json
393
394 [Return] ${message}
Vijaybc331e22020-02-27 04:17:37 -0600395
396
Sushil Singha7d71f02020-11-02 05:24:22 -0600397Verify Redfish Session Deleted
398 [Documentation] Verify the redfish session is deleted.
399 [Arguments] ${session_info}
400
401 # Description of argument(s):
402 # session_info Session information are stored in dictionary.
403
404 # ${session_info} = {
405 # 'SessionIDs': 'XXXXXXXXX',
406 # 'ClientID': 'XXXXXX',
407 # 'SessionToken': 'XXXXXXXXX',
408 # 'SessionResp': session response from redfish login
409 # }
410
411 # SessionIDs : Session IDs
412 # ClientID : Client ID
413 # SessionToken : Session token
414 # SessionResp : Response of creating an redfish login session
415
416 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions
417
418 FOR ${session} IN @{sessions['Members']}
Sushil Singh8a3efe72021-08-26 08:16:41 -0500419 Should Not Be Equal As Strings
420 ... session ['/redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}']
Sushil Singha7d71f02020-11-02 05:24:22 -0600421 END
422
423
424Verify Redfish List Of Session Deleted
425 [Documentation] Verify all the list of redfish session is deleted.
426 [Arguments] ${session_info_list}
427
428 # Description of argument(s):
429 # session_info_list List contains individual session record are stored in dictionary.
430
431 # ${session_info_list} = [{
432 # 'SessionIDs': 'XXXXXXXXX',
433 # 'ClientID': 'XXXXXX',
434 # 'SessionToken': 'XXXXXXXXX',
435 # 'SessionResp': session response from redfish login
436 # }]
437
438 # SessionIDs : Session IDs
439 # ClientID : Client ID
440 # SessionToken : Session token
441 # SessionResp : Response of creating an redfish login session
442
443 FOR ${session_record} IN @{session_info_list}
444 Verify Redfish Session Deleted ${session_record}
445 END
446
447
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500448Redfish Post Acquire Lock
449 [Documentation] Acquire and release lock.
450 [Arguments] ${lock_type} ${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 # status_code HTTP status code.
Vijaybc331e22020-02-27 04:17:37 -0600455
Sushil Singhe33c6e62020-09-29 06:34:35 -0500456 ${lock_dict_param}= Form Data To Acquire Lock ${lock_type}
Sushil Singh8a3efe72021-08-26 08:16:41 -0500457 ${resp}= Redfish Post Request
458 ... /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 Singhdf390b62021-01-19 00:50:05 -0600460
461 Run Keyword If ${status_code} == ${HTTP_BAD_REQUEST}
462 ... Valid Value ${BAD_REQUEST} ['${resp.content}']
463 ... ELSE
464 ... Run Keyword And Return Return Description Of Response ${resp.content}
Vijaybc331e22020-02-27 04:17:37 -0600465
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500466 [Return] ${resp}
Vijaybc331e22020-02-27 04:17:37 -0600467
468
Sushil Singh977f8f52020-11-20 06:32:50 -0600469Redfish Post Acquire List Lock
470 [Documentation] Acquire and release lock.
471 [Arguments] ${lock_type} ${status_code}=${HTTP_OK}
472
473 # Description of argument(s):
474 # lock_type Read lock or Write lock.
475 # status_code HTTP status code.
476
477 ${lock_dict_param}= Create Data To Acquire List Of Lock ${lock_type}
Sushil Singh8a3efe72021-08-26 08:16:41 -0500478 ${resp}= Redfish Post Request
479 ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param}
Sushil Singh977f8f52020-11-20 06:32:50 -0600480 Should Be Equal As Strings ${resp.status_code} ${status_code}
481
Sushil Singhe3f2e3b2022-07-28 05:15:43 -0500482 Run Keyword If ${status_code} == ${HTTP_CONFLICT}
483 ... Should Be Equal As Strings ${CONFLICT_RQUEST} ${resp.content}
484 ... ELSE
485 ... Run Keyword And Return Return Description Of Response ${resp.content}
486
Sushil Singh977f8f52020-11-20 06:32:50 -0600487 [Return] ${resp}
488
489
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500490Redfish Post Acquire Invalid Lock
491 [Documentation] Redfish to post request to acquire in-valid lock.
492 [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK}
Vijaybc331e22020-02-27 04:17:37 -0600493
494 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500495 # lock_type Read lock or Write lock.
496 # message Return message from URI.
497 # status_code HTTP status code.
Vijaybc331e22020-02-27 04:17:37 -0600498
Sushil Singhe33c6e62020-09-29 06:34:35 -0500499 ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type}
Sushil Singh8a3efe72021-08-26 08:16:41 -0500500 ${resp}= Redfish Post Request
501 ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500502 Should Be Equal As Strings ${resp.status_code} ${status_code}
Sushil Singh3b3a7ec2020-11-23 03:54:06 -0600503 Run Keyword If '${message}' != '${EMPTY}'
504 ... Valid Value message ['${resp.content}']
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500505
506 [Return] ${resp}
Vijaybc331e22020-02-27 04:17:37 -0600507
508
Sushil Singhe33c6e62020-09-29 06:34:35 -0500509Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID
510 [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id.
511 [Arguments] ${lock_type} ${status_code}=${HTTP_OK}
512
513 # Description of argument(s):
514 # lock_type Read lock or Write lock.
515 # status_code HTTP status code.
516
Sushil Singh8a3efe72021-08-26 08:16:41 -0500517 ${lock_dict_param}=
518 ... Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type}
519 ${resp}= Redfish Post Request
520 ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500521 Should Be Equal As Strings ${resp.status_code} ${status_code}
522
523 [Return] ${resp}
524
525
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500526Form Data To Acquire Lock
George Keishing16b3c7b2021-01-28 09:23:37 -0600527 [Documentation] Create a dictionary for lock request.
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500528 [Arguments] ${lock_type}
529
530 # Description of argument(s):
531 # lock_type Read lock or Write lock.
532
533 ${lock_res_info}= Get Lock Resource Information
534 ${resp}= RW General Dictionary
535 ... ${lock_res_info["Valid Case"]["${lock_type}"]}
536 ... ${lock_res_info["Valid Case"]["ResourceID"]}
537 ${temp_list}= Create List ${resp}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500538 ${lock_request_dict}= Create Dictionary Request=${temp_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500539
Sushil Singhe33c6e62020-09-29 06:34:35 -0500540 [Return] ${lock_request_dict}
541
542
Sushil Singh977f8f52020-11-20 06:32:50 -0600543Create Data To Acquire List Of Lock
George Keishing16b3c7b2021-01-28 09:23:37 -0600544 [Documentation] Create a dictionary for list of lock request.
Sushil Singh977f8f52020-11-20 06:32:50 -0600545 [Arguments] ${lock_type_list}
546
547 # Description of argument(s):
548 # lock_type Read lock or Write lock.
549
550 ${temp_list}= Create List
551 ${lock_res_info}= Get Lock Resource Information
552
553 FOR ${lock_type} IN @{lock_type_list}
554 ${resp}= RW General Dictionary
555 ... ${lock_res_info["Valid Case"]["${lock_type}"]}
556 ... ${lock_res_info["Valid Case"]["ResourceID"]}
557 Append To List ${temp_list} ${resp}
558 END
559
560 ${lock_request_dict}= Create Dictionary Request=${temp_list}
561
562 [Return] ${lock_request_dict}
563
564
Sushil Singhe33c6e62020-09-29 06:34:35 -0500565Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID
George Keishing16b3c7b2021-01-28 09:23:37 -0600566 [Documentation] Create a dictionary for in-valid lock request.
Sushil Singhe33c6e62020-09-29 06:34:35 -0500567 [Arguments] ${lock_type}
568
569 # Description of argument(s):
570 # lock_type Read lock or Write lock.
571
572 ${lock_res_info}= Get Lock Resource Information
573 ${resp}= RW General Dictionary
574 ... ${lock_res_info["Valid Case"]["${lock_type}"]}
575 ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]}
576 ${temp_list}= Create List ${resp}
577 ${lock_request_dict}= Create Dictionary Request=${temp_list}
578
579 [Return] ${lock_request_dict}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500580
581
582Form Data To Acquire Invalid Lock
George Keishing16b3c7b2021-01-28 09:23:37 -0600583 [Documentation] Create a dictionary for in-valid lock request.
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500584 [Arguments] ${lock_type}
585
586 # Description of argument(s):
587 # lock_type Read lock or Write lock.
588
589 ${lock_res_info}= Get Lock Resource Information
590 ${resp}= RW General Dictionary
591 ... ${lock_res_info["Invalid Case"]["${lock_type}"]}
592 ... ${lock_res_info["Valid Case"]["ResourceID"]}
593 ${temp_list}= Create List ${resp}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500594 ${lock_request_dict}= Create Dictionary Request=${temp_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500595
Sushil Singhe33c6e62020-09-29 06:34:35 -0500596 [Return] ${lock_request_dict}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500597
598
599Get Locks List On Resource
Vijaybc331e22020-02-27 04:17:37 -0600600 [Documentation] Get locks list.
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500601 [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK}
Vijaybc331e22020-02-27 04:17:37 -0600602
603 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500604 # session_info Session information in dict.
605 # exp_status_code Expected HTTP status code.
Vijaybc331e22020-02-27 04:17:37 -0600606
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500607 ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]}
George Keishing566daaf2020-07-02 06:18:50 -0500608 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList
609 ... data=${data}
Vijaybc331e22020-02-27 04:17:37 -0600610 ${locks}= Evaluate json.loads('''${resp.text}''') json
611
612 [Return] ${locks["Records"]}
613
614
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500615Verify Lock On Resource
616 [Documentation] Verify lock on resource.
617 [Arguments] ${session_info} ${transaction_id}
Vijaybc331e22020-02-27 04:17:37 -0600618
619 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500620 # session_info Session information in dict.
621 # transaction_id Transaction id in list stored in dict.
Vijaybc331e22020-02-27 04:17:37 -0600622
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500623 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']}
624 Rprint Vars sessions
625 ${lock_list}= Get Locks List On Resource ${session_info}
626 ${lock_length}= Get Length ${lock_list}
627 ${tran_id_length}= Get Length ${transaction_id}
628 Should Be Equal As Integers ${tran_id_length} ${lock_length}
Vijayafdd2a12020-04-09 02:03:20 -0500629
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500630 FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list}
631 Valid Value session_info['ClientID'] ['${lock['HMCID']}']
632 Valid Value session_info['SessionIDs'] ['${lock['SessionID']}']
633 Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']}
Vijaybc331e22020-02-27 04:17:37 -0600634 END
635
Vijaybc331e22020-02-27 04:17:37 -0600636
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500637Acquire Lock On Resource
638 [Documentation] Acquire lock on resource.
639 [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False
Vijaybc331e22020-02-27 04:17:37 -0600640
641 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500642 # client_id This client id can contain string value
643 # (e.g. 12345, "HMCID").
644 # lock_type Read lock or Write lock.
645 # reboot_flag Flag is used to run reboot the BMC code.
646 # (e.g. True or False).
Vijaybc331e22020-02-27 04:17:37 -0600647
Sushil Singh8a3efe72021-08-26 08:16:41 -0500648 ${trans_id_emptylist}= Create List
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500649 ${trans_id_list}= Create List
Sushil Singh8a3efe72021-08-26 08:16:41 -0500650
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500651 ${session_info}= Create Redfish Session With ClientID ${client_id}
652 ${trans_id}= Redfish Post Acquire Lock ${lock_type}
653 Append To List ${trans_id_list} ${trans_id}
Sushil Singh8a3efe72021-08-26 08:16:41 -0500654
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500655 Verify Lock On Resource ${session_info} ${trans_id_list}
George Keishing566daaf2020-07-02 06:18:50 -0500656
Sushil Singhe33c6e62020-09-29 06:34:35 -0500657 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
Vijaybc331e22020-02-27 04:17:37 -0600658
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500659 Run Keyword If '${reboot_flag}' == 'True'
Sushil Singh8a3efe72021-08-26 08:16:41 -0500660 ... Run Keywords Redfish BMC Reset Operation AND
Sushil Singhe33c6e62020-09-29 06:34:35 -0500661 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
Sushil Singh8a3efe72021-08-26 08:16:41 -0500662 ... Is BMC Standby AND
663 ... Verify Lock On Resource ${session_info} ${trans_id_emptylist}
Vijaybc331e22020-02-27 04:17:37 -0600664
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500665 Run Keyword If '${reboot_flag}' == 'False'
666 ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK}
Vijaybc331e22020-02-27 04:17:37 -0600667
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500668 ${trans_id_emptylist}= Create List
669 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
670 Redfish Delete Session ${session_info}
Vijaybc331e22020-02-27 04:17:37 -0600671
Vijaybc331e22020-02-27 04:17:37 -0600672
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500673Form Data To Release Lock
674 [Documentation] Create a dictonay to release lock.
675 [Arguments] ${trans_id_list}
Vijay355daac2020-03-26 12:06:08 -0500676
677 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500678 # trans_id_list
Vijay355daac2020-03-26 12:06:08 -0500679
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500680 @{tran_ids}= Create List
Vijay355daac2020-03-26 12:06:08 -0500681
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500682 FOR ${item} IN @{trans_id_list}
683 Append To List ${tran_ids} ${item['TransactionID']}
684 END
685
686 [Return] ${tran_ids}
687
688
689Release Locks On Resource
690 [Documentation] Redfish request to release a lock.
Sushil Singh8a3efe72021-08-26 08:16:41 -0500691 [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction
692 ... ${status_code}=${HTTP_OK}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500693
694 # Description of argument(s):
695 # session_info Session information in dict.
696 # trans_id_list Transaction id list.
697 # release_lock_type Release lock by Transaction, Session.
698 # status_code HTTP status code.
699
700 ${tran_ids}= Form Data To Release Lock ${trans_id_list}
701 ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}}
702 ${data}= Evaluate json.dumps(${data}) json
703 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data}
704 Should Be Equal As Strings ${resp.status_code} ${status_code}
705
706
Sushil Singhdf390b62021-01-19 00:50:05 -0600707Release locks And Delete Session
708 [Documentation] Release locks and delete redfish session.
709 [Arguments] ${session_info} ${trans_id_list}
710
711 Release Locks On Resource ${session_info} ${trans_id_list}
712
713 ${trans_id_emptylist}= Create List
714 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
715
716 Redfish Delete Session ${session_info}
717
718
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500719Acquire Lock On Another Lock
720 [Documentation] Acquire lock on another lock.
721 [Arguments] ${client_id}
722
723 # Description of argument(s):
724 # client_id This client id can contain string value
725 # (e.g. 12345, "HMCID").
726
727 ${trans_id_list}= Create List
728 ${session_info}= Create Redfish Session With ClientID ${client_id}
729
730 ${trans_id}= Redfish Post Acquire Lock ReadCase1
731 Append To List ${trans_id_list} ${trans_id}
732
733 ${trans_id}= Redfish Post Acquire Lock ReadCase1
734 Append To List ${trans_id_list} ${trans_id}
735
736 Verify Lock On Resource ${session_info} ${trans_id_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500737
Sushil Singhdf390b62021-01-19 00:50:05 -0600738 Release locks And Delete Session ${session_info} ${trans_id_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500739
740
Sushil Singh977f8f52020-11-20 06:32:50 -0600741Verify Fail To Acquire Read And Write In Single Request
742 [Documentation] Verify fail to acquire read and write lock passed in single request.
Sushil Singhe3f2e3b2022-07-28 05:15:43 -0500743 [Arguments] ${client_id} ${lock_type} ${status_code}
744
745 # Description of argument(s):
746 # client_id This client id can contain string value
747 # (e.g. 12345, "HMCID").
748 # lock_type Read lock or Write lock.
749 # status_code HTTP status code
750
751 ${lock_type_list}= Split String ${lock_type} ,
752
753 ${session_info}= Create Redfish Session With ClientID ${client_id}
754 ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list} status_code=${status_code}
755 Redfish Delete Session ${session_info}
756
757
758Verify Acquire Read In Single Request
759 [Documentation] Verify acquire read in single request.
Sushil Singh977f8f52020-11-20 06:32:50 -0600760 [Arguments] ${client_id} ${lock_type}
761
762 # Description of argument(s):
763 # client_id This client id can contain string value
764 # (e.g. 12345, "HMCID").
765 # lock_type Read lock or Write lock.
766
Sushil Singhe3f2e3b2022-07-28 05:15:43 -0500767 ${trans_id_list}= Create List
Sushil Singh977f8f52020-11-20 06:32:50 -0600768 ${lock_type_list}= Split String ${lock_type} ,
769
770 ${session_info}= Create Redfish Session With ClientID ${client_id}
Sushil Singhe3f2e3b2022-07-28 05:15:43 -0500771 ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list}
772 Append To List ${trans_id_list} ${trans_id}
773 Append To List ${trans_id_list} ${trans_id}
774
775 Verify Lock On Resource ${session_info} ${trans_id_list}
776 Remove From List ${trans_id_list} 1
777 Release Locks On Resource ${session_info} ${trans_id_list}
778
Sushil Singh977f8f52020-11-20 06:32:50 -0600779 Redfish Delete Session ${session_info}
780
781
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500782Verify Empty Lock Records For Invalid Session
783 [Documentation] Verify no lock record found for invalid session.
784 [Arguments] ${client_id}
785
786 # Description of argument(s):
787 # client_id This client id can contain string value
788 # (e.g. 12345, "HMCID").
789
790 ${session_info1}= Create Redfish Session With ClientID ${client_id}
791
792 ${lock_list1}= Get Locks List On Resource ${session_info1}
793 ${lock_length1}= Get Length ${lock_list1}
794
795 ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True
796 set to dictionary ${session_info2} SessionIDs xxyXyyYZZz
797
798 ${lock_list2}= Get Locks List On Resource ${session_info2}
Sushil Singhf9a536c2020-11-09 07:33:17 -0600799 ${lock_length2}= Get Length ${lock_list2}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500800
Sushil Singhf9a536c2020-11-09 07:33:17 -0600801 Should Be Equal As Integers ${lock_length1} ${lock_length2}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500802
803 Redfish Delete Session ${session_info1}
804
805
806Verify Acquire Lock Fails On Another Lock
807 [Documentation] Verify acquire lock on another lock fails.
808 [Arguments] ${client_id} ${lock_type}
809
810 # Description of argument(s):
811 # client_id This client id can contain string value
812 # (e.g. 12345, "HMCID").
813 # lock_type Read lock or Write lock.
814
815 @{lock_type_list}= Split String ${lock_type} ,
816 ${session_info}= Create Redfish Session With ClientID ${client_id}
817 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
818
819 ${trans_id_list}= Create List
820 Append To List ${trans_id_list} ${trans_id}
821
822 Verify Lock On Resource ${session_info} ${trans_id_list}
823 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500824
Sushil Singhdf390b62021-01-19 00:50:05 -0600825 Release locks And Delete Session ${session_info} ${trans_id_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500826
827
Sushil Singhe33c6e62020-09-29 06:34:35 -0500828Verify Acquire Lock After Reboot
829 [Documentation] Acquire read and write lock after the reboot and release lock.
830 [Arguments] ${client_id} ${lock_type}
831
832 # Description of argument(s):
833 # client_id This client id can contain string value
834 # (e.g. 12345, "HMCID").
835 # lock_type Read lock or Write lock.
836
837 ${trans_id_list}= Create List
Sushil Singhf9a536c2020-11-09 07:33:17 -0600838 ${session_info}= Create Session With ClientID ${client_id}
Sushil Singhac229c72021-09-13 02:26:51 -0500839
Sushil Singhe33c6e62020-09-29 06:34:35 -0500840 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
Sushil Singhac229c72021-09-13 02:26:51 -0500841 Redfish BMC Reset Operation
Sushil Singhe33c6e62020-09-29 06:34:35 -0500842 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
Sushil Singhac229c72021-09-13 02:26:51 -0500843 Is BMC Standby
Sushil Singhe33c6e62020-09-29 06:34:35 -0500844
845 ${trans_id}= Redfish Post Acquire Lock ${lock_type}
846 Append To List ${trans_id_list} ${trans_id}
847 Verify Lock On Resource ${session_info} ${trans_id_list}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500848
Sushil Singhdf390b62021-01-19 00:50:05 -0600849 Release locks And Delete Session ${session_info} ${trans_id_list}
850
851
852Verify Acquire Multiple Lock Request At CEC Level
853 [Documentation] Acquire lock in loop.
854 [Arguments] ${client_id} ${lock_type}
855
856 # Description of argument(s):
857 # client_id This client id can contain string value
858 # (e.g. 12345, "HMCID").
859 # lock_type Read lock or Write lock.
860
861 ${trans_id_list}= Create List
862 @{lock_type_list}= Split String ${lock_type} ,
863 ${session_info}= Create Redfish Session With ClientID ${client_id}
864
865 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
866 Append To List ${trans_id_list} ${trans_id}
867
868 Verify Lock On Resource ${session_info} ${trans_id_list}
869
870 Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT}
871
872 Release locks And Delete Session ${session_info} ${trans_id_list}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500873
874
Sushil Singh8d420bf2021-09-06 08:27:41 -0500875Post Reboot Acquire Lock
876 [Documentation] Post reboot acquire lock and verify the transaction id is 1.
877 [Arguments] ${session_info} ${lock_type}
878
879 # Description of argument(s):
880 # session_info Session information.
881 # lock_type Read lock or Write lock.
882
883 ${trans_id_list}= Create List
884 ${trans_id_list_var}= Create List
885 ${trans_id}= Redfish Post Acquire Lock ${lock_type}
886 Append To List ${trans_id_list} ${trans_id}
887 Append To List ${trans_id_list_var} ${default_trans_id}
888 Verify Lock On Resource ${session_info} ${trans_id_list}
889 Verify Lock On Resource ${session_info} ${trans_id_list_var}
890 Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK}
891 ${trans_id_emptylist}= Create List
892 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
893
894
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500895Verify Acquire And Release Lock In Loop
896 [Documentation] Acquire lock in loop.
Sushil Singh8d420bf2021-09-06 08:27:41 -0500897 [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500898
899 # Description of argument(s):
900 # client_id This client id can contain string value
901 # (e.g. 12345, "HMCID").
902 # lock_type Read lock or Write lock.
Sushil Singh8d420bf2021-09-06 08:27:41 -0500903 # reboot_flag Flag is used to run reboot the BMC code.
904 # (e.g. True or False).
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500905
906 FOR ${count} IN RANGE 1 11
907 ${trans_id_list}= Create List
908 ${session_info}= Create Redfish Session With ClientID ${client_id}
909 ${trans_id}= Redfish Post Acquire Lock ${lock_type}
910 Append To List ${trans_id_list} ${trans_id}
911 Verify Lock On Resource ${session_info} ${trans_id_list}
912 Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK}
913 ${trans_id_emptylist}= Create List
914 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
Sushil Singh8d420bf2021-09-06 08:27:41 -0500915 Redfish Delete Session ${session_info}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500916 END
917
Sushil Singh8d420bf2021-09-06 08:27:41 -0500918 ${session_info}= Create Redfish Session With ClientID ${client_id}
919 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
920
921 Run Keyword If '${reboot_flag}' == 'True'
922 ... Run Keywords Redfish BMC Reset Operation AND
923 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
924 ... Is BMC Standby AND
925 ... Post Reboot Acquire Lock ${session_info} ${lock_type}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500926 Redfish Delete Session ${session_info}
927
928
929Acquire And Release Multiple Locks
930 [Documentation] Acquire mutilple locks on resource.
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 @{lock_type_list}= Split String ${lock_type} ,
940 ${session_info}= Create Redfish Session With ClientID ${client_id}
941 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
942
943 ${trans_id_list}= Create List
944
945 Append To List ${trans_id_list} ${trans_id}
946 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
947
948 Append To List ${trans_id_list} ${trans_id}
949 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2]
950
951 Append To List ${trans_id_list} ${trans_id}
952 Verify Lock On Resource ${session_info} ${trans_id_list}
953 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type}
954
955 ${trans_id_emptylist}= Create List
956 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
957 Redfish Delete Session ${session_info}
958
959
susilsi794116c62021-03-04 07:57:51 -0600960Verify Release Lock When Session Deleted
961 [Documentation] Verify lock get released when session are deleted.
962 [Arguments] ${client_id} ${lock_type}
963
964 # Description of argument(s):
965 # client_ids This client id can contain string value
966 # (e.g. 12345, "HMCID").
967 # lock_type Read lock or Write lock.
968
969 ${trans_id_list}= Create List
970 @{lock_type_list}= Split String ${lock_type} ,
971
972 ${pre_session_info}= Create Redfish Session With ClientID ${client_id}
973
974 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
975 Append To List ${trans_id_list} ${trans_id}
976 Verify Lock On Resource ${pre_session_info} ${trans_id_list}
977
978 Redfish Delete Session ${pre_session_info}
979 ${post_session_info}= Create Redfish Session With ClientID ${client_id}
980 ${resp}= Get Locks List On Resource With Session List ${pre_session_info} ${HTTP_BAD_REQUEST}
981
982 Redfish Delete Session ${post_session_info}
983
984
985
Sushil Singh59011d02021-01-27 23:00:20 -0600986Verify Fail To Release Lock With Invalid TransactionID
George Keishing16b3c7b2021-01-28 09:23:37 -0600987 [Documentation] Verify fail to be release lock with invalid transaction ID.
Sushil Singh59011d02021-01-27 23:00:20 -0600988 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
989
990 # Description of argument(s):
991 # client_id This client id can contain string value
992 # (e.g. 12345, "HMCID").
993 # lock_type Read lock or Write lock.
994 # release_lock_type The value can be Transaction or Session.
995
996 ${trans_id_list}= Create List
997 @{lock_type_list}= Split String ${lock_type} ,
998
999 ${session_info}= Create Redfish Session With ClientID ${client_id}
1000
1001 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1002 ${value}= Get From Dictionary ${trans_id} TransactionID
1003 ${value}= Evaluate ${value} + 10
1004 Set To Dictionary ${trans_id} TransactionID ${value}
1005 Append To List ${trans_id_list} ${trans_id}
1006
1007 Release Locks On Resource
1008 ... ${session_info} ${trans_id_list}
1009 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST}
1010 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session
1011
1012 ${trans_id_emptylist}= Create List
1013 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
1014 Redfish Delete Session ${session_info}
1015
1016
Sushil Singh1b590532021-01-20 05:13:54 -06001017Verify Fail To Release Multiple Lock With Invalid TransactionID
1018 [Documentation] Verify release multiple locks with invalid transaction ID fails.
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001019 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
1020
1021 # Description of argument(s):
1022 # client_id This client id can contain string value
1023 # (e.g. 12345, "HMCID").
1024 # lock_type Read lock or Write lock.
1025 # release_lock_type The value can be Transaction or Session.
1026
1027 ${trans_id_list}= Create List
1028 @{lock_type_list}= Split String ${lock_type} ,
1029
1030 ${session_info}= Create Redfish Session With ClientID ${client_id}
1031
1032 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1033 ${value}= Get From Dictionary ${trans_id} TransactionID
1034 ${value}= Evaluate ${value} + 10
1035 Set To Dictionary ${trans_id} TransactionID ${value}
1036 Append To List ${trans_id_list} ${trans_id}
1037
1038 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
1039 ${value}= Get From Dictionary ${trans_id} TransactionID
1040 ${value}= Evaluate ${value} + 10
1041 Set To Dictionary ${trans_id} TransactionID ${value}
1042 Append To List ${trans_id_list} ${trans_id}
1043
1044 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2]
1045 ${value}= Get From Dictionary ${trans_id} TransactionID
1046 ${value}= Evaluate ${value} + 10
1047 Set To Dictionary ${trans_id} TransactionID ${value}
1048 Append To List ${trans_id_list} ${trans_id}
1049
1050 Release Locks On Resource
1051 ... ${session_info} ${trans_id_list}
1052 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST}
1053 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session
1054
1055 ${trans_id_emptylist}= Create List
1056 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
1057 Redfish Delete Session ${session_info}
1058
1059
Sushil Singh8bee3582021-01-27 23:46:48 -06001060Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID
George Keishing96143832021-03-23 07:55:08 -05001061 [Documentation] Verify fail to be release multiple lock with valid and invalid transaction ID.
Sushil Singh8bee3582021-01-27 23:46:48 -06001062 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
1063
1064 # Description of argument(s):
1065 # client_id This client id can contain string value
1066 # (e.g. 12345, "HMCID").
1067 # lock_type Read lock or Write lock.
1068 # release_lock_type The value can be Transaction or Session.
1069
1070 ${trans_id_list}= Create List
1071 @{lock_type_list}= Split String ${lock_type} ,
1072
1073 ${session_info}= Create Redfish Session With ClientID ${client_id}
1074
1075 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1076 Append To List ${trans_id_list} ${trans_id}
1077
1078 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
1079 ${value}= Get From Dictionary ${trans_id} TransactionID
1080 ${value}= Evaluate ${value} + 10
1081 Set To Dictionary ${trans_id} TransactionID ${value}
1082 Append To List ${trans_id_list} ${trans_id}
1083
1084 Release Locks On Resource
1085 ... ${session_info} ${trans_id_list}
1086 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST}
1087 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session
1088
1089 ${trans_id_emptylist}= Create List
1090 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
1091 Redfish Delete Session ${session_info}
1092
1093
susilsi71d7b9962021-03-02 03:06:18 -06001094Verify Fail To Release Lock With TransactionID As String Type
George Keishing96143832021-03-23 07:55:08 -05001095 [Documentation] Verify fail to be release lock with transaction ID as string data type.
susilsi71d7b9962021-03-02 03:06:18 -06001096 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
1097
1098 # Description of argument(s):
1099 # client_id This client id can contain string value
1100 # (e.g. 12345, "HMCID").
1101 # lock_type Read lock or Write lock.
1102 # release_lock_type The value can be Transaction or Session.
1103
1104 ${trans_id_list}= Create List
1105 @{lock_type_list}= Split String ${lock_type} ,
1106
1107 ${session_info}= Create Redfish Session With ClientID ${client_id}
1108
1109 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1110
1111 Append To List ${trans_id_list} ${trans_id}
1112
1113 ${temp_trans_id_list}= Copy Dictionary ${trans_id_list} deepcopy=True
1114
1115 ${value}= Get From Dictionary ${trans_id_list}[0] TransactionID
1116 ${value}= Set Variable \'${value}\'
1117 Set To Dictionary ${temp_trans_id_list}[0] TransactionID ${value}
1118
1119 Release Locks On Resource
1120 ... ${session_info} ${temp_trans_id_list}
1121 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST}
1122
1123 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type}
1124
1125 ${trans_id_emptylist}= Create List
1126 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
1127 Redfish Delete Session ${session_info}
1128
1129
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001130Verify Fail To Release Lock For Another Session
1131 [Documentation] Verify failed to release the lock form another session.
1132 [Arguments] ${client_id} ${lock_type}
1133
1134 # Description of argument(s):
1135 # client_id This client id can contain string value
1136 # (e.g. 12345, "HMCID").
1137 # lock_type Read lock or Write lock.
1138
1139 ${client_ids}= Split String ${client_id} ,
1140 ${lock_type_list}= Split String ${lock_type} ,
1141 ${trans_id_list1}= Create List
1142 ${trans_id_list2}= Create List
1143
1144 ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0]
1145
1146 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1147 Append To List ${trans_id_list1} ${trans_id}
1148 Verify Lock On Resource ${session_info1} ${trans_id_list1}
1149
1150 ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1]
1151 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
1152 Append To List ${trans_id_list2} ${trans_id}
1153 Verify Lock On Resource ${session_info2} ${trans_id_list2}
1154
1155 Release Locks On Resource
Sushil Singhe3f2e3b2022-07-28 05:15:43 -05001156 ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_BAD_REQUEST}
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001157 Verify Lock On Resource ${session_info1} ${trans_id_list1}
1158 Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session
1159 Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session
1160 Redfish Delete Session ${session_info1}
1161 Redfish Delete Session ${session_info2}
1162
1163
Sushil Singhe33c6e62020-09-29 06:34:35 -05001164Verify Fail To Acquire Lock For Invalid Resource ID Data Type
1165 [Documentation] Verify fail to acquire the lock with invalid resource id data type.
1166 [Arguments] ${client_id} ${lock_type}
1167
1168 # Description of argument(s):
1169 # client_id This client id can contain string value
1170 # (e.g. 12345, "HMCID").
1171 # lock_type Read lock or Write lock.
1172
1173 ${session_info}= Create Redfish Session With ClientID ${client_id}
1174 Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID
1175 ... ${lock_type} status_code=${HTTP_BAD_REQUEST}
1176 Redfish Delete Session ${session_info}
1177
1178
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001179Verify Fail To Acquire Lock For Invalid Lock Data
George Keishing16b3c7b2021-01-28 09:23:37 -06001180 [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segment flags.
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001181 [Arguments] ${client_id} ${lock_type} ${message}
1182
1183 # Description of argument(s):
1184 # client_id This client id can contain string value
1185 # (e.g. 12345, "HMCID").
1186 # lock_type Read lock or Write lock.
1187 # message Return message from URI.
1188
1189 ${session_info}= Create Redfish Session With ClientID ${client_id}
Sushil Singh8a3efe72021-08-26 08:16:41 -05001190 ${trans_id}= Redfish Post Acquire Invalid Lock
1191 ... ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST}
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001192 Redfish Delete Session ${session_info}
Sushil Singhbace3002020-10-08 08:12:58 -05001193
1194
1195Verify No Locks Records For Session With No Acquired Lock
1196 [Documentation] Verify no records found for a session where no lock is acquired.
1197 [Arguments] ${client_id}
1198
1199 # Description of argument(s):
1200 # client_id This client id can contain string value
1201 # (e.g. 12345, "HMCID").
1202
1203 ${session_info}= Create Redfish Session With ClientID ${client_id}
1204 ${trans_id_emptylist}= Create List
1205 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
1206 Redfish Delete Session ${session_info}
Sushil Singh728ef9c2020-10-28 04:25:39 -05001207
1208
1209Create List Of Session ID
1210 [Documentation] Create session id list from session dict info.
1211 [Arguments] ${session_dict_info}
1212
1213 # Description of argument(s):
1214 # session_dict_info Session information in dict.
1215
1216 @{session_id_list}= Create List
1217
1218 FOR ${session} IN @{session_dict_info}
1219 Append To List ${session_id_list} ${session["SessionIDs"]}
1220 END
1221
1222 ${num_id}= Get Length ${session_id_list}
1223 Should Not Be Equal As Integers ${num_id} ${0}
1224
1225 ${session_id_list}= Evaluate json.dumps(${session_id_list}) json
1226
1227 [Return] ${session_id_list}
1228
1229
1230Get Locks List On Resource With Session List
1231 [Documentation] Get locks list from session of list.
1232 [Arguments] ${session_id_list} ${exp_status_code}=${HTTP_OK}
1233
1234 # Description of argument(s):
1235 # session_id_list Session ids list.
1236 # exp_status_code Expected HTTP status code.
1237
1238 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList
1239 ... data={"SessionIDs": ${session_id_list}}
susilsi794116c62021-03-04 07:57:51 -06001240 Should Be Equal As Strings ${resp.status_code} ${exp_status_code}
Sushil Singh728ef9c2020-10-28 04:25:39 -05001241 ${locks}= Evaluate json.loads('''${resp.text}''') json
1242
1243 [Return] ${locks}
1244
1245
1246Verify List Of Session Lock On Resource
1247 [Documentation] Verify list of lock record from list of sessions.
1248 [Arguments] ${session_dict_info} ${transaction_id_list}
1249
1250 # Description of argument(s):
1251 # session_dict_info Session information in dict.
1252 # transaction_id_list Transaction id in list stored in dict.
1253
1254 ${session_id_list}= Create List Of Session ID ${session_dict_info}
1255 ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list}
1256 ${lock_list}= Set Variable ${lock_list_resp['Records']}
1257
Sushil Singh8a3efe72021-08-26 08:16:41 -05001258 FOR ${session_id} ${tran_id} ${lock_record} IN ZIP
1259 ... ${session_dict_info} ${transaction_id_list} ${lock_list}
Sushil Singh728ef9c2020-10-28 04:25:39 -05001260 Valid Value session_id['SessionIDs'] ['${lock_record['SessionID']}']
1261 Should Be Equal As Integers ${tran_id['TransactionID']} ${lock_record['TransactionID']}
1262 END
1263
1264
1265Verify Lock Records Of Multiple Session
1266 [Documentation] Verify all records found for a multiple sessions.
1267 [Arguments] ${client_ids} ${lock_type}
1268
1269 # Description of argument(s):
1270 # client_ids This client id can contain string value
1271 # (e.g. 12345, "HMCID").
1272 # lock_type Read lock or Write lock.
1273
1274 ${client_id_list}= Split String ${client_ids} ,
1275 ${lock_type_list}= Split String ${lock_type} ,
1276 ${trans_id_list1}= Create List
1277 ${trans_id_list2}= Create List
1278
1279 ${session_dict_list}= Create List
1280 ${lock_list}= Create List
1281
1282 ${client_id1}= Create List
1283 Append To List ${client_id1} ${client_id_list}[0]
1284 ${session_info1}= Create Session With List Of ClientID ${client_id1}
1285 Append To List ${session_dict_list} ${session_info1}[0]
1286 Verify A Session Created With ClientID ${client_id1} ${session_info1}
1287
1288 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1289 Append To List ${trans_id_list1} ${trans_id}
1290 Append To List ${lock_list} ${trans_id}
1291 Verify Lock On Resource ${session_info1}[0] ${trans_id_list1}
1292
1293
1294 ${client_id2}= Create List
1295 Append To List ${client_id2} ${client_id_list}[1]
1296 ${session_info2}= Create Session With List Of ClientID ${client_id2}
1297 Append To List ${session_dict_list} ${session_info2}[0]
1298 Verify A Session Created With ClientID ${client_id2} ${session_info2}
1299
1300 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
1301 Append To List ${trans_id_list2} ${trans_id}
1302 Append To List ${lock_list} ${trans_id}
1303 Verify Lock On Resource ${session_info2}[0] ${trans_id_list2}
1304
1305 Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list}
1306
1307 ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken
1308 Set Global Variable ${XAUTH_TOKEN} ${session_token}
1309
1310 Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction
1311
1312 ${session_token}= Get From Dictionary ${session_info2}[0] SessionToken
1313 Set Global Variable ${XAUTH_TOKEN} ${session_token}
1314
1315 Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Transaction
1316
1317 ${trans_id_emptylist}= Create List
1318 Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist}
1319 Verify Lock On Resource ${session_info2}[0] ${trans_id_emptylist}
1320
1321 Redfish Delete List Of Session ${session_dict_list}
Sushil Singhf9a536c2020-11-09 07:33:17 -06001322
1323
1324Verify Lock Records For Multiple Invalid Session
1325 [Documentation] Verify no lock record found for multiple invalid session.
1326 [Arguments] ${client_id}
1327
1328 # Description of argument(s):
1329 # client_id This client id can contain string value
1330 # (e.g. 12345, "HMCID").
1331
1332 ${session_dict_list}= Create List
1333 ${invalid_session_ids}= Create List xxyXyyYZZz xXyXYyYZzz
1334
1335 ${session_info1}= Create Session With ClientID ${client_id}
1336
1337 ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True
1338 set to dictionary ${session_info2} SessionIDs ${invalid_session_ids}[0]
1339 Append To List ${session_dict_list} ${session_info2}
1340
1341 ${session_info3}= Copy Dictionary ${session_info1} deepcopy=True
1342 set to dictionary ${session_info3} SessionIDs ${invalid_session_ids}[0]
1343 Append To List ${session_dict_list} ${session_info3}
1344
1345 ${lock_list1}= Get Locks List On Resource ${session_info1}
1346 ${lock_length1}= Get Length ${lock_list1}
1347
1348 ${session_id_list}= Create List Of Session ID ${session_dict_list}
1349 ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list}
1350 ${lock_length2}= Get Length ${lock_list_resp['Records']}
1351
1352 Should Be Equal As Integers ${lock_length1} ${lock_length2}
1353
1354 Redfish Delete Session ${session_info1}
Sushil Singh11949a22020-11-13 06:12:16 -06001355
1356
1357Verify Lock Records For Multiple Invalid And Valid Session
1358 [Documentation] Verify all records found for a valid and invalid sessions.
1359 [Arguments] ${client_ids} ${lock_type}
1360
1361 # Description of argument(s):
1362 # client_ids This client id can contain string value
1363 # (e.g. 12345, "HMCID").
1364 # lock_type Read lock or Write lock.
1365
1366 ${client_id_list}= Split String ${client_ids} ,
1367 ${lock_type_list}= Split String ${lock_type} ,
1368 ${trans_id_list1}= Create List
1369 ${invalid_session_ids}= Create List xxyXyyYZZz
1370
1371 ${session_dict_list}= Create List
1372 ${lock_list}= Create List
1373
1374 ${client_id1}= Create List
1375 Append To List ${client_id1} ${client_id_list}[0]
1376 ${session_info1}= Create Session With List Of ClientID ${client_id1}
1377 Append To List ${session_dict_list} ${session_info1}[0]
1378 Verify A Session Created With ClientID ${client_id1} ${session_info1}
1379
1380 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1381 Append To List ${trans_id_list1} ${trans_id}
1382 Append To List ${lock_list} ${trans_id}
1383 Verify Lock On Resource ${session_info1}[0] ${trans_id_list1}
1384
1385 ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True
1386 set to dictionary ${session_info2}[0] SessionIDs ${invalid_session_ids}[0]
1387 Append To List ${session_dict_list} ${session_info2}[0]
1388
1389 Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list}
1390
1391 ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken
1392 Set Global Variable ${XAUTH_TOKEN} ${session_token}
1393
1394 Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction
1395
1396 ${trans_id_emptylist}= Create List
1397 Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist}
1398
1399 Redfish Delete Session ${session_info1}[0]