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 11fbd67007SGeorge KeishingLibrary JSONLibrary 12bc331e22SVijay 13*7e49fd5dSGeorge KeishingSuite Setup Run Keyword And Ignore Error Delete All Redfish And HMC Sessions 14*7e49fd5dSGeorge KeishingSuite Teardown Run Keyword And Ignore Error Delete All Redfish And HMC Sessions 15*7e49fd5dSGeorge KeishingTest Setup Delete All Redfish And HMC Sessions 16*7e49fd5dSGeorge KeishingTest Teardown Run Keywords FFDC On Test Case Fail AND Restart Bmcweb On Failure 17bc331e22SVijay 18bc331e22SVijay*** Variables *** 19bc331e22SVijay 20e3f2e3baSSushil Singh${CONFLICT_RQUEST} Conflict 21d03f2ce1SSushil Singh${BAD_REQUEST} Bad Request 228d420bf6SSushil Singh&{default_trans_id} TransactionID=${1} 23bc331e22SVijay 24bc331e22SVijay*** Test Cases *** 25bc331e22SVijay 26d03f2ce1SSushil SinghAcquire Read Write Lock 27bc331e22SVijay [Documentation] Acquire and release different read locks. 28d03f2ce1SSushil Singh [Tags] Acquire_Read_Write_Lock 29d03f2ce1SSushil Singh [Template] Acquire Lock On Resource 30bc331e22SVijay 31d03f2ce1SSushil Singh # client_id lock_type reboot_flag 32d03f2ce1SSushil Singh HMCID-01 ReadCase1 False 33d03f2ce1SSushil Singh HMCID-01 ReadCase2 False 34d03f2ce1SSushil Singh HMCID-01 ReadCase3 False 35d03f2ce1SSushil Singh HMCID-01 WriteCase1 False 36d03f2ce1SSushil Singh HMCID-01 WriteCase2 False 37d03f2ce1SSushil Singh HMCID-01 WriteCase3 False 38bc331e22SVijay 39bc331e22SVijay 40d8bf1424SSushil SinghVerify Lock Is Not Persistent On BMC Reboot 41d8bf1424SSushil Singh [Documentation] Acquire lock and after reboot the locks are removed as no persistency 42d8bf1424SSushil Singh ... maintained. 43d8bf1424SSushil Singh [Tags] Verify_Lock_Is_Not_Persistent_On_BMC_Reboot 44d03f2ce1SSushil Singh [Template] Acquire Lock On Resource 45bc331e22SVijay 46d03f2ce1SSushil Singh # client_id lock_type reboot_flag 47d03f2ce1SSushil Singh HMCID-01 ReadCase1 True 48d03f2ce1SSushil Singh HMCID-01 ReadCase2 True 49d03f2ce1SSushil Singh HMCID-01 ReadCase3 True 50d03f2ce1SSushil Singh HMCID-01 WriteCase1 True 51d03f2ce1SSushil Singh HMCID-01 WriteCase2 True 52d03f2ce1SSushil Singh HMCID-01 WriteCase3 True 53bc331e22SVijay 54bc331e22SVijay 558d420bf6SSushil SinghCheck After Reboot Transaction ID Set To Default 568d420bf6SSushil Singh [Documentation] After reboot, the transaction id starts with default i.e. 1, 577fd1ac06SGeorge Keishing ... if any lock is acquired. 588d420bf6SSushil Singh [Tags] Check_After_Reboot_Transaction_ID_Set_To_Default 598d420bf6SSushil Singh [Template] Verify Acquire And Release Lock In Loop 608d420bf6SSushil Singh 618d420bf6SSushil Singh # client_id lock_type reboot_flag 628d420bf6SSushil Singh HMCID-01 ReadCase1 True 638d420bf6SSushil Singh HMCID-01 WriteCase1 True 648d420bf6SSushil Singh 658d420bf6SSushil Singh 66d03f2ce1SSushil SinghAcquire Read Lock On Read Lock 67d03f2ce1SSushil Singh [Documentation] Acquire read lock on another read lock. 68d03f2ce1SSushil Singh [Tags] Acquire_Read_Lock_On_Read_Lock 69d03f2ce1SSushil Singh [Template] Acquire Lock On Another Lock 70bc331e22SVijay 71d03f2ce1SSushil Singh # client_id 72d03f2ce1SSushil Singh HMCID-01 73bc331e22SVijay 74bc331e22SVijay 75d03f2ce1SSushil SinghFail To Acquire Lock On Another Lock 76d03f2ce1SSushil Singh [Documentation] Fail to acquire another lock. 77d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_On_Another_Lock 78d03f2ce1SSushil Singh [Template] Verify Acquire Lock Fails On Another Lock 7985610eeeSVijay 80d03f2ce1SSushil Singh # client_id lock_type 815d05994bSSushil Singh HMCID-01 ReadCase7,WriteCase6 825d05994bSSushil Singh HMCID-01 WriteCase6,WriteCase6 835d05994bSSushil Singh HMCID-01 WriteCase6,ReadCase7 84566daaf3SGeorge Keishing 85566daaf3SGeorge Keishing 86e33c6e6aSSushil SinghAcquire Lock After Reboot 87e33c6e6aSSushil Singh [Documentation] Acquire and release read and write locks after reboot. 88e33c6e6aSSushil Singh [Tags] Acquire_Lock_After_Reboot 89e33c6e6aSSushil Singh [Template] Verify Acquire Lock After Reboot 90e33c6e6aSSushil Singh 91e33c6e6aSSushil Singh # client_id lock_type 92e33c6e6aSSushil Singh HMCID-01 ReadCase1 93e33c6e6aSSushil Singh HMCID-01 ReadCase2 94e33c6e6aSSushil Singh HMCID-01 ReadCase3 95e33c6e6aSSushil Singh HMCID-01 WriteCase1 96e33c6e6aSSushil Singh HMCID-01 WriteCase2 97e33c6e6aSSushil Singh HMCID-01 WriteCase3 98e33c6e6aSSushil Singh 99e33c6e6aSSushil Singh 100d03f2ce1SSushil SinghAcquire And Release Lock In Loop 101d03f2ce1SSushil Singh [Documentation] Acquire and release read, write locks in loop. 102d03f2ce1SSushil Singh [Tags] Acquire_And_Release_Lock_In_Loop 103d03f2ce1SSushil Singh [Template] Verify Acquire And Release Lock In Loop 104566daaf3SGeorge Keishing 105d03f2ce1SSushil Singh # client_id lock_type 106d03f2ce1SSushil Singh HMCID-01 ReadCase1 107d03f2ce1SSushil Singh HMCID-01 ReadCase2 108d03f2ce1SSushil Singh HMCID-01 ReadCase3 109d03f2ce1SSushil Singh HMCID-01 WriteCase1 110d03f2ce1SSushil Singh HMCID-01 WriteCase2 111d03f2ce1SSushil Singh HMCID-01 WriteCase3 11285610eeeSVijay 11385610eeeSVijay 114977f8f58SSushil SinghFail To Acquire Read And Write In Single Request 115977f8f58SSushil Singh [Documentation] Fail to acquire read and write lock in single request. 116977f8f58SSushil Singh [Tags] Fail_To_Acquire_Read_And_Write_In_Single_Request 117977f8f58SSushil Singh [Template] Verify Fail To Acquire Read And Write In Single Request 118977f8f58SSushil Singh 119e3f2e3baSSushil Singh # client_id lock_type status_code 120e3f2e3baSSushil Singh HMCID-01 ReadCase1,WriteCase1 ${HTTP_CONFLICT} 121e3f2e3baSSushil Singh HMCID-01 WriteCase1,ReadCase1 ${HTTP_CONFLICT} 122e3f2e3baSSushil Singh HMCID-01 WriteCase1,WriteCase1 ${HTTP_CONFLICT} 123e3f2e3baSSushil Singh 124e3f2e3baSSushil Singh 125e3f2e3baSSushil SinghAcquire Read In Single Request 126e3f2e3baSSushil Singh [Documentation] Acquire read in single request. 127e3f2e3baSSushil Singh [Tags] Acquire_Read_In_Single_Request 128e3f2e3baSSushil Singh [Template] Verify Acquire Read In Single Request 129e3f2e3baSSushil Singh 130977f8f58SSushil Singh # client_id lock_type 131e3f2e3baSSushil Singh HMCID-01 ReadCase1,ReadCase1 132977f8f58SSushil Singh 133977f8f58SSushil Singh 134df390b61SSushil SinghAcquire Multiple Lock Request At CEC Level 135df390b61SSushil Singh [Documentation] Acquire write lock on read lock under CEC level. 136df390b61SSushil Singh [Tags] Acquire_Multiple_Lock_Request_At_CEC_Level 137df390b61SSushil Singh [Template] Verify Acquire Multiple Lock Request At CEC Level 138df390b61SSushil Singh 139df390b61SSushil Singh # client_id lock_type 140df390b61SSushil Singh HMCID-01 ReadCase4,WriteCase4 141df390b61SSushil Singh HMCID-01 WriteCase5,ReadCase5 142df390b61SSushil Singh HMCID-01 ReadCase6,WriteCase6 143df390b61SSushil Singh HMCID-01 WriteCase7,ReadCase7 144df390b61SSushil Singh 145df390b61SSushil Singh 146d03f2ce1SSushil SinghVerify Release Of Valid Locks 147d03f2ce1SSushil Singh [Documentation] Release all valid locks. 148d03f2ce1SSushil Singh [Tags] Verify_Release_Of_Valid_Locks 149d03f2ce1SSushil Singh [Template] Acquire And Release Multiple Locks 150afdd2a1dSVijay 151d03f2ce1SSushil Singh # client_id lock_type release_lock_type 152d03f2ce1SSushil Singh HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 153d03f2ce1SSushil Singh HMCID-02 ReadCase1,ReadCase1,ReadCase1 Session 154afdd2a1dSVijay 155afdd2a1dSVijay 15694116c61Ssusilsi7Release Lock When Session Deleted 15794116c61Ssusilsi7 [Documentation] Release lock when session gets deleted. 15894116c61Ssusilsi7 [Tags] Release_Lock_When_Session_Deleted 15994116c61Ssusilsi7 [Template] Verify Release Lock When Session Deleted 16094116c61Ssusilsi7 16194116c61Ssusilsi7 # client_id lock_type 16294116c61Ssusilsi7 HMCID-01 ReadCase1 16394116c61Ssusilsi7 HMCID-01 WriteCase1 16494116c61Ssusilsi7 16594116c61Ssusilsi7 16659011d08SSushil SinghFail To Release Lock With Invalid TransactionID 16759011d08SSushil Singh [Documentation] Fail to release lock with invalid transaction id. 16859011d08SSushil Singh [Tags] Fail_To_Release_Lock_With_Invalid_TransactionID 16959011d08SSushil Singh [Template] Verify Fail To Release Lock With Invalid TransactionID 17059011d08SSushil Singh 17159011d08SSushil Singh # client_id lock_type release_lock_type 17259011d08SSushil Singh HMCID-01 ReadCase1 Transaction 17343b0c063Ssusilsi7 HMCID-01 WriteCase1 Transaction 17459011d08SSushil Singh 17559011d08SSushil Singh 1761b59053dSSushil SinghFail To Release Multiple Lock With Invalid TransactionID 177d03f2ce1SSushil Singh [Documentation] Release in-valid lock result in fail. 1781b59053dSSushil Singh [Tags] Fail_To_Release_Multiple_Lock_With_Invalid_TransactionID 1791b59053dSSushil Singh [Template] Verify Fail To Release Multiple Lock With Invalid TransactionID 180afdd2a1dSVijay 181d03f2ce1SSushil Singh # client_id lock_type release_lock_type 182d03f2ce1SSushil Singh HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 183d03f2ce1SSushil Singh 12345 ReadCase2,ReadCase2,ReadCase2 Transaction 184d03f2ce1SSushil Singh HMCID ReadCase3,ReadCase3,ReadCase3 Transaction 185afdd2a1dSVijay 186afdd2a1dSVijay 1878bee358fSSushil SinghFail To Release Multiple Lock With Valid And Invalid TransactionID 1889614383dSGeorge Keishing [Documentation] Release multiple lock with valid and invalid transaction. 1898bee358fSSushil Singh [Tags] Fail_To_Release_Multiple_Lock_With_Valid_And_Invalid_TransactionID 1908bee358fSSushil Singh [Template] Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID 1918bee358fSSushil Singh 1928bee358fSSushil Singh # client_id lock_type release_lock_type 1938bee358fSSushil Singh HMCID-01 ReadCase1,ReadCase1 Transaction 1948bee358fSSushil Singh 1958bee358fSSushil Singh 1961d7b996cSsusilsi7Fail To Release Lock With String As TransactionID Data Type 1971d7b996cSsusilsi7 [Documentation] Fail to release lock with string as transaction id data type. 1981d7b996cSsusilsi7 [Tags] Fail_To_Release_Lock_With_String_As_TransactionID_Data_Type 1991d7b996cSsusilsi7 [Template] Verify Fail To Release Lock With TransactionID As String Type 2001d7b996cSsusilsi7 2011d7b996cSsusilsi7 # client_id lock_type release_lock_type 2021d7b996cSsusilsi7 HMCID-01 ReadCase1 Transaction 2031d7b996cSsusilsi7 HMCID-01 WriteCase1 Transaction 2041d7b996cSsusilsi7 2051d7b996cSsusilsi7 206d03f2ce1SSushil SinghFail To Release Lock For Another Session 207d03f2ce1SSushil Singh [Documentation] Failed to release locks from another session. 208d03f2ce1SSushil Singh [Tags] Fail_To_Release_Lock_For_Another_Session 209d03f2ce1SSushil Singh [Template] Verify Fail To Release Lock For Another Session 210afdd2a1dSVijay 211d03f2ce1SSushil Singh # client_id lock_type 212d03f2ce1SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 213afdd2a1dSVijay 214afdd2a1dSVijay 215e33c6e6aSSushil SinghTest Invalid Resource ID Data Type Locking 216e33c6e6aSSushil Singh [Documentation] Failed to acquire lock for invalid resource id data type. 217e33c6e6aSSushil Singh [Tags] Test_Invalid_Resource_ID_Data_Type_Locking 218e33c6e6aSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type 219e33c6e6aSSushil Singh 220e33c6e6aSSushil Singh # client_id lock_type 221e33c6e6aSSushil Singh HMCID-01 ReadCase1 222e33c6e6aSSushil Singh HMCID-01 ReadCase2 223e33c6e6aSSushil Singh HMCID-01 ReadCase3 224e33c6e6aSSushil Singh HMCID-01 WriteCase1 225e33c6e6aSSushil Singh HMCID-01 WriteCase2 226e33c6e6aSSushil Singh HMCID-01 WriteCase3 227e33c6e6aSSushil Singh 228e33c6e6aSSushil Singh 229d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Type 230d03f2ce1SSushil Singh [Documentation] Failed to acquire read, write lock for invalid lock data passed. 231d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type 232d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 233afdd2a1dSVijay 234d03f2ce1SSushil Singh # client_id lock_type message 235d03f2ce1SSushil Singh HMCID-01 ReadCase1 ${BAD_REQUEST} 236d03f2ce1SSushil Singh HMCID-01 ReadCase2 ${BAD_REQUEST} 237d03f2ce1SSushil Singh HMCID-01 ReadCase3 ${BAD_REQUEST} 238d03f2ce1SSushil Singh HMCID-01 ReadCase4 ${BAD_REQUEST} 239d03f2ce1SSushil Singh HMCID-01 ReadCase5 ${BAD_REQUEST} 240d03f2ce1SSushil Singh HMCID-01 WriteCase1 ${BAD_REQUEST} 241d03f2ce1SSushil Singh HMCID-01 WriteCase2 ${BAD_REQUEST} 242d03f2ce1SSushil Singh HMCID-01 WriteCase3 ${BAD_REQUEST} 243d03f2ce1SSushil Singh HMCID-01 WriteCase4 ${BAD_REQUEST} 244d03f2ce1SSushil Singh HMCID-01 WriteCase5 ${BAD_REQUEST} 245afdd2a1dSVijay 246afdd2a1dSVijay 247d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Flag 248d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid lock flag passed. 249d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag 250d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 251afdd2a1dSVijay 252d03f2ce1SSushil Singh # client_id lock_type message 253d03f2ce1SSushil Singh HMCID-01 ReadCase6 ${BAD_REQUEST} 254d03f2ce1SSushil Singh HMCID-01 ReadCase7 ${BAD_REQUEST} 255d03f2ce1SSushil Singh HMCID-01 ReadCase8 ${BAD_REQUEST} 256d03f2ce1SSushil Singh HMCID-01 ReadCase9 ${BAD_REQUEST} 257d03f2ce1SSushil Singh HMCID-01 ReadCase10 ${BAD_REQUEST} 258d03f2ce1SSushil Singh HMCID-01 ReadCase11 ${BAD_REQUEST} 259d03f2ce1SSushil Singh HMCID-01 WriteCase6 ${BAD_REQUEST} 260d03f2ce1SSushil Singh HMCID-01 WriteCase7 ${BAD_REQUEST} 261d03f2ce1SSushil Singh HMCID-01 WriteCase8 ${BAD_REQUEST} 262d03f2ce1SSushil Singh HMCID-01 WriteCase9 ${BAD_REQUEST} 263d03f2ce1SSushil Singh HMCID-01 WriteCase10 ${BAD_REQUEST} 264d03f2ce1SSushil Singh HMCID-01 WriteCase11 ${BAD_REQUEST} 265afdd2a1dSVijay 266afdd2a1dSVijay 267d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Segment Flag 268d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 269d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag 270d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 271d03f2ce1SSushil Singh 272d03f2ce1SSushil Singh # client_id lock_type message 273d03f2ce1SSushil Singh HMCID-01 ReadCase12 ${BAD_REQUEST} 274d03f2ce1SSushil Singh HMCID-01 ReadCase13 ${BAD_REQUEST} 275d03f2ce1SSushil Singh HMCID-01 ReadCase14 ${BAD_REQUEST} 276d03f2ce1SSushil Singh HMCID-01 WriteCase12 ${BAD_REQUEST} 277d03f2ce1SSushil Singh HMCID-01 WriteCase13 ${BAD_REQUEST} 278d03f2ce1SSushil Singh HMCID-01 WriteCase14 ${BAD_REQUEST} 279afdd2a1dSVijay 280bace3005SSushil Singh 2813b3a7ecaSSushil SinghFail To Acquire Lock For Invalid Segment Data Type Flag 2823b3a7ecaSSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 2833b3a7ecaSSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Data_Type_Flag 2843b3a7ecaSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 2853b3a7ecaSSushil Singh 2863b3a7ecaSSushil Singh # client_id lock_type message 2873b3a7ecaSSushil Singh HMCID-01 ReadCase15 ${EMPTY} 2883b3a7ecaSSushil Singh HMCID-01 ReadCase16 ${EMPTY} 2893b3a7ecaSSushil Singh HMCID-01 ReadCase17 ${EMPTY} 2903b3a7ecaSSushil Singh HMCID-01 ReadCase18 ${EMPTY} 2913b3a7ecaSSushil Singh HMCID-01 WriteCase15 ${EMPTY} 2923b3a7ecaSSushil Singh HMCID-01 WriteCase16 ${EMPTY} 2933b3a7ecaSSushil Singh HMCID-01 WriteCase17 ${EMPTY} 2943b3a7ecaSSushil Singh HMCID-01 WriteCase18 ${EMPTY} 2953b3a7ecaSSushil Singh 2963b3a7ecaSSushil Singh 297bace3005SSushil SinghGet Empty Lock Records For Session Where No Locks Acquired 298bace3005SSushil Singh [Documentation] If session does not acquire locks then get lock should return 299bace3005SSushil Singh ... empty lock records. 300bace3005SSushil Singh [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired 301bace3005SSushil Singh [Template] Verify No Locks Records For Session With No Acquired Lock 302bace3005SSushil Singh 303bace3005SSushil Singh # client_id 304bace3005SSushil Singh HMCID-01 305bace3005SSushil Singh 306728ef9c9SSushil Singh 307f9a536caSSushil SinghGet Lock Records Empty For Invalid Session 308f9a536caSSushil Singh [Documentation] Record of lock list is empty for invalid session. 309f9a536caSSushil Singh [Tags] Get_Lock_Records_Empty_For_Invalid_Session 310f9a536caSSushil Singh [Template] Verify Empty Lock Records For Invalid Session 311f9a536caSSushil Singh 312f9a536caSSushil Singh # client_id 313f9a536caSSushil Singh HMCID-01 314f9a536caSSushil Singh 315f9a536caSSushil Singh 316728ef9c9SSushil SinghGet Lock Records For Multiple Session 317728ef9c9SSushil Singh [Documentation] Get lock records of multiple session. 318728ef9c9SSushil Singh [Tags] Get_Lock_Records_For_Multiple_Session 319728ef9c9SSushil Singh [Template] Verify Lock Records Of Multiple Session 320728ef9c9SSushil Singh 321728ef9c9SSushil Singh # client_ids lock_type 322728ef9c9SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 323728ef9c9SSushil Singh 324728ef9c9SSushil Singh 325f9a536caSSushil SinghGet Lock Records For Multiple Invalid Session 326f9a536caSSushil Singh [Documentation] Record of lock list is empty for list of invalid session. 327f9a536caSSushil Singh [Tags] Get_Lock_Records_For_Multiple_Invalid_Session 328f9a536caSSushil Singh [Template] Verify Lock Records For Multiple Invalid Session 329f9a536caSSushil Singh 330f9a536caSSushil Singh # client_id 331f9a536caSSushil Singh HMCID-01 332f9a536caSSushil Singh 33311949a2cSSushil Singh 33411949a2cSSushil SinghGet Lock Records For Multiple Invalid And Valid Session 33511949a2cSSushil Singh [Documentation] Get record of lock from invalid and valid session. 33611949a2cSSushil Singh [Tags] Get_Lock_Records_For_Multiple_Invalid_And_Valid_Session 33711949a2cSSushil Singh [Template] Verify Lock Records For Multiple Invalid And Valid Session 33811949a2cSSushil Singh 33911949a2cSSushil Singh # client_id lock_type 34011949a2cSSushil Singh HMCID-01,HMCID-02 ReadCase1 34111949a2cSSushil Singh 342bc331e22SVijay*** Keywords *** 343bc331e22SVijay 344d03f2ce1SSushil SinghCreate Redfish Session With ClientID 345d03f2ce1SSushil Singh [Documentation] Create redifish session with client id. 346d03f2ce1SSushil Singh [Arguments] ${client_id} 34785610eeeSVijay 34885610eeeSVijay # Description of argument(s): 349d03f2ce1SSushil Singh # client_id This client id can contain string value 350d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 35185610eeeSVijay 352d03f2ce1SSushil Singh ${session_info}= Create Dictionary 353d03f2ce1SSushil Singh ${session}= Redfish Login kwargs="Oem":{"OpenBMC" : {"ClientID":"${client_id}"}} 35485610eeeSVijay 355d03f2ce1SSushil Singh Set To Dictionary ${session_info} SessionIDs ${session['Id']} 356d03f2ce1SSushil Singh Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]} 35785610eeeSVijay 358d03f2ce1SSushil Singh [Return] ${session_info} 35985610eeeSVijay 36085610eeeSVijay 361d03f2ce1SSushil SinghRW General Dictionary 36216b3c7bfSGeorge Keishing [Documentation] Create dictionary of lock request. 363d03f2ce1SSushil Singh [Arguments] ${read_case} ${res_id} 364bc331e22SVijay 365bc331e22SVijay # Description of argument(s): 366d03f2ce1SSushil Singh # read_case Read or Write lock type. 367d03f2ce1SSushil Singh # res_id Resource id. 368bc331e22SVijay 369d03f2ce1SSushil Singh ${request_dict}= Create Dictionary 370566daaf3SGeorge Keishing 371d03f2ce1SSushil Singh FOR ${key} IN @{read_case.keys()} 372d03f2ce1SSushil Singh Set To Dictionary ${request_dict} LockType ${key} 373d03f2ce1SSushil Singh Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]} 374d03f2ce1SSushil Singh END 375bc331e22SVijay 376d03f2ce1SSushil Singh Set To Dictionary ${request_dict} ResourceID ${res_id} 377d03f2ce1SSushil Singh 378d03f2ce1SSushil Singh [Return] ${request_dict} 379bc331e22SVijay 380bc331e22SVijay 381d03f2ce1SSushil SinghReturn Description Of Response 382d03f2ce1SSushil Singh [Documentation] Return description of REST response. 383bc331e22SVijay [Arguments] ${resp_text} 384bc331e22SVijay 385bc331e22SVijay # Description of argument(s): 386d03f2ce1SSushil Singh # resp_text REST response body. 387bc331e22SVijay 388d03f2ce1SSushil Singh # resp_text after successful partition file upload looks like: 389d03f2ce1SSushil Singh # { 390d03f2ce1SSushil Singh # "Description": "File Created" 391d03f2ce1SSushil Singh # } 392bc331e22SVijay 393d03f2ce1SSushil Singh ${message}= Evaluate json.loads('''${resp_text}''') json 394d03f2ce1SSushil Singh 395d03f2ce1SSushil Singh [Return] ${message} 396bc331e22SVijay 397bc331e22SVijay 398a7d71f02SSushil SinghVerify Redfish Session Deleted 399a7d71f02SSushil Singh [Documentation] Verify the redfish session is deleted. 400a7d71f02SSushil Singh [Arguments] ${session_info} 401a7d71f02SSushil Singh 402a7d71f02SSushil Singh # Description of argument(s): 403a7d71f02SSushil Singh # session_info Session information are stored in dictionary. 404a7d71f02SSushil Singh 405a7d71f02SSushil Singh # ${session_info} = { 406a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 407a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 408a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 409a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 410a7d71f02SSushil Singh # } 411a7d71f02SSushil Singh 412a7d71f02SSushil Singh # SessionIDs : Session IDs 413a7d71f02SSushil Singh # ClientID : Client ID 414a7d71f02SSushil Singh # SessionToken : Session token 415a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 416a7d71f02SSushil Singh 417a7d71f02SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions 418a7d71f02SSushil Singh 419a7d71f02SSushil Singh FOR ${session} IN @{sessions['Members']} 4208a3efe7cSSushil Singh Should Not Be Equal As Strings 4218a3efe7cSSushil Singh ... session ['/redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}'] 422a7d71f02SSushil Singh END 423a7d71f02SSushil Singh 424a7d71f02SSushil Singh 425a7d71f02SSushil SinghVerify Redfish List Of Session Deleted 426a7d71f02SSushil Singh [Documentation] Verify all the list of redfish session is deleted. 427a7d71f02SSushil Singh [Arguments] ${session_info_list} 428a7d71f02SSushil Singh 429a7d71f02SSushil Singh # Description of argument(s): 430a7d71f02SSushil Singh # session_info_list List contains individual session record are stored in dictionary. 431a7d71f02SSushil Singh 432a7d71f02SSushil Singh # ${session_info_list} = [{ 433a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 434a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 435a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 436a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 437a7d71f02SSushil Singh # }] 438a7d71f02SSushil Singh 439a7d71f02SSushil Singh # SessionIDs : Session IDs 440a7d71f02SSushil Singh # ClientID : Client ID 441a7d71f02SSushil Singh # SessionToken : Session token 442a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 443a7d71f02SSushil Singh 444a7d71f02SSushil Singh FOR ${session_record} IN @{session_info_list} 445a7d71f02SSushil Singh Verify Redfish Session Deleted ${session_record} 446a7d71f02SSushil Singh END 447a7d71f02SSushil Singh 448a7d71f02SSushil Singh 449d03f2ce1SSushil SinghRedfish Post Acquire Lock 450d03f2ce1SSushil Singh [Documentation] Acquire and release lock. 451d03f2ce1SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 452bc331e22SVijay 453bc331e22SVijay # Description of argument(s): 454d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 455d03f2ce1SSushil Singh # status_code HTTP status code. 456bc331e22SVijay 457e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Lock ${lock_type} 458fbd67007SGeorge Keishing ${lock_dict_param}= Convert JSON To String ${lock_dict_param} 4598a3efe7cSSushil Singh ${resp}= Redfish Post Request 4608a3efe7cSSushil Singh ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 461fbd67007SGeorge Keishing ... expected_status=any 462d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 463df390b61SSushil Singh 464df390b61SSushil Singh Run Keyword If ${status_code} == ${HTTP_BAD_REQUEST} 465df390b61SSushil Singh ... Valid Value ${BAD_REQUEST} ['${resp.content}'] 466df390b61SSushil Singh ... ELSE 467df390b61SSushil Singh ... Run Keyword And Return Return Description Of Response ${resp.content} 468bc331e22SVijay 469d03f2ce1SSushil Singh [Return] ${resp} 470bc331e22SVijay 471bc331e22SVijay 472977f8f58SSushil SinghRedfish Post Acquire List Lock 473977f8f58SSushil Singh [Documentation] Acquire and release lock. 474977f8f58SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 475977f8f58SSushil Singh 476977f8f58SSushil Singh # Description of argument(s): 477977f8f58SSushil Singh # lock_type Read lock or Write lock. 478977f8f58SSushil Singh # status_code HTTP status code. 479977f8f58SSushil Singh 480977f8f58SSushil Singh ${lock_dict_param}= Create Data To Acquire List Of Lock ${lock_type} 481fbd67007SGeorge Keishing ${lock_dict_param}= Convert JSON To String ${lock_dict_param} 4828a3efe7cSSushil Singh ${resp}= Redfish Post Request 4838a3efe7cSSushil Singh ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 484fbd67007SGeorge Keishing ... expected_status=any 485977f8f58SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 486977f8f58SSushil Singh 487e3f2e3baSSushil Singh Run Keyword If ${status_code} == ${HTTP_CONFLICT} 488e3f2e3baSSushil Singh ... Should Be Equal As Strings ${CONFLICT_RQUEST} ${resp.content} 489e3f2e3baSSushil Singh ... ELSE 490e3f2e3baSSushil Singh ... Run Keyword And Return Return Description Of Response ${resp.content} 491e3f2e3baSSushil Singh 492977f8f58SSushil Singh [Return] ${resp} 493977f8f58SSushil Singh 494977f8f58SSushil Singh 495d03f2ce1SSushil SinghRedfish Post Acquire Invalid Lock 496d03f2ce1SSushil Singh [Documentation] Redfish to post request to acquire in-valid lock. 497d03f2ce1SSushil Singh [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK} 498bc331e22SVijay 499bc331e22SVijay # Description of argument(s): 500d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 501d03f2ce1SSushil Singh # message Return message from URI. 502d03f2ce1SSushil Singh # status_code HTTP status code. 503bc331e22SVijay 504e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type} 505fbd67007SGeorge Keishing ${lock_dict_param}= Convert JSON To String ${lock_dict_param} 5068a3efe7cSSushil Singh ${resp}= Redfish Post Request 5078a3efe7cSSushil Singh ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 508d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 5093b3a7ecaSSushil Singh Run Keyword If '${message}' != '${EMPTY}' 5103b3a7ecaSSushil Singh ... Valid Value message ['${resp.content}'] 511d03f2ce1SSushil Singh 512d03f2ce1SSushil Singh [Return] ${resp} 513bc331e22SVijay 514bc331e22SVijay 515e33c6e6aSSushil SinghRedfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 516e33c6e6aSSushil Singh [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id. 517e33c6e6aSSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 518e33c6e6aSSushil Singh 519e33c6e6aSSushil Singh # Description of argument(s): 520e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 521e33c6e6aSSushil Singh # status_code HTTP status code. 522e33c6e6aSSushil Singh 5238a3efe7cSSushil Singh ${lock_dict_param}= 5248a3efe7cSSushil Singh ... Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type} 525fbd67007SGeorge Keishing ${lock_dict_param}= Convert JSON To String ${lock_dict_param} 5268a3efe7cSSushil Singh ${resp}= Redfish Post Request 5278a3efe7cSSushil Singh ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 528e33c6e6aSSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 529e33c6e6aSSushil Singh 530e33c6e6aSSushil Singh [Return] ${resp} 531e33c6e6aSSushil Singh 532e33c6e6aSSushil Singh 533d03f2ce1SSushil SinghForm Data To Acquire Lock 53416b3c7bfSGeorge Keishing [Documentation] Create a dictionary for lock request. 535d03f2ce1SSushil Singh [Arguments] ${lock_type} 536d03f2ce1SSushil Singh 537d03f2ce1SSushil Singh # Description of argument(s): 538d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 539d03f2ce1SSushil Singh 540d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 541d03f2ce1SSushil Singh ${resp}= RW General Dictionary 542d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 543d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 544d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 545e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 546d03f2ce1SSushil Singh 547e33c6e6aSSushil Singh [Return] ${lock_request_dict} 548e33c6e6aSSushil Singh 549e33c6e6aSSushil Singh 550977f8f58SSushil SinghCreate Data To Acquire List Of Lock 55116b3c7bfSGeorge Keishing [Documentation] Create a dictionary for list of lock request. 552977f8f58SSushil Singh [Arguments] ${lock_type_list} 553977f8f58SSushil Singh 554977f8f58SSushil Singh # Description of argument(s): 555977f8f58SSushil Singh # lock_type Read lock or Write lock. 556977f8f58SSushil Singh 557977f8f58SSushil Singh ${temp_list}= Create List 558977f8f58SSushil Singh ${lock_res_info}= Get Lock Resource Information 559977f8f58SSushil Singh 560977f8f58SSushil Singh FOR ${lock_type} IN @{lock_type_list} 561977f8f58SSushil Singh ${resp}= RW General Dictionary 562977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 563977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 564977f8f58SSushil Singh Append To List ${temp_list} ${resp} 565977f8f58SSushil Singh END 566977f8f58SSushil Singh 567977f8f58SSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 568977f8f58SSushil Singh 569977f8f58SSushil Singh [Return] ${lock_request_dict} 570977f8f58SSushil Singh 571977f8f58SSushil Singh 572e33c6e6aSSushil SinghForm Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID 57316b3c7bfSGeorge Keishing [Documentation] Create a dictionary for in-valid lock request. 574e33c6e6aSSushil Singh [Arguments] ${lock_type} 575e33c6e6aSSushil Singh 576e33c6e6aSSushil Singh # Description of argument(s): 577e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 578e33c6e6aSSushil Singh 579e33c6e6aSSushil Singh ${lock_res_info}= Get Lock Resource Information 580e33c6e6aSSushil Singh ${resp}= RW General Dictionary 581e33c6e6aSSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 582e33c6e6aSSushil Singh ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]} 583e33c6e6aSSushil Singh ${temp_list}= Create List ${resp} 584e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 585e33c6e6aSSushil Singh 586e33c6e6aSSushil Singh [Return] ${lock_request_dict} 587d03f2ce1SSushil Singh 588d03f2ce1SSushil Singh 589d03f2ce1SSushil SinghForm Data To Acquire Invalid Lock 59016b3c7bfSGeorge Keishing [Documentation] Create a dictionary for in-valid lock request. 591d03f2ce1SSushil Singh [Arguments] ${lock_type} 592d03f2ce1SSushil Singh 593d03f2ce1SSushil Singh # Description of argument(s): 594d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 595d03f2ce1SSushil Singh 596d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 597d03f2ce1SSushil Singh ${resp}= RW General Dictionary 598d03f2ce1SSushil Singh ... ${lock_res_info["Invalid Case"]["${lock_type}"]} 599d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 600d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 601e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 602d03f2ce1SSushil Singh 603e33c6e6aSSushil Singh [Return] ${lock_request_dict} 604d03f2ce1SSushil Singh 605d03f2ce1SSushil Singh 606d03f2ce1SSushil SinghGet Locks List On Resource 607bc331e22SVijay [Documentation] Get locks list. 608d03f2ce1SSushil Singh [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK} 609bc331e22SVijay 610bc331e22SVijay # Description of argument(s): 611d03f2ce1SSushil Singh # session_info Session information in dict. 612d03f2ce1SSushil Singh # exp_status_code Expected HTTP status code. 613bc331e22SVijay 614d03f2ce1SSushil Singh ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]} 615566daaf3SGeorge Keishing ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 616566daaf3SGeorge Keishing ... data=${data} 617bc331e22SVijay ${locks}= Evaluate json.loads('''${resp.text}''') json 618bc331e22SVijay 619bc331e22SVijay [Return] ${locks["Records"]} 620bc331e22SVijay 621bc331e22SVijay 622d03f2ce1SSushil SinghVerify Lock On Resource 623d03f2ce1SSushil Singh [Documentation] Verify lock on resource. 624d03f2ce1SSushil Singh [Arguments] ${session_info} ${transaction_id} 625bc331e22SVijay 626bc331e22SVijay # Description of argument(s): 627d03f2ce1SSushil Singh # session_info Session information in dict. 628d03f2ce1SSushil Singh # transaction_id Transaction id in list stored in dict. 629bc331e22SVijay 630d03f2ce1SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']} 631d03f2ce1SSushil Singh Rprint Vars sessions 632d03f2ce1SSushil Singh ${lock_list}= Get Locks List On Resource ${session_info} 633d03f2ce1SSushil Singh ${lock_length}= Get Length ${lock_list} 634d03f2ce1SSushil Singh ${tran_id_length}= Get Length ${transaction_id} 635d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id_length} ${lock_length} 636afdd2a1dSVijay 637d03f2ce1SSushil Singh FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list} 638d03f2ce1SSushil Singh Valid Value session_info['ClientID'] ['${lock['HMCID']}'] 639d03f2ce1SSushil Singh Valid Value session_info['SessionIDs'] ['${lock['SessionID']}'] 640d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']} 641bc331e22SVijay END 642bc331e22SVijay 643bc331e22SVijay 644d03f2ce1SSushil SinghAcquire Lock On Resource 645d03f2ce1SSushil Singh [Documentation] Acquire lock on resource. 646d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False 647bc331e22SVijay 648bc331e22SVijay # Description of argument(s): 649d03f2ce1SSushil Singh # client_id This client id can contain string value 650d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 651d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 652d03f2ce1SSushil Singh # reboot_flag Flag is used to run reboot the BMC code. 653d03f2ce1SSushil Singh # (e.g. True or False). 654bc331e22SVijay 6558a3efe7cSSushil Singh ${trans_id_emptylist}= Create List 656d03f2ce1SSushil Singh ${trans_id_list}= Create List 6578a3efe7cSSushil Singh 658d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 659d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 660d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 6618a3efe7cSSushil Singh 662d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 663566daaf3SGeorge Keishing 664e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 665bc331e22SVijay 666d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'True' 6678a3efe7cSSushil Singh ... Run Keywords Redfish BMC Reset Operation AND 668e33c6e6aSSushil Singh ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND 66907b25344SSushil Singh ... Wait Until Keyword Succeeds 3 min 10 sec Redfish BMC Match States match_state=Enabled AND 6708a3efe7cSSushil Singh ... Is BMC Standby AND 6718a3efe7cSSushil Singh ... Verify Lock On Resource ${session_info} ${trans_id_emptylist} 672bc331e22SVijay 673d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'False' 674d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 675bc331e22SVijay 676d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 677d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 678d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 679bc331e22SVijay 680bc331e22SVijay 681d03f2ce1SSushil SinghForm Data To Release Lock 682d03f2ce1SSushil Singh [Documentation] Create a dictonay to release lock. 683d03f2ce1SSushil Singh [Arguments] ${trans_id_list} 684355daac7SVijay 685355daac7SVijay # Description of argument(s): 686d03f2ce1SSushil Singh # trans_id_list 687355daac7SVijay 688d03f2ce1SSushil Singh @{tran_ids}= Create List 689355daac7SVijay 690d03f2ce1SSushil Singh FOR ${item} IN @{trans_id_list} 691d03f2ce1SSushil Singh Append To List ${tran_ids} ${item['TransactionID']} 692d03f2ce1SSushil Singh END 693d03f2ce1SSushil Singh 694d03f2ce1SSushil Singh [Return] ${tran_ids} 695d03f2ce1SSushil Singh 696d03f2ce1SSushil Singh 697d03f2ce1SSushil SinghRelease Locks On Resource 698d03f2ce1SSushil Singh [Documentation] Redfish request to release a lock. 6998a3efe7cSSushil Singh [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction 7008a3efe7cSSushil Singh ... ${status_code}=${HTTP_OK} 701d03f2ce1SSushil Singh 702d03f2ce1SSushil Singh # Description of argument(s): 703d03f2ce1SSushil Singh # session_info Session information in dict. 704d03f2ce1SSushil Singh # trans_id_list Transaction id list. 705d03f2ce1SSushil Singh # release_lock_type Release lock by Transaction, Session. 706d03f2ce1SSushil Singh # status_code HTTP status code. 707d03f2ce1SSushil Singh 708d03f2ce1SSushil Singh ${tran_ids}= Form Data To Release Lock ${trans_id_list} 709d03f2ce1SSushil Singh ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}} 710d03f2ce1SSushil Singh ${data}= Evaluate json.dumps(${data}) json 711d03f2ce1SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data} 712d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 713d03f2ce1SSushil Singh 714d03f2ce1SSushil Singh 715df390b61SSushil SinghRelease locks And Delete Session 716df390b61SSushil Singh [Documentation] Release locks and delete redfish session. 717df390b61SSushil Singh [Arguments] ${session_info} ${trans_id_list} 718df390b61SSushil Singh 719df390b61SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} 720df390b61SSushil Singh 721df390b61SSushil Singh ${trans_id_emptylist}= Create List 722df390b61SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 723df390b61SSushil Singh 724df390b61SSushil Singh Redfish Delete Session ${session_info} 725df390b61SSushil Singh 726df390b61SSushil Singh 727d03f2ce1SSushil SinghAcquire Lock On Another Lock 728d03f2ce1SSushil Singh [Documentation] Acquire lock on another lock. 729d03f2ce1SSushil Singh [Arguments] ${client_id} 730d03f2ce1SSushil Singh 731d03f2ce1SSushil Singh # Description of argument(s): 732d03f2ce1SSushil Singh # client_id This client id can contain string value 733d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 734d03f2ce1SSushil Singh 735d03f2ce1SSushil Singh ${trans_id_list}= Create List 736d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 737d03f2ce1SSushil Singh 738d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 739d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 740d03f2ce1SSushil Singh 741d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 742d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 743d03f2ce1SSushil Singh 744d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 745d03f2ce1SSushil Singh 746df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 747d03f2ce1SSushil Singh 748d03f2ce1SSushil Singh 749977f8f58SSushil SinghVerify Fail To Acquire Read And Write In Single Request 750977f8f58SSushil Singh [Documentation] Verify fail to acquire read and write lock passed in single request. 751e3f2e3baSSushil Singh [Arguments] ${client_id} ${lock_type} ${status_code} 752e3f2e3baSSushil Singh 753e3f2e3baSSushil Singh # Description of argument(s): 754e3f2e3baSSushil Singh # client_id This client id can contain string value 755e3f2e3baSSushil Singh # (e.g. 12345, "HMCID"). 756e3f2e3baSSushil Singh # lock_type Read lock or Write lock. 757e3f2e3baSSushil Singh # status_code HTTP status code 758e3f2e3baSSushil Singh 759e3f2e3baSSushil Singh ${lock_type_list}= Split String ${lock_type} , 760e3f2e3baSSushil Singh 761e3f2e3baSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 762e3f2e3baSSushil Singh ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list} status_code=${status_code} 763e3f2e3baSSushil Singh Redfish Delete Session ${session_info} 764e3f2e3baSSushil Singh 765e3f2e3baSSushil Singh 766e3f2e3baSSushil SinghVerify Acquire Read In Single Request 767e3f2e3baSSushil Singh [Documentation] Verify acquire read in single request. 768977f8f58SSushil Singh [Arguments] ${client_id} ${lock_type} 769977f8f58SSushil Singh 770977f8f58SSushil Singh # Description of argument(s): 771977f8f58SSushil Singh # client_id This client id can contain string value 772977f8f58SSushil Singh # (e.g. 12345, "HMCID"). 773977f8f58SSushil Singh # lock_type Read lock or Write lock. 774977f8f58SSushil Singh 775e3f2e3baSSushil Singh ${trans_id_list}= Create List 776977f8f58SSushil Singh ${lock_type_list}= Split String ${lock_type} , 777977f8f58SSushil Singh 778977f8f58SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 779e3f2e3baSSushil Singh ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list} 780e3f2e3baSSushil Singh Append To List ${trans_id_list} ${trans_id} 781e3f2e3baSSushil Singh Append To List ${trans_id_list} ${trans_id} 782e3f2e3baSSushil Singh 783e3f2e3baSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 784e3f2e3baSSushil Singh Remove From List ${trans_id_list} 1 785e3f2e3baSSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} 786e3f2e3baSSushil Singh 787977f8f58SSushil Singh Redfish Delete Session ${session_info} 788977f8f58SSushil Singh 789977f8f58SSushil Singh 790d03f2ce1SSushil SinghVerify Empty Lock Records For Invalid Session 791d03f2ce1SSushil Singh [Documentation] Verify no lock record found for invalid session. 792d03f2ce1SSushil Singh [Arguments] ${client_id} 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 798d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_id} 799d03f2ce1SSushil Singh 800d03f2ce1SSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 801d03f2ce1SSushil Singh ${lock_length1}= Get Length ${lock_list1} 802d03f2ce1SSushil Singh 803d03f2ce1SSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 804d03f2ce1SSushil Singh set to dictionary ${session_info2} SessionIDs xxyXyyYZZz 805d03f2ce1SSushil Singh 806d03f2ce1SSushil Singh ${lock_list2}= Get Locks List On Resource ${session_info2} 807f9a536caSSushil Singh ${lock_length2}= Get Length ${lock_list2} 808d03f2ce1SSushil Singh 809f9a536caSSushil Singh Should Be Equal As Integers ${lock_length1} ${lock_length2} 810d03f2ce1SSushil Singh 811d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 812d03f2ce1SSushil Singh 813d03f2ce1SSushil Singh 814d03f2ce1SSushil SinghVerify Acquire Lock Fails On Another Lock 815d03f2ce1SSushil Singh [Documentation] Verify acquire lock on another lock fails. 816d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 817d03f2ce1SSushil Singh 818d03f2ce1SSushil Singh # Description of argument(s): 819d03f2ce1SSushil Singh # client_id This client id can contain string value 820d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 821d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 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 Append To List ${trans_id_list} ${trans_id} 829d03f2ce1SSushil Singh 830d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 831d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 832d03f2ce1SSushil Singh 833df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 834d03f2ce1SSushil Singh 835d03f2ce1SSushil Singh 836e33c6e6aSSushil SinghVerify Acquire Lock After Reboot 837e33c6e6aSSushil Singh [Documentation] Acquire read and write lock after the reboot and release lock. 838e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 839e33c6e6aSSushil Singh 840e33c6e6aSSushil Singh # Description of argument(s): 841e33c6e6aSSushil Singh # client_id This client id can contain string value 842e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 843e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 844e33c6e6aSSushil Singh 845e33c6e6aSSushil Singh ${trans_id_list}= Create List 846f9a536caSSushil Singh ${session_info}= Create Session With ClientID ${client_id} 847ac229c79SSushil Singh 848e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 849ac229c79SSushil Singh Redfish BMC Reset Operation 850e33c6e6aSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} 85107b25344SSushil Singh Wait Until Keyword Succeeds 3 min 10 sec Redfish BMC Match States match_state=Enabled 852ac229c79SSushil Singh Is BMC Standby 853e33c6e6aSSushil Singh 854e33c6e6aSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 855e33c6e6aSSushil Singh Append To List ${trans_id_list} ${trans_id} 856e33c6e6aSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 857e33c6e6aSSushil Singh 858df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 859df390b61SSushil Singh 860df390b61SSushil Singh 861df390b61SSushil SinghVerify Acquire Multiple Lock Request At CEC Level 862df390b61SSushil Singh [Documentation] Acquire lock in loop. 863df390b61SSushil Singh [Arguments] ${client_id} ${lock_type} 864df390b61SSushil Singh 865df390b61SSushil Singh # Description of argument(s): 866df390b61SSushil Singh # client_id This client id can contain string value 867df390b61SSushil Singh # (e.g. 12345, "HMCID"). 868df390b61SSushil Singh # lock_type Read lock or Write lock. 869df390b61SSushil Singh 870df390b61SSushil Singh ${trans_id_list}= Create List 871df390b61SSushil Singh @{lock_type_list}= Split String ${lock_type} , 872df390b61SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 873df390b61SSushil Singh 874df390b61SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 875df390b61SSushil Singh Append To List ${trans_id_list} ${trans_id} 876df390b61SSushil Singh 877df390b61SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 878df390b61SSushil Singh 879df390b61SSushil Singh Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 880df390b61SSushil Singh 881df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 882e33c6e6aSSushil Singh 883e33c6e6aSSushil Singh 8848d420bf6SSushil SinghPost Reboot Acquire Lock 8858d420bf6SSushil Singh [Documentation] Post reboot acquire lock and verify the transaction id is 1. 8868d420bf6SSushil Singh [Arguments] ${session_info} ${lock_type} 8878d420bf6SSushil Singh 8888d420bf6SSushil Singh # Description of argument(s): 8898d420bf6SSushil Singh # session_info Session information. 8908d420bf6SSushil Singh # lock_type Read lock or Write lock. 8918d420bf6SSushil Singh 8928d420bf6SSushil Singh ${trans_id_list}= Create List 8938d420bf6SSushil Singh ${trans_id_list_var}= Create List 8948d420bf6SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 8958d420bf6SSushil Singh Append To List ${trans_id_list} ${trans_id} 8968d420bf6SSushil Singh Append To List ${trans_id_list_var} ${default_trans_id} 8978d420bf6SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 8988d420bf6SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list_var} 8998d420bf6SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 9008d420bf6SSushil Singh ${trans_id_emptylist}= Create List 9018d420bf6SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 9028d420bf6SSushil Singh 9038d420bf6SSushil Singh 904d03f2ce1SSushil SinghVerify Acquire And Release Lock In Loop 905d03f2ce1SSushil Singh [Documentation] Acquire lock in loop. 9068d420bf6SSushil Singh [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False 907d03f2ce1SSushil Singh 908d03f2ce1SSushil Singh # Description of argument(s): 909d03f2ce1SSushil Singh # client_id This client id can contain string value 910d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 911d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 9128d420bf6SSushil Singh # reboot_flag Flag is used to run reboot the BMC code. 9138d420bf6SSushil Singh # (e.g. True or False). 914d03f2ce1SSushil Singh 915d03f2ce1SSushil Singh FOR ${count} IN RANGE 1 11 916d03f2ce1SSushil Singh ${trans_id_list}= Create List 917d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 918d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 919d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 920d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 921d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 922d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 923d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 9248d420bf6SSushil Singh Redfish Delete Session ${session_info} 925d03f2ce1SSushil Singh END 926d03f2ce1SSushil Singh 9278d420bf6SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 9288d420bf6SSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 9298d420bf6SSushil Singh 9308d420bf6SSushil Singh Run Keyword If '${reboot_flag}' == 'True' 9318d420bf6SSushil Singh ... Run Keywords Redfish BMC Reset Operation AND 9328d420bf6SSushil Singh ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND 93307b25344SSushil Singh ... Wait Until Keyword Succeeds 3 min 10 sec Redfish BMC Match States match_state=Enabled AND 9348d420bf6SSushil Singh ... Is BMC Standby AND 9358d420bf6SSushil Singh ... Post Reboot Acquire Lock ${session_info} ${lock_type} 936d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 937d03f2ce1SSushil Singh 938d03f2ce1SSushil Singh 939d03f2ce1SSushil SinghAcquire And Release Multiple Locks 940d03f2ce1SSushil Singh [Documentation] Acquire mutilple locks on resource. 941d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 942d03f2ce1SSushil Singh 943d03f2ce1SSushil Singh # Description of argument(s): 944d03f2ce1SSushil Singh # client_id This client id can contain string value 945d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 946d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 947d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 948d03f2ce1SSushil Singh 949d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 950d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 951d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 952d03f2ce1SSushil Singh 953d03f2ce1SSushil Singh ${trans_id_list}= Create List 954d03f2ce1SSushil Singh 955d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 956d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 957d03f2ce1SSushil Singh 958d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 959d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 960d03f2ce1SSushil Singh 961d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 962d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 963d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 964d03f2ce1SSushil Singh 965d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 966d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 967d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 968d03f2ce1SSushil Singh 969d03f2ce1SSushil Singh 97094116c61Ssusilsi7Verify Release Lock When Session Deleted 97194116c61Ssusilsi7 [Documentation] Verify lock get released when session are deleted. 97294116c61Ssusilsi7 [Arguments] ${client_id} ${lock_type} 97394116c61Ssusilsi7 97494116c61Ssusilsi7 # Description of argument(s): 97594116c61Ssusilsi7 # client_ids This client id can contain string value 97694116c61Ssusilsi7 # (e.g. 12345, "HMCID"). 97794116c61Ssusilsi7 # lock_type Read lock or Write lock. 97894116c61Ssusilsi7 97994116c61Ssusilsi7 ${trans_id_list}= Create List 98094116c61Ssusilsi7 @{lock_type_list}= Split String ${lock_type} , 98194116c61Ssusilsi7 98294116c61Ssusilsi7 ${pre_session_info}= Create Redfish Session With ClientID ${client_id} 98394116c61Ssusilsi7 98494116c61Ssusilsi7 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 98594116c61Ssusilsi7 Append To List ${trans_id_list} ${trans_id} 98694116c61Ssusilsi7 Verify Lock On Resource ${pre_session_info} ${trans_id_list} 98794116c61Ssusilsi7 98894116c61Ssusilsi7 Redfish Delete Session ${pre_session_info} 98994116c61Ssusilsi7 ${post_session_info}= Create Redfish Session With ClientID ${client_id} 99094116c61Ssusilsi7 ${resp}= Get Locks List On Resource With Session List ${pre_session_info} ${HTTP_BAD_REQUEST} 99194116c61Ssusilsi7 99294116c61Ssusilsi7 Redfish Delete Session ${post_session_info} 99394116c61Ssusilsi7 99494116c61Ssusilsi7 99594116c61Ssusilsi7 99659011d08SSushil SinghVerify Fail To Release Lock With Invalid TransactionID 99716b3c7bfSGeorge Keishing [Documentation] Verify fail to be release lock with invalid transaction ID. 99859011d08SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 99959011d08SSushil Singh 100059011d08SSushil Singh # Description of argument(s): 100159011d08SSushil Singh # client_id This client id can contain string value 100259011d08SSushil Singh # (e.g. 12345, "HMCID"). 100359011d08SSushil Singh # lock_type Read lock or Write lock. 100459011d08SSushil Singh # release_lock_type The value can be Transaction or Session. 100559011d08SSushil Singh 100659011d08SSushil Singh ${trans_id_list}= Create List 100759011d08SSushil Singh @{lock_type_list}= Split String ${lock_type} , 100859011d08SSushil Singh 100959011d08SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 101059011d08SSushil Singh 101159011d08SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 101259011d08SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 101359011d08SSushil Singh ${value}= Evaluate ${value} + 10 101459011d08SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 101559011d08SSushil Singh Append To List ${trans_id_list} ${trans_id} 101659011d08SSushil Singh 101759011d08SSushil Singh Release Locks On Resource 101859011d08SSushil Singh ... ${session_info} ${trans_id_list} 101959011d08SSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 102059011d08SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 102159011d08SSushil Singh 102259011d08SSushil Singh ${trans_id_emptylist}= Create List 102359011d08SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 102459011d08SSushil Singh Redfish Delete Session ${session_info} 102559011d08SSushil Singh 102659011d08SSushil Singh 10271b59053dSSushil SinghVerify Fail To Release Multiple Lock With Invalid TransactionID 10281b59053dSSushil Singh [Documentation] Verify release multiple locks with invalid transaction ID fails. 1029d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 1030d03f2ce1SSushil Singh 1031d03f2ce1SSushil Singh # Description of argument(s): 1032d03f2ce1SSushil Singh # client_id This client id can contain string value 1033d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 1034d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 1035d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 1036d03f2ce1SSushil Singh 1037d03f2ce1SSushil Singh ${trans_id_list}= Create List 1038d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 1039d03f2ce1SSushil Singh 1040d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 1041d03f2ce1SSushil Singh 1042d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1043d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 1044d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 1045d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 1046d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 1047d03f2ce1SSushil Singh 1048d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 1049d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 1050d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 1051d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 1052d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 1053d03f2ce1SSushil Singh 1054d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 1055d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 1056d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 1057d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 1058d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 1059d03f2ce1SSushil Singh 1060d03f2ce1SSushil Singh Release Locks On Resource 1061d03f2ce1SSushil Singh ... ${session_info} ${trans_id_list} 1062d03f2ce1SSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 1063d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 1064d03f2ce1SSushil Singh 1065d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 1066d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 1067d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 1068d03f2ce1SSushil Singh 1069d03f2ce1SSushil Singh 10708bee358fSSushil SinghVerify Fail To Release Multiple Lock With Valid And Invalid TransactionID 10719614383dSGeorge Keishing [Documentation] Verify fail to be release multiple lock with valid and invalid transaction ID. 10728bee358fSSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 10738bee358fSSushil Singh 10748bee358fSSushil Singh # Description of argument(s): 10758bee358fSSushil Singh # client_id This client id can contain string value 10768bee358fSSushil Singh # (e.g. 12345, "HMCID"). 10778bee358fSSushil Singh # lock_type Read lock or Write lock. 10788bee358fSSushil Singh # release_lock_type The value can be Transaction or Session. 10798bee358fSSushil Singh 10808bee358fSSushil Singh ${trans_id_list}= Create List 10818bee358fSSushil Singh @{lock_type_list}= Split String ${lock_type} , 10828bee358fSSushil Singh 10838bee358fSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 10848bee358fSSushil Singh 10858bee358fSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 10868bee358fSSushil Singh Append To List ${trans_id_list} ${trans_id} 10878bee358fSSushil Singh 10888bee358fSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 10898bee358fSSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 10908bee358fSSushil Singh ${value}= Evaluate ${value} + 10 10918bee358fSSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 10928bee358fSSushil Singh Append To List ${trans_id_list} ${trans_id} 10938bee358fSSushil Singh 10948bee358fSSushil Singh Release Locks On Resource 10958bee358fSSushil Singh ... ${session_info} ${trans_id_list} 10968bee358fSSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 10978bee358fSSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 10988bee358fSSushil Singh 10998bee358fSSushil Singh ${trans_id_emptylist}= Create List 11008bee358fSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 11018bee358fSSushil Singh Redfish Delete Session ${session_info} 11028bee358fSSushil Singh 11038bee358fSSushil Singh 11041d7b996cSsusilsi7Verify Fail To Release Lock With TransactionID As String Type 11059614383dSGeorge Keishing [Documentation] Verify fail to be release lock with transaction ID as string data type. 11061d7b996cSsusilsi7 [Arguments] ${client_id} ${lock_type} ${release_lock_type} 11071d7b996cSsusilsi7 11081d7b996cSsusilsi7 # Description of argument(s): 11091d7b996cSsusilsi7 # client_id This client id can contain string value 11101d7b996cSsusilsi7 # (e.g. 12345, "HMCID"). 11111d7b996cSsusilsi7 # lock_type Read lock or Write lock. 11121d7b996cSsusilsi7 # release_lock_type The value can be Transaction or Session. 11131d7b996cSsusilsi7 11141d7b996cSsusilsi7 ${trans_id_list}= Create List 11151d7b996cSsusilsi7 @{lock_type_list}= Split String ${lock_type} , 11161d7b996cSsusilsi7 11171d7b996cSsusilsi7 ${session_info}= Create Redfish Session With ClientID ${client_id} 11181d7b996cSsusilsi7 11191d7b996cSsusilsi7 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 11201d7b996cSsusilsi7 11211d7b996cSsusilsi7 Append To List ${trans_id_list} ${trans_id} 11221d7b996cSsusilsi7 11231d7b996cSsusilsi7 ${temp_trans_id_list}= Copy Dictionary ${trans_id_list} deepcopy=True 11241d7b996cSsusilsi7 11251d7b996cSsusilsi7 ${value}= Get From Dictionary ${trans_id_list}[0] TransactionID 11261d7b996cSsusilsi7 ${value}= Set Variable \'${value}\' 11271d7b996cSsusilsi7 Set To Dictionary ${temp_trans_id_list}[0] TransactionID ${value} 11281d7b996cSsusilsi7 11291d7b996cSsusilsi7 Release Locks On Resource 11301d7b996cSsusilsi7 ... ${session_info} ${temp_trans_id_list} 11311d7b996cSsusilsi7 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 11321d7b996cSsusilsi7 11331d7b996cSsusilsi7 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 11341d7b996cSsusilsi7 11351d7b996cSsusilsi7 ${trans_id_emptylist}= Create List 11361d7b996cSsusilsi7 Verify Lock On Resource ${session_info} ${trans_id_emptylist} 11371d7b996cSsusilsi7 Redfish Delete Session ${session_info} 11381d7b996cSsusilsi7 11391d7b996cSsusilsi7 1140d03f2ce1SSushil SinghVerify Fail To Release Lock For Another Session 1141d03f2ce1SSushil Singh [Documentation] Verify failed to release the lock form another session. 1142d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 1143d03f2ce1SSushil Singh 1144d03f2ce1SSushil Singh # Description of argument(s): 1145d03f2ce1SSushil Singh # client_id This client id can contain string value 1146d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 1147d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 1148d03f2ce1SSushil Singh 1149d03f2ce1SSushil Singh ${client_ids}= Split String ${client_id} , 1150d03f2ce1SSushil Singh ${lock_type_list}= Split String ${lock_type} , 1151d03f2ce1SSushil Singh ${trans_id_list1}= Create List 1152d03f2ce1SSushil Singh ${trans_id_list2}= Create List 1153d03f2ce1SSushil Singh 1154d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0] 1155d03f2ce1SSushil Singh 1156d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1157d03f2ce1SSushil Singh Append To List ${trans_id_list1} ${trans_id} 1158d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 1159d03f2ce1SSushil Singh 1160d03f2ce1SSushil Singh ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1] 1161d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 1162d03f2ce1SSushil Singh Append To List ${trans_id_list2} ${trans_id} 1163d03f2ce1SSushil Singh Verify Lock On Resource ${session_info2} ${trans_id_list2} 1164d03f2ce1SSushil Singh 1165d03f2ce1SSushil Singh Release Locks On Resource 1166e3f2e3baSSushil Singh ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_BAD_REQUEST} 1167d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 1168d03f2ce1SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session 1169d03f2ce1SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session 1170d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 1171d03f2ce1SSushil Singh Redfish Delete Session ${session_info2} 1172d03f2ce1SSushil Singh 1173d03f2ce1SSushil Singh 1174e33c6e6aSSushil SinghVerify Fail To Acquire Lock For Invalid Resource ID Data Type 1175e33c6e6aSSushil Singh [Documentation] Verify fail to acquire the lock with invalid resource id data type. 1176e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 1177e33c6e6aSSushil Singh 1178e33c6e6aSSushil Singh # Description of argument(s): 1179e33c6e6aSSushil Singh # client_id This client id can contain string value 1180e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 1181e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 1182e33c6e6aSSushil Singh 1183e33c6e6aSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 1184e33c6e6aSSushil Singh Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 1185e33c6e6aSSushil Singh ... ${lock_type} status_code=${HTTP_BAD_REQUEST} 1186e33c6e6aSSushil Singh Redfish Delete Session ${session_info} 1187e33c6e6aSSushil Singh 1188e33c6e6aSSushil Singh 1189d03f2ce1SSushil SinghVerify Fail To Acquire Lock For Invalid Lock Data 119016b3c7bfSGeorge Keishing [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segment flags. 1191d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${message} 1192d03f2ce1SSushil Singh 1193d03f2ce1SSushil Singh # Description of argument(s): 1194d03f2ce1SSushil Singh # client_id This client id can contain string value 1195d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 1196d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 1197d03f2ce1SSushil Singh # message Return message from URI. 1198d03f2ce1SSushil Singh 1199d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 12008a3efe7cSSushil Singh ${trans_id}= Redfish Post Acquire Invalid Lock 12018a3efe7cSSushil Singh ... ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST} 1202d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 1203bace3005SSushil Singh 1204bace3005SSushil Singh 1205bace3005SSushil SinghVerify No Locks Records For Session With No Acquired Lock 1206bace3005SSushil Singh [Documentation] Verify no records found for a session where no lock is acquired. 1207bace3005SSushil Singh [Arguments] ${client_id} 1208bace3005SSushil Singh 1209bace3005SSushil Singh # Description of argument(s): 1210bace3005SSushil Singh # client_id This client id can contain string value 1211bace3005SSushil Singh # (e.g. 12345, "HMCID"). 1212bace3005SSushil Singh 1213bace3005SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 1214bace3005SSushil Singh ${trans_id_emptylist}= Create List 1215bace3005SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 1216bace3005SSushil Singh Redfish Delete Session ${session_info} 1217728ef9c9SSushil Singh 1218728ef9c9SSushil Singh 1219728ef9c9SSushil SinghCreate List Of Session ID 1220728ef9c9SSushil Singh [Documentation] Create session id list from session dict info. 1221728ef9c9SSushil Singh [Arguments] ${session_dict_info} 1222728ef9c9SSushil Singh 1223728ef9c9SSushil Singh # Description of argument(s): 1224728ef9c9SSushil Singh # session_dict_info Session information in dict. 1225728ef9c9SSushil Singh 1226728ef9c9SSushil Singh @{session_id_list}= Create List 1227728ef9c9SSushil Singh 1228728ef9c9SSushil Singh FOR ${session} IN @{session_dict_info} 1229728ef9c9SSushil Singh Append To List ${session_id_list} ${session["SessionIDs"]} 1230728ef9c9SSushil Singh END 1231728ef9c9SSushil Singh 1232728ef9c9SSushil Singh ${num_id}= Get Length ${session_id_list} 1233728ef9c9SSushil Singh Should Not Be Equal As Integers ${num_id} ${0} 1234728ef9c9SSushil Singh 1235728ef9c9SSushil Singh ${session_id_list}= Evaluate json.dumps(${session_id_list}) json 1236728ef9c9SSushil Singh 1237728ef9c9SSushil Singh [Return] ${session_id_list} 1238728ef9c9SSushil Singh 1239728ef9c9SSushil Singh 1240728ef9c9SSushil SinghGet Locks List On Resource With Session List 1241728ef9c9SSushil Singh [Documentation] Get locks list from session of list. 1242728ef9c9SSushil Singh [Arguments] ${session_id_list} ${exp_status_code}=${HTTP_OK} 1243728ef9c9SSushil Singh 1244728ef9c9SSushil Singh # Description of argument(s): 1245728ef9c9SSushil Singh # session_id_list Session ids list. 1246728ef9c9SSushil Singh # exp_status_code Expected HTTP status code. 1247728ef9c9SSushil Singh 1248728ef9c9SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 1249fbd67007SGeorge Keishing ... data={"SessionIDs":${session_id_list}} expected_status=any 125094116c61Ssusilsi7 Should Be Equal As Strings ${resp.status_code} ${exp_status_code} 1251728ef9c9SSushil Singh ${locks}= Evaluate json.loads('''${resp.text}''') json 1252728ef9c9SSushil Singh 1253728ef9c9SSushil Singh [Return] ${locks} 1254728ef9c9SSushil Singh 1255728ef9c9SSushil Singh 1256728ef9c9SSushil SinghVerify List Of Session Lock On Resource 1257728ef9c9SSushil Singh [Documentation] Verify list of lock record from list of sessions. 1258728ef9c9SSushil Singh [Arguments] ${session_dict_info} ${transaction_id_list} 1259728ef9c9SSushil Singh 1260728ef9c9SSushil Singh # Description of argument(s): 1261728ef9c9SSushil Singh # session_dict_info Session information in dict. 1262728ef9c9SSushil Singh # transaction_id_list Transaction id in list stored in dict. 1263728ef9c9SSushil Singh 1264728ef9c9SSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_info} 1265728ef9c9SSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 1266728ef9c9SSushil Singh ${lock_list}= Set Variable ${lock_list_resp['Records']} 1267728ef9c9SSushil Singh 12688a3efe7cSSushil Singh FOR ${session_id} ${tran_id} ${lock_record} IN ZIP 12698a3efe7cSSushil Singh ... ${session_dict_info} ${transaction_id_list} ${lock_list} 1270728ef9c9SSushil Singh Valid Value session_id['SessionIDs'] ['${lock_record['SessionID']}'] 1271728ef9c9SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock_record['TransactionID']} 1272728ef9c9SSushil Singh END 1273728ef9c9SSushil Singh 1274728ef9c9SSushil Singh 1275728ef9c9SSushil SinghVerify Lock Records Of Multiple Session 1276728ef9c9SSushil Singh [Documentation] Verify all records found for a multiple sessions. 1277728ef9c9SSushil Singh [Arguments] ${client_ids} ${lock_type} 1278728ef9c9SSushil Singh 1279728ef9c9SSushil Singh # Description of argument(s): 1280728ef9c9SSushil Singh # client_ids This client id can contain string value 1281728ef9c9SSushil Singh # (e.g. 12345, "HMCID"). 1282728ef9c9SSushil Singh # lock_type Read lock or Write lock. 1283728ef9c9SSushil Singh 1284728ef9c9SSushil Singh ${client_id_list}= Split String ${client_ids} , 1285728ef9c9SSushil Singh ${lock_type_list}= Split String ${lock_type} , 1286728ef9c9SSushil Singh ${trans_id_list1}= Create List 1287728ef9c9SSushil Singh ${trans_id_list2}= Create List 1288728ef9c9SSushil Singh 1289728ef9c9SSushil Singh ${session_dict_list}= Create List 1290728ef9c9SSushil Singh ${lock_list}= Create List 1291728ef9c9SSushil Singh 1292728ef9c9SSushil Singh ${client_id1}= Create List 1293728ef9c9SSushil Singh Append To List ${client_id1} ${client_id_list}[0] 1294728ef9c9SSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 1295728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 1296728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 1297728ef9c9SSushil Singh 1298728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1299728ef9c9SSushil Singh Append To List ${trans_id_list1} ${trans_id} 1300728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 1301728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 1302728ef9c9SSushil Singh 1303728ef9c9SSushil Singh 1304728ef9c9SSushil Singh ${client_id2}= Create List 1305728ef9c9SSushil Singh Append To List ${client_id2} ${client_id_list}[1] 1306728ef9c9SSushil Singh ${session_info2}= Create Session With List Of ClientID ${client_id2} 1307728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 1308728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id2} ${session_info2} 1309728ef9c9SSushil Singh 1310728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 1311728ef9c9SSushil Singh Append To List ${trans_id_list2} ${trans_id} 1312728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 1313728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_list2} 1314728ef9c9SSushil Singh 1315728ef9c9SSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 1316728ef9c9SSushil Singh 1317728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 1318728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 1319728ef9c9SSushil Singh 1320728ef9c9SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 1321728ef9c9SSushil Singh 1322728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info2}[0] SessionToken 1323728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 1324728ef9c9SSushil Singh 1325728ef9c9SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Transaction 1326728ef9c9SSushil Singh 1327728ef9c9SSushil Singh ${trans_id_emptylist}= Create List 1328728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 1329728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_emptylist} 1330728ef9c9SSushil Singh 1331728ef9c9SSushil Singh Redfish Delete List Of Session ${session_dict_list} 1332f9a536caSSushil Singh 1333f9a536caSSushil Singh 1334f9a536caSSushil SinghVerify Lock Records For Multiple Invalid Session 1335f9a536caSSushil Singh [Documentation] Verify no lock record found for multiple invalid session. 1336f9a536caSSushil Singh [Arguments] ${client_id} 1337f9a536caSSushil Singh 1338f9a536caSSushil Singh # Description of argument(s): 1339f9a536caSSushil Singh # client_id This client id can contain string value 1340f9a536caSSushil Singh # (e.g. 12345, "HMCID"). 1341f9a536caSSushil Singh 1342f9a536caSSushil Singh ${session_dict_list}= Create List 1343f9a536caSSushil Singh ${invalid_session_ids}= Create List xxyXyyYZZz xXyXYyYZzz 1344f9a536caSSushil Singh 1345f9a536caSSushil Singh ${session_info1}= Create Session With ClientID ${client_id} 1346f9a536caSSushil Singh 1347f9a536caSSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 1348f9a536caSSushil Singh set to dictionary ${session_info2} SessionIDs ${invalid_session_ids}[0] 1349f9a536caSSushil Singh Append To List ${session_dict_list} ${session_info2} 1350f9a536caSSushil Singh 1351f9a536caSSushil Singh ${session_info3}= Copy Dictionary ${session_info1} deepcopy=True 1352f9a536caSSushil Singh set to dictionary ${session_info3} SessionIDs ${invalid_session_ids}[0] 1353f9a536caSSushil Singh Append To List ${session_dict_list} ${session_info3} 1354f9a536caSSushil Singh 1355f9a536caSSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 1356f9a536caSSushil Singh ${lock_length1}= Get Length ${lock_list1} 1357f9a536caSSushil Singh 1358f9a536caSSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_list} 1359f9a536caSSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 1360f9a536caSSushil Singh ${lock_length2}= Get Length ${lock_list_resp['Records']} 1361f9a536caSSushil Singh 1362f9a536caSSushil Singh Should Be Equal As Integers ${lock_length1} ${lock_length2} 1363f9a536caSSushil Singh 1364f9a536caSSushil Singh Redfish Delete Session ${session_info1} 136511949a2cSSushil Singh 136611949a2cSSushil Singh 136711949a2cSSushil SinghVerify Lock Records For Multiple Invalid And Valid Session 136811949a2cSSushil Singh [Documentation] Verify all records found for a valid and invalid sessions. 136911949a2cSSushil Singh [Arguments] ${client_ids} ${lock_type} 137011949a2cSSushil Singh 137111949a2cSSushil Singh # Description of argument(s): 137211949a2cSSushil Singh # client_ids This client id can contain string value 137311949a2cSSushil Singh # (e.g. 12345, "HMCID"). 137411949a2cSSushil Singh # lock_type Read lock or Write lock. 137511949a2cSSushil Singh 137611949a2cSSushil Singh ${client_id_list}= Split String ${client_ids} , 137711949a2cSSushil Singh ${lock_type_list}= Split String ${lock_type} , 137811949a2cSSushil Singh ${trans_id_list1}= Create List 137911949a2cSSushil Singh ${invalid_session_ids}= Create List xxyXyyYZZz 138011949a2cSSushil Singh 138111949a2cSSushil Singh ${session_dict_list}= Create List 138211949a2cSSushil Singh ${lock_list}= Create List 138311949a2cSSushil Singh 138411949a2cSSushil Singh ${client_id1}= Create List 138511949a2cSSushil Singh Append To List ${client_id1} ${client_id_list}[0] 138611949a2cSSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 138711949a2cSSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 138811949a2cSSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 138911949a2cSSushil Singh 139011949a2cSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 139111949a2cSSushil Singh Append To List ${trans_id_list1} ${trans_id} 139211949a2cSSushil Singh Append To List ${lock_list} ${trans_id} 139311949a2cSSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 139411949a2cSSushil Singh 139511949a2cSSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 139611949a2cSSushil Singh set to dictionary ${session_info2}[0] SessionIDs ${invalid_session_ids}[0] 139711949a2cSSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 139811949a2cSSushil Singh 139911949a2cSSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 140011949a2cSSushil Singh 140111949a2cSSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 140211949a2cSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 140311949a2cSSushil Singh 140411949a2cSSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 140511949a2cSSushil Singh 140611949a2cSSushil Singh ${trans_id_emptylist}= Create List 140711949a2cSSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 140811949a2cSSushil Singh 140911949a2cSSushil Singh Redfish Delete Session ${session_info1}[0] 1410*7e49fd5dSGeorge Keishing 1411*7e49fd5dSGeorge Keishing 1412*7e49fd5dSGeorge KeishingDelete All Redfish and HMC Sessions 1413*7e49fd5dSGeorge Keishing [Documentation] Delete all active redfish sessions. 1414*7e49fd5dSGeorge Keishing 1415*7e49fd5dSGeorge Keishing ${saved_session_info}= Get Redfish Session Info 1416*7e49fd5dSGeorge Keishing 1417*7e49fd5dSGeorge Keishing ${resp_list}= Redfish_Utils.Get Member List 1418*7e49fd5dSGeorge Keishing ... /redfish/v1/SessionService/Sessions 1419*7e49fd5dSGeorge Keishing 1420*7e49fd5dSGeorge Keishing # Remove the current login session from the list. 1421*7e49fd5dSGeorge Keishing Remove Values From List ${resp_list} ${saved_session_info["location"]} 1422*7e49fd5dSGeorge Keishing 1423*7e49fd5dSGeorge Keishing FOR ${session} IN @{resp_list} 1424*7e49fd5dSGeorge Keishing Run Keyword And Ignore Error Redfish.Delete ${session} 1425*7e49fd5dSGeorge Keishing END 1426*7e49fd5dSGeorge Keishing 1427*7e49fd5dSGeorge Keishing 1428*7e49fd5dSGeorge KeishingRestart Bmcweb On Failure 1429*7e49fd5dSGeorge Keishing [Documentation] Restart bmcweb only if test failed. 1430*7e49fd5dSGeorge Keishing 1431*7e49fd5dSGeorge Keishing Return From Keyword If "${TEST_STATUS}" == "PASS" 1432*7e49fd5dSGeorge Keishing 1433*7e49fd5dSGeorge Keishing # This procedure is needs to be corrected or removed, when we figure out 1434*7e49fd5dSGeorge Keishing # what is causing the real failure here. 1435*7e49fd5dSGeorge Keishing 1436*7e49fd5dSGeorge Keishing Log To Console Likely ConnectionResetError: Restarting bmcweb 1437*7e49fd5dSGeorge Keishing 1438*7e49fd5dSGeorge Keishing ${stdout} ${stderr} ${rc}= BMC Execute Command 1439*7e49fd5dSGeorge Keishing ... systemctl restart bmcweb print_out=1 1440*7e49fd5dSGeorge Keishing 1441*7e49fd5dSGeorge Keishing Should Be Empty ${stderr} 1442*7e49fd5dSGeorge Keishing 1443*7e49fd5dSGeorge Keishing Sleep 10s reason=Wait for service to restart properly. 1444