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 151*8bee358fSSushil SinghFail To Release Multiple Lock With Valid And Invalid TransactionID 152*8bee358fSSushil Singh [Documentation] Release multiple lock with valid and invalid trasaction. 153*8bee358fSSushil Singh [Tags] Fail_To_Release_Multiple_Lock_With_Valid_And_Invalid_TransactionID 154*8bee358fSSushil Singh [Template] Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID 155*8bee358fSSushil Singh 156*8bee358fSSushil Singh # client_id lock_type release_lock_type 157*8bee358fSSushil Singh HMCID-01 ReadCase1,ReadCase1 Transaction 158*8bee358fSSushil Singh 159*8bee358fSSushil Singh 160d03f2ce1SSushil SinghFail To Release Lock For Another Session 161d03f2ce1SSushil Singh [Documentation] Failed to release locks from another session. 162d03f2ce1SSushil Singh [Tags] Fail_To_Release_Lock_For_Another_Session 163d03f2ce1SSushil Singh [Template] Verify Fail To Release Lock For Another Session 164afdd2a1dSVijay 165d03f2ce1SSushil Singh # client_id lock_type 166d03f2ce1SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 167afdd2a1dSVijay 168afdd2a1dSVijay 169e33c6e6aSSushil SinghTest Invalid Resource ID Data Type Locking 170e33c6e6aSSushil Singh [Documentation] Failed to acquire lock for invalid resource id data type. 171e33c6e6aSSushil Singh [Tags] Test_Invalid_Resource_ID_Data_Type_Locking 172e33c6e6aSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type 173e33c6e6aSSushil Singh 174e33c6e6aSSushil Singh # client_id lock_type 175e33c6e6aSSushil Singh HMCID-01 ReadCase1 176e33c6e6aSSushil Singh HMCID-01 ReadCase2 177e33c6e6aSSushil Singh HMCID-01 ReadCase3 178e33c6e6aSSushil Singh HMCID-01 WriteCase1 179e33c6e6aSSushil Singh HMCID-01 WriteCase2 180e33c6e6aSSushil Singh HMCID-01 WriteCase3 181e33c6e6aSSushil Singh 182e33c6e6aSSushil Singh 183d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Type 184d03f2ce1SSushil Singh [Documentation] Failed to acquire read, write lock for invalid lock data passed. 185d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type 186d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 187afdd2a1dSVijay 188d03f2ce1SSushil Singh # client_id lock_type message 189d03f2ce1SSushil Singh HMCID-01 ReadCase1 ${BAD_REQUEST} 190d03f2ce1SSushil Singh HMCID-01 ReadCase2 ${BAD_REQUEST} 191d03f2ce1SSushil Singh HMCID-01 ReadCase3 ${BAD_REQUEST} 192d03f2ce1SSushil Singh HMCID-01 ReadCase4 ${BAD_REQUEST} 193d03f2ce1SSushil Singh HMCID-01 ReadCase5 ${BAD_REQUEST} 194d03f2ce1SSushil Singh HMCID-01 WriteCase1 ${BAD_REQUEST} 195d03f2ce1SSushil Singh HMCID-01 WriteCase2 ${BAD_REQUEST} 196d03f2ce1SSushil Singh HMCID-01 WriteCase3 ${BAD_REQUEST} 197d03f2ce1SSushil Singh HMCID-01 WriteCase4 ${BAD_REQUEST} 198d03f2ce1SSushil Singh HMCID-01 WriteCase5 ${BAD_REQUEST} 199afdd2a1dSVijay 200afdd2a1dSVijay 201d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Flag 202d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid lock flag passed. 203d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag 204d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 205afdd2a1dSVijay 206d03f2ce1SSushil Singh # client_id lock_type message 207d03f2ce1SSushil Singh HMCID-01 ReadCase6 ${BAD_REQUEST} 208d03f2ce1SSushil Singh HMCID-01 ReadCase7 ${BAD_REQUEST} 209d03f2ce1SSushil Singh HMCID-01 ReadCase8 ${BAD_REQUEST} 210d03f2ce1SSushil Singh HMCID-01 ReadCase9 ${BAD_REQUEST} 211d03f2ce1SSushil Singh HMCID-01 ReadCase10 ${BAD_REQUEST} 212d03f2ce1SSushil Singh HMCID-01 ReadCase11 ${BAD_REQUEST} 213d03f2ce1SSushil Singh HMCID-01 WriteCase6 ${BAD_REQUEST} 214d03f2ce1SSushil Singh HMCID-01 WriteCase7 ${BAD_REQUEST} 215d03f2ce1SSushil Singh HMCID-01 WriteCase8 ${BAD_REQUEST} 216d03f2ce1SSushil Singh HMCID-01 WriteCase9 ${BAD_REQUEST} 217d03f2ce1SSushil Singh HMCID-01 WriteCase10 ${BAD_REQUEST} 218d03f2ce1SSushil Singh HMCID-01 WriteCase11 ${BAD_REQUEST} 219afdd2a1dSVijay 220afdd2a1dSVijay 221d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Segment Flag 222d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 223d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag 224d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 225d03f2ce1SSushil Singh 226d03f2ce1SSushil Singh # client_id lock_type message 227d03f2ce1SSushil Singh HMCID-01 ReadCase12 ${BAD_REQUEST} 228d03f2ce1SSushil Singh HMCID-01 ReadCase13 ${BAD_REQUEST} 229d03f2ce1SSushil Singh HMCID-01 ReadCase14 ${BAD_REQUEST} 230d03f2ce1SSushil Singh HMCID-01 WriteCase12 ${BAD_REQUEST} 231d03f2ce1SSushil Singh HMCID-01 WriteCase13 ${BAD_REQUEST} 232d03f2ce1SSushil Singh HMCID-01 WriteCase14 ${BAD_REQUEST} 233afdd2a1dSVijay 234bace3005SSushil Singh 2353b3a7ecaSSushil SinghFail To Acquire Lock For Invalid Segment Data Type Flag 2363b3a7ecaSSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 2373b3a7ecaSSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Data_Type_Flag 2383b3a7ecaSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 2393b3a7ecaSSushil Singh 2403b3a7ecaSSushil Singh # client_id lock_type message 2413b3a7ecaSSushil Singh HMCID-01 ReadCase15 ${EMPTY} 2423b3a7ecaSSushil Singh HMCID-01 ReadCase16 ${EMPTY} 2433b3a7ecaSSushil Singh HMCID-01 ReadCase17 ${EMPTY} 2443b3a7ecaSSushil Singh HMCID-01 ReadCase18 ${EMPTY} 2453b3a7ecaSSushil Singh HMCID-01 WriteCase15 ${EMPTY} 2463b3a7ecaSSushil Singh HMCID-01 WriteCase16 ${EMPTY} 2473b3a7ecaSSushil Singh HMCID-01 WriteCase17 ${EMPTY} 2483b3a7ecaSSushil Singh HMCID-01 WriteCase18 ${EMPTY} 2493b3a7ecaSSushil Singh 2503b3a7ecaSSushil Singh 251bace3005SSushil SinghGet Empty Lock Records For Session Where No Locks Acquired 252bace3005SSushil Singh [Documentation] If session does not acquire locks then get lock should return 253bace3005SSushil Singh ... empty lock records. 254bace3005SSushil Singh [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired 255bace3005SSushil Singh [Template] Verify No Locks Records For Session With No Acquired Lock 256bace3005SSushil Singh 257bace3005SSushil Singh # client_id 258bace3005SSushil Singh HMCID-01 259bace3005SSushil Singh 260728ef9c9SSushil Singh 261f9a536caSSushil SinghGet Lock Records Empty For Invalid Session 262f9a536caSSushil Singh [Documentation] Record of lock list is empty for invalid session. 263f9a536caSSushil Singh [Tags] Get_Lock_Records_Empty_For_Invalid_Session 264f9a536caSSushil Singh [Template] Verify Empty Lock Records For Invalid Session 265f9a536caSSushil Singh 266f9a536caSSushil Singh # client_id 267f9a536caSSushil Singh HMCID-01 268f9a536caSSushil Singh 269f9a536caSSushil Singh 270728ef9c9SSushil SinghGet Lock Records For Multiple Session 271728ef9c9SSushil Singh [Documentation] Get lock records of multiple session. 272728ef9c9SSushil Singh [Tags] Get_Lock_Records_For_Multiple_Session 273728ef9c9SSushil Singh [Template] Verify Lock Records Of Multiple Session 274728ef9c9SSushil Singh 275728ef9c9SSushil Singh # client_ids lock_type 276728ef9c9SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 277728ef9c9SSushil Singh 278728ef9c9SSushil Singh 279f9a536caSSushil SinghGet Lock Records For Multiple Invalid Session 280f9a536caSSushil Singh [Documentation] Record of lock list is empty for list of invalid session. 281f9a536caSSushil Singh [Tags] Get_Lock_Records_For_Multiple_Invalid_Session 282f9a536caSSushil Singh [Template] Verify Lock Records For Multiple Invalid Session 283f9a536caSSushil Singh 284f9a536caSSushil Singh # client_id 285f9a536caSSushil Singh HMCID-01 286f9a536caSSushil Singh 28711949a2cSSushil Singh 28811949a2cSSushil SinghGet Lock Records For Multiple Invalid And Valid Session 28911949a2cSSushil Singh [Documentation] Get record of lock from invalid and valid session. 29011949a2cSSushil Singh [Tags] Get_Lock_Records_For_Multiple_Invalid_And_Valid_Session 29111949a2cSSushil Singh [Template] Verify Lock Records For Multiple Invalid And Valid Session 29211949a2cSSushil Singh 29311949a2cSSushil Singh # client_id lock_type 29411949a2cSSushil Singh HMCID-01,HMCID-02 ReadCase1 29511949a2cSSushil Singh 296bc331e22SVijay*** Keywords *** 297bc331e22SVijay 298d03f2ce1SSushil SinghCreate Redfish Session With ClientID 299d03f2ce1SSushil Singh [Documentation] Create redifish session with client id. 300d03f2ce1SSushil Singh [Arguments] ${client_id} 30185610eeeSVijay 30285610eeeSVijay # Description of argument(s): 303d03f2ce1SSushil Singh # client_id This client id can contain string value 304d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 30585610eeeSVijay 306d03f2ce1SSushil Singh ${session_info}= Create Dictionary 307d03f2ce1SSushil Singh ${session}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}} 30885610eeeSVijay 309d03f2ce1SSushil Singh Set To Dictionary ${session_info} SessionIDs ${session['Id']} 310d03f2ce1SSushil Singh Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]} 31185610eeeSVijay 312d03f2ce1SSushil Singh [Return] ${session_info} 31385610eeeSVijay 31485610eeeSVijay 315d03f2ce1SSushil SinghRW General Dictionary 31616b3c7bfSGeorge Keishing [Documentation] Create dictionary of lock request. 317d03f2ce1SSushil Singh [Arguments] ${read_case} ${res_id} 318bc331e22SVijay 319bc331e22SVijay # Description of argument(s): 320d03f2ce1SSushil Singh # read_case Read or Write lock type. 321d03f2ce1SSushil Singh # res_id Resource id. 322bc331e22SVijay 323d03f2ce1SSushil Singh ${request_dict}= Create Dictionary 324566daaf3SGeorge Keishing 325d03f2ce1SSushil Singh FOR ${key} IN @{read_case.keys()} 326d03f2ce1SSushil Singh Set To Dictionary ${request_dict} LockType ${key} 327d03f2ce1SSushil Singh Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]} 328d03f2ce1SSushil Singh END 329bc331e22SVijay 330d03f2ce1SSushil Singh Set To Dictionary ${request_dict} ResourceID ${res_id} 331d03f2ce1SSushil Singh 332d03f2ce1SSushil Singh [Return] ${request_dict} 333bc331e22SVijay 334bc331e22SVijay 335d03f2ce1SSushil SinghReturn Description Of Response 336d03f2ce1SSushil Singh [Documentation] Return description of REST response. 337bc331e22SVijay [Arguments] ${resp_text} 338bc331e22SVijay 339bc331e22SVijay # Description of argument(s): 340d03f2ce1SSushil Singh # resp_text REST response body. 341bc331e22SVijay 342d03f2ce1SSushil Singh # resp_text after successful partition file upload looks like: 343d03f2ce1SSushil Singh # { 344d03f2ce1SSushil Singh # "Description": "File Created" 345d03f2ce1SSushil Singh # } 346bc331e22SVijay 347d03f2ce1SSushil Singh ${message}= Evaluate json.loads('''${resp_text}''') json 348d03f2ce1SSushil Singh 349d03f2ce1SSushil Singh [Return] ${message} 350bc331e22SVijay 351bc331e22SVijay 352a7d71f02SSushil SinghVerify Redfish Session Deleted 353a7d71f02SSushil Singh [Documentation] Verify the redfish session is deleted. 354a7d71f02SSushil Singh [Arguments] ${session_info} 355a7d71f02SSushil Singh 356a7d71f02SSushil Singh # Description of argument(s): 357a7d71f02SSushil Singh # session_info Session information are stored in dictionary. 358a7d71f02SSushil Singh 359a7d71f02SSushil Singh # ${session_info} = { 360a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 361a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 362a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 363a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 364a7d71f02SSushil Singh # } 365a7d71f02SSushil Singh 366a7d71f02SSushil Singh # SessionIDs : Session IDs 367a7d71f02SSushil Singh # ClientID : Client ID 368a7d71f02SSushil Singh # SessionToken : Session token 369a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 370a7d71f02SSushil Singh 371a7d71f02SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions 372a7d71f02SSushil Singh 373a7d71f02SSushil Singh FOR ${session} IN @{sessions['Members']} 374a7d71f02SSushil Singh Should Not Be Equal As Strings session ['/redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}'] 375a7d71f02SSushil Singh END 376a7d71f02SSushil Singh 377a7d71f02SSushil Singh 378a7d71f02SSushil SinghVerify Redfish List Of Session Deleted 379a7d71f02SSushil Singh [Documentation] Verify all the list of redfish session is deleted. 380a7d71f02SSushil Singh [Arguments] ${session_info_list} 381a7d71f02SSushil Singh 382a7d71f02SSushil Singh # Description of argument(s): 383a7d71f02SSushil Singh # session_info_list List contains individual session record are stored in dictionary. 384a7d71f02SSushil Singh 385a7d71f02SSushil Singh # ${session_info_list} = [{ 386a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 387a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 388a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 389a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 390a7d71f02SSushil Singh # }] 391a7d71f02SSushil Singh 392a7d71f02SSushil Singh # SessionIDs : Session IDs 393a7d71f02SSushil Singh # ClientID : Client ID 394a7d71f02SSushil Singh # SessionToken : Session token 395a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 396a7d71f02SSushil Singh 397a7d71f02SSushil Singh FOR ${session_record} IN @{session_info_list} 398a7d71f02SSushil Singh Verify Redfish Session Deleted ${session_record} 399a7d71f02SSushil Singh END 400a7d71f02SSushil Singh 401a7d71f02SSushil Singh 402d03f2ce1SSushil SinghRedfish Post Acquire Lock 403d03f2ce1SSushil Singh [Documentation] Acquire and release lock. 404d03f2ce1SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 405bc331e22SVijay 406bc331e22SVijay # Description of argument(s): 407d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 408d03f2ce1SSushil Singh # status_code HTTP status code. 409bc331e22SVijay 410e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Lock ${lock_type} 411e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 412d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 413df390b61SSushil Singh 414df390b61SSushil Singh Run Keyword If ${status_code} == ${HTTP_BAD_REQUEST} 415df390b61SSushil Singh ... Valid Value ${BAD_REQUEST} ['${resp.content}'] 416df390b61SSushil Singh ... ELSE 417df390b61SSushil Singh ... Run Keyword And Return Return Description Of Response ${resp.content} 418bc331e22SVijay 419d03f2ce1SSushil Singh [Return] ${resp} 420bc331e22SVijay 421bc331e22SVijay 422977f8f58SSushil SinghRedfish Post Acquire List Lock 423977f8f58SSushil Singh [Documentation] Acquire and release lock. 424977f8f58SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 425977f8f58SSushil Singh 426977f8f58SSushil Singh # Description of argument(s): 427977f8f58SSushil Singh # lock_type Read lock or Write lock. 428977f8f58SSushil Singh # status_code HTTP status code. 429977f8f58SSushil Singh 430977f8f58SSushil Singh ${lock_dict_param}= Create Data To Acquire List Of Lock ${lock_type} 431977f8f58SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 432977f8f58SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 433977f8f58SSushil Singh 434977f8f58SSushil Singh [Return] ${resp} 435977f8f58SSushil Singh 436977f8f58SSushil Singh 437d03f2ce1SSushil SinghRedfish Post Acquire Invalid Lock 438d03f2ce1SSushil Singh [Documentation] Redfish to post request to acquire in-valid lock. 439d03f2ce1SSushil Singh [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK} 440bc331e22SVijay 441bc331e22SVijay # Description of argument(s): 442d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 443d03f2ce1SSushil Singh # message Return message from URI. 444d03f2ce1SSushil Singh # status_code HTTP status code. 445bc331e22SVijay 446e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type} 447e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 448d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 4493b3a7ecaSSushil Singh Run Keyword If '${message}' != '${EMPTY}' 4503b3a7ecaSSushil Singh ... Valid Value message ['${resp.content}'] 451d03f2ce1SSushil Singh 452d03f2ce1SSushil Singh [Return] ${resp} 453bc331e22SVijay 454bc331e22SVijay 455e33c6e6aSSushil SinghRedfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 456e33c6e6aSSushil Singh [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id. 457e33c6e6aSSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 458e33c6e6aSSushil Singh 459e33c6e6aSSushil Singh # Description of argument(s): 460e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 461e33c6e6aSSushil Singh # status_code HTTP status code. 462e33c6e6aSSushil Singh 463e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type} 464e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 465e33c6e6aSSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 466e33c6e6aSSushil Singh 467e33c6e6aSSushil Singh [Return] ${resp} 468e33c6e6aSSushil Singh 469e33c6e6aSSushil Singh 470d03f2ce1SSushil SinghForm Data To Acquire Lock 47116b3c7bfSGeorge Keishing [Documentation] Create a dictionary for lock request. 472d03f2ce1SSushil Singh [Arguments] ${lock_type} 473d03f2ce1SSushil Singh 474d03f2ce1SSushil Singh # Description of argument(s): 475d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 476d03f2ce1SSushil Singh 477d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 478d03f2ce1SSushil Singh ${resp}= RW General Dictionary 479d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 480d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 481d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 482e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 483d03f2ce1SSushil Singh 484e33c6e6aSSushil Singh [Return] ${lock_request_dict} 485e33c6e6aSSushil Singh 486e33c6e6aSSushil Singh 487977f8f58SSushil SinghCreate Data To Acquire List Of Lock 48816b3c7bfSGeorge Keishing [Documentation] Create a dictionary for list of lock request. 489977f8f58SSushil Singh [Arguments] ${lock_type_list} 490977f8f58SSushil Singh 491977f8f58SSushil Singh # Description of argument(s): 492977f8f58SSushil Singh # lock_type Read lock or Write lock. 493977f8f58SSushil Singh 494977f8f58SSushil Singh ${temp_list}= Create List 495977f8f58SSushil Singh ${lock_res_info}= Get Lock Resource Information 496977f8f58SSushil Singh 497977f8f58SSushil Singh FOR ${lock_type} IN @{lock_type_list} 498977f8f58SSushil Singh ${resp}= RW General Dictionary 499977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 500977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 501977f8f58SSushil Singh Append To List ${temp_list} ${resp} 502977f8f58SSushil Singh END 503977f8f58SSushil Singh 504977f8f58SSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 505977f8f58SSushil Singh 506977f8f58SSushil Singh [Return] ${lock_request_dict} 507977f8f58SSushil Singh 508977f8f58SSushil Singh 509e33c6e6aSSushil SinghForm Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID 51016b3c7bfSGeorge Keishing [Documentation] Create a dictionary for in-valid lock request. 511e33c6e6aSSushil Singh [Arguments] ${lock_type} 512e33c6e6aSSushil Singh 513e33c6e6aSSushil Singh # Description of argument(s): 514e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 515e33c6e6aSSushil Singh 516e33c6e6aSSushil Singh ${lock_res_info}= Get Lock Resource Information 517e33c6e6aSSushil Singh ${resp}= RW General Dictionary 518e33c6e6aSSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 519e33c6e6aSSushil Singh ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]} 520e33c6e6aSSushil Singh ${temp_list}= Create List ${resp} 521e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 522e33c6e6aSSushil Singh 523e33c6e6aSSushil Singh [Return] ${lock_request_dict} 524d03f2ce1SSushil Singh 525d03f2ce1SSushil Singh 526d03f2ce1SSushil SinghForm Data To Acquire Invalid Lock 52716b3c7bfSGeorge Keishing [Documentation] Create a dictionary for in-valid lock request. 528d03f2ce1SSushil Singh [Arguments] ${lock_type} 529d03f2ce1SSushil Singh 530d03f2ce1SSushil Singh # Description of argument(s): 531d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 532d03f2ce1SSushil Singh 533d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 534d03f2ce1SSushil Singh ${resp}= RW General Dictionary 535d03f2ce1SSushil Singh ... ${lock_res_info["Invalid Case"]["${lock_type}"]} 536d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 537d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 538e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 539d03f2ce1SSushil Singh 540e33c6e6aSSushil Singh [Return] ${lock_request_dict} 541d03f2ce1SSushil Singh 542d03f2ce1SSushil Singh 543d03f2ce1SSushil SinghGet Locks List On Resource 544bc331e22SVijay [Documentation] Get locks list. 545d03f2ce1SSushil Singh [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK} 546bc331e22SVijay 547bc331e22SVijay # Description of argument(s): 548d03f2ce1SSushil Singh # session_info Session information in dict. 549d03f2ce1SSushil Singh # exp_status_code Expected HTTP status code. 550bc331e22SVijay 551d03f2ce1SSushil Singh ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]} 552566daaf3SGeorge Keishing ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 553566daaf3SGeorge Keishing ... data=${data} 554bc331e22SVijay ${locks}= Evaluate json.loads('''${resp.text}''') json 555bc331e22SVijay 556bc331e22SVijay [Return] ${locks["Records"]} 557bc331e22SVijay 558bc331e22SVijay 559d03f2ce1SSushil SinghVerify Lock On Resource 560d03f2ce1SSushil Singh [Documentation] Verify lock on resource. 561d03f2ce1SSushil Singh [Arguments] ${session_info} ${transaction_id} 562bc331e22SVijay 563bc331e22SVijay # Description of argument(s): 564d03f2ce1SSushil Singh # session_info Session information in dict. 565d03f2ce1SSushil Singh # transaction_id Transaction id in list stored in dict. 566bc331e22SVijay 567d03f2ce1SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']} 568d03f2ce1SSushil Singh Rprint Vars sessions 569d03f2ce1SSushil Singh ${lock_list}= Get Locks List On Resource ${session_info} 570d03f2ce1SSushil Singh ${lock_length}= Get Length ${lock_list} 571d03f2ce1SSushil Singh ${tran_id_length}= Get Length ${transaction_id} 572d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id_length} ${lock_length} 573afdd2a1dSVijay 574d03f2ce1SSushil Singh FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list} 575d03f2ce1SSushil Singh Valid Value session_info['ClientID'] ['${lock['HMCID']}'] 576d03f2ce1SSushil Singh Valid Value session_info['SessionIDs'] ['${lock['SessionID']}'] 577d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']} 578bc331e22SVijay END 579bc331e22SVijay 580bc331e22SVijay 581d03f2ce1SSushil SinghAcquire Lock On Resource 582d03f2ce1SSushil Singh [Documentation] Acquire lock on resource. 583d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False 584bc331e22SVijay 585bc331e22SVijay # Description of argument(s): 586d03f2ce1SSushil Singh # client_id This client id can contain string value 587d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 588d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 589d03f2ce1SSushil Singh # reboot_flag Flag is used to run reboot the BMC code. 590d03f2ce1SSushil Singh # (e.g. True or False). 591bc331e22SVijay 592d03f2ce1SSushil Singh ${trans_id_list}= Create List 593d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 594d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 595d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 596d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 597566daaf3SGeorge Keishing 598e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 599bc331e22SVijay 600d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'True' 601d03f2ce1SSushil Singh ... Run Keywords Redfish OBMC Reboot (off) AND 602d03f2ce1SSushil Singh ... Redfish Login AND 603e33c6e6aSSushil Singh ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND 604d03f2ce1SSushil Singh ... Verify Lock On Resource ${session_info} ${trans_id_list} AND 605d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 606bc331e22SVijay 607d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'False' 608d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 609bc331e22SVijay 610d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 611d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 612d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 613bc331e22SVijay 614bc331e22SVijay 615d03f2ce1SSushil SinghForm Data To Release Lock 616d03f2ce1SSushil Singh [Documentation] Create a dictonay to release lock. 617d03f2ce1SSushil Singh [Arguments] ${trans_id_list} 618355daac7SVijay 619355daac7SVijay # Description of argument(s): 620d03f2ce1SSushil Singh # trans_id_list 621355daac7SVijay 622d03f2ce1SSushil Singh @{tran_ids}= Create List 623355daac7SVijay 624d03f2ce1SSushil Singh FOR ${item} IN @{trans_id_list} 625d03f2ce1SSushil Singh Append To List ${tran_ids} ${item['TransactionID']} 626d03f2ce1SSushil Singh END 627d03f2ce1SSushil Singh 628d03f2ce1SSushil Singh [Return] ${tran_ids} 629d03f2ce1SSushil Singh 630d03f2ce1SSushil Singh 631d03f2ce1SSushil SinghRelease Locks On Resource 632d03f2ce1SSushil Singh [Documentation] Redfish request to release a lock. 633d03f2ce1SSushil Singh [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction ${status_code}=${HTTP_OK} 634d03f2ce1SSushil Singh 635d03f2ce1SSushil Singh # Description of argument(s): 636d03f2ce1SSushil Singh # session_info Session information in dict. 637d03f2ce1SSushil Singh # trans_id_list Transaction id list. 638d03f2ce1SSushil Singh # release_lock_type Release lock by Transaction, Session. 639d03f2ce1SSushil Singh # status_code HTTP status code. 640d03f2ce1SSushil Singh 641d03f2ce1SSushil Singh ${tran_ids}= Form Data To Release Lock ${trans_id_list} 642d03f2ce1SSushil Singh ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}} 643d03f2ce1SSushil Singh ${data}= Evaluate json.dumps(${data}) json 644d03f2ce1SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data} 645d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 646d03f2ce1SSushil Singh 647d03f2ce1SSushil Singh 648df390b61SSushil SinghRelease locks And Delete Session 649df390b61SSushil Singh [Documentation] Release locks and delete redfish session. 650df390b61SSushil Singh [Arguments] ${session_info} ${trans_id_list} 651df390b61SSushil Singh 652df390b61SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} 653df390b61SSushil Singh 654df390b61SSushil Singh ${trans_id_emptylist}= Create List 655df390b61SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 656df390b61SSushil Singh 657df390b61SSushil Singh Redfish Delete Session ${session_info} 658df390b61SSushil Singh 659df390b61SSushil Singh 660d03f2ce1SSushil SinghAcquire Lock On Another Lock 661d03f2ce1SSushil Singh [Documentation] Acquire lock on another lock. 662d03f2ce1SSushil Singh [Arguments] ${client_id} 663d03f2ce1SSushil Singh 664d03f2ce1SSushil Singh # Description of argument(s): 665d03f2ce1SSushil Singh # client_id This client id can contain string value 666d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 667d03f2ce1SSushil Singh 668d03f2ce1SSushil Singh ${trans_id_list}= Create List 669d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 670d03f2ce1SSushil Singh 671d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 672d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 673d03f2ce1SSushil Singh 674d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 675d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 676d03f2ce1SSushil Singh 677d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 678d03f2ce1SSushil Singh 679df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 680d03f2ce1SSushil Singh 681d03f2ce1SSushil Singh 682977f8f58SSushil SinghVerify Fail To Acquire Read And Write In Single Request 683977f8f58SSushil Singh [Documentation] Verify fail to acquire read and write lock passed in single request. 684977f8f58SSushil Singh [Arguments] ${client_id} ${lock_type} 685977f8f58SSushil Singh 686977f8f58SSushil Singh # Description of argument(s): 687977f8f58SSushil Singh # client_id This client id can contain string value 688977f8f58SSushil Singh # (e.g. 12345, "HMCID"). 689977f8f58SSushil Singh # lock_type Read lock or Write lock. 690977f8f58SSushil Singh 691977f8f58SSushil Singh ${lock_type_list}= Split String ${lock_type} , 692977f8f58SSushil Singh 693977f8f58SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 694977f8f58SSushil Singh ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list} status_code=${HTTP_BAD_REQUEST} 695977f8f58SSushil Singh Redfish Delete Session ${session_info} 696977f8f58SSushil Singh 697977f8f58SSushil Singh 698d03f2ce1SSushil SinghVerify Empty Lock Records For Invalid Session 699d03f2ce1SSushil Singh [Documentation] Verify no lock record found for invalid session. 700d03f2ce1SSushil Singh [Arguments] ${client_id} 701d03f2ce1SSushil Singh 702d03f2ce1SSushil Singh # Description of argument(s): 703d03f2ce1SSushil Singh # client_id This client id can contain string value 704d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 705d03f2ce1SSushil Singh 706d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_id} 707d03f2ce1SSushil Singh 708d03f2ce1SSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 709d03f2ce1SSushil Singh ${lock_length1}= Get Length ${lock_list1} 710d03f2ce1SSushil Singh 711d03f2ce1SSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 712d03f2ce1SSushil Singh set to dictionary ${session_info2} SessionIDs xxyXyyYZZz 713d03f2ce1SSushil Singh 714d03f2ce1SSushil Singh ${lock_list2}= Get Locks List On Resource ${session_info2} 715f9a536caSSushil Singh ${lock_length2}= Get Length ${lock_list2} 716d03f2ce1SSushil Singh 717f9a536caSSushil Singh Should Be Equal As Integers ${lock_length1} ${lock_length2} 718d03f2ce1SSushil Singh 719d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 720d03f2ce1SSushil Singh 721d03f2ce1SSushil Singh 722d03f2ce1SSushil SinghVerify Acquire Lock Fails On Another Lock 723d03f2ce1SSushil Singh [Documentation] Verify acquire lock on another lock fails. 724d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 725d03f2ce1SSushil Singh 726d03f2ce1SSushil Singh # Description of argument(s): 727d03f2ce1SSushil Singh # client_id This client id can contain string value 728d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 729d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 730d03f2ce1SSushil Singh 731d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 732d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 733d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 734d03f2ce1SSushil Singh 735d03f2ce1SSushil Singh ${trans_id_list}= Create List 736d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 737d03f2ce1SSushil Singh 738d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 739d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 740d03f2ce1SSushil Singh 741df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 742d03f2ce1SSushil Singh 743d03f2ce1SSushil Singh 744e33c6e6aSSushil SinghVerify Acquire Lock After Reboot 745e33c6e6aSSushil Singh [Documentation] Acquire read and write lock after the reboot and release lock. 746e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 747e33c6e6aSSushil Singh 748e33c6e6aSSushil Singh # Description of argument(s): 749e33c6e6aSSushil Singh # client_id This client id can contain string value 750e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 751e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 752e33c6e6aSSushil Singh 753e33c6e6aSSushil Singh ${trans_id_list}= Create List 754f9a536caSSushil Singh ${session_info}= Create Session With ClientID ${client_id} 755e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 756e33c6e6aSSushil Singh Redfish OBMC Reboot (off) 757e33c6e6aSSushil Singh Redfish Login 758e33c6e6aSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} 759e33c6e6aSSushil Singh 760e33c6e6aSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 761e33c6e6aSSushil Singh Append To List ${trans_id_list} ${trans_id} 762e33c6e6aSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 763e33c6e6aSSushil Singh 764df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 765df390b61SSushil Singh 766df390b61SSushil Singh 767df390b61SSushil SinghVerify Acquire Multiple Lock Request At CEC Level 768df390b61SSushil Singh [Documentation] Acquire lock in loop. 769df390b61SSushil Singh [Arguments] ${client_id} ${lock_type} 770df390b61SSushil Singh 771df390b61SSushil Singh # Description of argument(s): 772df390b61SSushil Singh # client_id This client id can contain string value 773df390b61SSushil Singh # (e.g. 12345, "HMCID"). 774df390b61SSushil Singh # lock_type Read lock or Write lock. 775df390b61SSushil Singh 776df390b61SSushil Singh ${trans_id_list}= Create List 777df390b61SSushil Singh @{lock_type_list}= Split String ${lock_type} , 778df390b61SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 779df390b61SSushil Singh 780df390b61SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 781df390b61SSushil Singh Append To List ${trans_id_list} ${trans_id} 782df390b61SSushil Singh 783df390b61SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 784df390b61SSushil Singh 785df390b61SSushil Singh Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 786df390b61SSushil Singh 787df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 788e33c6e6aSSushil Singh 789e33c6e6aSSushil Singh 790d03f2ce1SSushil SinghVerify Acquire And Release Lock In Loop 791d03f2ce1SSushil Singh [Documentation] Acquire lock in loop. 792d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 793d03f2ce1SSushil Singh 794d03f2ce1SSushil Singh # Description of argument(s): 795d03f2ce1SSushil Singh # client_id This client id can contain string value 796d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 797d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 798d03f2ce1SSushil Singh 799d03f2ce1SSushil Singh FOR ${count} IN RANGE 1 11 800d03f2ce1SSushil Singh ${trans_id_list}= Create List 801d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 802d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 803d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 804d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 805d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 806d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 807d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 808d03f2ce1SSushil Singh END 809d03f2ce1SSushil Singh 810d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 811d03f2ce1SSushil Singh 812d03f2ce1SSushil Singh 813d03f2ce1SSushil SinghAcquire And Release Multiple Locks 814d03f2ce1SSushil Singh [Documentation] Acquire mutilple locks on resource. 815d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 816d03f2ce1SSushil Singh 817d03f2ce1SSushil Singh # Description of argument(s): 818d03f2ce1SSushil Singh # client_id This client id can contain string value 819d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 820d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 821d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 822d03f2ce1SSushil Singh 823d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 824d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 825d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 826d03f2ce1SSushil Singh 827d03f2ce1SSushil Singh ${trans_id_list}= Create List 828d03f2ce1SSushil Singh 829d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 830d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 831d03f2ce1SSushil Singh 832d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 833d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 834d03f2ce1SSushil Singh 835d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 836d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 837d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 838d03f2ce1SSushil Singh 839d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 840d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 841d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 842d03f2ce1SSushil Singh 843d03f2ce1SSushil Singh 84459011d08SSushil SinghVerify Fail To Release Lock With Invalid TransactionID 84516b3c7bfSGeorge Keishing [Documentation] Verify fail to be release lock with invalid transaction ID. 84659011d08SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 84759011d08SSushil Singh 84859011d08SSushil Singh # Description of argument(s): 84959011d08SSushil Singh # client_id This client id can contain string value 85059011d08SSushil Singh # (e.g. 12345, "HMCID"). 85159011d08SSushil Singh # lock_type Read lock or Write lock. 85259011d08SSushil Singh # release_lock_type The value can be Transaction or Session. 85359011d08SSushil Singh 85459011d08SSushil Singh ${trans_id_list}= Create List 85559011d08SSushil Singh @{lock_type_list}= Split String ${lock_type} , 85659011d08SSushil Singh 85759011d08SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 85859011d08SSushil Singh 85959011d08SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 86059011d08SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 86159011d08SSushil Singh ${value}= Evaluate ${value} + 10 86259011d08SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 86359011d08SSushil Singh Append To List ${trans_id_list} ${trans_id} 86459011d08SSushil Singh 86559011d08SSushil Singh Release Locks On Resource 86659011d08SSushil Singh ... ${session_info} ${trans_id_list} 86759011d08SSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 86859011d08SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 86959011d08SSushil Singh 87059011d08SSushil Singh ${trans_id_emptylist}= Create List 87159011d08SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 87259011d08SSushil Singh Redfish Delete Session ${session_info} 87359011d08SSushil Singh 87459011d08SSushil Singh 8751b59053dSSushil SinghVerify Fail To Release Multiple Lock With Invalid TransactionID 8761b59053dSSushil Singh [Documentation] Verify release multiple locks with invalid transaction ID fails. 877d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 878d03f2ce1SSushil Singh 879d03f2ce1SSushil Singh # Description of argument(s): 880d03f2ce1SSushil Singh # client_id This client id can contain string value 881d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 882d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 883d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 884d03f2ce1SSushil Singh 885d03f2ce1SSushil Singh ${trans_id_list}= Create List 886d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 887d03f2ce1SSushil Singh 888d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 889d03f2ce1SSushil Singh 890d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 891d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 892d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 893d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 894d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 895d03f2ce1SSushil Singh 896d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 897d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 898d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 899d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 900d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 901d03f2ce1SSushil Singh 902d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 903d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 904d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 905d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 906d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 907d03f2ce1SSushil Singh 908d03f2ce1SSushil Singh Release Locks On Resource 909d03f2ce1SSushil Singh ... ${session_info} ${trans_id_list} 910d03f2ce1SSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 911d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 912d03f2ce1SSushil Singh 913d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 914d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 915d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 916d03f2ce1SSushil Singh 917d03f2ce1SSushil Singh 918*8bee358fSSushil SinghVerify Fail To Release Multiple Lock With Valid And Invalid TransactionID 919*8bee358fSSushil Singh [Documentation] Verify fail to be release multiple lock with valid and invalid trasaction ID. 920*8bee358fSSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 921*8bee358fSSushil Singh 922*8bee358fSSushil Singh # Description of argument(s): 923*8bee358fSSushil Singh # client_id This client id can contain string value 924*8bee358fSSushil Singh # (e.g. 12345, "HMCID"). 925*8bee358fSSushil Singh # lock_type Read lock or Write lock. 926*8bee358fSSushil Singh # release_lock_type The value can be Transaction or Session. 927*8bee358fSSushil Singh 928*8bee358fSSushil Singh ${trans_id_list}= Create List 929*8bee358fSSushil Singh @{lock_type_list}= Split String ${lock_type} , 930*8bee358fSSushil Singh 931*8bee358fSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 932*8bee358fSSushil Singh 933*8bee358fSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 934*8bee358fSSushil Singh Append To List ${trans_id_list} ${trans_id} 935*8bee358fSSushil Singh 936*8bee358fSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 937*8bee358fSSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 938*8bee358fSSushil Singh ${value}= Evaluate ${value} + 10 939*8bee358fSSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 940*8bee358fSSushil Singh Append To List ${trans_id_list} ${trans_id} 941*8bee358fSSushil Singh 942*8bee358fSSushil Singh Release Locks On Resource 943*8bee358fSSushil Singh ... ${session_info} ${trans_id_list} 944*8bee358fSSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 945*8bee358fSSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 946*8bee358fSSushil Singh 947*8bee358fSSushil Singh ${trans_id_emptylist}= Create List 948*8bee358fSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 949*8bee358fSSushil Singh Redfish Delete Session ${session_info} 950*8bee358fSSushil Singh 951*8bee358fSSushil Singh 952d03f2ce1SSushil SinghVerify Fail To Release Lock For Another Session 953d03f2ce1SSushil Singh [Documentation] Verify failed to release the lock form another session. 954d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 955d03f2ce1SSushil Singh 956d03f2ce1SSushil Singh # Description of argument(s): 957d03f2ce1SSushil Singh # client_id This client id can contain string value 958d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 959d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 960d03f2ce1SSushil Singh 961d03f2ce1SSushil Singh ${client_ids}= Split String ${client_id} , 962d03f2ce1SSushil Singh ${lock_type_list}= Split String ${lock_type} , 963d03f2ce1SSushil Singh ${trans_id_list1}= Create List 964d03f2ce1SSushil Singh ${trans_id_list2}= Create List 965d03f2ce1SSushil Singh 966d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0] 967d03f2ce1SSushil Singh 968d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 969d03f2ce1SSushil Singh Append To List ${trans_id_list1} ${trans_id} 970d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 971d03f2ce1SSushil Singh 972d03f2ce1SSushil Singh ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1] 973d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 974d03f2ce1SSushil Singh Append To List ${trans_id_list2} ${trans_id} 975d03f2ce1SSushil Singh Verify Lock On Resource ${session_info2} ${trans_id_list2} 976d03f2ce1SSushil Singh 977d03f2ce1SSushil Singh Release Locks On Resource 978d03f2ce1SSushil Singh ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_UNAUTHORIZED} 979d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 980d03f2ce1SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session 981d03f2ce1SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session 982d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 983d03f2ce1SSushil Singh Redfish Delete Session ${session_info2} 984d03f2ce1SSushil Singh 985d03f2ce1SSushil Singh 986e33c6e6aSSushil SinghVerify Fail To Acquire Lock For Invalid Resource ID Data Type 987e33c6e6aSSushil Singh [Documentation] Verify fail to acquire the lock with invalid resource id data type. 988e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 989e33c6e6aSSushil Singh 990e33c6e6aSSushil Singh # Description of argument(s): 991e33c6e6aSSushil Singh # client_id This client id can contain string value 992e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 993e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 994e33c6e6aSSushil Singh 995e33c6e6aSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 996e33c6e6aSSushil Singh Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 997e33c6e6aSSushil Singh ... ${lock_type} status_code=${HTTP_BAD_REQUEST} 998e33c6e6aSSushil Singh Redfish Delete Session ${session_info} 999e33c6e6aSSushil Singh 1000e33c6e6aSSushil Singh 1001d03f2ce1SSushil SinghVerify Fail To Acquire Lock For Invalid Lock Data 100216b3c7bfSGeorge Keishing [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segment flags. 1003d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${message} 1004d03f2ce1SSushil Singh 1005d03f2ce1SSushil Singh # Description of argument(s): 1006d03f2ce1SSushil Singh # client_id This client id can contain string value 1007d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 1008d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 1009d03f2ce1SSushil Singh # message Return message from URI. 1010d03f2ce1SSushil Singh 1011d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 1012d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Invalid Lock ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST} 1013d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 1014bace3005SSushil Singh 1015bace3005SSushil Singh 1016bace3005SSushil SinghVerify No Locks Records For Session With No Acquired Lock 1017bace3005SSushil Singh [Documentation] Verify no records found for a session where no lock is acquired. 1018bace3005SSushil Singh [Arguments] ${client_id} 1019bace3005SSushil Singh 1020bace3005SSushil Singh # Description of argument(s): 1021bace3005SSushil Singh # client_id This client id can contain string value 1022bace3005SSushil Singh # (e.g. 12345, "HMCID"). 1023bace3005SSushil Singh 1024bace3005SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 1025bace3005SSushil Singh ${trans_id_emptylist}= Create List 1026bace3005SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 1027bace3005SSushil Singh Redfish Delete Session ${session_info} 1028728ef9c9SSushil Singh 1029728ef9c9SSushil Singh 1030728ef9c9SSushil SinghCreate List Of Session ID 1031728ef9c9SSushil Singh [Documentation] Create session id list from session dict info. 1032728ef9c9SSushil Singh [Arguments] ${session_dict_info} 1033728ef9c9SSushil Singh 1034728ef9c9SSushil Singh # Description of argument(s): 1035728ef9c9SSushil Singh # session_dict_info Session information in dict. 1036728ef9c9SSushil Singh 1037728ef9c9SSushil Singh @{session_id_list}= Create List 1038728ef9c9SSushil Singh 1039728ef9c9SSushil Singh FOR ${session} IN @{session_dict_info} 1040728ef9c9SSushil Singh Append To List ${session_id_list} ${session["SessionIDs"]} 1041728ef9c9SSushil Singh END 1042728ef9c9SSushil Singh 1043728ef9c9SSushil Singh ${num_id}= Get Length ${session_id_list} 1044728ef9c9SSushil Singh Should Not Be Equal As Integers ${num_id} ${0} 1045728ef9c9SSushil Singh 1046728ef9c9SSushil Singh ${session_id_list}= Evaluate json.dumps(${session_id_list}) json 1047728ef9c9SSushil Singh 1048728ef9c9SSushil Singh [Return] ${session_id_list} 1049728ef9c9SSushil Singh 1050728ef9c9SSushil Singh 1051728ef9c9SSushil SinghGet Locks List On Resource With Session List 1052728ef9c9SSushil Singh [Documentation] Get locks list from session of list. 1053728ef9c9SSushil Singh [Arguments] ${session_id_list} ${exp_status_code}=${HTTP_OK} 1054728ef9c9SSushil Singh 1055728ef9c9SSushil Singh # Description of argument(s): 1056728ef9c9SSushil Singh # session_id_list Session ids list. 1057728ef9c9SSushil Singh # exp_status_code Expected HTTP status code. 1058728ef9c9SSushil Singh 1059728ef9c9SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 1060728ef9c9SSushil Singh ... data={"SessionIDs": ${session_id_list}} 1061728ef9c9SSushil Singh ${locks}= Evaluate json.loads('''${resp.text}''') json 1062728ef9c9SSushil Singh 1063728ef9c9SSushil Singh [Return] ${locks} 1064728ef9c9SSushil Singh 1065728ef9c9SSushil Singh 1066728ef9c9SSushil SinghVerify List Of Session Lock On Resource 1067728ef9c9SSushil Singh [Documentation] Verify list of lock record from list of sessions. 1068728ef9c9SSushil Singh [Arguments] ${session_dict_info} ${transaction_id_list} 1069728ef9c9SSushil Singh 1070728ef9c9SSushil Singh # Description of argument(s): 1071728ef9c9SSushil Singh # session_dict_info Session information in dict. 1072728ef9c9SSushil Singh # transaction_id_list Transaction id in list stored in dict. 1073728ef9c9SSushil Singh 1074728ef9c9SSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_info} 1075728ef9c9SSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 1076728ef9c9SSushil Singh ${lock_list}= Set Variable ${lock_list_resp['Records']} 1077728ef9c9SSushil Singh 1078728ef9c9SSushil Singh FOR ${session_id} ${tran_id} ${lock_record} IN ZIP ${session_dict_info} ${transaction_id_list} ${lock_list} 1079728ef9c9SSushil Singh Valid Value session_id['SessionIDs'] ['${lock_record['SessionID']}'] 1080728ef9c9SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock_record['TransactionID']} 1081728ef9c9SSushil Singh END 1082728ef9c9SSushil Singh 1083728ef9c9SSushil Singh 1084728ef9c9SSushil SinghVerify Lock Records Of Multiple Session 1085728ef9c9SSushil Singh [Documentation] Verify all records found for a multiple sessions. 1086728ef9c9SSushil Singh [Arguments] ${client_ids} ${lock_type} 1087728ef9c9SSushil Singh 1088728ef9c9SSushil Singh # Description of argument(s): 1089728ef9c9SSushil Singh # client_ids This client id can contain string value 1090728ef9c9SSushil Singh # (e.g. 12345, "HMCID"). 1091728ef9c9SSushil Singh # lock_type Read lock or Write lock. 1092728ef9c9SSushil Singh 1093728ef9c9SSushil Singh ${client_id_list}= Split String ${client_ids} , 1094728ef9c9SSushil Singh ${lock_type_list}= Split String ${lock_type} , 1095728ef9c9SSushil Singh ${trans_id_list1}= Create List 1096728ef9c9SSushil Singh ${trans_id_list2}= Create List 1097728ef9c9SSushil Singh 1098728ef9c9SSushil Singh ${session_dict_list}= Create List 1099728ef9c9SSushil Singh ${lock_list}= Create List 1100728ef9c9SSushil Singh 1101728ef9c9SSushil Singh ${client_id1}= Create List 1102728ef9c9SSushil Singh Append To List ${client_id1} ${client_id_list}[0] 1103728ef9c9SSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 1104728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 1105728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 1106728ef9c9SSushil Singh 1107728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1108728ef9c9SSushil Singh Append To List ${trans_id_list1} ${trans_id} 1109728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 1110728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 1111728ef9c9SSushil Singh 1112728ef9c9SSushil Singh 1113728ef9c9SSushil Singh ${client_id2}= Create List 1114728ef9c9SSushil Singh Append To List ${client_id2} ${client_id_list}[1] 1115728ef9c9SSushil Singh ${session_info2}= Create Session With List Of ClientID ${client_id2} 1116728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 1117728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id2} ${session_info2} 1118728ef9c9SSushil Singh 1119728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 1120728ef9c9SSushil Singh Append To List ${trans_id_list2} ${trans_id} 1121728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 1122728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_list2} 1123728ef9c9SSushil Singh 1124728ef9c9SSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 1125728ef9c9SSushil Singh 1126728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 1127728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 1128728ef9c9SSushil Singh 1129728ef9c9SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 1130728ef9c9SSushil Singh 1131728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info2}[0] SessionToken 1132728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 1133728ef9c9SSushil Singh 1134728ef9c9SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Transaction 1135728ef9c9SSushil Singh 1136728ef9c9SSushil Singh ${trans_id_emptylist}= Create List 1137728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 1138728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_emptylist} 1139728ef9c9SSushil Singh 1140728ef9c9SSushil Singh Redfish Delete List Of Session ${session_dict_list} 1141f9a536caSSushil Singh 1142f9a536caSSushil Singh 1143f9a536caSSushil SinghVerify Lock Records For Multiple Invalid Session 1144f9a536caSSushil Singh [Documentation] Verify no lock record found for multiple invalid session. 1145f9a536caSSushil Singh [Arguments] ${client_id} 1146f9a536caSSushil Singh 1147f9a536caSSushil Singh # Description of argument(s): 1148f9a536caSSushil Singh # client_id This client id can contain string value 1149f9a536caSSushil Singh # (e.g. 12345, "HMCID"). 1150f9a536caSSushil Singh 1151f9a536caSSushil Singh ${session_dict_list}= Create List 1152f9a536caSSushil Singh ${invalid_session_ids}= Create List xxyXyyYZZz xXyXYyYZzz 1153f9a536caSSushil Singh 1154f9a536caSSushil Singh ${session_info1}= Create Session With ClientID ${client_id} 1155f9a536caSSushil Singh 1156f9a536caSSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 1157f9a536caSSushil Singh set to dictionary ${session_info2} SessionIDs ${invalid_session_ids}[0] 1158f9a536caSSushil Singh Append To List ${session_dict_list} ${session_info2} 1159f9a536caSSushil Singh 1160f9a536caSSushil Singh ${session_info3}= Copy Dictionary ${session_info1} deepcopy=True 1161f9a536caSSushil Singh set to dictionary ${session_info3} SessionIDs ${invalid_session_ids}[0] 1162f9a536caSSushil Singh Append To List ${session_dict_list} ${session_info3} 1163f9a536caSSushil Singh 1164f9a536caSSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 1165f9a536caSSushil Singh ${lock_length1}= Get Length ${lock_list1} 1166f9a536caSSushil Singh 1167f9a536caSSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_list} 1168f9a536caSSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 1169f9a536caSSushil Singh ${lock_length2}= Get Length ${lock_list_resp['Records']} 1170f9a536caSSushil Singh 1171f9a536caSSushil Singh Should Be Equal As Integers ${lock_length1} ${lock_length2} 1172f9a536caSSushil Singh 1173f9a536caSSushil Singh Redfish Delete Session ${session_info1} 117411949a2cSSushil Singh 117511949a2cSSushil Singh 117611949a2cSSushil SinghVerify Lock Records For Multiple Invalid And Valid Session 117711949a2cSSushil Singh [Documentation] Verify all records found for a valid and invalid sessions. 117811949a2cSSushil Singh [Arguments] ${client_ids} ${lock_type} 117911949a2cSSushil Singh 118011949a2cSSushil Singh # Description of argument(s): 118111949a2cSSushil Singh # client_ids This client id can contain string value 118211949a2cSSushil Singh # (e.g. 12345, "HMCID"). 118311949a2cSSushil Singh # lock_type Read lock or Write lock. 118411949a2cSSushil Singh 118511949a2cSSushil Singh ${client_id_list}= Split String ${client_ids} , 118611949a2cSSushil Singh ${lock_type_list}= Split String ${lock_type} , 118711949a2cSSushil Singh ${trans_id_list1}= Create List 118811949a2cSSushil Singh ${invalid_session_ids}= Create List xxyXyyYZZz 118911949a2cSSushil Singh 119011949a2cSSushil Singh ${session_dict_list}= Create List 119111949a2cSSushil Singh ${lock_list}= Create List 119211949a2cSSushil Singh 119311949a2cSSushil Singh ${client_id1}= Create List 119411949a2cSSushil Singh Append To List ${client_id1} ${client_id_list}[0] 119511949a2cSSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 119611949a2cSSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 119711949a2cSSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 119811949a2cSSushil Singh 119911949a2cSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 120011949a2cSSushil Singh Append To List ${trans_id_list1} ${trans_id} 120111949a2cSSushil Singh Append To List ${lock_list} ${trans_id} 120211949a2cSSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 120311949a2cSSushil Singh 120411949a2cSSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 120511949a2cSSushil Singh set to dictionary ${session_info2}[0] SessionIDs ${invalid_session_ids}[0] 120611949a2cSSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 120711949a2cSSushil Singh 120811949a2cSSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 120911949a2cSSushil Singh 121011949a2cSSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 121111949a2cSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 121211949a2cSSushil Singh 121311949a2cSSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 121411949a2cSSushil Singh 121511949a2cSSushil Singh ${trans_id_emptylist}= Create List 121611949a2cSSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 121711949a2cSSushil Singh 121811949a2cSSushil Singh Redfish Delete Session ${session_info1}[0] 1219