blob: 16f6e8b6268b6ddf82c2545660d9ac5f2cf2b0de [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
George Keishingfbd67002022-08-01 11:24:03 -050011Library JSONLibrary
Vijaybc331e22020-02-27 04:17:37 -060012
Sushil Singh8d420bf2021-09-06 08:27:41 -050013Suite Setup Run Keyword And Ignore Error Delete All Redfish Sessions
14Suite Teardown Run Keyword And Ignore Error Delete All Redfish Sessions
15Test Setup Printn
16Test Teardown FFDC On Test Case Fail
Vijaybc331e22020-02-27 04:17:37 -060017
18*** Variables ***
19
Sushil Singhe3f2e3b2022-07-28 05:15:43 -050020${CONFLICT_RQUEST} Conflict
Sushil Singh8d420bf2021-09-06 08:27:41 -050021${BAD_REQUEST} Bad Request
22&{default_trans_id} TransactionID=${1}
Vijaybc331e22020-02-27 04:17:37 -060023
24*** Test Cases ***
25
Sushil Singhd03f2ce2020-09-17 08:54:41 -050026Acquire Read Write Lock
Vijaybc331e22020-02-27 04:17:37 -060027 [Documentation] Acquire and release different read locks.
Sushil Singhd03f2ce2020-09-17 08:54:41 -050028 [Tags] Acquire_Read_Write_Lock
29 [Template] Acquire Lock On Resource
Vijaybc331e22020-02-27 04:17:37 -060030
Sushil Singhd03f2ce2020-09-17 08:54:41 -050031 # client_id lock_type reboot_flag
32 HMCID-01 ReadCase1 False
33 HMCID-01 ReadCase2 False
34 HMCID-01 ReadCase3 False
35 HMCID-01 WriteCase1 False
36 HMCID-01 WriteCase2 False
37 HMCID-01 WriteCase3 False
Vijaybc331e22020-02-27 04:17:37 -060038
39
Sushil Singhd8bf1422021-09-06 05:19:09 -050040Verify Lock Is Not Persistent On BMC Reboot
41 [Documentation] Acquire lock and after reboot the locks are removed as no persistency
42 ... maintained.
43 [Tags] Verify_Lock_Is_Not_Persistent_On_BMC_Reboot
Sushil Singhd03f2ce2020-09-17 08:54:41 -050044 [Template] Acquire Lock On Resource
Vijaybc331e22020-02-27 04:17:37 -060045
Sushil Singhd03f2ce2020-09-17 08:54:41 -050046 # client_id lock_type reboot_flag
47 HMCID-01 ReadCase1 True
48 HMCID-01 ReadCase2 True
49 HMCID-01 ReadCase3 True
50 HMCID-01 WriteCase1 True
51 HMCID-01 WriteCase2 True
52 HMCID-01 WriteCase3 True
Vijaybc331e22020-02-27 04:17:37 -060053
54
Sushil Singh8d420bf2021-09-06 08:27:41 -050055Check After Reboot Transaction ID Set To Default
56 [Documentation] After reboot, the transaction id starts with default i.e. 1,
George Keishing7fd1ac02021-09-23 08:10:33 -050057 ... if any lock is acquired.
Sushil Singh8d420bf2021-09-06 08:27:41 -050058 [Tags] Check_After_Reboot_Transaction_ID_Set_To_Default
59 [Template] Verify Acquire And Release Lock In Loop
60
61 # client_id lock_type reboot_flag
62 HMCID-01 ReadCase1 True
63 HMCID-01 WriteCase1 True
64
65
Sushil Singhd03f2ce2020-09-17 08:54:41 -050066Acquire Read Lock On Read Lock
67 [Documentation] Acquire read lock on another read lock.
68 [Tags] Acquire_Read_Lock_On_Read_Lock
69 [Template] Acquire Lock On Another Lock
Vijaybc331e22020-02-27 04:17:37 -060070
Sushil Singhd03f2ce2020-09-17 08:54:41 -050071 # client_id
72 HMCID-01
Vijaybc331e22020-02-27 04:17:37 -060073
74
Sushil Singhd03f2ce2020-09-17 08:54:41 -050075Fail To Acquire Lock On Another Lock
76 [Documentation] Fail to acquire another lock.
77 [Tags] Fail_To_Acquire_Lock_On_Another_Lock
78 [Template] Verify Acquire Lock Fails On Another Lock
Vijay85610ee2020-04-03 05:30:28 -050079
Sushil Singhd03f2ce2020-09-17 08:54:41 -050080 # client_id lock_type
Sushil Singh5d059942021-09-27 08:41:38 -050081 HMCID-01 ReadCase7,WriteCase6
82 HMCID-01 WriteCase6,WriteCase6
83 HMCID-01 WriteCase6,ReadCase7
George Keishing566daaf2020-07-02 06:18:50 -050084
85
Sushil Singhe33c6e62020-09-29 06:34:35 -050086Acquire Lock After Reboot
87 [Documentation] Acquire and release read and write locks after reboot.
88 [Tags] Acquire_Lock_After_Reboot
89 [Template] Verify Acquire Lock After Reboot
90
91 # client_id lock_type
92 HMCID-01 ReadCase1
93 HMCID-01 ReadCase2
94 HMCID-01 ReadCase3
95 HMCID-01 WriteCase1
96 HMCID-01 WriteCase2
97 HMCID-01 WriteCase3
98
99
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500100Acquire And Release Lock In Loop
101 [Documentation] Acquire and release read, write locks in loop.
102 [Tags] Acquire_And_Release_Lock_In_Loop
103 [Template] Verify Acquire And Release Lock In Loop
George Keishing566daaf2020-07-02 06:18:50 -0500104
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500105 # client_id lock_type
106 HMCID-01 ReadCase1
107 HMCID-01 ReadCase2
108 HMCID-01 ReadCase3
109 HMCID-01 WriteCase1
110 HMCID-01 WriteCase2
111 HMCID-01 WriteCase3
Vijay85610ee2020-04-03 05:30:28 -0500112
113
Sushil Singh977f8f52020-11-20 06:32:50 -0600114Fail To Acquire Read And Write In Single Request
115 [Documentation] Fail to acquire read and write lock in single request.
116 [Tags] Fail_To_Acquire_Read_And_Write_In_Single_Request
117 [Template] Verify Fail To Acquire Read And Write In Single Request
118
Sushil Singhe3f2e3b2022-07-28 05:15:43 -0500119 # client_id lock_type status_code
120 HMCID-01 ReadCase1,WriteCase1 ${HTTP_CONFLICT}
121 HMCID-01 WriteCase1,ReadCase1 ${HTTP_CONFLICT}
122 HMCID-01 WriteCase1,WriteCase1 ${HTTP_CONFLICT}
123
124
125Acquire Read In Single Request
126 [Documentation] Acquire read in single request.
127 [Tags] Acquire_Read_In_Single_Request
128 [Template] Verify Acquire Read In Single Request
129
Sushil Singh977f8f52020-11-20 06:32:50 -0600130 # client_id lock_type
Sushil Singhe3f2e3b2022-07-28 05:15:43 -0500131 HMCID-01 ReadCase1,ReadCase1
Sushil Singh977f8f52020-11-20 06:32:50 -0600132
133
Sushil Singhdf390b62021-01-19 00:50:05 -0600134Acquire Multiple Lock Request At CEC Level
135 [Documentation] Acquire write lock on read lock under CEC level.
136 [Tags] Acquire_Multiple_Lock_Request_At_CEC_Level
137 [Template] Verify Acquire Multiple Lock Request At CEC Level
138
139 # client_id lock_type
140 HMCID-01 ReadCase4,WriteCase4
141 HMCID-01 WriteCase5,ReadCase5
142 HMCID-01 ReadCase6,WriteCase6
143 HMCID-01 WriteCase7,ReadCase7
144
145
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500146Verify Release Of Valid Locks
147 [Documentation] Release all valid locks.
148 [Tags] Verify_Release_Of_Valid_Locks
149 [Template] Acquire And Release Multiple Locks
Vijayafdd2a12020-04-09 02:03:20 -0500150
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500151 # client_id lock_type release_lock_type
152 HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction
153 HMCID-02 ReadCase1,ReadCase1,ReadCase1 Session
Vijayafdd2a12020-04-09 02:03:20 -0500154
155
susilsi794116c62021-03-04 07:57:51 -0600156Release Lock When Session Deleted
157 [Documentation] Release lock when session gets deleted.
158 [Tags] Release_Lock_When_Session_Deleted
159 [Template] Verify Release Lock When Session Deleted
160
161 # client_id lock_type
162 HMCID-01 ReadCase1
163 HMCID-01 WriteCase1
164
165
Sushil Singh59011d02021-01-27 23:00:20 -0600166Fail To Release Lock With Invalid TransactionID
167 [Documentation] Fail to release lock with invalid transaction id.
168 [Tags] Fail_To_Release_Lock_With_Invalid_TransactionID
169 [Template] Verify Fail To Release Lock With Invalid TransactionID
170
susilsi743b0c062021-03-02 04:24:19 -0600171 # client_id lock_type release_lock_type
172 HMCID-01 ReadCase1 Transaction
173 HMCID-01 WriteCase1 Transaction
Sushil Singh59011d02021-01-27 23:00:20 -0600174
175
Sushil Singh1b590532021-01-20 05:13:54 -0600176Fail To Release Multiple Lock With Invalid TransactionID
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500177 [Documentation] Release in-valid lock result in fail.
Sushil Singh1b590532021-01-20 05:13:54 -0600178 [Tags] Fail_To_Release_Multiple_Lock_With_Invalid_TransactionID
179 [Template] Verify Fail To Release Multiple Lock With Invalid TransactionID
Vijayafdd2a12020-04-09 02:03:20 -0500180
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500181 # client_id lock_type release_lock_type
182 HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction
183 12345 ReadCase2,ReadCase2,ReadCase2 Transaction
184 HMCID ReadCase3,ReadCase3,ReadCase3 Transaction
Vijayafdd2a12020-04-09 02:03:20 -0500185
186
Sushil Singh8bee3582021-01-27 23:46:48 -0600187Fail To Release Multiple Lock With Valid And Invalid TransactionID
George Keishing96143832021-03-23 07:55:08 -0500188 [Documentation] Release multiple lock with valid and invalid transaction.
Sushil Singh8bee3582021-01-27 23:46:48 -0600189 [Tags] Fail_To_Release_Multiple_Lock_With_Valid_And_Invalid_TransactionID
190 [Template] Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID
191
192 # client_id lock_type release_lock_type
193 HMCID-01 ReadCase1,ReadCase1 Transaction
194
195
susilsi71d7b9962021-03-02 03:06:18 -0600196Fail To Release Lock With String As TransactionID Data Type
197 [Documentation] Fail to release lock with string as transaction id data type.
198 [Tags] Fail_To_Release_Lock_With_String_As_TransactionID_Data_Type
199 [Template] Verify Fail To Release Lock With TransactionID As String Type
200
201 # client_id lock_type release_lock_type
202 HMCID-01 ReadCase1 Transaction
203 HMCID-01 WriteCase1 Transaction
204
205
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500206Fail To Release Lock For Another Session
207 [Documentation] Failed to release locks from another session.
208 [Tags] Fail_To_Release_Lock_For_Another_Session
209 [Template] Verify Fail To Release Lock For Another Session
Vijayafdd2a12020-04-09 02:03:20 -0500210
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500211 # client_id lock_type
212 HMCID-01,HMCID-02 ReadCase1,ReadCase1
Vijayafdd2a12020-04-09 02:03:20 -0500213
214
Sushil Singhe33c6e62020-09-29 06:34:35 -0500215Test Invalid Resource ID Data Type Locking
216 [Documentation] Failed to acquire lock for invalid resource id data type.
217 [Tags] Test_Invalid_Resource_ID_Data_Type_Locking
218 [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type
219
220 # client_id lock_type
221 HMCID-01 ReadCase1
222 HMCID-01 ReadCase2
223 HMCID-01 ReadCase3
224 HMCID-01 WriteCase1
225 HMCID-01 WriteCase2
226 HMCID-01 WriteCase3
227
228
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500229Fail To Acquire Lock For Invalid Lock Type
230 [Documentation] Failed to acquire read, write lock for invalid lock data passed.
231 [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type
232 [Template] Verify Fail To Acquire Lock For Invalid Lock Data
Vijayafdd2a12020-04-09 02:03:20 -0500233
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500234 # client_id lock_type message
235 HMCID-01 ReadCase1 ${BAD_REQUEST}
236 HMCID-01 ReadCase2 ${BAD_REQUEST}
237 HMCID-01 ReadCase3 ${BAD_REQUEST}
238 HMCID-01 ReadCase4 ${BAD_REQUEST}
239 HMCID-01 ReadCase5 ${BAD_REQUEST}
240 HMCID-01 WriteCase1 ${BAD_REQUEST}
241 HMCID-01 WriteCase2 ${BAD_REQUEST}
242 HMCID-01 WriteCase3 ${BAD_REQUEST}
243 HMCID-01 WriteCase4 ${BAD_REQUEST}
244 HMCID-01 WriteCase5 ${BAD_REQUEST}
Vijayafdd2a12020-04-09 02:03:20 -0500245
Vijayafdd2a12020-04-09 02:03:20 -0500246
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500247Fail To Acquire Lock For Invalid Lock Flag
248 [Documentation] Failed to acquire read write lock for invalid lock flag passed.
249 [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag
250 [Template] Verify Fail To Acquire Lock For Invalid Lock Data
Vijayafdd2a12020-04-09 02:03:20 -0500251
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500252 # client_id lock_type message
253 HMCID-01 ReadCase6 ${BAD_REQUEST}
254 HMCID-01 ReadCase7 ${BAD_REQUEST}
255 HMCID-01 ReadCase8 ${BAD_REQUEST}
256 HMCID-01 ReadCase9 ${BAD_REQUEST}
257 HMCID-01 ReadCase10 ${BAD_REQUEST}
258 HMCID-01 ReadCase11 ${BAD_REQUEST}
259 HMCID-01 WriteCase6 ${BAD_REQUEST}
260 HMCID-01 WriteCase7 ${BAD_REQUEST}
261 HMCID-01 WriteCase8 ${BAD_REQUEST}
262 HMCID-01 WriteCase9 ${BAD_REQUEST}
263 HMCID-01 WriteCase10 ${BAD_REQUEST}
264 HMCID-01 WriteCase11 ${BAD_REQUEST}
Vijayafdd2a12020-04-09 02:03:20 -0500265
Vijayafdd2a12020-04-09 02:03:20 -0500266
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500267Fail To Acquire Lock For Invalid Segment Flag
268 [Documentation] Failed to acquire read write lock for invalid segment flag passed.
269 [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag
270 [Template] Verify Fail To Acquire Lock For Invalid Lock Data
271
272 # client_id lock_type message
273 HMCID-01 ReadCase12 ${BAD_REQUEST}
274 HMCID-01 ReadCase13 ${BAD_REQUEST}
275 HMCID-01 ReadCase14 ${BAD_REQUEST}
276 HMCID-01 WriteCase12 ${BAD_REQUEST}
277 HMCID-01 WriteCase13 ${BAD_REQUEST}
278 HMCID-01 WriteCase14 ${BAD_REQUEST}
Vijayafdd2a12020-04-09 02:03:20 -0500279
Sushil Singhbace3002020-10-08 08:12:58 -0500280
Sushil Singh3b3a7ec2020-11-23 03:54:06 -0600281Fail To Acquire Lock For Invalid Segment Data Type Flag
282 [Documentation] Failed to acquire read write lock for invalid segment flag passed.
283 [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Data_Type_Flag
284 [Template] Verify Fail To Acquire Lock For Invalid Lock Data
285
286 # client_id lock_type message
287 HMCID-01 ReadCase15 ${EMPTY}
288 HMCID-01 ReadCase16 ${EMPTY}
289 HMCID-01 ReadCase17 ${EMPTY}
290 HMCID-01 ReadCase18 ${EMPTY}
291 HMCID-01 WriteCase15 ${EMPTY}
292 HMCID-01 WriteCase16 ${EMPTY}
293 HMCID-01 WriteCase17 ${EMPTY}
294 HMCID-01 WriteCase18 ${EMPTY}
295
296
Sushil Singhbace3002020-10-08 08:12:58 -0500297Get Empty Lock Records For Session Where No Locks Acquired
298 [Documentation] If session does not acquire locks then get lock should return
299 ... empty lock records.
300 [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired
301 [Template] Verify No Locks Records For Session With No Acquired Lock
302
303 # client_id
304 HMCID-01
305
Sushil Singh728ef9c2020-10-28 04:25:39 -0500306
Sushil Singhf9a536c2020-11-09 07:33:17 -0600307Get Lock Records Empty For Invalid Session
308 [Documentation] Record of lock list is empty for invalid session.
309 [Tags] Get_Lock_Records_Empty_For_Invalid_Session
310 [Template] Verify Empty Lock Records For Invalid Session
311
312 # client_id
313 HMCID-01
314
315
Sushil Singh728ef9c2020-10-28 04:25:39 -0500316Get Lock Records For Multiple Session
317 [Documentation] Get lock records of multiple session.
318 [Tags] Get_Lock_Records_For_Multiple_Session
319 [Template] Verify Lock Records Of Multiple Session
320
321 # client_ids lock_type
322 HMCID-01,HMCID-02 ReadCase1,ReadCase1
323
324
Sushil Singhf9a536c2020-11-09 07:33:17 -0600325Get Lock Records For Multiple Invalid Session
326 [Documentation] Record of lock list is empty for list of invalid session.
327 [Tags] Get_Lock_Records_For_Multiple_Invalid_Session
328 [Template] Verify Lock Records For Multiple Invalid Session
329
330 # client_id
331 HMCID-01
332
Sushil Singh11949a22020-11-13 06:12:16 -0600333
334Get Lock Records For Multiple Invalid And Valid Session
335 [Documentation] Get record of lock from invalid and valid session.
336 [Tags] Get_Lock_Records_For_Multiple_Invalid_And_Valid_Session
337 [Template] Verify Lock Records For Multiple Invalid And Valid Session
338
339 # client_id lock_type
340 HMCID-01,HMCID-02 ReadCase1
341
Vijaybc331e22020-02-27 04:17:37 -0600342*** Keywords ***
343
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500344Create Redfish Session With ClientID
345 [Documentation] Create redifish session with client id.
346 [Arguments] ${client_id}
Vijay85610ee2020-04-03 05:30:28 -0500347
348 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500349 # client_id This client id can contain string value
350 # (e.g. 12345, "HMCID").
Vijay85610ee2020-04-03 05:30:28 -0500351
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500352 ${session_info}= Create Dictionary
353 ${session}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}}
Vijay85610ee2020-04-03 05:30:28 -0500354
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500355 Set To Dictionary ${session_info} SessionIDs ${session['Id']}
356 Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]}
Vijay85610ee2020-04-03 05:30:28 -0500357
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500358 [Return] ${session_info}
Vijay85610ee2020-04-03 05:30:28 -0500359
360
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500361RW General Dictionary
George Keishing16b3c7b2021-01-28 09:23:37 -0600362 [Documentation] Create dictionary of lock request.
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500363 [Arguments] ${read_case} ${res_id}
Vijaybc331e22020-02-27 04:17:37 -0600364
365 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500366 # read_case Read or Write lock type.
367 # res_id Resource id.
Vijaybc331e22020-02-27 04:17:37 -0600368
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500369 ${request_dict}= Create Dictionary
George Keishing566daaf2020-07-02 06:18:50 -0500370
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500371 FOR ${key} IN @{read_case.keys()}
372 Set To Dictionary ${request_dict} LockType ${key}
373 Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]}
374 END
Vijaybc331e22020-02-27 04:17:37 -0600375
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500376 Set To Dictionary ${request_dict} ResourceID ${res_id}
377
378 [Return] ${request_dict}
Vijaybc331e22020-02-27 04:17:37 -0600379
380
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500381Return Description Of Response
382 [Documentation] Return description of REST response.
Vijaybc331e22020-02-27 04:17:37 -0600383 [Arguments] ${resp_text}
384
385 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500386 # resp_text REST response body.
Vijaybc331e22020-02-27 04:17:37 -0600387
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500388 # resp_text after successful partition file upload looks like:
389 # {
390 # "Description": "File Created"
391 # }
Vijaybc331e22020-02-27 04:17:37 -0600392
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500393 ${message}= Evaluate json.loads('''${resp_text}''') json
394
395 [Return] ${message}
Vijaybc331e22020-02-27 04:17:37 -0600396
397
Sushil Singha7d71f02020-11-02 05:24:22 -0600398Verify Redfish Session Deleted
399 [Documentation] Verify the redfish session is deleted.
400 [Arguments] ${session_info}
401
402 # Description of argument(s):
403 # session_info Session information are stored in dictionary.
404
405 # ${session_info} = {
406 # 'SessionIDs': 'XXXXXXXXX',
407 # 'ClientID': 'XXXXXX',
408 # 'SessionToken': 'XXXXXXXXX',
409 # 'SessionResp': session response from redfish login
410 # }
411
412 # SessionIDs : Session IDs
413 # ClientID : Client ID
414 # SessionToken : Session token
415 # SessionResp : Response of creating an redfish login session
416
417 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions
418
419 FOR ${session} IN @{sessions['Members']}
Sushil Singh8a3efe72021-08-26 08:16:41 -0500420 Should Not Be Equal As Strings
421 ... session ['/redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}']
Sushil Singha7d71f02020-11-02 05:24:22 -0600422 END
423
424
425Verify Redfish List Of Session Deleted
426 [Documentation] Verify all the list of redfish session is deleted.
427 [Arguments] ${session_info_list}
428
429 # Description of argument(s):
430 # session_info_list List contains individual session record are stored in dictionary.
431
432 # ${session_info_list} = [{
433 # 'SessionIDs': 'XXXXXXXXX',
434 # 'ClientID': 'XXXXXX',
435 # 'SessionToken': 'XXXXXXXXX',
436 # 'SessionResp': session response from redfish login
437 # }]
438
439 # SessionIDs : Session IDs
440 # ClientID : Client ID
441 # SessionToken : Session token
442 # SessionResp : Response of creating an redfish login session
443
444 FOR ${session_record} IN @{session_info_list}
445 Verify Redfish Session Deleted ${session_record}
446 END
447
448
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500449Redfish Post Acquire Lock
450 [Documentation] Acquire and release lock.
451 [Arguments] ${lock_type} ${status_code}=${HTTP_OK}
Vijaybc331e22020-02-27 04:17:37 -0600452
453 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500454 # lock_type Read lock or Write lock.
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 Lock ${lock_type}
George Keishingfbd67002022-08-01 11:24:03 -0500458 ${lock_dict_param}= Convert JSON To String ${lock_dict_param}
Sushil Singh8a3efe72021-08-26 08:16:41 -0500459 ${resp}= Redfish Post Request
460 ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param}
George Keishingfbd67002022-08-01 11:24:03 -0500461 ... expected_status=any
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500462 Should Be Equal As Strings ${resp.status_code} ${status_code}
Sushil Singhdf390b62021-01-19 00:50:05 -0600463
464 Run Keyword If ${status_code} == ${HTTP_BAD_REQUEST}
465 ... Valid Value ${BAD_REQUEST} ['${resp.content}']
466 ... ELSE
467 ... Run Keyword And Return Return Description Of Response ${resp.content}
Vijaybc331e22020-02-27 04:17:37 -0600468
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500469 [Return] ${resp}
Vijaybc331e22020-02-27 04:17:37 -0600470
471
Sushil Singh977f8f52020-11-20 06:32:50 -0600472Redfish Post Acquire List Lock
473 [Documentation] Acquire and release lock.
474 [Arguments] ${lock_type} ${status_code}=${HTTP_OK}
475
476 # Description of argument(s):
477 # lock_type Read lock or Write lock.
478 # status_code HTTP status code.
479
480 ${lock_dict_param}= Create Data To Acquire List Of Lock ${lock_type}
George Keishingfbd67002022-08-01 11:24:03 -0500481 ${lock_dict_param}= Convert JSON To String ${lock_dict_param}
Sushil Singh8a3efe72021-08-26 08:16:41 -0500482 ${resp}= Redfish Post Request
483 ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param}
George Keishingfbd67002022-08-01 11:24:03 -0500484 ... expected_status=any
Sushil Singh977f8f52020-11-20 06:32:50 -0600485 Should Be Equal As Strings ${resp.status_code} ${status_code}
486
Sushil Singhe3f2e3b2022-07-28 05:15:43 -0500487 Run Keyword If ${status_code} == ${HTTP_CONFLICT}
488 ... Should Be Equal As Strings ${CONFLICT_RQUEST} ${resp.content}
489 ... ELSE
490 ... Run Keyword And Return Return Description Of Response ${resp.content}
491
Sushil Singh977f8f52020-11-20 06:32:50 -0600492 [Return] ${resp}
493
494
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500495Redfish Post Acquire Invalid Lock
496 [Documentation] Redfish to post request to acquire in-valid lock.
497 [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK}
Vijaybc331e22020-02-27 04:17:37 -0600498
499 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500500 # lock_type Read lock or Write lock.
501 # message Return message from URI.
502 # status_code HTTP status code.
Vijaybc331e22020-02-27 04:17:37 -0600503
Sushil Singhe33c6e62020-09-29 06:34:35 -0500504 ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type}
George Keishingfbd67002022-08-01 11:24:03 -0500505 ${lock_dict_param}= Convert JSON To String ${lock_dict_param}
Sushil Singh8a3efe72021-08-26 08:16:41 -0500506 ${resp}= Redfish Post Request
507 ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500508 Should Be Equal As Strings ${resp.status_code} ${status_code}
Sushil Singh3b3a7ec2020-11-23 03:54:06 -0600509 Run Keyword If '${message}' != '${EMPTY}'
510 ... Valid Value message ['${resp.content}']
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500511
512 [Return] ${resp}
Vijaybc331e22020-02-27 04:17:37 -0600513
514
Sushil Singhe33c6e62020-09-29 06:34:35 -0500515Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID
516 [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id.
517 [Arguments] ${lock_type} ${status_code}=${HTTP_OK}
518
519 # Description of argument(s):
520 # lock_type Read lock or Write lock.
521 # status_code HTTP status code.
522
Sushil Singh8a3efe72021-08-26 08:16:41 -0500523 ${lock_dict_param}=
524 ... Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type}
George Keishingfbd67002022-08-01 11:24:03 -0500525 ${lock_dict_param}= Convert JSON To String ${lock_dict_param}
Sushil Singh8a3efe72021-08-26 08:16:41 -0500526 ${resp}= Redfish Post Request
527 ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500528 Should Be Equal As Strings ${resp.status_code} ${status_code}
529
530 [Return] ${resp}
531
532
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500533Form Data To Acquire Lock
George Keishing16b3c7b2021-01-28 09:23:37 -0600534 [Documentation] Create a dictionary for lock request.
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500535 [Arguments] ${lock_type}
536
537 # Description of argument(s):
538 # lock_type Read lock or Write lock.
539
540 ${lock_res_info}= Get Lock Resource Information
541 ${resp}= RW General Dictionary
542 ... ${lock_res_info["Valid Case"]["${lock_type}"]}
543 ... ${lock_res_info["Valid Case"]["ResourceID"]}
544 ${temp_list}= Create List ${resp}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500545 ${lock_request_dict}= Create Dictionary Request=${temp_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500546
Sushil Singhe33c6e62020-09-29 06:34:35 -0500547 [Return] ${lock_request_dict}
548
549
Sushil Singh977f8f52020-11-20 06:32:50 -0600550Create Data To Acquire List Of Lock
George Keishing16b3c7b2021-01-28 09:23:37 -0600551 [Documentation] Create a dictionary for list of lock request.
Sushil Singh977f8f52020-11-20 06:32:50 -0600552 [Arguments] ${lock_type_list}
553
554 # Description of argument(s):
555 # lock_type Read lock or Write lock.
556
557 ${temp_list}= Create List
558 ${lock_res_info}= Get Lock Resource Information
559
560 FOR ${lock_type} IN @{lock_type_list}
561 ${resp}= RW General Dictionary
562 ... ${lock_res_info["Valid Case"]["${lock_type}"]}
563 ... ${lock_res_info["Valid Case"]["ResourceID"]}
564 Append To List ${temp_list} ${resp}
565 END
566
567 ${lock_request_dict}= Create Dictionary Request=${temp_list}
568
569 [Return] ${lock_request_dict}
570
571
Sushil Singhe33c6e62020-09-29 06:34:35 -0500572Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID
George Keishing16b3c7b2021-01-28 09:23:37 -0600573 [Documentation] Create a dictionary for in-valid lock request.
Sushil Singhe33c6e62020-09-29 06:34:35 -0500574 [Arguments] ${lock_type}
575
576 # Description of argument(s):
577 # lock_type Read lock or Write lock.
578
579 ${lock_res_info}= Get Lock Resource Information
580 ${resp}= RW General Dictionary
581 ... ${lock_res_info["Valid Case"]["${lock_type}"]}
582 ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]}
583 ${temp_list}= Create List ${resp}
584 ${lock_request_dict}= Create Dictionary Request=${temp_list}
585
586 [Return] ${lock_request_dict}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500587
588
589Form Data To Acquire Invalid Lock
George Keishing16b3c7b2021-01-28 09:23:37 -0600590 [Documentation] Create a dictionary for in-valid lock request.
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500591 [Arguments] ${lock_type}
592
593 # Description of argument(s):
594 # lock_type Read lock or Write lock.
595
596 ${lock_res_info}= Get Lock Resource Information
597 ${resp}= RW General Dictionary
598 ... ${lock_res_info["Invalid Case"]["${lock_type}"]}
599 ... ${lock_res_info["Valid Case"]["ResourceID"]}
600 ${temp_list}= Create List ${resp}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500601 ${lock_request_dict}= Create Dictionary Request=${temp_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500602
Sushil Singhe33c6e62020-09-29 06:34:35 -0500603 [Return] ${lock_request_dict}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500604
605
606Get Locks List On Resource
Vijaybc331e22020-02-27 04:17:37 -0600607 [Documentation] Get locks list.
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500608 [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK}
Vijaybc331e22020-02-27 04:17:37 -0600609
610 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500611 # session_info Session information in dict.
612 # exp_status_code Expected HTTP status code.
Vijaybc331e22020-02-27 04:17:37 -0600613
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500614 ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]}
George Keishing566daaf2020-07-02 06:18:50 -0500615 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList
616 ... data=${data}
Vijaybc331e22020-02-27 04:17:37 -0600617 ${locks}= Evaluate json.loads('''${resp.text}''') json
618
619 [Return] ${locks["Records"]}
620
621
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500622Verify Lock On Resource
623 [Documentation] Verify lock on resource.
624 [Arguments] ${session_info} ${transaction_id}
Vijaybc331e22020-02-27 04:17:37 -0600625
626 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500627 # session_info Session information in dict.
628 # transaction_id Transaction id in list stored in dict.
Vijaybc331e22020-02-27 04:17:37 -0600629
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500630 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']}
631 Rprint Vars sessions
632 ${lock_list}= Get Locks List On Resource ${session_info}
633 ${lock_length}= Get Length ${lock_list}
634 ${tran_id_length}= Get Length ${transaction_id}
635 Should Be Equal As Integers ${tran_id_length} ${lock_length}
Vijayafdd2a12020-04-09 02:03:20 -0500636
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500637 FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list}
638 Valid Value session_info['ClientID'] ['${lock['HMCID']}']
639 Valid Value session_info['SessionIDs'] ['${lock['SessionID']}']
640 Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']}
Vijaybc331e22020-02-27 04:17:37 -0600641 END
642
Vijaybc331e22020-02-27 04:17:37 -0600643
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500644Acquire Lock On Resource
645 [Documentation] Acquire lock on resource.
646 [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False
Vijaybc331e22020-02-27 04:17:37 -0600647
648 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500649 # client_id This client id can contain string value
650 # (e.g. 12345, "HMCID").
651 # lock_type Read lock or Write lock.
652 # reboot_flag Flag is used to run reboot the BMC code.
653 # (e.g. True or False).
Vijaybc331e22020-02-27 04:17:37 -0600654
Sushil Singh8a3efe72021-08-26 08:16:41 -0500655 ${trans_id_emptylist}= Create List
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500656 ${trans_id_list}= Create List
Sushil Singh8a3efe72021-08-26 08:16:41 -0500657
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500658 ${session_info}= Create Redfish Session With ClientID ${client_id}
659 ${trans_id}= Redfish Post Acquire Lock ${lock_type}
660 Append To List ${trans_id_list} ${trans_id}
Sushil Singh8a3efe72021-08-26 08:16:41 -0500661
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500662 Verify Lock On Resource ${session_info} ${trans_id_list}
George Keishing566daaf2020-07-02 06:18:50 -0500663
Sushil Singhe33c6e62020-09-29 06:34:35 -0500664 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
Vijaybc331e22020-02-27 04:17:37 -0600665
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500666 Run Keyword If '${reboot_flag}' == 'True'
Sushil Singh8a3efe72021-08-26 08:16:41 -0500667 ... Run Keywords Redfish BMC Reset Operation AND
Sushil Singhe33c6e62020-09-29 06:34:35 -0500668 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
Sushil Singh8a3efe72021-08-26 08:16:41 -0500669 ... Is BMC Standby AND
670 ... Verify Lock On Resource ${session_info} ${trans_id_emptylist}
Vijaybc331e22020-02-27 04:17:37 -0600671
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500672 Run Keyword If '${reboot_flag}' == 'False'
673 ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK}
Vijaybc331e22020-02-27 04:17:37 -0600674
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500675 ${trans_id_emptylist}= Create List
676 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
677 Redfish Delete Session ${session_info}
Vijaybc331e22020-02-27 04:17:37 -0600678
Vijaybc331e22020-02-27 04:17:37 -0600679
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500680Form Data To Release Lock
681 [Documentation] Create a dictonay to release lock.
682 [Arguments] ${trans_id_list}
Vijay355daac2020-03-26 12:06:08 -0500683
684 # Description of argument(s):
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500685 # trans_id_list
Vijay355daac2020-03-26 12:06:08 -0500686
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500687 @{tran_ids}= Create List
Vijay355daac2020-03-26 12:06:08 -0500688
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500689 FOR ${item} IN @{trans_id_list}
690 Append To List ${tran_ids} ${item['TransactionID']}
691 END
692
693 [Return] ${tran_ids}
694
695
696Release Locks On Resource
697 [Documentation] Redfish request to release a lock.
Sushil Singh8a3efe72021-08-26 08:16:41 -0500698 [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction
699 ... ${status_code}=${HTTP_OK}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500700
701 # Description of argument(s):
702 # session_info Session information in dict.
703 # trans_id_list Transaction id list.
704 # release_lock_type Release lock by Transaction, Session.
705 # status_code HTTP status code.
706
707 ${tran_ids}= Form Data To Release Lock ${trans_id_list}
708 ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}}
709 ${data}= Evaluate json.dumps(${data}) json
710 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data}
711 Should Be Equal As Strings ${resp.status_code} ${status_code}
712
713
Sushil Singhdf390b62021-01-19 00:50:05 -0600714Release locks And Delete Session
715 [Documentation] Release locks and delete redfish session.
716 [Arguments] ${session_info} ${trans_id_list}
717
718 Release Locks On Resource ${session_info} ${trans_id_list}
719
720 ${trans_id_emptylist}= Create List
721 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
722
723 Redfish Delete Session ${session_info}
724
725
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500726Acquire Lock On Another Lock
727 [Documentation] Acquire lock on another lock.
728 [Arguments] ${client_id}
729
730 # Description of argument(s):
731 # client_id This client id can contain string value
732 # (e.g. 12345, "HMCID").
733
734 ${trans_id_list}= Create List
735 ${session_info}= Create Redfish Session With ClientID ${client_id}
736
737 ${trans_id}= Redfish Post Acquire Lock ReadCase1
738 Append To List ${trans_id_list} ${trans_id}
739
740 ${trans_id}= Redfish Post Acquire Lock ReadCase1
741 Append To List ${trans_id_list} ${trans_id}
742
743 Verify Lock On Resource ${session_info} ${trans_id_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500744
Sushil Singhdf390b62021-01-19 00:50:05 -0600745 Release locks And Delete Session ${session_info} ${trans_id_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500746
747
Sushil Singh977f8f52020-11-20 06:32:50 -0600748Verify Fail To Acquire Read And Write In Single Request
749 [Documentation] Verify fail to acquire read and write lock passed in single request.
Sushil Singhe3f2e3b2022-07-28 05:15:43 -0500750 [Arguments] ${client_id} ${lock_type} ${status_code}
751
752 # Description of argument(s):
753 # client_id This client id can contain string value
754 # (e.g. 12345, "HMCID").
755 # lock_type Read lock or Write lock.
756 # status_code HTTP status code
757
758 ${lock_type_list}= Split String ${lock_type} ,
759
760 ${session_info}= Create Redfish Session With ClientID ${client_id}
761 ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list} status_code=${status_code}
762 Redfish Delete Session ${session_info}
763
764
765Verify Acquire Read In Single Request
766 [Documentation] Verify acquire read in single request.
Sushil Singh977f8f52020-11-20 06:32:50 -0600767 [Arguments] ${client_id} ${lock_type}
768
769 # Description of argument(s):
770 # client_id This client id can contain string value
771 # (e.g. 12345, "HMCID").
772 # lock_type Read lock or Write lock.
773
Sushil Singhe3f2e3b2022-07-28 05:15:43 -0500774 ${trans_id_list}= Create List
Sushil Singh977f8f52020-11-20 06:32:50 -0600775 ${lock_type_list}= Split String ${lock_type} ,
776
777 ${session_info}= Create Redfish Session With ClientID ${client_id}
Sushil Singhe3f2e3b2022-07-28 05:15:43 -0500778 ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list}
779 Append To List ${trans_id_list} ${trans_id}
780 Append To List ${trans_id_list} ${trans_id}
781
782 Verify Lock On Resource ${session_info} ${trans_id_list}
783 Remove From List ${trans_id_list} 1
784 Release Locks On Resource ${session_info} ${trans_id_list}
785
Sushil Singh977f8f52020-11-20 06:32:50 -0600786 Redfish Delete Session ${session_info}
787
788
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500789Verify Empty Lock Records For Invalid Session
790 [Documentation] Verify no lock record found for invalid session.
791 [Arguments] ${client_id}
792
793 # Description of argument(s):
794 # client_id This client id can contain string value
795 # (e.g. 12345, "HMCID").
796
797 ${session_info1}= Create Redfish Session With ClientID ${client_id}
798
799 ${lock_list1}= Get Locks List On Resource ${session_info1}
800 ${lock_length1}= Get Length ${lock_list1}
801
802 ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True
803 set to dictionary ${session_info2} SessionIDs xxyXyyYZZz
804
805 ${lock_list2}= Get Locks List On Resource ${session_info2}
Sushil Singhf9a536c2020-11-09 07:33:17 -0600806 ${lock_length2}= Get Length ${lock_list2}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500807
Sushil Singhf9a536c2020-11-09 07:33:17 -0600808 Should Be Equal As Integers ${lock_length1} ${lock_length2}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500809
810 Redfish Delete Session ${session_info1}
811
812
813Verify Acquire Lock Fails On Another Lock
814 [Documentation] Verify acquire lock on another lock fails.
815 [Arguments] ${client_id} ${lock_type}
816
817 # Description of argument(s):
818 # client_id This client id can contain string value
819 # (e.g. 12345, "HMCID").
820 # lock_type Read lock or Write lock.
821
822 @{lock_type_list}= Split String ${lock_type} ,
823 ${session_info}= Create Redfish Session With ClientID ${client_id}
824 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
825
826 ${trans_id_list}= Create List
827 Append To List ${trans_id_list} ${trans_id}
828
829 Verify Lock On Resource ${session_info} ${trans_id_list}
830 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500831
Sushil Singhdf390b62021-01-19 00:50:05 -0600832 Release locks And Delete Session ${session_info} ${trans_id_list}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500833
834
Sushil Singhe33c6e62020-09-29 06:34:35 -0500835Verify Acquire Lock After Reboot
836 [Documentation] Acquire read and write lock after the reboot and release lock.
837 [Arguments] ${client_id} ${lock_type}
838
839 # Description of argument(s):
840 # client_id This client id can contain string value
841 # (e.g. 12345, "HMCID").
842 # lock_type Read lock or Write lock.
843
844 ${trans_id_list}= Create List
Sushil Singhf9a536c2020-11-09 07:33:17 -0600845 ${session_info}= Create Session With ClientID ${client_id}
Sushil Singhac229c72021-09-13 02:26:51 -0500846
Sushil Singhe33c6e62020-09-29 06:34:35 -0500847 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
Sushil Singhac229c72021-09-13 02:26:51 -0500848 Redfish BMC Reset Operation
Sushil Singhe33c6e62020-09-29 06:34:35 -0500849 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
Sushil Singhac229c72021-09-13 02:26:51 -0500850 Is BMC Standby
Sushil Singhe33c6e62020-09-29 06:34:35 -0500851
852 ${trans_id}= Redfish Post Acquire Lock ${lock_type}
853 Append To List ${trans_id_list} ${trans_id}
854 Verify Lock On Resource ${session_info} ${trans_id_list}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500855
Sushil Singhdf390b62021-01-19 00:50:05 -0600856 Release locks And Delete Session ${session_info} ${trans_id_list}
857
858
859Verify Acquire Multiple Lock Request At CEC Level
860 [Documentation] Acquire lock in loop.
861 [Arguments] ${client_id} ${lock_type}
862
863 # Description of argument(s):
864 # client_id This client id can contain string value
865 # (e.g. 12345, "HMCID").
866 # lock_type Read lock or Write lock.
867
868 ${trans_id_list}= Create List
869 @{lock_type_list}= Split String ${lock_type} ,
870 ${session_info}= Create Redfish Session With ClientID ${client_id}
871
872 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
873 Append To List ${trans_id_list} ${trans_id}
874
875 Verify Lock On Resource ${session_info} ${trans_id_list}
876
877 Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT}
878
879 Release locks And Delete Session ${session_info} ${trans_id_list}
Sushil Singhe33c6e62020-09-29 06:34:35 -0500880
881
Sushil Singh8d420bf2021-09-06 08:27:41 -0500882Post Reboot Acquire Lock
883 [Documentation] Post reboot acquire lock and verify the transaction id is 1.
884 [Arguments] ${session_info} ${lock_type}
885
886 # Description of argument(s):
887 # session_info Session information.
888 # lock_type Read lock or Write lock.
889
890 ${trans_id_list}= Create List
891 ${trans_id_list_var}= Create List
892 ${trans_id}= Redfish Post Acquire Lock ${lock_type}
893 Append To List ${trans_id_list} ${trans_id}
894 Append To List ${trans_id_list_var} ${default_trans_id}
895 Verify Lock On Resource ${session_info} ${trans_id_list}
896 Verify Lock On Resource ${session_info} ${trans_id_list_var}
897 Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK}
898 ${trans_id_emptylist}= Create List
899 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
900
901
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500902Verify Acquire And Release Lock In Loop
903 [Documentation] Acquire lock in loop.
Sushil Singh8d420bf2021-09-06 08:27:41 -0500904 [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500905
906 # Description of argument(s):
907 # client_id This client id can contain string value
908 # (e.g. 12345, "HMCID").
909 # lock_type Read lock or Write lock.
Sushil Singh8d420bf2021-09-06 08:27:41 -0500910 # reboot_flag Flag is used to run reboot the BMC code.
911 # (e.g. True or False).
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500912
913 FOR ${count} IN RANGE 1 11
914 ${trans_id_list}= Create List
915 ${session_info}= Create Redfish Session With ClientID ${client_id}
916 ${trans_id}= Redfish Post Acquire Lock ${lock_type}
917 Append To List ${trans_id_list} ${trans_id}
918 Verify Lock On Resource ${session_info} ${trans_id_list}
919 Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK}
920 ${trans_id_emptylist}= Create List
921 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
Sushil Singh8d420bf2021-09-06 08:27:41 -0500922 Redfish Delete Session ${session_info}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500923 END
924
Sushil Singh8d420bf2021-09-06 08:27:41 -0500925 ${session_info}= Create Redfish Session With ClientID ${client_id}
926 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
927
928 Run Keyword If '${reboot_flag}' == 'True'
929 ... Run Keywords Redfish BMC Reset Operation AND
930 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
931 ... Is BMC Standby AND
932 ... Post Reboot Acquire Lock ${session_info} ${lock_type}
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500933 Redfish Delete Session ${session_info}
934
935
936Acquire And Release Multiple Locks
937 [Documentation] Acquire mutilple locks on resource.
938 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
939
940 # Description of argument(s):
941 # client_id This client id can contain string value
942 # (e.g. 12345, "HMCID").
943 # lock_type Read lock or Write lock.
944 # release_lock_type The value can be Transaction or Session.
945
946 @{lock_type_list}= Split String ${lock_type} ,
947 ${session_info}= Create Redfish Session With ClientID ${client_id}
948 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
949
950 ${trans_id_list}= Create List
951
952 Append To List ${trans_id_list} ${trans_id}
953 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
954
955 Append To List ${trans_id_list} ${trans_id}
956 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2]
957
958 Append To List ${trans_id_list} ${trans_id}
959 Verify Lock On Resource ${session_info} ${trans_id_list}
960 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type}
961
962 ${trans_id_emptylist}= Create List
963 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
964 Redfish Delete Session ${session_info}
965
966
susilsi794116c62021-03-04 07:57:51 -0600967Verify Release Lock When Session Deleted
968 [Documentation] Verify lock get released when session are deleted.
969 [Arguments] ${client_id} ${lock_type}
970
971 # Description of argument(s):
972 # client_ids This client id can contain string value
973 # (e.g. 12345, "HMCID").
974 # lock_type Read lock or Write lock.
975
976 ${trans_id_list}= Create List
977 @{lock_type_list}= Split String ${lock_type} ,
978
979 ${pre_session_info}= Create Redfish Session With ClientID ${client_id}
980
981 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
982 Append To List ${trans_id_list} ${trans_id}
983 Verify Lock On Resource ${pre_session_info} ${trans_id_list}
984
985 Redfish Delete Session ${pre_session_info}
986 ${post_session_info}= Create Redfish Session With ClientID ${client_id}
987 ${resp}= Get Locks List On Resource With Session List ${pre_session_info} ${HTTP_BAD_REQUEST}
988
989 Redfish Delete Session ${post_session_info}
990
991
992
Sushil Singh59011d02021-01-27 23:00:20 -0600993Verify Fail To Release Lock With Invalid TransactionID
George Keishing16b3c7b2021-01-28 09:23:37 -0600994 [Documentation] Verify fail to be release lock with invalid transaction ID.
Sushil Singh59011d02021-01-27 23:00:20 -0600995 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
996
997 # Description of argument(s):
998 # client_id This client id can contain string value
999 # (e.g. 12345, "HMCID").
1000 # lock_type Read lock or Write lock.
1001 # release_lock_type The value can be Transaction or Session.
1002
1003 ${trans_id_list}= Create List
1004 @{lock_type_list}= Split String ${lock_type} ,
1005
1006 ${session_info}= Create Redfish Session With ClientID ${client_id}
1007
1008 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1009 ${value}= Get From Dictionary ${trans_id} TransactionID
1010 ${value}= Evaluate ${value} + 10
1011 Set To Dictionary ${trans_id} TransactionID ${value}
1012 Append To List ${trans_id_list} ${trans_id}
1013
1014 Release Locks On Resource
1015 ... ${session_info} ${trans_id_list}
1016 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST}
1017 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session
1018
1019 ${trans_id_emptylist}= Create List
1020 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
1021 Redfish Delete Session ${session_info}
1022
1023
Sushil Singh1b590532021-01-20 05:13:54 -06001024Verify Fail To Release Multiple Lock With Invalid TransactionID
1025 [Documentation] Verify release multiple locks with invalid transaction ID fails.
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001026 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
1027
1028 # Description of argument(s):
1029 # client_id This client id can contain string value
1030 # (e.g. 12345, "HMCID").
1031 # lock_type Read lock or Write lock.
1032 # release_lock_type The value can be Transaction or Session.
1033
1034 ${trans_id_list}= Create List
1035 @{lock_type_list}= Split String ${lock_type} ,
1036
1037 ${session_info}= Create Redfish Session With ClientID ${client_id}
1038
1039 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1040 ${value}= Get From Dictionary ${trans_id} TransactionID
1041 ${value}= Evaluate ${value} + 10
1042 Set To Dictionary ${trans_id} TransactionID ${value}
1043 Append To List ${trans_id_list} ${trans_id}
1044
1045 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
1046 ${value}= Get From Dictionary ${trans_id} TransactionID
1047 ${value}= Evaluate ${value} + 10
1048 Set To Dictionary ${trans_id} TransactionID ${value}
1049 Append To List ${trans_id_list} ${trans_id}
1050
1051 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2]
1052 ${value}= Get From Dictionary ${trans_id} TransactionID
1053 ${value}= Evaluate ${value} + 10
1054 Set To Dictionary ${trans_id} TransactionID ${value}
1055 Append To List ${trans_id_list} ${trans_id}
1056
1057 Release Locks On Resource
1058 ... ${session_info} ${trans_id_list}
1059 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST}
1060 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session
1061
1062 ${trans_id_emptylist}= Create List
1063 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
1064 Redfish Delete Session ${session_info}
1065
1066
Sushil Singh8bee3582021-01-27 23:46:48 -06001067Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID
George Keishing96143832021-03-23 07:55:08 -05001068 [Documentation] Verify fail to be release multiple lock with valid and invalid transaction ID.
Sushil Singh8bee3582021-01-27 23:46:48 -06001069 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
1070
1071 # Description of argument(s):
1072 # client_id This client id can contain string value
1073 # (e.g. 12345, "HMCID").
1074 # lock_type Read lock or Write lock.
1075 # release_lock_type The value can be Transaction or Session.
1076
1077 ${trans_id_list}= Create List
1078 @{lock_type_list}= Split String ${lock_type} ,
1079
1080 ${session_info}= Create Redfish Session With ClientID ${client_id}
1081
1082 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1083 Append To List ${trans_id_list} ${trans_id}
1084
1085 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
1086 ${value}= Get From Dictionary ${trans_id} TransactionID
1087 ${value}= Evaluate ${value} + 10
1088 Set To Dictionary ${trans_id} TransactionID ${value}
1089 Append To List ${trans_id_list} ${trans_id}
1090
1091 Release Locks On Resource
1092 ... ${session_info} ${trans_id_list}
1093 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST}
1094 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session
1095
1096 ${trans_id_emptylist}= Create List
1097 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
1098 Redfish Delete Session ${session_info}
1099
1100
susilsi71d7b9962021-03-02 03:06:18 -06001101Verify Fail To Release Lock With TransactionID As String Type
George Keishing96143832021-03-23 07:55:08 -05001102 [Documentation] Verify fail to be release lock with transaction ID as string data type.
susilsi71d7b9962021-03-02 03:06:18 -06001103 [Arguments] ${client_id} ${lock_type} ${release_lock_type}
1104
1105 # Description of argument(s):
1106 # client_id This client id can contain string value
1107 # (e.g. 12345, "HMCID").
1108 # lock_type Read lock or Write lock.
1109 # release_lock_type The value can be Transaction or Session.
1110
1111 ${trans_id_list}= Create List
1112 @{lock_type_list}= Split String ${lock_type} ,
1113
1114 ${session_info}= Create Redfish Session With ClientID ${client_id}
1115
1116 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1117
1118 Append To List ${trans_id_list} ${trans_id}
1119
1120 ${temp_trans_id_list}= Copy Dictionary ${trans_id_list} deepcopy=True
1121
1122 ${value}= Get From Dictionary ${trans_id_list}[0] TransactionID
1123 ${value}= Set Variable \'${value}\'
1124 Set To Dictionary ${temp_trans_id_list}[0] TransactionID ${value}
1125
1126 Release Locks On Resource
1127 ... ${session_info} ${temp_trans_id_list}
1128 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST}
1129
1130 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type}
1131
1132 ${trans_id_emptylist}= Create List
1133 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
1134 Redfish Delete Session ${session_info}
1135
1136
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001137Verify Fail To Release Lock For Another Session
1138 [Documentation] Verify failed to release the lock form another session.
1139 [Arguments] ${client_id} ${lock_type}
1140
1141 # Description of argument(s):
1142 # client_id This client id can contain string value
1143 # (e.g. 12345, "HMCID").
1144 # lock_type Read lock or Write lock.
1145
1146 ${client_ids}= Split String ${client_id} ,
1147 ${lock_type_list}= Split String ${lock_type} ,
1148 ${trans_id_list1}= Create List
1149 ${trans_id_list2}= Create List
1150
1151 ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0]
1152
1153 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1154 Append To List ${trans_id_list1} ${trans_id}
1155 Verify Lock On Resource ${session_info1} ${trans_id_list1}
1156
1157 ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1]
1158 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
1159 Append To List ${trans_id_list2} ${trans_id}
1160 Verify Lock On Resource ${session_info2} ${trans_id_list2}
1161
1162 Release Locks On Resource
Sushil Singhe3f2e3b2022-07-28 05:15:43 -05001163 ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_BAD_REQUEST}
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001164 Verify Lock On Resource ${session_info1} ${trans_id_list1}
1165 Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session
1166 Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session
1167 Redfish Delete Session ${session_info1}
1168 Redfish Delete Session ${session_info2}
1169
1170
Sushil Singhe33c6e62020-09-29 06:34:35 -05001171Verify Fail To Acquire Lock For Invalid Resource ID Data Type
1172 [Documentation] Verify fail to acquire the lock with invalid resource id data type.
1173 [Arguments] ${client_id} ${lock_type}
1174
1175 # Description of argument(s):
1176 # client_id This client id can contain string value
1177 # (e.g. 12345, "HMCID").
1178 # lock_type Read lock or Write lock.
1179
1180 ${session_info}= Create Redfish Session With ClientID ${client_id}
1181 Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID
1182 ... ${lock_type} status_code=${HTTP_BAD_REQUEST}
1183 Redfish Delete Session ${session_info}
1184
1185
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001186Verify Fail To Acquire Lock For Invalid Lock Data
George Keishing16b3c7b2021-01-28 09:23:37 -06001187 [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segment flags.
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001188 [Arguments] ${client_id} ${lock_type} ${message}
1189
1190 # Description of argument(s):
1191 # client_id This client id can contain string value
1192 # (e.g. 12345, "HMCID").
1193 # lock_type Read lock or Write lock.
1194 # message Return message from URI.
1195
1196 ${session_info}= Create Redfish Session With ClientID ${client_id}
Sushil Singh8a3efe72021-08-26 08:16:41 -05001197 ${trans_id}= Redfish Post Acquire Invalid Lock
1198 ... ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST}
Sushil Singhd03f2ce2020-09-17 08:54:41 -05001199 Redfish Delete Session ${session_info}
Sushil Singhbace3002020-10-08 08:12:58 -05001200
1201
1202Verify No Locks Records For Session With No Acquired Lock
1203 [Documentation] Verify no records found for a session where no lock is acquired.
1204 [Arguments] ${client_id}
1205
1206 # Description of argument(s):
1207 # client_id This client id can contain string value
1208 # (e.g. 12345, "HMCID").
1209
1210 ${session_info}= Create Redfish Session With ClientID ${client_id}
1211 ${trans_id_emptylist}= Create List
1212 Verify Lock On Resource ${session_info} ${trans_id_emptylist}
1213 Redfish Delete Session ${session_info}
Sushil Singh728ef9c2020-10-28 04:25:39 -05001214
1215
1216Create List Of Session ID
1217 [Documentation] Create session id list from session dict info.
1218 [Arguments] ${session_dict_info}
1219
1220 # Description of argument(s):
1221 # session_dict_info Session information in dict.
1222
1223 @{session_id_list}= Create List
1224
1225 FOR ${session} IN @{session_dict_info}
1226 Append To List ${session_id_list} ${session["SessionIDs"]}
1227 END
1228
1229 ${num_id}= Get Length ${session_id_list}
1230 Should Not Be Equal As Integers ${num_id} ${0}
1231
1232 ${session_id_list}= Evaluate json.dumps(${session_id_list}) json
1233
1234 [Return] ${session_id_list}
1235
1236
1237Get Locks List On Resource With Session List
1238 [Documentation] Get locks list from session of list.
1239 [Arguments] ${session_id_list} ${exp_status_code}=${HTTP_OK}
1240
1241 # Description of argument(s):
1242 # session_id_list Session ids list.
1243 # exp_status_code Expected HTTP status code.
1244
1245 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList
George Keishingfbd67002022-08-01 11:24:03 -05001246 ... data={"SessionIDs":${session_id_list}} expected_status=any
susilsi794116c62021-03-04 07:57:51 -06001247 Should Be Equal As Strings ${resp.status_code} ${exp_status_code}
Sushil Singh728ef9c2020-10-28 04:25:39 -05001248 ${locks}= Evaluate json.loads('''${resp.text}''') json
1249
1250 [Return] ${locks}
1251
1252
1253Verify List Of Session Lock On Resource
1254 [Documentation] Verify list of lock record from list of sessions.
1255 [Arguments] ${session_dict_info} ${transaction_id_list}
1256
1257 # Description of argument(s):
1258 # session_dict_info Session information in dict.
1259 # transaction_id_list Transaction id in list stored in dict.
1260
1261 ${session_id_list}= Create List Of Session ID ${session_dict_info}
1262 ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list}
1263 ${lock_list}= Set Variable ${lock_list_resp['Records']}
1264
Sushil Singh8a3efe72021-08-26 08:16:41 -05001265 FOR ${session_id} ${tran_id} ${lock_record} IN ZIP
1266 ... ${session_dict_info} ${transaction_id_list} ${lock_list}
Sushil Singh728ef9c2020-10-28 04:25:39 -05001267 Valid Value session_id['SessionIDs'] ['${lock_record['SessionID']}']
1268 Should Be Equal As Integers ${tran_id['TransactionID']} ${lock_record['TransactionID']}
1269 END
1270
1271
1272Verify Lock Records Of Multiple Session
1273 [Documentation] Verify all records found for a multiple sessions.
1274 [Arguments] ${client_ids} ${lock_type}
1275
1276 # Description of argument(s):
1277 # client_ids This client id can contain string value
1278 # (e.g. 12345, "HMCID").
1279 # lock_type Read lock or Write lock.
1280
1281 ${client_id_list}= Split String ${client_ids} ,
1282 ${lock_type_list}= Split String ${lock_type} ,
1283 ${trans_id_list1}= Create List
1284 ${trans_id_list2}= Create List
1285
1286 ${session_dict_list}= Create List
1287 ${lock_list}= Create List
1288
1289 ${client_id1}= Create List
1290 Append To List ${client_id1} ${client_id_list}[0]
1291 ${session_info1}= Create Session With List Of ClientID ${client_id1}
1292 Append To List ${session_dict_list} ${session_info1}[0]
1293 Verify A Session Created With ClientID ${client_id1} ${session_info1}
1294
1295 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1296 Append To List ${trans_id_list1} ${trans_id}
1297 Append To List ${lock_list} ${trans_id}
1298 Verify Lock On Resource ${session_info1}[0] ${trans_id_list1}
1299
1300
1301 ${client_id2}= Create List
1302 Append To List ${client_id2} ${client_id_list}[1]
1303 ${session_info2}= Create Session With List Of ClientID ${client_id2}
1304 Append To List ${session_dict_list} ${session_info2}[0]
1305 Verify A Session Created With ClientID ${client_id2} ${session_info2}
1306
1307 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1]
1308 Append To List ${trans_id_list2} ${trans_id}
1309 Append To List ${lock_list} ${trans_id}
1310 Verify Lock On Resource ${session_info2}[0] ${trans_id_list2}
1311
1312 Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list}
1313
1314 ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken
1315 Set Global Variable ${XAUTH_TOKEN} ${session_token}
1316
1317 Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction
1318
1319 ${session_token}= Get From Dictionary ${session_info2}[0] SessionToken
1320 Set Global Variable ${XAUTH_TOKEN} ${session_token}
1321
1322 Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Transaction
1323
1324 ${trans_id_emptylist}= Create List
1325 Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist}
1326 Verify Lock On Resource ${session_info2}[0] ${trans_id_emptylist}
1327
1328 Redfish Delete List Of Session ${session_dict_list}
Sushil Singhf9a536c2020-11-09 07:33:17 -06001329
1330
1331Verify Lock Records For Multiple Invalid Session
1332 [Documentation] Verify no lock record found for multiple invalid session.
1333 [Arguments] ${client_id}
1334
1335 # Description of argument(s):
1336 # client_id This client id can contain string value
1337 # (e.g. 12345, "HMCID").
1338
1339 ${session_dict_list}= Create List
1340 ${invalid_session_ids}= Create List xxyXyyYZZz xXyXYyYZzz
1341
1342 ${session_info1}= Create Session With ClientID ${client_id}
1343
1344 ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True
1345 set to dictionary ${session_info2} SessionIDs ${invalid_session_ids}[0]
1346 Append To List ${session_dict_list} ${session_info2}
1347
1348 ${session_info3}= Copy Dictionary ${session_info1} deepcopy=True
1349 set to dictionary ${session_info3} SessionIDs ${invalid_session_ids}[0]
1350 Append To List ${session_dict_list} ${session_info3}
1351
1352 ${lock_list1}= Get Locks List On Resource ${session_info1}
1353 ${lock_length1}= Get Length ${lock_list1}
1354
1355 ${session_id_list}= Create List Of Session ID ${session_dict_list}
1356 ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list}
1357 ${lock_length2}= Get Length ${lock_list_resp['Records']}
1358
1359 Should Be Equal As Integers ${lock_length1} ${lock_length2}
1360
1361 Redfish Delete Session ${session_info1}
Sushil Singh11949a22020-11-13 06:12:16 -06001362
1363
1364Verify Lock Records For Multiple Invalid And Valid Session
1365 [Documentation] Verify all records found for a valid and invalid sessions.
1366 [Arguments] ${client_ids} ${lock_type}
1367
1368 # Description of argument(s):
1369 # client_ids This client id can contain string value
1370 # (e.g. 12345, "HMCID").
1371 # lock_type Read lock or Write lock.
1372
1373 ${client_id_list}= Split String ${client_ids} ,
1374 ${lock_type_list}= Split String ${lock_type} ,
1375 ${trans_id_list1}= Create List
1376 ${invalid_session_ids}= Create List xxyXyyYZZz
1377
1378 ${session_dict_list}= Create List
1379 ${lock_list}= Create List
1380
1381 ${client_id1}= Create List
1382 Append To List ${client_id1} ${client_id_list}[0]
1383 ${session_info1}= Create Session With List Of ClientID ${client_id1}
1384 Append To List ${session_dict_list} ${session_info1}[0]
1385 Verify A Session Created With ClientID ${client_id1} ${session_info1}
1386
1387 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
1388 Append To List ${trans_id_list1} ${trans_id}
1389 Append To List ${lock_list} ${trans_id}
1390 Verify Lock On Resource ${session_info1}[0] ${trans_id_list1}
1391
1392 ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True
1393 set to dictionary ${session_info2}[0] SessionIDs ${invalid_session_ids}[0]
1394 Append To List ${session_dict_list} ${session_info2}[0]
1395
1396 Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list}
1397
1398 ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken
1399 Set Global Variable ${XAUTH_TOKEN} ${session_token}
1400
1401 Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction
1402
1403 ${trans_id_emptylist}= Create List
1404 Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist}
1405
1406 Redfish Delete Session ${session_info1}[0]