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 13d03f2ce1SSushil SinghSuite Teardown Redfish.Logout 14d03f2ce1SSushil SinghTest Setup Printn 15d03f2ce1SSushil SinghTest Teardown FFDC On Test Case Fail 16bc331e22SVijay 17bc331e22SVijay*** Variables *** 18bc331e22SVijay 19d03f2ce1SSushil Singh${BAD_REQUEST} Bad Request 20bc331e22SVijay 21bc331e22SVijay*** Test Cases *** 22bc331e22SVijay 23d03f2ce1SSushil SinghAcquire Read Write Lock 24bc331e22SVijay [Documentation] Acquire and release different read locks. 25d03f2ce1SSushil Singh [Tags] Acquire_Read_Write_Lock 26d03f2ce1SSushil Singh [Template] Acquire Lock On Resource 27bc331e22SVijay 28d03f2ce1SSushil Singh # client_id lock_type reboot_flag 29d03f2ce1SSushil Singh HMCID-01 ReadCase1 False 30d03f2ce1SSushil Singh HMCID-01 ReadCase2 False 31d03f2ce1SSushil Singh HMCID-01 ReadCase3 False 32d03f2ce1SSushil Singh HMCID-01 WriteCase1 False 33d03f2ce1SSushil Singh HMCID-01 WriteCase2 False 34d03f2ce1SSushil Singh HMCID-01 WriteCase3 False 35bc331e22SVijay 36bc331e22SVijay 37d03f2ce1SSushil SinghCheck Lock Persistency On BMC Reboot 38d03f2ce1SSushil Singh [Documentation] Acquire lock and check after reboot it remain same. 39d03f2ce1SSushil Singh [Tags] Check_Lock_Persistency_On_BMC_Reboot 40d03f2ce1SSushil Singh [Template] Acquire Lock On Resource 41bc331e22SVijay 42d03f2ce1SSushil Singh # client_id lock_type reboot_flag 43d03f2ce1SSushil Singh HMCID-01 ReadCase1 True 44d03f2ce1SSushil Singh HMCID-01 ReadCase2 True 45d03f2ce1SSushil Singh HMCID-01 ReadCase3 True 46d03f2ce1SSushil Singh HMCID-01 WriteCase1 True 47d03f2ce1SSushil Singh HMCID-01 WriteCase2 True 48d03f2ce1SSushil Singh HMCID-01 WriteCase3 True 49bc331e22SVijay 50bc331e22SVijay 51d03f2ce1SSushil SinghAcquire Read Lock On Read Lock 52d03f2ce1SSushil Singh [Documentation] Acquire read lock on another read lock. 53d03f2ce1SSushil Singh [Tags] Acquire_Read_Lock_On_Read_Lock 54d03f2ce1SSushil Singh [Template] Acquire Lock On Another Lock 55bc331e22SVijay 56d03f2ce1SSushil Singh # client_id 57d03f2ce1SSushil Singh HMCID-01 58bc331e22SVijay 59bc331e22SVijay 60d03f2ce1SSushil SinghFail To Acquire Lock On Another Lock 61d03f2ce1SSushil Singh [Documentation] Fail to acquire another lock. 62d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_On_Another_Lock 63d03f2ce1SSushil Singh [Template] Verify Acquire Lock Fails On Another Lock 6485610eeeSVijay 65d03f2ce1SSushil Singh # client_id lock_type 66d03f2ce1SSushil Singh HMCID-01 ReadCase2,WriteCase2 67d03f2ce1SSushil Singh HMCID-01 WriteCase2,WriteCase2 68d03f2ce1SSushil Singh HMCID-01 WriteCase2,ReadCase2 69566daaf3SGeorge Keishing 70566daaf3SGeorge Keishing 71e33c6e6aSSushil SinghAcquire Lock After Reboot 72e33c6e6aSSushil Singh [Documentation] Acquire and release read and write locks after reboot. 73e33c6e6aSSushil Singh [Tags] Acquire_Lock_After_Reboot 74e33c6e6aSSushil Singh [Template] Verify Acquire Lock After Reboot 75e33c6e6aSSushil Singh 76e33c6e6aSSushil Singh # client_id lock_type 77e33c6e6aSSushil Singh HMCID-01 ReadCase1 78e33c6e6aSSushil Singh HMCID-01 ReadCase2 79e33c6e6aSSushil Singh HMCID-01 ReadCase3 80e33c6e6aSSushil Singh HMCID-01 WriteCase1 81e33c6e6aSSushil Singh HMCID-01 WriteCase2 82e33c6e6aSSushil Singh HMCID-01 WriteCase3 83e33c6e6aSSushil Singh 84e33c6e6aSSushil Singh 85d03f2ce1SSushil SinghAcquire And Release Lock In Loop 86d03f2ce1SSushil Singh [Documentation] Acquire and release read, write locks in loop. 87d03f2ce1SSushil Singh [Tags] Acquire_And_Release_Lock_In_Loop 88d03f2ce1SSushil Singh [Template] Verify Acquire And Release Lock In Loop 89566daaf3SGeorge Keishing 90d03f2ce1SSushil Singh # client_id lock_type 91d03f2ce1SSushil Singh HMCID-01 ReadCase1 92d03f2ce1SSushil Singh HMCID-01 ReadCase2 93d03f2ce1SSushil Singh HMCID-01 ReadCase3 94d03f2ce1SSushil Singh HMCID-01 WriteCase1 95d03f2ce1SSushil Singh HMCID-01 WriteCase2 96d03f2ce1SSushil Singh HMCID-01 WriteCase3 9785610eeeSVijay 9885610eeeSVijay 99977f8f58SSushil SinghFail To Acquire Read And Write In Single Request 100977f8f58SSushil Singh [Documentation] Fail to acquire read and write lock in single request. 101977f8f58SSushil Singh [Tags] Fail_To_Acquire_Read_And_Write_In_Single_Request 102977f8f58SSushil Singh [Template] Verify Fail To Acquire Read And Write In Single Request 103977f8f58SSushil Singh 104977f8f58SSushil Singh # client_id lock_type 105977f8f58SSushil Singh HMCID-01 ReadCase1,WriteCase1 106977f8f58SSushil Singh HMCID-01 WriteCase1,ReadCase1 107977f8f58SSushil Singh 108977f8f58SSushil Singh 109d03f2ce1SSushil SinghVerify Release Of Valid Locks 110d03f2ce1SSushil Singh [Documentation] Release all valid locks. 111d03f2ce1SSushil Singh [Tags] Verify_Release_Of_Valid_Locks 112d03f2ce1SSushil Singh [Template] Acquire And Release Multiple Locks 113afdd2a1dSVijay 114d03f2ce1SSushil Singh # client_id lock_type release_lock_type 115d03f2ce1SSushil Singh HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 116d03f2ce1SSushil Singh HMCID-02 ReadCase1,ReadCase1,ReadCase1 Session 117afdd2a1dSVijay 118afdd2a1dSVijay 119d03f2ce1SSushil SinghInvalid Locks Fail To Release 120d03f2ce1SSushil Singh [Documentation] Release in-valid lock result in fail. 121d03f2ce1SSushil Singh [Tags] Invalid_Locks_Fail_To_Release 122d03f2ce1SSushil Singh [Template] Verify Invalid Locks Fail To Release 123afdd2a1dSVijay 124d03f2ce1SSushil Singh # client_id lock_type release_lock_type 125d03f2ce1SSushil Singh HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 126d03f2ce1SSushil Singh 12345 ReadCase2,ReadCase2,ReadCase2 Transaction 127d03f2ce1SSushil Singh HMCID ReadCase3,ReadCase3,ReadCase3 Transaction 128afdd2a1dSVijay 129afdd2a1dSVijay 130d03f2ce1SSushil SinghFail To Release Lock For Another Session 131d03f2ce1SSushil Singh [Documentation] Failed to release locks from another session. 132d03f2ce1SSushil Singh [Tags] Fail_To_Release_Lock_For_Another_Session 133d03f2ce1SSushil Singh [Template] Verify Fail To Release Lock For Another Session 134afdd2a1dSVijay 135d03f2ce1SSushil Singh # client_id lock_type 136d03f2ce1SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 137afdd2a1dSVijay 138afdd2a1dSVijay 139e33c6e6aSSushil SinghTest Invalid Resource ID Data Type Locking 140e33c6e6aSSushil Singh [Documentation] Failed to acquire lock for invalid resource id data type. 141e33c6e6aSSushil Singh [Tags] Test_Invalid_Resource_ID_Data_Type_Locking 142e33c6e6aSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type 143e33c6e6aSSushil Singh 144e33c6e6aSSushil Singh # client_id lock_type 145e33c6e6aSSushil Singh HMCID-01 ReadCase1 146e33c6e6aSSushil Singh HMCID-01 ReadCase2 147e33c6e6aSSushil Singh HMCID-01 ReadCase3 148e33c6e6aSSushil Singh HMCID-01 WriteCase1 149e33c6e6aSSushil Singh HMCID-01 WriteCase2 150e33c6e6aSSushil Singh HMCID-01 WriteCase3 151e33c6e6aSSushil Singh 152e33c6e6aSSushil Singh 153d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Type 154d03f2ce1SSushil Singh [Documentation] Failed to acquire read, write lock for invalid lock data passed. 155d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type 156d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 157afdd2a1dSVijay 158d03f2ce1SSushil Singh # client_id lock_type message 159d03f2ce1SSushil Singh HMCID-01 ReadCase1 ${BAD_REQUEST} 160d03f2ce1SSushil Singh HMCID-01 ReadCase2 ${BAD_REQUEST} 161d03f2ce1SSushil Singh HMCID-01 ReadCase3 ${BAD_REQUEST} 162d03f2ce1SSushil Singh HMCID-01 ReadCase4 ${BAD_REQUEST} 163d03f2ce1SSushil Singh HMCID-01 ReadCase5 ${BAD_REQUEST} 164d03f2ce1SSushil Singh HMCID-01 WriteCase1 ${BAD_REQUEST} 165d03f2ce1SSushil Singh HMCID-01 WriteCase2 ${BAD_REQUEST} 166d03f2ce1SSushil Singh HMCID-01 WriteCase3 ${BAD_REQUEST} 167d03f2ce1SSushil Singh HMCID-01 WriteCase4 ${BAD_REQUEST} 168d03f2ce1SSushil Singh HMCID-01 WriteCase5 ${BAD_REQUEST} 169afdd2a1dSVijay 170afdd2a1dSVijay 171d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Flag 172d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid lock flag passed. 173d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag 174d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 175afdd2a1dSVijay 176d03f2ce1SSushil Singh # client_id lock_type message 177d03f2ce1SSushil Singh HMCID-01 ReadCase6 ${BAD_REQUEST} 178d03f2ce1SSushil Singh HMCID-01 ReadCase7 ${BAD_REQUEST} 179d03f2ce1SSushil Singh HMCID-01 ReadCase8 ${BAD_REQUEST} 180d03f2ce1SSushil Singh HMCID-01 ReadCase9 ${BAD_REQUEST} 181d03f2ce1SSushil Singh HMCID-01 ReadCase10 ${BAD_REQUEST} 182d03f2ce1SSushil Singh HMCID-01 ReadCase11 ${BAD_REQUEST} 183d03f2ce1SSushil Singh HMCID-01 WriteCase6 ${BAD_REQUEST} 184d03f2ce1SSushil Singh HMCID-01 WriteCase7 ${BAD_REQUEST} 185d03f2ce1SSushil Singh HMCID-01 WriteCase8 ${BAD_REQUEST} 186d03f2ce1SSushil Singh HMCID-01 WriteCase9 ${BAD_REQUEST} 187d03f2ce1SSushil Singh HMCID-01 WriteCase10 ${BAD_REQUEST} 188d03f2ce1SSushil Singh HMCID-01 WriteCase11 ${BAD_REQUEST} 189afdd2a1dSVijay 190afdd2a1dSVijay 191d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Segment Flag 192d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 193d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag 194d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 195d03f2ce1SSushil Singh 196d03f2ce1SSushil Singh # client_id lock_type message 197d03f2ce1SSushil Singh HMCID-01 ReadCase12 ${BAD_REQUEST} 198d03f2ce1SSushil Singh HMCID-01 ReadCase13 ${BAD_REQUEST} 199d03f2ce1SSushil Singh HMCID-01 ReadCase14 ${BAD_REQUEST} 200d03f2ce1SSushil Singh HMCID-01 WriteCase12 ${BAD_REQUEST} 201d03f2ce1SSushil Singh HMCID-01 WriteCase13 ${BAD_REQUEST} 202d03f2ce1SSushil Singh HMCID-01 WriteCase14 ${BAD_REQUEST} 203afdd2a1dSVijay 204bace3005SSushil Singh 2053b3a7ecaSSushil SinghFail To Acquire Lock For Invalid Segment Data Type Flag 2063b3a7ecaSSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 2073b3a7ecaSSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Data_Type_Flag 2083b3a7ecaSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 2093b3a7ecaSSushil Singh 2103b3a7ecaSSushil Singh # client_id lock_type message 2113b3a7ecaSSushil Singh HMCID-01 ReadCase15 ${EMPTY} 2123b3a7ecaSSushil Singh HMCID-01 ReadCase16 ${EMPTY} 2133b3a7ecaSSushil Singh HMCID-01 ReadCase17 ${EMPTY} 2143b3a7ecaSSushil Singh HMCID-01 ReadCase18 ${EMPTY} 2153b3a7ecaSSushil Singh HMCID-01 WriteCase15 ${EMPTY} 2163b3a7ecaSSushil Singh HMCID-01 WriteCase16 ${EMPTY} 2173b3a7ecaSSushil Singh HMCID-01 WriteCase17 ${EMPTY} 2183b3a7ecaSSushil Singh HMCID-01 WriteCase18 ${EMPTY} 2193b3a7ecaSSushil Singh 2203b3a7ecaSSushil Singh 221bace3005SSushil SinghGet Empty Lock Records For Session Where No Locks Acquired 222bace3005SSushil Singh [Documentation] If session does not acquire locks then get lock should return 223bace3005SSushil Singh ... empty lock records. 224bace3005SSushil Singh [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired 225bace3005SSushil Singh [Template] Verify No Locks Records For Session With No Acquired Lock 226bace3005SSushil Singh 227bace3005SSushil Singh # client_id 228bace3005SSushil Singh HMCID-01 229bace3005SSushil Singh 230728ef9c9SSushil Singh 231f9a536caSSushil SinghGet Lock Records Empty For Invalid Session 232f9a536caSSushil Singh [Documentation] Record of lock list is empty for invalid session. 233f9a536caSSushil Singh [Tags] Get_Lock_Records_Empty_For_Invalid_Session 234f9a536caSSushil Singh [Template] Verify Empty Lock Records For Invalid Session 235f9a536caSSushil Singh 236f9a536caSSushil Singh # client_id 237f9a536caSSushil Singh HMCID-01 238f9a536caSSushil Singh 239f9a536caSSushil Singh 240728ef9c9SSushil SinghGet Lock Records For Multiple Session 241728ef9c9SSushil Singh [Documentation] Get lock records of multiple session. 242728ef9c9SSushil Singh [Tags] Get_Lock_Records_For_Multiple_Session 243728ef9c9SSushil Singh [Template] Verify Lock Records Of Multiple Session 244728ef9c9SSushil Singh 245728ef9c9SSushil Singh # client_ids lock_type 246728ef9c9SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 247728ef9c9SSushil Singh 248728ef9c9SSushil Singh 249f9a536caSSushil SinghGet Lock Records For Multiple Invalid Session 250f9a536caSSushil Singh [Documentation] Record of lock list is empty for list of invalid session. 251f9a536caSSushil Singh [Tags] Get_Lock_Records_For_Multiple_Invalid_Session 252f9a536caSSushil Singh [Template] Verify Lock Records For Multiple Invalid Session 253f9a536caSSushil Singh 254f9a536caSSushil Singh # client_id 255f9a536caSSushil Singh HMCID-01 256f9a536caSSushil Singh 257*11949a2cSSushil Singh 258*11949a2cSSushil SinghGet Lock Records For Multiple Invalid And Valid Session 259*11949a2cSSushil Singh [Documentation] Get record of lock from invalid and valid session. 260*11949a2cSSushil Singh [Tags] Get_Lock_Records_For_Multiple_Invalid_And_Valid_Session 261*11949a2cSSushil Singh [Template] Verify Lock Records For Multiple Invalid And Valid Session 262*11949a2cSSushil Singh 263*11949a2cSSushil Singh # client_id lock_type 264*11949a2cSSushil Singh HMCID-01,HMCID-02 ReadCase1 265*11949a2cSSushil Singh 266bc331e22SVijay*** Keywords *** 267bc331e22SVijay 268d03f2ce1SSushil SinghCreate Redfish Session With ClientID 269d03f2ce1SSushil Singh [Documentation] Create redifish session with client id. 270d03f2ce1SSushil Singh [Arguments] ${client_id} 27185610eeeSVijay 27285610eeeSVijay # Description of argument(s): 273d03f2ce1SSushil Singh # client_id This client id can contain string value 274d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 27585610eeeSVijay 276d03f2ce1SSushil Singh ${session_info}= Create Dictionary 277d03f2ce1SSushil Singh ${session}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}} 27885610eeeSVijay 279d03f2ce1SSushil Singh Set To Dictionary ${session_info} SessionIDs ${session['Id']} 280d03f2ce1SSushil Singh Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]} 28185610eeeSVijay 282d03f2ce1SSushil Singh [Return] ${session_info} 28385610eeeSVijay 28485610eeeSVijay 285d03f2ce1SSushil SinghRW General Dictionary 286d03f2ce1SSushil Singh [Documentation] Create dictionay of lock request. 287d03f2ce1SSushil Singh [Arguments] ${read_case} ${res_id} 288bc331e22SVijay 289bc331e22SVijay # Description of argument(s): 290d03f2ce1SSushil Singh # read_case Read or Write lock type. 291d03f2ce1SSushil Singh # res_id Resource id. 292bc331e22SVijay 293d03f2ce1SSushil Singh ${request_dict}= Create Dictionary 294566daaf3SGeorge Keishing 295d03f2ce1SSushil Singh FOR ${key} IN @{read_case.keys()} 296d03f2ce1SSushil Singh Set To Dictionary ${request_dict} LockType ${key} 297d03f2ce1SSushil Singh Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]} 298d03f2ce1SSushil Singh END 299bc331e22SVijay 300d03f2ce1SSushil Singh Set To Dictionary ${request_dict} ResourceID ${res_id} 301d03f2ce1SSushil Singh 302d03f2ce1SSushil Singh [Return] ${request_dict} 303bc331e22SVijay 304bc331e22SVijay 305d03f2ce1SSushil SinghReturn Description Of Response 306d03f2ce1SSushil Singh [Documentation] Return description of REST response. 307bc331e22SVijay [Arguments] ${resp_text} 308bc331e22SVijay 309bc331e22SVijay # Description of argument(s): 310d03f2ce1SSushil Singh # resp_text REST response body. 311bc331e22SVijay 312d03f2ce1SSushil Singh # resp_text after successful partition file upload looks like: 313d03f2ce1SSushil Singh # { 314d03f2ce1SSushil Singh # "Description": "File Created" 315d03f2ce1SSushil Singh # } 316bc331e22SVijay 317d03f2ce1SSushil Singh ${message}= Evaluate json.loads('''${resp_text}''') json 318d03f2ce1SSushil Singh 319d03f2ce1SSushil Singh [Return] ${message} 320bc331e22SVijay 321bc331e22SVijay 322a7d71f02SSushil SinghVerify Redfish Session Deleted 323a7d71f02SSushil Singh [Documentation] Verify the redfish session is deleted. 324a7d71f02SSushil Singh [Arguments] ${session_info} 325a7d71f02SSushil Singh 326a7d71f02SSushil Singh # Description of argument(s): 327a7d71f02SSushil Singh # session_info Session information are stored in dictionary. 328a7d71f02SSushil Singh 329a7d71f02SSushil Singh # ${session_info} = { 330a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 331a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 332a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 333a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 334a7d71f02SSushil Singh # } 335a7d71f02SSushil Singh 336a7d71f02SSushil Singh # SessionIDs : Session IDs 337a7d71f02SSushil Singh # ClientID : Client ID 338a7d71f02SSushil Singh # SessionToken : Session token 339a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 340a7d71f02SSushil Singh 341a7d71f02SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions 342a7d71f02SSushil Singh 343a7d71f02SSushil Singh FOR ${session} IN @{sessions['Members']} 344a7d71f02SSushil Singh Should Not Be Equal As Strings session ['/redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}'] 345a7d71f02SSushil Singh END 346a7d71f02SSushil Singh 347a7d71f02SSushil Singh 348a7d71f02SSushil SinghVerify Redfish List Of Session Deleted 349a7d71f02SSushil Singh [Documentation] Verify all the list of redfish session is deleted. 350a7d71f02SSushil Singh [Arguments] ${session_info_list} 351a7d71f02SSushil Singh 352a7d71f02SSushil Singh # Description of argument(s): 353a7d71f02SSushil Singh # session_info_list List contains individual session record are stored in dictionary. 354a7d71f02SSushil Singh 355a7d71f02SSushil Singh # ${session_info_list} = [{ 356a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 357a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 358a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 359a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 360a7d71f02SSushil Singh # }] 361a7d71f02SSushil Singh 362a7d71f02SSushil Singh # SessionIDs : Session IDs 363a7d71f02SSushil Singh # ClientID : Client ID 364a7d71f02SSushil Singh # SessionToken : Session token 365a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 366a7d71f02SSushil Singh 367a7d71f02SSushil Singh FOR ${session_record} IN @{session_info_list} 368a7d71f02SSushil Singh Verify Redfish Session Deleted ${session_record} 369a7d71f02SSushil Singh END 370a7d71f02SSushil Singh 371a7d71f02SSushil Singh 372d03f2ce1SSushil SinghRedfish Post Acquire Lock 373d03f2ce1SSushil Singh [Documentation] Acquire and release lock. 374d03f2ce1SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 375bc331e22SVijay 376bc331e22SVijay # Description of argument(s): 377d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 378d03f2ce1SSushil Singh # status_code HTTP status code. 379bc331e22SVijay 380e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Lock ${lock_type} 381e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 382d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 383d03f2ce1SSushil Singh ${resp}= Return Description Of Response ${resp.content} 384bc331e22SVijay 385d03f2ce1SSushil Singh [Return] ${resp} 386bc331e22SVijay 387bc331e22SVijay 388977f8f58SSushil SinghRedfish Post Acquire List Lock 389977f8f58SSushil Singh [Documentation] Acquire and release lock. 390977f8f58SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 391977f8f58SSushil Singh 392977f8f58SSushil Singh # Description of argument(s): 393977f8f58SSushil Singh # lock_type Read lock or Write lock. 394977f8f58SSushil Singh # status_code HTTP status code. 395977f8f58SSushil Singh 396977f8f58SSushil Singh ${lock_dict_param}= Create Data To Acquire List Of Lock ${lock_type} 397977f8f58SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 398977f8f58SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 399977f8f58SSushil Singh 400977f8f58SSushil Singh [Return] ${resp} 401977f8f58SSushil Singh 402977f8f58SSushil Singh 403d03f2ce1SSushil SinghRedfish Post Acquire Invalid Lock 404d03f2ce1SSushil Singh [Documentation] Redfish to post request to acquire in-valid lock. 405d03f2ce1SSushil Singh [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK} 406bc331e22SVijay 407bc331e22SVijay # Description of argument(s): 408d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 409d03f2ce1SSushil Singh # message Return message from URI. 410d03f2ce1SSushil Singh # status_code HTTP status code. 411bc331e22SVijay 412e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type} 413e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 414d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 4153b3a7ecaSSushil Singh Run Keyword If '${message}' != '${EMPTY}' 4163b3a7ecaSSushil Singh ... Valid Value message ['${resp.content}'] 417d03f2ce1SSushil Singh 418d03f2ce1SSushil Singh [Return] ${resp} 419bc331e22SVijay 420bc331e22SVijay 421e33c6e6aSSushil SinghRedfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 422e33c6e6aSSushil Singh [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id. 423e33c6e6aSSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 424e33c6e6aSSushil Singh 425e33c6e6aSSushil Singh # Description of argument(s): 426e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 427e33c6e6aSSushil Singh # status_code HTTP status code. 428e33c6e6aSSushil Singh 429e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type} 430e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 431e33c6e6aSSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 432e33c6e6aSSushil Singh 433e33c6e6aSSushil Singh [Return] ${resp} 434e33c6e6aSSushil Singh 435e33c6e6aSSushil Singh 436d03f2ce1SSushil SinghForm Data To Acquire Lock 437d03f2ce1SSushil Singh [Documentation] Create a dictionay for lock request. 438d03f2ce1SSushil Singh [Arguments] ${lock_type} 439d03f2ce1SSushil Singh 440d03f2ce1SSushil Singh # Description of argument(s): 441d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 442d03f2ce1SSushil Singh 443d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 444d03f2ce1SSushil Singh ${resp}= RW General Dictionary 445d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 446d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 447d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 448e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 449d03f2ce1SSushil Singh 450e33c6e6aSSushil Singh [Return] ${lock_request_dict} 451e33c6e6aSSushil Singh 452e33c6e6aSSushil Singh 453977f8f58SSushil SinghCreate Data To Acquire List Of Lock 454977f8f58SSushil Singh [Documentation] Create a dictionay for list of lock request. 455977f8f58SSushil Singh [Arguments] ${lock_type_list} 456977f8f58SSushil Singh 457977f8f58SSushil Singh # Description of argument(s): 458977f8f58SSushil Singh # lock_type Read lock or Write lock. 459977f8f58SSushil Singh 460977f8f58SSushil Singh ${temp_list}= Create List 461977f8f58SSushil Singh ${lock_res_info}= Get Lock Resource Information 462977f8f58SSushil Singh 463977f8f58SSushil Singh FOR ${lock_type} IN @{lock_type_list} 464977f8f58SSushil Singh ${resp}= RW General Dictionary 465977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 466977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 467977f8f58SSushil Singh Append To List ${temp_list} ${resp} 468977f8f58SSushil Singh END 469977f8f58SSushil Singh 470977f8f58SSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 471977f8f58SSushil Singh 472977f8f58SSushil Singh [Return] ${lock_request_dict} 473977f8f58SSushil Singh 474977f8f58SSushil Singh 475e33c6e6aSSushil SinghForm Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID 476e33c6e6aSSushil Singh [Documentation] Create a dictionay for in-valid lock request. 477e33c6e6aSSushil Singh [Arguments] ${lock_type} 478e33c6e6aSSushil Singh 479e33c6e6aSSushil Singh # Description of argument(s): 480e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 481e33c6e6aSSushil Singh 482e33c6e6aSSushil Singh ${lock_res_info}= Get Lock Resource Information 483e33c6e6aSSushil Singh ${resp}= RW General Dictionary 484e33c6e6aSSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 485e33c6e6aSSushil Singh ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]} 486e33c6e6aSSushil Singh ${temp_list}= Create List ${resp} 487e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 488e33c6e6aSSushil Singh 489e33c6e6aSSushil Singh [Return] ${lock_request_dict} 490d03f2ce1SSushil Singh 491d03f2ce1SSushil Singh 492d03f2ce1SSushil SinghForm Data To Acquire Invalid Lock 493d03f2ce1SSushil Singh [Documentation] Create a dictionay for in-valid lock request. 494d03f2ce1SSushil Singh [Arguments] ${lock_type} 495d03f2ce1SSushil Singh 496d03f2ce1SSushil Singh # Description of argument(s): 497d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 498d03f2ce1SSushil Singh 499d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 500d03f2ce1SSushil Singh ${resp}= RW General Dictionary 501d03f2ce1SSushil Singh ... ${lock_res_info["Invalid Case"]["${lock_type}"]} 502d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 503d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 504e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 505d03f2ce1SSushil Singh 506e33c6e6aSSushil Singh [Return] ${lock_request_dict} 507d03f2ce1SSushil Singh 508d03f2ce1SSushil Singh 509d03f2ce1SSushil SinghGet Locks List On Resource 510bc331e22SVijay [Documentation] Get locks list. 511d03f2ce1SSushil Singh [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK} 512bc331e22SVijay 513bc331e22SVijay # Description of argument(s): 514d03f2ce1SSushil Singh # session_info Session information in dict. 515d03f2ce1SSushil Singh # exp_status_code Expected HTTP status code. 516bc331e22SVijay 517d03f2ce1SSushil Singh ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]} 518566daaf3SGeorge Keishing ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 519566daaf3SGeorge Keishing ... data=${data} 520bc331e22SVijay ${locks}= Evaluate json.loads('''${resp.text}''') json 521bc331e22SVijay 522bc331e22SVijay [Return] ${locks["Records"]} 523bc331e22SVijay 524bc331e22SVijay 525d03f2ce1SSushil SinghVerify Lock On Resource 526d03f2ce1SSushil Singh [Documentation] Verify lock on resource. 527d03f2ce1SSushil Singh [Arguments] ${session_info} ${transaction_id} 528bc331e22SVijay 529bc331e22SVijay # Description of argument(s): 530d03f2ce1SSushil Singh # session_info Session information in dict. 531d03f2ce1SSushil Singh # transaction_id Transaction id in list stored in dict. 532bc331e22SVijay 533d03f2ce1SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']} 534d03f2ce1SSushil Singh Rprint Vars sessions 535d03f2ce1SSushil Singh ${lock_list}= Get Locks List On Resource ${session_info} 536d03f2ce1SSushil Singh ${lock_length}= Get Length ${lock_list} 537d03f2ce1SSushil Singh ${tran_id_length}= Get Length ${transaction_id} 538d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id_length} ${lock_length} 539afdd2a1dSVijay 540d03f2ce1SSushil Singh FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list} 541d03f2ce1SSushil Singh Valid Value session_info['ClientID'] ['${lock['HMCID']}'] 542d03f2ce1SSushil Singh Valid Value session_info['SessionIDs'] ['${lock['SessionID']}'] 543d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']} 544bc331e22SVijay END 545bc331e22SVijay 546bc331e22SVijay 547d03f2ce1SSushil SinghAcquire Lock On Resource 548d03f2ce1SSushil Singh [Documentation] Acquire lock on resource. 549d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False 550bc331e22SVijay 551bc331e22SVijay # Description of argument(s): 552d03f2ce1SSushil Singh # client_id This client id can contain string value 553d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 554d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 555d03f2ce1SSushil Singh # reboot_flag Flag is used to run reboot the BMC code. 556d03f2ce1SSushil Singh # (e.g. True or False). 557bc331e22SVijay 558d03f2ce1SSushil Singh ${trans_id_list}= Create List 559d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 560d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 561d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 562d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 563566daaf3SGeorge Keishing 564e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 565bc331e22SVijay 566d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'True' 567d03f2ce1SSushil Singh ... Run Keywords Redfish OBMC Reboot (off) AND 568d03f2ce1SSushil Singh ... Redfish Login AND 569e33c6e6aSSushil Singh ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND 570d03f2ce1SSushil Singh ... Verify Lock On Resource ${session_info} ${trans_id_list} AND 571d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 572bc331e22SVijay 573d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'False' 574d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 575bc331e22SVijay 576d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 577d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 578d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 579bc331e22SVijay 580bc331e22SVijay 581d03f2ce1SSushil SinghForm Data To Release Lock 582d03f2ce1SSushil Singh [Documentation] Create a dictonay to release lock. 583d03f2ce1SSushil Singh [Arguments] ${trans_id_list} 584355daac7SVijay 585355daac7SVijay # Description of argument(s): 586d03f2ce1SSushil Singh # trans_id_list 587355daac7SVijay 588d03f2ce1SSushil Singh @{tran_ids}= Create List 589355daac7SVijay 590d03f2ce1SSushil Singh FOR ${item} IN @{trans_id_list} 591d03f2ce1SSushil Singh Append To List ${tran_ids} ${item['TransactionID']} 592d03f2ce1SSushil Singh END 593d03f2ce1SSushil Singh 594d03f2ce1SSushil Singh [Return] ${tran_ids} 595d03f2ce1SSushil Singh 596d03f2ce1SSushil Singh 597d03f2ce1SSushil SinghRelease Locks On Resource 598d03f2ce1SSushil Singh [Documentation] Redfish request to release a lock. 599d03f2ce1SSushil Singh [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction ${status_code}=${HTTP_OK} 600d03f2ce1SSushil Singh 601d03f2ce1SSushil Singh # Description of argument(s): 602d03f2ce1SSushil Singh # session_info Session information in dict. 603d03f2ce1SSushil Singh # trans_id_list Transaction id list. 604d03f2ce1SSushil Singh # release_lock_type Release lock by Transaction, Session. 605d03f2ce1SSushil Singh # status_code HTTP status code. 606d03f2ce1SSushil Singh 607d03f2ce1SSushil Singh ${tran_ids}= Form Data To Release Lock ${trans_id_list} 608d03f2ce1SSushil Singh ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}} 609d03f2ce1SSushil Singh ${data}= Evaluate json.dumps(${data}) json 610d03f2ce1SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data} 611d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 612d03f2ce1SSushil Singh 613d03f2ce1SSushil Singh 614d03f2ce1SSushil SinghAcquire Lock On Another Lock 615d03f2ce1SSushil Singh [Documentation] Acquire lock on another lock. 616d03f2ce1SSushil Singh [Arguments] ${client_id} 617d03f2ce1SSushil Singh 618d03f2ce1SSushil Singh # Description of argument(s): 619d03f2ce1SSushil Singh # client_id This client id can contain string value 620d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 621d03f2ce1SSushil Singh 622d03f2ce1SSushil Singh ${trans_id_list}= Create List 623d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 624d03f2ce1SSushil Singh 625d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 626d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 627d03f2ce1SSushil Singh 628d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 629d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 630d03f2ce1SSushil Singh 631d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 632d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} 633d03f2ce1SSushil Singh 634d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 635d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 636d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 637d03f2ce1SSushil Singh 638d03f2ce1SSushil Singh 639977f8f58SSushil SinghVerify Fail To Acquire Read And Write In Single Request 640977f8f58SSushil Singh [Documentation] Verify fail to acquire read and write lock passed in single request. 641977f8f58SSushil Singh [Arguments] ${client_id} ${lock_type} 642977f8f58SSushil Singh 643977f8f58SSushil Singh # Description of argument(s): 644977f8f58SSushil Singh # client_id This client id can contain string value 645977f8f58SSushil Singh # (e.g. 12345, "HMCID"). 646977f8f58SSushil Singh # lock_type Read lock or Write lock. 647977f8f58SSushil Singh 648977f8f58SSushil Singh ${lock_type_list}= Split String ${lock_type} , 649977f8f58SSushil Singh 650977f8f58SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 651977f8f58SSushil Singh ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list} status_code=${HTTP_BAD_REQUEST} 652977f8f58SSushil Singh Redfish Delete Session ${session_info} 653977f8f58SSushil Singh 654977f8f58SSushil Singh 655d03f2ce1SSushil SinghVerify Empty Lock Records For Invalid Session 656d03f2ce1SSushil Singh [Documentation] Verify no lock record found for invalid session. 657d03f2ce1SSushil Singh [Arguments] ${client_id} 658d03f2ce1SSushil Singh 659d03f2ce1SSushil Singh # Description of argument(s): 660d03f2ce1SSushil Singh # client_id This client id can contain string value 661d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 662d03f2ce1SSushil Singh 663d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_id} 664d03f2ce1SSushil Singh 665d03f2ce1SSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 666d03f2ce1SSushil Singh ${lock_length1}= Get Length ${lock_list1} 667d03f2ce1SSushil Singh 668d03f2ce1SSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 669d03f2ce1SSushil Singh set to dictionary ${session_info2} SessionIDs xxyXyyYZZz 670d03f2ce1SSushil Singh 671d03f2ce1SSushil Singh ${lock_list2}= Get Locks List On Resource ${session_info2} 672f9a536caSSushil Singh ${lock_length2}= Get Length ${lock_list2} 673d03f2ce1SSushil Singh 674f9a536caSSushil Singh Should Be Equal As Integers ${lock_length1} ${lock_length2} 675d03f2ce1SSushil Singh 676d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 677d03f2ce1SSushil Singh 678d03f2ce1SSushil Singh 679d03f2ce1SSushil SinghVerify Acquire Lock Fails On Another Lock 680d03f2ce1SSushil Singh [Documentation] Verify acquire lock on another lock fails. 681d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 682d03f2ce1SSushil Singh 683d03f2ce1SSushil Singh # Description of argument(s): 684d03f2ce1SSushil Singh # client_id This client id can contain string value 685d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 686d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 687d03f2ce1SSushil Singh 688d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 689d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 690d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 691d03f2ce1SSushil Singh 692d03f2ce1SSushil Singh ${trans_id_list}= Create List 693d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 694d03f2ce1SSushil Singh 695d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 696d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 697d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} 698d03f2ce1SSushil Singh 699d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 700d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 701d03f2ce1SSushil Singh 702d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 703d03f2ce1SSushil Singh 704d03f2ce1SSushil Singh 705e33c6e6aSSushil SinghVerify Acquire Lock After Reboot 706e33c6e6aSSushil Singh [Documentation] Acquire read and write lock after the reboot and release lock. 707e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 708e33c6e6aSSushil Singh 709e33c6e6aSSushil Singh # Description of argument(s): 710e33c6e6aSSushil Singh # client_id This client id can contain string value 711e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 712e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 713e33c6e6aSSushil Singh 714e33c6e6aSSushil Singh ${trans_id_list}= Create List 715f9a536caSSushil Singh ${session_info}= Create Session With ClientID ${client_id} 716e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 717e33c6e6aSSushil Singh Redfish OBMC Reboot (off) 718e33c6e6aSSushil Singh Redfish Login 719e33c6e6aSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} 720e33c6e6aSSushil Singh 721e33c6e6aSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 722e33c6e6aSSushil Singh Append To List ${trans_id_list} ${trans_id} 723e33c6e6aSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 724e33c6e6aSSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 725e33c6e6aSSushil Singh 726e33c6e6aSSushil Singh ${trans_id_emptylist}= Create List 727e33c6e6aSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 728e33c6e6aSSushil Singh Redfish Delete Session ${session_info} 729e33c6e6aSSushil Singh 730e33c6e6aSSushil Singh 731d03f2ce1SSushil SinghVerify Acquire And Release Lock In Loop 732d03f2ce1SSushil Singh [Documentation] Acquire lock in loop. 733d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 734d03f2ce1SSushil Singh 735d03f2ce1SSushil Singh # Description of argument(s): 736d03f2ce1SSushil Singh # client_id This client id can contain string value 737d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 738d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 739d03f2ce1SSushil Singh 740d03f2ce1SSushil Singh FOR ${count} IN RANGE 1 11 741d03f2ce1SSushil Singh ${trans_id_list}= Create List 742d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 743d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 744d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 745d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 746d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 747d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 748d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 749d03f2ce1SSushil Singh END 750d03f2ce1SSushil Singh 751d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 752d03f2ce1SSushil Singh 753d03f2ce1SSushil Singh 754d03f2ce1SSushil SinghAcquire And Release Multiple Locks 755d03f2ce1SSushil Singh [Documentation] Acquire mutilple locks on resource. 756d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 757d03f2ce1SSushil Singh 758d03f2ce1SSushil Singh # Description of argument(s): 759d03f2ce1SSushil Singh # client_id This client id can contain string value 760d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 761d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 762d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 763d03f2ce1SSushil Singh 764d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 765d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 766d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 767d03f2ce1SSushil Singh 768d03f2ce1SSushil Singh ${trans_id_list}= Create List 769d03f2ce1SSushil Singh 770d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 771d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 772d03f2ce1SSushil Singh 773d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 774d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 775d03f2ce1SSushil Singh 776d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 777d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 778d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 779d03f2ce1SSushil Singh 780d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 781d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 782d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 783d03f2ce1SSushil Singh 784d03f2ce1SSushil Singh 785d03f2ce1SSushil SinghVerify Invalid Locks Fail To Release 786d03f2ce1SSushil Singh [Documentation] Verify invalid locks fails to be released. 787d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 788d03f2ce1SSushil Singh 789d03f2ce1SSushil Singh # Description of argument(s): 790d03f2ce1SSushil Singh # client_id This client id can contain string value 791d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 792d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 793d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 794d03f2ce1SSushil Singh 795d03f2ce1SSushil Singh ${trans_id_list}= Create List 796d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 797d03f2ce1SSushil Singh 798d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 799d03f2ce1SSushil Singh 800d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 801d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 802d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 803d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 804d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 805d03f2ce1SSushil Singh 806d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 807d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 808d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 809d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 810d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 811d03f2ce1SSushil Singh 812d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 813d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 814d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 815d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 816d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 817d03f2ce1SSushil Singh 818d03f2ce1SSushil Singh Release Locks On Resource 819d03f2ce1SSushil Singh ... ${session_info} ${trans_id_list} 820d03f2ce1SSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 821d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 822d03f2ce1SSushil Singh 823d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 824d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 825d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 826d03f2ce1SSushil Singh 827d03f2ce1SSushil Singh 828d03f2ce1SSushil SinghVerify Fail To Release Lock For Another Session 829d03f2ce1SSushil Singh [Documentation] Verify failed to release the lock form another session. 830d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 831d03f2ce1SSushil Singh 832d03f2ce1SSushil Singh # Description of argument(s): 833d03f2ce1SSushil Singh # client_id This client id can contain string value 834d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 835d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 836d03f2ce1SSushil Singh 837d03f2ce1SSushil Singh ${client_ids}= Split String ${client_id} , 838d03f2ce1SSushil Singh ${lock_type_list}= Split String ${lock_type} , 839d03f2ce1SSushil Singh ${trans_id_list1}= Create List 840d03f2ce1SSushil Singh ${trans_id_list2}= Create List 841d03f2ce1SSushil Singh 842d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0] 843d03f2ce1SSushil Singh 844d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 845d03f2ce1SSushil Singh Append To List ${trans_id_list1} ${trans_id} 846d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 847d03f2ce1SSushil Singh 848d03f2ce1SSushil Singh ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1] 849d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 850d03f2ce1SSushil Singh Append To List ${trans_id_list2} ${trans_id} 851d03f2ce1SSushil Singh Verify Lock On Resource ${session_info2} ${trans_id_list2} 852d03f2ce1SSushil Singh 853d03f2ce1SSushil Singh Release Locks On Resource 854d03f2ce1SSushil Singh ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_UNAUTHORIZED} 855d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 856d03f2ce1SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session 857d03f2ce1SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session 858d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 859d03f2ce1SSushil Singh Redfish Delete Session ${session_info2} 860d03f2ce1SSushil Singh 861d03f2ce1SSushil Singh 862e33c6e6aSSushil SinghVerify Fail To Acquire Lock For Invalid Resource ID Data Type 863e33c6e6aSSushil Singh [Documentation] Verify fail to acquire the lock with invalid resource id data type. 864e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 865e33c6e6aSSushil Singh 866e33c6e6aSSushil Singh # Description of argument(s): 867e33c6e6aSSushil Singh # client_id This client id can contain string value 868e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 869e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 870e33c6e6aSSushil Singh 871e33c6e6aSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 872e33c6e6aSSushil Singh Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 873e33c6e6aSSushil Singh ... ${lock_type} status_code=${HTTP_BAD_REQUEST} 874e33c6e6aSSushil Singh Redfish Delete Session ${session_info} 875e33c6e6aSSushil Singh 876e33c6e6aSSushil Singh 877d03f2ce1SSushil SinghVerify Fail To Acquire Lock For Invalid Lock Data 878e33c6e6aSSushil Singh [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segement flags. 879d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${message} 880d03f2ce1SSushil Singh 881d03f2ce1SSushil Singh # Description of argument(s): 882d03f2ce1SSushil Singh # client_id This client id can contain string value 883d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 884d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 885d03f2ce1SSushil Singh # message Return message from URI. 886d03f2ce1SSushil Singh 887d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 888d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Invalid Lock ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST} 889d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 890bace3005SSushil Singh 891bace3005SSushil Singh 892bace3005SSushil SinghVerify No Locks Records For Session With No Acquired Lock 893bace3005SSushil Singh [Documentation] Verify no records found for a session where no lock is acquired. 894bace3005SSushil Singh [Arguments] ${client_id} 895bace3005SSushil Singh 896bace3005SSushil Singh # Description of argument(s): 897bace3005SSushil Singh # client_id This client id can contain string value 898bace3005SSushil Singh # (e.g. 12345, "HMCID"). 899bace3005SSushil Singh 900bace3005SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 901bace3005SSushil Singh ${trans_id_emptylist}= Create List 902bace3005SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 903bace3005SSushil Singh Redfish Delete Session ${session_info} 904728ef9c9SSushil Singh 905728ef9c9SSushil Singh 906728ef9c9SSushil SinghCreate List Of Session ID 907728ef9c9SSushil Singh [Documentation] Create session id list from session dict info. 908728ef9c9SSushil Singh [Arguments] ${session_dict_info} 909728ef9c9SSushil Singh 910728ef9c9SSushil Singh # Description of argument(s): 911728ef9c9SSushil Singh # session_dict_info Session information in dict. 912728ef9c9SSushil Singh 913728ef9c9SSushil Singh @{session_id_list}= Create List 914728ef9c9SSushil Singh 915728ef9c9SSushil Singh FOR ${session} IN @{session_dict_info} 916728ef9c9SSushil Singh Append To List ${session_id_list} ${session["SessionIDs"]} 917728ef9c9SSushil Singh END 918728ef9c9SSushil Singh 919728ef9c9SSushil Singh ${num_id}= Get Length ${session_id_list} 920728ef9c9SSushil Singh Should Not Be Equal As Integers ${num_id} ${0} 921728ef9c9SSushil Singh 922728ef9c9SSushil Singh ${session_id_list}= Evaluate json.dumps(${session_id_list}) json 923728ef9c9SSushil Singh 924728ef9c9SSushil Singh [Return] ${session_id_list} 925728ef9c9SSushil Singh 926728ef9c9SSushil Singh 927728ef9c9SSushil SinghGet Locks List On Resource With Session List 928728ef9c9SSushil Singh [Documentation] Get locks list from session of list. 929728ef9c9SSushil Singh [Arguments] ${session_id_list} ${exp_status_code}=${HTTP_OK} 930728ef9c9SSushil Singh 931728ef9c9SSushil Singh # Description of argument(s): 932728ef9c9SSushil Singh # session_id_list Session ids list. 933728ef9c9SSushil Singh # exp_status_code Expected HTTP status code. 934728ef9c9SSushil Singh 935728ef9c9SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 936728ef9c9SSushil Singh ... data={"SessionIDs": ${session_id_list}} 937728ef9c9SSushil Singh ${locks}= Evaluate json.loads('''${resp.text}''') json 938728ef9c9SSushil Singh 939728ef9c9SSushil Singh [Return] ${locks} 940728ef9c9SSushil Singh 941728ef9c9SSushil Singh 942728ef9c9SSushil SinghVerify List Of Session Lock On Resource 943728ef9c9SSushil Singh [Documentation] Verify list of lock record from list of sessions. 944728ef9c9SSushil Singh [Arguments] ${session_dict_info} ${transaction_id_list} 945728ef9c9SSushil Singh 946728ef9c9SSushil Singh # Description of argument(s): 947728ef9c9SSushil Singh # session_dict_info Session information in dict. 948728ef9c9SSushil Singh # transaction_id_list Transaction id in list stored in dict. 949728ef9c9SSushil Singh 950728ef9c9SSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_info} 951728ef9c9SSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 952728ef9c9SSushil Singh ${lock_list}= Set Variable ${lock_list_resp['Records']} 953728ef9c9SSushil Singh 954728ef9c9SSushil Singh FOR ${session_id} ${tran_id} ${lock_record} IN ZIP ${session_dict_info} ${transaction_id_list} ${lock_list} 955728ef9c9SSushil Singh Valid Value session_id['SessionIDs'] ['${lock_record['SessionID']}'] 956728ef9c9SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock_record['TransactionID']} 957728ef9c9SSushil Singh END 958728ef9c9SSushil Singh 959728ef9c9SSushil Singh 960728ef9c9SSushil SinghVerify Lock Records Of Multiple Session 961728ef9c9SSushil Singh [Documentation] Verify all records found for a multiple sessions. 962728ef9c9SSushil Singh [Arguments] ${client_ids} ${lock_type} 963728ef9c9SSushil Singh 964728ef9c9SSushil Singh # Description of argument(s): 965728ef9c9SSushil Singh # client_ids This client id can contain string value 966728ef9c9SSushil Singh # (e.g. 12345, "HMCID"). 967728ef9c9SSushil Singh # lock_type Read lock or Write lock. 968728ef9c9SSushil Singh 969728ef9c9SSushil Singh ${client_id_list}= Split String ${client_ids} , 970728ef9c9SSushil Singh ${lock_type_list}= Split String ${lock_type} , 971728ef9c9SSushil Singh ${trans_id_list1}= Create List 972728ef9c9SSushil Singh ${trans_id_list2}= Create List 973728ef9c9SSushil Singh 974728ef9c9SSushil Singh ${session_dict_list}= Create List 975728ef9c9SSushil Singh ${lock_list}= Create List 976728ef9c9SSushil Singh 977728ef9c9SSushil Singh ${client_id1}= Create List 978728ef9c9SSushil Singh Append To List ${client_id1} ${client_id_list}[0] 979728ef9c9SSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 980728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 981728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 982728ef9c9SSushil Singh 983728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 984728ef9c9SSushil Singh Append To List ${trans_id_list1} ${trans_id} 985728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 986728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 987728ef9c9SSushil Singh 988728ef9c9SSushil Singh 989728ef9c9SSushil Singh ${client_id2}= Create List 990728ef9c9SSushil Singh Append To List ${client_id2} ${client_id_list}[1] 991728ef9c9SSushil Singh ${session_info2}= Create Session With List Of ClientID ${client_id2} 992728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 993728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id2} ${session_info2} 994728ef9c9SSushil Singh 995728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 996728ef9c9SSushil Singh Append To List ${trans_id_list2} ${trans_id} 997728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 998728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_list2} 999728ef9c9SSushil Singh 1000728ef9c9SSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 1001728ef9c9SSushil Singh 1002728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 1003728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 1004728ef9c9SSushil Singh 1005728ef9c9SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 1006728ef9c9SSushil Singh 1007728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info2}[0] SessionToken 1008728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 1009728ef9c9SSushil Singh 1010728ef9c9SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Transaction 1011728ef9c9SSushil Singh 1012728ef9c9SSushil Singh ${trans_id_emptylist}= Create List 1013728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 1014728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_emptylist} 1015728ef9c9SSushil Singh 1016728ef9c9SSushil Singh Redfish Delete List Of Session ${session_dict_list} 1017f9a536caSSushil Singh 1018f9a536caSSushil Singh 1019f9a536caSSushil SinghVerify Lock Records For Multiple Invalid Session 1020f9a536caSSushil Singh [Documentation] Verify no lock record found for multiple invalid session. 1021f9a536caSSushil Singh [Arguments] ${client_id} 1022f9a536caSSushil Singh 1023f9a536caSSushil Singh # Description of argument(s): 1024f9a536caSSushil Singh # client_id This client id can contain string value 1025f9a536caSSushil Singh # (e.g. 12345, "HMCID"). 1026f9a536caSSushil Singh 1027f9a536caSSushil Singh ${session_dict_list}= Create List 1028f9a536caSSushil Singh ${invalid_session_ids}= Create List xxyXyyYZZz xXyXYyYZzz 1029f9a536caSSushil Singh 1030f9a536caSSushil Singh ${session_info1}= Create Session With ClientID ${client_id} 1031f9a536caSSushil Singh 1032f9a536caSSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 1033f9a536caSSushil Singh set to dictionary ${session_info2} SessionIDs ${invalid_session_ids}[0] 1034f9a536caSSushil Singh Append To List ${session_dict_list} ${session_info2} 1035f9a536caSSushil Singh 1036f9a536caSSushil Singh ${session_info3}= Copy Dictionary ${session_info1} deepcopy=True 1037f9a536caSSushil Singh set to dictionary ${session_info3} SessionIDs ${invalid_session_ids}[0] 1038f9a536caSSushil Singh Append To List ${session_dict_list} ${session_info3} 1039f9a536caSSushil Singh 1040f9a536caSSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 1041f9a536caSSushil Singh ${lock_length1}= Get Length ${lock_list1} 1042f9a536caSSushil Singh 1043f9a536caSSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_list} 1044f9a536caSSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 1045f9a536caSSushil Singh ${lock_length2}= Get Length ${lock_list_resp['Records']} 1046f9a536caSSushil Singh 1047f9a536caSSushil Singh Should Be Equal As Integers ${lock_length1} ${lock_length2} 1048f9a536caSSushil Singh 1049f9a536caSSushil Singh Redfish Delete Session ${session_info1} 1050*11949a2cSSushil Singh 1051*11949a2cSSushil Singh 1052*11949a2cSSushil SinghVerify Lock Records For Multiple Invalid And Valid Session 1053*11949a2cSSushil Singh [Documentation] Verify all records found for a valid and invalid sessions. 1054*11949a2cSSushil Singh [Arguments] ${client_ids} ${lock_type} 1055*11949a2cSSushil Singh 1056*11949a2cSSushil Singh # Description of argument(s): 1057*11949a2cSSushil Singh # client_ids This client id can contain string value 1058*11949a2cSSushil Singh # (e.g. 12345, "HMCID"). 1059*11949a2cSSushil Singh # lock_type Read lock or Write lock. 1060*11949a2cSSushil Singh 1061*11949a2cSSushil Singh ${client_id_list}= Split String ${client_ids} , 1062*11949a2cSSushil Singh ${lock_type_list}= Split String ${lock_type} , 1063*11949a2cSSushil Singh ${trans_id_list1}= Create List 1064*11949a2cSSushil Singh ${invalid_session_ids}= Create List xxyXyyYZZz 1065*11949a2cSSushil Singh 1066*11949a2cSSushil Singh ${session_dict_list}= Create List 1067*11949a2cSSushil Singh ${lock_list}= Create List 1068*11949a2cSSushil Singh 1069*11949a2cSSushil Singh ${client_id1}= Create List 1070*11949a2cSSushil Singh Append To List ${client_id1} ${client_id_list}[0] 1071*11949a2cSSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 1072*11949a2cSSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 1073*11949a2cSSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 1074*11949a2cSSushil Singh 1075*11949a2cSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 1076*11949a2cSSushil Singh Append To List ${trans_id_list1} ${trans_id} 1077*11949a2cSSushil Singh Append To List ${lock_list} ${trans_id} 1078*11949a2cSSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 1079*11949a2cSSushil Singh 1080*11949a2cSSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 1081*11949a2cSSushil Singh set to dictionary ${session_info2}[0] SessionIDs ${invalid_session_ids}[0] 1082*11949a2cSSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 1083*11949a2cSSushil Singh 1084*11949a2cSSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 1085*11949a2cSSushil Singh 1086*11949a2cSSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 1087*11949a2cSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 1088*11949a2cSSushil Singh 1089*11949a2cSSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 1090*11949a2cSSushil Singh 1091*11949a2cSSushil Singh ${trans_id_emptylist}= Create List 1092*11949a2cSSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 1093*11949a2cSSushil Singh 1094*11949a2cSSushil Singh Redfish Delete Session ${session_info1}[0] 1095