3
3
Documentation Test Lock Management feature of Management Console on BMC.
4
4
5
5
Resource ../../lib/resource.robot
6
- Resource ../../lib/bmc_redfish_resource.robot
7
6
Resource ../../lib/openbmc_ffdc.robot
7
+ Resource ../../lib/bmc_redfish_utils.robot
8
8
9
+ Suite Setup Delete All Redfish Sessions
9
10
Test Setup Test Setup Execution
10
11
Test Teardown Test Teardown Execution
12
+ Suite Teardown Delete All Redfish Sessions
11
13
12
14
*** Variables ***
13
15
@@ -192,11 +194,10 @@ Verify GetLockList Returns An Empty Record For An Invalid Session Id
192
194
[Documentation] Verify GetLockList returns an empty record for an invalid session id.
193
195
[Tags] Verify_GetLockList_Returns_An_Empty_Record_For_An_Invalid_Session_Id
194
196
195
- ${session_location } = Redfish.Get Session Location
196
- ${session_id } = Evaluate os.path.basename($session_location) modules=os
197
+ ${resp } = Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${hmc_id } "}}
197
198
198
- ${records } = Run Keyword Get Locks List ${session_id }
199
- ${records } = Run Keyword Get Locks List ZZzZZz9zzZ
199
+ ${records } = Get Locks List ${resp['Id'] }
200
+ ${records } = Get Locks List ZZzZZz9zzZ
200
201
${length } = Get Length ${records }
201
202
Should Be Equal ${length } ${0 }
202
203
@@ -214,30 +215,34 @@ Verify Lock Conflicts
214
215
Write ${TWO_SEG_FLAG_2 } ${234 } hmc-id ${HTTP_CONFLICT } ['NA'] ${False }
215
216
216
217
217
- Verify Persistency Of Locks After BMC Reboot
218
+ Verify Persistency Of Read Locks After BMC Reboot
218
219
[Documentation] Verify persistency of locks after BMC reboot.
219
- [Tags] Verify_Persistency_Of_Locks_After_BMC_Reboot
220
+ [Tags] Verify_Persistency_Of_Read_Locks_After_BMC_Reboot
220
221
[Template] Locks Persistency Check After BMC Reboot
221
222
222
223
# lock_type seg_flags resource_id
223
224
Read ${TWO_SEG_FLAG_2 } ${234 }
225
+
226
+
227
+ Verify Persistency Of Write Locks After BMC Reboot
228
+ [Documentation] Verify persistency of locks after BMC reboot.
229
+ [Tags] Verify_Persistency_Of_Write_Locks_After_BMC_Reboot
230
+ [Template] Locks Persistency Check After BMC Reboot
231
+
232
+ # lock_type seg_flags resource_id
224
233
Write ${TWO_SEG_FLAG_2 } ${234 }
225
234
226
235
227
236
Verify Valid Lock Transactions Release
228
237
[Documentation] Verify valid lock transactions release.
229
238
[Tags] Verify_Valid_Lock_Transactions_Release
230
239
231
- ${transaction_id1 } = Acquire Lock On A Given Resource
232
- ... Read ${TWO_SEG_FLAG_2 } ${234 }
240
+ ${transaction_id1 } = Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_2 } ${234 }
233
241
${locks_before } = Get Locks List ${SESSION_ID }
234
242
235
- ${transaction_id2 } = Acquire Lock On A Given Resource
236
- ... Read ${TWO_SEG_FLAG_3 } ${234 }
237
- ${transaction_id3 } = Acquire Lock On A Given Resource
238
- ... Read ${TWO_SEG_FLAG_2 } ${234 }
239
- ${transaction_id4 } = Acquire Lock On A Given Resource
240
- ... Read ${TWO_SEG_FLAG_3 } ${234 }
243
+ ${transaction_id2 } = Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_3 } ${234 }
244
+ ${transaction_id3 } = Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_2 } ${234 }
245
+ ${transaction_id4 } = Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_3 } ${234 }
241
246
242
247
${transaction_ids } = Create List ${transaction_id2 } ${transaction_id3 } ${transaction_id4 }
243
248
Release Locks ${transaction_ids }
@@ -249,8 +254,7 @@ Verify Invalid Lock Transactions Release
249
254
[Documentation] Verify invalid lock transactions release.
250
255
[Tags] Verify_Invalid_Lock_Transactions_Release
251
256
252
- ${transaction_id1 } = Acquire Lock On A Given Resource
253
- ... Read ${TWO_SEG_FLAG_2 } ${234 }
257
+ ${transaction_id1 } = Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_2 } ${234 }
254
258
${locks_before } = Get Locks List ${SESSION_ID }
255
259
256
260
${transaction_id2 } = Evaluate ${transaction_id1 } + 1
@@ -268,18 +272,15 @@ Verify Locks Release By Session
268
272
[Tags] Verify_Locks_Release_By_Session
269
273
270
274
${locks_before } = Get Locks List ${SESSION_ID }
271
- ${transaction_id1 } = Acquire Lock On A Given Resource
272
- ... Write ${TWO_SEG_FLAG_2 } ${234 }
275
+ ${transaction_id1 } = Acquire Lock On A Given Resource Write ${TWO_SEG_FLAG_2 } ${234 }
273
276
274
277
# Release Lock by Session without mentioning transaction_ids.
275
278
Release Locks release_type=Session
276
279
${locks_after } = Get Locks List ${SESSION_ID }
277
280
Should Be Equal ${locks_before } ${locks_after }
278
281
279
- ${transaction_id1 } = Acquire Lock On A Given Resource
280
- ... Read ${TWO_SEG_FLAG_2 } ${234 }
281
- ${transaction_id2 } = Acquire Lock On A Given Resource
282
- ... Read ${TWO_SEG_FLAG_3 } ${234 }
282
+ ${transaction_id1 } = Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_2 } ${234 }
283
+ ${transaction_id2 } = Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_3 } ${234 }
283
284
${transaction_ids } = Create List ${transaction_id1 } ${transaction_id2 }
284
285
285
286
# Release Lock by Session by mentioning transaction_ids also in the request.
@@ -289,17 +290,18 @@ Verify Locks Release By Session
289
290
Verify Locks Created By One Session Cannot Be Deleted By Another Session
290
291
[Documentation] Verify locks created by one session cannot be deleted by another session.
291
292
[Tags] Verify_Locks_Created_By_One_Session_Cannot_Be_Deleted_By_Another_Session
293
+ [Setup] No Operation
292
294
293
- ${transaction_id1 } = Acquire Lock On A Given Resource
294
- ... Read ${TWO_SEG_FLAG_2 } ${234 }
295
- ${locks_tran1 } = Get Locks List ${SESSION_ID }
295
+ ${resp } = Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"hmc-id"}}
296
+ Set Test Variable ${SESSION_ID } ${resp['Id'] }
297
+ ${transaction_id1 } = Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_2 } ${234 }
298
+ ${locks_tran1 } = Get Locks List ${resp['Id'] }
296
299
297
- Redfish. Login
298
- ${ session_id } ${ session_key } = Return Session Id And Session Key
300
+ ${ resp } = Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"hmc-id"}}
301
+ Set Test Variable ${ SESSION_ID } ${ resp['Id'] }
299
302
300
- ${transaction_id2 } = Acquire Lock On A Given Resource
301
- ... Read ${TWO_SEG_FLAG_3 } ${234 }
302
- ${locks_before } = Get Locks List ${SESSION_ID }
303
+ ${transaction_id2 } = Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_3 } ${234 }
304
+ ${locks_before } = Get Locks List ${resp['Id'] }
303
305
304
306
${transaction_ids } = Create List ${transaction_id1 } ${transaction_id2 }
305
307
Release Locks ${transaction_ids } exp_status_code=${HTTP_UNAUTHORIZED } conflict_record=${locks_tran1 }
@@ -323,16 +325,16 @@ Locks Persistency Check After BMC Reboot
323
325
# seg_flags Segmentation Flags to identify lock elements under system level in the hierarchy.
324
326
# resource_id Decimal +ve integer value of maximum 8 hex bytes. Ex: 134, 2048 etc.
325
327
326
- ${transaction_id } = Run Keyword Acquire Lock On A Given Resource
327
- ... ${lock_type } ${seg_flags } ${resource_id }
328
+ ${transaction_id } = Acquire Lock On A Given Resource ${lock_type } ${seg_flags } ${resource_id }
328
329
329
- ${locks_prev } = Run Keyword Get Locks List ${SESSION_ID }
330
+ ${locks_prev } = Get Locks List ${SESSION_ID }
330
331
331
- Initialize OpenBMC
332
- OBMC Reboot (off)
332
+ Redfish OBMC Reboot (off)
333
+ Redfish Login
333
334
334
- ${locks_curr } = Run Keyword Get Locks List ${SESSION_ID }
335
+ ${locks_curr } = Get Locks List ${SESSION_ID }
335
336
Should Be Equal ${locks_prev } ${locks_curr }
337
+
336
338
${transaction_ids } = Create List ${transaction_id }
337
339
Release Locks ${transaction_ids }
338
340
@@ -346,11 +348,14 @@ Return Data Dictionary For Single Request
346
348
# seg_flags Segmentation Flags to identify lock elements under system level in the hierarchy.
347
349
# resource_id Decimal +ve integer value of maximum 8 hex bytes. Ex: 134, 2048 etc.
348
350
349
- ${SEG_FLAGS_LOCK } = Create Dictionary LockType=${lock_type } SegmentFlags=@{seg_flags }
351
+ ${SEG_FLAGS_LOCK } = Create Dictionary
352
+ ... LockType=${lock_type }
353
+ ... SegmentFlags=@{seg_flags }
350
354
... ResourceID=${resource_id }
355
+
351
356
${SEG_FLAGS_ENTRIES } = Create List ${SEG_FLAGS_LOCK }
352
357
${LOCK_REQUEST } = Create Dictionary Request=${SEG_FLAGS_ENTRIES }
353
- Log To Console ${LOCK_REQUEST }
358
+ Log To Console \n ${LOCK_REQUEST }
354
359
355
360
[Return] ${LOCK_REQUEST }
356
361
@@ -370,17 +375,17 @@ Acquire Lock On A Given Resource
370
375
# err_msgs List of expected error messages.
371
376
372
377
${data } = Return Data Dictionary For Single Request ${lock_type } ${seg_flags } ${resource_id }
373
- ${resp } = Redfish.Post /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock
374
- ... body=${data } valid_status_codes=[${exp_status_code } ]
378
+ ${resp } = Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${data }
375
379
376
380
${transaction_id } = Run Keyword If ${exp_status_code } != ${HTTP_OK }
377
- ... Set Variable ${0 }
378
- ... ELSE Load Lock Record And Build Transaction To Session Map ${resp.text }
381
+ ... Set Variable ${0 }
382
+ ... ELSE
383
+ ... Load Lock Record And Build Transaction To Session Map ${resp.text }
379
384
380
385
Run Keyword If ${exp_status_code } == ${HTTP_CONFLICT } and ${err_msgs } == ['NA']
381
- ... Load Response And Verify Conflict ${resp.text } ${SESSION_ID }
386
+ ... Load Response And Verify Conflict ${resp.text } ${SESSION_ID }
382
387
... ELSE Run Keyword If ${exp_status_code } != ${HTTP_OK } and ${err_msgs } != ${EMPTY_LIST }
383
- ... Load Response And Verify Error ${resp.text } err_msgs=${err_msgs }
388
+ ... Load Response And Verify Error ${resp.text } err_msgs=${err_msgs }
384
389
385
390
Append Transaction Id And Session Id To Locks Dictionary ${transaction_id }
386
391
@@ -418,7 +423,7 @@ Load Response And Verify Error
418
423
Append To List ${extended_errors } ${error[0]["Message"] }
419
424
END
420
425
421
- Log To Console EXTENDED = ${extended_errors }
426
+ Log To Console \n ${extended_errors }
422
427
423
428
FOR ${exp_error } IN @{err_msgs }
424
429
Run Keyword Expect List Of Errors In An Extended Errors ${exp_error } ${extended_errors }
@@ -459,9 +464,8 @@ Get Locks List
459
464
460
465
${sessions } = Evaluate json.dumps(${sessions } ) json
461
466
${data } = Set Variable {"SessionIDs": ${sessions } }
462
- ${resp } = Redfish.Post /ibm/v1/HMC/LockService/Actions/LockService.GetLockList
463
- ... body=${data } valid_status_codes=[${exp_status_code } ]
464
-
467
+ ${resp } = Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList
468
+ ... data=${data }
465
469
${locks } = Evaluate json.loads('''${resp.text } ''') json
466
470
467
471
[Return] ${locks["Records"] }
@@ -482,9 +486,8 @@ Release Locks
482
486
# When release_type=Session then TransactionIDs list will be ignored.
483
487
${data } = Set Variable {"Type": "${release_type } ", "TransactionIDs": ${transaction_ids } }
484
488
${data } = Evaluate json.dumps(${data } ) json
485
- ${resp } = Redfish.Post /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock
486
- ... body=${data } valid_status_codes=[${exp_status_code } ]
487
- Should Be True ${resp.status } ${exp_status_code }
489
+ ${resp } = Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data }
490
+ Should Be True ${resp.status_code } ${exp_status_code }
488
491
Return From Keyword If ${conflict_record } == ${EMPTY_LIST }
489
492
490
493
${conflict } = Evaluate json.loads('''${resp.text } ''') json
@@ -522,7 +525,7 @@ Verify Lock Record
522
525
# lock_records A dictionary containing key value pairs of a lock record.
523
526
524
527
${session } = Get From Dictionary ${LOCKS } ${lock_records["TransactionID"] }
525
- ${locks } = Run Keyword Get Locks List ${session }
528
+ ${locks } = Get Locks List ${session }
526
529
527
530
${lock_record_found } = Set Variable ${False }
528
531
@@ -552,7 +555,7 @@ Load Response And Verify Conflict
552
555
# "SessionID": "B6geYEdo6T", "TransactionID": 104 } }
553
556
# sessions Comma separated list of sessions
554
557
555
- ${curr_locks } = Run Keyword Get Locks List ${sessions }
558
+ ${curr_locks } = Get Locks List ${sessions }
556
559
${conflict_resp } = Replace String ${conflict_resp } \" \\"
557
560
${conflict_response } = Evaluate json.loads('''${conflict_resp } ''') json
558
561
@@ -576,13 +579,19 @@ Acquire And Release Lock
576
579
# err_msgs List of expected error messages.
577
580
# new_sess_req Create a new session before acquiring a lock if True.
578
581
582
+ # Delete the session.
583
+ Run Keyword If ${new_sess_req } == ${True } Delete All Redfish Sessions
584
+
579
585
# Get REST session to BMC.
580
586
Run Keyword If ${new_sess_req } == ${True } Create New Session
581
587
582
- ${inputs } = Create Dictionary LockType=${lock_type } ResourceID=${resource_id }
583
- ... SegmentFlags=${seg_flags } HMCID=${hmc_id }
588
+ ${inputs } = Create Dictionary
589
+ ... LockType=${lock_type }
590
+ ... ResourceID=${resource_id }
591
+ ... SegmentFlags=${seg_flags }
592
+ ... HMCID=${hmc_id }
584
593
585
- ${transaction_id } = Run Keyword Acquire Lock On A Given Resource ${inputs["LockType"] }
594
+ ${transaction_id } = Acquire Lock On A Given Resource ${inputs["LockType"] }
586
595
... ${inputs["SegmentFlags"] } ${inputs["ResourceID"] } ${exp_status_code } err_msgs=${err_msgs }
587
596
588
597
# Each lock request from a new session is saved so that for next lock request using same session
@@ -601,28 +610,19 @@ Acquire And Release Lock
601
610
Release Locks ${transaction_ids }
602
611
Verify Lock Record ${False } &{inputs }
603
612
604
- # Delete the session.
605
- Redfish.Logout
606
-
607
613
608
614
Create New Session
609
615
[Documentation] Create new session.
610
616
611
- # Delete current session.
612
- Redfish.Logout
613
-
614
- # Get a redfish session to BMC.
615
- Redfish.Login
616
- ${session_id } ${session_key } = Return Session Id And Session Key
617
- Set Test Variable ${SESSION_ID } ${session_id }
618
- Set Test Variable ${SESSION_KEY } ${session_key }
617
+ ${resp } = Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${hmc_id } "}}
618
+ Set Test Variable ${SESSION_ID } ${resp['Id'] }
619
619
620
620
621
621
Test Teardown Execution
622
622
[Documentation] Test teardown execution.
623
623
624
624
FFDC On Test Case Fail
625
- Redfish.Logout
625
+ Delete All Redfish Sessions
626
626
627
627
628
628
Return Session Id And Session Key
@@ -638,10 +638,12 @@ Return Session Id And Session Key
638
638
Test Setup Execution
639
639
[Documentation] Test setup execution.
640
640
641
+ # This is a test constant value.
642
+ Set Test Variable ${hmc_id } hmc-id
641
643
Create New Session
642
644
643
- Set Test Variable Dictionary Of Previous Lock Request ${ EMPTY } ${ EMPTY_LIST } ${ EMPTY } ${ EMPTY }
644
- ... ${EMPTY } ${EMPTY }
645
+ Set Test Variable Dictionary Of Previous Lock Request
646
+ ... ${EMPTY } ${EMPTY_LIST } ${ EMPTY } ${ EMPTY } ${ EMPTY } ${ EMPTY }
645
647
646
648
647
649
Set Test Variable Dictionary Of Previous Lock Request
@@ -658,7 +660,12 @@ Set Test Variable Dictionary Of Previous Lock Request
658
660
# session_id Session id of the transaction.
659
661
# transaction_id Transaction_id of the lock request.
660
662
661
- ${prev_inputs } = Create Dictionary LockType=${lock_type } ResourceID=${resource_id }
662
- ... SegmentFlags=${seg_flags } HMCID=${hmc_id } SessionID=${session_id } TransactionID=${transaction_id }
663
+ ${prev_inputs } = Create Dictionary
664
+ ... LockType=${lock_type }
665
+ ... ResourceID=${resource_id }
666
+ ... SegmentFlags=${seg_flags }
667
+ ... HMCID=${hmc_id }
668
+ ... SessionID=${session_id }
669
+ ... TransactionID=${transaction_id }
663
670
664
671
Set Test Variable ${PREV_INPUTS } ${prev_inputs }
0 commit comments