1bc331e22SVijay*** Settings *** 2bc331e22SVijay 3d03f2ce1SSushil SinghDocumentation Test lock management feature of management console on BMC. 4bc331e22SVijay 5bc331e22SVijayResource ../../lib/resource.robot 6bc331e22SVijayResource ../../lib/openbmc_ffdc.robot 7566daaf3SGeorge KeishingResource ../../lib/bmc_redfish_utils.robot 8d03f2ce1SSushil SinghResource ../../lib/external_intf/management_console_utils.robot 9977f8f58SSushil SinghResource ../../lib/rest_response_code.robot 10728ef9c9SSushil SinghLibrary ../../lib/bmc_network_utils.py 11bc331e22SVijay 1240ef0eb7SSushil SinghSuite Setup Run Keyword And Ignore Error Delete All Redfish Sessions 13df390b61SSushil SinghSuite Teardown Run Keyword And Ignore Error Delete All Redfish Sessions 14d03f2ce1SSushil SinghTest Setup Printn 15d03f2ce1SSushil SinghTest Teardown FFDC On Test Case Fail 16bc331e22SVijay 17bc331e22SVijay*** Variables *** 18bc331e22SVijay 19d03f2ce1SSushil Singh${BAD_REQUEST} Bad Request 20bc331e22SVijay 21bc331e22SVijay*** Test Cases *** 22bc331e22SVijay 23d03f2ce1SSushil SinghAcquire Read Write Lock 24bc331e22SVijay [Documentation] Acquire and release different read locks. 25d03f2ce1SSushil Singh [Tags] Acquire_Read_Write_Lock 26d03f2ce1SSushil Singh [Template] Acquire Lock On Resource 27bc331e22SVijay 28d03f2ce1SSushil Singh # client_id lock_type reboot_flag 29d03f2ce1SSushil Singh HMCID-01 ReadCase1 False 30d03f2ce1SSushil Singh HMCID-01 ReadCase2 False 31d03f2ce1SSushil Singh HMCID-01 ReadCase3 False 32d03f2ce1SSushil Singh HMCID-01 WriteCase1 False 33d03f2ce1SSushil Singh HMCID-01 WriteCase2 False 34d03f2ce1SSushil Singh HMCID-01 WriteCase3 False 35bc331e22SVijay 36bc331e22SVijay 37d03f2ce1SSushil SinghCheck Lock Persistency On BMC Reboot 38d03f2ce1SSushil Singh [Documentation] Acquire lock and check after reboot it remain same. 39d03f2ce1SSushil Singh [Tags] Check_Lock_Persistency_On_BMC_Reboot 40d03f2ce1SSushil Singh [Template] Acquire Lock On Resource 41bc331e22SVijay 42d03f2ce1SSushil Singh # client_id lock_type reboot_flag 43d03f2ce1SSushil Singh HMCID-01 ReadCase1 True 44d03f2ce1SSushil Singh HMCID-01 ReadCase2 True 45d03f2ce1SSushil Singh HMCID-01 ReadCase3 True 46d03f2ce1SSushil Singh HMCID-01 WriteCase1 True 47d03f2ce1SSushil Singh HMCID-01 WriteCase2 True 48d03f2ce1SSushil Singh HMCID-01 WriteCase3 True 49bc331e22SVijay 50bc331e22SVijay 51d03f2ce1SSushil SinghAcquire Read Lock On Read Lock 52d03f2ce1SSushil Singh [Documentation] Acquire read lock on another read lock. 53d03f2ce1SSushil Singh [Tags] Acquire_Read_Lock_On_Read_Lock 54d03f2ce1SSushil Singh [Template] Acquire Lock On Another Lock 55bc331e22SVijay 56d03f2ce1SSushil Singh # client_id 57d03f2ce1SSushil Singh HMCID-01 58bc331e22SVijay 59bc331e22SVijay 60d03f2ce1SSushil SinghFail To Acquire Lock On Another Lock 61d03f2ce1SSushil Singh [Documentation] Fail to acquire another lock. 62d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_On_Another_Lock 63d03f2ce1SSushil Singh [Template] Verify Acquire Lock Fails On Another Lock 6485610eeeSVijay 65d03f2ce1SSushil Singh # client_id lock_type 66d03f2ce1SSushil Singh HMCID-01 ReadCase2,WriteCase2 67d03f2ce1SSushil Singh HMCID-01 WriteCase2,WriteCase2 68d03f2ce1SSushil Singh HMCID-01 WriteCase2,ReadCase2 69566daaf3SGeorge Keishing 70566daaf3SGeorge Keishing 71e33c6e6aSSushil SinghAcquire Lock After Reboot 72e33c6e6aSSushil Singh [Documentation] Acquire and release read and write locks after reboot. 73e33c6e6aSSushil Singh [Tags] Acquire_Lock_After_Reboot 74e33c6e6aSSushil Singh [Template] Verify Acquire Lock After Reboot 75e33c6e6aSSushil Singh 76e33c6e6aSSushil Singh # client_id lock_type 77e33c6e6aSSushil Singh HMCID-01 ReadCase1 78e33c6e6aSSushil Singh HMCID-01 ReadCase2 79e33c6e6aSSushil Singh HMCID-01 ReadCase3 80e33c6e6aSSushil Singh HMCID-01 WriteCase1 81e33c6e6aSSushil Singh HMCID-01 WriteCase2 82e33c6e6aSSushil Singh HMCID-01 WriteCase3 83e33c6e6aSSushil Singh 84e33c6e6aSSushil Singh 85d03f2ce1SSushil SinghAcquire And Release Lock In Loop 86d03f2ce1SSushil Singh [Documentation] Acquire and release read, write locks in loop. 87d03f2ce1SSushil Singh [Tags] Acquire_And_Release_Lock_In_Loop 88d03f2ce1SSushil Singh [Template] Verify Acquire And Release Lock In Loop 89566daaf3SGeorge Keishing 90d03f2ce1SSushil Singh # client_id lock_type 91d03f2ce1SSushil Singh HMCID-01 ReadCase1 92d03f2ce1SSushil Singh HMCID-01 ReadCase2 93d03f2ce1SSushil Singh HMCID-01 ReadCase3 94d03f2ce1SSushil Singh HMCID-01 WriteCase1 95d03f2ce1SSushil Singh HMCID-01 WriteCase2 96d03f2ce1SSushil Singh HMCID-01 WriteCase3 9785610eeeSVijay 9885610eeeSVijay 99977f8f58SSushil SinghFail To Acquire Read And Write In Single Request 100977f8f58SSushil Singh [Documentation] Fail to acquire read and write lock in single request. 101977f8f58SSushil Singh [Tags] Fail_To_Acquire_Read_And_Write_In_Single_Request 102977f8f58SSushil Singh [Template] Verify Fail To Acquire Read And Write In Single Request 103977f8f58SSushil Singh 104977f8f58SSushil Singh # client_id lock_type 105977f8f58SSushil Singh HMCID-01 ReadCase1,WriteCase1 106977f8f58SSushil Singh HMCID-01 WriteCase1,ReadCase1 107977f8f58SSushil Singh 108977f8f58SSushil Singh 109df390b61SSushil SinghAcquire Multiple Lock Request At CEC Level 110df390b61SSushil Singh [Documentation] Acquire write lock on read lock under CEC level. 111df390b61SSushil Singh [Tags] Acquire_Multiple_Lock_Request_At_CEC_Level 112df390b61SSushil Singh [Template] Verify Acquire Multiple Lock Request At CEC Level 113df390b61SSushil Singh 114df390b61SSushil Singh # client_id lock_type 115df390b61SSushil Singh HMCID-01 ReadCase4,WriteCase4 116df390b61SSushil Singh HMCID-01 WriteCase5,ReadCase5 117df390b61SSushil Singh HMCID-01 ReadCase6,WriteCase6 118df390b61SSushil Singh HMCID-01 WriteCase7,ReadCase7 119df390b61SSushil Singh 120df390b61SSushil Singh 121d03f2ce1SSushil SinghVerify Release Of Valid Locks 122d03f2ce1SSushil Singh [Documentation] Release all valid locks. 123d03f2ce1SSushil Singh [Tags] Verify_Release_Of_Valid_Locks 124d03f2ce1SSushil Singh [Template] Acquire And Release Multiple Locks 125afdd2a1dSVijay 126d03f2ce1SSushil Singh # client_id lock_type release_lock_type 127d03f2ce1SSushil Singh HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 128d03f2ce1SSushil Singh HMCID-02 ReadCase1,ReadCase1,ReadCase1 Session 129afdd2a1dSVijay 130afdd2a1dSVijay 131*94116c61Ssusilsi7Release Lock When Session Deleted 132*94116c61Ssusilsi7 [Documentation] Release lock when session gets deleted. 133*94116c61Ssusilsi7 [Tags] Release_Lock_When_Session_Deleted 134*94116c61Ssusilsi7 [Template] Verify Release Lock When Session Deleted 135*94116c61Ssusilsi7 136*94116c61Ssusilsi7 # client_id lock_type 137*94116c61Ssusilsi7 HMCID-01 ReadCase1 138*94116c61Ssusilsi7 HMCID-01 WriteCase1 139*94116c61Ssusilsi7 140*94116c61Ssusilsi7 14159011d08SSushil SinghFail To Release Lock With Invalid TransactionID 14259011d08SSushil Singh [Documentation] Fail to release lock with invalid transaction id. 14359011d08SSushil Singh [Tags] Fail_To_Release_Lock_With_Invalid_TransactionID 14459011d08SSushil Singh [Template] Verify Fail To Release Lock With Invalid TransactionID 14559011d08SSushil Singh 14659011d08SSushil Singh # client_id lock_type release_lock_type 14759011d08SSushil Singh HMCID-01 ReadCase1 Transaction 14843b0c063Ssusilsi7 HMCID-01 WriteCase1 Transaction 14959011d08SSushil Singh 15059011d08SSushil Singh 1511b59053dSSushil SinghFail To Release Multiple Lock With Invalid TransactionID 152d03f2ce1SSushil Singh [Documentation] Release in-valid lock result in fail. 1531b59053dSSushil Singh [Tags] Fail_To_Release_Multiple_Lock_With_Invalid_TransactionID 1541b59053dSSushil Singh [Template] Verify Fail To Release Multiple Lock With Invalid TransactionID 155afdd2a1dSVijay 156d03f2ce1SSushil Singh # client_id lock_type release_lock_type 157d03f2ce1SSushil Singh HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 158d03f2ce1SSushil Singh 12345 ReadCase2,ReadCase2,ReadCase2 Transaction 159d03f2ce1SSushil Singh HMCID ReadCase3,ReadCase3,ReadCase3 Transaction 160afdd2a1dSVijay 161afdd2a1dSVijay 1628bee358fSSushil SinghFail To Release Multiple Lock With Valid And Invalid TransactionID 1638bee358fSSushil Singh [Documentation] Release multiple lock with valid and invalid trasaction. 1648bee358fSSushil Singh [Tags] Fail_To_Release_Multiple_Lock_With_Valid_And_Invalid_TransactionID 1658bee358fSSushil Singh [Template] Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID 1668bee358fSSushil Singh 1678bee358fSSushil Singh # client_id lock_type release_lock_type 1688bee358fSSushil Singh HMCID-01 ReadCase1,ReadCase1 Transaction 1698bee358fSSushil Singh 1708bee358fSSushil Singh 1711d7b996cSsusilsi7Fail To Release Lock With String As TransactionID Data Type 1721d7b996cSsusilsi7 [Documentation] Fail to release lock with string as transaction id data type. 1731d7b996cSsusilsi7 [Tags] Fail_To_Release_Lock_With_String_As_TransactionID_Data_Type 1741d7b996cSsusilsi7 [Template] Verify Fail To Release Lock With TransactionID As String Type 1751d7b996cSsusilsi7 1761d7b996cSsusilsi7 # client_id lock_type release_lock_type 1771d7b996cSsusilsi7 HMCID-01 ReadCase1 Transaction 1781d7b996cSsusilsi7 HMCID-01 WriteCase1 Transaction 1791d7b996cSsusilsi7 1801d7b996cSsusilsi7 181d03f2ce1SSushil SinghFail To Release Lock For Another Session 182d03f2ce1SSushil Singh [Documentation] Failed to release locks from another session. 183d03f2ce1SSushil Singh [Tags] Fail_To_Release_Lock_For_Another_Session 184d03f2ce1SSushil Singh [Template] Verify Fail To Release Lock For Another Session 185afdd2a1dSVijay 186d03f2ce1SSushil Singh # client_id lock_type 187d03f2ce1SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 188afdd2a1dSVijay 189afdd2a1dSVijay 190e33c6e6aSSushil SinghTest Invalid Resource ID Data Type Locking 191e33c6e6aSSushil Singh [Documentation] Failed to acquire lock for invalid resource id data type. 192e33c6e6aSSushil Singh [Tags] Test_Invalid_Resource_ID_Data_Type_Locking 193e33c6e6aSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type 194e33c6e6aSSushil Singh 195e33c6e6aSSushil Singh # client_id lock_type 196e33c6e6aSSushil Singh HMCID-01 ReadCase1 197e33c6e6aSSushil Singh HMCID-01 ReadCase2 198e33c6e6aSSushil Singh HMCID-01 ReadCase3 199e33c6e6aSSushil Singh HMCID-01 WriteCase1 200e33c6e6aSSushil Singh HMCID-01 WriteCase2 201e33c6e6aSSushil Singh HMCID-01 WriteCase3 202e33c6e6aSSushil Singh 203e33c6e6aSSushil Singh 204d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Type 205d03f2ce1SSushil Singh [Documentation] Failed to acquire read, write lock for invalid lock data passed. 206d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type 207d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 208afdd2a1dSVijay 209d03f2ce1SSushil Singh # client_id lock_type message 210d03f2ce1SSushil Singh HMCID-01 ReadCase1 ${BAD_REQUEST} 211d03f2ce1SSushil Singh HMCID-01 ReadCase2 ${BAD_REQUEST} 212d03f2ce1SSushil Singh HMCID-01 ReadCase3 ${BAD_REQUEST} 213d03f2ce1SSushil Singh HMCID-01 ReadCase4 ${BAD_REQUEST} 214d03f2ce1SSushil Singh HMCID-01 ReadCase5 ${BAD_REQUEST} 215d03f2ce1SSushil Singh HMCID-01 WriteCase1 ${BAD_REQUEST} 216d03f2ce1SSushil Singh HMCID-01 WriteCase2 ${BAD_REQUEST} 217d03f2ce1SSushil Singh HMCID-01 WriteCase3 ${BAD_REQUEST} 218d03f2ce1SSushil Singh HMCID-01 WriteCase4 ${BAD_REQUEST} 219d03f2ce1SSushil Singh HMCID-01 WriteCase5 ${BAD_REQUEST} 220afdd2a1dSVijay 221afdd2a1dSVijay 222d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Flag 223d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid lock flag passed. 224d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag 225d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 226afdd2a1dSVijay 227d03f2ce1SSushil Singh # client_id lock_type message 228d03f2ce1SSushil Singh HMCID-01 ReadCase6 ${BAD_REQUEST} 229d03f2ce1SSushil Singh HMCID-01 ReadCase7 ${BAD_REQUEST} 230d03f2ce1SSushil Singh HMCID-01 ReadCase8 ${BAD_REQUEST} 231d03f2ce1SSushil Singh HMCID-01 ReadCase9 ${BAD_REQUEST} 232d03f2ce1SSushil Singh HMCID-01 ReadCase10 ${BAD_REQUEST} 233d03f2ce1SSushil Singh HMCID-01 ReadCase11 ${BAD_REQUEST} 234d03f2ce1SSushil Singh HMCID-01 WriteCase6 ${BAD_REQUEST} 235d03f2ce1SSushil Singh HMCID-01 WriteCase7 ${BAD_REQUEST} 236d03f2ce1SSushil Singh HMCID-01 WriteCase8 ${BAD_REQUEST} 237d03f2ce1SSushil Singh HMCID-01 WriteCase9 ${BAD_REQUEST} 238d03f2ce1SSushil Singh HMCID-01 WriteCase10 ${BAD_REQUEST} 239d03f2ce1SSushil Singh HMCID-01 WriteCase11 ${BAD_REQUEST} 240afdd2a1dSVijay 241afdd2a1dSVijay 242d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Segment Flag 243d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 244d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag 245d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 246d03f2ce1SSushil Singh 247d03f2ce1SSushil Singh # client_id lock_type message 248d03f2ce1SSushil Singh HMCID-01 ReadCase12 ${BAD_REQUEST} 249d03f2ce1SSushil Singh HMCID-01 ReadCase13 ${BAD_REQUEST} 250d03f2ce1SSushil Singh HMCID-01 ReadCase14 ${BAD_REQUEST} 251d03f2ce1SSushil Singh HMCID-01 WriteCase12 ${BAD_REQUEST} 252d03f2ce1SSushil Singh HMCID-01 WriteCase13 ${BAD_REQUEST} 253d03f2ce1SSushil Singh HMCID-01 WriteCase14 ${BAD_REQUEST} 254afdd2a1dSVijay 255bace3005SSushil Singh 2563b3a7ecaSSushil SinghFail To Acquire Lock For Invalid Segment Data Type Flag 2573b3a7ecaSSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 2583b3a7ecaSSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Data_Type_Flag 2593b3a7ecaSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 2603b3a7ecaSSushil Singh 2613b3a7ecaSSushil Singh # client_id lock_type message 2623b3a7ecaSSushil Singh HMCID-01 ReadCase15 ${EMPTY} 2633b3a7ecaSSushil Singh HMCID-01 ReadCase16 ${EMPTY} 2643b3a7ecaSSushil Singh HMCID-01 ReadCase17 ${EMPTY} 2653b3a7ecaSSushil Singh HMCID-01 ReadCase18 ${EMPTY} 2663b3a7ecaSSushil Singh HMCID-01 WriteCase15 ${EMPTY} 2673b3a7ecaSSushil Singh HMCID-01 WriteCase16 ${EMPTY} 2683b3a7ecaSSushil Singh HMCID-01 WriteCase17 ${EMPTY} 2693b3a7ecaSSushil Singh HMCID-01 WriteCase18 ${EMPTY} 2703b3a7ecaSSushil Singh 2713b3a7ecaSSushil Singh 272bace3005SSushil SinghGet Empty Lock Records For Session Where No Locks Acquired 273bace3005SSushil Singh [Documentation] If session does not acquire locks then get lock should return 274bace3005SSushil Singh ... empty lock records. 275bace3005SSushil Singh [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired 276bace3005SSushil Singh [Template] Verify No Locks Records For Session With No Acquired Lock 277bace3005SSushil Singh 278bace3005SSushil Singh # client_id 279bace3005SSushil Singh HMCID-01 280bace3005SSushil Singh 281728ef9c9SSushil Singh 282f9a536caSSushil SinghGet Lock Records Empty For Invalid Session 283f9a536caSSushil Singh [Documentation] Record of lock list is empty for invalid session. 284f9a536caSSushil Singh [Tags] Get_Lock_Records_Empty_For_Invalid_Session 285f9a536caSSushil Singh [Template] Verify Empty Lock Records For Invalid Session 286f9a536caSSushil Singh 287f9a536caSSushil Singh # client_id 288f9a536caSSushil Singh HMCID-01 289f9a536caSSushil Singh 290f9a536caSSushil Singh 291728ef9c9SSushil SinghGet Lock Records For Multiple Session 292728ef9c9SSushil Singh [Documentation] Get lock records of multiple session. 293728ef9c9SSushil Singh [Tags] Get_Lock_Records_For_Multiple_Session 294728ef9c9SSushil Singh [Template] Verify Lock Records Of Multiple Session 295728ef9c9SSushil Singh 296728ef9c9SSushil Singh # client_ids lock_type 297728ef9c9SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 298728ef9c9SSushil Singh 299728ef9c9SSushil Singh 300f9a536caSSushil SinghGet Lock Records For Multiple Invalid Session 301f9a536caSSushil Singh [Documentation] Record of lock list is empty for list of invalid session. 302f9a536caSSushil Singh [Tags] Get_Lock_Records_For_Multiple_Invalid_Session 303f9a536caSSushil Singh [Template] Verify Lock Records For Multiple Invalid Session 304f9a536caSSushil Singh 305f9a536caSSushil Singh # client_id 306f9a536caSSushil Singh HMCID-01 307f9a536caSSushil Singh 30811949a2cSSushil Singh 30911949a2cSSushil SinghGet Lock Records For Multiple Invalid And Valid Session 31011949a2cSSushil Singh [Documentation] Get record of lock from invalid and valid session. 31111949a2cSSushil Singh [Tags] Get_Lock_Records_For_Multiple_Invalid_And_Valid_Session 31211949a2cSSushil Singh [Template] Verify Lock Records For Multiple Invalid And Valid Session 31311949a2cSSushil Singh 31411949a2cSSushil Singh # client_id lock_type 31511949a2cSSushil Singh HMCID-01,HMCID-02 ReadCase1 31611949a2cSSushil Singh 317bc331e22SVijay*** Keywords *** 318bc331e22SVijay 319d03f2ce1SSushil SinghCreate Redfish Session With ClientID 320d03f2ce1SSushil Singh [Documentation] Create redifish session with client id. 321d03f2ce1SSushil Singh [Arguments] ${client_id} 32285610eeeSVijay 32385610eeeSVijay # Description of argument(s): 324d03f2ce1SSushil Singh # client_id This client id can contain string value 325d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 32685610eeeSVijay 327d03f2ce1SSushil Singh ${session_info}= Create Dictionary 328d03f2ce1SSushil Singh ${session}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}} 32985610eeeSVijay 330d03f2ce1SSushil Singh Set To Dictionary ${session_info} SessionIDs ${session['Id']} 331d03f2ce1SSushil Singh Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]} 33285610eeeSVijay 333d03f2ce1SSushil Singh [Return] ${session_info} 33485610eeeSVijay 33585610eeeSVijay 336d03f2ce1SSushil SinghRW General Dictionary 33716b3c7bfSGeorge Keishing [Documentation] Create dictionary of lock request. 338d03f2ce1SSushil Singh [Arguments] ${read_case} ${res_id} 339bc331e22SVijay 340bc331e22SVijay # Description of argument(s): 341d03f2ce1SSushil Singh # read_case Read or Write lock type. 342d03f2ce1SSushil Singh # res_id Resource id. 343bc331e22SVijay 344d03f2ce1SSushil Singh ${request_dict}= Create Dictionary 345566daaf3SGeorge Keishing 346d03f2ce1SSushil Singh FOR ${key} IN @{read_case.keys()} 347d03f2ce1SSushil Singh Set To Dictionary ${request_dict} LockType ${key} 348d03f2ce1SSushil Singh Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]} 349d03f2ce1SSushil Singh END 350bc331e22SVijay 351d03f2ce1SSushil Singh Set To Dictionary ${request_dict} ResourceID ${res_id} 352d03f2ce1SSushil Singh 353d03f2ce1SSushil Singh [Return] ${request_dict} 354bc331e22SVijay 355bc331e22SVijay 356d03f2ce1SSushil SinghReturn Description Of Response 357d03f2ce1SSushil Singh [Documentation] Return description of REST response. 358bc331e22SVijay [Arguments] ${resp_text} 359bc331e22SVijay 360bc331e22SVijay # Description of argument(s): 361d03f2ce1SSushil Singh # resp_text REST response body. 362bc331e22SVijay 363d03f2ce1SSushil Singh # resp_text after successful partition file upload looks like: 364d03f2ce1SSushil Singh # { 365d03f2ce1SSushil Singh # "Description": "File Created" 366d03f2ce1SSushil Singh # } 367bc331e22SVijay 368d03f2ce1SSushil Singh ${message}= Evaluate json.loads('''${resp_text}''') json 369d03f2ce1SSushil Singh 370d03f2ce1SSushil Singh [Return] ${message} 371bc331e22SVijay 372bc331e22SVijay 373a7d71f02SSushil SinghVerify Redfish Session Deleted 374a7d71f02SSushil Singh [Documentation] Verify the redfish session is deleted. 375a7d71f02SSushil Singh [Arguments] ${session_info} 376a7d71f02SSushil Singh 377a7d71f02SSushil Singh # Description of argument(s): 378a7d71f02SSushil Singh # session_info Session information are stored in dictionary. 379a7d71f02SSushil Singh 380a7d71f02SSushil Singh # ${session_info} = { 381a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 382a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 383a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 384a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 385a7d71f02SSushil Singh # } 386a7d71f02SSushil Singh 387a7d71f02SSushil Singh # SessionIDs : Session IDs 388a7d71f02SSushil Singh # ClientID : Client ID 389a7d71f02SSushil Singh # SessionToken : Session token 390a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 391a7d71f02SSushil Singh 392a7d71f02SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions 393a7d71f02SSushil Singh 394a7d71f02SSushil Singh FOR ${session} IN @{sessions['Members']} 395a7d71f02SSushil Singh Should Not Be Equal As Strings session ['/redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}'] 396a7d71f02SSushil Singh END 397a7d71f02SSushil Singh 398a7d71f02SSushil Singh 399a7d71f02SSushil SinghVerify Redfish List Of Session Deleted 400a7d71f02SSushil Singh [Documentation] Verify all the list of redfish session is deleted. 401a7d71f02SSushil Singh [Arguments] ${session_info_list} 402a7d71f02SSushil Singh 403a7d71f02SSushil Singh # Description of argument(s): 404a7d71f02SSushil Singh # session_info_list List contains individual session record are stored in dictionary. 405a7d71f02SSushil Singh 406a7d71f02SSushil Singh # ${session_info_list} = [{ 407a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 408a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 409a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 410a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 411a7d71f02SSushil Singh # }] 412a7d71f02SSushil Singh 413a7d71f02SSushil Singh # SessionIDs : Session IDs 414a7d71f02SSushil Singh # ClientID : Client ID 415a7d71f02SSushil Singh # SessionToken : Session token 416a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 417a7d71f02SSushil Singh 418a7d71f02SSushil Singh FOR ${session_record} IN @{session_info_list} 419a7d71f02SSushil Singh Verify Redfish Session Deleted ${session_record} 420a7d71f02SSushil Singh END 421a7d71f02SSushil Singh 422a7d71f02SSushil Singh 423d03f2ce1SSushil SinghRedfish Post Acquire Lock 424d03f2ce1SSushil Singh [Documentation] Acquire and release lock. 425d03f2ce1SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 426bc331e22SVijay 427bc331e22SVijay # Description of argument(s): 428d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 429d03f2ce1SSushil Singh # status_code HTTP status code. 430bc331e22SVijay 431e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Lock ${lock_type} 432e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 433d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 434df390b61SSushil Singh 435df390b61SSushil Singh Run Keyword If ${status_code} == ${HTTP_BAD_REQUEST} 436df390b61SSushil Singh ... Valid Value ${BAD_REQUEST} ['${resp.content}'] 437df390b61SSushil Singh ... ELSE 438df390b61SSushil Singh ... Run Keyword And Return Return Description Of Response ${resp.content} 439bc331e22SVijay 440d03f2ce1SSushil Singh [Return] ${resp} 441bc331e22SVijay 442bc331e22SVijay 443977f8f58SSushil SinghRedfish Post Acquire List Lock 444977f8f58SSushil Singh [Documentation] Acquire and release lock. 445977f8f58SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 446977f8f58SSushil Singh 447977f8f58SSushil Singh # Description of argument(s): 448977f8f58SSushil Singh # lock_type Read lock or Write lock. 449977f8f58SSushil Singh # status_code HTTP status code. 450977f8f58SSushil Singh 451977f8f58SSushil Singh ${lock_dict_param}= Create Data To Acquire List Of Lock ${lock_type} 452977f8f58SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 453977f8f58SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 454977f8f58SSushil Singh 455977f8f58SSushil Singh [Return] ${resp} 456977f8f58SSushil Singh 457977f8f58SSushil Singh 458d03f2ce1SSushil SinghRedfish Post Acquire Invalid Lock 459d03f2ce1SSushil Singh [Documentation] Redfish to post request to acquire in-valid lock. 460d03f2ce1SSushil Singh [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK} 461bc331e22SVijay 462bc331e22SVijay # Description of argument(s): 463d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 464d03f2ce1SSushil Singh # message Return message from URI. 465d03f2ce1SSushil Singh # status_code HTTP status code. 466bc331e22SVijay 467e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type} 468e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 469d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 4703b3a7ecaSSushil Singh Run Keyword If '${message}' != '${EMPTY}' 4713b3a7ecaSSushil Singh ... Valid Value message ['${resp.content}'] 472d03f2ce1SSushil Singh 473d03f2ce1SSushil Singh [Return] ${resp} 474bc331e22SVijay 475bc331e22SVijay 476e33c6e6aSSushil SinghRedfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 477e33c6e6aSSushil Singh [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id. 478e33c6e6aSSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 479e33c6e6aSSushil Singh 480e33c6e6aSSushil Singh # Description of argument(s): 481e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 482e33c6e6aSSushil Singh # status_code HTTP status code. 483e33c6e6aSSushil Singh 484e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type} 485e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 486e33c6e6aSSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 487e33c6e6aSSushil Singh 488e33c6e6aSSushil Singh [Return] ${resp} 489e33c6e6aSSushil Singh 490e33c6e6aSSushil Singh 491d03f2ce1SSushil SinghForm Data To Acquire Lock 49216b3c7bfSGeorge Keishing [Documentation] Create a dictionary for lock request. 493d03f2ce1SSushil Singh [Arguments] ${lock_type} 494d03f2ce1SSushil Singh 495d03f2ce1SSushil Singh # Description of argument(s): 496d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 497d03f2ce1SSushil Singh 498d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 499d03f2ce1SSushil Singh ${resp}= RW General Dictionary 500d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 501d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 502d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 503e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 504d03f2ce1SSushil Singh 505e33c6e6aSSushil Singh [Return] ${lock_request_dict} 506e33c6e6aSSushil Singh 507e33c6e6aSSushil Singh 508977f8f58SSushil SinghCreate Data To Acquire List Of Lock 50916b3c7bfSGeorge Keishing [Documentation] Create a dictionary for list of lock request. 510977f8f58SSushil Singh [Arguments] ${lock_type_list} 511977f8f58SSushil Singh 512977f8f58SSushil Singh # Description of argument(s): 513977f8f58SSushil Singh # lock_type Read lock or Write lock. 514977f8f58SSushil Singh 515977f8f58SSushil Singh ${temp_list}= Create List 516977f8f58SSushil Singh ${lock_res_info}= Get Lock Resource Information 517977f8f58SSushil Singh 518977f8f58SSushil Singh FOR ${lock_type} IN @{lock_type_list} 519977f8f58SSushil Singh ${resp}= RW General Dictionary 520977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 521977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 522977f8f58SSushil Singh Append To List ${temp_list} ${resp} 523977f8f58SSushil Singh END 524977f8f58SSushil Singh 525977f8f58SSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 526977f8f58SSushil Singh 527977f8f58SSushil Singh [Return] ${lock_request_dict} 528977f8f58SSushil Singh 529977f8f58SSushil Singh 530e33c6e6aSSushil SinghForm Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID 53116b3c7bfSGeorge Keishing [Documentation] Create a dictionary for in-valid lock request. 532e33c6e6aSSushil Singh [Arguments] ${lock_type} 533e33c6e6aSSushil Singh 534e33c6e6aSSushil Singh # Description of argument(s): 535e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 536e33c6e6aSSushil Singh 537e33c6e6aSSushil Singh ${lock_res_info}= Get Lock Resource Information 538e33c6e6aSSushil Singh ${resp}= RW General Dictionary 539e33c6e6aSSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 540e33c6e6aSSushil Singh ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]} 541e33c6e6aSSushil Singh ${temp_list}= Create List ${resp} 542e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 543e33c6e6aSSushil Singh 544e33c6e6aSSushil Singh [Return] ${lock_request_dict} 545d03f2ce1SSushil Singh 546d03f2ce1SSushil Singh 547d03f2ce1SSushil SinghForm Data To Acquire Invalid Lock 54816b3c7bfSGeorge Keishing [Documentation] Create a dictionary for in-valid lock request. 549d03f2ce1SSushil Singh [Arguments] ${lock_type} 550d03f2ce1SSushil Singh 551d03f2ce1SSushil Singh # Description of argument(s): 552d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 553d03f2ce1SSushil Singh 554d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 555d03f2ce1SSushil Singh ${resp}= RW General Dictionary 556d03f2ce1SSushil Singh ... ${lock_res_info["Invalid Case"]["${lock_type}"]} 557d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 558d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 559e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 560d03f2ce1SSushil Singh 561e33c6e6aSSushil Singh [Return] ${lock_request_dict} 562d03f2ce1SSushil Singh 563d03f2ce1SSushil Singh 564d03f2ce1SSushil SinghGet Locks List On Resource 565bc331e22SVijay [Documentation] Get locks list. 566d03f2ce1SSushil Singh [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK} 567bc331e22SVijay 568bc331e22SVijay # Description of argument(s): 569d03f2ce1SSushil Singh # session_info Session information in dict. 570d03f2ce1SSushil Singh # exp_status_code Expected HTTP status code. 571bc331e22SVijay 572d03f2ce1SSushil Singh ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]} 573566daaf3SGeorge Keishing ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 574566daaf3SGeorge Keishing ... data=${data} 575bc331e22SVijay ${locks}= Evaluate json.loads('''${resp.text}''') json 576bc331e22SVijay 577bc331e22SVijay [Return] ${locks["Records"]} 578bc331e22SVijay 579bc331e22SVijay 580d03f2ce1SSushil SinghVerify Lock On Resource 581d03f2ce1SSushil Singh [Documentation] Verify lock on resource. 582d03f2ce1SSushil Singh [Arguments] ${session_info} ${transaction_id} 583bc331e22SVijay 584bc331e22SVijay # Description of argument(s): 585d03f2ce1SSushil Singh # session_info Session information in dict. 586d03f2ce1SSushil Singh # transaction_id Transaction id in list stored in dict. 587bc331e22SVijay 588d03f2ce1SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']} 589d03f2ce1SSushil Singh Rprint Vars sessions 590d03f2ce1SSushil Singh ${lock_list}= Get Locks List On Resource ${session_info} 591d03f2ce1SSushil Singh ${lock_length}= Get Length ${lock_list} 592d03f2ce1SSushil Singh ${tran_id_length}= Get Length ${transaction_id} 593d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id_length} ${lock_length} 594afdd2a1dSVijay 595d03f2ce1SSushil Singh FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list} 596d03f2ce1SSushil Singh Valid Value session_info['ClientID'] ['${lock['HMCID']}'] 597d03f2ce1SSushil Singh Valid Value session_info['SessionIDs'] ['${lock['SessionID']}'] 598d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']} 599bc331e22SVijay END 600bc331e22SVijay 601bc331e22SVijay 602d03f2ce1SSushil SinghAcquire Lock On Resource 603d03f2ce1SSushil Singh [Documentation] Acquire lock on resource. 604d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False 605bc331e22SVijay 606bc331e22SVijay # Description of argument(s): 607d03f2ce1SSushil Singh # client_id This client id can contain string value 608d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 609d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 610d03f2ce1SSushil Singh # reboot_flag Flag is used to run reboot the BMC code. 611d03f2ce1SSushil Singh # (e.g. True or False). 612bc331e22SVijay 613d03f2ce1SSushil Singh ${trans_id_list}= Create List 614d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 615d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 616d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 617d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 618566daaf3SGeorge Keishing 619e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 620bc331e22SVijay 621d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'True' 622d03f2ce1SSushil Singh ... Run Keywords Redfish OBMC Reboot (off) AND 623d03f2ce1SSushil Singh ... Redfish Login AND 624e33c6e6aSSushil Singh ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND 625d03f2ce1SSushil Singh ... Verify Lock On Resource ${session_info} ${trans_id_list} AND 626d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 627bc331e22SVijay 628d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'False' 629d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 630bc331e22SVijay 631d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 632d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 633d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 634bc331e22SVijay 635bc331e22SVijay 636d03f2ce1SSushil SinghForm Data To Release Lock 637d03f2ce1SSushil Singh [Documentation] Create a dictonay to release lock. 638d03f2ce1SSushil Singh [Arguments] ${trans_id_list} 639355daac7SVijay 640355daac7SVijay # Description of argument(s): 641d03f2ce1SSushil Singh # trans_id_list 642355daac7SVijay 643d03f2ce1SSushil Singh @{tran_ids}= Create List 644355daac7SVijay 645d03f2ce1SSushil Singh FOR ${item} IN @{trans_id_list} 646d03f2ce1SSushil Singh Append To List ${tran_ids} ${item['TransactionID']} 647d03f2ce1SSushil Singh END 648d03f2ce1SSushil Singh 649d03f2ce1SSushil Singh [Return] ${tran_ids} 650d03f2ce1SSushil Singh 651d03f2ce1SSushil Singh 652d03f2ce1SSushil SinghRelease Locks On Resource 653d03f2ce1SSushil Singh [Documentation] Redfish request to release a lock. 654d03f2ce1SSushil Singh [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction ${status_code}=${HTTP_OK} 655d03f2ce1SSushil Singh 656d03f2ce1SSushil Singh # Description of argument(s): 657d03f2ce1SSushil Singh # session_info Session information in dict. 658d03f2ce1SSushil Singh # trans_id_list Transaction id list. 659d03f2ce1SSushil Singh # release_lock_type Release lock by Transaction, Session. 660d03f2ce1SSushil Singh # status_code HTTP status code. 661d03f2ce1SSushil Singh 662d03f2ce1SSushil Singh ${tran_ids}= Form Data To Release Lock ${trans_id_list} 663d03f2ce1SSushil Singh ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}} 664d03f2ce1SSushil Singh ${data}= Evaluate json.dumps(${data}) json 665d03f2ce1SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data} 666d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 667d03f2ce1SSushil Singh 668d03f2ce1SSushil Singh 669df390b61SSushil SinghRelease locks And Delete Session 670df390b61SSushil Singh [Documentation] Release locks and delete redfish session. 671df390b61SSushil Singh [Arguments] ${session_info} ${trans_id_list} 672df390b61SSushil Singh 673df390b61SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} 674df390b61SSushil Singh 675df390b61SSushil Singh ${trans_id_emptylist}= Create List 676df390b61SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 677df390b61SSushil Singh 678df390b61SSushil Singh Redfish Delete Session ${session_info} 679df390b61SSushil Singh 680df390b61SSushil Singh 681d03f2ce1SSushil SinghAcquire Lock On Another Lock 682d03f2ce1SSushil Singh [Documentation] Acquire lock on another lock. 683d03f2ce1SSushil Singh [Arguments] ${client_id} 684d03f2ce1SSushil Singh 685d03f2ce1SSushil Singh # Description of argument(s): 686d03f2ce1SSushil Singh # client_id This client id can contain string value 687d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 688d03f2ce1SSushil Singh 689d03f2ce1SSushil Singh ${trans_id_list}= Create List 690d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 691d03f2ce1SSushil Singh 692d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 693d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 694d03f2ce1SSushil Singh 695d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 696d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 697d03f2ce1SSushil Singh 698d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 699d03f2ce1SSushil Singh 700df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 701d03f2ce1SSushil Singh 702d03f2ce1SSushil Singh 703977f8f58SSushil SinghVerify Fail To Acquire Read And Write In Single Request 704977f8f58SSushil Singh [Documentation] Verify fail to acquire read and write lock passed in single request. 705977f8f58SSushil Singh [Arguments] ${client_id} ${lock_type} 706977f8f58SSushil Singh 707977f8f58SSushil Singh # Description of argument(s): 708977f8f58SSushil Singh # client_id This client id can contain string value 709977f8f58SSushil Singh # (e.g. 12345, "HMCID"). 710977f8f58SSushil Singh # lock_type Read lock or Write lock. 711977f8f58SSushil Singh 712977f8f58SSushil Singh ${lock_type_list}= Split String ${lock_type} , 713977f8f58SSushil Singh 714977f8f58SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 715977f8f58SSushil Singh ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list} status_code=${HTTP_BAD_REQUEST} 716977f8f58SSushil Singh Redfish Delete Session ${session_info} 717977f8f58SSushil Singh 718977f8f58SSushil Singh 719d03f2ce1SSushil SinghVerify Empty Lock Records For Invalid Session 720d03f2ce1SSushil Singh [Documentation] Verify no lock record found for invalid session. 721d03f2ce1SSushil Singh [Arguments] ${client_id} 722d03f2ce1SSushil Singh 723d03f2ce1SSushil Singh # Description of argument(s): 724d03f2ce1SSushil Singh # client_id This client id can contain string value 725d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 726d03f2ce1SSushil Singh 727d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_id} 728d03f2ce1SSushil Singh 729d03f2ce1SSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 730d03f2ce1SSushil Singh ${lock_length1}= Get Length ${lock_list1} 731d03f2ce1SSushil Singh 732d03f2ce1SSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 733d03f2ce1SSushil Singh set to dictionary ${session_info2} SessionIDs xxyXyyYZZz 734d03f2ce1SSushil Singh 735d03f2ce1SSushil Singh ${lock_list2}= Get Locks List On Resource ${session_info2} 736f9a536caSSushil Singh ${lock_length2}= Get Length ${lock_list2} 737d03f2ce1SSushil Singh 738f9a536caSSushil Singh Should Be Equal As Integers ${lock_length1} ${lock_length2} 739d03f2ce1SSushil Singh 740d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 741d03f2ce1SSushil Singh 742d03f2ce1SSushil Singh 743d03f2ce1SSushil SinghVerify Acquire Lock Fails On Another Lock 744d03f2ce1SSushil Singh [Documentation] Verify acquire lock on another lock fails. 745d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 746d03f2ce1SSushil Singh 747d03f2ce1SSushil Singh # Description of argument(s): 748d03f2ce1SSushil Singh # client_id This client id can contain string value 749d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 750d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 751d03f2ce1SSushil Singh 752d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 753d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 754d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 755d03f2ce1SSushil Singh 756d03f2ce1SSushil Singh ${trans_id_list}= Create List 757d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 758d03f2ce1SSushil Singh 759d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 760d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 761d03f2ce1SSushil Singh 762df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 763d03f2ce1SSushil Singh 764d03f2ce1SSushil Singh 765e33c6e6aSSushil SinghVerify Acquire Lock After Reboot 766e33c6e6aSSushil Singh [Documentation] Acquire read and write lock after the reboot and release lock. 767e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 768e33c6e6aSSushil Singh 769e33c6e6aSSushil Singh # Description of argument(s): 770e33c6e6aSSushil Singh # client_id This client id can contain string value 771e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 772e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 773e33c6e6aSSushil Singh 774e33c6e6aSSushil Singh ${trans_id_list}= Create List 775f9a536caSSushil Singh ${session_info}= Create Session With ClientID ${client_id} 776e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 777e33c6e6aSSushil Singh Redfish OBMC Reboot (off) 778e33c6e6aSSushil Singh Redfish Login 779e33c6e6aSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} 780e33c6e6aSSushil Singh 781e33c6e6aSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 782e33c6e6aSSushil Singh Append To List ${trans_id_list} ${trans_id} 783e33c6e6aSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 784e33c6e6aSSushil Singh 785df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 786df390b61SSushil Singh 787df390b61SSushil Singh 788df390b61SSushil SinghVerify Acquire Multiple Lock Request At CEC Level 789df390b61SSushil Singh [Documentation] Acquire lock in loop. 790df390b61SSushil Singh [Arguments] ${client_id} ${lock_type} 791df390b61SSushil Singh 792df390b61SSushil Singh # Description of argument(s): 793df390b61SSushil Singh # client_id This client id can contain string value 794df390b61SSushil Singh # (e.g. 12345, "HMCID"). 795df390b61SSushil Singh # lock_type Read lock or Write lock. 796df390b61SSushil Singh 797df390b61SSushil Singh ${trans_id_list}= Create List 798df390b61SSushil Singh @{lock_type_list}= Split String ${lock_type} , 799df390b61SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 800df390b61SSushil Singh 801df390b61SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 802df390b61SSushil Singh Append To List ${trans_id_list} ${trans_id} 803df390b61SSushil Singh 804df390b61SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 805df390b61SSushil Singh 806df390b61SSushil Singh Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 807df390b61SSushil Singh 808df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 809e33c6e6aSSushil Singh 810e33c6e6aSSushil Singh 811d03f2ce1SSushil SinghVerify Acquire And Release Lock In Loop 812d03f2ce1SSushil Singh [Documentation] Acquire lock in loop. 813d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 814d03f2ce1SSushil Singh 815d03f2ce1SSushil Singh # Description of argument(s): 816d03f2ce1SSushil Singh # client_id This client id can contain string value 817d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 818d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 819d03f2ce1SSushil Singh 820d03f2ce1SSushil Singh FOR ${count} IN RANGE 1 11 821d03f2ce1SSushil Singh ${trans_id_list}= Create List 822d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 823d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 824d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 825d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 826d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 827d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 828d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 829d03f2ce1SSushil Singh END 830d03f2ce1SSushil Singh 831d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 832d03f2ce1SSushil Singh 833d03f2ce1SSushil Singh 834d03f2ce1SSushil SinghAcquire And Release Multiple Locks 835d03f2ce1SSushil Singh [Documentation] Acquire mutilple locks on resource. 836d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 837d03f2ce1SSushil Singh 838d03f2ce1SSushil Singh # Description of argument(s): 839d03f2ce1SSushil Singh # client_id This client id can contain string value 840d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 841d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 842d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 843d03f2ce1SSushil Singh 844d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 845d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 846d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 847d03f2ce1SSushil Singh 848d03f2ce1SSushil Singh ${trans_id_list}= Create List 849d03f2ce1SSushil Singh 850d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 851d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 852d03f2ce1SSushil Singh 853d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 854d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 855d03f2ce1SSushil Singh 856d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 857d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 858d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 859d03f2ce1SSushil Singh 860d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 861d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 862d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 863d03f2ce1SSushil Singh 864d03f2ce1SSushil Singh 865*94116c61Ssusilsi7Verify Release Lock When Session Deleted 866*94116c61Ssusilsi7 [Documentation] Verify lock get released when session are deleted. 867*94116c61Ssusilsi7 [Arguments] ${client_id} ${lock_type} 868*94116c61Ssusilsi7 869*94116c61Ssusilsi7 # Description of argument(s): 870*94116c61Ssusilsi7 # client_ids This client id can contain string value 871*94116c61Ssusilsi7 # (e.g. 12345, "HMCID"). 872*94116c61Ssusilsi7 # lock_type Read lock or Write lock. 873*94116c61Ssusilsi7 874*94116c61Ssusilsi7 ${trans_id_list}= Create List 875*94116c61Ssusilsi7 @{lock_type_list}= Split String ${lock_type} , 876*94116c61Ssusilsi7 877*94116c61Ssusilsi7 ${pre_session_info}= Create Redfish Session With ClientID ${client_id} 878*94116c61Ssusilsi7 879*94116c61Ssusilsi7 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 880*94116c61Ssusilsi7 Append To List ${trans_id_list} ${trans_id} 881*94116c61Ssusilsi7 Verify Lock On Resource ${pre_session_info} ${trans_id_list} 882*94116c61Ssusilsi7 883*94116c61Ssusilsi7 Redfish Delete Session ${pre_session_info} 884*94116c61Ssusilsi7 ${post_session_info}= Create Redfish Session With ClientID ${client_id} 885*94116c61Ssusilsi7 ${resp}= Get Locks List On Resource With Session List ${pre_session_info} ${HTTP_BAD_REQUEST} 886*94116c61Ssusilsi7 887*94116c61Ssusilsi7 Redfish Delete Session ${post_session_info} 888*94116c61Ssusilsi7 889*94116c61Ssusilsi7 890*94116c61Ssusilsi7 89159011d08SSushil SinghVerify Fail To Release Lock With Invalid TransactionID 89216b3c7bfSGeorge Keishing [Documentation] Verify fail to be release lock with invalid transaction ID. 89359011d08SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 89459011d08SSushil Singh 89559011d08SSushil Singh # Description of argument(s): 89659011d08SSushil Singh # client_id This client id can contain string value 89759011d08SSushil Singh # (e.g. 12345, "HMCID"). 89859011d08SSushil Singh # lock_type Read lock or Write lock. 89959011d08SSushil Singh # release_lock_type The value can be Transaction or Session. 90059011d08SSushil Singh 90159011d08SSushil Singh ${trans_id_list}= Create List 90259011d08SSushil Singh @{lock_type_list}= Split String ${lock_type} , 90359011d08SSushil Singh 90459011d08SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 90559011d08SSushil Singh 90659011d08SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 90759011d08SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 90859011d08SSushil Singh ${value}= Evaluate ${value} + 10 90959011d08SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 91059011d08SSushil Singh Append To List ${trans_id_list} ${trans_id} 91159011d08SSushil Singh 91259011d08SSushil Singh Release Locks On Resource 91359011d08SSushil Singh ... ${session_info} ${trans_id_list} 91459011d08SSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 91559011d08SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 91659011d08SSushil Singh 91759011d08SSushil Singh ${trans_id_emptylist}= Create List 91859011d08SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 91959011d08SSushil Singh Redfish Delete Session ${session_info} 92059011d08SSushil Singh 92159011d08SSushil Singh 9221b59053dSSushil SinghVerify Fail To Release Multiple Lock With Invalid TransactionID 9231b59053dSSushil Singh [Documentation] Verify release multiple locks with invalid transaction ID fails. 924d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 925d03f2ce1SSushil Singh 926d03f2ce1SSushil Singh # Description of argument(s): 927d03f2ce1SSushil Singh # client_id This client id can contain string value 928d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 929d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 930d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 931d03f2ce1SSushil Singh 932d03f2ce1SSushil Singh ${trans_id_list}= Create List 933d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 934d03f2ce1SSushil Singh 935d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 936d03f2ce1SSushil Singh 937d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 938d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 939d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 940d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 941d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 942d03f2ce1SSushil Singh 943d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 944d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 945d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 946d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 947d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 948d03f2ce1SSushil Singh 949d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 950d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 951d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 952d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 953d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 954d03f2ce1SSushil Singh 955d03f2ce1SSushil Singh Release Locks On Resource 956d03f2ce1SSushil Singh ... ${session_info} ${trans_id_list} 957d03f2ce1SSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 958d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 959d03f2ce1SSushil Singh 960d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 961d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 962d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 963d03f2ce1SSushil Singh 964d03f2ce1SSushil Singh 9658bee358fSSushil SinghVerify Fail To Release Multiple Lock With Valid And Invalid TransactionID 9668bee358fSSushil Singh [Documentation] Verify fail to be release multiple lock with valid and invalid trasaction ID. 9678bee358fSSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 9688bee358fSSushil Singh 9698bee358fSSushil Singh # Description of argument(s): 9708bee358fSSushil Singh # client_id This client id can contain string value 9718bee358fSSushil Singh # (e.g. 12345, "HMCID"). 9728bee358fSSushil Singh # lock_type Read lock or Write lock. 9738bee358fSSushil Singh # release_lock_type The value can be Transaction or Session. 9748bee358fSSushil Singh 9758bee358fSSushil Singh ${trans_id_list}= Create List 9768bee358fSSushil Singh @{lock_type_list}= Split String ${lock_type} , 9778bee358fSSushil Singh 9788bee358fSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 9798bee358fSSushil Singh 9808bee358fSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 9818bee358fSSushil Singh Append To List ${trans_id_list} ${trans_id} 9828bee358fSSushil Singh 9838bee358fSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 9848bee358fSSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 9858bee358fSSushil Singh ${value}= Evaluate ${value} + 10 9868bee358fSSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 9878bee358fSSushil Singh Append To List ${trans_id_list} ${trans_id} 9888bee358fSSushil Singh 9898bee358fSSushil Singh Release Locks On Resource 9908bee358fSSushil Singh ... ${session_info} ${trans_id_list} 9918bee358fSSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 9928bee358fSSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 9938bee358fSSushil Singh 9948bee358fSSushil Singh ${trans_id_emptylist}= Create List 9958bee358fSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 9968bee358fSSushil Singh Redfish Delete Session ${session_info} 9978bee358fSSushil Singh 9988bee358fSSushil Singh 9991d7b996cSsusilsi7Verify Fail To Release Lock With TransactionID As String Type 10001d7b996cSsusilsi7 [Documentation] Verify fail to be release lock with trasaction ID as string data type. 10011d7b996cSsusilsi7 [Arguments] ${client_id} ${lock_type} ${release_lock_type} 10021d7b996cSsusilsi7 10031d7b996cSsusilsi7 # Description of argument(s): 10041d7b996cSsusilsi7 # client_id This client id can contain string value 10051d7b996cSsusilsi7 # (e.g. 12345, "HMCID"). 10061d7b996cSsusilsi7 # lock_type Read lock or Write lock. 10071d7b996cSsusilsi7 # release_lock_type The value can be Transaction or Session. 10081d7b996cSsusilsi7 10091d7b996cSsusilsi7 ${trans_id_list}= Create List 10101d7b996cSsusilsi7 @{lock_type_list}= Split String ${lock_type} , 10111d7b996cSsusilsi7 10121d7b996cSsusilsi7 ${session_info}= Create Redfish Session With ClientID ${client_id} 10131d7b996cSsusilsi7 10141d7b996cSsusilsi7 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 10151d7b996cSsusilsi7 10161d7b996cSsusilsi7 Append To List ${trans_id_list} ${trans_id} 10171d7b996cSsusilsi7 10181d7b996cSsusilsi7 ${temp_trans_id_list}= Copy Dictionary ${trans_id_list} deepcopy=True 10191d7b996cSsusilsi7 10201d7b996cSsusilsi7 ${value}= Get From Dictionary ${trans_id_list}[0] TransactionID 10211d7b996cSsusilsi7 ${value}= Set Variable \'${value}\' 10221d7b996cSsusilsi7 Set To Dictionary ${temp_trans_id_list}[0] TransactionID ${value} 10231d7b996cSsusilsi7 10241d7b996cSsusilsi7 Release Locks On Resource 10251d7b996cSsusilsi7 ... ${session_info} ${temp_trans_id_list} 10261d7b996cSsusilsi7 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 10271d7b996cSsusilsi7 10281d7b996cSsusilsi7 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 10291d7b996cSsusilsi7 10301d7b996cSsusilsi7 ${trans_id_emptylist}= Create List 10311d7b996cSsusilsi7 Verify Lock On Resource ${session_info} ${trans_id_emptylist} 10321d7b996cSsusilsi7 Redfish Delete Session ${session_info} 10331d7b996cSsusilsi7 10341d7b996cSsusilsi7 1035d03f2ce1SSushil SinghVerify Fail To Release Lock For Another Session 1036d03f2ce1SSushil Singh [Documentation] Verify failed to release the lock form another session. 1037d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 1038d03f2ce1SSushil Singh 1039d03f2ce1SSushil Singh # Description of argument(s): 1040d03f2ce1SSushil Singh # client_id This client id can contain string value 1041d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 1042d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 1043d03f2ce1SSushil Singh 1044d03f2ce1SSushil Singh ${client_ids}= Split String ${client_id} , 1045d03f2ce1SSushil Singh ${lock_type_list}= Split String ${lock_type} , 1046d03f2ce1SSushil Singh ${trans_id_list1}= Create List 1047d03f2ce1SSushil Singh ${trans_id_list2}= Create List 1048d03f2ce1SSushil Singh 1049d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0] 1050d03f2ce1SSushil Singh 1051d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1052d03f2ce1SSushil Singh Append To List ${trans_id_list1} ${trans_id} 1053d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 1054d03f2ce1SSushil Singh 1055d03f2ce1SSushil Singh ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1] 1056d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 1057d03f2ce1SSushil Singh Append To List ${trans_id_list2} ${trans_id} 1058d03f2ce1SSushil Singh Verify Lock On Resource ${session_info2} ${trans_id_list2} 1059d03f2ce1SSushil Singh 1060d03f2ce1SSushil Singh Release Locks On Resource 1061d03f2ce1SSushil Singh ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_UNAUTHORIZED} 1062d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 1063d03f2ce1SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session 1064d03f2ce1SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session 1065d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 1066d03f2ce1SSushil Singh Redfish Delete Session ${session_info2} 1067d03f2ce1SSushil Singh 1068d03f2ce1SSushil Singh 1069e33c6e6aSSushil SinghVerify Fail To Acquire Lock For Invalid Resource ID Data Type 1070e33c6e6aSSushil Singh [Documentation] Verify fail to acquire the lock with invalid resource id data type. 1071e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 1072e33c6e6aSSushil Singh 1073e33c6e6aSSushil Singh # Description of argument(s): 1074e33c6e6aSSushil Singh # client_id This client id can contain string value 1075e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 1076e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 1077e33c6e6aSSushil Singh 1078e33c6e6aSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 1079e33c6e6aSSushil Singh Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 1080e33c6e6aSSushil Singh ... ${lock_type} status_code=${HTTP_BAD_REQUEST} 1081e33c6e6aSSushil Singh Redfish Delete Session ${session_info} 1082e33c6e6aSSushil Singh 1083e33c6e6aSSushil Singh 1084d03f2ce1SSushil SinghVerify Fail To Acquire Lock For Invalid Lock Data 108516b3c7bfSGeorge Keishing [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segment flags. 1086d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${message} 1087d03f2ce1SSushil Singh 1088d03f2ce1SSushil Singh # Description of argument(s): 1089d03f2ce1SSushil Singh # client_id This client id can contain string value 1090d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 1091d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 1092d03f2ce1SSushil Singh # message Return message from URI. 1093d03f2ce1SSushil Singh 1094d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 1095d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Invalid Lock ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST} 1096d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 1097bace3005SSushil Singh 1098bace3005SSushil Singh 1099bace3005SSushil SinghVerify No Locks Records For Session With No Acquired Lock 1100bace3005SSushil Singh [Documentation] Verify no records found for a session where no lock is acquired. 1101bace3005SSushil Singh [Arguments] ${client_id} 1102bace3005SSushil Singh 1103bace3005SSushil Singh # Description of argument(s): 1104bace3005SSushil Singh # client_id This client id can contain string value 1105bace3005SSushil Singh # (e.g. 12345, "HMCID"). 1106bace3005SSushil Singh 1107bace3005SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 1108bace3005SSushil Singh ${trans_id_emptylist}= Create List 1109bace3005SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 1110bace3005SSushil Singh Redfish Delete Session ${session_info} 1111728ef9c9SSushil Singh 1112728ef9c9SSushil Singh 1113728ef9c9SSushil SinghCreate List Of Session ID 1114728ef9c9SSushil Singh [Documentation] Create session id list from session dict info. 1115728ef9c9SSushil Singh [Arguments] ${session_dict_info} 1116728ef9c9SSushil Singh 1117728ef9c9SSushil Singh # Description of argument(s): 1118728ef9c9SSushil Singh # session_dict_info Session information in dict. 1119728ef9c9SSushil Singh 1120728ef9c9SSushil Singh @{session_id_list}= Create List 1121728ef9c9SSushil Singh 1122728ef9c9SSushil Singh FOR ${session} IN @{session_dict_info} 1123728ef9c9SSushil Singh Append To List ${session_id_list} ${session["SessionIDs"]} 1124728ef9c9SSushil Singh END 1125728ef9c9SSushil Singh 1126728ef9c9SSushil Singh ${num_id}= Get Length ${session_id_list} 1127728ef9c9SSushil Singh Should Not Be Equal As Integers ${num_id} ${0} 1128728ef9c9SSushil Singh 1129728ef9c9SSushil Singh ${session_id_list}= Evaluate json.dumps(${session_id_list}) json 1130728ef9c9SSushil Singh 1131728ef9c9SSushil Singh [Return] ${session_id_list} 1132728ef9c9SSushil Singh 1133728ef9c9SSushil Singh 1134728ef9c9SSushil SinghGet Locks List On Resource With Session List 1135728ef9c9SSushil Singh [Documentation] Get locks list from session of list. 1136728ef9c9SSushil Singh [Arguments] ${session_id_list} ${exp_status_code}=${HTTP_OK} 1137728ef9c9SSushil Singh 1138728ef9c9SSushil Singh # Description of argument(s): 1139728ef9c9SSushil Singh # session_id_list Session ids list. 1140728ef9c9SSushil Singh # exp_status_code Expected HTTP status code. 1141728ef9c9SSushil Singh 1142728ef9c9SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 1143728ef9c9SSushil Singh ... data={"SessionIDs": ${session_id_list}} 1144*94116c61Ssusilsi7 Should Be Equal As Strings ${resp.status_code} ${exp_status_code} 1145728ef9c9SSushil Singh ${locks}= Evaluate json.loads('''${resp.text}''') json 1146728ef9c9SSushil Singh 1147728ef9c9SSushil Singh [Return] ${locks} 1148728ef9c9SSushil Singh 1149728ef9c9SSushil Singh 1150728ef9c9SSushil SinghVerify List Of Session Lock On Resource 1151728ef9c9SSushil Singh [Documentation] Verify list of lock record from list of sessions. 1152728ef9c9SSushil Singh [Arguments] ${session_dict_info} ${transaction_id_list} 1153728ef9c9SSushil Singh 1154728ef9c9SSushil Singh # Description of argument(s): 1155728ef9c9SSushil Singh # session_dict_info Session information in dict. 1156728ef9c9SSushil Singh # transaction_id_list Transaction id in list stored in dict. 1157728ef9c9SSushil Singh 1158728ef9c9SSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_info} 1159728ef9c9SSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 1160728ef9c9SSushil Singh ${lock_list}= Set Variable ${lock_list_resp['Records']} 1161728ef9c9SSushil Singh 1162728ef9c9SSushil Singh FOR ${session_id} ${tran_id} ${lock_record} IN ZIP ${session_dict_info} ${transaction_id_list} ${lock_list} 1163728ef9c9SSushil Singh Valid Value session_id['SessionIDs'] ['${lock_record['SessionID']}'] 1164728ef9c9SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock_record['TransactionID']} 1165728ef9c9SSushil Singh END 1166728ef9c9SSushil Singh 1167728ef9c9SSushil Singh 1168728ef9c9SSushil SinghVerify Lock Records Of Multiple Session 1169728ef9c9SSushil Singh [Documentation] Verify all records found for a multiple sessions. 1170728ef9c9SSushil Singh [Arguments] ${client_ids} ${lock_type} 1171728ef9c9SSushil Singh 1172728ef9c9SSushil Singh # Description of argument(s): 1173728ef9c9SSushil Singh # client_ids This client id can contain string value 1174728ef9c9SSushil Singh # (e.g. 12345, "HMCID"). 1175728ef9c9SSushil Singh # lock_type Read lock or Write lock. 1176728ef9c9SSushil Singh 1177728ef9c9SSushil Singh ${client_id_list}= Split String ${client_ids} , 1178728ef9c9SSushil Singh ${lock_type_list}= Split String ${lock_type} , 1179728ef9c9SSushil Singh ${trans_id_list1}= Create List 1180728ef9c9SSushil Singh ${trans_id_list2}= Create List 1181728ef9c9SSushil Singh 1182728ef9c9SSushil Singh ${session_dict_list}= Create List 1183728ef9c9SSushil Singh ${lock_list}= Create List 1184728ef9c9SSushil Singh 1185728ef9c9SSushil Singh ${client_id1}= Create List 1186728ef9c9SSushil Singh Append To List ${client_id1} ${client_id_list}[0] 1187728ef9c9SSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 1188728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 1189728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 1190728ef9c9SSushil Singh 1191728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1192728ef9c9SSushil Singh Append To List ${trans_id_list1} ${trans_id} 1193728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 1194728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 1195728ef9c9SSushil Singh 1196728ef9c9SSushil Singh 1197728ef9c9SSushil Singh ${client_id2}= Create List 1198728ef9c9SSushil Singh Append To List ${client_id2} ${client_id_list}[1] 1199728ef9c9SSushil Singh ${session_info2}= Create Session With List Of ClientID ${client_id2} 1200728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 1201728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id2} ${session_info2} 1202728ef9c9SSushil Singh 1203728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 1204728ef9c9SSushil Singh Append To List ${trans_id_list2} ${trans_id} 1205728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 1206728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_list2} 1207728ef9c9SSushil Singh 1208728ef9c9SSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 1209728ef9c9SSushil Singh 1210728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 1211728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 1212728ef9c9SSushil Singh 1213728ef9c9SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 1214728ef9c9SSushil Singh 1215728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info2}[0] SessionToken 1216728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 1217728ef9c9SSushil Singh 1218728ef9c9SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Transaction 1219728ef9c9SSushil Singh 1220728ef9c9SSushil Singh ${trans_id_emptylist}= Create List 1221728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 1222728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_emptylist} 1223728ef9c9SSushil Singh 1224728ef9c9SSushil Singh Redfish Delete List Of Session ${session_dict_list} 1225f9a536caSSushil Singh 1226f9a536caSSushil Singh 1227f9a536caSSushil SinghVerify Lock Records For Multiple Invalid Session 1228f9a536caSSushil Singh [Documentation] Verify no lock record found for multiple invalid session. 1229f9a536caSSushil Singh [Arguments] ${client_id} 1230f9a536caSSushil Singh 1231f9a536caSSushil Singh # Description of argument(s): 1232f9a536caSSushil Singh # client_id This client id can contain string value 1233f9a536caSSushil Singh # (e.g. 12345, "HMCID"). 1234f9a536caSSushil Singh 1235f9a536caSSushil Singh ${session_dict_list}= Create List 1236f9a536caSSushil Singh ${invalid_session_ids}= Create List xxyXyyYZZz xXyXYyYZzz 1237f9a536caSSushil Singh 1238f9a536caSSushil Singh ${session_info1}= Create Session With ClientID ${client_id} 1239f9a536caSSushil Singh 1240f9a536caSSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 1241f9a536caSSushil Singh set to dictionary ${session_info2} SessionIDs ${invalid_session_ids}[0] 1242f9a536caSSushil Singh Append To List ${session_dict_list} ${session_info2} 1243f9a536caSSushil Singh 1244f9a536caSSushil Singh ${session_info3}= Copy Dictionary ${session_info1} deepcopy=True 1245f9a536caSSushil Singh set to dictionary ${session_info3} SessionIDs ${invalid_session_ids}[0] 1246f9a536caSSushil Singh Append To List ${session_dict_list} ${session_info3} 1247f9a536caSSushil Singh 1248f9a536caSSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 1249f9a536caSSushil Singh ${lock_length1}= Get Length ${lock_list1} 1250f9a536caSSushil Singh 1251f9a536caSSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_list} 1252f9a536caSSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 1253f9a536caSSushil Singh ${lock_length2}= Get Length ${lock_list_resp['Records']} 1254f9a536caSSushil Singh 1255f9a536caSSushil Singh Should Be Equal As Integers ${lock_length1} ${lock_length2} 1256f9a536caSSushil Singh 1257f9a536caSSushil Singh Redfish Delete Session ${session_info1} 125811949a2cSSushil Singh 125911949a2cSSushil Singh 126011949a2cSSushil SinghVerify Lock Records For Multiple Invalid And Valid Session 126111949a2cSSushil Singh [Documentation] Verify all records found for a valid and invalid sessions. 126211949a2cSSushil Singh [Arguments] ${client_ids} ${lock_type} 126311949a2cSSushil Singh 126411949a2cSSushil Singh # Description of argument(s): 126511949a2cSSushil Singh # client_ids This client id can contain string value 126611949a2cSSushil Singh # (e.g. 12345, "HMCID"). 126711949a2cSSushil Singh # lock_type Read lock or Write lock. 126811949a2cSSushil Singh 126911949a2cSSushil Singh ${client_id_list}= Split String ${client_ids} , 127011949a2cSSushil Singh ${lock_type_list}= Split String ${lock_type} , 127111949a2cSSushil Singh ${trans_id_list1}= Create List 127211949a2cSSushil Singh ${invalid_session_ids}= Create List xxyXyyYZZz 127311949a2cSSushil Singh 127411949a2cSSushil Singh ${session_dict_list}= Create List 127511949a2cSSushil Singh ${lock_list}= Create List 127611949a2cSSushil Singh 127711949a2cSSushil Singh ${client_id1}= Create List 127811949a2cSSushil Singh Append To List ${client_id1} ${client_id_list}[0] 127911949a2cSSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 128011949a2cSSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 128111949a2cSSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 128211949a2cSSushil Singh 128311949a2cSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 128411949a2cSSushil Singh Append To List ${trans_id_list1} ${trans_id} 128511949a2cSSushil Singh Append To List ${lock_list} ${trans_id} 128611949a2cSSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 128711949a2cSSushil Singh 128811949a2cSSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 128911949a2cSSushil Singh set to dictionary ${session_info2}[0] SessionIDs ${invalid_session_ids}[0] 129011949a2cSSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 129111949a2cSSushil Singh 129211949a2cSSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 129311949a2cSSushil Singh 129411949a2cSSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 129511949a2cSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 129611949a2cSSushil Singh 129711949a2cSSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 129811949a2cSSushil Singh 129911949a2cSSushil Singh ${trans_id_emptylist}= Create List 130011949a2cSSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 130111949a2cSSushil Singh 130211949a2cSSushil Singh Redfish Delete Session ${session_info1}[0] 1303