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 13159011d08SSushil SinghFail To Release Lock With Invalid TransactionID 13259011d08SSushil Singh [Documentation] Fail to release lock with invalid transaction id. 13359011d08SSushil Singh [Tags] Fail_To_Release_Lock_With_Invalid_TransactionID 13459011d08SSushil Singh [Template] Verify Fail To Release Lock With Invalid TransactionID 13559011d08SSushil Singh 13659011d08SSushil Singh # client_id lock_type release_lock_type 13759011d08SSushil Singh HMCID-01 ReadCase1 Transaction 13859011d08SSushil Singh 13959011d08SSushil Singh 1401b59053dSSushil SinghFail To Release Multiple Lock With Invalid TransactionID 141d03f2ce1SSushil Singh [Documentation] Release in-valid lock result in fail. 1421b59053dSSushil Singh [Tags] Fail_To_Release_Multiple_Lock_With_Invalid_TransactionID 1431b59053dSSushil Singh [Template] Verify Fail To Release Multiple Lock With Invalid TransactionID 144afdd2a1dSVijay 145d03f2ce1SSushil Singh # client_id lock_type release_lock_type 146d03f2ce1SSushil Singh HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 147d03f2ce1SSushil Singh 12345 ReadCase2,ReadCase2,ReadCase2 Transaction 148d03f2ce1SSushil Singh HMCID ReadCase3,ReadCase3,ReadCase3 Transaction 149afdd2a1dSVijay 150afdd2a1dSVijay 1518bee358fSSushil SinghFail To Release Multiple Lock With Valid And Invalid TransactionID 1528bee358fSSushil Singh [Documentation] Release multiple lock with valid and invalid trasaction. 1538bee358fSSushil Singh [Tags] Fail_To_Release_Multiple_Lock_With_Valid_And_Invalid_TransactionID 1548bee358fSSushil Singh [Template] Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID 1558bee358fSSushil Singh 1568bee358fSSushil Singh # client_id lock_type release_lock_type 1578bee358fSSushil Singh HMCID-01 ReadCase1,ReadCase1 Transaction 1588bee358fSSushil Singh 1598bee358fSSushil Singh 160*1d7b996cSsusilsi7Fail To Release Lock With String As TransactionID Data Type 161*1d7b996cSsusilsi7 [Documentation] Fail to release lock with string as transaction id data type. 162*1d7b996cSsusilsi7 [Tags] Fail_To_Release_Lock_With_String_As_TransactionID_Data_Type 163*1d7b996cSsusilsi7 [Template] Verify Fail To Release Lock With TransactionID As String Type 164*1d7b996cSsusilsi7 165*1d7b996cSsusilsi7 # client_id lock_type release_lock_type 166*1d7b996cSsusilsi7 HMCID-01 ReadCase1 Transaction 167*1d7b996cSsusilsi7 HMCID-01 WriteCase1 Transaction 168*1d7b996cSsusilsi7 169*1d7b996cSsusilsi7 170d03f2ce1SSushil SinghFail To Release Lock For Another Session 171d03f2ce1SSushil Singh [Documentation] Failed to release locks from another session. 172d03f2ce1SSushil Singh [Tags] Fail_To_Release_Lock_For_Another_Session 173d03f2ce1SSushil Singh [Template] Verify Fail To Release Lock For Another Session 174afdd2a1dSVijay 175d03f2ce1SSushil Singh # client_id lock_type 176d03f2ce1SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 177afdd2a1dSVijay 178afdd2a1dSVijay 179e33c6e6aSSushil SinghTest Invalid Resource ID Data Type Locking 180e33c6e6aSSushil Singh [Documentation] Failed to acquire lock for invalid resource id data type. 181e33c6e6aSSushil Singh [Tags] Test_Invalid_Resource_ID_Data_Type_Locking 182e33c6e6aSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type 183e33c6e6aSSushil Singh 184e33c6e6aSSushil Singh # client_id lock_type 185e33c6e6aSSushil Singh HMCID-01 ReadCase1 186e33c6e6aSSushil Singh HMCID-01 ReadCase2 187e33c6e6aSSushil Singh HMCID-01 ReadCase3 188e33c6e6aSSushil Singh HMCID-01 WriteCase1 189e33c6e6aSSushil Singh HMCID-01 WriteCase2 190e33c6e6aSSushil Singh HMCID-01 WriteCase3 191e33c6e6aSSushil Singh 192e33c6e6aSSushil Singh 193d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Type 194d03f2ce1SSushil Singh [Documentation] Failed to acquire read, write lock for invalid lock data passed. 195d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type 196d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 197afdd2a1dSVijay 198d03f2ce1SSushil Singh # client_id lock_type message 199d03f2ce1SSushil Singh HMCID-01 ReadCase1 ${BAD_REQUEST} 200d03f2ce1SSushil Singh HMCID-01 ReadCase2 ${BAD_REQUEST} 201d03f2ce1SSushil Singh HMCID-01 ReadCase3 ${BAD_REQUEST} 202d03f2ce1SSushil Singh HMCID-01 ReadCase4 ${BAD_REQUEST} 203d03f2ce1SSushil Singh HMCID-01 ReadCase5 ${BAD_REQUEST} 204d03f2ce1SSushil Singh HMCID-01 WriteCase1 ${BAD_REQUEST} 205d03f2ce1SSushil Singh HMCID-01 WriteCase2 ${BAD_REQUEST} 206d03f2ce1SSushil Singh HMCID-01 WriteCase3 ${BAD_REQUEST} 207d03f2ce1SSushil Singh HMCID-01 WriteCase4 ${BAD_REQUEST} 208d03f2ce1SSushil Singh HMCID-01 WriteCase5 ${BAD_REQUEST} 209afdd2a1dSVijay 210afdd2a1dSVijay 211d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Flag 212d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid lock flag passed. 213d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag 214d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 215afdd2a1dSVijay 216d03f2ce1SSushil Singh # client_id lock_type message 217d03f2ce1SSushil Singh HMCID-01 ReadCase6 ${BAD_REQUEST} 218d03f2ce1SSushil Singh HMCID-01 ReadCase7 ${BAD_REQUEST} 219d03f2ce1SSushil Singh HMCID-01 ReadCase8 ${BAD_REQUEST} 220d03f2ce1SSushil Singh HMCID-01 ReadCase9 ${BAD_REQUEST} 221d03f2ce1SSushil Singh HMCID-01 ReadCase10 ${BAD_REQUEST} 222d03f2ce1SSushil Singh HMCID-01 ReadCase11 ${BAD_REQUEST} 223d03f2ce1SSushil Singh HMCID-01 WriteCase6 ${BAD_REQUEST} 224d03f2ce1SSushil Singh HMCID-01 WriteCase7 ${BAD_REQUEST} 225d03f2ce1SSushil Singh HMCID-01 WriteCase8 ${BAD_REQUEST} 226d03f2ce1SSushil Singh HMCID-01 WriteCase9 ${BAD_REQUEST} 227d03f2ce1SSushil Singh HMCID-01 WriteCase10 ${BAD_REQUEST} 228d03f2ce1SSushil Singh HMCID-01 WriteCase11 ${BAD_REQUEST} 229afdd2a1dSVijay 230afdd2a1dSVijay 231d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Segment Flag 232d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 233d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag 234d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 235d03f2ce1SSushil Singh 236d03f2ce1SSushil Singh # client_id lock_type message 237d03f2ce1SSushil Singh HMCID-01 ReadCase12 ${BAD_REQUEST} 238d03f2ce1SSushil Singh HMCID-01 ReadCase13 ${BAD_REQUEST} 239d03f2ce1SSushil Singh HMCID-01 ReadCase14 ${BAD_REQUEST} 240d03f2ce1SSushil Singh HMCID-01 WriteCase12 ${BAD_REQUEST} 241d03f2ce1SSushil Singh HMCID-01 WriteCase13 ${BAD_REQUEST} 242d03f2ce1SSushil Singh HMCID-01 WriteCase14 ${BAD_REQUEST} 243afdd2a1dSVijay 244bace3005SSushil Singh 2453b3a7ecaSSushil SinghFail To Acquire Lock For Invalid Segment Data Type Flag 2463b3a7ecaSSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 2473b3a7ecaSSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Data_Type_Flag 2483b3a7ecaSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 2493b3a7ecaSSushil Singh 2503b3a7ecaSSushil Singh # client_id lock_type message 2513b3a7ecaSSushil Singh HMCID-01 ReadCase15 ${EMPTY} 2523b3a7ecaSSushil Singh HMCID-01 ReadCase16 ${EMPTY} 2533b3a7ecaSSushil Singh HMCID-01 ReadCase17 ${EMPTY} 2543b3a7ecaSSushil Singh HMCID-01 ReadCase18 ${EMPTY} 2553b3a7ecaSSushil Singh HMCID-01 WriteCase15 ${EMPTY} 2563b3a7ecaSSushil Singh HMCID-01 WriteCase16 ${EMPTY} 2573b3a7ecaSSushil Singh HMCID-01 WriteCase17 ${EMPTY} 2583b3a7ecaSSushil Singh HMCID-01 WriteCase18 ${EMPTY} 2593b3a7ecaSSushil Singh 2603b3a7ecaSSushil Singh 261bace3005SSushil SinghGet Empty Lock Records For Session Where No Locks Acquired 262bace3005SSushil Singh [Documentation] If session does not acquire locks then get lock should return 263bace3005SSushil Singh ... empty lock records. 264bace3005SSushil Singh [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired 265bace3005SSushil Singh [Template] Verify No Locks Records For Session With No Acquired Lock 266bace3005SSushil Singh 267bace3005SSushil Singh # client_id 268bace3005SSushil Singh HMCID-01 269bace3005SSushil Singh 270728ef9c9SSushil Singh 271f9a536caSSushil SinghGet Lock Records Empty For Invalid Session 272f9a536caSSushil Singh [Documentation] Record of lock list is empty for invalid session. 273f9a536caSSushil Singh [Tags] Get_Lock_Records_Empty_For_Invalid_Session 274f9a536caSSushil Singh [Template] Verify Empty Lock Records For Invalid Session 275f9a536caSSushil Singh 276f9a536caSSushil Singh # client_id 277f9a536caSSushil Singh HMCID-01 278f9a536caSSushil Singh 279f9a536caSSushil Singh 280728ef9c9SSushil SinghGet Lock Records For Multiple Session 281728ef9c9SSushil Singh [Documentation] Get lock records of multiple session. 282728ef9c9SSushil Singh [Tags] Get_Lock_Records_For_Multiple_Session 283728ef9c9SSushil Singh [Template] Verify Lock Records Of Multiple Session 284728ef9c9SSushil Singh 285728ef9c9SSushil Singh # client_ids lock_type 286728ef9c9SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 287728ef9c9SSushil Singh 288728ef9c9SSushil Singh 289f9a536caSSushil SinghGet Lock Records For Multiple Invalid Session 290f9a536caSSushil Singh [Documentation] Record of lock list is empty for list of invalid session. 291f9a536caSSushil Singh [Tags] Get_Lock_Records_For_Multiple_Invalid_Session 292f9a536caSSushil Singh [Template] Verify Lock Records For Multiple Invalid Session 293f9a536caSSushil Singh 294f9a536caSSushil Singh # client_id 295f9a536caSSushil Singh HMCID-01 296f9a536caSSushil Singh 29711949a2cSSushil Singh 29811949a2cSSushil SinghGet Lock Records For Multiple Invalid And Valid Session 29911949a2cSSushil Singh [Documentation] Get record of lock from invalid and valid session. 30011949a2cSSushil Singh [Tags] Get_Lock_Records_For_Multiple_Invalid_And_Valid_Session 30111949a2cSSushil Singh [Template] Verify Lock Records For Multiple Invalid And Valid Session 30211949a2cSSushil Singh 30311949a2cSSushil Singh # client_id lock_type 30411949a2cSSushil Singh HMCID-01,HMCID-02 ReadCase1 30511949a2cSSushil Singh 306bc331e22SVijay*** Keywords *** 307bc331e22SVijay 308d03f2ce1SSushil SinghCreate Redfish Session With ClientID 309d03f2ce1SSushil Singh [Documentation] Create redifish session with client id. 310d03f2ce1SSushil Singh [Arguments] ${client_id} 31185610eeeSVijay 31285610eeeSVijay # Description of argument(s): 313d03f2ce1SSushil Singh # client_id This client id can contain string value 314d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 31585610eeeSVijay 316d03f2ce1SSushil Singh ${session_info}= Create Dictionary 317d03f2ce1SSushil Singh ${session}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}} 31885610eeeSVijay 319d03f2ce1SSushil Singh Set To Dictionary ${session_info} SessionIDs ${session['Id']} 320d03f2ce1SSushil Singh Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]} 32185610eeeSVijay 322d03f2ce1SSushil Singh [Return] ${session_info} 32385610eeeSVijay 32485610eeeSVijay 325d03f2ce1SSushil SinghRW General Dictionary 32616b3c7bfSGeorge Keishing [Documentation] Create dictionary of lock request. 327d03f2ce1SSushil Singh [Arguments] ${read_case} ${res_id} 328bc331e22SVijay 329bc331e22SVijay # Description of argument(s): 330d03f2ce1SSushil Singh # read_case Read or Write lock type. 331d03f2ce1SSushil Singh # res_id Resource id. 332bc331e22SVijay 333d03f2ce1SSushil Singh ${request_dict}= Create Dictionary 334566daaf3SGeorge Keishing 335d03f2ce1SSushil Singh FOR ${key} IN @{read_case.keys()} 336d03f2ce1SSushil Singh Set To Dictionary ${request_dict} LockType ${key} 337d03f2ce1SSushil Singh Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]} 338d03f2ce1SSushil Singh END 339bc331e22SVijay 340d03f2ce1SSushil Singh Set To Dictionary ${request_dict} ResourceID ${res_id} 341d03f2ce1SSushil Singh 342d03f2ce1SSushil Singh [Return] ${request_dict} 343bc331e22SVijay 344bc331e22SVijay 345d03f2ce1SSushil SinghReturn Description Of Response 346d03f2ce1SSushil Singh [Documentation] Return description of REST response. 347bc331e22SVijay [Arguments] ${resp_text} 348bc331e22SVijay 349bc331e22SVijay # Description of argument(s): 350d03f2ce1SSushil Singh # resp_text REST response body. 351bc331e22SVijay 352d03f2ce1SSushil Singh # resp_text after successful partition file upload looks like: 353d03f2ce1SSushil Singh # { 354d03f2ce1SSushil Singh # "Description": "File Created" 355d03f2ce1SSushil Singh # } 356bc331e22SVijay 357d03f2ce1SSushil Singh ${message}= Evaluate json.loads('''${resp_text}''') json 358d03f2ce1SSushil Singh 359d03f2ce1SSushil Singh [Return] ${message} 360bc331e22SVijay 361bc331e22SVijay 362a7d71f02SSushil SinghVerify Redfish Session Deleted 363a7d71f02SSushil Singh [Documentation] Verify the redfish session is deleted. 364a7d71f02SSushil Singh [Arguments] ${session_info} 365a7d71f02SSushil Singh 366a7d71f02SSushil Singh # Description of argument(s): 367a7d71f02SSushil Singh # session_info Session information are stored in dictionary. 368a7d71f02SSushil Singh 369a7d71f02SSushil Singh # ${session_info} = { 370a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 371a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 372a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 373a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 374a7d71f02SSushil Singh # } 375a7d71f02SSushil Singh 376a7d71f02SSushil Singh # SessionIDs : Session IDs 377a7d71f02SSushil Singh # ClientID : Client ID 378a7d71f02SSushil Singh # SessionToken : Session token 379a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 380a7d71f02SSushil Singh 381a7d71f02SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions 382a7d71f02SSushil Singh 383a7d71f02SSushil Singh FOR ${session} IN @{sessions['Members']} 384a7d71f02SSushil Singh Should Not Be Equal As Strings session ['/redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}'] 385a7d71f02SSushil Singh END 386a7d71f02SSushil Singh 387a7d71f02SSushil Singh 388a7d71f02SSushil SinghVerify Redfish List Of Session Deleted 389a7d71f02SSushil Singh [Documentation] Verify all the list of redfish session is deleted. 390a7d71f02SSushil Singh [Arguments] ${session_info_list} 391a7d71f02SSushil Singh 392a7d71f02SSushil Singh # Description of argument(s): 393a7d71f02SSushil Singh # session_info_list List contains individual session record are stored in dictionary. 394a7d71f02SSushil Singh 395a7d71f02SSushil Singh # ${session_info_list} = [{ 396a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 397a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 398a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 399a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 400a7d71f02SSushil Singh # }] 401a7d71f02SSushil Singh 402a7d71f02SSushil Singh # SessionIDs : Session IDs 403a7d71f02SSushil Singh # ClientID : Client ID 404a7d71f02SSushil Singh # SessionToken : Session token 405a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 406a7d71f02SSushil Singh 407a7d71f02SSushil Singh FOR ${session_record} IN @{session_info_list} 408a7d71f02SSushil Singh Verify Redfish Session Deleted ${session_record} 409a7d71f02SSushil Singh END 410a7d71f02SSushil Singh 411a7d71f02SSushil Singh 412d03f2ce1SSushil SinghRedfish Post Acquire Lock 413d03f2ce1SSushil Singh [Documentation] Acquire and release lock. 414d03f2ce1SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 415bc331e22SVijay 416bc331e22SVijay # Description of argument(s): 417d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 418d03f2ce1SSushil Singh # status_code HTTP status code. 419bc331e22SVijay 420e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Lock ${lock_type} 421e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 422d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 423df390b61SSushil Singh 424df390b61SSushil Singh Run Keyword If ${status_code} == ${HTTP_BAD_REQUEST} 425df390b61SSushil Singh ... Valid Value ${BAD_REQUEST} ['${resp.content}'] 426df390b61SSushil Singh ... ELSE 427df390b61SSushil Singh ... Run Keyword And Return Return Description Of Response ${resp.content} 428bc331e22SVijay 429d03f2ce1SSushil Singh [Return] ${resp} 430bc331e22SVijay 431bc331e22SVijay 432977f8f58SSushil SinghRedfish Post Acquire List Lock 433977f8f58SSushil Singh [Documentation] Acquire and release lock. 434977f8f58SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 435977f8f58SSushil Singh 436977f8f58SSushil Singh # Description of argument(s): 437977f8f58SSushil Singh # lock_type Read lock or Write lock. 438977f8f58SSushil Singh # status_code HTTP status code. 439977f8f58SSushil Singh 440977f8f58SSushil Singh ${lock_dict_param}= Create Data To Acquire List Of Lock ${lock_type} 441977f8f58SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 442977f8f58SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 443977f8f58SSushil Singh 444977f8f58SSushil Singh [Return] ${resp} 445977f8f58SSushil Singh 446977f8f58SSushil Singh 447d03f2ce1SSushil SinghRedfish Post Acquire Invalid Lock 448d03f2ce1SSushil Singh [Documentation] Redfish to post request to acquire in-valid lock. 449d03f2ce1SSushil Singh [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK} 450bc331e22SVijay 451bc331e22SVijay # Description of argument(s): 452d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 453d03f2ce1SSushil Singh # message Return message from URI. 454d03f2ce1SSushil Singh # status_code HTTP status code. 455bc331e22SVijay 456e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type} 457e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 458d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 4593b3a7ecaSSushil Singh Run Keyword If '${message}' != '${EMPTY}' 4603b3a7ecaSSushil Singh ... Valid Value message ['${resp.content}'] 461d03f2ce1SSushil Singh 462d03f2ce1SSushil Singh [Return] ${resp} 463bc331e22SVijay 464bc331e22SVijay 465e33c6e6aSSushil SinghRedfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 466e33c6e6aSSushil Singh [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id. 467e33c6e6aSSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 468e33c6e6aSSushil Singh 469e33c6e6aSSushil Singh # Description of argument(s): 470e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 471e33c6e6aSSushil Singh # status_code HTTP status code. 472e33c6e6aSSushil Singh 473e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type} 474e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 475e33c6e6aSSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 476e33c6e6aSSushil Singh 477e33c6e6aSSushil Singh [Return] ${resp} 478e33c6e6aSSushil Singh 479e33c6e6aSSushil Singh 480d03f2ce1SSushil SinghForm Data To Acquire Lock 48116b3c7bfSGeorge Keishing [Documentation] Create a dictionary for lock request. 482d03f2ce1SSushil Singh [Arguments] ${lock_type} 483d03f2ce1SSushil Singh 484d03f2ce1SSushil Singh # Description of argument(s): 485d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 486d03f2ce1SSushil Singh 487d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 488d03f2ce1SSushil Singh ${resp}= RW General Dictionary 489d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 490d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 491d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 492e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 493d03f2ce1SSushil Singh 494e33c6e6aSSushil Singh [Return] ${lock_request_dict} 495e33c6e6aSSushil Singh 496e33c6e6aSSushil Singh 497977f8f58SSushil SinghCreate Data To Acquire List Of Lock 49816b3c7bfSGeorge Keishing [Documentation] Create a dictionary for list of lock request. 499977f8f58SSushil Singh [Arguments] ${lock_type_list} 500977f8f58SSushil Singh 501977f8f58SSushil Singh # Description of argument(s): 502977f8f58SSushil Singh # lock_type Read lock or Write lock. 503977f8f58SSushil Singh 504977f8f58SSushil Singh ${temp_list}= Create List 505977f8f58SSushil Singh ${lock_res_info}= Get Lock Resource Information 506977f8f58SSushil Singh 507977f8f58SSushil Singh FOR ${lock_type} IN @{lock_type_list} 508977f8f58SSushil Singh ${resp}= RW General Dictionary 509977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 510977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 511977f8f58SSushil Singh Append To List ${temp_list} ${resp} 512977f8f58SSushil Singh END 513977f8f58SSushil Singh 514977f8f58SSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 515977f8f58SSushil Singh 516977f8f58SSushil Singh [Return] ${lock_request_dict} 517977f8f58SSushil Singh 518977f8f58SSushil Singh 519e33c6e6aSSushil SinghForm Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID 52016b3c7bfSGeorge Keishing [Documentation] Create a dictionary for in-valid lock request. 521e33c6e6aSSushil Singh [Arguments] ${lock_type} 522e33c6e6aSSushil Singh 523e33c6e6aSSushil Singh # Description of argument(s): 524e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 525e33c6e6aSSushil Singh 526e33c6e6aSSushil Singh ${lock_res_info}= Get Lock Resource Information 527e33c6e6aSSushil Singh ${resp}= RW General Dictionary 528e33c6e6aSSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 529e33c6e6aSSushil Singh ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]} 530e33c6e6aSSushil Singh ${temp_list}= Create List ${resp} 531e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 532e33c6e6aSSushil Singh 533e33c6e6aSSushil Singh [Return] ${lock_request_dict} 534d03f2ce1SSushil Singh 535d03f2ce1SSushil Singh 536d03f2ce1SSushil SinghForm Data To Acquire Invalid Lock 53716b3c7bfSGeorge Keishing [Documentation] Create a dictionary for in-valid lock request. 538d03f2ce1SSushil Singh [Arguments] ${lock_type} 539d03f2ce1SSushil Singh 540d03f2ce1SSushil Singh # Description of argument(s): 541d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 542d03f2ce1SSushil Singh 543d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 544d03f2ce1SSushil Singh ${resp}= RW General Dictionary 545d03f2ce1SSushil Singh ... ${lock_res_info["Invalid Case"]["${lock_type}"]} 546d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 547d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 548e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 549d03f2ce1SSushil Singh 550e33c6e6aSSushil Singh [Return] ${lock_request_dict} 551d03f2ce1SSushil Singh 552d03f2ce1SSushil Singh 553d03f2ce1SSushil SinghGet Locks List On Resource 554bc331e22SVijay [Documentation] Get locks list. 555d03f2ce1SSushil Singh [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK} 556bc331e22SVijay 557bc331e22SVijay # Description of argument(s): 558d03f2ce1SSushil Singh # session_info Session information in dict. 559d03f2ce1SSushil Singh # exp_status_code Expected HTTP status code. 560bc331e22SVijay 561d03f2ce1SSushil Singh ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]} 562566daaf3SGeorge Keishing ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 563566daaf3SGeorge Keishing ... data=${data} 564bc331e22SVijay ${locks}= Evaluate json.loads('''${resp.text}''') json 565bc331e22SVijay 566bc331e22SVijay [Return] ${locks["Records"]} 567bc331e22SVijay 568bc331e22SVijay 569d03f2ce1SSushil SinghVerify Lock On Resource 570d03f2ce1SSushil Singh [Documentation] Verify lock on resource. 571d03f2ce1SSushil Singh [Arguments] ${session_info} ${transaction_id} 572bc331e22SVijay 573bc331e22SVijay # Description of argument(s): 574d03f2ce1SSushil Singh # session_info Session information in dict. 575d03f2ce1SSushil Singh # transaction_id Transaction id in list stored in dict. 576bc331e22SVijay 577d03f2ce1SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']} 578d03f2ce1SSushil Singh Rprint Vars sessions 579d03f2ce1SSushil Singh ${lock_list}= Get Locks List On Resource ${session_info} 580d03f2ce1SSushil Singh ${lock_length}= Get Length ${lock_list} 581d03f2ce1SSushil Singh ${tran_id_length}= Get Length ${transaction_id} 582d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id_length} ${lock_length} 583afdd2a1dSVijay 584d03f2ce1SSushil Singh FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list} 585d03f2ce1SSushil Singh Valid Value session_info['ClientID'] ['${lock['HMCID']}'] 586d03f2ce1SSushil Singh Valid Value session_info['SessionIDs'] ['${lock['SessionID']}'] 587d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']} 588bc331e22SVijay END 589bc331e22SVijay 590bc331e22SVijay 591d03f2ce1SSushil SinghAcquire Lock On Resource 592d03f2ce1SSushil Singh [Documentation] Acquire lock on resource. 593d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False 594bc331e22SVijay 595bc331e22SVijay # Description of argument(s): 596d03f2ce1SSushil Singh # client_id This client id can contain string value 597d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 598d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 599d03f2ce1SSushil Singh # reboot_flag Flag is used to run reboot the BMC code. 600d03f2ce1SSushil Singh # (e.g. True or False). 601bc331e22SVijay 602d03f2ce1SSushil Singh ${trans_id_list}= Create List 603d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 604d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 605d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 606d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 607566daaf3SGeorge Keishing 608e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 609bc331e22SVijay 610d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'True' 611d03f2ce1SSushil Singh ... Run Keywords Redfish OBMC Reboot (off) AND 612d03f2ce1SSushil Singh ... Redfish Login AND 613e33c6e6aSSushil Singh ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND 614d03f2ce1SSushil Singh ... Verify Lock On Resource ${session_info} ${trans_id_list} AND 615d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 616bc331e22SVijay 617d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'False' 618d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 619bc331e22SVijay 620d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 621d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 622d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 623bc331e22SVijay 624bc331e22SVijay 625d03f2ce1SSushil SinghForm Data To Release Lock 626d03f2ce1SSushil Singh [Documentation] Create a dictonay to release lock. 627d03f2ce1SSushil Singh [Arguments] ${trans_id_list} 628355daac7SVijay 629355daac7SVijay # Description of argument(s): 630d03f2ce1SSushil Singh # trans_id_list 631355daac7SVijay 632d03f2ce1SSushil Singh @{tran_ids}= Create List 633355daac7SVijay 634d03f2ce1SSushil Singh FOR ${item} IN @{trans_id_list} 635d03f2ce1SSushil Singh Append To List ${tran_ids} ${item['TransactionID']} 636d03f2ce1SSushil Singh END 637d03f2ce1SSushil Singh 638d03f2ce1SSushil Singh [Return] ${tran_ids} 639d03f2ce1SSushil Singh 640d03f2ce1SSushil Singh 641d03f2ce1SSushil SinghRelease Locks On Resource 642d03f2ce1SSushil Singh [Documentation] Redfish request to release a lock. 643d03f2ce1SSushil Singh [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction ${status_code}=${HTTP_OK} 644d03f2ce1SSushil Singh 645d03f2ce1SSushil Singh # Description of argument(s): 646d03f2ce1SSushil Singh # session_info Session information in dict. 647d03f2ce1SSushil Singh # trans_id_list Transaction id list. 648d03f2ce1SSushil Singh # release_lock_type Release lock by Transaction, Session. 649d03f2ce1SSushil Singh # status_code HTTP status code. 650d03f2ce1SSushil Singh 651d03f2ce1SSushil Singh ${tran_ids}= Form Data To Release Lock ${trans_id_list} 652d03f2ce1SSushil Singh ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}} 653d03f2ce1SSushil Singh ${data}= Evaluate json.dumps(${data}) json 654d03f2ce1SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data} 655d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 656d03f2ce1SSushil Singh 657d03f2ce1SSushil Singh 658df390b61SSushil SinghRelease locks And Delete Session 659df390b61SSushil Singh [Documentation] Release locks and delete redfish session. 660df390b61SSushil Singh [Arguments] ${session_info} ${trans_id_list} 661df390b61SSushil Singh 662df390b61SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} 663df390b61SSushil Singh 664df390b61SSushil Singh ${trans_id_emptylist}= Create List 665df390b61SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 666df390b61SSushil Singh 667df390b61SSushil Singh Redfish Delete Session ${session_info} 668df390b61SSushil Singh 669df390b61SSushil Singh 670d03f2ce1SSushil SinghAcquire Lock On Another Lock 671d03f2ce1SSushil Singh [Documentation] Acquire lock on another lock. 672d03f2ce1SSushil Singh [Arguments] ${client_id} 673d03f2ce1SSushil Singh 674d03f2ce1SSushil Singh # Description of argument(s): 675d03f2ce1SSushil Singh # client_id This client id can contain string value 676d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 677d03f2ce1SSushil Singh 678d03f2ce1SSushil Singh ${trans_id_list}= Create List 679d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 680d03f2ce1SSushil Singh 681d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 682d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 683d03f2ce1SSushil Singh 684d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 685d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 686d03f2ce1SSushil Singh 687d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 688d03f2ce1SSushil Singh 689df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 690d03f2ce1SSushil Singh 691d03f2ce1SSushil Singh 692977f8f58SSushil SinghVerify Fail To Acquire Read And Write In Single Request 693977f8f58SSushil Singh [Documentation] Verify fail to acquire read and write lock passed in single request. 694977f8f58SSushil Singh [Arguments] ${client_id} ${lock_type} 695977f8f58SSushil Singh 696977f8f58SSushil Singh # Description of argument(s): 697977f8f58SSushil Singh # client_id This client id can contain string value 698977f8f58SSushil Singh # (e.g. 12345, "HMCID"). 699977f8f58SSushil Singh # lock_type Read lock or Write lock. 700977f8f58SSushil Singh 701977f8f58SSushil Singh ${lock_type_list}= Split String ${lock_type} , 702977f8f58SSushil Singh 703977f8f58SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 704977f8f58SSushil Singh ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list} status_code=${HTTP_BAD_REQUEST} 705977f8f58SSushil Singh Redfish Delete Session ${session_info} 706977f8f58SSushil Singh 707977f8f58SSushil Singh 708d03f2ce1SSushil SinghVerify Empty Lock Records For Invalid Session 709d03f2ce1SSushil Singh [Documentation] Verify no lock record found for invalid session. 710d03f2ce1SSushil Singh [Arguments] ${client_id} 711d03f2ce1SSushil Singh 712d03f2ce1SSushil Singh # Description of argument(s): 713d03f2ce1SSushil Singh # client_id This client id can contain string value 714d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 715d03f2ce1SSushil Singh 716d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_id} 717d03f2ce1SSushil Singh 718d03f2ce1SSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 719d03f2ce1SSushil Singh ${lock_length1}= Get Length ${lock_list1} 720d03f2ce1SSushil Singh 721d03f2ce1SSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 722d03f2ce1SSushil Singh set to dictionary ${session_info2} SessionIDs xxyXyyYZZz 723d03f2ce1SSushil Singh 724d03f2ce1SSushil Singh ${lock_list2}= Get Locks List On Resource ${session_info2} 725f9a536caSSushil Singh ${lock_length2}= Get Length ${lock_list2} 726d03f2ce1SSushil Singh 727f9a536caSSushil Singh Should Be Equal As Integers ${lock_length1} ${lock_length2} 728d03f2ce1SSushil Singh 729d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 730d03f2ce1SSushil Singh 731d03f2ce1SSushil Singh 732d03f2ce1SSushil SinghVerify Acquire Lock Fails On Another Lock 733d03f2ce1SSushil Singh [Documentation] Verify acquire lock on another lock fails. 734d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 735d03f2ce1SSushil Singh 736d03f2ce1SSushil Singh # Description of argument(s): 737d03f2ce1SSushil Singh # client_id This client id can contain string value 738d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 739d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 740d03f2ce1SSushil Singh 741d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 742d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 743d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 744d03f2ce1SSushil Singh 745d03f2ce1SSushil Singh ${trans_id_list}= Create List 746d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 747d03f2ce1SSushil Singh 748d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 749d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 750d03f2ce1SSushil Singh 751df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 752d03f2ce1SSushil Singh 753d03f2ce1SSushil Singh 754e33c6e6aSSushil SinghVerify Acquire Lock After Reboot 755e33c6e6aSSushil Singh [Documentation] Acquire read and write lock after the reboot and release lock. 756e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 757e33c6e6aSSushil Singh 758e33c6e6aSSushil Singh # Description of argument(s): 759e33c6e6aSSushil Singh # client_id This client id can contain string value 760e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 761e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 762e33c6e6aSSushil Singh 763e33c6e6aSSushil Singh ${trans_id_list}= Create List 764f9a536caSSushil Singh ${session_info}= Create Session With ClientID ${client_id} 765e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 766e33c6e6aSSushil Singh Redfish OBMC Reboot (off) 767e33c6e6aSSushil Singh Redfish Login 768e33c6e6aSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} 769e33c6e6aSSushil Singh 770e33c6e6aSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 771e33c6e6aSSushil Singh Append To List ${trans_id_list} ${trans_id} 772e33c6e6aSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 773e33c6e6aSSushil Singh 774df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 775df390b61SSushil Singh 776df390b61SSushil Singh 777df390b61SSushil SinghVerify Acquire Multiple Lock Request At CEC Level 778df390b61SSushil Singh [Documentation] Acquire lock in loop. 779df390b61SSushil Singh [Arguments] ${client_id} ${lock_type} 780df390b61SSushil Singh 781df390b61SSushil Singh # Description of argument(s): 782df390b61SSushil Singh # client_id This client id can contain string value 783df390b61SSushil Singh # (e.g. 12345, "HMCID"). 784df390b61SSushil Singh # lock_type Read lock or Write lock. 785df390b61SSushil Singh 786df390b61SSushil Singh ${trans_id_list}= Create List 787df390b61SSushil Singh @{lock_type_list}= Split String ${lock_type} , 788df390b61SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 789df390b61SSushil Singh 790df390b61SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 791df390b61SSushil Singh Append To List ${trans_id_list} ${trans_id} 792df390b61SSushil Singh 793df390b61SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 794df390b61SSushil Singh 795df390b61SSushil Singh Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 796df390b61SSushil Singh 797df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 798e33c6e6aSSushil Singh 799e33c6e6aSSushil Singh 800d03f2ce1SSushil SinghVerify Acquire And Release Lock In Loop 801d03f2ce1SSushil Singh [Documentation] Acquire lock in loop. 802d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 803d03f2ce1SSushil Singh 804d03f2ce1SSushil Singh # Description of argument(s): 805d03f2ce1SSushil Singh # client_id This client id can contain string value 806d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 807d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 808d03f2ce1SSushil Singh 809d03f2ce1SSushil Singh FOR ${count} IN RANGE 1 11 810d03f2ce1SSushil Singh ${trans_id_list}= Create List 811d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 812d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 813d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 814d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 815d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 816d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 817d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 818d03f2ce1SSushil Singh END 819d03f2ce1SSushil Singh 820d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 821d03f2ce1SSushil Singh 822d03f2ce1SSushil Singh 823d03f2ce1SSushil SinghAcquire And Release Multiple Locks 824d03f2ce1SSushil Singh [Documentation] Acquire mutilple locks on resource. 825d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 826d03f2ce1SSushil Singh 827d03f2ce1SSushil Singh # Description of argument(s): 828d03f2ce1SSushil Singh # client_id This client id can contain string value 829d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 830d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 831d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 832d03f2ce1SSushil Singh 833d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 834d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 835d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 836d03f2ce1SSushil Singh 837d03f2ce1SSushil Singh ${trans_id_list}= Create List 838d03f2ce1SSushil Singh 839d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 840d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 841d03f2ce1SSushil Singh 842d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 843d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 844d03f2ce1SSushil Singh 845d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 846d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 847d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 848d03f2ce1SSushil Singh 849d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 850d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 851d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 852d03f2ce1SSushil Singh 853d03f2ce1SSushil Singh 85459011d08SSushil SinghVerify Fail To Release Lock With Invalid TransactionID 85516b3c7bfSGeorge Keishing [Documentation] Verify fail to be release lock with invalid transaction ID. 85659011d08SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 85759011d08SSushil Singh 85859011d08SSushil Singh # Description of argument(s): 85959011d08SSushil Singh # client_id This client id can contain string value 86059011d08SSushil Singh # (e.g. 12345, "HMCID"). 86159011d08SSushil Singh # lock_type Read lock or Write lock. 86259011d08SSushil Singh # release_lock_type The value can be Transaction or Session. 86359011d08SSushil Singh 86459011d08SSushil Singh ${trans_id_list}= Create List 86559011d08SSushil Singh @{lock_type_list}= Split String ${lock_type} , 86659011d08SSushil Singh 86759011d08SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 86859011d08SSushil Singh 86959011d08SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 87059011d08SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 87159011d08SSushil Singh ${value}= Evaluate ${value} + 10 87259011d08SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 87359011d08SSushil Singh Append To List ${trans_id_list} ${trans_id} 87459011d08SSushil Singh 87559011d08SSushil Singh Release Locks On Resource 87659011d08SSushil Singh ... ${session_info} ${trans_id_list} 87759011d08SSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 87859011d08SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 87959011d08SSushil Singh 88059011d08SSushil Singh ${trans_id_emptylist}= Create List 88159011d08SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 88259011d08SSushil Singh Redfish Delete Session ${session_info} 88359011d08SSushil Singh 88459011d08SSushil Singh 8851b59053dSSushil SinghVerify Fail To Release Multiple Lock With Invalid TransactionID 8861b59053dSSushil Singh [Documentation] Verify release multiple locks with invalid transaction ID fails. 887d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 888d03f2ce1SSushil Singh 889d03f2ce1SSushil Singh # Description of argument(s): 890d03f2ce1SSushil Singh # client_id This client id can contain string value 891d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 892d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 893d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 894d03f2ce1SSushil Singh 895d03f2ce1SSushil Singh ${trans_id_list}= Create List 896d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 897d03f2ce1SSushil Singh 898d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 899d03f2ce1SSushil Singh 900d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 901d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 902d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 903d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 904d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 905d03f2ce1SSushil Singh 906d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 907d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 908d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 909d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 910d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 911d03f2ce1SSushil Singh 912d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 913d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 914d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 915d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 916d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 917d03f2ce1SSushil Singh 918d03f2ce1SSushil Singh Release Locks On Resource 919d03f2ce1SSushil Singh ... ${session_info} ${trans_id_list} 920d03f2ce1SSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 921d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 922d03f2ce1SSushil Singh 923d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 924d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 925d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 926d03f2ce1SSushil Singh 927d03f2ce1SSushil Singh 9288bee358fSSushil SinghVerify Fail To Release Multiple Lock With Valid And Invalid TransactionID 9298bee358fSSushil Singh [Documentation] Verify fail to be release multiple lock with valid and invalid trasaction ID. 9308bee358fSSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 9318bee358fSSushil Singh 9328bee358fSSushil Singh # Description of argument(s): 9338bee358fSSushil Singh # client_id This client id can contain string value 9348bee358fSSushil Singh # (e.g. 12345, "HMCID"). 9358bee358fSSushil Singh # lock_type Read lock or Write lock. 9368bee358fSSushil Singh # release_lock_type The value can be Transaction or Session. 9378bee358fSSushil Singh 9388bee358fSSushil Singh ${trans_id_list}= Create List 9398bee358fSSushil Singh @{lock_type_list}= Split String ${lock_type} , 9408bee358fSSushil Singh 9418bee358fSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 9428bee358fSSushil Singh 9438bee358fSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 9448bee358fSSushil Singh Append To List ${trans_id_list} ${trans_id} 9458bee358fSSushil Singh 9468bee358fSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 9478bee358fSSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 9488bee358fSSushil Singh ${value}= Evaluate ${value} + 10 9498bee358fSSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 9508bee358fSSushil Singh Append To List ${trans_id_list} ${trans_id} 9518bee358fSSushil Singh 9528bee358fSSushil Singh Release Locks On Resource 9538bee358fSSushil Singh ... ${session_info} ${trans_id_list} 9548bee358fSSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 9558bee358fSSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 9568bee358fSSushil Singh 9578bee358fSSushil Singh ${trans_id_emptylist}= Create List 9588bee358fSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 9598bee358fSSushil Singh Redfish Delete Session ${session_info} 9608bee358fSSushil Singh 9618bee358fSSushil Singh 962*1d7b996cSsusilsi7Verify Fail To Release Lock With TransactionID As String Type 963*1d7b996cSsusilsi7 [Documentation] Verify fail to be release lock with trasaction ID as string data type. 964*1d7b996cSsusilsi7 [Arguments] ${client_id} ${lock_type} ${release_lock_type} 965*1d7b996cSsusilsi7 966*1d7b996cSsusilsi7 # Description of argument(s): 967*1d7b996cSsusilsi7 # client_id This client id can contain string value 968*1d7b996cSsusilsi7 # (e.g. 12345, "HMCID"). 969*1d7b996cSsusilsi7 # lock_type Read lock or Write lock. 970*1d7b996cSsusilsi7 # release_lock_type The value can be Transaction or Session. 971*1d7b996cSsusilsi7 972*1d7b996cSsusilsi7 ${trans_id_list}= Create List 973*1d7b996cSsusilsi7 @{lock_type_list}= Split String ${lock_type} , 974*1d7b996cSsusilsi7 975*1d7b996cSsusilsi7 ${session_info}= Create Redfish Session With ClientID ${client_id} 976*1d7b996cSsusilsi7 977*1d7b996cSsusilsi7 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 978*1d7b996cSsusilsi7 979*1d7b996cSsusilsi7 Append To List ${trans_id_list} ${trans_id} 980*1d7b996cSsusilsi7 981*1d7b996cSsusilsi7 ${temp_trans_id_list}= Copy Dictionary ${trans_id_list} deepcopy=True 982*1d7b996cSsusilsi7 983*1d7b996cSsusilsi7 ${value}= Get From Dictionary ${trans_id_list}[0] TransactionID 984*1d7b996cSsusilsi7 ${value}= Set Variable \'${value}\' 985*1d7b996cSsusilsi7 Set To Dictionary ${temp_trans_id_list}[0] TransactionID ${value} 986*1d7b996cSsusilsi7 987*1d7b996cSsusilsi7 Release Locks On Resource 988*1d7b996cSsusilsi7 ... ${session_info} ${temp_trans_id_list} 989*1d7b996cSsusilsi7 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 990*1d7b996cSsusilsi7 991*1d7b996cSsusilsi7 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 992*1d7b996cSsusilsi7 993*1d7b996cSsusilsi7 ${trans_id_emptylist}= Create List 994*1d7b996cSsusilsi7 Verify Lock On Resource ${session_info} ${trans_id_emptylist} 995*1d7b996cSsusilsi7 Redfish Delete Session ${session_info} 996*1d7b996cSsusilsi7 997*1d7b996cSsusilsi7 998d03f2ce1SSushil SinghVerify Fail To Release Lock For Another Session 999d03f2ce1SSushil Singh [Documentation] Verify failed to release the lock form another session. 1000d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 1001d03f2ce1SSushil Singh 1002d03f2ce1SSushil Singh # Description of argument(s): 1003d03f2ce1SSushil Singh # client_id This client id can contain string value 1004d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 1005d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 1006d03f2ce1SSushil Singh 1007d03f2ce1SSushil Singh ${client_ids}= Split String ${client_id} , 1008d03f2ce1SSushil Singh ${lock_type_list}= Split String ${lock_type} , 1009d03f2ce1SSushil Singh ${trans_id_list1}= Create List 1010d03f2ce1SSushil Singh ${trans_id_list2}= Create List 1011d03f2ce1SSushil Singh 1012d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0] 1013d03f2ce1SSushil Singh 1014d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1015d03f2ce1SSushil Singh Append To List ${trans_id_list1} ${trans_id} 1016d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 1017d03f2ce1SSushil Singh 1018d03f2ce1SSushil Singh ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1] 1019d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 1020d03f2ce1SSushil Singh Append To List ${trans_id_list2} ${trans_id} 1021d03f2ce1SSushil Singh Verify Lock On Resource ${session_info2} ${trans_id_list2} 1022d03f2ce1SSushil Singh 1023d03f2ce1SSushil Singh Release Locks On Resource 1024d03f2ce1SSushil Singh ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_UNAUTHORIZED} 1025d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 1026d03f2ce1SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session 1027d03f2ce1SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session 1028d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 1029d03f2ce1SSushil Singh Redfish Delete Session ${session_info2} 1030d03f2ce1SSushil Singh 1031d03f2ce1SSushil Singh 1032e33c6e6aSSushil SinghVerify Fail To Acquire Lock For Invalid Resource ID Data Type 1033e33c6e6aSSushil Singh [Documentation] Verify fail to acquire the lock with invalid resource id data type. 1034e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 1035e33c6e6aSSushil Singh 1036e33c6e6aSSushil Singh # Description of argument(s): 1037e33c6e6aSSushil Singh # client_id This client id can contain string value 1038e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 1039e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 1040e33c6e6aSSushil Singh 1041e33c6e6aSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 1042e33c6e6aSSushil Singh Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 1043e33c6e6aSSushil Singh ... ${lock_type} status_code=${HTTP_BAD_REQUEST} 1044e33c6e6aSSushil Singh Redfish Delete Session ${session_info} 1045e33c6e6aSSushil Singh 1046e33c6e6aSSushil Singh 1047d03f2ce1SSushil SinghVerify Fail To Acquire Lock For Invalid Lock Data 104816b3c7bfSGeorge Keishing [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segment flags. 1049d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${message} 1050d03f2ce1SSushil Singh 1051d03f2ce1SSushil Singh # Description of argument(s): 1052d03f2ce1SSushil Singh # client_id This client id can contain string value 1053d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 1054d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 1055d03f2ce1SSushil Singh # message Return message from URI. 1056d03f2ce1SSushil Singh 1057d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 1058d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Invalid Lock ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST} 1059d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 1060bace3005SSushil Singh 1061bace3005SSushil Singh 1062bace3005SSushil SinghVerify No Locks Records For Session With No Acquired Lock 1063bace3005SSushil Singh [Documentation] Verify no records found for a session where no lock is acquired. 1064bace3005SSushil Singh [Arguments] ${client_id} 1065bace3005SSushil Singh 1066bace3005SSushil Singh # Description of argument(s): 1067bace3005SSushil Singh # client_id This client id can contain string value 1068bace3005SSushil Singh # (e.g. 12345, "HMCID"). 1069bace3005SSushil Singh 1070bace3005SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 1071bace3005SSushil Singh ${trans_id_emptylist}= Create List 1072bace3005SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 1073bace3005SSushil Singh Redfish Delete Session ${session_info} 1074728ef9c9SSushil Singh 1075728ef9c9SSushil Singh 1076728ef9c9SSushil SinghCreate List Of Session ID 1077728ef9c9SSushil Singh [Documentation] Create session id list from session dict info. 1078728ef9c9SSushil Singh [Arguments] ${session_dict_info} 1079728ef9c9SSushil Singh 1080728ef9c9SSushil Singh # Description of argument(s): 1081728ef9c9SSushil Singh # session_dict_info Session information in dict. 1082728ef9c9SSushil Singh 1083728ef9c9SSushil Singh @{session_id_list}= Create List 1084728ef9c9SSushil Singh 1085728ef9c9SSushil Singh FOR ${session} IN @{session_dict_info} 1086728ef9c9SSushil Singh Append To List ${session_id_list} ${session["SessionIDs"]} 1087728ef9c9SSushil Singh END 1088728ef9c9SSushil Singh 1089728ef9c9SSushil Singh ${num_id}= Get Length ${session_id_list} 1090728ef9c9SSushil Singh Should Not Be Equal As Integers ${num_id} ${0} 1091728ef9c9SSushil Singh 1092728ef9c9SSushil Singh ${session_id_list}= Evaluate json.dumps(${session_id_list}) json 1093728ef9c9SSushil Singh 1094728ef9c9SSushil Singh [Return] ${session_id_list} 1095728ef9c9SSushil Singh 1096728ef9c9SSushil Singh 1097728ef9c9SSushil SinghGet Locks List On Resource With Session List 1098728ef9c9SSushil Singh [Documentation] Get locks list from session of list. 1099728ef9c9SSushil Singh [Arguments] ${session_id_list} ${exp_status_code}=${HTTP_OK} 1100728ef9c9SSushil Singh 1101728ef9c9SSushil Singh # Description of argument(s): 1102728ef9c9SSushil Singh # session_id_list Session ids list. 1103728ef9c9SSushil Singh # exp_status_code Expected HTTP status code. 1104728ef9c9SSushil Singh 1105728ef9c9SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 1106728ef9c9SSushil Singh ... data={"SessionIDs": ${session_id_list}} 1107728ef9c9SSushil Singh ${locks}= Evaluate json.loads('''${resp.text}''') json 1108728ef9c9SSushil Singh 1109728ef9c9SSushil Singh [Return] ${locks} 1110728ef9c9SSushil Singh 1111728ef9c9SSushil Singh 1112728ef9c9SSushil SinghVerify List Of Session Lock On Resource 1113728ef9c9SSushil Singh [Documentation] Verify list of lock record from list of sessions. 1114728ef9c9SSushil Singh [Arguments] ${session_dict_info} ${transaction_id_list} 1115728ef9c9SSushil Singh 1116728ef9c9SSushil Singh # Description of argument(s): 1117728ef9c9SSushil Singh # session_dict_info Session information in dict. 1118728ef9c9SSushil Singh # transaction_id_list Transaction id in list stored in dict. 1119728ef9c9SSushil Singh 1120728ef9c9SSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_info} 1121728ef9c9SSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 1122728ef9c9SSushil Singh ${lock_list}= Set Variable ${lock_list_resp['Records']} 1123728ef9c9SSushil Singh 1124728ef9c9SSushil Singh FOR ${session_id} ${tran_id} ${lock_record} IN ZIP ${session_dict_info} ${transaction_id_list} ${lock_list} 1125728ef9c9SSushil Singh Valid Value session_id['SessionIDs'] ['${lock_record['SessionID']}'] 1126728ef9c9SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock_record['TransactionID']} 1127728ef9c9SSushil Singh END 1128728ef9c9SSushil Singh 1129728ef9c9SSushil Singh 1130728ef9c9SSushil SinghVerify Lock Records Of Multiple Session 1131728ef9c9SSushil Singh [Documentation] Verify all records found for a multiple sessions. 1132728ef9c9SSushil Singh [Arguments] ${client_ids} ${lock_type} 1133728ef9c9SSushil Singh 1134728ef9c9SSushil Singh # Description of argument(s): 1135728ef9c9SSushil Singh # client_ids This client id can contain string value 1136728ef9c9SSushil Singh # (e.g. 12345, "HMCID"). 1137728ef9c9SSushil Singh # lock_type Read lock or Write lock. 1138728ef9c9SSushil Singh 1139728ef9c9SSushil Singh ${client_id_list}= Split String ${client_ids} , 1140728ef9c9SSushil Singh ${lock_type_list}= Split String ${lock_type} , 1141728ef9c9SSushil Singh ${trans_id_list1}= Create List 1142728ef9c9SSushil Singh ${trans_id_list2}= Create List 1143728ef9c9SSushil Singh 1144728ef9c9SSushil Singh ${session_dict_list}= Create List 1145728ef9c9SSushil Singh ${lock_list}= Create List 1146728ef9c9SSushil Singh 1147728ef9c9SSushil Singh ${client_id1}= Create List 1148728ef9c9SSushil Singh Append To List ${client_id1} ${client_id_list}[0] 1149728ef9c9SSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 1150728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 1151728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 1152728ef9c9SSushil Singh 1153728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1154728ef9c9SSushil Singh Append To List ${trans_id_list1} ${trans_id} 1155728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 1156728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 1157728ef9c9SSushil Singh 1158728ef9c9SSushil Singh 1159728ef9c9SSushil Singh ${client_id2}= Create List 1160728ef9c9SSushil Singh Append To List ${client_id2} ${client_id_list}[1] 1161728ef9c9SSushil Singh ${session_info2}= Create Session With List Of ClientID ${client_id2} 1162728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 1163728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id2} ${session_info2} 1164728ef9c9SSushil Singh 1165728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 1166728ef9c9SSushil Singh Append To List ${trans_id_list2} ${trans_id} 1167728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 1168728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_list2} 1169728ef9c9SSushil Singh 1170728ef9c9SSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 1171728ef9c9SSushil Singh 1172728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 1173728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 1174728ef9c9SSushil Singh 1175728ef9c9SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 1176728ef9c9SSushil Singh 1177728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info2}[0] SessionToken 1178728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 1179728ef9c9SSushil Singh 1180728ef9c9SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Transaction 1181728ef9c9SSushil Singh 1182728ef9c9SSushil Singh ${trans_id_emptylist}= Create List 1183728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 1184728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_emptylist} 1185728ef9c9SSushil Singh 1186728ef9c9SSushil Singh Redfish Delete List Of Session ${session_dict_list} 1187f9a536caSSushil Singh 1188f9a536caSSushil Singh 1189f9a536caSSushil SinghVerify Lock Records For Multiple Invalid Session 1190f9a536caSSushil Singh [Documentation] Verify no lock record found for multiple invalid session. 1191f9a536caSSushil Singh [Arguments] ${client_id} 1192f9a536caSSushil Singh 1193f9a536caSSushil Singh # Description of argument(s): 1194f9a536caSSushil Singh # client_id This client id can contain string value 1195f9a536caSSushil Singh # (e.g. 12345, "HMCID"). 1196f9a536caSSushil Singh 1197f9a536caSSushil Singh ${session_dict_list}= Create List 1198f9a536caSSushil Singh ${invalid_session_ids}= Create List xxyXyyYZZz xXyXYyYZzz 1199f9a536caSSushil Singh 1200f9a536caSSushil Singh ${session_info1}= Create Session With ClientID ${client_id} 1201f9a536caSSushil Singh 1202f9a536caSSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 1203f9a536caSSushil Singh set to dictionary ${session_info2} SessionIDs ${invalid_session_ids}[0] 1204f9a536caSSushil Singh Append To List ${session_dict_list} ${session_info2} 1205f9a536caSSushil Singh 1206f9a536caSSushil Singh ${session_info3}= Copy Dictionary ${session_info1} deepcopy=True 1207f9a536caSSushil Singh set to dictionary ${session_info3} SessionIDs ${invalid_session_ids}[0] 1208f9a536caSSushil Singh Append To List ${session_dict_list} ${session_info3} 1209f9a536caSSushil Singh 1210f9a536caSSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 1211f9a536caSSushil Singh ${lock_length1}= Get Length ${lock_list1} 1212f9a536caSSushil Singh 1213f9a536caSSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_list} 1214f9a536caSSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 1215f9a536caSSushil Singh ${lock_length2}= Get Length ${lock_list_resp['Records']} 1216f9a536caSSushil Singh 1217f9a536caSSushil Singh Should Be Equal As Integers ${lock_length1} ${lock_length2} 1218f9a536caSSushil Singh 1219f9a536caSSushil Singh Redfish Delete Session ${session_info1} 122011949a2cSSushil Singh 122111949a2cSSushil Singh 122211949a2cSSushil SinghVerify Lock Records For Multiple Invalid And Valid Session 122311949a2cSSushil Singh [Documentation] Verify all records found for a valid and invalid sessions. 122411949a2cSSushil Singh [Arguments] ${client_ids} ${lock_type} 122511949a2cSSushil Singh 122611949a2cSSushil Singh # Description of argument(s): 122711949a2cSSushil Singh # client_ids This client id can contain string value 122811949a2cSSushil Singh # (e.g. 12345, "HMCID"). 122911949a2cSSushil Singh # lock_type Read lock or Write lock. 123011949a2cSSushil Singh 123111949a2cSSushil Singh ${client_id_list}= Split String ${client_ids} , 123211949a2cSSushil Singh ${lock_type_list}= Split String ${lock_type} , 123311949a2cSSushil Singh ${trans_id_list1}= Create List 123411949a2cSSushil Singh ${invalid_session_ids}= Create List xxyXyyYZZz 123511949a2cSSushil Singh 123611949a2cSSushil Singh ${session_dict_list}= Create List 123711949a2cSSushil Singh ${lock_list}= Create List 123811949a2cSSushil Singh 123911949a2cSSushil Singh ${client_id1}= Create List 124011949a2cSSushil Singh Append To List ${client_id1} ${client_id_list}[0] 124111949a2cSSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 124211949a2cSSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 124311949a2cSSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 124411949a2cSSushil Singh 124511949a2cSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 124611949a2cSSushil Singh Append To List ${trans_id_list1} ${trans_id} 124711949a2cSSushil Singh Append To List ${lock_list} ${trans_id} 124811949a2cSSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 124911949a2cSSushil Singh 125011949a2cSSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 125111949a2cSSushil Singh set to dictionary ${session_info2}[0] SessionIDs ${invalid_session_ids}[0] 125211949a2cSSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 125311949a2cSSushil Singh 125411949a2cSSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 125511949a2cSSushil Singh 125611949a2cSSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 125711949a2cSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 125811949a2cSSushil Singh 125911949a2cSSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 126011949a2cSSushil Singh 126111949a2cSSushil Singh ${trans_id_emptylist}= Create List 126211949a2cSSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 126311949a2cSSushil Singh 126411949a2cSSushil Singh Redfish Delete Session ${session_info1}[0] 1265