1*** Settings *** 2 3Documentation Test lock management feature of management console on BMC. 4 5Resource ../../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 11 12Suite 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 16 17*** Variables *** 18 19${BAD_REQUEST} Bad Request 20 21*** Test Cases *** 22 23Acquire Read Write Lock 24 [Documentation] Acquire and release different read locks. 25 [Tags] Acquire_Read_Write_Lock 26 [Template] Acquire Lock On Resource 27 28 # client_id lock_type reboot_flag 29 HMCID-01 ReadCase1 False 30 HMCID-01 ReadCase2 False 31 HMCID-01 ReadCase3 False 32 HMCID-01 WriteCase1 False 33 HMCID-01 WriteCase2 False 34 HMCID-01 WriteCase3 False 35 36 37Verify Lock Is Not Persistent On BMC Reboot 38 [Documentation] Acquire lock and after reboot the locks are removed as no persistency 39 ... maintained. 40 [Tags] Verify_Lock_Is_Not_Persistent_On_BMC_Reboot 41 [Template] Acquire Lock On Resource 42 43 # client_id lock_type reboot_flag 44 HMCID-01 ReadCase1 True 45 HMCID-01 ReadCase2 True 46 HMCID-01 ReadCase3 True 47 HMCID-01 WriteCase1 True 48 HMCID-01 WriteCase2 True 49 HMCID-01 WriteCase3 True 50 51 52Acquire Read Lock On Read Lock 53 [Documentation] Acquire read lock on another read lock. 54 [Tags] Acquire_Read_Lock_On_Read_Lock 55 [Template] Acquire Lock On Another Lock 56 57 # client_id 58 HMCID-01 59 60 61Fail To Acquire Lock On Another Lock 62 [Documentation] Fail to acquire another lock. 63 [Tags] Fail_To_Acquire_Lock_On_Another_Lock 64 [Template] Verify Acquire Lock Fails On Another Lock 65 66 # client_id lock_type 67 HMCID-01 ReadCase2,WriteCase2 68 HMCID-01 WriteCase2,WriteCase2 69 HMCID-01 WriteCase2,ReadCase2 70 71 72Acquire Lock After Reboot 73 [Documentation] Acquire and release read and write locks after reboot. 74 [Tags] Acquire_Lock_After_Reboot 75 [Template] Verify Acquire Lock After Reboot 76 77 # client_id lock_type 78 HMCID-01 ReadCase1 79 HMCID-01 ReadCase2 80 HMCID-01 ReadCase3 81 HMCID-01 WriteCase1 82 HMCID-01 WriteCase2 83 HMCID-01 WriteCase3 84 85 86Acquire And Release Lock In Loop 87 [Documentation] Acquire and release read, write locks in loop. 88 [Tags] Acquire_And_Release_Lock_In_Loop 89 [Template] Verify Acquire And Release Lock In Loop 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 100Fail To Acquire Read And Write In Single Request 101 [Documentation] Fail to acquire read and write lock in single request. 102 [Tags] Fail_To_Acquire_Read_And_Write_In_Single_Request 103 [Template] Verify Fail To Acquire Read And Write In Single Request 104 105 # client_id lock_type 106 HMCID-01 ReadCase1,WriteCase1 107 HMCID-01 WriteCase1,ReadCase1 108 109 110Acquire Multiple Lock Request At CEC Level 111 [Documentation] Acquire write lock on read lock under CEC level. 112 [Tags] Acquire_Multiple_Lock_Request_At_CEC_Level 113 [Template] Verify Acquire Multiple Lock Request At CEC Level 114 115 # client_id lock_type 116 HMCID-01 ReadCase4,WriteCase4 117 HMCID-01 WriteCase5,ReadCase5 118 HMCID-01 ReadCase6,WriteCase6 119 HMCID-01 WriteCase7,ReadCase7 120 121 122Verify Release Of Valid Locks 123 [Documentation] Release all valid locks. 124 [Tags] Verify_Release_Of_Valid_Locks 125 [Template] Acquire And Release Multiple Locks 126 127 # client_id lock_type release_lock_type 128 HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 129 HMCID-02 ReadCase1,ReadCase1,ReadCase1 Session 130 131 132Release Lock When Session Deleted 133 [Documentation] Release lock when session gets deleted. 134 [Tags] Release_Lock_When_Session_Deleted 135 [Template] Verify Release Lock When Session Deleted 136 137 # client_id lock_type 138 HMCID-01 ReadCase1 139 HMCID-01 WriteCase1 140 141 142Fail To Release Lock With Invalid TransactionID 143 [Documentation] Fail to release lock with invalid transaction id. 144 [Tags] Fail_To_Release_Lock_With_Invalid_TransactionID 145 [Template] Verify Fail To Release Lock With Invalid TransactionID 146 147 # client_id lock_type release_lock_type 148 HMCID-01 ReadCase1 Transaction 149 HMCID-01 WriteCase1 Transaction 150 151 152Fail To Release Multiple Lock With Invalid TransactionID 153 [Documentation] Release in-valid lock result in fail. 154 [Tags] Fail_To_Release_Multiple_Lock_With_Invalid_TransactionID 155 [Template] Verify Fail To Release Multiple Lock With Invalid TransactionID 156 157 # client_id lock_type release_lock_type 158 HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 159 12345 ReadCase2,ReadCase2,ReadCase2 Transaction 160 HMCID ReadCase3,ReadCase3,ReadCase3 Transaction 161 162 163Fail To Release Multiple Lock With Valid And Invalid TransactionID 164 [Documentation] Release multiple lock with valid and invalid transaction. 165 [Tags] Fail_To_Release_Multiple_Lock_With_Valid_And_Invalid_TransactionID 166 [Template] Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID 167 168 # client_id lock_type release_lock_type 169 HMCID-01 ReadCase1,ReadCase1 Transaction 170 171 172Fail To Release Lock With String As TransactionID Data Type 173 [Documentation] Fail to release lock with string as transaction id data type. 174 [Tags] Fail_To_Release_Lock_With_String_As_TransactionID_Data_Type 175 [Template] Verify Fail To Release Lock With TransactionID As String Type 176 177 # client_id lock_type release_lock_type 178 HMCID-01 ReadCase1 Transaction 179 HMCID-01 WriteCase1 Transaction 180 181 182Fail To Release Lock For Another Session 183 [Documentation] Failed to release locks from another session. 184 [Tags] Fail_To_Release_Lock_For_Another_Session 185 [Template] Verify Fail To Release Lock For Another Session 186 187 # client_id lock_type 188 HMCID-01,HMCID-02 ReadCase1,ReadCase1 189 190 191Test Invalid Resource ID Data Type Locking 192 [Documentation] Failed to acquire lock for invalid resource id data type. 193 [Tags] Test_Invalid_Resource_ID_Data_Type_Locking 194 [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type 195 196 # client_id lock_type 197 HMCID-01 ReadCase1 198 HMCID-01 ReadCase2 199 HMCID-01 ReadCase3 200 HMCID-01 WriteCase1 201 HMCID-01 WriteCase2 202 HMCID-01 WriteCase3 203 204 205Fail To Acquire Lock For Invalid Lock Type 206 [Documentation] Failed to acquire read, write lock for invalid lock data passed. 207 [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type 208 [Template] Verify Fail To Acquire Lock For Invalid Lock Data 209 210 # client_id lock_type message 211 HMCID-01 ReadCase1 ${BAD_REQUEST} 212 HMCID-01 ReadCase2 ${BAD_REQUEST} 213 HMCID-01 ReadCase3 ${BAD_REQUEST} 214 HMCID-01 ReadCase4 ${BAD_REQUEST} 215 HMCID-01 ReadCase5 ${BAD_REQUEST} 216 HMCID-01 WriteCase1 ${BAD_REQUEST} 217 HMCID-01 WriteCase2 ${BAD_REQUEST} 218 HMCID-01 WriteCase3 ${BAD_REQUEST} 219 HMCID-01 WriteCase4 ${BAD_REQUEST} 220 HMCID-01 WriteCase5 ${BAD_REQUEST} 221 222 223Fail To Acquire Lock For Invalid Lock Flag 224 [Documentation] Failed to acquire read write lock for invalid lock flag passed. 225 [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag 226 [Template] Verify Fail To Acquire Lock For Invalid Lock Data 227 228 # client_id lock_type message 229 HMCID-01 ReadCase6 ${BAD_REQUEST} 230 HMCID-01 ReadCase7 ${BAD_REQUEST} 231 HMCID-01 ReadCase8 ${BAD_REQUEST} 232 HMCID-01 ReadCase9 ${BAD_REQUEST} 233 HMCID-01 ReadCase10 ${BAD_REQUEST} 234 HMCID-01 ReadCase11 ${BAD_REQUEST} 235 HMCID-01 WriteCase6 ${BAD_REQUEST} 236 HMCID-01 WriteCase7 ${BAD_REQUEST} 237 HMCID-01 WriteCase8 ${BAD_REQUEST} 238 HMCID-01 WriteCase9 ${BAD_REQUEST} 239 HMCID-01 WriteCase10 ${BAD_REQUEST} 240 HMCID-01 WriteCase11 ${BAD_REQUEST} 241 242 243Fail To Acquire Lock For Invalid Segment Flag 244 [Documentation] Failed to acquire read write lock for invalid segment flag passed. 245 [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag 246 [Template] Verify Fail To Acquire Lock For Invalid Lock Data 247 248 # client_id lock_type message 249 HMCID-01 ReadCase12 ${BAD_REQUEST} 250 HMCID-01 ReadCase13 ${BAD_REQUEST} 251 HMCID-01 ReadCase14 ${BAD_REQUEST} 252 HMCID-01 WriteCase12 ${BAD_REQUEST} 253 HMCID-01 WriteCase13 ${BAD_REQUEST} 254 HMCID-01 WriteCase14 ${BAD_REQUEST} 255 256 257Fail To Acquire Lock For Invalid Segment Data Type Flag 258 [Documentation] Failed to acquire read write lock for invalid segment flag passed. 259 [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Data_Type_Flag 260 [Template] Verify Fail To Acquire Lock For Invalid Lock Data 261 262 # client_id lock_type message 263 HMCID-01 ReadCase15 ${EMPTY} 264 HMCID-01 ReadCase16 ${EMPTY} 265 HMCID-01 ReadCase17 ${EMPTY} 266 HMCID-01 ReadCase18 ${EMPTY} 267 HMCID-01 WriteCase15 ${EMPTY} 268 HMCID-01 WriteCase16 ${EMPTY} 269 HMCID-01 WriteCase17 ${EMPTY} 270 HMCID-01 WriteCase18 ${EMPTY} 271 272 273Get Empty Lock Records For Session Where No Locks Acquired 274 [Documentation] If session does not acquire locks then get lock should return 275 ... empty lock records. 276 [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired 277 [Template] Verify No Locks Records For Session With No Acquired Lock 278 279 # client_id 280 HMCID-01 281 282 283Get Lock Records Empty For Invalid Session 284 [Documentation] Record of lock list is empty for invalid session. 285 [Tags] Get_Lock_Records_Empty_For_Invalid_Session 286 [Template] Verify Empty Lock Records For Invalid Session 287 288 # client_id 289 HMCID-01 290 291 292Get Lock Records For Multiple Session 293 [Documentation] Get lock records of multiple session. 294 [Tags] Get_Lock_Records_For_Multiple_Session 295 [Template] Verify Lock Records Of Multiple Session 296 297 # client_ids lock_type 298 HMCID-01,HMCID-02 ReadCase1,ReadCase1 299 300 301Get Lock Records For Multiple Invalid Session 302 [Documentation] Record of lock list is empty for list of invalid session. 303 [Tags] Get_Lock_Records_For_Multiple_Invalid_Session 304 [Template] Verify Lock Records For Multiple Invalid Session 305 306 # client_id 307 HMCID-01 308 309 310Get Lock Records For Multiple Invalid And Valid Session 311 [Documentation] Get record of lock from invalid and valid session. 312 [Tags] Get_Lock_Records_For_Multiple_Invalid_And_Valid_Session 313 [Template] Verify Lock Records For Multiple Invalid And Valid Session 314 315 # client_id lock_type 316 HMCID-01,HMCID-02 ReadCase1 317 318*** Keywords *** 319 320Create Redfish Session With ClientID 321 [Documentation] Create redifish session with client id. 322 [Arguments] ${client_id} 323 324 # Description of argument(s): 325 # client_id This client id can contain string value 326 # (e.g. 12345, "HMCID"). 327 328 ${session_info}= Create Dictionary 329 ${session}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}} 330 331 Set To Dictionary ${session_info} SessionIDs ${session['Id']} 332 Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]} 333 334 [Return] ${session_info} 335 336 337RW General Dictionary 338 [Documentation] Create dictionary of lock request. 339 [Arguments] ${read_case} ${res_id} 340 341 # Description of argument(s): 342 # read_case Read or Write lock type. 343 # res_id Resource id. 344 345 ${request_dict}= Create Dictionary 346 347 FOR ${key} IN @{read_case.keys()} 348 Set To Dictionary ${request_dict} LockType ${key} 349 Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]} 350 END 351 352 Set To Dictionary ${request_dict} ResourceID ${res_id} 353 354 [Return] ${request_dict} 355 356 357Return Description Of Response 358 [Documentation] Return description of REST response. 359 [Arguments] ${resp_text} 360 361 # Description of argument(s): 362 # resp_text REST response body. 363 364 # resp_text after successful partition file upload looks like: 365 # { 366 # "Description": "File Created" 367 # } 368 369 ${message}= Evaluate json.loads('''${resp_text}''') json 370 371 [Return] ${message} 372 373 374Verify Redfish Session Deleted 375 [Documentation] Verify the redfish session is deleted. 376 [Arguments] ${session_info} 377 378 # Description of argument(s): 379 # session_info Session information are stored in dictionary. 380 381 # ${session_info} = { 382 # 'SessionIDs': 'XXXXXXXXX', 383 # 'ClientID': 'XXXXXX', 384 # 'SessionToken': 'XXXXXXXXX', 385 # 'SessionResp': session response from redfish login 386 # } 387 388 # SessionIDs : Session IDs 389 # ClientID : Client ID 390 # SessionToken : Session token 391 # SessionResp : Response of creating an redfish login session 392 393 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions 394 395 FOR ${session} IN @{sessions['Members']} 396 Should Not Be Equal As Strings 397 ... session ['/redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}'] 398 END 399 400 401Verify Redfish List Of Session Deleted 402 [Documentation] Verify all the list of redfish session is deleted. 403 [Arguments] ${session_info_list} 404 405 # Description of argument(s): 406 # session_info_list List contains individual session record are stored in dictionary. 407 408 # ${session_info_list} = [{ 409 # 'SessionIDs': 'XXXXXXXXX', 410 # 'ClientID': 'XXXXXX', 411 # 'SessionToken': 'XXXXXXXXX', 412 # 'SessionResp': session response from redfish login 413 # }] 414 415 # SessionIDs : Session IDs 416 # ClientID : Client ID 417 # SessionToken : Session token 418 # SessionResp : Response of creating an redfish login session 419 420 FOR ${session_record} IN @{session_info_list} 421 Verify Redfish Session Deleted ${session_record} 422 END 423 424 425Redfish Post Acquire Lock 426 [Documentation] Acquire and release lock. 427 [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 428 429 # Description of argument(s): 430 # lock_type Read lock or Write lock. 431 # status_code HTTP status code. 432 433 ${lock_dict_param}= Form Data To Acquire Lock ${lock_type} 434 ${resp}= Redfish Post Request 435 ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 436 Should Be Equal As Strings ${resp.status_code} ${status_code} 437 438 Run Keyword If ${status_code} == ${HTTP_BAD_REQUEST} 439 ... Valid Value ${BAD_REQUEST} ['${resp.content}'] 440 ... ELSE 441 ... Run Keyword And Return Return Description Of Response ${resp.content} 442 443 [Return] ${resp} 444 445 446Redfish Post Acquire List Lock 447 [Documentation] Acquire and release lock. 448 [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 449 450 # Description of argument(s): 451 # lock_type Read lock or Write lock. 452 # status_code HTTP status code. 453 454 ${lock_dict_param}= Create Data To Acquire List Of Lock ${lock_type} 455 ${resp}= Redfish Post Request 456 ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 457 Should Be Equal As Strings ${resp.status_code} ${status_code} 458 459 [Return] ${resp} 460 461 462Redfish Post Acquire Invalid Lock 463 [Documentation] Redfish to post request to acquire in-valid lock. 464 [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK} 465 466 # Description of argument(s): 467 # lock_type Read lock or Write lock. 468 # message Return message from URI. 469 # status_code HTTP status code. 470 471 ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type} 472 ${resp}= Redfish Post Request 473 ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 474 Should Be Equal As Strings ${resp.status_code} ${status_code} 475 Run Keyword If '${message}' != '${EMPTY}' 476 ... Valid Value message ['${resp.content}'] 477 478 [Return] ${resp} 479 480 481Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 482 [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id. 483 [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 484 485 # Description of argument(s): 486 # lock_type Read lock or Write lock. 487 # status_code HTTP status code. 488 489 ${lock_dict_param}= 490 ... Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type} 491 ${resp}= Redfish Post Request 492 ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 493 Should Be Equal As Strings ${resp.status_code} ${status_code} 494 495 [Return] ${resp} 496 497 498Form Data To Acquire Lock 499 [Documentation] Create a dictionary for lock request. 500 [Arguments] ${lock_type} 501 502 # Description of argument(s): 503 # lock_type Read lock or Write lock. 504 505 ${lock_res_info}= Get Lock Resource Information 506 ${resp}= RW General Dictionary 507 ... ${lock_res_info["Valid Case"]["${lock_type}"]} 508 ... ${lock_res_info["Valid Case"]["ResourceID"]} 509 ${temp_list}= Create List ${resp} 510 ${lock_request_dict}= Create Dictionary Request=${temp_list} 511 512 [Return] ${lock_request_dict} 513 514 515Create Data To Acquire List Of Lock 516 [Documentation] Create a dictionary for list of lock request. 517 [Arguments] ${lock_type_list} 518 519 # Description of argument(s): 520 # lock_type Read lock or Write lock. 521 522 ${temp_list}= Create List 523 ${lock_res_info}= Get Lock Resource Information 524 525 FOR ${lock_type} IN @{lock_type_list} 526 ${resp}= RW General Dictionary 527 ... ${lock_res_info["Valid Case"]["${lock_type}"]} 528 ... ${lock_res_info["Valid Case"]["ResourceID"]} 529 Append To List ${temp_list} ${resp} 530 END 531 532 ${lock_request_dict}= Create Dictionary Request=${temp_list} 533 534 [Return] ${lock_request_dict} 535 536 537Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID 538 [Documentation] Create a dictionary for in-valid lock request. 539 [Arguments] ${lock_type} 540 541 # Description of argument(s): 542 # lock_type Read lock or Write lock. 543 544 ${lock_res_info}= Get Lock Resource Information 545 ${resp}= RW General Dictionary 546 ... ${lock_res_info["Valid Case"]["${lock_type}"]} 547 ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]} 548 ${temp_list}= Create List ${resp} 549 ${lock_request_dict}= Create Dictionary Request=${temp_list} 550 551 [Return] ${lock_request_dict} 552 553 554Form Data To Acquire Invalid Lock 555 [Documentation] Create a dictionary for in-valid lock request. 556 [Arguments] ${lock_type} 557 558 # Description of argument(s): 559 # lock_type Read lock or Write lock. 560 561 ${lock_res_info}= Get Lock Resource Information 562 ${resp}= RW General Dictionary 563 ... ${lock_res_info["Invalid Case"]["${lock_type}"]} 564 ... ${lock_res_info["Valid Case"]["ResourceID"]} 565 ${temp_list}= Create List ${resp} 566 ${lock_request_dict}= Create Dictionary Request=${temp_list} 567 568 [Return] ${lock_request_dict} 569 570 571Get Locks List On Resource 572 [Documentation] Get locks list. 573 [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK} 574 575 # Description of argument(s): 576 # session_info Session information in dict. 577 # exp_status_code Expected HTTP status code. 578 579 ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]} 580 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 581 ... data=${data} 582 ${locks}= Evaluate json.loads('''${resp.text}''') json 583 584 [Return] ${locks["Records"]} 585 586 587Verify Lock On Resource 588 [Documentation] Verify lock on resource. 589 [Arguments] ${session_info} ${transaction_id} 590 591 # Description of argument(s): 592 # session_info Session information in dict. 593 # transaction_id Transaction id in list stored in dict. 594 595 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']} 596 Rprint Vars sessions 597 ${lock_list}= Get Locks List On Resource ${session_info} 598 ${lock_length}= Get Length ${lock_list} 599 ${tran_id_length}= Get Length ${transaction_id} 600 Should Be Equal As Integers ${tran_id_length} ${lock_length} 601 602 FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list} 603 Valid Value session_info['ClientID'] ['${lock['HMCID']}'] 604 Valid Value session_info['SessionIDs'] ['${lock['SessionID']}'] 605 Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']} 606 END 607 608 609Acquire Lock On Resource 610 [Documentation] Acquire lock on resource. 611 [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False 612 613 # Description of argument(s): 614 # client_id This client id can contain string value 615 # (e.g. 12345, "HMCID"). 616 # lock_type Read lock or Write lock. 617 # reboot_flag Flag is used to run reboot the BMC code. 618 # (e.g. True or False). 619 620 ${trans_id_emptylist}= Create List 621 ${trans_id_list}= Create List 622 623 ${session_info}= Create Redfish Session With ClientID ${client_id} 624 ${trans_id}= Redfish Post Acquire Lock ${lock_type} 625 Append To List ${trans_id_list} ${trans_id} 626 627 Verify Lock On Resource ${session_info} ${trans_id_list} 628 629 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 630 631 Run Keyword If '${reboot_flag}' == 'True' 632 ... Run Keywords Redfish BMC Reset Operation AND 633 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND 634 ... Is BMC Standby AND 635 ... Verify Lock On Resource ${session_info} ${trans_id_emptylist} 636 637 Run Keyword If '${reboot_flag}' == 'False' 638 ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 639 640 ${trans_id_emptylist}= Create List 641 Verify Lock On Resource ${session_info} ${trans_id_emptylist} 642 Redfish Delete Session ${session_info} 643 644 645Form Data To Release Lock 646 [Documentation] Create a dictonay to release lock. 647 [Arguments] ${trans_id_list} 648 649 # Description of argument(s): 650 # trans_id_list 651 652 @{tran_ids}= Create List 653 654 FOR ${item} IN @{trans_id_list} 655 Append To List ${tran_ids} ${item['TransactionID']} 656 END 657 658 [Return] ${tran_ids} 659 660 661Release Locks On Resource 662 [Documentation] Redfish request to release a lock. 663 [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction 664 ... ${status_code}=${HTTP_OK} 665 666 # Description of argument(s): 667 # session_info Session information in dict. 668 # trans_id_list Transaction id list. 669 # release_lock_type Release lock by Transaction, Session. 670 # status_code HTTP status code. 671 672 ${tran_ids}= Form Data To Release Lock ${trans_id_list} 673 ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}} 674 ${data}= Evaluate json.dumps(${data}) json 675 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data} 676 Should Be Equal As Strings ${resp.status_code} ${status_code} 677 678 679Release locks And Delete Session 680 [Documentation] Release locks and delete redfish session. 681 [Arguments] ${session_info} ${trans_id_list} 682 683 Release Locks On Resource ${session_info} ${trans_id_list} 684 685 ${trans_id_emptylist}= Create List 686 Verify Lock On Resource ${session_info} ${trans_id_emptylist} 687 688 Redfish Delete Session ${session_info} 689 690 691Acquire Lock On Another Lock 692 [Documentation] Acquire lock on another lock. 693 [Arguments] ${client_id} 694 695 # Description of argument(s): 696 # client_id This client id can contain string value 697 # (e.g. 12345, "HMCID"). 698 699 ${trans_id_list}= Create List 700 ${session_info}= Create Redfish Session With ClientID ${client_id} 701 702 ${trans_id}= Redfish Post Acquire Lock ReadCase1 703 Append To List ${trans_id_list} ${trans_id} 704 705 ${trans_id}= Redfish Post Acquire Lock ReadCase1 706 Append To List ${trans_id_list} ${trans_id} 707 708 Verify Lock On Resource ${session_info} ${trans_id_list} 709 710 Release locks And Delete Session ${session_info} ${trans_id_list} 711 712 713Verify Fail To Acquire Read And Write In Single Request 714 [Documentation] Verify fail to acquire read and write lock passed in single request. 715 [Arguments] ${client_id} ${lock_type} 716 717 # Description of argument(s): 718 # client_id This client id can contain string value 719 # (e.g. 12345, "HMCID"). 720 # lock_type Read lock or Write lock. 721 722 ${lock_type_list}= Split String ${lock_type} , 723 724 ${session_info}= Create Redfish Session With ClientID ${client_id} 725 ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list} status_code=${HTTP_BAD_REQUEST} 726 Redfish Delete Session ${session_info} 727 728 729Verify Empty Lock Records For Invalid Session 730 [Documentation] Verify no lock record found for invalid session. 731 [Arguments] ${client_id} 732 733 # Description of argument(s): 734 # client_id This client id can contain string value 735 # (e.g. 12345, "HMCID"). 736 737 ${session_info1}= Create Redfish Session With ClientID ${client_id} 738 739 ${lock_list1}= Get Locks List On Resource ${session_info1} 740 ${lock_length1}= Get Length ${lock_list1} 741 742 ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 743 set to dictionary ${session_info2} SessionIDs xxyXyyYZZz 744 745 ${lock_list2}= Get Locks List On Resource ${session_info2} 746 ${lock_length2}= Get Length ${lock_list2} 747 748 Should Be Equal As Integers ${lock_length1} ${lock_length2} 749 750 Redfish Delete Session ${session_info1} 751 752 753Verify Acquire Lock Fails On Another Lock 754 [Documentation] Verify acquire lock on another lock fails. 755 [Arguments] ${client_id} ${lock_type} 756 757 # Description of argument(s): 758 # client_id This client id can contain string value 759 # (e.g. 12345, "HMCID"). 760 # lock_type Read lock or Write lock. 761 762 @{lock_type_list}= Split String ${lock_type} , 763 ${session_info}= Create Redfish Session With ClientID ${client_id} 764 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 765 766 ${trans_id_list}= Create List 767 Append To List ${trans_id_list} ${trans_id} 768 769 Verify Lock On Resource ${session_info} ${trans_id_list} 770 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 771 772 Release locks And Delete Session ${session_info} ${trans_id_list} 773 774 775Verify Acquire Lock After Reboot 776 [Documentation] Acquire read and write lock after the reboot and release lock. 777 [Arguments] ${client_id} ${lock_type} 778 779 # Description of argument(s): 780 # client_id This client id can contain string value 781 # (e.g. 12345, "HMCID"). 782 # lock_type Read lock or Write lock. 783 784 ${trans_id_list}= Create List 785 ${session_info}= Create Session With ClientID ${client_id} 786 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 787 Redfish OBMC Reboot (off) 788 Redfish Login 789 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} 790 791 ${trans_id}= Redfish Post Acquire Lock ${lock_type} 792 Append To List ${trans_id_list} ${trans_id} 793 Verify Lock On Resource ${session_info} ${trans_id_list} 794 795 Release locks And Delete Session ${session_info} ${trans_id_list} 796 797 798Verify Acquire Multiple Lock Request At CEC Level 799 [Documentation] Acquire lock in loop. 800 [Arguments] ${client_id} ${lock_type} 801 802 # Description of argument(s): 803 # client_id This client id can contain string value 804 # (e.g. 12345, "HMCID"). 805 # lock_type Read lock or Write lock. 806 807 ${trans_id_list}= Create List 808 @{lock_type_list}= Split String ${lock_type} , 809 ${session_info}= Create Redfish Session With ClientID ${client_id} 810 811 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 812 Append To List ${trans_id_list} ${trans_id} 813 814 Verify Lock On Resource ${session_info} ${trans_id_list} 815 816 Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 817 818 Release locks And Delete Session ${session_info} ${trans_id_list} 819 820 821Verify Acquire And Release Lock In Loop 822 [Documentation] Acquire lock in loop. 823 [Arguments] ${client_id} ${lock_type} 824 825 # Description of argument(s): 826 # client_id This client id can contain string value 827 # (e.g. 12345, "HMCID"). 828 # lock_type Read lock or Write lock. 829 830 FOR ${count} IN RANGE 1 11 831 ${trans_id_list}= Create List 832 ${session_info}= Create Redfish Session With ClientID ${client_id} 833 ${trans_id}= Redfish Post Acquire Lock ${lock_type} 834 Append To List ${trans_id_list} ${trans_id} 835 Verify Lock On Resource ${session_info} ${trans_id_list} 836 Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 837 ${trans_id_emptylist}= Create List 838 Verify Lock On Resource ${session_info} ${trans_id_emptylist} 839 END 840 841 Redfish Delete Session ${session_info} 842 843 844Acquire And Release Multiple Locks 845 [Documentation] Acquire mutilple locks on resource. 846 [Arguments] ${client_id} ${lock_type} ${release_lock_type} 847 848 # Description of argument(s): 849 # client_id This client id can contain string value 850 # (e.g. 12345, "HMCID"). 851 # lock_type Read lock or Write lock. 852 # release_lock_type The value can be Transaction or Session. 853 854 @{lock_type_list}= Split String ${lock_type} , 855 ${session_info}= Create Redfish Session With ClientID ${client_id} 856 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 857 858 ${trans_id_list}= Create List 859 860 Append To List ${trans_id_list} ${trans_id} 861 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 862 863 Append To List ${trans_id_list} ${trans_id} 864 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 865 866 Append To List ${trans_id_list} ${trans_id} 867 Verify Lock On Resource ${session_info} ${trans_id_list} 868 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 869 870 ${trans_id_emptylist}= Create List 871 Verify Lock On Resource ${session_info} ${trans_id_emptylist} 872 Redfish Delete Session ${session_info} 873 874 875Verify Release Lock When Session Deleted 876 [Documentation] Verify lock get released when session are deleted. 877 [Arguments] ${client_id} ${lock_type} 878 879 # Description of argument(s): 880 # client_ids This client id can contain string value 881 # (e.g. 12345, "HMCID"). 882 # lock_type Read lock or Write lock. 883 884 ${trans_id_list}= Create List 885 @{lock_type_list}= Split String ${lock_type} , 886 887 ${pre_session_info}= Create Redfish Session With ClientID ${client_id} 888 889 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 890 Append To List ${trans_id_list} ${trans_id} 891 Verify Lock On Resource ${pre_session_info} ${trans_id_list} 892 893 Redfish Delete Session ${pre_session_info} 894 ${post_session_info}= Create Redfish Session With ClientID ${client_id} 895 ${resp}= Get Locks List On Resource With Session List ${pre_session_info} ${HTTP_BAD_REQUEST} 896 897 Redfish Delete Session ${post_session_info} 898 899 900 901Verify Fail To Release Lock With Invalid TransactionID 902 [Documentation] Verify fail to be release lock with invalid transaction ID. 903 [Arguments] ${client_id} ${lock_type} ${release_lock_type} 904 905 # Description of argument(s): 906 # client_id This client id can contain string value 907 # (e.g. 12345, "HMCID"). 908 # lock_type Read lock or Write lock. 909 # release_lock_type The value can be Transaction or Session. 910 911 ${trans_id_list}= Create List 912 @{lock_type_list}= Split String ${lock_type} , 913 914 ${session_info}= Create Redfish Session With ClientID ${client_id} 915 916 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 917 ${value}= Get From Dictionary ${trans_id} TransactionID 918 ${value}= Evaluate ${value} + 10 919 Set To Dictionary ${trans_id} TransactionID ${value} 920 Append To List ${trans_id_list} ${trans_id} 921 922 Release Locks On Resource 923 ... ${session_info} ${trans_id_list} 924 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 925 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 926 927 ${trans_id_emptylist}= Create List 928 Verify Lock On Resource ${session_info} ${trans_id_emptylist} 929 Redfish Delete Session ${session_info} 930 931 932Verify Fail To Release Multiple Lock With Invalid TransactionID 933 [Documentation] Verify release multiple locks with invalid transaction ID fails. 934 [Arguments] ${client_id} ${lock_type} ${release_lock_type} 935 936 # Description of argument(s): 937 # client_id This client id can contain string value 938 # (e.g. 12345, "HMCID"). 939 # lock_type Read lock or Write lock. 940 # release_lock_type The value can be Transaction or Session. 941 942 ${trans_id_list}= Create List 943 @{lock_type_list}= Split String ${lock_type} , 944 945 ${session_info}= Create Redfish Session With ClientID ${client_id} 946 947 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 948 ${value}= Get From Dictionary ${trans_id} TransactionID 949 ${value}= Evaluate ${value} + 10 950 Set To Dictionary ${trans_id} TransactionID ${value} 951 Append To List ${trans_id_list} ${trans_id} 952 953 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 954 ${value}= Get From Dictionary ${trans_id} TransactionID 955 ${value}= Evaluate ${value} + 10 956 Set To Dictionary ${trans_id} TransactionID ${value} 957 Append To List ${trans_id_list} ${trans_id} 958 959 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 960 ${value}= Get From Dictionary ${trans_id} TransactionID 961 ${value}= Evaluate ${value} + 10 962 Set To Dictionary ${trans_id} TransactionID ${value} 963 Append To List ${trans_id_list} ${trans_id} 964 965 Release Locks On Resource 966 ... ${session_info} ${trans_id_list} 967 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 968 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 969 970 ${trans_id_emptylist}= Create List 971 Verify Lock On Resource ${session_info} ${trans_id_emptylist} 972 Redfish Delete Session ${session_info} 973 974 975Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID 976 [Documentation] Verify fail to be release multiple lock with valid and invalid transaction ID. 977 [Arguments] ${client_id} ${lock_type} ${release_lock_type} 978 979 # Description of argument(s): 980 # client_id This client id can contain string value 981 # (e.g. 12345, "HMCID"). 982 # lock_type Read lock or Write lock. 983 # release_lock_type The value can be Transaction or Session. 984 985 ${trans_id_list}= Create List 986 @{lock_type_list}= Split String ${lock_type} , 987 988 ${session_info}= Create Redfish Session With ClientID ${client_id} 989 990 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 991 Append To List ${trans_id_list} ${trans_id} 992 993 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 994 ${value}= Get From Dictionary ${trans_id} TransactionID 995 ${value}= Evaluate ${value} + 10 996 Set To Dictionary ${trans_id} TransactionID ${value} 997 Append To List ${trans_id_list} ${trans_id} 998 999 Release Locks On Resource 1000 ... ${session_info} ${trans_id_list} 1001 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 1002 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 1003 1004 ${trans_id_emptylist}= Create List 1005 Verify Lock On Resource ${session_info} ${trans_id_emptylist} 1006 Redfish Delete Session ${session_info} 1007 1008 1009Verify Fail To Release Lock With TransactionID As String Type 1010 [Documentation] Verify fail to be release lock with transaction ID as string data type. 1011 [Arguments] ${client_id} ${lock_type} ${release_lock_type} 1012 1013 # Description of argument(s): 1014 # client_id This client id can contain string value 1015 # (e.g. 12345, "HMCID"). 1016 # lock_type Read lock or Write lock. 1017 # release_lock_type The value can be Transaction or Session. 1018 1019 ${trans_id_list}= Create List 1020 @{lock_type_list}= Split String ${lock_type} , 1021 1022 ${session_info}= Create Redfish Session With ClientID ${client_id} 1023 1024 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1025 1026 Append To List ${trans_id_list} ${trans_id} 1027 1028 ${temp_trans_id_list}= Copy Dictionary ${trans_id_list} deepcopy=True 1029 1030 ${value}= Get From Dictionary ${trans_id_list}[0] TransactionID 1031 ${value}= Set Variable \'${value}\' 1032 Set To Dictionary ${temp_trans_id_list}[0] TransactionID ${value} 1033 1034 Release Locks On Resource 1035 ... ${session_info} ${temp_trans_id_list} 1036 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 1037 1038 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 1039 1040 ${trans_id_emptylist}= Create List 1041 Verify Lock On Resource ${session_info} ${trans_id_emptylist} 1042 Redfish Delete Session ${session_info} 1043 1044 1045Verify Fail To Release Lock For Another Session 1046 [Documentation] Verify failed to release the lock form another session. 1047 [Arguments] ${client_id} ${lock_type} 1048 1049 # Description of argument(s): 1050 # client_id This client id can contain string value 1051 # (e.g. 12345, "HMCID"). 1052 # lock_type Read lock or Write lock. 1053 1054 ${client_ids}= Split String ${client_id} , 1055 ${lock_type_list}= Split String ${lock_type} , 1056 ${trans_id_list1}= Create List 1057 ${trans_id_list2}= Create List 1058 1059 ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0] 1060 1061 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1062 Append To List ${trans_id_list1} ${trans_id} 1063 Verify Lock On Resource ${session_info1} ${trans_id_list1} 1064 1065 ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1] 1066 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 1067 Append To List ${trans_id_list2} ${trans_id} 1068 Verify Lock On Resource ${session_info2} ${trans_id_list2} 1069 1070 Release Locks On Resource 1071 ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_UNAUTHORIZED} 1072 Verify Lock On Resource ${session_info1} ${trans_id_list1} 1073 Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session 1074 Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session 1075 Redfish Delete Session ${session_info1} 1076 Redfish Delete Session ${session_info2} 1077 1078 1079Verify Fail To Acquire Lock For Invalid Resource ID Data Type 1080 [Documentation] Verify fail to acquire the lock with invalid resource id data type. 1081 [Arguments] ${client_id} ${lock_type} 1082 1083 # Description of argument(s): 1084 # client_id This client id can contain string value 1085 # (e.g. 12345, "HMCID"). 1086 # lock_type Read lock or Write lock. 1087 1088 ${session_info}= Create Redfish Session With ClientID ${client_id} 1089 Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 1090 ... ${lock_type} status_code=${HTTP_BAD_REQUEST} 1091 Redfish Delete Session ${session_info} 1092 1093 1094Verify Fail To Acquire Lock For Invalid Lock Data 1095 [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segment flags. 1096 [Arguments] ${client_id} ${lock_type} ${message} 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 # message Return message from URI. 1103 1104 ${session_info}= Create Redfish Session With ClientID ${client_id} 1105 ${trans_id}= Redfish Post Acquire Invalid Lock 1106 ... ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST} 1107 Redfish Delete Session ${session_info} 1108 1109 1110Verify No Locks Records For Session With No Acquired Lock 1111 [Documentation] Verify no records found for a session where no lock is acquired. 1112 [Arguments] ${client_id} 1113 1114 # Description of argument(s): 1115 # client_id This client id can contain string value 1116 # (e.g. 12345, "HMCID"). 1117 1118 ${session_info}= Create Redfish Session With ClientID ${client_id} 1119 ${trans_id_emptylist}= Create List 1120 Verify Lock On Resource ${session_info} ${trans_id_emptylist} 1121 Redfish Delete Session ${session_info} 1122 1123 1124Create List Of Session ID 1125 [Documentation] Create session id list from session dict info. 1126 [Arguments] ${session_dict_info} 1127 1128 # Description of argument(s): 1129 # session_dict_info Session information in dict. 1130 1131 @{session_id_list}= Create List 1132 1133 FOR ${session} IN @{session_dict_info} 1134 Append To List ${session_id_list} ${session["SessionIDs"]} 1135 END 1136 1137 ${num_id}= Get Length ${session_id_list} 1138 Should Not Be Equal As Integers ${num_id} ${0} 1139 1140 ${session_id_list}= Evaluate json.dumps(${session_id_list}) json 1141 1142 [Return] ${session_id_list} 1143 1144 1145Get Locks List On Resource With Session List 1146 [Documentation] Get locks list from session of list. 1147 [Arguments] ${session_id_list} ${exp_status_code}=${HTTP_OK} 1148 1149 # Description of argument(s): 1150 # session_id_list Session ids list. 1151 # exp_status_code Expected HTTP status code. 1152 1153 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 1154 ... data={"SessionIDs": ${session_id_list}} 1155 Should Be Equal As Strings ${resp.status_code} ${exp_status_code} 1156 ${locks}= Evaluate json.loads('''${resp.text}''') json 1157 1158 [Return] ${locks} 1159 1160 1161Verify List Of Session Lock On Resource 1162 [Documentation] Verify list of lock record from list of sessions. 1163 [Arguments] ${session_dict_info} ${transaction_id_list} 1164 1165 # Description of argument(s): 1166 # session_dict_info Session information in dict. 1167 # transaction_id_list Transaction id in list stored in dict. 1168 1169 ${session_id_list}= Create List Of Session ID ${session_dict_info} 1170 ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 1171 ${lock_list}= Set Variable ${lock_list_resp['Records']} 1172 1173 FOR ${session_id} ${tran_id} ${lock_record} IN ZIP 1174 ... ${session_dict_info} ${transaction_id_list} ${lock_list} 1175 Valid Value session_id['SessionIDs'] ['${lock_record['SessionID']}'] 1176 Should Be Equal As Integers ${tran_id['TransactionID']} ${lock_record['TransactionID']} 1177 END 1178 1179 1180Verify Lock Records Of Multiple Session 1181 [Documentation] Verify all records found for a multiple sessions. 1182 [Arguments] ${client_ids} ${lock_type} 1183 1184 # Description of argument(s): 1185 # client_ids This client id can contain string value 1186 # (e.g. 12345, "HMCID"). 1187 # lock_type Read lock or Write lock. 1188 1189 ${client_id_list}= Split String ${client_ids} , 1190 ${lock_type_list}= Split String ${lock_type} , 1191 ${trans_id_list1}= Create List 1192 ${trans_id_list2}= Create List 1193 1194 ${session_dict_list}= Create List 1195 ${lock_list}= Create List 1196 1197 ${client_id1}= Create List 1198 Append To List ${client_id1} ${client_id_list}[0] 1199 ${session_info1}= Create Session With List Of ClientID ${client_id1} 1200 Append To List ${session_dict_list} ${session_info1}[0] 1201 Verify A Session Created With ClientID ${client_id1} ${session_info1} 1202 1203 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1204 Append To List ${trans_id_list1} ${trans_id} 1205 Append To List ${lock_list} ${trans_id} 1206 Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 1207 1208 1209 ${client_id2}= Create List 1210 Append To List ${client_id2} ${client_id_list}[1] 1211 ${session_info2}= Create Session With List Of ClientID ${client_id2} 1212 Append To List ${session_dict_list} ${session_info2}[0] 1213 Verify A Session Created With ClientID ${client_id2} ${session_info2} 1214 1215 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 1216 Append To List ${trans_id_list2} ${trans_id} 1217 Append To List ${lock_list} ${trans_id} 1218 Verify Lock On Resource ${session_info2}[0] ${trans_id_list2} 1219 1220 Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 1221 1222 ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 1223 Set Global Variable ${XAUTH_TOKEN} ${session_token} 1224 1225 Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 1226 1227 ${session_token}= Get From Dictionary ${session_info2}[0] SessionToken 1228 Set Global Variable ${XAUTH_TOKEN} ${session_token} 1229 1230 Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Transaction 1231 1232 ${trans_id_emptylist}= Create List 1233 Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 1234 Verify Lock On Resource ${session_info2}[0] ${trans_id_emptylist} 1235 1236 Redfish Delete List Of Session ${session_dict_list} 1237 1238 1239Verify Lock Records For Multiple Invalid Session 1240 [Documentation] Verify no lock record found for multiple invalid session. 1241 [Arguments] ${client_id} 1242 1243 # Description of argument(s): 1244 # client_id This client id can contain string value 1245 # (e.g. 12345, "HMCID"). 1246 1247 ${session_dict_list}= Create List 1248 ${invalid_session_ids}= Create List xxyXyyYZZz xXyXYyYZzz 1249 1250 ${session_info1}= Create Session With ClientID ${client_id} 1251 1252 ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 1253 set to dictionary ${session_info2} SessionIDs ${invalid_session_ids}[0] 1254 Append To List ${session_dict_list} ${session_info2} 1255 1256 ${session_info3}= Copy Dictionary ${session_info1} deepcopy=True 1257 set to dictionary ${session_info3} SessionIDs ${invalid_session_ids}[0] 1258 Append To List ${session_dict_list} ${session_info3} 1259 1260 ${lock_list1}= Get Locks List On Resource ${session_info1} 1261 ${lock_length1}= Get Length ${lock_list1} 1262 1263 ${session_id_list}= Create List Of Session ID ${session_dict_list} 1264 ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 1265 ${lock_length2}= Get Length ${lock_list_resp['Records']} 1266 1267 Should Be Equal As Integers ${lock_length1} ${lock_length2} 1268 1269 Redfish Delete Session ${session_info1} 1270 1271 1272Verify Lock Records For Multiple Invalid And Valid Session 1273 [Documentation] Verify all records found for a valid and invalid 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 ${invalid_session_ids}= Create List xxyXyyYZZz 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 ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 1301 set to dictionary ${session_info2}[0] SessionIDs ${invalid_session_ids}[0] 1302 Append To List ${session_dict_list} ${session_info2}[0] 1303 1304 Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 1305 1306 ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 1307 Set Global Variable ${XAUTH_TOKEN} ${session_token} 1308 1309 Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 1310 1311 ${trans_id_emptylist}= Create List 1312 Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 1313 1314 Redfish Delete Session ${session_info1}[0] 1315