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 20*8d420bf6SSushil Singh&{default_trans_id} TransactionID=${1} 21bc331e22SVijay 22bc331e22SVijay*** Test Cases *** 23bc331e22SVijay 24d03f2ce1SSushil SinghAcquire Read Write Lock 25bc331e22SVijay [Documentation] Acquire and release different read locks. 26d03f2ce1SSushil Singh [Tags] Acquire_Read_Write_Lock 27d03f2ce1SSushil Singh [Template] Acquire Lock On Resource 28bc331e22SVijay 29d03f2ce1SSushil Singh # client_id lock_type reboot_flag 30d03f2ce1SSushil Singh HMCID-01 ReadCase1 False 31d03f2ce1SSushil Singh HMCID-01 ReadCase2 False 32d03f2ce1SSushil Singh HMCID-01 ReadCase3 False 33d03f2ce1SSushil Singh HMCID-01 WriteCase1 False 34d03f2ce1SSushil Singh HMCID-01 WriteCase2 False 35d03f2ce1SSushil Singh HMCID-01 WriteCase3 False 36bc331e22SVijay 37bc331e22SVijay 38d8bf1424SSushil SinghVerify Lock Is Not Persistent On BMC Reboot 39d8bf1424SSushil Singh [Documentation] Acquire lock and after reboot the locks are removed as no persistency 40d8bf1424SSushil Singh ... maintained. 41d8bf1424SSushil Singh [Tags] Verify_Lock_Is_Not_Persistent_On_BMC_Reboot 42d03f2ce1SSushil Singh [Template] Acquire Lock On Resource 43bc331e22SVijay 44d03f2ce1SSushil Singh # client_id lock_type reboot_flag 45d03f2ce1SSushil Singh HMCID-01 ReadCase1 True 46d03f2ce1SSushil Singh HMCID-01 ReadCase2 True 47d03f2ce1SSushil Singh HMCID-01 ReadCase3 True 48d03f2ce1SSushil Singh HMCID-01 WriteCase1 True 49d03f2ce1SSushil Singh HMCID-01 WriteCase2 True 50d03f2ce1SSushil Singh HMCID-01 WriteCase3 True 51bc331e22SVijay 52bc331e22SVijay 53*8d420bf6SSushil SinghCheck After Reboot Transaction ID Set To Default 54*8d420bf6SSushil Singh [Documentation] After reboot, the transaction id starts with default i.e. 1, 55*8d420bf6SSushil Singh ... if any lock is aquired. 56*8d420bf6SSushil Singh [Tags] Check_After_Reboot_Transaction_ID_Set_To_Default 57*8d420bf6SSushil Singh [Template] Verify Acquire And Release Lock In Loop 58*8d420bf6SSushil Singh 59*8d420bf6SSushil Singh # client_id lock_type reboot_flag 60*8d420bf6SSushil Singh HMCID-01 ReadCase1 True 61*8d420bf6SSushil Singh HMCID-01 WriteCase1 True 62*8d420bf6SSushil Singh 63*8d420bf6SSushil Singh 64d03f2ce1SSushil SinghAcquire Read Lock On Read Lock 65d03f2ce1SSushil Singh [Documentation] Acquire read lock on another read lock. 66d03f2ce1SSushil Singh [Tags] Acquire_Read_Lock_On_Read_Lock 67d03f2ce1SSushil Singh [Template] Acquire Lock On Another Lock 68bc331e22SVijay 69d03f2ce1SSushil Singh # client_id 70d03f2ce1SSushil Singh HMCID-01 71bc331e22SVijay 72bc331e22SVijay 73d03f2ce1SSushil SinghFail To Acquire Lock On Another Lock 74d03f2ce1SSushil Singh [Documentation] Fail to acquire another lock. 75d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_On_Another_Lock 76d03f2ce1SSushil Singh [Template] Verify Acquire Lock Fails On Another Lock 7785610eeeSVijay 78d03f2ce1SSushil Singh # client_id lock_type 79d03f2ce1SSushil Singh HMCID-01 ReadCase2,WriteCase2 80d03f2ce1SSushil Singh HMCID-01 WriteCase2,WriteCase2 81d03f2ce1SSushil Singh HMCID-01 WriteCase2,ReadCase2 82566daaf3SGeorge Keishing 83566daaf3SGeorge Keishing 84e33c6e6aSSushil SinghAcquire Lock After Reboot 85e33c6e6aSSushil Singh [Documentation] Acquire and release read and write locks after reboot. 86e33c6e6aSSushil Singh [Tags] Acquire_Lock_After_Reboot 87e33c6e6aSSushil Singh [Template] Verify Acquire Lock After Reboot 88e33c6e6aSSushil Singh 89e33c6e6aSSushil Singh # client_id lock_type 90e33c6e6aSSushil Singh HMCID-01 ReadCase1 91e33c6e6aSSushil Singh HMCID-01 ReadCase2 92e33c6e6aSSushil Singh HMCID-01 ReadCase3 93e33c6e6aSSushil Singh HMCID-01 WriteCase1 94e33c6e6aSSushil Singh HMCID-01 WriteCase2 95e33c6e6aSSushil Singh HMCID-01 WriteCase3 96e33c6e6aSSushil Singh 97e33c6e6aSSushil Singh 98d03f2ce1SSushil SinghAcquire And Release Lock In Loop 99d03f2ce1SSushil Singh [Documentation] Acquire and release read, write locks in loop. 100d03f2ce1SSushil Singh [Tags] Acquire_And_Release_Lock_In_Loop 101d03f2ce1SSushil Singh [Template] Verify Acquire And Release Lock In Loop 102566daaf3SGeorge Keishing 103d03f2ce1SSushil Singh # client_id lock_type 104d03f2ce1SSushil Singh HMCID-01 ReadCase1 105d03f2ce1SSushil Singh HMCID-01 ReadCase2 106d03f2ce1SSushil Singh HMCID-01 ReadCase3 107d03f2ce1SSushil Singh HMCID-01 WriteCase1 108d03f2ce1SSushil Singh HMCID-01 WriteCase2 109d03f2ce1SSushil Singh HMCID-01 WriteCase3 11085610eeeSVijay 11185610eeeSVijay 112977f8f58SSushil SinghFail To Acquire Read And Write In Single Request 113977f8f58SSushil Singh [Documentation] Fail to acquire read and write lock in single request. 114977f8f58SSushil Singh [Tags] Fail_To_Acquire_Read_And_Write_In_Single_Request 115977f8f58SSushil Singh [Template] Verify Fail To Acquire Read And Write In Single Request 116977f8f58SSushil Singh 117977f8f58SSushil Singh # client_id lock_type 118977f8f58SSushil Singh HMCID-01 ReadCase1,WriteCase1 119977f8f58SSushil Singh HMCID-01 WriteCase1,ReadCase1 120977f8f58SSushil Singh 121977f8f58SSushil Singh 122df390b61SSushil SinghAcquire Multiple Lock Request At CEC Level 123df390b61SSushil Singh [Documentation] Acquire write lock on read lock under CEC level. 124df390b61SSushil Singh [Tags] Acquire_Multiple_Lock_Request_At_CEC_Level 125df390b61SSushil Singh [Template] Verify Acquire Multiple Lock Request At CEC Level 126df390b61SSushil Singh 127df390b61SSushil Singh # client_id lock_type 128df390b61SSushil Singh HMCID-01 ReadCase4,WriteCase4 129df390b61SSushil Singh HMCID-01 WriteCase5,ReadCase5 130df390b61SSushil Singh HMCID-01 ReadCase6,WriteCase6 131df390b61SSushil Singh HMCID-01 WriteCase7,ReadCase7 132df390b61SSushil Singh 133df390b61SSushil Singh 134d03f2ce1SSushil SinghVerify Release Of Valid Locks 135d03f2ce1SSushil Singh [Documentation] Release all valid locks. 136d03f2ce1SSushil Singh [Tags] Verify_Release_Of_Valid_Locks 137d03f2ce1SSushil Singh [Template] Acquire And Release Multiple Locks 138afdd2a1dSVijay 139d03f2ce1SSushil Singh # client_id lock_type release_lock_type 140d03f2ce1SSushil Singh HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 141d03f2ce1SSushil Singh HMCID-02 ReadCase1,ReadCase1,ReadCase1 Session 142afdd2a1dSVijay 143afdd2a1dSVijay 14494116c61Ssusilsi7Release Lock When Session Deleted 14594116c61Ssusilsi7 [Documentation] Release lock when session gets deleted. 14694116c61Ssusilsi7 [Tags] Release_Lock_When_Session_Deleted 14794116c61Ssusilsi7 [Template] Verify Release Lock When Session Deleted 14894116c61Ssusilsi7 14994116c61Ssusilsi7 # client_id lock_type 15094116c61Ssusilsi7 HMCID-01 ReadCase1 15194116c61Ssusilsi7 HMCID-01 WriteCase1 15294116c61Ssusilsi7 15394116c61Ssusilsi7 15459011d08SSushil SinghFail To Release Lock With Invalid TransactionID 15559011d08SSushil Singh [Documentation] Fail to release lock with invalid transaction id. 15659011d08SSushil Singh [Tags] Fail_To_Release_Lock_With_Invalid_TransactionID 15759011d08SSushil Singh [Template] Verify Fail To Release Lock With Invalid TransactionID 15859011d08SSushil Singh 15959011d08SSushil Singh # client_id lock_type release_lock_type 16059011d08SSushil Singh HMCID-01 ReadCase1 Transaction 16143b0c063Ssusilsi7 HMCID-01 WriteCase1 Transaction 16259011d08SSushil Singh 16359011d08SSushil Singh 1641b59053dSSushil SinghFail To Release Multiple Lock With Invalid TransactionID 165d03f2ce1SSushil Singh [Documentation] Release in-valid lock result in fail. 1661b59053dSSushil Singh [Tags] Fail_To_Release_Multiple_Lock_With_Invalid_TransactionID 1671b59053dSSushil Singh [Template] Verify Fail To Release Multiple Lock With Invalid TransactionID 168afdd2a1dSVijay 169d03f2ce1SSushil Singh # client_id lock_type release_lock_type 170d03f2ce1SSushil Singh HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 171d03f2ce1SSushil Singh 12345 ReadCase2,ReadCase2,ReadCase2 Transaction 172d03f2ce1SSushil Singh HMCID ReadCase3,ReadCase3,ReadCase3 Transaction 173afdd2a1dSVijay 174afdd2a1dSVijay 1758bee358fSSushil SinghFail To Release Multiple Lock With Valid And Invalid TransactionID 1769614383dSGeorge Keishing [Documentation] Release multiple lock with valid and invalid transaction. 1778bee358fSSushil Singh [Tags] Fail_To_Release_Multiple_Lock_With_Valid_And_Invalid_TransactionID 1788bee358fSSushil Singh [Template] Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID 1798bee358fSSushil Singh 1808bee358fSSushil Singh # client_id lock_type release_lock_type 1818bee358fSSushil Singh HMCID-01 ReadCase1,ReadCase1 Transaction 1828bee358fSSushil Singh 1838bee358fSSushil Singh 1841d7b996cSsusilsi7Fail To Release Lock With String As TransactionID Data Type 1851d7b996cSsusilsi7 [Documentation] Fail to release lock with string as transaction id data type. 1861d7b996cSsusilsi7 [Tags] Fail_To_Release_Lock_With_String_As_TransactionID_Data_Type 1871d7b996cSsusilsi7 [Template] Verify Fail To Release Lock With TransactionID As String Type 1881d7b996cSsusilsi7 1891d7b996cSsusilsi7 # client_id lock_type release_lock_type 1901d7b996cSsusilsi7 HMCID-01 ReadCase1 Transaction 1911d7b996cSsusilsi7 HMCID-01 WriteCase1 Transaction 1921d7b996cSsusilsi7 1931d7b996cSsusilsi7 194d03f2ce1SSushil SinghFail To Release Lock For Another Session 195d03f2ce1SSushil Singh [Documentation] Failed to release locks from another session. 196d03f2ce1SSushil Singh [Tags] Fail_To_Release_Lock_For_Another_Session 197d03f2ce1SSushil Singh [Template] Verify Fail To Release Lock For Another Session 198afdd2a1dSVijay 199d03f2ce1SSushil Singh # client_id lock_type 200d03f2ce1SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 201afdd2a1dSVijay 202afdd2a1dSVijay 203e33c6e6aSSushil SinghTest Invalid Resource ID Data Type Locking 204e33c6e6aSSushil Singh [Documentation] Failed to acquire lock for invalid resource id data type. 205e33c6e6aSSushil Singh [Tags] Test_Invalid_Resource_ID_Data_Type_Locking 206e33c6e6aSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type 207e33c6e6aSSushil Singh 208e33c6e6aSSushil Singh # client_id lock_type 209e33c6e6aSSushil Singh HMCID-01 ReadCase1 210e33c6e6aSSushil Singh HMCID-01 ReadCase2 211e33c6e6aSSushil Singh HMCID-01 ReadCase3 212e33c6e6aSSushil Singh HMCID-01 WriteCase1 213e33c6e6aSSushil Singh HMCID-01 WriteCase2 214e33c6e6aSSushil Singh HMCID-01 WriteCase3 215e33c6e6aSSushil Singh 216e33c6e6aSSushil Singh 217d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Type 218d03f2ce1SSushil Singh [Documentation] Failed to acquire read, write lock for invalid lock data passed. 219d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type 220d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 221afdd2a1dSVijay 222d03f2ce1SSushil Singh # client_id lock_type message 223d03f2ce1SSushil Singh HMCID-01 ReadCase1 ${BAD_REQUEST} 224d03f2ce1SSushil Singh HMCID-01 ReadCase2 ${BAD_REQUEST} 225d03f2ce1SSushil Singh HMCID-01 ReadCase3 ${BAD_REQUEST} 226d03f2ce1SSushil Singh HMCID-01 ReadCase4 ${BAD_REQUEST} 227d03f2ce1SSushil Singh HMCID-01 ReadCase5 ${BAD_REQUEST} 228d03f2ce1SSushil Singh HMCID-01 WriteCase1 ${BAD_REQUEST} 229d03f2ce1SSushil Singh HMCID-01 WriteCase2 ${BAD_REQUEST} 230d03f2ce1SSushil Singh HMCID-01 WriteCase3 ${BAD_REQUEST} 231d03f2ce1SSushil Singh HMCID-01 WriteCase4 ${BAD_REQUEST} 232d03f2ce1SSushil Singh HMCID-01 WriteCase5 ${BAD_REQUEST} 233afdd2a1dSVijay 234afdd2a1dSVijay 235d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Flag 236d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid lock flag passed. 237d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag 238d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 239afdd2a1dSVijay 240d03f2ce1SSushil Singh # client_id lock_type message 241d03f2ce1SSushil Singh HMCID-01 ReadCase6 ${BAD_REQUEST} 242d03f2ce1SSushil Singh HMCID-01 ReadCase7 ${BAD_REQUEST} 243d03f2ce1SSushil Singh HMCID-01 ReadCase8 ${BAD_REQUEST} 244d03f2ce1SSushil Singh HMCID-01 ReadCase9 ${BAD_REQUEST} 245d03f2ce1SSushil Singh HMCID-01 ReadCase10 ${BAD_REQUEST} 246d03f2ce1SSushil Singh HMCID-01 ReadCase11 ${BAD_REQUEST} 247d03f2ce1SSushil Singh HMCID-01 WriteCase6 ${BAD_REQUEST} 248d03f2ce1SSushil Singh HMCID-01 WriteCase7 ${BAD_REQUEST} 249d03f2ce1SSushil Singh HMCID-01 WriteCase8 ${BAD_REQUEST} 250d03f2ce1SSushil Singh HMCID-01 WriteCase9 ${BAD_REQUEST} 251d03f2ce1SSushil Singh HMCID-01 WriteCase10 ${BAD_REQUEST} 252d03f2ce1SSushil Singh HMCID-01 WriteCase11 ${BAD_REQUEST} 253afdd2a1dSVijay 254afdd2a1dSVijay 255d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Segment Flag 256d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 257d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag 258d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 259d03f2ce1SSushil Singh 260d03f2ce1SSushil Singh # client_id lock_type message 261d03f2ce1SSushil Singh HMCID-01 ReadCase12 ${BAD_REQUEST} 262d03f2ce1SSushil Singh HMCID-01 ReadCase13 ${BAD_REQUEST} 263d03f2ce1SSushil Singh HMCID-01 ReadCase14 ${BAD_REQUEST} 264d03f2ce1SSushil Singh HMCID-01 WriteCase12 ${BAD_REQUEST} 265d03f2ce1SSushil Singh HMCID-01 WriteCase13 ${BAD_REQUEST} 266d03f2ce1SSushil Singh HMCID-01 WriteCase14 ${BAD_REQUEST} 267afdd2a1dSVijay 268bace3005SSushil Singh 2693b3a7ecaSSushil SinghFail To Acquire Lock For Invalid Segment Data Type Flag 2703b3a7ecaSSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 2713b3a7ecaSSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Data_Type_Flag 2723b3a7ecaSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 2733b3a7ecaSSushil Singh 2743b3a7ecaSSushil Singh # client_id lock_type message 2753b3a7ecaSSushil Singh HMCID-01 ReadCase15 ${EMPTY} 2763b3a7ecaSSushil Singh HMCID-01 ReadCase16 ${EMPTY} 2773b3a7ecaSSushil Singh HMCID-01 ReadCase17 ${EMPTY} 2783b3a7ecaSSushil Singh HMCID-01 ReadCase18 ${EMPTY} 2793b3a7ecaSSushil Singh HMCID-01 WriteCase15 ${EMPTY} 2803b3a7ecaSSushil Singh HMCID-01 WriteCase16 ${EMPTY} 2813b3a7ecaSSushil Singh HMCID-01 WriteCase17 ${EMPTY} 2823b3a7ecaSSushil Singh HMCID-01 WriteCase18 ${EMPTY} 2833b3a7ecaSSushil Singh 2843b3a7ecaSSushil Singh 285bace3005SSushil SinghGet Empty Lock Records For Session Where No Locks Acquired 286bace3005SSushil Singh [Documentation] If session does not acquire locks then get lock should return 287bace3005SSushil Singh ... empty lock records. 288bace3005SSushil Singh [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired 289bace3005SSushil Singh [Template] Verify No Locks Records For Session With No Acquired Lock 290bace3005SSushil Singh 291bace3005SSushil Singh # client_id 292bace3005SSushil Singh HMCID-01 293bace3005SSushil Singh 294728ef9c9SSushil Singh 295f9a536caSSushil SinghGet Lock Records Empty For Invalid Session 296f9a536caSSushil Singh [Documentation] Record of lock list is empty for invalid session. 297f9a536caSSushil Singh [Tags] Get_Lock_Records_Empty_For_Invalid_Session 298f9a536caSSushil Singh [Template] Verify Empty Lock Records For Invalid Session 299f9a536caSSushil Singh 300f9a536caSSushil Singh # client_id 301f9a536caSSushil Singh HMCID-01 302f9a536caSSushil Singh 303f9a536caSSushil Singh 304728ef9c9SSushil SinghGet Lock Records For Multiple Session 305728ef9c9SSushil Singh [Documentation] Get lock records of multiple session. 306728ef9c9SSushil Singh [Tags] Get_Lock_Records_For_Multiple_Session 307728ef9c9SSushil Singh [Template] Verify Lock Records Of Multiple Session 308728ef9c9SSushil Singh 309728ef9c9SSushil Singh # client_ids lock_type 310728ef9c9SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 311728ef9c9SSushil Singh 312728ef9c9SSushil Singh 313f9a536caSSushil SinghGet Lock Records For Multiple Invalid Session 314f9a536caSSushil Singh [Documentation] Record of lock list is empty for list of invalid session. 315f9a536caSSushil Singh [Tags] Get_Lock_Records_For_Multiple_Invalid_Session 316f9a536caSSushil Singh [Template] Verify Lock Records For Multiple Invalid Session 317f9a536caSSushil Singh 318f9a536caSSushil Singh # client_id 319f9a536caSSushil Singh HMCID-01 320f9a536caSSushil Singh 32111949a2cSSushil Singh 32211949a2cSSushil SinghGet Lock Records For Multiple Invalid And Valid Session 32311949a2cSSushil Singh [Documentation] Get record of lock from invalid and valid session. 32411949a2cSSushil Singh [Tags] Get_Lock_Records_For_Multiple_Invalid_And_Valid_Session 32511949a2cSSushil Singh [Template] Verify Lock Records For Multiple Invalid And Valid Session 32611949a2cSSushil Singh 32711949a2cSSushil Singh # client_id lock_type 32811949a2cSSushil Singh HMCID-01,HMCID-02 ReadCase1 32911949a2cSSushil Singh 330bc331e22SVijay*** Keywords *** 331bc331e22SVijay 332d03f2ce1SSushil SinghCreate Redfish Session With ClientID 333d03f2ce1SSushil Singh [Documentation] Create redifish session with client id. 334d03f2ce1SSushil Singh [Arguments] ${client_id} 33585610eeeSVijay 33685610eeeSVijay # Description of argument(s): 337d03f2ce1SSushil Singh # client_id This client id can contain string value 338d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 33985610eeeSVijay 340d03f2ce1SSushil Singh ${session_info}= Create Dictionary 341d03f2ce1SSushil Singh ${session}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}} 34285610eeeSVijay 343d03f2ce1SSushil Singh Set To Dictionary ${session_info} SessionIDs ${session['Id']} 344d03f2ce1SSushil Singh Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]} 34585610eeeSVijay 346d03f2ce1SSushil Singh [Return] ${session_info} 34785610eeeSVijay 34885610eeeSVijay 349d03f2ce1SSushil SinghRW General Dictionary 35016b3c7bfSGeorge Keishing [Documentation] Create dictionary of lock request. 351d03f2ce1SSushil Singh [Arguments] ${read_case} ${res_id} 352bc331e22SVijay 353bc331e22SVijay # Description of argument(s): 354d03f2ce1SSushil Singh # read_case Read or Write lock type. 355d03f2ce1SSushil Singh # res_id Resource id. 356bc331e22SVijay 357d03f2ce1SSushil Singh ${request_dict}= Create Dictionary 358566daaf3SGeorge Keishing 359d03f2ce1SSushil Singh FOR ${key} IN @{read_case.keys()} 360d03f2ce1SSushil Singh Set To Dictionary ${request_dict} LockType ${key} 361d03f2ce1SSushil Singh Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]} 362d03f2ce1SSushil Singh END 363bc331e22SVijay 364d03f2ce1SSushil Singh Set To Dictionary ${request_dict} ResourceID ${res_id} 365d03f2ce1SSushil Singh 366d03f2ce1SSushil Singh [Return] ${request_dict} 367bc331e22SVijay 368bc331e22SVijay 369d03f2ce1SSushil SinghReturn Description Of Response 370d03f2ce1SSushil Singh [Documentation] Return description of REST response. 371bc331e22SVijay [Arguments] ${resp_text} 372bc331e22SVijay 373bc331e22SVijay # Description of argument(s): 374d03f2ce1SSushil Singh # resp_text REST response body. 375bc331e22SVijay 376d03f2ce1SSushil Singh # resp_text after successful partition file upload looks like: 377d03f2ce1SSushil Singh # { 378d03f2ce1SSushil Singh # "Description": "File Created" 379d03f2ce1SSushil Singh # } 380bc331e22SVijay 381d03f2ce1SSushil Singh ${message}= Evaluate json.loads('''${resp_text}''') json 382d03f2ce1SSushil Singh 383d03f2ce1SSushil Singh [Return] ${message} 384bc331e22SVijay 385bc331e22SVijay 386a7d71f02SSushil SinghVerify Redfish Session Deleted 387a7d71f02SSushil Singh [Documentation] Verify the redfish session is deleted. 388a7d71f02SSushil Singh [Arguments] ${session_info} 389a7d71f02SSushil Singh 390a7d71f02SSushil Singh # Description of argument(s): 391a7d71f02SSushil Singh # session_info Session information are stored in dictionary. 392a7d71f02SSushil Singh 393a7d71f02SSushil Singh # ${session_info} = { 394a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 395a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 396a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 397a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 398a7d71f02SSushil Singh # } 399a7d71f02SSushil Singh 400a7d71f02SSushil Singh # SessionIDs : Session IDs 401a7d71f02SSushil Singh # ClientID : Client ID 402a7d71f02SSushil Singh # SessionToken : Session token 403a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 404a7d71f02SSushil Singh 405a7d71f02SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions 406a7d71f02SSushil Singh 407a7d71f02SSushil Singh FOR ${session} IN @{sessions['Members']} 4088a3efe7cSSushil Singh Should Not Be Equal As Strings 4098a3efe7cSSushil Singh ... session ['/redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}'] 410a7d71f02SSushil Singh END 411a7d71f02SSushil Singh 412a7d71f02SSushil Singh 413a7d71f02SSushil SinghVerify Redfish List Of Session Deleted 414a7d71f02SSushil Singh [Documentation] Verify all the list of redfish session is deleted. 415a7d71f02SSushil Singh [Arguments] ${session_info_list} 416a7d71f02SSushil Singh 417a7d71f02SSushil Singh # Description of argument(s): 418a7d71f02SSushil Singh # session_info_list List contains individual session record are stored in dictionary. 419a7d71f02SSushil Singh 420a7d71f02SSushil Singh # ${session_info_list} = [{ 421a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 422a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 423a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 424a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 425a7d71f02SSushil Singh # }] 426a7d71f02SSushil Singh 427a7d71f02SSushil Singh # SessionIDs : Session IDs 428a7d71f02SSushil Singh # ClientID : Client ID 429a7d71f02SSushil Singh # SessionToken : Session token 430a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 431a7d71f02SSushil Singh 432a7d71f02SSushil Singh FOR ${session_record} IN @{session_info_list} 433a7d71f02SSushil Singh Verify Redfish Session Deleted ${session_record} 434a7d71f02SSushil Singh END 435a7d71f02SSushil Singh 436a7d71f02SSushil Singh 437d03f2ce1SSushil SinghRedfish Post Acquire Lock 438d03f2ce1SSushil Singh [Documentation] Acquire and release lock. 439d03f2ce1SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 440bc331e22SVijay 441bc331e22SVijay # Description of argument(s): 442d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 443d03f2ce1SSushil Singh # status_code HTTP status code. 444bc331e22SVijay 445e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Lock ${lock_type} 4468a3efe7cSSushil Singh ${resp}= Redfish Post Request 4478a3efe7cSSushil Singh ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 448d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 449df390b61SSushil Singh 450df390b61SSushil Singh Run Keyword If ${status_code} == ${HTTP_BAD_REQUEST} 451df390b61SSushil Singh ... Valid Value ${BAD_REQUEST} ['${resp.content}'] 452df390b61SSushil Singh ... ELSE 453df390b61SSushil Singh ... Run Keyword And Return Return Description Of Response ${resp.content} 454bc331e22SVijay 455d03f2ce1SSushil Singh [Return] ${resp} 456bc331e22SVijay 457bc331e22SVijay 458977f8f58SSushil SinghRedfish Post Acquire List Lock 459977f8f58SSushil Singh [Documentation] Acquire and release lock. 460977f8f58SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 461977f8f58SSushil Singh 462977f8f58SSushil Singh # Description of argument(s): 463977f8f58SSushil Singh # lock_type Read lock or Write lock. 464977f8f58SSushil Singh # status_code HTTP status code. 465977f8f58SSushil Singh 466977f8f58SSushil Singh ${lock_dict_param}= Create Data To Acquire List Of Lock ${lock_type} 4678a3efe7cSSushil Singh ${resp}= Redfish Post Request 4688a3efe7cSSushil Singh ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 469977f8f58SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 470977f8f58SSushil Singh 471977f8f58SSushil Singh [Return] ${resp} 472977f8f58SSushil Singh 473977f8f58SSushil Singh 474d03f2ce1SSushil SinghRedfish Post Acquire Invalid Lock 475d03f2ce1SSushil Singh [Documentation] Redfish to post request to acquire in-valid lock. 476d03f2ce1SSushil Singh [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK} 477bc331e22SVijay 478bc331e22SVijay # Description of argument(s): 479d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 480d03f2ce1SSushil Singh # message Return message from URI. 481d03f2ce1SSushil Singh # status_code HTTP status code. 482bc331e22SVijay 483e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type} 4848a3efe7cSSushil Singh ${resp}= Redfish Post Request 4858a3efe7cSSushil Singh ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 486d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 4873b3a7ecaSSushil Singh Run Keyword If '${message}' != '${EMPTY}' 4883b3a7ecaSSushil Singh ... Valid Value message ['${resp.content}'] 489d03f2ce1SSushil Singh 490d03f2ce1SSushil Singh [Return] ${resp} 491bc331e22SVijay 492bc331e22SVijay 493e33c6e6aSSushil SinghRedfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 494e33c6e6aSSushil Singh [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id. 495e33c6e6aSSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 496e33c6e6aSSushil Singh 497e33c6e6aSSushil Singh # Description of argument(s): 498e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 499e33c6e6aSSushil Singh # status_code HTTP status code. 500e33c6e6aSSushil Singh 5018a3efe7cSSushil Singh ${lock_dict_param}= 5028a3efe7cSSushil Singh ... Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type} 5038a3efe7cSSushil Singh ${resp}= Redfish Post Request 5048a3efe7cSSushil Singh ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 505e33c6e6aSSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 506e33c6e6aSSushil Singh 507e33c6e6aSSushil Singh [Return] ${resp} 508e33c6e6aSSushil Singh 509e33c6e6aSSushil Singh 510d03f2ce1SSushil SinghForm Data To Acquire Lock 51116b3c7bfSGeorge Keishing [Documentation] Create a dictionary for lock request. 512d03f2ce1SSushil Singh [Arguments] ${lock_type} 513d03f2ce1SSushil Singh 514d03f2ce1SSushil Singh # Description of argument(s): 515d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 516d03f2ce1SSushil Singh 517d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 518d03f2ce1SSushil Singh ${resp}= RW General Dictionary 519d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 520d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 521d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 522e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 523d03f2ce1SSushil Singh 524e33c6e6aSSushil Singh [Return] ${lock_request_dict} 525e33c6e6aSSushil Singh 526e33c6e6aSSushil Singh 527977f8f58SSushil SinghCreate Data To Acquire List Of Lock 52816b3c7bfSGeorge Keishing [Documentation] Create a dictionary for list of lock request. 529977f8f58SSushil Singh [Arguments] ${lock_type_list} 530977f8f58SSushil Singh 531977f8f58SSushil Singh # Description of argument(s): 532977f8f58SSushil Singh # lock_type Read lock or Write lock. 533977f8f58SSushil Singh 534977f8f58SSushil Singh ${temp_list}= Create List 535977f8f58SSushil Singh ${lock_res_info}= Get Lock Resource Information 536977f8f58SSushil Singh 537977f8f58SSushil Singh FOR ${lock_type} IN @{lock_type_list} 538977f8f58SSushil Singh ${resp}= RW General Dictionary 539977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 540977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 541977f8f58SSushil Singh Append To List ${temp_list} ${resp} 542977f8f58SSushil Singh END 543977f8f58SSushil Singh 544977f8f58SSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 545977f8f58SSushil Singh 546977f8f58SSushil Singh [Return] ${lock_request_dict} 547977f8f58SSushil Singh 548977f8f58SSushil Singh 549e33c6e6aSSushil SinghForm Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID 55016b3c7bfSGeorge Keishing [Documentation] Create a dictionary for in-valid lock request. 551e33c6e6aSSushil Singh [Arguments] ${lock_type} 552e33c6e6aSSushil Singh 553e33c6e6aSSushil Singh # Description of argument(s): 554e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 555e33c6e6aSSushil Singh 556e33c6e6aSSushil Singh ${lock_res_info}= Get Lock Resource Information 557e33c6e6aSSushil Singh ${resp}= RW General Dictionary 558e33c6e6aSSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 559e33c6e6aSSushil Singh ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]} 560e33c6e6aSSushil Singh ${temp_list}= Create List ${resp} 561e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 562e33c6e6aSSushil Singh 563e33c6e6aSSushil Singh [Return] ${lock_request_dict} 564d03f2ce1SSushil Singh 565d03f2ce1SSushil Singh 566d03f2ce1SSushil SinghForm Data To Acquire Invalid Lock 56716b3c7bfSGeorge Keishing [Documentation] Create a dictionary for in-valid lock request. 568d03f2ce1SSushil Singh [Arguments] ${lock_type} 569d03f2ce1SSushil Singh 570d03f2ce1SSushil Singh # Description of argument(s): 571d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 572d03f2ce1SSushil Singh 573d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 574d03f2ce1SSushil Singh ${resp}= RW General Dictionary 575d03f2ce1SSushil Singh ... ${lock_res_info["Invalid Case"]["${lock_type}"]} 576d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 577d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 578e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 579d03f2ce1SSushil Singh 580e33c6e6aSSushil Singh [Return] ${lock_request_dict} 581d03f2ce1SSushil Singh 582d03f2ce1SSushil Singh 583d03f2ce1SSushil SinghGet Locks List On Resource 584bc331e22SVijay [Documentation] Get locks list. 585d03f2ce1SSushil Singh [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK} 586bc331e22SVijay 587bc331e22SVijay # Description of argument(s): 588d03f2ce1SSushil Singh # session_info Session information in dict. 589d03f2ce1SSushil Singh # exp_status_code Expected HTTP status code. 590bc331e22SVijay 591d03f2ce1SSushil Singh ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]} 592566daaf3SGeorge Keishing ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 593566daaf3SGeorge Keishing ... data=${data} 594bc331e22SVijay ${locks}= Evaluate json.loads('''${resp.text}''') json 595bc331e22SVijay 596bc331e22SVijay [Return] ${locks["Records"]} 597bc331e22SVijay 598bc331e22SVijay 599d03f2ce1SSushil SinghVerify Lock On Resource 600d03f2ce1SSushil Singh [Documentation] Verify lock on resource. 601d03f2ce1SSushil Singh [Arguments] ${session_info} ${transaction_id} 602bc331e22SVijay 603bc331e22SVijay # Description of argument(s): 604d03f2ce1SSushil Singh # session_info Session information in dict. 605d03f2ce1SSushil Singh # transaction_id Transaction id in list stored in dict. 606bc331e22SVijay 607d03f2ce1SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']} 608d03f2ce1SSushil Singh Rprint Vars sessions 609d03f2ce1SSushil Singh ${lock_list}= Get Locks List On Resource ${session_info} 610d03f2ce1SSushil Singh ${lock_length}= Get Length ${lock_list} 611d03f2ce1SSushil Singh ${tran_id_length}= Get Length ${transaction_id} 612d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id_length} ${lock_length} 613afdd2a1dSVijay 614d03f2ce1SSushil Singh FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list} 615d03f2ce1SSushil Singh Valid Value session_info['ClientID'] ['${lock['HMCID']}'] 616d03f2ce1SSushil Singh Valid Value session_info['SessionIDs'] ['${lock['SessionID']}'] 617d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']} 618bc331e22SVijay END 619bc331e22SVijay 620bc331e22SVijay 621d03f2ce1SSushil SinghAcquire Lock On Resource 622d03f2ce1SSushil Singh [Documentation] Acquire lock on resource. 623d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False 624bc331e22SVijay 625bc331e22SVijay # Description of argument(s): 626d03f2ce1SSushil Singh # client_id This client id can contain string value 627d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 628d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 629d03f2ce1SSushil Singh # reboot_flag Flag is used to run reboot the BMC code. 630d03f2ce1SSushil Singh # (e.g. True or False). 631bc331e22SVijay 6328a3efe7cSSushil Singh ${trans_id_emptylist}= Create List 633d03f2ce1SSushil Singh ${trans_id_list}= Create List 6348a3efe7cSSushil Singh 635d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 636d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 637d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 6388a3efe7cSSushil Singh 639d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 640566daaf3SGeorge Keishing 641e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 642bc331e22SVijay 643d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'True' 6448a3efe7cSSushil Singh ... Run Keywords Redfish BMC Reset Operation AND 645e33c6e6aSSushil Singh ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND 6468a3efe7cSSushil Singh ... Is BMC Standby AND 6478a3efe7cSSushil Singh ... Verify Lock On Resource ${session_info} ${trans_id_emptylist} 648bc331e22SVijay 649d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'False' 650d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 651bc331e22SVijay 652d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 653d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 654d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 655bc331e22SVijay 656bc331e22SVijay 657d03f2ce1SSushil SinghForm Data To Release Lock 658d03f2ce1SSushil Singh [Documentation] Create a dictonay to release lock. 659d03f2ce1SSushil Singh [Arguments] ${trans_id_list} 660355daac7SVijay 661355daac7SVijay # Description of argument(s): 662d03f2ce1SSushil Singh # trans_id_list 663355daac7SVijay 664d03f2ce1SSushil Singh @{tran_ids}= Create List 665355daac7SVijay 666d03f2ce1SSushil Singh FOR ${item} IN @{trans_id_list} 667d03f2ce1SSushil Singh Append To List ${tran_ids} ${item['TransactionID']} 668d03f2ce1SSushil Singh END 669d03f2ce1SSushil Singh 670d03f2ce1SSushil Singh [Return] ${tran_ids} 671d03f2ce1SSushil Singh 672d03f2ce1SSushil Singh 673d03f2ce1SSushil SinghRelease Locks On Resource 674d03f2ce1SSushil Singh [Documentation] Redfish request to release a lock. 6758a3efe7cSSushil Singh [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction 6768a3efe7cSSushil Singh ... ${status_code}=${HTTP_OK} 677d03f2ce1SSushil Singh 678d03f2ce1SSushil Singh # Description of argument(s): 679d03f2ce1SSushil Singh # session_info Session information in dict. 680d03f2ce1SSushil Singh # trans_id_list Transaction id list. 681d03f2ce1SSushil Singh # release_lock_type Release lock by Transaction, Session. 682d03f2ce1SSushil Singh # status_code HTTP status code. 683d03f2ce1SSushil Singh 684d03f2ce1SSushil Singh ${tran_ids}= Form Data To Release Lock ${trans_id_list} 685d03f2ce1SSushil Singh ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}} 686d03f2ce1SSushil Singh ${data}= Evaluate json.dumps(${data}) json 687d03f2ce1SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data} 688d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 689d03f2ce1SSushil Singh 690d03f2ce1SSushil Singh 691df390b61SSushil SinghRelease locks And Delete Session 692df390b61SSushil Singh [Documentation] Release locks and delete redfish session. 693df390b61SSushil Singh [Arguments] ${session_info} ${trans_id_list} 694df390b61SSushil Singh 695df390b61SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} 696df390b61SSushil Singh 697df390b61SSushil Singh ${trans_id_emptylist}= Create List 698df390b61SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 699df390b61SSushil Singh 700df390b61SSushil Singh Redfish Delete Session ${session_info} 701df390b61SSushil Singh 702df390b61SSushil Singh 703d03f2ce1SSushil SinghAcquire Lock On Another Lock 704d03f2ce1SSushil Singh [Documentation] Acquire lock on another lock. 705d03f2ce1SSushil Singh [Arguments] ${client_id} 706d03f2ce1SSushil Singh 707d03f2ce1SSushil Singh # Description of argument(s): 708d03f2ce1SSushil Singh # client_id This client id can contain string value 709d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 710d03f2ce1SSushil Singh 711d03f2ce1SSushil Singh ${trans_id_list}= Create List 712d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 713d03f2ce1SSushil Singh 714d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 715d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 716d03f2ce1SSushil Singh 717d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 718d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 719d03f2ce1SSushil Singh 720d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 721d03f2ce1SSushil Singh 722df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 723d03f2ce1SSushil Singh 724d03f2ce1SSushil Singh 725977f8f58SSushil SinghVerify Fail To Acquire Read And Write In Single Request 726977f8f58SSushil Singh [Documentation] Verify fail to acquire read and write lock passed in single request. 727977f8f58SSushil Singh [Arguments] ${client_id} ${lock_type} 728977f8f58SSushil Singh 729977f8f58SSushil Singh # Description of argument(s): 730977f8f58SSushil Singh # client_id This client id can contain string value 731977f8f58SSushil Singh # (e.g. 12345, "HMCID"). 732977f8f58SSushil Singh # lock_type Read lock or Write lock. 733977f8f58SSushil Singh 734977f8f58SSushil Singh ${lock_type_list}= Split String ${lock_type} , 735977f8f58SSushil Singh 736977f8f58SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 737977f8f58SSushil Singh ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list} status_code=${HTTP_BAD_REQUEST} 738977f8f58SSushil Singh Redfish Delete Session ${session_info} 739977f8f58SSushil Singh 740977f8f58SSushil Singh 741d03f2ce1SSushil SinghVerify Empty Lock Records For Invalid Session 742d03f2ce1SSushil Singh [Documentation] Verify no lock record found for invalid session. 743d03f2ce1SSushil Singh [Arguments] ${client_id} 744d03f2ce1SSushil Singh 745d03f2ce1SSushil Singh # Description of argument(s): 746d03f2ce1SSushil Singh # client_id This client id can contain string value 747d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 748d03f2ce1SSushil Singh 749d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_id} 750d03f2ce1SSushil Singh 751d03f2ce1SSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 752d03f2ce1SSushil Singh ${lock_length1}= Get Length ${lock_list1} 753d03f2ce1SSushil Singh 754d03f2ce1SSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 755d03f2ce1SSushil Singh set to dictionary ${session_info2} SessionIDs xxyXyyYZZz 756d03f2ce1SSushil Singh 757d03f2ce1SSushil Singh ${lock_list2}= Get Locks List On Resource ${session_info2} 758f9a536caSSushil Singh ${lock_length2}= Get Length ${lock_list2} 759d03f2ce1SSushil Singh 760f9a536caSSushil Singh Should Be Equal As Integers ${lock_length1} ${lock_length2} 761d03f2ce1SSushil Singh 762d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 763d03f2ce1SSushil Singh 764d03f2ce1SSushil Singh 765d03f2ce1SSushil SinghVerify Acquire Lock Fails On Another Lock 766d03f2ce1SSushil Singh [Documentation] Verify acquire lock on another lock fails. 767d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 768d03f2ce1SSushil Singh 769d03f2ce1SSushil Singh # Description of argument(s): 770d03f2ce1SSushil Singh # client_id This client id can contain string value 771d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 772d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 773d03f2ce1SSushil Singh 774d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 775d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 776d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 777d03f2ce1SSushil Singh 778d03f2ce1SSushil Singh ${trans_id_list}= Create List 779d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 780d03f2ce1SSushil Singh 781d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 782d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 783d03f2ce1SSushil Singh 784df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 785d03f2ce1SSushil Singh 786d03f2ce1SSushil Singh 787e33c6e6aSSushil SinghVerify Acquire Lock After Reboot 788e33c6e6aSSushil Singh [Documentation] Acquire read and write lock after the reboot and release lock. 789e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 790e33c6e6aSSushil Singh 791e33c6e6aSSushil Singh # Description of argument(s): 792e33c6e6aSSushil Singh # client_id This client id can contain string value 793e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 794e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 795e33c6e6aSSushil Singh 796e33c6e6aSSushil Singh ${trans_id_list}= Create List 797f9a536caSSushil Singh ${session_info}= Create Session With ClientID ${client_id} 798e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 799e33c6e6aSSushil Singh Redfish OBMC Reboot (off) 800e33c6e6aSSushil Singh Redfish Login 801e33c6e6aSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} 802e33c6e6aSSushil Singh 803e33c6e6aSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 804e33c6e6aSSushil Singh Append To List ${trans_id_list} ${trans_id} 805e33c6e6aSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 806e33c6e6aSSushil Singh 807df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 808df390b61SSushil Singh 809df390b61SSushil Singh 810df390b61SSushil SinghVerify Acquire Multiple Lock Request At CEC Level 811df390b61SSushil Singh [Documentation] Acquire lock in loop. 812df390b61SSushil Singh [Arguments] ${client_id} ${lock_type} 813df390b61SSushil Singh 814df390b61SSushil Singh # Description of argument(s): 815df390b61SSushil Singh # client_id This client id can contain string value 816df390b61SSushil Singh # (e.g. 12345, "HMCID"). 817df390b61SSushil Singh # lock_type Read lock or Write lock. 818df390b61SSushil Singh 819df390b61SSushil Singh ${trans_id_list}= Create List 820df390b61SSushil Singh @{lock_type_list}= Split String ${lock_type} , 821df390b61SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 822df390b61SSushil Singh 823df390b61SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 824df390b61SSushil Singh Append To List ${trans_id_list} ${trans_id} 825df390b61SSushil Singh 826df390b61SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 827df390b61SSushil Singh 828df390b61SSushil Singh Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 829df390b61SSushil Singh 830df390b61SSushil Singh Release locks And Delete Session ${session_info} ${trans_id_list} 831e33c6e6aSSushil Singh 832e33c6e6aSSushil Singh 833*8d420bf6SSushil SinghPost Reboot Acquire Lock 834*8d420bf6SSushil Singh [Documentation] Post reboot acquire lock and verify the transaction id is 1. 835*8d420bf6SSushil Singh [Arguments] ${session_info} ${lock_type} 836*8d420bf6SSushil Singh 837*8d420bf6SSushil Singh # Description of argument(s): 838*8d420bf6SSushil Singh # session_info Session information. 839*8d420bf6SSushil Singh # lock_type Read lock or Write lock. 840*8d420bf6SSushil Singh 841*8d420bf6SSushil Singh ${trans_id_list}= Create List 842*8d420bf6SSushil Singh ${trans_id_list_var}= Create List 843*8d420bf6SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 844*8d420bf6SSushil Singh Append To List ${trans_id_list} ${trans_id} 845*8d420bf6SSushil Singh Append To List ${trans_id_list_var} ${default_trans_id} 846*8d420bf6SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 847*8d420bf6SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list_var} 848*8d420bf6SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 849*8d420bf6SSushil Singh ${trans_id_emptylist}= Create List 850*8d420bf6SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 851*8d420bf6SSushil Singh 852*8d420bf6SSushil Singh 853d03f2ce1SSushil SinghVerify Acquire And Release Lock In Loop 854d03f2ce1SSushil Singh [Documentation] Acquire lock in loop. 855*8d420bf6SSushil Singh [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False 856d03f2ce1SSushil Singh 857d03f2ce1SSushil Singh # Description of argument(s): 858d03f2ce1SSushil Singh # client_id This client id can contain string value 859d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 860d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 861*8d420bf6SSushil Singh # reboot_flag Flag is used to run reboot the BMC code. 862*8d420bf6SSushil Singh # (e.g. True or False). 863d03f2ce1SSushil Singh 864d03f2ce1SSushil Singh FOR ${count} IN RANGE 1 11 865d03f2ce1SSushil Singh ${trans_id_list}= Create List 866d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 867d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 868d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 869d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 870d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 871d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 872d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 873*8d420bf6SSushil Singh Redfish Delete Session ${session_info} 874d03f2ce1SSushil Singh END 875d03f2ce1SSushil Singh 876*8d420bf6SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 877*8d420bf6SSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 878*8d420bf6SSushil Singh 879*8d420bf6SSushil Singh Run Keyword If '${reboot_flag}' == 'True' 880*8d420bf6SSushil Singh ... Run Keywords Redfish BMC Reset Operation AND 881*8d420bf6SSushil Singh ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND 882*8d420bf6SSushil Singh ... Is BMC Standby AND 883*8d420bf6SSushil Singh ... Post Reboot Acquire Lock ${session_info} ${lock_type} 884d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 885d03f2ce1SSushil Singh 886d03f2ce1SSushil Singh 887d03f2ce1SSushil SinghAcquire And Release Multiple Locks 888d03f2ce1SSushil Singh [Documentation] Acquire mutilple locks on resource. 889d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 890d03f2ce1SSushil Singh 891d03f2ce1SSushil Singh # Description of argument(s): 892d03f2ce1SSushil Singh # client_id This client id can contain string value 893d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 894d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 895d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 896d03f2ce1SSushil Singh 897d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 898d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 899d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 900d03f2ce1SSushil Singh 901d03f2ce1SSushil Singh ${trans_id_list}= Create List 902d03f2ce1SSushil Singh 903d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 904d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 905d03f2ce1SSushil Singh 906d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 907d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 908d03f2ce1SSushil Singh 909d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 910d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 911d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 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 91894116c61Ssusilsi7Verify Release Lock When Session Deleted 91994116c61Ssusilsi7 [Documentation] Verify lock get released when session are deleted. 92094116c61Ssusilsi7 [Arguments] ${client_id} ${lock_type} 92194116c61Ssusilsi7 92294116c61Ssusilsi7 # Description of argument(s): 92394116c61Ssusilsi7 # client_ids This client id can contain string value 92494116c61Ssusilsi7 # (e.g. 12345, "HMCID"). 92594116c61Ssusilsi7 # lock_type Read lock or Write lock. 92694116c61Ssusilsi7 92794116c61Ssusilsi7 ${trans_id_list}= Create List 92894116c61Ssusilsi7 @{lock_type_list}= Split String ${lock_type} , 92994116c61Ssusilsi7 93094116c61Ssusilsi7 ${pre_session_info}= Create Redfish Session With ClientID ${client_id} 93194116c61Ssusilsi7 93294116c61Ssusilsi7 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 93394116c61Ssusilsi7 Append To List ${trans_id_list} ${trans_id} 93494116c61Ssusilsi7 Verify Lock On Resource ${pre_session_info} ${trans_id_list} 93594116c61Ssusilsi7 93694116c61Ssusilsi7 Redfish Delete Session ${pre_session_info} 93794116c61Ssusilsi7 ${post_session_info}= Create Redfish Session With ClientID ${client_id} 93894116c61Ssusilsi7 ${resp}= Get Locks List On Resource With Session List ${pre_session_info} ${HTTP_BAD_REQUEST} 93994116c61Ssusilsi7 94094116c61Ssusilsi7 Redfish Delete Session ${post_session_info} 94194116c61Ssusilsi7 94294116c61Ssusilsi7 94394116c61Ssusilsi7 94459011d08SSushil SinghVerify Fail To Release Lock With Invalid TransactionID 94516b3c7bfSGeorge Keishing [Documentation] Verify fail to be release lock with invalid transaction ID. 94659011d08SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 94759011d08SSushil Singh 94859011d08SSushil Singh # Description of argument(s): 94959011d08SSushil Singh # client_id This client id can contain string value 95059011d08SSushil Singh # (e.g. 12345, "HMCID"). 95159011d08SSushil Singh # lock_type Read lock or Write lock. 95259011d08SSushil Singh # release_lock_type The value can be Transaction or Session. 95359011d08SSushil Singh 95459011d08SSushil Singh ${trans_id_list}= Create List 95559011d08SSushil Singh @{lock_type_list}= Split String ${lock_type} , 95659011d08SSushil Singh 95759011d08SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 95859011d08SSushil Singh 95959011d08SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 96059011d08SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 96159011d08SSushil Singh ${value}= Evaluate ${value} + 10 96259011d08SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 96359011d08SSushil Singh Append To List ${trans_id_list} ${trans_id} 96459011d08SSushil Singh 96559011d08SSushil Singh Release Locks On Resource 96659011d08SSushil Singh ... ${session_info} ${trans_id_list} 96759011d08SSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 96859011d08SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 96959011d08SSushil Singh 97059011d08SSushil Singh ${trans_id_emptylist}= Create List 97159011d08SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 97259011d08SSushil Singh Redfish Delete Session ${session_info} 97359011d08SSushil Singh 97459011d08SSushil Singh 9751b59053dSSushil SinghVerify Fail To Release Multiple Lock With Invalid TransactionID 9761b59053dSSushil Singh [Documentation] Verify release multiple locks with invalid transaction ID fails. 977d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 978d03f2ce1SSushil Singh 979d03f2ce1SSushil Singh # Description of argument(s): 980d03f2ce1SSushil Singh # client_id This client id can contain string value 981d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 982d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 983d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 984d03f2ce1SSushil Singh 985d03f2ce1SSushil Singh ${trans_id_list}= Create List 986d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 987d03f2ce1SSushil Singh 988d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 989d03f2ce1SSushil Singh 990d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 991d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 992d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 993d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 994d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 995d03f2ce1SSushil Singh 996d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 997d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 998d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 999d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 1000d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 1001d03f2ce1SSushil Singh 1002d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 1003d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 1004d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 1005d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 1006d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 1007d03f2ce1SSushil Singh 1008d03f2ce1SSushil Singh Release Locks On Resource 1009d03f2ce1SSushil Singh ... ${session_info} ${trans_id_list} 1010d03f2ce1SSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 1011d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 1012d03f2ce1SSushil Singh 1013d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 1014d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 1015d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 1016d03f2ce1SSushil Singh 1017d03f2ce1SSushil Singh 10188bee358fSSushil SinghVerify Fail To Release Multiple Lock With Valid And Invalid TransactionID 10199614383dSGeorge Keishing [Documentation] Verify fail to be release multiple lock with valid and invalid transaction ID. 10208bee358fSSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 10218bee358fSSushil Singh 10228bee358fSSushil Singh # Description of argument(s): 10238bee358fSSushil Singh # client_id This client id can contain string value 10248bee358fSSushil Singh # (e.g. 12345, "HMCID"). 10258bee358fSSushil Singh # lock_type Read lock or Write lock. 10268bee358fSSushil Singh # release_lock_type The value can be Transaction or Session. 10278bee358fSSushil Singh 10288bee358fSSushil Singh ${trans_id_list}= Create List 10298bee358fSSushil Singh @{lock_type_list}= Split String ${lock_type} , 10308bee358fSSushil Singh 10318bee358fSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 10328bee358fSSushil Singh 10338bee358fSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 10348bee358fSSushil Singh Append To List ${trans_id_list} ${trans_id} 10358bee358fSSushil Singh 10368bee358fSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 10378bee358fSSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 10388bee358fSSushil Singh ${value}= Evaluate ${value} + 10 10398bee358fSSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 10408bee358fSSushil Singh Append To List ${trans_id_list} ${trans_id} 10418bee358fSSushil Singh 10428bee358fSSushil Singh Release Locks On Resource 10438bee358fSSushil Singh ... ${session_info} ${trans_id_list} 10448bee358fSSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 10458bee358fSSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 10468bee358fSSushil Singh 10478bee358fSSushil Singh ${trans_id_emptylist}= Create List 10488bee358fSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 10498bee358fSSushil Singh Redfish Delete Session ${session_info} 10508bee358fSSushil Singh 10518bee358fSSushil Singh 10521d7b996cSsusilsi7Verify Fail To Release Lock With TransactionID As String Type 10539614383dSGeorge Keishing [Documentation] Verify fail to be release lock with transaction ID as string data type. 10541d7b996cSsusilsi7 [Arguments] ${client_id} ${lock_type} ${release_lock_type} 10551d7b996cSsusilsi7 10561d7b996cSsusilsi7 # Description of argument(s): 10571d7b996cSsusilsi7 # client_id This client id can contain string value 10581d7b996cSsusilsi7 # (e.g. 12345, "HMCID"). 10591d7b996cSsusilsi7 # lock_type Read lock or Write lock. 10601d7b996cSsusilsi7 # release_lock_type The value can be Transaction or Session. 10611d7b996cSsusilsi7 10621d7b996cSsusilsi7 ${trans_id_list}= Create List 10631d7b996cSsusilsi7 @{lock_type_list}= Split String ${lock_type} , 10641d7b996cSsusilsi7 10651d7b996cSsusilsi7 ${session_info}= Create Redfish Session With ClientID ${client_id} 10661d7b996cSsusilsi7 10671d7b996cSsusilsi7 ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 10681d7b996cSsusilsi7 10691d7b996cSsusilsi7 Append To List ${trans_id_list} ${trans_id} 10701d7b996cSsusilsi7 10711d7b996cSsusilsi7 ${temp_trans_id_list}= Copy Dictionary ${trans_id_list} deepcopy=True 10721d7b996cSsusilsi7 10731d7b996cSsusilsi7 ${value}= Get From Dictionary ${trans_id_list}[0] TransactionID 10741d7b996cSsusilsi7 ${value}= Set Variable \'${value}\' 10751d7b996cSsusilsi7 Set To Dictionary ${temp_trans_id_list}[0] TransactionID ${value} 10761d7b996cSsusilsi7 10771d7b996cSsusilsi7 Release Locks On Resource 10781d7b996cSsusilsi7 ... ${session_info} ${temp_trans_id_list} 10791d7b996cSsusilsi7 ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 10801d7b996cSsusilsi7 10811d7b996cSsusilsi7 Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 10821d7b996cSsusilsi7 10831d7b996cSsusilsi7 ${trans_id_emptylist}= Create List 10841d7b996cSsusilsi7 Verify Lock On Resource ${session_info} ${trans_id_emptylist} 10851d7b996cSsusilsi7 Redfish Delete Session ${session_info} 10861d7b996cSsusilsi7 10871d7b996cSsusilsi7 1088d03f2ce1SSushil SinghVerify Fail To Release Lock For Another Session 1089d03f2ce1SSushil Singh [Documentation] Verify failed to release the lock form another session. 1090d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 1091d03f2ce1SSushil Singh 1092d03f2ce1SSushil Singh # Description of argument(s): 1093d03f2ce1SSushil Singh # client_id This client id can contain string value 1094d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 1095d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 1096d03f2ce1SSushil Singh 1097d03f2ce1SSushil Singh ${client_ids}= Split String ${client_id} , 1098d03f2ce1SSushil Singh ${lock_type_list}= Split String ${lock_type} , 1099d03f2ce1SSushil Singh ${trans_id_list1}= Create List 1100d03f2ce1SSushil Singh ${trans_id_list2}= Create List 1101d03f2ce1SSushil Singh 1102d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0] 1103d03f2ce1SSushil Singh 1104d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1105d03f2ce1SSushil Singh Append To List ${trans_id_list1} ${trans_id} 1106d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 1107d03f2ce1SSushil Singh 1108d03f2ce1SSushil Singh ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1] 1109d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 1110d03f2ce1SSushil Singh Append To List ${trans_id_list2} ${trans_id} 1111d03f2ce1SSushil Singh Verify Lock On Resource ${session_info2} ${trans_id_list2} 1112d03f2ce1SSushil Singh 1113d03f2ce1SSushil Singh Release Locks On Resource 1114d03f2ce1SSushil Singh ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_UNAUTHORIZED} 1115d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 1116d03f2ce1SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session 1117d03f2ce1SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session 1118d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 1119d03f2ce1SSushil Singh Redfish Delete Session ${session_info2} 1120d03f2ce1SSushil Singh 1121d03f2ce1SSushil Singh 1122e33c6e6aSSushil SinghVerify Fail To Acquire Lock For Invalid Resource ID Data Type 1123e33c6e6aSSushil Singh [Documentation] Verify fail to acquire the lock with invalid resource id data type. 1124e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 1125e33c6e6aSSushil Singh 1126e33c6e6aSSushil Singh # Description of argument(s): 1127e33c6e6aSSushil Singh # client_id This client id can contain string value 1128e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 1129e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 1130e33c6e6aSSushil Singh 1131e33c6e6aSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 1132e33c6e6aSSushil Singh Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 1133e33c6e6aSSushil Singh ... ${lock_type} status_code=${HTTP_BAD_REQUEST} 1134e33c6e6aSSushil Singh Redfish Delete Session ${session_info} 1135e33c6e6aSSushil Singh 1136e33c6e6aSSushil Singh 1137d03f2ce1SSushil SinghVerify Fail To Acquire Lock For Invalid Lock Data 113816b3c7bfSGeorge Keishing [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segment flags. 1139d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${message} 1140d03f2ce1SSushil Singh 1141d03f2ce1SSushil Singh # Description of argument(s): 1142d03f2ce1SSushil Singh # client_id This client id can contain string value 1143d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 1144d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 1145d03f2ce1SSushil Singh # message Return message from URI. 1146d03f2ce1SSushil Singh 1147d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 11488a3efe7cSSushil Singh ${trans_id}= Redfish Post Acquire Invalid Lock 11498a3efe7cSSushil Singh ... ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST} 1150d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 1151bace3005SSushil Singh 1152bace3005SSushil Singh 1153bace3005SSushil SinghVerify No Locks Records For Session With No Acquired Lock 1154bace3005SSushil Singh [Documentation] Verify no records found for a session where no lock is acquired. 1155bace3005SSushil Singh [Arguments] ${client_id} 1156bace3005SSushil Singh 1157bace3005SSushil Singh # Description of argument(s): 1158bace3005SSushil Singh # client_id This client id can contain string value 1159bace3005SSushil Singh # (e.g. 12345, "HMCID"). 1160bace3005SSushil Singh 1161bace3005SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 1162bace3005SSushil Singh ${trans_id_emptylist}= Create List 1163bace3005SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 1164bace3005SSushil Singh Redfish Delete Session ${session_info} 1165728ef9c9SSushil Singh 1166728ef9c9SSushil Singh 1167728ef9c9SSushil SinghCreate List Of Session ID 1168728ef9c9SSushil Singh [Documentation] Create session id list from session dict info. 1169728ef9c9SSushil Singh [Arguments] ${session_dict_info} 1170728ef9c9SSushil Singh 1171728ef9c9SSushil Singh # Description of argument(s): 1172728ef9c9SSushil Singh # session_dict_info Session information in dict. 1173728ef9c9SSushil Singh 1174728ef9c9SSushil Singh @{session_id_list}= Create List 1175728ef9c9SSushil Singh 1176728ef9c9SSushil Singh FOR ${session} IN @{session_dict_info} 1177728ef9c9SSushil Singh Append To List ${session_id_list} ${session["SessionIDs"]} 1178728ef9c9SSushil Singh END 1179728ef9c9SSushil Singh 1180728ef9c9SSushil Singh ${num_id}= Get Length ${session_id_list} 1181728ef9c9SSushil Singh Should Not Be Equal As Integers ${num_id} ${0} 1182728ef9c9SSushil Singh 1183728ef9c9SSushil Singh ${session_id_list}= Evaluate json.dumps(${session_id_list}) json 1184728ef9c9SSushil Singh 1185728ef9c9SSushil Singh [Return] ${session_id_list} 1186728ef9c9SSushil Singh 1187728ef9c9SSushil Singh 1188728ef9c9SSushil SinghGet Locks List On Resource With Session List 1189728ef9c9SSushil Singh [Documentation] Get locks list from session of list. 1190728ef9c9SSushil Singh [Arguments] ${session_id_list} ${exp_status_code}=${HTTP_OK} 1191728ef9c9SSushil Singh 1192728ef9c9SSushil Singh # Description of argument(s): 1193728ef9c9SSushil Singh # session_id_list Session ids list. 1194728ef9c9SSushil Singh # exp_status_code Expected HTTP status code. 1195728ef9c9SSushil Singh 1196728ef9c9SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 1197728ef9c9SSushil Singh ... data={"SessionIDs": ${session_id_list}} 119894116c61Ssusilsi7 Should Be Equal As Strings ${resp.status_code} ${exp_status_code} 1199728ef9c9SSushil Singh ${locks}= Evaluate json.loads('''${resp.text}''') json 1200728ef9c9SSushil Singh 1201728ef9c9SSushil Singh [Return] ${locks} 1202728ef9c9SSushil Singh 1203728ef9c9SSushil Singh 1204728ef9c9SSushil SinghVerify List Of Session Lock On Resource 1205728ef9c9SSushil Singh [Documentation] Verify list of lock record from list of sessions. 1206728ef9c9SSushil Singh [Arguments] ${session_dict_info} ${transaction_id_list} 1207728ef9c9SSushil Singh 1208728ef9c9SSushil Singh # Description of argument(s): 1209728ef9c9SSushil Singh # session_dict_info Session information in dict. 1210728ef9c9SSushil Singh # transaction_id_list Transaction id in list stored in dict. 1211728ef9c9SSushil Singh 1212728ef9c9SSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_info} 1213728ef9c9SSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 1214728ef9c9SSushil Singh ${lock_list}= Set Variable ${lock_list_resp['Records']} 1215728ef9c9SSushil Singh 12168a3efe7cSSushil Singh FOR ${session_id} ${tran_id} ${lock_record} IN ZIP 12178a3efe7cSSushil Singh ... ${session_dict_info} ${transaction_id_list} ${lock_list} 1218728ef9c9SSushil Singh Valid Value session_id['SessionIDs'] ['${lock_record['SessionID']}'] 1219728ef9c9SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock_record['TransactionID']} 1220728ef9c9SSushil Singh END 1221728ef9c9SSushil Singh 1222728ef9c9SSushil Singh 1223728ef9c9SSushil SinghVerify Lock Records Of Multiple Session 1224728ef9c9SSushil Singh [Documentation] Verify all records found for a multiple sessions. 1225728ef9c9SSushil Singh [Arguments] ${client_ids} ${lock_type} 1226728ef9c9SSushil Singh 1227728ef9c9SSushil Singh # Description of argument(s): 1228728ef9c9SSushil Singh # client_ids This client id can contain string value 1229728ef9c9SSushil Singh # (e.g. 12345, "HMCID"). 1230728ef9c9SSushil Singh # lock_type Read lock or Write lock. 1231728ef9c9SSushil Singh 1232728ef9c9SSushil Singh ${client_id_list}= Split String ${client_ids} , 1233728ef9c9SSushil Singh ${lock_type_list}= Split String ${lock_type} , 1234728ef9c9SSushil Singh ${trans_id_list1}= Create List 1235728ef9c9SSushil Singh ${trans_id_list2}= Create List 1236728ef9c9SSushil Singh 1237728ef9c9SSushil Singh ${session_dict_list}= Create List 1238728ef9c9SSushil Singh ${lock_list}= Create List 1239728ef9c9SSushil Singh 1240728ef9c9SSushil Singh ${client_id1}= Create List 1241728ef9c9SSushil Singh Append To List ${client_id1} ${client_id_list}[0] 1242728ef9c9SSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 1243728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 1244728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 1245728ef9c9SSushil Singh 1246728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1247728ef9c9SSushil Singh Append To List ${trans_id_list1} ${trans_id} 1248728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 1249728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 1250728ef9c9SSushil Singh 1251728ef9c9SSushil Singh 1252728ef9c9SSushil Singh ${client_id2}= Create List 1253728ef9c9SSushil Singh Append To List ${client_id2} ${client_id_list}[1] 1254728ef9c9SSushil Singh ${session_info2}= Create Session With List Of ClientID ${client_id2} 1255728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 1256728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id2} ${session_info2} 1257728ef9c9SSushil Singh 1258728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 1259728ef9c9SSushil Singh Append To List ${trans_id_list2} ${trans_id} 1260728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 1261728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_list2} 1262728ef9c9SSushil Singh 1263728ef9c9SSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 1264728ef9c9SSushil Singh 1265728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 1266728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 1267728ef9c9SSushil Singh 1268728ef9c9SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 1269728ef9c9SSushil Singh 1270728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info2}[0] SessionToken 1271728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 1272728ef9c9SSushil Singh 1273728ef9c9SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Transaction 1274728ef9c9SSushil Singh 1275728ef9c9SSushil Singh ${trans_id_emptylist}= Create List 1276728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 1277728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_emptylist} 1278728ef9c9SSushil Singh 1279728ef9c9SSushil Singh Redfish Delete List Of Session ${session_dict_list} 1280f9a536caSSushil Singh 1281f9a536caSSushil Singh 1282f9a536caSSushil SinghVerify Lock Records For Multiple Invalid Session 1283f9a536caSSushil Singh [Documentation] Verify no lock record found for multiple invalid session. 1284f9a536caSSushil Singh [Arguments] ${client_id} 1285f9a536caSSushil Singh 1286f9a536caSSushil Singh # Description of argument(s): 1287f9a536caSSushil Singh # client_id This client id can contain string value 1288f9a536caSSushil Singh # (e.g. 12345, "HMCID"). 1289f9a536caSSushil Singh 1290f9a536caSSushil Singh ${session_dict_list}= Create List 1291f9a536caSSushil Singh ${invalid_session_ids}= Create List xxyXyyYZZz xXyXYyYZzz 1292f9a536caSSushil Singh 1293f9a536caSSushil Singh ${session_info1}= Create Session With ClientID ${client_id} 1294f9a536caSSushil Singh 1295f9a536caSSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 1296f9a536caSSushil Singh set to dictionary ${session_info2} SessionIDs ${invalid_session_ids}[0] 1297f9a536caSSushil Singh Append To List ${session_dict_list} ${session_info2} 1298f9a536caSSushil Singh 1299f9a536caSSushil Singh ${session_info3}= Copy Dictionary ${session_info1} deepcopy=True 1300f9a536caSSushil Singh set to dictionary ${session_info3} SessionIDs ${invalid_session_ids}[0] 1301f9a536caSSushil Singh Append To List ${session_dict_list} ${session_info3} 1302f9a536caSSushil Singh 1303f9a536caSSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 1304f9a536caSSushil Singh ${lock_length1}= Get Length ${lock_list1} 1305f9a536caSSushil Singh 1306f9a536caSSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_list} 1307f9a536caSSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 1308f9a536caSSushil Singh ${lock_length2}= Get Length ${lock_list_resp['Records']} 1309f9a536caSSushil Singh 1310f9a536caSSushil Singh Should Be Equal As Integers ${lock_length1} ${lock_length2} 1311f9a536caSSushil Singh 1312f9a536caSSushil Singh Redfish Delete Session ${session_info1} 131311949a2cSSushil Singh 131411949a2cSSushil Singh 131511949a2cSSushil SinghVerify Lock Records For Multiple Invalid And Valid Session 131611949a2cSSushil Singh [Documentation] Verify all records found for a valid and invalid sessions. 131711949a2cSSushil Singh [Arguments] ${client_ids} ${lock_type} 131811949a2cSSushil Singh 131911949a2cSSushil Singh # Description of argument(s): 132011949a2cSSushil Singh # client_ids This client id can contain string value 132111949a2cSSushil Singh # (e.g. 12345, "HMCID"). 132211949a2cSSushil Singh # lock_type Read lock or Write lock. 132311949a2cSSushil Singh 132411949a2cSSushil Singh ${client_id_list}= Split String ${client_ids} , 132511949a2cSSushil Singh ${lock_type_list}= Split String ${lock_type} , 132611949a2cSSushil Singh ${trans_id_list1}= Create List 132711949a2cSSushil Singh ${invalid_session_ids}= Create List xxyXyyYZZz 132811949a2cSSushil Singh 132911949a2cSSushil Singh ${session_dict_list}= Create List 133011949a2cSSushil Singh ${lock_list}= Create List 133111949a2cSSushil Singh 133211949a2cSSushil Singh ${client_id1}= Create List 133311949a2cSSushil Singh Append To List ${client_id1} ${client_id_list}[0] 133411949a2cSSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 133511949a2cSSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 133611949a2cSSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 133711949a2cSSushil Singh 133811949a2cSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 133911949a2cSSushil Singh Append To List ${trans_id_list1} ${trans_id} 134011949a2cSSushil Singh Append To List ${lock_list} ${trans_id} 134111949a2cSSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 134211949a2cSSushil Singh 134311949a2cSSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 134411949a2cSSushil Singh set to dictionary ${session_info2}[0] SessionIDs ${invalid_session_ids}[0] 134511949a2cSSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 134611949a2cSSushil Singh 134711949a2cSSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 134811949a2cSSushil Singh 134911949a2cSSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 135011949a2cSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 135111949a2cSSushil Singh 135211949a2cSSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 135311949a2cSSushil Singh 135411949a2cSSushil Singh ${trans_id_emptylist}= Create List 135511949a2cSSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 135611949a2cSSushil Singh 135711949a2cSSushil Singh Redfish Delete Session ${session_info1}[0] 1358