Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 3 | Documentation Test lock management feature of management console on BMC. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 4 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 5 | Resource ../../lib/resource.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | Resource ../../lib/bmc_redfish_utils.robot |
| 8 | Resource ../../lib/external_intf/management_console_utils.robot |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 9 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 10 | Suite Setup Run Keyword And Ignore Error Delete All Redfish Sessions |
| 11 | Suite Teardown Redfish.Logout |
| 12 | Test Setup Printn |
| 13 | Test Teardown FFDC On Test Case Fail |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 14 | |
| 15 | *** Variables *** |
| 16 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 17 | ${BAD_REQUEST} Bad Request |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 18 | |
| 19 | *** Test Cases *** |
| 20 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 21 | Acquire Read Write Lock |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 22 | [Documentation] Acquire and release different read locks. |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 23 | [Tags] Acquire_Read_Write_Lock |
| 24 | [Template] Acquire Lock On Resource |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 25 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 26 | # client_id lock_type reboot_flag |
| 27 | HMCID-01 ReadCase1 False |
| 28 | HMCID-01 ReadCase2 False |
| 29 | HMCID-01 ReadCase3 False |
| 30 | HMCID-01 WriteCase1 False |
| 31 | HMCID-01 WriteCase2 False |
| 32 | HMCID-01 WriteCase3 False |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 33 | |
| 34 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 35 | Check Lock Persistency On BMC Reboot |
| 36 | [Documentation] Acquire lock and check after reboot it remain same. |
| 37 | [Tags] Check_Lock_Persistency_On_BMC_Reboot |
| 38 | [Template] Acquire Lock On Resource |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 39 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 40 | # client_id lock_type reboot_flag |
| 41 | HMCID-01 ReadCase1 True |
| 42 | HMCID-01 ReadCase2 True |
| 43 | HMCID-01 ReadCase3 True |
| 44 | HMCID-01 WriteCase1 True |
| 45 | HMCID-01 WriteCase2 True |
| 46 | HMCID-01 WriteCase3 True |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 47 | |
| 48 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 49 | Acquire Read Lock On Read Lock |
| 50 | [Documentation] Acquire read lock on another read lock. |
| 51 | [Tags] Acquire_Read_Lock_On_Read_Lock |
| 52 | [Template] Acquire Lock On Another Lock |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 53 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 54 | # client_id |
| 55 | HMCID-01 |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 56 | |
| 57 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 58 | Get Lock Records Empty For Invalid Session |
| 59 | [Documentation] Record of lock list is empty for invalid session. |
| 60 | [Tags] Get_Lock_Records_Empty_For_Invalid_Session |
| 61 | [Template] Verify Empty Lock Records For Invalid Session |
Vijay | 355daac | 2020-03-26 12:06:08 -0500 | [diff] [blame] | 62 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 63 | # client_id |
| 64 | HMCID-01 |
Vijay | 355daac | 2020-03-26 12:06:08 -0500 | [diff] [blame] | 65 | |
| 66 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 67 | Fail To Acquire Lock On Another Lock |
| 68 | [Documentation] Fail to acquire another lock. |
| 69 | [Tags] Fail_To_Acquire_Lock_On_Another_Lock |
| 70 | [Template] Verify Acquire Lock Fails On Another Lock |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 71 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 72 | # client_id lock_type |
| 73 | HMCID-01 ReadCase2,WriteCase2 |
| 74 | HMCID-01 WriteCase2,WriteCase2 |
| 75 | HMCID-01 WriteCase2,ReadCase2 |
George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 76 | |
| 77 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 78 | Acquire Lock After Reboot |
| 79 | [Documentation] Acquire and release read and write locks after reboot. |
| 80 | [Tags] Acquire_Lock_After_Reboot |
| 81 | [Template] Verify Acquire Lock After Reboot |
| 82 | |
| 83 | # client_id lock_type |
| 84 | HMCID-01 ReadCase1 |
| 85 | HMCID-01 ReadCase2 |
| 86 | HMCID-01 ReadCase3 |
| 87 | HMCID-01 WriteCase1 |
| 88 | HMCID-01 WriteCase2 |
| 89 | HMCID-01 WriteCase3 |
| 90 | |
| 91 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 92 | Acquire And Release Lock In Loop |
| 93 | [Documentation] Acquire and release read, write locks in loop. |
| 94 | [Tags] Acquire_And_Release_Lock_In_Loop |
| 95 | [Template] Verify Acquire And Release Lock In Loop |
George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 96 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 97 | # client_id lock_type |
| 98 | HMCID-01 ReadCase1 |
| 99 | HMCID-01 ReadCase2 |
| 100 | HMCID-01 ReadCase3 |
| 101 | HMCID-01 WriteCase1 |
| 102 | HMCID-01 WriteCase2 |
| 103 | HMCID-01 WriteCase3 |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 104 | |
| 105 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 106 | Verify Release Of Valid Locks |
| 107 | [Documentation] Release all valid locks. |
| 108 | [Tags] Verify_Release_Of_Valid_Locks |
| 109 | [Template] Acquire And Release Multiple Locks |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 110 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 111 | # client_id lock_type release_lock_type |
| 112 | HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction |
| 113 | HMCID-02 ReadCase1,ReadCase1,ReadCase1 Session |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 114 | |
| 115 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 116 | Invalid Locks Fail To Release |
| 117 | [Documentation] Release in-valid lock result in fail. |
| 118 | [Tags] Invalid_Locks_Fail_To_Release |
| 119 | [Template] Verify Invalid Locks Fail To Release |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 120 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 121 | # client_id lock_type release_lock_type |
| 122 | HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction |
| 123 | 12345 ReadCase2,ReadCase2,ReadCase2 Transaction |
| 124 | HMCID ReadCase3,ReadCase3,ReadCase3 Transaction |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 125 | |
| 126 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 127 | Fail To Release Lock For Another Session |
| 128 | [Documentation] Failed to release locks from another session. |
| 129 | [Tags] Fail_To_Release_Lock_For_Another_Session |
| 130 | [Template] Verify Fail To Release Lock For Another Session |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 131 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 132 | # client_id lock_type |
| 133 | HMCID-01,HMCID-02 ReadCase1,ReadCase1 |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 134 | |
| 135 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 136 | Test Invalid Resource ID Data Type Locking |
| 137 | [Documentation] Failed to acquire lock for invalid resource id data type. |
| 138 | [Tags] Test_Invalid_Resource_ID_Data_Type_Locking |
| 139 | [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type |
| 140 | |
| 141 | # client_id lock_type |
| 142 | HMCID-01 ReadCase1 |
| 143 | HMCID-01 ReadCase2 |
| 144 | HMCID-01 ReadCase3 |
| 145 | HMCID-01 WriteCase1 |
| 146 | HMCID-01 WriteCase2 |
| 147 | HMCID-01 WriteCase3 |
| 148 | |
| 149 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 150 | Fail To Acquire Lock For Invalid Lock Type |
| 151 | [Documentation] Failed to acquire read, write lock for invalid lock data passed. |
| 152 | [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type |
| 153 | [Template] Verify Fail To Acquire Lock For Invalid Lock Data |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 154 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 155 | # client_id lock_type message |
| 156 | HMCID-01 ReadCase1 ${BAD_REQUEST} |
| 157 | HMCID-01 ReadCase2 ${BAD_REQUEST} |
| 158 | HMCID-01 ReadCase3 ${BAD_REQUEST} |
| 159 | HMCID-01 ReadCase4 ${BAD_REQUEST} |
| 160 | HMCID-01 ReadCase5 ${BAD_REQUEST} |
| 161 | HMCID-01 WriteCase1 ${BAD_REQUEST} |
| 162 | HMCID-01 WriteCase2 ${BAD_REQUEST} |
| 163 | HMCID-01 WriteCase3 ${BAD_REQUEST} |
| 164 | HMCID-01 WriteCase4 ${BAD_REQUEST} |
| 165 | HMCID-01 WriteCase5 ${BAD_REQUEST} |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 166 | |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 167 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 168 | Fail To Acquire Lock For Invalid Lock Flag |
| 169 | [Documentation] Failed to acquire read write lock for invalid lock flag passed. |
| 170 | [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag |
| 171 | [Template] Verify Fail To Acquire Lock For Invalid Lock Data |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 172 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 173 | # client_id lock_type message |
| 174 | HMCID-01 ReadCase6 ${BAD_REQUEST} |
| 175 | HMCID-01 ReadCase7 ${BAD_REQUEST} |
| 176 | HMCID-01 ReadCase8 ${BAD_REQUEST} |
| 177 | HMCID-01 ReadCase9 ${BAD_REQUEST} |
| 178 | HMCID-01 ReadCase10 ${BAD_REQUEST} |
| 179 | HMCID-01 ReadCase11 ${BAD_REQUEST} |
| 180 | HMCID-01 WriteCase6 ${BAD_REQUEST} |
| 181 | HMCID-01 WriteCase7 ${BAD_REQUEST} |
| 182 | HMCID-01 WriteCase8 ${BAD_REQUEST} |
| 183 | HMCID-01 WriteCase9 ${BAD_REQUEST} |
| 184 | HMCID-01 WriteCase10 ${BAD_REQUEST} |
| 185 | HMCID-01 WriteCase11 ${BAD_REQUEST} |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 186 | |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 187 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 188 | Fail To Acquire Lock For Invalid Segment Flag |
| 189 | [Documentation] Failed to acquire read write lock for invalid segment flag passed. |
| 190 | [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag |
| 191 | [Template] Verify Fail To Acquire Lock For Invalid Lock Data |
| 192 | |
| 193 | # client_id lock_type message |
| 194 | HMCID-01 ReadCase12 ${BAD_REQUEST} |
| 195 | HMCID-01 ReadCase13 ${BAD_REQUEST} |
| 196 | HMCID-01 ReadCase14 ${BAD_REQUEST} |
| 197 | HMCID-01 WriteCase12 ${BAD_REQUEST} |
| 198 | HMCID-01 WriteCase13 ${BAD_REQUEST} |
| 199 | HMCID-01 WriteCase14 ${BAD_REQUEST} |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 200 | |
Sushil Singh | bace300 | 2020-10-08 08:12:58 -0500 | [diff] [blame] | 201 | |
| 202 | Get Empty Lock Records For Session Where No Locks Acquired |
| 203 | [Documentation] If session does not acquire locks then get lock should return |
| 204 | ... empty lock records. |
| 205 | [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired |
| 206 | [Template] Verify No Locks Records For Session With No Acquired Lock |
| 207 | |
| 208 | # client_id |
| 209 | HMCID-01 |
| 210 | |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 211 | *** Keywords *** |
| 212 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 213 | Create Redfish Session With ClientID |
| 214 | [Documentation] Create redifish session with client id. |
| 215 | [Arguments] ${client_id} |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 216 | |
| 217 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 218 | # client_id This client id can contain string value |
| 219 | # (e.g. 12345, "HMCID"). |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 220 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 221 | ${session_info}= Create Dictionary |
| 222 | ${session}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}} |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 223 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 224 | Set To Dictionary ${session_info} SessionIDs ${session['Id']} |
| 225 | Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]} |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 226 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 227 | [Return] ${session_info} |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 228 | |
| 229 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 230 | RW General Dictionary |
| 231 | [Documentation] Create dictionay of lock request. |
| 232 | [Arguments] ${read_case} ${res_id} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 233 | |
| 234 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 235 | # read_case Read or Write lock type. |
| 236 | # res_id Resource id. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 237 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 238 | ${request_dict}= Create Dictionary |
George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 239 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 240 | FOR ${key} IN @{read_case.keys()} |
| 241 | Set To Dictionary ${request_dict} LockType ${key} |
| 242 | Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]} |
| 243 | END |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 244 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 245 | Set To Dictionary ${request_dict} ResourceID ${res_id} |
| 246 | |
| 247 | [Return] ${request_dict} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 248 | |
| 249 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 250 | Return Description Of Response |
| 251 | [Documentation] Return description of REST response. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 252 | [Arguments] ${resp_text} |
| 253 | |
| 254 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 255 | # resp_text REST response body. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 256 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 257 | # resp_text after successful partition file upload looks like: |
| 258 | # { |
| 259 | # "Description": "File Created" |
| 260 | # } |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 261 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 262 | ${message}= Evaluate json.loads('''${resp_text}''') json |
| 263 | |
| 264 | [Return] ${message} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 265 | |
| 266 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 267 | Redfish Post Acquire Lock |
| 268 | [Documentation] Acquire and release lock. |
| 269 | [Arguments] ${lock_type} ${status_code}=${HTTP_OK} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 270 | |
| 271 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 272 | # lock_type Read lock or Write lock. |
| 273 | # status_code HTTP status code. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 274 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 275 | ${lock_dict_param}= Form Data To Acquire Lock ${lock_type} |
| 276 | ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 277 | Should Be Equal As Strings ${resp.status_code} ${status_code} |
| 278 | ${resp}= Return Description Of Response ${resp.content} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 279 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 280 | [Return] ${resp} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 281 | |
| 282 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 283 | Redfish Post Acquire Invalid Lock |
| 284 | [Documentation] Redfish to post request to acquire in-valid lock. |
| 285 | [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 286 | |
| 287 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 288 | # lock_type Read lock or Write lock. |
| 289 | # message Return message from URI. |
| 290 | # status_code HTTP status code. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 291 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 292 | ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type} |
| 293 | ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 294 | Should Be Equal As Strings ${resp.status_code} ${status_code} |
| 295 | Valid Value message ['${resp.content}'] |
| 296 | |
| 297 | [Return] ${resp} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 298 | |
| 299 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 300 | Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID |
| 301 | [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id. |
| 302 | [Arguments] ${lock_type} ${status_code}=${HTTP_OK} |
| 303 | |
| 304 | # Description of argument(s): |
| 305 | # lock_type Read lock or Write lock. |
| 306 | # status_code HTTP status code. |
| 307 | |
| 308 | ${lock_dict_param}= Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type} |
| 309 | ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} |
| 310 | Should Be Equal As Strings ${resp.status_code} ${status_code} |
| 311 | |
| 312 | [Return] ${resp} |
| 313 | |
| 314 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 315 | Form Data To Acquire Lock |
| 316 | [Documentation] Create a dictionay for lock request. |
| 317 | [Arguments] ${lock_type} |
| 318 | |
| 319 | # Description of argument(s): |
| 320 | # lock_type Read lock or Write lock. |
| 321 | |
| 322 | ${lock_res_info}= Get Lock Resource Information |
| 323 | ${resp}= RW General Dictionary |
| 324 | ... ${lock_res_info["Valid Case"]["${lock_type}"]} |
| 325 | ... ${lock_res_info["Valid Case"]["ResourceID"]} |
| 326 | ${temp_list}= Create List ${resp} |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 327 | ${lock_request_dict}= Create Dictionary Request=${temp_list} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 328 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 329 | [Return] ${lock_request_dict} |
| 330 | |
| 331 | |
| 332 | Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID |
| 333 | [Documentation] Create a dictionay for in-valid lock request. |
| 334 | [Arguments] ${lock_type} |
| 335 | |
| 336 | # Description of argument(s): |
| 337 | # lock_type Read lock or Write lock. |
| 338 | |
| 339 | ${lock_res_info}= Get Lock Resource Information |
| 340 | ${resp}= RW General Dictionary |
| 341 | ... ${lock_res_info["Valid Case"]["${lock_type}"]} |
| 342 | ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]} |
| 343 | ${temp_list}= Create List ${resp} |
| 344 | ${lock_request_dict}= Create Dictionary Request=${temp_list} |
| 345 | |
| 346 | [Return] ${lock_request_dict} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 347 | |
| 348 | |
| 349 | Form Data To Acquire Invalid Lock |
| 350 | [Documentation] Create a dictionay for in-valid lock request. |
| 351 | [Arguments] ${lock_type} |
| 352 | |
| 353 | # Description of argument(s): |
| 354 | # lock_type Read lock or Write lock. |
| 355 | |
| 356 | ${lock_res_info}= Get Lock Resource Information |
| 357 | ${resp}= RW General Dictionary |
| 358 | ... ${lock_res_info["Invalid Case"]["${lock_type}"]} |
| 359 | ... ${lock_res_info["Valid Case"]["ResourceID"]} |
| 360 | ${temp_list}= Create List ${resp} |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 361 | ${lock_request_dict}= Create Dictionary Request=${temp_list} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 362 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 363 | [Return] ${lock_request_dict} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 364 | |
| 365 | |
| 366 | Get Locks List On Resource |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 367 | [Documentation] Get locks list. |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 368 | [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 369 | |
| 370 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 371 | # session_info Session information in dict. |
| 372 | # exp_status_code Expected HTTP status code. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 373 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 374 | ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]} |
George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 375 | ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList |
| 376 | ... data=${data} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 377 | ${locks}= Evaluate json.loads('''${resp.text}''') json |
| 378 | |
| 379 | [Return] ${locks["Records"]} |
| 380 | |
| 381 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 382 | Verify Lock On Resource |
| 383 | [Documentation] Verify lock on resource. |
| 384 | [Arguments] ${session_info} ${transaction_id} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 385 | |
| 386 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 387 | # session_info Session information in dict. |
| 388 | # transaction_id Transaction id in list stored in dict. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 389 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 390 | ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']} |
| 391 | Rprint Vars sessions |
| 392 | ${lock_list}= Get Locks List On Resource ${session_info} |
| 393 | ${lock_length}= Get Length ${lock_list} |
| 394 | ${tran_id_length}= Get Length ${transaction_id} |
| 395 | Should Be Equal As Integers ${tran_id_length} ${lock_length} |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 396 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 397 | FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list} |
| 398 | Valid Value session_info['ClientID'] ['${lock['HMCID']}'] |
| 399 | Valid Value session_info['SessionIDs'] ['${lock['SessionID']}'] |
| 400 | Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 401 | END |
| 402 | |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 403 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 404 | Redfish Delete Session |
| 405 | [Documentation] Redfish delete session. |
| 406 | [Arguments] ${session_info} |
Vijay | 355daac | 2020-03-26 12:06:08 -0500 | [diff] [blame] | 407 | |
| 408 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 409 | # session_info Session information in dict. |
Vijay | 355daac | 2020-03-26 12:06:08 -0500 | [diff] [blame] | 410 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 411 | Redfish.Delete /redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]} |
Vijay | 355daac | 2020-03-26 12:06:08 -0500 | [diff] [blame] | 412 | |
| 413 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 414 | Acquire Lock On Resource |
| 415 | [Documentation] Acquire lock on resource. |
| 416 | [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 417 | |
| 418 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 419 | # client_id This client id can contain string value |
| 420 | # (e.g. 12345, "HMCID"). |
| 421 | # lock_type Read lock or Write lock. |
| 422 | # reboot_flag Flag is used to run reboot the BMC code. |
| 423 | # (e.g. True or False). |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 424 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 425 | ${trans_id_list}= Create List |
| 426 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 427 | ${trans_id}= Redfish Post Acquire Lock ${lock_type} |
| 428 | Append To List ${trans_id_list} ${trans_id} |
| 429 | Verify Lock On Resource ${session_info} ${trans_id_list} |
George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 430 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 431 | ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 432 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 433 | Run Keyword If '${reboot_flag}' == 'True' |
| 434 | ... Run Keywords Redfish OBMC Reboot (off) AND |
| 435 | ... Redfish Login AND |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 436 | ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 437 | ... Verify Lock On Resource ${session_info} ${trans_id_list} AND |
| 438 | ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 439 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 440 | Run Keyword If '${reboot_flag}' == 'False' |
| 441 | ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 442 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 443 | ${trans_id_emptylist}= Create List |
| 444 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 445 | Redfish Delete Session ${session_info} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 446 | |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 447 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 448 | Form Data To Release Lock |
| 449 | [Documentation] Create a dictonay to release lock. |
| 450 | [Arguments] ${trans_id_list} |
Vijay | 355daac | 2020-03-26 12:06:08 -0500 | [diff] [blame] | 451 | |
| 452 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 453 | # trans_id_list |
Vijay | 355daac | 2020-03-26 12:06:08 -0500 | [diff] [blame] | 454 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 455 | @{tran_ids}= Create List |
Vijay | 355daac | 2020-03-26 12:06:08 -0500 | [diff] [blame] | 456 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 457 | FOR ${item} IN @{trans_id_list} |
| 458 | Append To List ${tran_ids} ${item['TransactionID']} |
| 459 | END |
| 460 | |
| 461 | [Return] ${tran_ids} |
| 462 | |
| 463 | |
| 464 | Release Locks On Resource |
| 465 | [Documentation] Redfish request to release a lock. |
| 466 | [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction ${status_code}=${HTTP_OK} |
| 467 | |
| 468 | # Description of argument(s): |
| 469 | # session_info Session information in dict. |
| 470 | # trans_id_list Transaction id list. |
| 471 | # release_lock_type Release lock by Transaction, Session. |
| 472 | # status_code HTTP status code. |
| 473 | |
| 474 | ${tran_ids}= Form Data To Release Lock ${trans_id_list} |
| 475 | ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}} |
| 476 | ${data}= Evaluate json.dumps(${data}) json |
| 477 | ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data} |
| 478 | Should Be Equal As Strings ${resp.status_code} ${status_code} |
| 479 | |
| 480 | |
| 481 | Acquire Lock On Another Lock |
| 482 | [Documentation] Acquire lock on another lock. |
| 483 | [Arguments] ${client_id} |
| 484 | |
| 485 | # Description of argument(s): |
| 486 | # client_id This client id can contain string value |
| 487 | # (e.g. 12345, "HMCID"). |
| 488 | |
| 489 | ${trans_id_list}= Create List |
| 490 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 491 | |
| 492 | ${trans_id}= Redfish Post Acquire Lock ReadCase1 |
| 493 | Append To List ${trans_id_list} ${trans_id} |
| 494 | |
| 495 | ${trans_id}= Redfish Post Acquire Lock ReadCase1 |
| 496 | Append To List ${trans_id_list} ${trans_id} |
| 497 | |
| 498 | Verify Lock On Resource ${session_info} ${trans_id_list} |
| 499 | Release Locks On Resource ${session_info} ${trans_id_list} |
| 500 | |
| 501 | ${trans_id_emptylist}= Create List |
| 502 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 503 | Redfish Delete Session ${session_info} |
| 504 | |
| 505 | |
| 506 | Verify Empty Lock Records For Invalid Session |
| 507 | [Documentation] Verify no lock record found for invalid session. |
| 508 | [Arguments] ${client_id} |
| 509 | |
| 510 | # Description of argument(s): |
| 511 | # client_id This client id can contain string value |
| 512 | # (e.g. 12345, "HMCID"). |
| 513 | |
| 514 | ${session_info1}= Create Redfish Session With ClientID ${client_id} |
| 515 | |
| 516 | ${lock_list1}= Get Locks List On Resource ${session_info1} |
| 517 | ${lock_length1}= Get Length ${lock_list1} |
| 518 | |
| 519 | ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True |
| 520 | set to dictionary ${session_info2} SessionIDs xxyXyyYZZz |
| 521 | |
| 522 | ${lock_list2}= Get Locks List On Resource ${session_info2} |
| 523 | ${lock_length2}= Get Length ${lock_list1} |
| 524 | |
| 525 | Valid Value lock_length1 ${lock_list2} |
| 526 | |
| 527 | Redfish Delete Session ${session_info1} |
| 528 | |
| 529 | |
| 530 | Verify Acquire Lock Fails On Another Lock |
| 531 | [Documentation] Verify acquire lock on another lock fails. |
| 532 | [Arguments] ${client_id} ${lock_type} |
| 533 | |
| 534 | # Description of argument(s): |
| 535 | # client_id This client id can contain string value |
| 536 | # (e.g. 12345, "HMCID"). |
| 537 | # lock_type Read lock or Write lock. |
| 538 | |
| 539 | @{lock_type_list}= Split String ${lock_type} , |
| 540 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 541 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 542 | |
| 543 | ${trans_id_list}= Create List |
| 544 | Append To List ${trans_id_list} ${trans_id} |
| 545 | |
| 546 | Verify Lock On Resource ${session_info} ${trans_id_list} |
| 547 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} |
| 548 | Release Locks On Resource ${session_info} ${trans_id_list} |
| 549 | |
| 550 | ${trans_id_emptylist}= Create List |
| 551 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 552 | |
| 553 | Redfish Delete Session ${session_info} |
| 554 | |
| 555 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 556 | Verify Acquire Lock After Reboot |
| 557 | [Documentation] Acquire read and write lock after the reboot and release lock. |
| 558 | [Arguments] ${client_id} ${lock_type} |
| 559 | |
| 560 | # Description of argument(s): |
| 561 | # client_id This client id can contain string value |
| 562 | # (e.g. 12345, "HMCID"). |
| 563 | # lock_type Read lock or Write lock. |
| 564 | |
| 565 | ${trans_id_list}= Create List |
| 566 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 567 | ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} |
| 568 | Redfish OBMC Reboot (off) |
| 569 | Redfish Login |
| 570 | Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} |
| 571 | |
| 572 | ${trans_id}= Redfish Post Acquire Lock ${lock_type} |
| 573 | Append To List ${trans_id_list} ${trans_id} |
| 574 | Verify Lock On Resource ${session_info} ${trans_id_list} |
| 575 | Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} |
| 576 | |
| 577 | ${trans_id_emptylist}= Create List |
| 578 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 579 | Redfish Delete Session ${session_info} |
| 580 | |
| 581 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 582 | Verify Acquire And Release Lock In Loop |
| 583 | [Documentation] Acquire lock in loop. |
| 584 | [Arguments] ${client_id} ${lock_type} |
| 585 | |
| 586 | # Description of argument(s): |
| 587 | # client_id This client id can contain string value |
| 588 | # (e.g. 12345, "HMCID"). |
| 589 | # lock_type Read lock or Write lock. |
| 590 | |
| 591 | FOR ${count} IN RANGE 1 11 |
| 592 | ${trans_id_list}= Create List |
| 593 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 594 | ${trans_id}= Redfish Post Acquire Lock ${lock_type} |
| 595 | Append To List ${trans_id_list} ${trans_id} |
| 596 | Verify Lock On Resource ${session_info} ${trans_id_list} |
| 597 | Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} |
| 598 | ${trans_id_emptylist}= Create List |
| 599 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 600 | END |
| 601 | |
| 602 | Redfish Delete Session ${session_info} |
| 603 | |
| 604 | |
| 605 | Acquire And Release Multiple Locks |
| 606 | [Documentation] Acquire mutilple locks on resource. |
| 607 | [Arguments] ${client_id} ${lock_type} ${release_lock_type} |
| 608 | |
| 609 | # Description of argument(s): |
| 610 | # client_id This client id can contain string value |
| 611 | # (e.g. 12345, "HMCID"). |
| 612 | # lock_type Read lock or Write lock. |
| 613 | # release_lock_type The value can be Transaction or Session. |
| 614 | |
| 615 | @{lock_type_list}= Split String ${lock_type} , |
| 616 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 617 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 618 | |
| 619 | ${trans_id_list}= Create List |
| 620 | |
| 621 | Append To List ${trans_id_list} ${trans_id} |
| 622 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] |
| 623 | |
| 624 | Append To List ${trans_id_list} ${trans_id} |
| 625 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] |
| 626 | |
| 627 | Append To List ${trans_id_list} ${trans_id} |
| 628 | Verify Lock On Resource ${session_info} ${trans_id_list} |
| 629 | Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} |
| 630 | |
| 631 | ${trans_id_emptylist}= Create List |
| 632 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 633 | Redfish Delete Session ${session_info} |
| 634 | |
| 635 | |
| 636 | Verify Invalid Locks Fail To Release |
| 637 | [Documentation] Verify invalid locks fails to be released. |
| 638 | [Arguments] ${client_id} ${lock_type} ${release_lock_type} |
| 639 | |
| 640 | # Description of argument(s): |
| 641 | # client_id This client id can contain string value |
| 642 | # (e.g. 12345, "HMCID"). |
| 643 | # lock_type Read lock or Write lock. |
| 644 | # release_lock_type The value can be Transaction or Session. |
| 645 | |
| 646 | ${trans_id_list}= Create List |
| 647 | @{lock_type_list}= Split String ${lock_type} , |
| 648 | |
| 649 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 650 | |
| 651 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 652 | ${value}= Get From Dictionary ${trans_id} TransactionID |
| 653 | ${value}= Evaluate ${value} + 10 |
| 654 | Set To Dictionary ${trans_id} TransactionID ${value} |
| 655 | Append To List ${trans_id_list} ${trans_id} |
| 656 | |
| 657 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] |
| 658 | ${value}= Get From Dictionary ${trans_id} TransactionID |
| 659 | ${value}= Evaluate ${value} + 10 |
| 660 | Set To Dictionary ${trans_id} TransactionID ${value} |
| 661 | Append To List ${trans_id_list} ${trans_id} |
| 662 | |
| 663 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] |
| 664 | ${value}= Get From Dictionary ${trans_id} TransactionID |
| 665 | ${value}= Evaluate ${value} + 10 |
| 666 | Set To Dictionary ${trans_id} TransactionID ${value} |
| 667 | Append To List ${trans_id_list} ${trans_id} |
| 668 | |
| 669 | Release Locks On Resource |
| 670 | ... ${session_info} ${trans_id_list} |
| 671 | ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} |
| 672 | Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session |
| 673 | |
| 674 | ${trans_id_emptylist}= Create List |
| 675 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 676 | Redfish Delete Session ${session_info} |
| 677 | |
| 678 | |
| 679 | Verify Fail To Release Lock For Another Session |
| 680 | [Documentation] Verify failed to release the lock form another session. |
| 681 | [Arguments] ${client_id} ${lock_type} |
| 682 | |
| 683 | # Description of argument(s): |
| 684 | # client_id This client id can contain string value |
| 685 | # (e.g. 12345, "HMCID"). |
| 686 | # lock_type Read lock or Write lock. |
| 687 | |
| 688 | ${client_ids}= Split String ${client_id} , |
| 689 | ${lock_type_list}= Split String ${lock_type} , |
| 690 | ${trans_id_list1}= Create List |
| 691 | ${trans_id_list2}= Create List |
| 692 | |
| 693 | ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0] |
| 694 | |
| 695 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 696 | Append To List ${trans_id_list1} ${trans_id} |
| 697 | Verify Lock On Resource ${session_info1} ${trans_id_list1} |
| 698 | |
| 699 | ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1] |
| 700 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] |
| 701 | Append To List ${trans_id_list2} ${trans_id} |
| 702 | Verify Lock On Resource ${session_info2} ${trans_id_list2} |
| 703 | |
| 704 | Release Locks On Resource |
| 705 | ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_UNAUTHORIZED} |
| 706 | Verify Lock On Resource ${session_info1} ${trans_id_list1} |
| 707 | Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session |
| 708 | Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session |
| 709 | Redfish Delete Session ${session_info1} |
| 710 | Redfish Delete Session ${session_info2} |
| 711 | |
| 712 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 713 | Verify Fail To Acquire Lock For Invalid Resource ID Data Type |
| 714 | [Documentation] Verify fail to acquire the lock with invalid resource id data type. |
| 715 | [Arguments] ${client_id} ${lock_type} |
| 716 | |
| 717 | # Description of argument(s): |
| 718 | # client_id This client id can contain string value |
| 719 | # (e.g. 12345, "HMCID"). |
| 720 | # lock_type Read lock or Write lock. |
| 721 | |
| 722 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 723 | Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID |
| 724 | ... ${lock_type} status_code=${HTTP_BAD_REQUEST} |
| 725 | Redfish Delete Session ${session_info} |
| 726 | |
| 727 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 728 | Verify Fail To Acquire Lock For Invalid Lock Data |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 729 | [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segement flags. |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 730 | [Arguments] ${client_id} ${lock_type} ${message} |
| 731 | |
| 732 | # Description of argument(s): |
| 733 | # client_id This client id can contain string value |
| 734 | # (e.g. 12345, "HMCID"). |
| 735 | # lock_type Read lock or Write lock. |
| 736 | # message Return message from URI. |
| 737 | |
| 738 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 739 | ${trans_id}= Redfish Post Acquire Invalid Lock ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST} |
| 740 | Redfish Delete Session ${session_info} |
Sushil Singh | bace300 | 2020-10-08 08:12:58 -0500 | [diff] [blame] | 741 | |
| 742 | |
| 743 | Verify No Locks Records For Session With No Acquired Lock |
| 744 | [Documentation] Verify no records found for a session where no lock is acquired. |
| 745 | [Arguments] ${client_id} |
| 746 | |
| 747 | # Description of argument(s): |
| 748 | # client_id This client id can contain string value |
| 749 | # (e.g. 12345, "HMCID"). |
| 750 | |
| 751 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 752 | ${trans_id_emptylist}= Create List |
| 753 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 754 | Redfish Delete Session ${session_info} |