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