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 9*977f8f58SSushil 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 SinghGet Lock Records Empty For Invalid Session 61d03f2ce1SSushil Singh [Documentation] Record of lock list is empty for invalid session. 62d03f2ce1SSushil Singh [Tags] Get_Lock_Records_Empty_For_Invalid_Session 63d03f2ce1SSushil Singh [Template] Verify Empty Lock Records For Invalid Session 64355daac7SVijay 65d03f2ce1SSushil Singh # client_id 66d03f2ce1SSushil Singh HMCID-01 67355daac7SVijay 68355daac7SVijay 69d03f2ce1SSushil SinghFail To Acquire Lock On Another Lock 70d03f2ce1SSushil Singh [Documentation] Fail to acquire another lock. 71d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_On_Another_Lock 72d03f2ce1SSushil Singh [Template] Verify Acquire Lock Fails On Another Lock 7385610eeeSVijay 74d03f2ce1SSushil Singh # client_id lock_type 75d03f2ce1SSushil Singh HMCID-01 ReadCase2,WriteCase2 76d03f2ce1SSushil Singh HMCID-01 WriteCase2,WriteCase2 77d03f2ce1SSushil Singh HMCID-01 WriteCase2,ReadCase2 78566daaf3SGeorge Keishing 79566daaf3SGeorge Keishing 80e33c6e6aSSushil SinghAcquire Lock After Reboot 81e33c6e6aSSushil Singh [Documentation] Acquire and release read and write locks after reboot. 82e33c6e6aSSushil Singh [Tags] Acquire_Lock_After_Reboot 83e33c6e6aSSushil Singh [Template] Verify Acquire Lock After Reboot 84e33c6e6aSSushil Singh 85e33c6e6aSSushil Singh # client_id lock_type 86e33c6e6aSSushil Singh HMCID-01 ReadCase1 87e33c6e6aSSushil Singh HMCID-01 ReadCase2 88e33c6e6aSSushil Singh HMCID-01 ReadCase3 89e33c6e6aSSushil Singh HMCID-01 WriteCase1 90e33c6e6aSSushil Singh HMCID-01 WriteCase2 91e33c6e6aSSushil Singh HMCID-01 WriteCase3 92e33c6e6aSSushil Singh 93e33c6e6aSSushil Singh 94d03f2ce1SSushil SinghAcquire And Release Lock In Loop 95d03f2ce1SSushil Singh [Documentation] Acquire and release read, write locks in loop. 96d03f2ce1SSushil Singh [Tags] Acquire_And_Release_Lock_In_Loop 97d03f2ce1SSushil Singh [Template] Verify Acquire And Release Lock In Loop 98566daaf3SGeorge Keishing 99d03f2ce1SSushil Singh # client_id lock_type 100d03f2ce1SSushil Singh HMCID-01 ReadCase1 101d03f2ce1SSushil Singh HMCID-01 ReadCase2 102d03f2ce1SSushil Singh HMCID-01 ReadCase3 103d03f2ce1SSushil Singh HMCID-01 WriteCase1 104d03f2ce1SSushil Singh HMCID-01 WriteCase2 105d03f2ce1SSushil Singh HMCID-01 WriteCase3 10685610eeeSVijay 10785610eeeSVijay 108*977f8f58SSushil SinghFail To Acquire Read And Write In Single Request 109*977f8f58SSushil Singh [Documentation] Fail to acquire read and write lock in single request. 110*977f8f58SSushil Singh [Tags] Fail_To_Acquire_Read_And_Write_In_Single_Request 111*977f8f58SSushil Singh [Template] Verify Fail To Acquire Read And Write In Single Request 112*977f8f58SSushil Singh 113*977f8f58SSushil Singh # client_id lock_type 114*977f8f58SSushil Singh HMCID-01 ReadCase1,WriteCase1 115*977f8f58SSushil Singh HMCID-01 WriteCase1,ReadCase1 116*977f8f58SSushil Singh 117*977f8f58SSushil Singh 118d03f2ce1SSushil SinghVerify Release Of Valid Locks 119d03f2ce1SSushil Singh [Documentation] Release all valid locks. 120d03f2ce1SSushil Singh [Tags] Verify_Release_Of_Valid_Locks 121d03f2ce1SSushil Singh [Template] Acquire And Release Multiple Locks 122afdd2a1dSVijay 123d03f2ce1SSushil Singh # client_id lock_type release_lock_type 124d03f2ce1SSushil Singh HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 125d03f2ce1SSushil Singh HMCID-02 ReadCase1,ReadCase1,ReadCase1 Session 126afdd2a1dSVijay 127afdd2a1dSVijay 128d03f2ce1SSushil SinghInvalid Locks Fail To Release 129d03f2ce1SSushil Singh [Documentation] Release in-valid lock result in fail. 130d03f2ce1SSushil Singh [Tags] Invalid_Locks_Fail_To_Release 131d03f2ce1SSushil Singh [Template] Verify Invalid Locks Fail To Release 132afdd2a1dSVijay 133d03f2ce1SSushil Singh # client_id lock_type release_lock_type 134d03f2ce1SSushil Singh HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction 135d03f2ce1SSushil Singh 12345 ReadCase2,ReadCase2,ReadCase2 Transaction 136d03f2ce1SSushil Singh HMCID ReadCase3,ReadCase3,ReadCase3 Transaction 137afdd2a1dSVijay 138afdd2a1dSVijay 139d03f2ce1SSushil SinghFail To Release Lock For Another Session 140d03f2ce1SSushil Singh [Documentation] Failed to release locks from another session. 141d03f2ce1SSushil Singh [Tags] Fail_To_Release_Lock_For_Another_Session 142d03f2ce1SSushil Singh [Template] Verify Fail To Release Lock For Another Session 143afdd2a1dSVijay 144d03f2ce1SSushil Singh # client_id lock_type 145d03f2ce1SSushil Singh HMCID-01,HMCID-02 ReadCase1,ReadCase1 146afdd2a1dSVijay 147afdd2a1dSVijay 148e33c6e6aSSushil SinghTest Invalid Resource ID Data Type Locking 149e33c6e6aSSushil Singh [Documentation] Failed to acquire lock for invalid resource id data type. 150e33c6e6aSSushil Singh [Tags] Test_Invalid_Resource_ID_Data_Type_Locking 151e33c6e6aSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type 152e33c6e6aSSushil Singh 153e33c6e6aSSushil Singh # client_id lock_type 154e33c6e6aSSushil Singh HMCID-01 ReadCase1 155e33c6e6aSSushil Singh HMCID-01 ReadCase2 156e33c6e6aSSushil Singh HMCID-01 ReadCase3 157e33c6e6aSSushil Singh HMCID-01 WriteCase1 158e33c6e6aSSushil Singh HMCID-01 WriteCase2 159e33c6e6aSSushil Singh HMCID-01 WriteCase3 160e33c6e6aSSushil Singh 161e33c6e6aSSushil Singh 162d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Type 163d03f2ce1SSushil Singh [Documentation] Failed to acquire read, write lock for invalid lock data passed. 164d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type 165d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 166afdd2a1dSVijay 167d03f2ce1SSushil Singh # client_id lock_type message 168d03f2ce1SSushil Singh HMCID-01 ReadCase1 ${BAD_REQUEST} 169d03f2ce1SSushil Singh HMCID-01 ReadCase2 ${BAD_REQUEST} 170d03f2ce1SSushil Singh HMCID-01 ReadCase3 ${BAD_REQUEST} 171d03f2ce1SSushil Singh HMCID-01 ReadCase4 ${BAD_REQUEST} 172d03f2ce1SSushil Singh HMCID-01 ReadCase5 ${BAD_REQUEST} 173d03f2ce1SSushil Singh HMCID-01 WriteCase1 ${BAD_REQUEST} 174d03f2ce1SSushil Singh HMCID-01 WriteCase2 ${BAD_REQUEST} 175d03f2ce1SSushil Singh HMCID-01 WriteCase3 ${BAD_REQUEST} 176d03f2ce1SSushil Singh HMCID-01 WriteCase4 ${BAD_REQUEST} 177d03f2ce1SSushil Singh HMCID-01 WriteCase5 ${BAD_REQUEST} 178afdd2a1dSVijay 179afdd2a1dSVijay 180d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Lock Flag 181d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid lock flag passed. 182d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag 183d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 184afdd2a1dSVijay 185d03f2ce1SSushil Singh # client_id lock_type message 186d03f2ce1SSushil Singh HMCID-01 ReadCase6 ${BAD_REQUEST} 187d03f2ce1SSushil Singh HMCID-01 ReadCase7 ${BAD_REQUEST} 188d03f2ce1SSushil Singh HMCID-01 ReadCase8 ${BAD_REQUEST} 189d03f2ce1SSushil Singh HMCID-01 ReadCase9 ${BAD_REQUEST} 190d03f2ce1SSushil Singh HMCID-01 ReadCase10 ${BAD_REQUEST} 191d03f2ce1SSushil Singh HMCID-01 ReadCase11 ${BAD_REQUEST} 192d03f2ce1SSushil Singh HMCID-01 WriteCase6 ${BAD_REQUEST} 193d03f2ce1SSushil Singh HMCID-01 WriteCase7 ${BAD_REQUEST} 194d03f2ce1SSushil Singh HMCID-01 WriteCase8 ${BAD_REQUEST} 195d03f2ce1SSushil Singh HMCID-01 WriteCase9 ${BAD_REQUEST} 196d03f2ce1SSushil Singh HMCID-01 WriteCase10 ${BAD_REQUEST} 197d03f2ce1SSushil Singh HMCID-01 WriteCase11 ${BAD_REQUEST} 198afdd2a1dSVijay 199afdd2a1dSVijay 200d03f2ce1SSushil SinghFail To Acquire Lock For Invalid Segment Flag 201d03f2ce1SSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 202d03f2ce1SSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag 203d03f2ce1SSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 204d03f2ce1SSushil Singh 205d03f2ce1SSushil Singh # client_id lock_type message 206d03f2ce1SSushil Singh HMCID-01 ReadCase12 ${BAD_REQUEST} 207d03f2ce1SSushil Singh HMCID-01 ReadCase13 ${BAD_REQUEST} 208d03f2ce1SSushil Singh HMCID-01 ReadCase14 ${BAD_REQUEST} 209d03f2ce1SSushil Singh HMCID-01 WriteCase12 ${BAD_REQUEST} 210d03f2ce1SSushil Singh HMCID-01 WriteCase13 ${BAD_REQUEST} 211d03f2ce1SSushil Singh HMCID-01 WriteCase14 ${BAD_REQUEST} 212afdd2a1dSVijay 213bace3005SSushil Singh 2143b3a7ecaSSushil SinghFail To Acquire Lock For Invalid Segment Data Type Flag 2153b3a7ecaSSushil Singh [Documentation] Failed to acquire read write lock for invalid segment flag passed. 2163b3a7ecaSSushil Singh [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Data_Type_Flag 2173b3a7ecaSSushil Singh [Template] Verify Fail To Acquire Lock For Invalid Lock Data 2183b3a7ecaSSushil Singh 2193b3a7ecaSSushil Singh # client_id lock_type message 2203b3a7ecaSSushil Singh HMCID-01 ReadCase15 ${EMPTY} 2213b3a7ecaSSushil Singh HMCID-01 ReadCase16 ${EMPTY} 2223b3a7ecaSSushil Singh HMCID-01 ReadCase17 ${EMPTY} 2233b3a7ecaSSushil Singh HMCID-01 ReadCase18 ${EMPTY} 2243b3a7ecaSSushil Singh HMCID-01 WriteCase15 ${EMPTY} 2253b3a7ecaSSushil Singh HMCID-01 WriteCase16 ${EMPTY} 2263b3a7ecaSSushil Singh HMCID-01 WriteCase17 ${EMPTY} 2273b3a7ecaSSushil Singh HMCID-01 WriteCase18 ${EMPTY} 2283b3a7ecaSSushil Singh 2293b3a7ecaSSushil Singh 230bace3005SSushil SinghGet Empty Lock Records For Session Where No Locks Acquired 231bace3005SSushil Singh [Documentation] If session does not acquire locks then get lock should return 232bace3005SSushil Singh ... empty lock records. 233bace3005SSushil Singh [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired 234bace3005SSushil Singh [Template] Verify No Locks Records For Session With No Acquired Lock 235bace3005SSushil Singh 236bace3005SSushil Singh # client_id 237bace3005SSushil Singh HMCID-01 238bace3005SSushil Singh 239728ef9c9SSushil 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 249bc331e22SVijay*** Keywords *** 250bc331e22SVijay 251d03f2ce1SSushil SinghCreate Redfish Session With ClientID 252d03f2ce1SSushil Singh [Documentation] Create redifish session with client id. 253d03f2ce1SSushil Singh [Arguments] ${client_id} 25485610eeeSVijay 25585610eeeSVijay # Description of argument(s): 256d03f2ce1SSushil Singh # client_id This client id can contain string value 257d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 25885610eeeSVijay 259d03f2ce1SSushil Singh ${session_info}= Create Dictionary 260d03f2ce1SSushil Singh ${session}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}} 26185610eeeSVijay 262d03f2ce1SSushil Singh Set To Dictionary ${session_info} SessionIDs ${session['Id']} 263d03f2ce1SSushil Singh Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]} 26485610eeeSVijay 265d03f2ce1SSushil Singh [Return] ${session_info} 26685610eeeSVijay 26785610eeeSVijay 268d03f2ce1SSushil SinghRW General Dictionary 269d03f2ce1SSushil Singh [Documentation] Create dictionay of lock request. 270d03f2ce1SSushil Singh [Arguments] ${read_case} ${res_id} 271bc331e22SVijay 272bc331e22SVijay # Description of argument(s): 273d03f2ce1SSushil Singh # read_case Read or Write lock type. 274d03f2ce1SSushil Singh # res_id Resource id. 275bc331e22SVijay 276d03f2ce1SSushil Singh ${request_dict}= Create Dictionary 277566daaf3SGeorge Keishing 278d03f2ce1SSushil Singh FOR ${key} IN @{read_case.keys()} 279d03f2ce1SSushil Singh Set To Dictionary ${request_dict} LockType ${key} 280d03f2ce1SSushil Singh Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]} 281d03f2ce1SSushil Singh END 282bc331e22SVijay 283d03f2ce1SSushil Singh Set To Dictionary ${request_dict} ResourceID ${res_id} 284d03f2ce1SSushil Singh 285d03f2ce1SSushil Singh [Return] ${request_dict} 286bc331e22SVijay 287bc331e22SVijay 288d03f2ce1SSushil SinghReturn Description Of Response 289d03f2ce1SSushil Singh [Documentation] Return description of REST response. 290bc331e22SVijay [Arguments] ${resp_text} 291bc331e22SVijay 292bc331e22SVijay # Description of argument(s): 293d03f2ce1SSushil Singh # resp_text REST response body. 294bc331e22SVijay 295d03f2ce1SSushil Singh # resp_text after successful partition file upload looks like: 296d03f2ce1SSushil Singh # { 297d03f2ce1SSushil Singh # "Description": "File Created" 298d03f2ce1SSushil Singh # } 299bc331e22SVijay 300d03f2ce1SSushil Singh ${message}= Evaluate json.loads('''${resp_text}''') json 301d03f2ce1SSushil Singh 302d03f2ce1SSushil Singh [Return] ${message} 303bc331e22SVijay 304bc331e22SVijay 305a7d71f02SSushil SinghVerify Redfish Session Deleted 306a7d71f02SSushil Singh [Documentation] Verify the redfish session is deleted. 307a7d71f02SSushil Singh [Arguments] ${session_info} 308a7d71f02SSushil Singh 309a7d71f02SSushil Singh # Description of argument(s): 310a7d71f02SSushil Singh # session_info Session information are stored in dictionary. 311a7d71f02SSushil Singh 312a7d71f02SSushil Singh # ${session_info} = { 313a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 314a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 315a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 316a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 317a7d71f02SSushil Singh # } 318a7d71f02SSushil Singh 319a7d71f02SSushil Singh # SessionIDs : Session IDs 320a7d71f02SSushil Singh # ClientID : Client ID 321a7d71f02SSushil Singh # SessionToken : Session token 322a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 323a7d71f02SSushil Singh 324a7d71f02SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions 325a7d71f02SSushil Singh 326a7d71f02SSushil Singh FOR ${session} IN @{sessions['Members']} 327a7d71f02SSushil Singh Should Not Be Equal As Strings session ['/redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}'] 328a7d71f02SSushil Singh END 329a7d71f02SSushil Singh 330a7d71f02SSushil Singh 331a7d71f02SSushil SinghVerify Redfish List Of Session Deleted 332a7d71f02SSushil Singh [Documentation] Verify all the list of redfish session is deleted. 333a7d71f02SSushil Singh [Arguments] ${session_info_list} 334a7d71f02SSushil Singh 335a7d71f02SSushil Singh # Description of argument(s): 336a7d71f02SSushil Singh # session_info_list List contains individual session record are stored in dictionary. 337a7d71f02SSushil Singh 338a7d71f02SSushil Singh # ${session_info_list} = [{ 339a7d71f02SSushil Singh # 'SessionIDs': 'XXXXXXXXX', 340a7d71f02SSushil Singh # 'ClientID': 'XXXXXX', 341a7d71f02SSushil Singh # 'SessionToken': 'XXXXXXXXX', 342a7d71f02SSushil Singh # 'SessionResp': session response from redfish login 343a7d71f02SSushil Singh # }] 344a7d71f02SSushil Singh 345a7d71f02SSushil Singh # SessionIDs : Session IDs 346a7d71f02SSushil Singh # ClientID : Client ID 347a7d71f02SSushil Singh # SessionToken : Session token 348a7d71f02SSushil Singh # SessionResp : Response of creating an redfish login session 349a7d71f02SSushil Singh 350a7d71f02SSushil Singh FOR ${session_record} IN @{session_info_list} 351a7d71f02SSushil Singh Verify Redfish Session Deleted ${session_record} 352a7d71f02SSushil Singh END 353a7d71f02SSushil Singh 354a7d71f02SSushil Singh 355d03f2ce1SSushil SinghRedfish Post Acquire Lock 356d03f2ce1SSushil Singh [Documentation] Acquire and release lock. 357d03f2ce1SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 358bc331e22SVijay 359bc331e22SVijay # Description of argument(s): 360d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 361d03f2ce1SSushil Singh # status_code HTTP status code. 362bc331e22SVijay 363e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Lock ${lock_type} 364e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 365d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 366d03f2ce1SSushil Singh ${resp}= Return Description Of Response ${resp.content} 367bc331e22SVijay 368d03f2ce1SSushil Singh [Return] ${resp} 369bc331e22SVijay 370bc331e22SVijay 371*977f8f58SSushil SinghRedfish Post Acquire List Lock 372*977f8f58SSushil Singh [Documentation] Acquire and release lock. 373*977f8f58SSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 374*977f8f58SSushil Singh 375*977f8f58SSushil Singh # Description of argument(s): 376*977f8f58SSushil Singh # lock_type Read lock or Write lock. 377*977f8f58SSushil Singh # status_code HTTP status code. 378*977f8f58SSushil Singh 379*977f8f58SSushil Singh ${lock_dict_param}= Create Data To Acquire List Of Lock ${lock_type} 380*977f8f58SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 381*977f8f58SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 382*977f8f58SSushil Singh 383*977f8f58SSushil Singh [Return] ${resp} 384*977f8f58SSushil Singh 385*977f8f58SSushil Singh 386d03f2ce1SSushil SinghRedfish Post Acquire Invalid Lock 387d03f2ce1SSushil Singh [Documentation] Redfish to post request to acquire in-valid lock. 388d03f2ce1SSushil Singh [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK} 389bc331e22SVijay 390bc331e22SVijay # Description of argument(s): 391d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 392d03f2ce1SSushil Singh # message Return message from URI. 393d03f2ce1SSushil Singh # status_code HTTP status code. 394bc331e22SVijay 395e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type} 396e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 397d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 3983b3a7ecaSSushil Singh Run Keyword If '${message}' != '${EMPTY}' 3993b3a7ecaSSushil Singh ... Valid Value message ['${resp.content}'] 400d03f2ce1SSushil Singh 401d03f2ce1SSushil Singh [Return] ${resp} 402bc331e22SVijay 403bc331e22SVijay 404e33c6e6aSSushil SinghRedfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 405e33c6e6aSSushil Singh [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id. 406e33c6e6aSSushil Singh [Arguments] ${lock_type} ${status_code}=${HTTP_OK} 407e33c6e6aSSushil Singh 408e33c6e6aSSushil Singh # Description of argument(s): 409e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 410e33c6e6aSSushil Singh # status_code HTTP status code. 411e33c6e6aSSushil Singh 412e33c6e6aSSushil Singh ${lock_dict_param}= Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type} 413e33c6e6aSSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} 414e33c6e6aSSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 415e33c6e6aSSushil Singh 416e33c6e6aSSushil Singh [Return] ${resp} 417e33c6e6aSSushil Singh 418e33c6e6aSSushil Singh 419d03f2ce1SSushil SinghForm Data To Acquire Lock 420d03f2ce1SSushil Singh [Documentation] Create a dictionay for lock request. 421d03f2ce1SSushil Singh [Arguments] ${lock_type} 422d03f2ce1SSushil Singh 423d03f2ce1SSushil Singh # Description of argument(s): 424d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 425d03f2ce1SSushil Singh 426d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 427d03f2ce1SSushil Singh ${resp}= RW General Dictionary 428d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 429d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 430d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 431e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 432d03f2ce1SSushil Singh 433e33c6e6aSSushil Singh [Return] ${lock_request_dict} 434e33c6e6aSSushil Singh 435e33c6e6aSSushil Singh 436*977f8f58SSushil SinghCreate Data To Acquire List Of Lock 437*977f8f58SSushil Singh [Documentation] Create a dictionay for list of lock request. 438*977f8f58SSushil Singh [Arguments] ${lock_type_list} 439*977f8f58SSushil Singh 440*977f8f58SSushil Singh # Description of argument(s): 441*977f8f58SSushil Singh # lock_type Read lock or Write lock. 442*977f8f58SSushil Singh 443*977f8f58SSushil Singh ${temp_list}= Create List 444*977f8f58SSushil Singh ${lock_res_info}= Get Lock Resource Information 445*977f8f58SSushil Singh 446*977f8f58SSushil Singh FOR ${lock_type} IN @{lock_type_list} 447*977f8f58SSushil Singh ${resp}= RW General Dictionary 448*977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 449*977f8f58SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 450*977f8f58SSushil Singh Append To List ${temp_list} ${resp} 451*977f8f58SSushil Singh END 452*977f8f58SSushil Singh 453*977f8f58SSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 454*977f8f58SSushil Singh 455*977f8f58SSushil Singh [Return] ${lock_request_dict} 456*977f8f58SSushil Singh 457*977f8f58SSushil Singh 458e33c6e6aSSushil SinghForm Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID 459e33c6e6aSSushil Singh [Documentation] Create a dictionay for in-valid lock request. 460e33c6e6aSSushil Singh [Arguments] ${lock_type} 461e33c6e6aSSushil Singh 462e33c6e6aSSushil Singh # Description of argument(s): 463e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 464e33c6e6aSSushil Singh 465e33c6e6aSSushil Singh ${lock_res_info}= Get Lock Resource Information 466e33c6e6aSSushil Singh ${resp}= RW General Dictionary 467e33c6e6aSSushil Singh ... ${lock_res_info["Valid Case"]["${lock_type}"]} 468e33c6e6aSSushil Singh ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]} 469e33c6e6aSSushil Singh ${temp_list}= Create List ${resp} 470e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 471e33c6e6aSSushil Singh 472e33c6e6aSSushil Singh [Return] ${lock_request_dict} 473d03f2ce1SSushil Singh 474d03f2ce1SSushil Singh 475d03f2ce1SSushil SinghForm Data To Acquire Invalid Lock 476d03f2ce1SSushil Singh [Documentation] Create a dictionay for in-valid lock request. 477d03f2ce1SSushil Singh [Arguments] ${lock_type} 478d03f2ce1SSushil Singh 479d03f2ce1SSushil Singh # Description of argument(s): 480d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 481d03f2ce1SSushil Singh 482d03f2ce1SSushil Singh ${lock_res_info}= Get Lock Resource Information 483d03f2ce1SSushil Singh ${resp}= RW General Dictionary 484d03f2ce1SSushil Singh ... ${lock_res_info["Invalid Case"]["${lock_type}"]} 485d03f2ce1SSushil Singh ... ${lock_res_info["Valid Case"]["ResourceID"]} 486d03f2ce1SSushil Singh ${temp_list}= Create List ${resp} 487e33c6e6aSSushil Singh ${lock_request_dict}= Create Dictionary Request=${temp_list} 488d03f2ce1SSushil Singh 489e33c6e6aSSushil Singh [Return] ${lock_request_dict} 490d03f2ce1SSushil Singh 491d03f2ce1SSushil Singh 492d03f2ce1SSushil SinghGet Locks List On Resource 493bc331e22SVijay [Documentation] Get locks list. 494d03f2ce1SSushil Singh [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK} 495bc331e22SVijay 496bc331e22SVijay # Description of argument(s): 497d03f2ce1SSushil Singh # session_info Session information in dict. 498d03f2ce1SSushil Singh # exp_status_code Expected HTTP status code. 499bc331e22SVijay 500d03f2ce1SSushil Singh ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]} 501566daaf3SGeorge Keishing ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 502566daaf3SGeorge Keishing ... data=${data} 503bc331e22SVijay ${locks}= Evaluate json.loads('''${resp.text}''') json 504bc331e22SVijay 505bc331e22SVijay [Return] ${locks["Records"]} 506bc331e22SVijay 507bc331e22SVijay 508d03f2ce1SSushil SinghVerify Lock On Resource 509d03f2ce1SSushil Singh [Documentation] Verify lock on resource. 510d03f2ce1SSushil Singh [Arguments] ${session_info} ${transaction_id} 511bc331e22SVijay 512bc331e22SVijay # Description of argument(s): 513d03f2ce1SSushil Singh # session_info Session information in dict. 514d03f2ce1SSushil Singh # transaction_id Transaction id in list stored in dict. 515bc331e22SVijay 516d03f2ce1SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']} 517d03f2ce1SSushil Singh Rprint Vars sessions 518d03f2ce1SSushil Singh ${lock_list}= Get Locks List On Resource ${session_info} 519d03f2ce1SSushil Singh ${lock_length}= Get Length ${lock_list} 520d03f2ce1SSushil Singh ${tran_id_length}= Get Length ${transaction_id} 521d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id_length} ${lock_length} 522afdd2a1dSVijay 523d03f2ce1SSushil Singh FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list} 524d03f2ce1SSushil Singh Valid Value session_info['ClientID'] ['${lock['HMCID']}'] 525d03f2ce1SSushil Singh Valid Value session_info['SessionIDs'] ['${lock['SessionID']}'] 526d03f2ce1SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']} 527bc331e22SVijay END 528bc331e22SVijay 529bc331e22SVijay 530d03f2ce1SSushil SinghAcquire Lock On Resource 531d03f2ce1SSushil Singh [Documentation] Acquire lock on resource. 532d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False 533bc331e22SVijay 534bc331e22SVijay # Description of argument(s): 535d03f2ce1SSushil Singh # client_id This client id can contain string value 536d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 537d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 538d03f2ce1SSushil Singh # reboot_flag Flag is used to run reboot the BMC code. 539d03f2ce1SSushil Singh # (e.g. True or False). 540bc331e22SVijay 541d03f2ce1SSushil Singh ${trans_id_list}= Create List 542d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 543d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 544d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 545d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 546566daaf3SGeorge Keishing 547e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 548bc331e22SVijay 549d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'True' 550d03f2ce1SSushil Singh ... Run Keywords Redfish OBMC Reboot (off) AND 551d03f2ce1SSushil Singh ... Redfish Login AND 552e33c6e6aSSushil Singh ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND 553d03f2ce1SSushil Singh ... Verify Lock On Resource ${session_info} ${trans_id_list} AND 554d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 555bc331e22SVijay 556d03f2ce1SSushil Singh Run Keyword If '${reboot_flag}' == 'False' 557d03f2ce1SSushil Singh ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 558bc331e22SVijay 559d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 560d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 561d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 562bc331e22SVijay 563bc331e22SVijay 564d03f2ce1SSushil SinghForm Data To Release Lock 565d03f2ce1SSushil Singh [Documentation] Create a dictonay to release lock. 566d03f2ce1SSushil Singh [Arguments] ${trans_id_list} 567355daac7SVijay 568355daac7SVijay # Description of argument(s): 569d03f2ce1SSushil Singh # trans_id_list 570355daac7SVijay 571d03f2ce1SSushil Singh @{tran_ids}= Create List 572355daac7SVijay 573d03f2ce1SSushil Singh FOR ${item} IN @{trans_id_list} 574d03f2ce1SSushil Singh Append To List ${tran_ids} ${item['TransactionID']} 575d03f2ce1SSushil Singh END 576d03f2ce1SSushil Singh 577d03f2ce1SSushil Singh [Return] ${tran_ids} 578d03f2ce1SSushil Singh 579d03f2ce1SSushil Singh 580d03f2ce1SSushil SinghRelease Locks On Resource 581d03f2ce1SSushil Singh [Documentation] Redfish request to release a lock. 582d03f2ce1SSushil Singh [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction ${status_code}=${HTTP_OK} 583d03f2ce1SSushil Singh 584d03f2ce1SSushil Singh # Description of argument(s): 585d03f2ce1SSushil Singh # session_info Session information in dict. 586d03f2ce1SSushil Singh # trans_id_list Transaction id list. 587d03f2ce1SSushil Singh # release_lock_type Release lock by Transaction, Session. 588d03f2ce1SSushil Singh # status_code HTTP status code. 589d03f2ce1SSushil Singh 590d03f2ce1SSushil Singh ${tran_ids}= Form Data To Release Lock ${trans_id_list} 591d03f2ce1SSushil Singh ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}} 592d03f2ce1SSushil Singh ${data}= Evaluate json.dumps(${data}) json 593d03f2ce1SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data} 594d03f2ce1SSushil Singh Should Be Equal As Strings ${resp.status_code} ${status_code} 595d03f2ce1SSushil Singh 596d03f2ce1SSushil Singh 597d03f2ce1SSushil SinghAcquire Lock On Another Lock 598d03f2ce1SSushil Singh [Documentation] Acquire lock on another lock. 599d03f2ce1SSushil Singh [Arguments] ${client_id} 600d03f2ce1SSushil Singh 601d03f2ce1SSushil Singh # Description of argument(s): 602d03f2ce1SSushil Singh # client_id This client id can contain string value 603d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 604d03f2ce1SSushil Singh 605d03f2ce1SSushil Singh ${trans_id_list}= Create List 606d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 607d03f2ce1SSushil Singh 608d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 609d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 610d03f2ce1SSushil Singh 611d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ReadCase1 612d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 613d03f2ce1SSushil Singh 614d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 615d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} 616d03f2ce1SSushil Singh 617d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 618d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 619d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 620d03f2ce1SSushil Singh 621d03f2ce1SSushil Singh 622*977f8f58SSushil SinghVerify Fail To Acquire Read And Write In Single Request 623*977f8f58SSushil Singh [Documentation] Verify fail to acquire read and write lock passed in single request. 624*977f8f58SSushil Singh [Arguments] ${client_id} ${lock_type} 625*977f8f58SSushil Singh 626*977f8f58SSushil Singh # Description of argument(s): 627*977f8f58SSushil Singh # client_id This client id can contain string value 628*977f8f58SSushil Singh # (e.g. 12345, "HMCID"). 629*977f8f58SSushil Singh # lock_type Read lock or Write lock. 630*977f8f58SSushil Singh 631*977f8f58SSushil Singh ${lock_type_list}= Split String ${lock_type} , 632*977f8f58SSushil Singh 633*977f8f58SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 634*977f8f58SSushil Singh ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list} status_code=${HTTP_BAD_REQUEST} 635*977f8f58SSushil Singh Redfish Delete Session ${session_info} 636*977f8f58SSushil Singh 637*977f8f58SSushil Singh 638d03f2ce1SSushil SinghVerify Empty Lock Records For Invalid Session 639d03f2ce1SSushil Singh [Documentation] Verify no lock record found for invalid session. 640d03f2ce1SSushil Singh [Arguments] ${client_id} 641d03f2ce1SSushil Singh 642d03f2ce1SSushil Singh # Description of argument(s): 643d03f2ce1SSushil Singh # client_id This client id can contain string value 644d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 645d03f2ce1SSushil Singh 646d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_id} 647d03f2ce1SSushil Singh 648d03f2ce1SSushil Singh ${lock_list1}= Get Locks List On Resource ${session_info1} 649d03f2ce1SSushil Singh ${lock_length1}= Get Length ${lock_list1} 650d03f2ce1SSushil Singh 651d03f2ce1SSushil Singh ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True 652d03f2ce1SSushil Singh set to dictionary ${session_info2} SessionIDs xxyXyyYZZz 653d03f2ce1SSushil Singh 654d03f2ce1SSushil Singh ${lock_list2}= Get Locks List On Resource ${session_info2} 655d03f2ce1SSushil Singh ${lock_length2}= Get Length ${lock_list1} 656d03f2ce1SSushil Singh 657d03f2ce1SSushil Singh Valid Value lock_length1 ${lock_list2} 658d03f2ce1SSushil Singh 659d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 660d03f2ce1SSushil Singh 661d03f2ce1SSushil Singh 662d03f2ce1SSushil SinghVerify Acquire Lock Fails On Another Lock 663d03f2ce1SSushil Singh [Documentation] Verify acquire lock on another lock fails. 664d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 665d03f2ce1SSushil Singh 666d03f2ce1SSushil Singh # Description of argument(s): 667d03f2ce1SSushil Singh # client_id This client id can contain string value 668d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 669d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 670d03f2ce1SSushil Singh 671d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 672d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 673d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 674d03f2ce1SSushil Singh 675d03f2ce1SSushil Singh ${trans_id_list}= Create List 676d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 677d03f2ce1SSushil Singh 678d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 679d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} 680d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} 681d03f2ce1SSushil Singh 682d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 683d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 684d03f2ce1SSushil Singh 685d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 686d03f2ce1SSushil Singh 687d03f2ce1SSushil Singh 688e33c6e6aSSushil SinghVerify Acquire Lock After Reboot 689e33c6e6aSSushil Singh [Documentation] Acquire read and write lock after the reboot and release lock. 690e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 691e33c6e6aSSushil Singh 692e33c6e6aSSushil Singh # Description of argument(s): 693e33c6e6aSSushil Singh # client_id This client id can contain string value 694e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 695e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 696e33c6e6aSSushil Singh 697e33c6e6aSSushil Singh ${trans_id_list}= Create List 698e33c6e6aSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 699e33c6e6aSSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 700e33c6e6aSSushil Singh Redfish OBMC Reboot (off) 701e33c6e6aSSushil Singh Redfish Login 702e33c6e6aSSushil Singh Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} 703e33c6e6aSSushil Singh 704e33c6e6aSSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 705e33c6e6aSSushil Singh Append To List ${trans_id_list} ${trans_id} 706e33c6e6aSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 707e33c6e6aSSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 708e33c6e6aSSushil Singh 709e33c6e6aSSushil Singh ${trans_id_emptylist}= Create List 710e33c6e6aSSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 711e33c6e6aSSushil Singh Redfish Delete Session ${session_info} 712e33c6e6aSSushil Singh 713e33c6e6aSSushil Singh 714d03f2ce1SSushil SinghVerify Acquire And Release Lock In Loop 715d03f2ce1SSushil Singh [Documentation] Acquire lock in loop. 716d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 717d03f2ce1SSushil Singh 718d03f2ce1SSushil Singh # Description of argument(s): 719d03f2ce1SSushil Singh # client_id This client id can contain string value 720d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 721d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 722d03f2ce1SSushil Singh 723d03f2ce1SSushil Singh FOR ${count} IN RANGE 1 11 724d03f2ce1SSushil Singh ${trans_id_list}= Create List 725d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 726d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type} 727d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 728d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 729d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} 730d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 731d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 732d03f2ce1SSushil Singh END 733d03f2ce1SSushil Singh 734d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 735d03f2ce1SSushil Singh 736d03f2ce1SSushil Singh 737d03f2ce1SSushil SinghAcquire And Release Multiple Locks 738d03f2ce1SSushil Singh [Documentation] Acquire mutilple locks on resource. 739d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 740d03f2ce1SSushil Singh 741d03f2ce1SSushil Singh # Description of argument(s): 742d03f2ce1SSushil Singh # client_id This client id can contain string value 743d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 744d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 745d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 746d03f2ce1SSushil Singh 747d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 748d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 749d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 750d03f2ce1SSushil Singh 751d03f2ce1SSushil Singh ${trans_id_list}= Create List 752d03f2ce1SSushil Singh 753d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 754d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 755d03f2ce1SSushil Singh 756d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 757d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 758d03f2ce1SSushil Singh 759d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 760d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_list} 761d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} 762d03f2ce1SSushil Singh 763d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 764d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 765d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 766d03f2ce1SSushil Singh 767d03f2ce1SSushil Singh 768d03f2ce1SSushil SinghVerify Invalid Locks Fail To Release 769d03f2ce1SSushil Singh [Documentation] Verify invalid locks fails to be released. 770d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${release_lock_type} 771d03f2ce1SSushil Singh 772d03f2ce1SSushil Singh # Description of argument(s): 773d03f2ce1SSushil Singh # client_id This client id can contain string value 774d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 775d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 776d03f2ce1SSushil Singh # release_lock_type The value can be Transaction or Session. 777d03f2ce1SSushil Singh 778d03f2ce1SSushil Singh ${trans_id_list}= Create List 779d03f2ce1SSushil Singh @{lock_type_list}= Split String ${lock_type} , 780d03f2ce1SSushil Singh 781d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 782d03f2ce1SSushil Singh 783d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 784d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 785d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 786d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 787d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 788d03f2ce1SSushil Singh 789d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 790d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 791d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 792d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 793d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 794d03f2ce1SSushil Singh 795d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] 796d03f2ce1SSushil Singh ${value}= Get From Dictionary ${trans_id} TransactionID 797d03f2ce1SSushil Singh ${value}= Evaluate ${value} + 10 798d03f2ce1SSushil Singh Set To Dictionary ${trans_id} TransactionID ${value} 799d03f2ce1SSushil Singh Append To List ${trans_id_list} ${trans_id} 800d03f2ce1SSushil Singh 801d03f2ce1SSushil Singh Release Locks On Resource 802d03f2ce1SSushil Singh ... ${session_info} ${trans_id_list} 803d03f2ce1SSushil Singh ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} 804d03f2ce1SSushil Singh Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session 805d03f2ce1SSushil Singh 806d03f2ce1SSushil Singh ${trans_id_emptylist}= Create List 807d03f2ce1SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 808d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 809d03f2ce1SSushil Singh 810d03f2ce1SSushil Singh 811d03f2ce1SSushil SinghVerify Fail To Release Lock For Another Session 812d03f2ce1SSushil Singh [Documentation] Verify failed to release the lock form another session. 813d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} 814d03f2ce1SSushil Singh 815d03f2ce1SSushil Singh # Description of argument(s): 816d03f2ce1SSushil Singh # client_id This client id can contain string value 817d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 818d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 819d03f2ce1SSushil Singh 820d03f2ce1SSushil Singh ${client_ids}= Split String ${client_id} , 821d03f2ce1SSushil Singh ${lock_type_list}= Split String ${lock_type} , 822d03f2ce1SSushil Singh ${trans_id_list1}= Create List 823d03f2ce1SSushil Singh ${trans_id_list2}= Create List 824d03f2ce1SSushil Singh 825d03f2ce1SSushil Singh ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0] 826d03f2ce1SSushil Singh 827d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 828d03f2ce1SSushil Singh Append To List ${trans_id_list1} ${trans_id} 829d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 830d03f2ce1SSushil Singh 831d03f2ce1SSushil Singh ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1] 832d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 833d03f2ce1SSushil Singh Append To List ${trans_id_list2} ${trans_id} 834d03f2ce1SSushil Singh Verify Lock On Resource ${session_info2} ${trans_id_list2} 835d03f2ce1SSushil Singh 836d03f2ce1SSushil Singh Release Locks On Resource 837d03f2ce1SSushil Singh ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_UNAUTHORIZED} 838d03f2ce1SSushil Singh Verify Lock On Resource ${session_info1} ${trans_id_list1} 839d03f2ce1SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session 840d03f2ce1SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session 841d03f2ce1SSushil Singh Redfish Delete Session ${session_info1} 842d03f2ce1SSushil Singh Redfish Delete Session ${session_info2} 843d03f2ce1SSushil Singh 844d03f2ce1SSushil Singh 845e33c6e6aSSushil SinghVerify Fail To Acquire Lock For Invalid Resource ID Data Type 846e33c6e6aSSushil Singh [Documentation] Verify fail to acquire the lock with invalid resource id data type. 847e33c6e6aSSushil Singh [Arguments] ${client_id} ${lock_type} 848e33c6e6aSSushil Singh 849e33c6e6aSSushil Singh # Description of argument(s): 850e33c6e6aSSushil Singh # client_id This client id can contain string value 851e33c6e6aSSushil Singh # (e.g. 12345, "HMCID"). 852e33c6e6aSSushil Singh # lock_type Read lock or Write lock. 853e33c6e6aSSushil Singh 854e33c6e6aSSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 855e33c6e6aSSushil Singh Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID 856e33c6e6aSSushil Singh ... ${lock_type} status_code=${HTTP_BAD_REQUEST} 857e33c6e6aSSushil Singh Redfish Delete Session ${session_info} 858e33c6e6aSSushil Singh 859e33c6e6aSSushil Singh 860d03f2ce1SSushil SinghVerify Fail To Acquire Lock For Invalid Lock Data 861e33c6e6aSSushil Singh [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segement flags. 862d03f2ce1SSushil Singh [Arguments] ${client_id} ${lock_type} ${message} 863d03f2ce1SSushil Singh 864d03f2ce1SSushil Singh # Description of argument(s): 865d03f2ce1SSushil Singh # client_id This client id can contain string value 866d03f2ce1SSushil Singh # (e.g. 12345, "HMCID"). 867d03f2ce1SSushil Singh # lock_type Read lock or Write lock. 868d03f2ce1SSushil Singh # message Return message from URI. 869d03f2ce1SSushil Singh 870d03f2ce1SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 871d03f2ce1SSushil Singh ${trans_id}= Redfish Post Acquire Invalid Lock ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST} 872d03f2ce1SSushil Singh Redfish Delete Session ${session_info} 873bace3005SSushil Singh 874bace3005SSushil Singh 875bace3005SSushil SinghVerify No Locks Records For Session With No Acquired Lock 876bace3005SSushil Singh [Documentation] Verify no records found for a session where no lock is acquired. 877bace3005SSushil Singh [Arguments] ${client_id} 878bace3005SSushil Singh 879bace3005SSushil Singh # Description of argument(s): 880bace3005SSushil Singh # client_id This client id can contain string value 881bace3005SSushil Singh # (e.g. 12345, "HMCID"). 882bace3005SSushil Singh 883bace3005SSushil Singh ${session_info}= Create Redfish Session With ClientID ${client_id} 884bace3005SSushil Singh ${trans_id_emptylist}= Create List 885bace3005SSushil Singh Verify Lock On Resource ${session_info} ${trans_id_emptylist} 886bace3005SSushil Singh Redfish Delete Session ${session_info} 887728ef9c9SSushil Singh 888728ef9c9SSushil Singh 889728ef9c9SSushil SinghCreate List Of Session ID 890728ef9c9SSushil Singh [Documentation] Create session id list from session dict info. 891728ef9c9SSushil Singh [Arguments] ${session_dict_info} 892728ef9c9SSushil Singh 893728ef9c9SSushil Singh # Description of argument(s): 894728ef9c9SSushil Singh # session_dict_info Session information in dict. 895728ef9c9SSushil Singh 896728ef9c9SSushil Singh @{session_id_list}= Create List 897728ef9c9SSushil Singh 898728ef9c9SSushil Singh FOR ${session} IN @{session_dict_info} 899728ef9c9SSushil Singh Append To List ${session_id_list} ${session["SessionIDs"]} 900728ef9c9SSushil Singh END 901728ef9c9SSushil Singh 902728ef9c9SSushil Singh ${num_id}= Get Length ${session_id_list} 903728ef9c9SSushil Singh Should Not Be Equal As Integers ${num_id} ${0} 904728ef9c9SSushil Singh 905728ef9c9SSushil Singh ${session_id_list}= Evaluate json.dumps(${session_id_list}) json 906728ef9c9SSushil Singh 907728ef9c9SSushil Singh [Return] ${session_id_list} 908728ef9c9SSushil Singh 909728ef9c9SSushil Singh 910728ef9c9SSushil SinghGet Locks List On Resource With Session List 911728ef9c9SSushil Singh [Documentation] Get locks list from session of list. 912728ef9c9SSushil Singh [Arguments] ${session_id_list} ${exp_status_code}=${HTTP_OK} 913728ef9c9SSushil Singh 914728ef9c9SSushil Singh # Description of argument(s): 915728ef9c9SSushil Singh # session_id_list Session ids list. 916728ef9c9SSushil Singh # exp_status_code Expected HTTP status code. 917728ef9c9SSushil Singh 918728ef9c9SSushil Singh ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList 919728ef9c9SSushil Singh ... data={"SessionIDs": ${session_id_list}} 920728ef9c9SSushil Singh ${locks}= Evaluate json.loads('''${resp.text}''') json 921728ef9c9SSushil Singh 922728ef9c9SSushil Singh [Return] ${locks} 923728ef9c9SSushil Singh 924728ef9c9SSushil Singh 925728ef9c9SSushil SinghVerify List Of Session Lock On Resource 926728ef9c9SSushil Singh [Documentation] Verify list of lock record from list of sessions. 927728ef9c9SSushil Singh [Arguments] ${session_dict_info} ${transaction_id_list} 928728ef9c9SSushil Singh 929728ef9c9SSushil Singh # Description of argument(s): 930728ef9c9SSushil Singh # session_dict_info Session information in dict. 931728ef9c9SSushil Singh # transaction_id_list Transaction id in list stored in dict. 932728ef9c9SSushil Singh 933728ef9c9SSushil Singh ${session_id_list}= Create List Of Session ID ${session_dict_info} 934728ef9c9SSushil Singh ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} 935728ef9c9SSushil Singh ${lock_list}= Set Variable ${lock_list_resp['Records']} 936728ef9c9SSushil Singh 937728ef9c9SSushil Singh FOR ${session_id} ${tran_id} ${lock_record} IN ZIP ${session_dict_info} ${transaction_id_list} ${lock_list} 938728ef9c9SSushil Singh Valid Value session_id['SessionIDs'] ['${lock_record['SessionID']}'] 939728ef9c9SSushil Singh Should Be Equal As Integers ${tran_id['TransactionID']} ${lock_record['TransactionID']} 940728ef9c9SSushil Singh END 941728ef9c9SSushil Singh 942728ef9c9SSushil Singh 943728ef9c9SSushil SinghVerify Lock Records Of Multiple Session 944728ef9c9SSushil Singh [Documentation] Verify all records found for a multiple sessions. 945728ef9c9SSushil Singh [Arguments] ${client_ids} ${lock_type} 946728ef9c9SSushil Singh 947728ef9c9SSushil Singh # Description of argument(s): 948728ef9c9SSushil Singh # client_ids This client id can contain string value 949728ef9c9SSushil Singh # (e.g. 12345, "HMCID"). 950728ef9c9SSushil Singh # lock_type Read lock or Write lock. 951728ef9c9SSushil Singh 952728ef9c9SSushil Singh ${client_id_list}= Split String ${client_ids} , 953728ef9c9SSushil Singh ${lock_type_list}= Split String ${lock_type} , 954728ef9c9SSushil Singh ${trans_id_list1}= Create List 955728ef9c9SSushil Singh ${trans_id_list2}= Create List 956728ef9c9SSushil Singh 957728ef9c9SSushil Singh ${session_dict_list}= Create List 958728ef9c9SSushil Singh ${lock_list}= Create List 959728ef9c9SSushil Singh 960728ef9c9SSushil Singh ${client_id1}= Create List 961728ef9c9SSushil Singh Append To List ${client_id1} ${client_id_list}[0] 962728ef9c9SSushil Singh ${session_info1}= Create Session With List Of ClientID ${client_id1} 963728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info1}[0] 964728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id1} ${session_info1} 965728ef9c9SSushil Singh 966728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] 967728ef9c9SSushil Singh Append To List ${trans_id_list1} ${trans_id} 968728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 969728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} 970728ef9c9SSushil Singh 971728ef9c9SSushil Singh 972728ef9c9SSushil Singh ${client_id2}= Create List 973728ef9c9SSushil Singh Append To List ${client_id2} ${client_id_list}[1] 974728ef9c9SSushil Singh ${session_info2}= Create Session With List Of ClientID ${client_id2} 975728ef9c9SSushil Singh Append To List ${session_dict_list} ${session_info2}[0] 976728ef9c9SSushil Singh Verify A Session Created With ClientID ${client_id2} ${session_info2} 977728ef9c9SSushil Singh 978728ef9c9SSushil Singh ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] 979728ef9c9SSushil Singh Append To List ${trans_id_list2} ${trans_id} 980728ef9c9SSushil Singh Append To List ${lock_list} ${trans_id} 981728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_list2} 982728ef9c9SSushil Singh 983728ef9c9SSushil Singh Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} 984728ef9c9SSushil Singh 985728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken 986728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 987728ef9c9SSushil Singh 988728ef9c9SSushil Singh Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction 989728ef9c9SSushil Singh 990728ef9c9SSushil Singh ${session_token}= Get From Dictionary ${session_info2}[0] SessionToken 991728ef9c9SSushil Singh Set Global Variable ${XAUTH_TOKEN} ${session_token} 992728ef9c9SSushil Singh 993728ef9c9SSushil Singh Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Transaction 994728ef9c9SSushil Singh 995728ef9c9SSushil Singh ${trans_id_emptylist}= Create List 996728ef9c9SSushil Singh Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} 997728ef9c9SSushil Singh Verify Lock On Resource ${session_info2}[0] ${trans_id_emptylist} 998728ef9c9SSushil Singh 999728ef9c9SSushil Singh Redfish Delete List Of Session ${session_dict_list} 1000