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 9728ef9c9SSushil SinghLibrary ../../lib/bmc_network_utils.py 10bc331e22SVijay 1140ef0eb7SSushil SinghSuite Setup Run Keyword And Ignore Error Delete All Redfish Sessions 12d03f2ce1SSushil SinghSuite Teardown Redfish.Logout 13d03f2ce1SSushil SinghTest Setup Printn 14d03f2ce1SSushil SinghTest Teardown FFDC On Test Case Fail 15bc331e22SVijay 16bc331e22SVijay*** Variables *** 17bc331e22SVijay 18d03f2ce1SSushil Singh${BAD_REQUEST} Bad Request 19bc331e22SVijay 20bc331e22SVijay*** Test Cases *** 21bc331e22SVijay 22d03f2ce1SSushil SinghAcquire Read Write Lock 23bc331e22SVijay [Documentation] Acquire and release different read locks. 24d03f2ce1SSushil Singh [Tags] Acquire_Read_Write_Lock 25d03f2ce1SSushil Singh [Template] Acquire Lock On Resource 26bc331e22SVijay 27d03f2ce1SSushil Singh # client_id lock_type reboot_flag 28d03f2ce1SSushil Singh HMCID-01 ReadCase1 False 29d03f2ce1SSushil Singh HMCID-01 ReadCase2 False 30d03f2ce1SSushil Singh HMCID-01 ReadCase3 False 31d03f2ce1SSushil Singh HMCID-01 WriteCase1 False 32d03f2ce1SSushil Singh HMCID-01 WriteCase2 False 33d03f2ce1SSushil Singh HMCID-01 WriteCase3 False 34bc331e22SVijay 35bc331e22SVijay 36d03f2ce1SSushil SinghCheck Lock Persistency On BMC Reboot 37d03f2ce1SSushil Singh [Documentation] Acquire lock and check after reboot it remain same. 38d03f2ce1SSushil Singh [Tags] Check_Lock_Persistency_On_BMC_Reboot 39d03f2ce1SSushil Singh [Template] Acquire Lock On Resource 40bc331e22SVijay 41d03f2ce1SSushil Singh # client_id lock_type reboot_flag 42d03f2ce1SSushil Singh HMCID-01 ReadCase1 True 43d03f2ce1SSushil Singh HMCID-01 ReadCase2 True 44d03f2ce1SSushil Singh HMCID-01 ReadCase3 True 45d03f2ce1SSushil Singh HMCID-01 WriteCase1 True 46d03f2ce1SSushil Singh HMCID-01 WriteCase2 True 47d03f2ce1SSushil Singh HMCID-01 WriteCase3 True 48bc331e22SVijay 49bc331e22SVijay 50d03f2ce1SSushil SinghAcquire Read Lock On Read Lock 51d03f2ce1SSushil Singh [Documentation] Acquire read lock on another read lock. 52d03f2ce1SSushil Singh [Tags] Acquire_Read_Lock_On_Read_Lock 53d03f2ce1SSushil Singh [Template] Acquire Lock On Another Lock 54bc331e22SVijay 55d03f2ce1SSushil Singh # client_id 56d03f2ce1SSushil Singh HMCID-01 57bc331e22SVijay 58bc331e22SVijay 59d03f2ce1SSushil SinghGet Lock Records Empty For Invalid Session 60d03f2ce1SSushil Singh [Documentation] Record of lock list is empty for invalid session. 61d03f2ce1SSushil Singh [Tags] Get_Lock_Records_Empty_For_Invalid_Session 62d03f2ce1SSushil Singh [Template] Verify Empty Lock Records For Invalid Session 63355daac7SVijay 64d03f2ce1SSushil Singh # client_id 65d03f2ce1SSushil Singh HMCID-01 66355daac7SVijay 67355daac7SVijay 68d03f2ce1SSushil SinghFail To Acquire Lock On Another Lock 69d03f2ce1SSushil Singh [Documentation] Fail to acquire another lock. 70d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_On_Another_Lock 71d03f2ce1SSushil Singh [Template] Verify Acquire Lock Fails On Another Lock 7285610eeeSVijay 73d03f2ce1SSushil Singh # client_id lock_type 74d03f2ce1SSushil Singh HMCID-01 ReadCase2,WriteCase2 75d03f2ce1SSushil Singh HMCID-01 WriteCase2,WriteCase2 76d03f2ce1SSushil Singh HMCID-01 WriteCase2,ReadCase2 77566daaf3SGeorge Keishing 78566daaf3SGeorge Keishing 79e33c6e6aSSushil SinghAcquire Lock After Reboot 80e33c6e6aSSushil Singh [Documentation] Acquire and release read and write locks after reboot. 81e33c6e6aSSushil Singh [Tags] Acquire_Lock_After_Reboot 82e33c6e6aSSushil Singh [Template] Verify Acquire Lock After Reboot 83e33c6e6aSSushil Singh 84e33c6e6aSSushil Singh # client_id lock_type 85e33c6e6aSSushil Singh HMCID-01 ReadCase1 86e33c6e6aSSushil Singh HMCID-01 ReadCase2 87e33c6e6aSSushil Singh HMCID-01 ReadCase3 88e33c6e6aSSushil Singh HMCID-01 WriteCase1 89e33c6e6aSSushil Singh HMCID-01 WriteCase2 90e33c6e6aSSushil Singh HMCID-01 WriteCase3 91e33c6e6aSSushil Singh 92e33c6e6aSSushil Singh 93d03f2ce1SSushil SinghAcquire And Release Lock In Loop 94d03f2ce1SSushil Singh [Documentation] Acquire and release read, write locks in loop. 95d03f2ce1SSushil Singh [Tags] Acquire_And_Release_Lock_In_Loop 96d03f2ce1SSushil Singh [Template] Verify Acquire And Release Lock In Loop 97566daaf3SGeorge Keishing 98d03f2ce1SSushil Singh # client_id lock_type 99d03f2ce1SSushil Singh HMCID-01 ReadCase1 100d03f2ce1SSushil Singh HMCID-01 ReadCase2 101d03f2ce1SSushil Singh HMCID-01 ReadCase3 102d03f2ce1SSushil Singh HMCID-01 WriteCase1 103d03f2ce1SSushil Singh HMCID-01 WriteCase2 104d03f2ce1SSushil Singh HMCID-01 WriteCase3 10585610eeeSVijay 10685610eeeSVijay 107d03f2ce1SSushil SinghVerify Release Of Valid Locks 108d03f2ce1SSushil Singh [Documentation] Release all valid locks. 109d03f2ce1SSushil Singh [Tags] Verify_Release_Of_Valid_Locks 110d03f2ce1SSushil Singh [Template] Acquire And Release Multiple Locks 111afdd2a1dSVijay 112d03f2ce1SSushil Singh # client_id lock_type release_lock_type 113d03f2ce1SSushil Singh HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 114d03f2ce1SSushil Singh HMCID-02 ReadCase1,ReadCase1,ReadCase1 Session 115afdd2a1dSVijay 116afdd2a1dSVijay 117d03f2ce1SSushil SinghInvalid Locks Fail To Release 118d03f2ce1SSushil Singh [Documentation] Release in-valid lock result in fail. 119d03f2ce1SSushil Singh [Tags] Invalid_Locks_Fail_To_Release 120d03f2ce1SSushil Singh [Template] Verify Invalid Locks Fail To Release 121afdd2a1dSVijay 122d03f2ce1SSushil Singh # client_id lock_type release_lock_type 123d03f2ce1SSushil Singh HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 124d03f2ce1SSushil Singh 12345 ReadCase2,ReadCase2,ReadCase2 Transaction 125d03f2ce1SSushil Singh HMCID ReadCase3,ReadCase3,ReadCase3 Transaction 126afdd2a1dSVijay 127afdd2a1dSVijay 128d03f2ce1SSushil SinghFail To Release Lock For Another Session 129d03f2ce1SSushil Singh [Documentation] Failed to release locks from another session. 130d03f2ce1SSushil Singh [Tags] Fail_To_Release_Lock_For_Another_Session 131d03f2ce1SSushil Singh [Template] Verify Fail To Release Lock For Another Session 132afdd2a1dSVijay 133d03f2ce1SSushil Singh # client_id lock_type 134d03f2ce1SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 135afdd2a1dSVijay 136afdd2a1dSVijay 137e33c6e6aSSushil SinghTest Invalid Resource ID Data Type Locking 138e33c6e6aSSushil Singh [Documentation] Failed to acquire lock for invalid resource id data type. 139e33c6e6aSSushil Singh [Tags] Test_Invalid_Resource_ID_Data_Type_Locking 140e33c6e6aSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type 141e33c6e6aSSushil Singh 142e33c6e6aSSushil Singh # client_id lock_type 143e33c6e6aSSushil Singh HMCID-01 ReadCase1 144e33c6e6aSSushil Singh HMCID-01 ReadCase2 145e33c6e6aSSushil Singh HMCID-01 ReadCase3 146e33c6e6aSSushil Singh HMCID-01 WriteCase1 147e33c6e6aSSushil Singh HMCID-01 WriteCase2 148e33c6e6aSSushil Singh HMCID-01 WriteCase3 149e33c6e6aSSushil Singh 150e33c6e6aSSushil Singh 151d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Type 152d03f2ce1SSushil Singh [Documentation] Failed to acquire read, write lock for invalid lock data passed. 153d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type 154d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 155afdd2a1dSVijay 156d03f2ce1SSushil Singh # client_id lock_type message 157d03f2ce1SSushil Singh HMCID-01 ReadCase1 ${BAD_REQUEST} 158d03f2ce1SSushil Singh HMCID-01 ReadCase2 ${BAD_REQUEST} 159d03f2ce1SSushil Singh HMCID-01 ReadCase3 ${BAD_REQUEST} 160d03f2ce1SSushil Singh HMCID-01 ReadCase4 ${BAD_REQUEST} 161d03f2ce1SSushil Singh HMCID-01 ReadCase5 ${BAD_REQUEST} 162d03f2ce1SSushil Singh HMCID-01 WriteCase1 ${BAD_REQUEST} 163d03f2ce1SSushil Singh HMCID-01 WriteCase2 ${BAD_REQUEST} 164d03f2ce1SSushil Singh HMCID-01 WriteCase3 ${BAD_REQUEST} 165d03f2ce1SSushil Singh HMCID-01 WriteCase4 ${BAD_REQUEST} 166d03f2ce1SSushil Singh HMCID-01 WriteCase5 ${BAD_REQUEST} 167afdd2a1dSVijay 168afdd2a1dSVijay 169d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Flag 170d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid lock flag passed. 171d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag 172d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 173afdd2a1dSVijay 174d03f2ce1SSushil Singh # client_id lock_type message 175d03f2ce1SSushil Singh HMCID-01 ReadCase6 ${BAD_REQUEST} 176d03f2ce1SSushil Singh HMCID-01 ReadCase7 ${BAD_REQUEST} 177d03f2ce1SSushil Singh HMCID-01 ReadCase8 ${BAD_REQUEST} 178d03f2ce1SSushil Singh HMCID-01 ReadCase9 ${BAD_REQUEST} 179d03f2ce1SSushil Singh HMCID-01 ReadCase10 ${BAD_REQUEST} 180d03f2ce1SSushil Singh HMCID-01 ReadCase11 ${BAD_REQUEST} 181d03f2ce1SSushil Singh HMCID-01 WriteCase6 ${BAD_REQUEST} 182d03f2ce1SSushil Singh HMCID-01 WriteCase7 ${BAD_REQUEST} 183d03f2ce1SSushil Singh HMCID-01 WriteCase8 ${BAD_REQUEST} 184d03f2ce1SSushil Singh HMCID-01 WriteCase9 ${BAD_REQUEST} 185d03f2ce1SSushil Singh HMCID-01 WriteCase10 ${BAD_REQUEST} 186d03f2ce1SSushil Singh HMCID-01 WriteCase11 ${BAD_REQUEST} 187afdd2a1dSVijay 188afdd2a1dSVijay 189d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Segment Flag 190d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 191d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag 192d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 193d03f2ce1SSushil Singh 194d03f2ce1SSushil Singh # client_id lock_type message 195d03f2ce1SSushil Singh HMCID-01 ReadCase12 ${BAD_REQUEST} 196d03f2ce1SSushil Singh HMCID-01 ReadCase13 ${BAD_REQUEST} 197d03f2ce1SSushil Singh HMCID-01 ReadCase14 ${BAD_REQUEST} 198d03f2ce1SSushil Singh HMCID-01 WriteCase12 ${BAD_REQUEST} 199d03f2ce1SSushil Singh HMCID-01 WriteCase13 ${BAD_REQUEST} 200d03f2ce1SSushil Singh HMCID-01 WriteCase14 ${BAD_REQUEST} 201afdd2a1dSVijay 202bace3005SSushil Singh 203bace3005SSushil SinghGet Empty Lock Records For Session Where No Locks Acquired 204bace3005SSushil Singh [Documentation] If session does not acquire locks then get lock should return 205bace3005SSushil Singh ... empty lock records. 206bace3005SSushil Singh [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired 207bace3005SSushil Singh [Template] Verify No Locks Records For Session With No Acquired Lock 208bace3005SSushil Singh 209bace3005SSushil Singh # client_id 210bace3005SSushil Singh HMCID-01 211bace3005SSushil Singh 212728ef9c9SSushil Singh 213728ef9c9SSushil SinghGet Lock Records For Multiple Session 214728ef9c9SSushil Singh [Documentation] Get lock records of multiple session. 215728ef9c9SSushil Singh [Tags] Get_Lock_Records_For_Multiple_Session 216728ef9c9SSushil Singh [Template] Verify Lock Records Of Multiple Session 217728ef9c9SSushil Singh 218728ef9c9SSushil Singh # client_ids lock_type 219728ef9c9SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 220728ef9c9SSushil Singh 221728ef9c9SSushil Singh 222bc331e22SVijay*** Keywords *** 223bc331e22SVijay 224d03f2ce1SSushil SinghCreate Redfish Session With ClientID 225d03f2ce1SSushil Singh [Documentation] Create redifish session with client id. 226d03f2ce1SSushil Singh [Arguments] ${client_id} 22785610eeeSVijay 22885610eeeSVijay # Description of argument(s): 229d03f2ce1SSushil Singh # client_id This client id can contain string value 230d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 23185610eeeSVijay 232d03f2ce1SSushil Singh ${session_info}= Create Dictionary 233d03f2ce1SSushil Singh ${session}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}} 23485610eeeSVijay 235d03f2ce1SSushil Singh Set To Dictionary ${session_info} SessionIDs ${session['Id']} 236d03f2ce1SSushil Singh Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]} 23785610eeeSVijay 238d03f2ce1SSushil Singh [Return] ${session_info} 23985610eeeSVijay 24085610eeeSVijay 241d03f2ce1SSushil SinghRW General Dictionary 242d03f2ce1SSushil Singh [Documentation] Create dictionay of lock request. 243d03f2ce1SSushil Singh [Arguments] ${read_case} ${res_id} 244bc331e22SVijay 245bc331e22SVijay # Description of argument(s): 246d03f2ce1SSushil Singh # read_case Read or Write lock type. 247d03f2ce1SSushil Singh # res_id Resource id. 248bc331e22SVijay 249d03f2ce1SSushil Singh ${request_dict}= Create Dictionary 250566daaf3SGeorge Keishing 251d03f2ce1SSushil Singh FOR ${key} IN @{read_case.keys()} 252d03f2ce1SSushil Singh Set To Dictionary ${request_dict} LockType ${key} 253d03f2ce1SSushil Singh Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]} 254d03f2ce1SSushil Singh END 255bc331e22SVijay 256d03f2ce1SSushil Singh Set To Dictionary ${request_dict} ResourceID ${res_id} 257d03f2ce1SSushil Singh 258d03f2ce1SSushil Singh [Return] ${request_dict} 259bc331e22SVijay 260bc331e22SVijay 261d03f2ce1SSushil SinghReturn Description Of Response 262d03f2ce1SSushil Singh [Documentation] Return description of REST response. 263bc331e22SVijay [Arguments] ${resp_text} 264bc331e22SVijay 265bc331e22SVijay # Description of argument(s): 266d03f2ce1SSushil Singh # resp_text REST response body. 267bc331e22SVijay 268d03f2ce1SSushil Singh # resp_text after successful partition file upload looks like: 269d03f2ce1SSushil Singh # { 270d03f2ce1SSushil Singh # "Description": "File Created" 271d03f2ce1SSushil Singh # } 272bc331e22SVijay 273d03f2ce1SSushil Singh ${message}= Evaluate json.loads('''${resp_text}''') json 274d03f2ce1SSushil Singh 275d03f2ce1SSushil Singh [Return] ${message} 276bc331e22SVijay 277bc331e22SVijay 278*a7d71f02SSushil SinghVerify Redfish Session Deleted 279*a7d71f02SSushil Singh [Documentation] Verify the redfish session is deleted. 280*a7d71f02SSushil Singh [Arguments] ${session_info} 281*a7d71f02SSushil Singh 282*a7d71f02SSushil Singh # Description of argument(s): 283*a7d71f02SSushil Singh # session_info Session information are stored in dictionary. 284*a7d71f02SSushil Singh 285*a7d71f02SSushil Singh # ${session_info} = { 286*a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 287*a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 288*a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 289*a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 290*a7d71f02SSushil Singh # } 291*a7d71f02SSushil Singh 292*a7d71f02SSushil Singh # SessionIDs : Session IDs 293*a7d71f02SSushil Singh # ClientID : Client ID 294*a7d71f02SSushil Singh # SessionToken : Session token 295*a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 296*a7d71f02SSushil Singh 297*a7d71f02SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions 298*a7d71f02SSushil Singh 299*a7d71f02SSushil Singh FOR ${session} IN @{sessions['Members']} 300*a7d71f02SSushil Singh Should Not Be Equal As Strings session ['/redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}'] 301*a7d71f02SSushil Singh END 302*a7d71f02SSushil Singh 303*a7d71f02SSushil Singh 304*a7d71f02SSushil SinghVerify Redfish List Of Session Deleted 305*a7d71f02SSushil Singh [Documentation] Verify all the list of redfish session is deleted. 306*a7d71f02SSushil Singh [Arguments] ${session_info_list} 307*a7d71f02SSushil Singh 308*a7d71f02SSushil Singh # Description of argument(s): 309*a7d71f02SSushil Singh # session_info_list List contains individual session record are stored in dictionary. 310*a7d71f02SSushil Singh 311*a7d71f02SSushil Singh # ${session_info_list} = [{ 312*a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 313*a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 314*a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 315*a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 316*a7d71f02SSushil Singh # }] 317*a7d71f02SSushil Singh 318*a7d71f02SSushil Singh # SessionIDs : Session IDs 319*a7d71f02SSushil Singh # ClientID : Client ID 320*a7d71f02SSushil Singh # SessionToken : Session token 321*a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 322*a7d71f02SSushil Singh 323*a7d71f02SSushil Singh FOR ${session_record} IN @{session_info_list} 324*a7d71f02SSushil Singh Verify Redfish Session Deleted ${session_record} 325*a7d71f02SSushil Singh END 326*a7d71f02SSushil Singh 327*a7d71f02SSushil Singh 328d03f2ce1SSushil SinghRedfish Post Acquire Lock 329d03f2ce1SSushil Singh [Documentation] Acquire and release lock. 330d03f2ce1SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 331bc331e22SVijay 332bc331e22SVijay # Description of argument(s): 333d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 334d03f2ce1SSushil Singh # status_code HTTP status code. 335bc331e22SVijay 336e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Lock ${lock_type} 337e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 338d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 339d03f2ce1SSushil Singh ${resp}= Return Description Of Response ${resp.content} 340bc331e22SVijay 341d03f2ce1SSushil Singh [Return] ${resp} 342bc331e22SVijay 343bc331e22SVijay 344d03f2ce1SSushil SinghRedfish Post Acquire Invalid Lock 345d03f2ce1SSushil Singh [Documentation] Redfish to post request to acquire in-valid lock. 346d03f2ce1SSushil Singh [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK} 347bc331e22SVijay 348bc331e22SVijay # Description of argument(s): 349d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 350d03f2ce1SSushil Singh # message Return message from URI. 351d03f2ce1SSushil Singh # status_code HTTP status code. 352bc331e22SVijay 353e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type} 354e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 355d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 356d03f2ce1SSushil Singh Valid Value message ['${resp.content}'] 357d03f2ce1SSushil Singh 358d03f2ce1SSushil Singh [Return] ${resp} 359bc331e22SVijay 360bc331e22SVijay 361e33c6e6aSSushil SinghRedfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 362e33c6e6aSSushil Singh [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id. 363e33c6e6aSSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 364e33c6e6aSSushil Singh 365e33c6e6aSSushil Singh # Description of argument(s): 366e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 367e33c6e6aSSushil Singh # status_code HTTP status code. 368e33c6e6aSSushil Singh 369e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type} 370e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 371e33c6e6aSSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 372e33c6e6aSSushil Singh 373e33c6e6aSSushil Singh [Return] ${resp} 374e33c6e6aSSushil Singh 375e33c6e6aSSushil Singh 376d03f2ce1SSushil SinghForm Data To Acquire Lock 377d03f2ce1SSushil Singh [Documentation] Create a dictionay for lock request. 378d03f2ce1SSushil Singh [Arguments] ${lock_type} 379d03f2ce1SSushil Singh 380d03f2ce1SSushil Singh # Description of argument(s): 381d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 382d03f2ce1SSushil Singh 383d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 384d03f2ce1SSushil Singh ${resp}= RW General Dictionary 385d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 386d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 387d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 388e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 389d03f2ce1SSushil Singh 390e33c6e6aSSushil Singh [Return] ${lock_request_dict} 391e33c6e6aSSushil Singh 392e33c6e6aSSushil Singh 393e33c6e6aSSushil SinghForm Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID 394e33c6e6aSSushil Singh [Documentation] Create a dictionay for in-valid lock request. 395e33c6e6aSSushil Singh [Arguments] ${lock_type} 396e33c6e6aSSushil Singh 397e33c6e6aSSushil Singh # Description of argument(s): 398e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 399e33c6e6aSSushil Singh 400e33c6e6aSSushil Singh ${lock_res_info}= Get Lock Resource Information 401e33c6e6aSSushil Singh ${resp}= RW General Dictionary 402e33c6e6aSSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 403e33c6e6aSSushil Singh ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]} 404e33c6e6aSSushil Singh ${temp_list}= Create List ${resp} 405e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 406e33c6e6aSSushil Singh 407e33c6e6aSSushil Singh [Return] ${lock_request_dict} 408d03f2ce1SSushil Singh 409d03f2ce1SSushil Singh 410d03f2ce1SSushil SinghForm Data To Acquire Invalid Lock 411d03f2ce1SSushil Singh [Documentation] Create a dictionay for in-valid lock request. 412d03f2ce1SSushil Singh [Arguments] ${lock_type} 413d03f2ce1SSushil Singh 414d03f2ce1SSushil Singh # Description of argument(s): 415d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 416d03f2ce1SSushil Singh 417d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 418d03f2ce1SSushil Singh ${resp}= RW General Dictionary 419d03f2ce1SSushil Singh ... ${lock_res_info["Invalid Case"]["${lock_type}"]} 420d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 421d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 422e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 423d03f2ce1SSushil Singh 424e33c6e6aSSushil Singh [Return] ${lock_request_dict} 425d03f2ce1SSushil Singh 426d03f2ce1SSushil Singh 427d03f2ce1SSushil SinghGet Locks List On Resource 428bc331e22SVijay [Documentation] Get locks list. 429d03f2ce1SSushil Singh [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK} 430bc331e22SVijay 431bc331e22SVijay # Description of argument(s): 432d03f2ce1SSushil Singh # session_info Session information in dict. 433d03f2ce1SSushil Singh # exp_status_code Expected HTTP status code. 434bc331e22SVijay 435d03f2ce1SSushil Singh ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]} 436566daaf3SGeorge Keishing ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 437566daaf3SGeorge Keishing ... data=${data} 438bc331e22SVijay ${locks}= Evaluate json.loads('''${resp.text}''') json 439bc331e22SVijay 440bc331e22SVijay [Return] ${locks["Records"]} 441bc331e22SVijay 442bc331e22SVijay 443d03f2ce1SSushil SinghVerify Lock On Resource 444d03f2ce1SSushil Singh [Documentation] Verify lock on resource. 445d03f2ce1SSushil Singh [Arguments] ${session_info} ${transaction_id} 446bc331e22SVijay 447bc331e22SVijay # Description of argument(s): 448d03f2ce1SSushil Singh # session_info Session information in dict. 449d03f2ce1SSushil Singh # transaction_id Transaction id in list stored in dict. 450bc331e22SVijay 451d03f2ce1SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']} 452d03f2ce1SSushil Singh Rprint Vars sessions 453d03f2ce1SSushil Singh ${lock_list}= Get Locks List On Resource ${session_info} 454d03f2ce1SSushil Singh ${lock_length}= Get Length ${lock_list} 455d03f2ce1SSushil Singh ${tran_id_length}= Get Length ${transaction_id} 456d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id_length} ${lock_length} 457afdd2a1dSVijay 458d03f2ce1SSushil Singh FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list} 459d03f2ce1SSushil Singh Valid Value session_info['ClientID'] ['${lock['HMCID']}'] 460d03f2ce1SSushil Singh Valid Value session_info['SessionIDs'] ['${lock['SessionID']}'] 461d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']} 462bc331e22SVijay END 463bc331e22SVijay 464bc331e22SVijay 465d03f2ce1SSushil SinghAcquire Lock On Resource 466d03f2ce1SSushil Singh [Documentation] Acquire lock on resource. 467d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False 468bc331e22SVijay 469bc331e22SVijay # Description of argument(s): 470d03f2ce1SSushil Singh # client_id This client id can contain string value 471d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 472d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 473d03f2ce1SSushil Singh # reboot_flag Flag is used to run reboot the BMC code. 474d03f2ce1SSushil Singh # (e.g. True or False). 475bc331e22SVijay 476d03f2ce1SSushil Singh ${trans_id_list}= Create List 477d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 478d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 479d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 480d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 481566daaf3SGeorge Keishing 482e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 483bc331e22SVijay 484d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'True' 485d03f2ce1SSushil Singh ... Run Keywords Redfish OBMC Reboot (off) AND 486d03f2ce1SSushil Singh ... Redfish Login AND 487e33c6e6aSSushil Singh ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND 488d03f2ce1SSushil Singh ... Verify Lock On Resource ${session_info} ${trans_id_list} AND 489d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 490bc331e22SVijay 491d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'False' 492d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 493bc331e22SVijay 494d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 495d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 496d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 497bc331e22SVijay 498bc331e22SVijay 499d03f2ce1SSushil SinghForm Data To Release Lock 500d03f2ce1SSushil Singh [Documentation] Create a dictonay to release lock. 501d03f2ce1SSushil Singh [Arguments] ${trans_id_list} 502355daac7SVijay 503355daac7SVijay # Description of argument(s): 504d03f2ce1SSushil Singh # trans_id_list 505355daac7SVijay 506d03f2ce1SSushil Singh @{tran_ids}= Create List 507355daac7SVijay 508d03f2ce1SSushil Singh FOR ${item} IN @{trans_id_list} 509d03f2ce1SSushil Singh Append To List ${tran_ids} ${item['TransactionID']} 510d03f2ce1SSushil Singh END 511d03f2ce1SSushil Singh 512d03f2ce1SSushil Singh [Return] ${tran_ids} 513d03f2ce1SSushil Singh 514d03f2ce1SSushil Singh 515d03f2ce1SSushil SinghRelease Locks On Resource 516d03f2ce1SSushil Singh [Documentation] Redfish request to release a lock. 517d03f2ce1SSushil Singh [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction ${status_code}=${HTTP_OK} 518d03f2ce1SSushil Singh 519d03f2ce1SSushil Singh # Description of argument(s): 520d03f2ce1SSushil Singh # session_info Session information in dict. 521d03f2ce1SSushil Singh # trans_id_list Transaction id list. 522d03f2ce1SSushil Singh # release_lock_type Release lock by Transaction, Session. 523d03f2ce1SSushil Singh # status_code HTTP status code. 524d03f2ce1SSushil Singh 525d03f2ce1SSushil Singh ${tran_ids}= Form Data To Release Lock ${trans_id_list} 526d03f2ce1SSushil Singh ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}} 527d03f2ce1SSushil Singh ${data}= Evaluate json.dumps(${data}) json 528d03f2ce1SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data} 529d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 530d03f2ce1SSushil Singh 531d03f2ce1SSushil Singh 532d03f2ce1SSushil SinghAcquire Lock On Another Lock 533d03f2ce1SSushil Singh [Documentation] Acquire lock on another lock. 534d03f2ce1SSushil Singh [Arguments] ${client_id} 535d03f2ce1SSushil Singh 536d03f2ce1SSushil Singh # Description of argument(s): 537d03f2ce1SSushil Singh # client_id This client id can contain string value 538d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 539d03f2ce1SSushil Singh 540d03f2ce1SSushil Singh ${trans_id_list}= Create List 541d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 542d03f2ce1SSushil Singh 543d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 544d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 545d03f2ce1SSushil Singh 546d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 547d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 548d03f2ce1SSushil Singh 549d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 550d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} 551d03f2ce1SSushil Singh 552d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 553d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 554d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 555d03f2ce1SSushil Singh 556d03f2ce1SSushil Singh 557d03f2ce1SSushil SinghVerify Empty Lock Records For Invalid Session 558d03f2ce1SSushil Singh [Documentation] Verify no lock record found for invalid session. 559d03f2ce1SSushil Singh [Arguments] ${client_id} 560d03f2ce1SSushil Singh 561d03f2ce1SSushil Singh # Description of argument(s): 562d03f2ce1SSushil Singh # client_id This client id can contain string value 563d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 564d03f2ce1SSushil Singh 565d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_id} 566d03f2ce1SSushil Singh 567d03f2ce1SSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 568d03f2ce1SSushil Singh ${lock_length1}= Get Length ${lock_list1} 569d03f2ce1SSushil Singh 570d03f2ce1SSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 571d03f2ce1SSushil Singh set to dictionary ${session_info2} SessionIDs xxyXyyYZZz 572d03f2ce1SSushil Singh 573d03f2ce1SSushil Singh ${lock_list2}= Get Locks List On Resource ${session_info2} 574d03f2ce1SSushil Singh ${lock_length2}= Get Length ${lock_list1} 575d03f2ce1SSushil Singh 576d03f2ce1SSushil Singh Valid Value lock_length1 ${lock_list2} 577d03f2ce1SSushil Singh 578d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 579d03f2ce1SSushil Singh 580d03f2ce1SSushil Singh 581d03f2ce1SSushil SinghVerify Acquire Lock Fails On Another Lock 582d03f2ce1SSushil Singh [Documentation] Verify acquire lock on another lock fails. 583d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 584d03f2ce1SSushil Singh 585d03f2ce1SSushil Singh # Description of argument(s): 586d03f2ce1SSushil Singh # client_id This client id can contain string value 587d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 588d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 589d03f2ce1SSushil Singh 590d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 591d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 592d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 593d03f2ce1SSushil Singh 594d03f2ce1SSushil Singh ${trans_id_list}= Create List 595d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 596d03f2ce1SSushil Singh 597d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 598d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 599d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} 600d03f2ce1SSushil Singh 601d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 602d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 603d03f2ce1SSushil Singh 604d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 605d03f2ce1SSushil Singh 606d03f2ce1SSushil Singh 607e33c6e6aSSushil SinghVerify Acquire Lock After Reboot 608e33c6e6aSSushil Singh [Documentation] Acquire read and write lock after the reboot and release lock. 609e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 610e33c6e6aSSushil Singh 611e33c6e6aSSushil Singh # Description of argument(s): 612e33c6e6aSSushil Singh # client_id This client id can contain string value 613e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 614e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 615e33c6e6aSSushil Singh 616e33c6e6aSSushil Singh ${trans_id_list}= Create List 617e33c6e6aSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 618e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 619e33c6e6aSSushil Singh Redfish OBMC Reboot (off) 620e33c6e6aSSushil Singh Redfish Login 621e33c6e6aSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} 622e33c6e6aSSushil Singh 623e33c6e6aSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 624e33c6e6aSSushil Singh Append To List ${trans_id_list} ${trans_id} 625e33c6e6aSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 626e33c6e6aSSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 627e33c6e6aSSushil Singh 628e33c6e6aSSushil Singh ${trans_id_emptylist}= Create List 629e33c6e6aSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 630e33c6e6aSSushil Singh Redfish Delete Session ${session_info} 631e33c6e6aSSushil Singh 632e33c6e6aSSushil Singh 633d03f2ce1SSushil SinghVerify Acquire And Release Lock In Loop 634d03f2ce1SSushil Singh [Documentation] Acquire lock in loop. 635d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 636d03f2ce1SSushil Singh 637d03f2ce1SSushil Singh # Description of argument(s): 638d03f2ce1SSushil Singh # client_id This client id can contain string value 639d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 640d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 641d03f2ce1SSushil Singh 642d03f2ce1SSushil Singh FOR ${count} IN RANGE 1 11 643d03f2ce1SSushil Singh ${trans_id_list}= Create List 644d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 645d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 646d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 647d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 648d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 649d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 650d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 651d03f2ce1SSushil Singh END 652d03f2ce1SSushil Singh 653d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 654d03f2ce1SSushil Singh 655d03f2ce1SSushil Singh 656d03f2ce1SSushil SinghAcquire And Release Multiple Locks 657d03f2ce1SSushil Singh [Documentation] Acquire mutilple locks on resource. 658d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 659d03f2ce1SSushil Singh 660d03f2ce1SSushil Singh # Description of argument(s): 661d03f2ce1SSushil Singh # client_id This client id can contain string value 662d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 663d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 664d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 665d03f2ce1SSushil Singh 666d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 667d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 668d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 669d03f2ce1SSushil Singh 670d03f2ce1SSushil Singh ${trans_id_list}= Create List 671d03f2ce1SSushil Singh 672d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 673d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 674d03f2ce1SSushil Singh 675d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 676d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 677d03f2ce1SSushil Singh 678d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 679d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 680d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 681d03f2ce1SSushil Singh 682d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 683d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 684d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 685d03f2ce1SSushil Singh 686d03f2ce1SSushil Singh 687d03f2ce1SSushil SinghVerify Invalid Locks Fail To Release 688d03f2ce1SSushil Singh [Documentation] Verify invalid locks fails to be released. 689d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 690d03f2ce1SSushil Singh 691d03f2ce1SSushil Singh # Description of argument(s): 692d03f2ce1SSushil Singh # client_id This client id can contain string value 693d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 694d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 695d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 696d03f2ce1SSushil Singh 697d03f2ce1SSushil Singh ${trans_id_list}= Create List 698d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 699d03f2ce1SSushil Singh 700d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 701d03f2ce1SSushil Singh 702d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 703d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 704d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 705d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 706d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 707d03f2ce1SSushil Singh 708d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 709d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 710d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 711d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 712d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 713d03f2ce1SSushil Singh 714d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 715d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 716d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 717d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 718d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 719d03f2ce1SSushil Singh 720d03f2ce1SSushil Singh Release Locks On Resource 721d03f2ce1SSushil Singh ... ${session_info} ${trans_id_list} 722d03f2ce1SSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 723d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 724d03f2ce1SSushil Singh 725d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 726d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 727d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 728d03f2ce1SSushil Singh 729d03f2ce1SSushil Singh 730d03f2ce1SSushil SinghVerify Fail To Release Lock For Another Session 731d03f2ce1SSushil Singh [Documentation] Verify failed to release the lock form another session. 732d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 733d03f2ce1SSushil Singh 734d03f2ce1SSushil Singh # Description of argument(s): 735d03f2ce1SSushil Singh # client_id This client id can contain string value 736d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 737d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 738d03f2ce1SSushil Singh 739d03f2ce1SSushil Singh ${client_ids}= Split String ${client_id} , 740d03f2ce1SSushil Singh ${lock_type_list}= Split String ${lock_type} , 741d03f2ce1SSushil Singh ${trans_id_list1}= Create List 742d03f2ce1SSushil Singh ${trans_id_list2}= Create List 743d03f2ce1SSushil Singh 744d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0] 745d03f2ce1SSushil Singh 746d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 747d03f2ce1SSushil Singh Append To List ${trans_id_list1} ${trans_id} 748d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 749d03f2ce1SSushil Singh 750d03f2ce1SSushil Singh ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1] 751d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 752d03f2ce1SSushil Singh Append To List ${trans_id_list2} ${trans_id} 753d03f2ce1SSushil Singh Verify Lock On Resource ${session_info2} ${trans_id_list2} 754d03f2ce1SSushil Singh 755d03f2ce1SSushil Singh Release Locks On Resource 756d03f2ce1SSushil Singh ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_UNAUTHORIZED} 757d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 758d03f2ce1SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session 759d03f2ce1SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session 760d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 761d03f2ce1SSushil Singh Redfish Delete Session ${session_info2} 762d03f2ce1SSushil Singh 763d03f2ce1SSushil Singh 764e33c6e6aSSushil SinghVerify Fail To Acquire Lock For Invalid Resource ID Data Type 765e33c6e6aSSushil Singh [Documentation] Verify fail to acquire the lock with invalid resource id data type. 766e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 767e33c6e6aSSushil Singh 768e33c6e6aSSushil Singh # Description of argument(s): 769e33c6e6aSSushil Singh # client_id This client id can contain string value 770e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 771e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 772e33c6e6aSSushil Singh 773e33c6e6aSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 774e33c6e6aSSushil Singh Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 775e33c6e6aSSushil Singh ... ${lock_type} status_code=${HTTP_BAD_REQUEST} 776e33c6e6aSSushil Singh Redfish Delete Session ${session_info} 777e33c6e6aSSushil Singh 778e33c6e6aSSushil Singh 779d03f2ce1SSushil SinghVerify Fail To Acquire Lock For Invalid Lock Data 780e33c6e6aSSushil Singh [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segement flags. 781d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${message} 782d03f2ce1SSushil Singh 783d03f2ce1SSushil Singh # Description of argument(s): 784d03f2ce1SSushil Singh # client_id This client id can contain string value 785d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 786d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 787d03f2ce1SSushil Singh # message Return message from URI. 788d03f2ce1SSushil Singh 789d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 790d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Invalid Lock ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST} 791d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 792bace3005SSushil Singh 793bace3005SSushil Singh 794bace3005SSushil SinghVerify No Locks Records For Session With No Acquired Lock 795bace3005SSushil Singh [Documentation] Verify no records found for a session where no lock is acquired. 796bace3005SSushil Singh [Arguments] ${client_id} 797bace3005SSushil Singh 798bace3005SSushil Singh # Description of argument(s): 799bace3005SSushil Singh # client_id This client id can contain string value 800bace3005SSushil Singh # (e.g. 12345, "HMCID"). 801bace3005SSushil Singh 802bace3005SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 803bace3005SSushil Singh ${trans_id_emptylist}= Create List 804bace3005SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 805bace3005SSushil Singh Redfish Delete Session ${session_info} 806728ef9c9SSushil Singh 807728ef9c9SSushil Singh 808728ef9c9SSushil SinghCreate List Of Session ID 809728ef9c9SSushil Singh [Documentation] Create session id list from session dict info. 810728ef9c9SSushil Singh [Arguments] ${session_dict_info} 811728ef9c9SSushil Singh 812728ef9c9SSushil Singh # Description of argument(s): 813728ef9c9SSushil Singh # session_dict_info Session information in dict. 814728ef9c9SSushil Singh 815728ef9c9SSushil Singh @{session_id_list}= Create List 816728ef9c9SSushil Singh 817728ef9c9SSushil Singh FOR ${session} IN @{session_dict_info} 818728ef9c9SSushil Singh Append To List ${session_id_list} ${session["SessionIDs"]} 819728ef9c9SSushil Singh END 820728ef9c9SSushil Singh 821728ef9c9SSushil Singh ${num_id}= Get Length ${session_id_list} 822728ef9c9SSushil Singh Should Not Be Equal As Integers ${num_id} ${0} 823728ef9c9SSushil Singh 824728ef9c9SSushil Singh ${session_id_list}= Evaluate json.dumps(${session_id_list}) json 825728ef9c9SSushil Singh 826728ef9c9SSushil Singh [Return] ${session_id_list} 827728ef9c9SSushil Singh 828728ef9c9SSushil Singh 829728ef9c9SSushil SinghGet Locks List On Resource With Session List 830728ef9c9SSushil Singh [Documentation] Get locks list from session of list. 831728ef9c9SSushil Singh [Arguments] ${session_id_list} ${exp_status_code}=${HTTP_OK} 832728ef9c9SSushil Singh 833728ef9c9SSushil Singh # Description of argument(s): 834728ef9c9SSushil Singh # session_id_list Session ids list. 835728ef9c9SSushil Singh # exp_status_code Expected HTTP status code. 836728ef9c9SSushil Singh 837728ef9c9SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 838728ef9c9SSushil Singh ... data={"SessionIDs": ${session_id_list}} 839728ef9c9SSushil Singh ${locks}= Evaluate json.loads('''${resp.text}''') json 840728ef9c9SSushil Singh 841728ef9c9SSushil Singh [Return] ${locks} 842728ef9c9SSushil Singh 843728ef9c9SSushil Singh 844728ef9c9SSushil SinghVerify List Of Session Lock On Resource 845728ef9c9SSushil Singh [Documentation] Verify list of lock record from list of sessions. 846728ef9c9SSushil Singh [Arguments] ${session_dict_info} ${transaction_id_list} 847728ef9c9SSushil Singh 848728ef9c9SSushil Singh # Description of argument(s): 849728ef9c9SSushil Singh # session_dict_info Session information in dict. 850728ef9c9SSushil Singh # transaction_id_list Transaction id in list stored in dict. 851728ef9c9SSushil Singh 852728ef9c9SSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_info} 853728ef9c9SSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 854728ef9c9SSushil Singh ${lock_list}= Set Variable ${lock_list_resp['Records']} 855728ef9c9SSushil Singh 856728ef9c9SSushil Singh FOR ${session_id} ${tran_id} ${lock_record} IN ZIP ${session_dict_info} ${transaction_id_list} ${lock_list} 857728ef9c9SSushil Singh Valid Value session_id['SessionIDs'] ['${lock_record['SessionID']}'] 858728ef9c9SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock_record['TransactionID']} 859728ef9c9SSushil Singh END 860728ef9c9SSushil Singh 861728ef9c9SSushil Singh 862728ef9c9SSushil SinghVerify Lock Records Of Multiple Session 863728ef9c9SSushil Singh [Documentation] Verify all records found for a multiple sessions. 864728ef9c9SSushil Singh [Arguments] ${client_ids} ${lock_type} 865728ef9c9SSushil Singh 866728ef9c9SSushil Singh # Description of argument(s): 867728ef9c9SSushil Singh # client_ids This client id can contain string value 868728ef9c9SSushil Singh # (e.g. 12345, "HMCID"). 869728ef9c9SSushil Singh # lock_type Read lock or Write lock. 870728ef9c9SSushil Singh 871728ef9c9SSushil Singh ${client_id_list}= Split String ${client_ids} , 872728ef9c9SSushil Singh ${lock_type_list}= Split String ${lock_type} , 873728ef9c9SSushil Singh ${trans_id_list1}= Create List 874728ef9c9SSushil Singh ${trans_id_list2}= Create List 875728ef9c9SSushil Singh 876728ef9c9SSushil Singh ${session_dict_list}= Create List 877728ef9c9SSushil Singh ${lock_list}= Create List 878728ef9c9SSushil Singh 879728ef9c9SSushil Singh ${client_id1}= Create List 880728ef9c9SSushil Singh Append To List ${client_id1} ${client_id_list}[0] 881728ef9c9SSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 882728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 883728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 884728ef9c9SSushil Singh 885728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 886728ef9c9SSushil Singh Append To List ${trans_id_list1} ${trans_id} 887728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 888728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 889728ef9c9SSushil Singh 890728ef9c9SSushil Singh 891728ef9c9SSushil Singh ${client_id2}= Create List 892728ef9c9SSushil Singh Append To List ${client_id2} ${client_id_list}[1] 893728ef9c9SSushil Singh ${session_info2}= Create Session With List Of ClientID ${client_id2} 894728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 895728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id2} ${session_info2} 896728ef9c9SSushil Singh 897728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 898728ef9c9SSushil Singh Append To List ${trans_id_list2} ${trans_id} 899728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 900728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_list2} 901728ef9c9SSushil Singh 902728ef9c9SSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 903728ef9c9SSushil Singh 904728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 905728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 906728ef9c9SSushil Singh 907728ef9c9SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 908728ef9c9SSushil Singh 909728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info2}[0] SessionToken 910728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 911728ef9c9SSushil Singh 912728ef9c9SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Transaction 913728ef9c9SSushil Singh 914728ef9c9SSushil Singh ${trans_id_emptylist}= Create List 915728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 916728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_emptylist} 917728ef9c9SSushil Singh 918728ef9c9SSushil Singh Redfish Delete List Of Session ${session_dict_list} 919