Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
Sushil Singh | 8d420bf | 2021-09-06 08:27: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 | 8d420bf | 2021-09-06 08:27: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 |
| 9 | Resource ../../lib/rest_response_code.robot |
| 10 | Library ../../lib/bmc_network_utils.py |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 11 | |
Sushil Singh | 8d420bf | 2021-09-06 08:27:41 -0500 | [diff] [blame] | 12 | Suite Setup Run Keyword And Ignore Error Delete All Redfish Sessions |
| 13 | Suite Teardown Run Keyword And Ignore Error Delete All Redfish Sessions |
| 14 | Test Setup Printn |
| 15 | Test Teardown FFDC On Test Case Fail |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 16 | |
| 17 | *** Variables *** |
| 18 | |
Sushil Singh | 8d420bf | 2021-09-06 08:27:41 -0500 | [diff] [blame] | 19 | ${BAD_REQUEST} Bad Request |
| 20 | &{default_trans_id} TransactionID=${1} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 21 | |
| 22 | *** Test Cases *** |
| 23 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 24 | Acquire Read Write Lock |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 25 | [Documentation] Acquire and release different read locks. |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 26 | [Tags] Acquire_Read_Write_Lock |
| 27 | [Template] Acquire Lock On Resource |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 28 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 29 | # client_id lock_type reboot_flag |
| 30 | HMCID-01 ReadCase1 False |
| 31 | HMCID-01 ReadCase2 False |
| 32 | HMCID-01 ReadCase3 False |
| 33 | HMCID-01 WriteCase1 False |
| 34 | HMCID-01 WriteCase2 False |
| 35 | HMCID-01 WriteCase3 False |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 36 | |
| 37 | |
Sushil Singh | d8bf142 | 2021-09-06 05:19:09 -0500 | [diff] [blame] | 38 | Verify Lock Is Not Persistent On BMC Reboot |
| 39 | [Documentation] Acquire lock and after reboot the locks are removed as no persistency |
| 40 | ... maintained. |
| 41 | [Tags] Verify_Lock_Is_Not_Persistent_On_BMC_Reboot |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 42 | [Template] Acquire Lock On Resource |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 43 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 44 | # client_id lock_type reboot_flag |
| 45 | HMCID-01 ReadCase1 True |
| 46 | HMCID-01 ReadCase2 True |
| 47 | HMCID-01 ReadCase3 True |
| 48 | HMCID-01 WriteCase1 True |
| 49 | HMCID-01 WriteCase2 True |
| 50 | HMCID-01 WriteCase3 True |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 51 | |
| 52 | |
Sushil Singh | 8d420bf | 2021-09-06 08:27:41 -0500 | [diff] [blame] | 53 | Check After Reboot Transaction ID Set To Default |
| 54 | [Documentation] After reboot, the transaction id starts with default i.e. 1, |
| 55 | ... if any lock is aquired. |
| 56 | [Tags] Check_After_Reboot_Transaction_ID_Set_To_Default |
| 57 | [Template] Verify Acquire And Release Lock In Loop |
| 58 | |
| 59 | # client_id lock_type reboot_flag |
| 60 | HMCID-01 ReadCase1 True |
| 61 | HMCID-01 WriteCase1 True |
| 62 | |
| 63 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 64 | Acquire Read Lock On Read Lock |
| 65 | [Documentation] Acquire read lock on another read lock. |
| 66 | [Tags] Acquire_Read_Lock_On_Read_Lock |
| 67 | [Template] Acquire Lock On Another Lock |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 68 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 69 | # client_id |
| 70 | HMCID-01 |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 71 | |
| 72 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 73 | Fail To Acquire Lock On Another Lock |
| 74 | [Documentation] Fail to acquire another lock. |
| 75 | [Tags] Fail_To_Acquire_Lock_On_Another_Lock |
| 76 | [Template] Verify Acquire Lock Fails On Another Lock |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 77 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 78 | # client_id lock_type |
| 79 | HMCID-01 ReadCase2,WriteCase2 |
| 80 | HMCID-01 WriteCase2,WriteCase2 |
| 81 | HMCID-01 WriteCase2,ReadCase2 |
George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 82 | |
| 83 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 84 | Acquire Lock After Reboot |
| 85 | [Documentation] Acquire and release read and write locks after reboot. |
| 86 | [Tags] Acquire_Lock_After_Reboot |
| 87 | [Template] Verify Acquire Lock After Reboot |
| 88 | |
| 89 | # client_id lock_type |
| 90 | HMCID-01 ReadCase1 |
| 91 | HMCID-01 ReadCase2 |
| 92 | HMCID-01 ReadCase3 |
| 93 | HMCID-01 WriteCase1 |
| 94 | HMCID-01 WriteCase2 |
| 95 | HMCID-01 WriteCase3 |
| 96 | |
| 97 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 98 | Acquire And Release Lock In Loop |
| 99 | [Documentation] Acquire and release read, write locks in loop. |
| 100 | [Tags] Acquire_And_Release_Lock_In_Loop |
| 101 | [Template] Verify Acquire And Release Lock In Loop |
George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 102 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 103 | # client_id lock_type |
| 104 | HMCID-01 ReadCase1 |
| 105 | HMCID-01 ReadCase2 |
| 106 | HMCID-01 ReadCase3 |
| 107 | HMCID-01 WriteCase1 |
| 108 | HMCID-01 WriteCase2 |
| 109 | HMCID-01 WriteCase3 |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 110 | |
| 111 | |
Sushil Singh | 977f8f5 | 2020-11-20 06:32:50 -0600 | [diff] [blame] | 112 | Fail To Acquire Read And Write In Single Request |
| 113 | [Documentation] Fail to acquire read and write lock in single request. |
| 114 | [Tags] Fail_To_Acquire_Read_And_Write_In_Single_Request |
| 115 | [Template] Verify Fail To Acquire Read And Write In Single Request |
| 116 | |
| 117 | # client_id lock_type |
| 118 | HMCID-01 ReadCase1,WriteCase1 |
| 119 | HMCID-01 WriteCase1,ReadCase1 |
| 120 | |
| 121 | |
Sushil Singh | df390b6 | 2021-01-19 00:50:05 -0600 | [diff] [blame] | 122 | Acquire Multiple Lock Request At CEC Level |
| 123 | [Documentation] Acquire write lock on read lock under CEC level. |
| 124 | [Tags] Acquire_Multiple_Lock_Request_At_CEC_Level |
| 125 | [Template] Verify Acquire Multiple Lock Request At CEC Level |
| 126 | |
| 127 | # client_id lock_type |
| 128 | HMCID-01 ReadCase4,WriteCase4 |
| 129 | HMCID-01 WriteCase5,ReadCase5 |
| 130 | HMCID-01 ReadCase6,WriteCase6 |
| 131 | HMCID-01 WriteCase7,ReadCase7 |
| 132 | |
| 133 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 134 | Verify Release Of Valid Locks |
| 135 | [Documentation] Release all valid locks. |
| 136 | [Tags] Verify_Release_Of_Valid_Locks |
| 137 | [Template] Acquire And Release Multiple Locks |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 138 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 139 | # client_id lock_type release_lock_type |
| 140 | HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction |
| 141 | HMCID-02 ReadCase1,ReadCase1,ReadCase1 Session |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 142 | |
| 143 | |
susilsi7 | 94116c6 | 2021-03-04 07:57:51 -0600 | [diff] [blame] | 144 | Release Lock When Session Deleted |
| 145 | [Documentation] Release lock when session gets deleted. |
| 146 | [Tags] Release_Lock_When_Session_Deleted |
| 147 | [Template] Verify Release Lock When Session Deleted |
| 148 | |
| 149 | # client_id lock_type |
| 150 | HMCID-01 ReadCase1 |
| 151 | HMCID-01 WriteCase1 |
| 152 | |
| 153 | |
Sushil Singh | 59011d0 | 2021-01-27 23:00:20 -0600 | [diff] [blame] | 154 | Fail To Release Lock With Invalid TransactionID |
| 155 | [Documentation] Fail to release lock with invalid transaction id. |
| 156 | [Tags] Fail_To_Release_Lock_With_Invalid_TransactionID |
| 157 | [Template] Verify Fail To Release Lock With Invalid TransactionID |
| 158 | |
susilsi7 | 43b0c06 | 2021-03-02 04:24:19 -0600 | [diff] [blame] | 159 | # client_id lock_type release_lock_type |
| 160 | HMCID-01 ReadCase1 Transaction |
| 161 | HMCID-01 WriteCase1 Transaction |
Sushil Singh | 59011d0 | 2021-01-27 23:00:20 -0600 | [diff] [blame] | 162 | |
| 163 | |
Sushil Singh | 1b59053 | 2021-01-20 05:13:54 -0600 | [diff] [blame] | 164 | Fail To Release Multiple Lock With Invalid TransactionID |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 165 | [Documentation] Release in-valid lock result in fail. |
Sushil Singh | 1b59053 | 2021-01-20 05:13:54 -0600 | [diff] [blame] | 166 | [Tags] Fail_To_Release_Multiple_Lock_With_Invalid_TransactionID |
| 167 | [Template] Verify Fail To Release Multiple Lock With Invalid TransactionID |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 168 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 169 | # client_id lock_type release_lock_type |
| 170 | HMCID-01 ReadCase1,ReadCase1,ReadCase1 Transaction |
| 171 | 12345 ReadCase2,ReadCase2,ReadCase2 Transaction |
| 172 | HMCID ReadCase3,ReadCase3,ReadCase3 Transaction |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 173 | |
| 174 | |
Sushil Singh | 8bee358 | 2021-01-27 23:46:48 -0600 | [diff] [blame] | 175 | Fail To Release Multiple Lock With Valid And Invalid TransactionID |
George Keishing | 9614383 | 2021-03-23 07:55:08 -0500 | [diff] [blame] | 176 | [Documentation] Release multiple lock with valid and invalid transaction. |
Sushil Singh | 8bee358 | 2021-01-27 23:46:48 -0600 | [diff] [blame] | 177 | [Tags] Fail_To_Release_Multiple_Lock_With_Valid_And_Invalid_TransactionID |
| 178 | [Template] Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID |
| 179 | |
| 180 | # client_id lock_type release_lock_type |
| 181 | HMCID-01 ReadCase1,ReadCase1 Transaction |
| 182 | |
| 183 | |
susilsi7 | 1d7b996 | 2021-03-02 03:06:18 -0600 | [diff] [blame] | 184 | Fail To Release Lock With String As TransactionID Data Type |
| 185 | [Documentation] Fail to release lock with string as transaction id data type. |
| 186 | [Tags] Fail_To_Release_Lock_With_String_As_TransactionID_Data_Type |
| 187 | [Template] Verify Fail To Release Lock With TransactionID As String Type |
| 188 | |
| 189 | # client_id lock_type release_lock_type |
| 190 | HMCID-01 ReadCase1 Transaction |
| 191 | HMCID-01 WriteCase1 Transaction |
| 192 | |
| 193 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 194 | Fail To Release Lock For Another Session |
| 195 | [Documentation] Failed to release locks from another session. |
| 196 | [Tags] Fail_To_Release_Lock_For_Another_Session |
| 197 | [Template] Verify Fail To Release Lock For Another Session |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 198 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 199 | # client_id lock_type |
| 200 | HMCID-01,HMCID-02 ReadCase1,ReadCase1 |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 201 | |
| 202 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 203 | Test Invalid Resource ID Data Type Locking |
| 204 | [Documentation] Failed to acquire lock for invalid resource id data type. |
| 205 | [Tags] Test_Invalid_Resource_ID_Data_Type_Locking |
| 206 | [Template] Verify Fail To Acquire Lock For Invalid Resource ID Data Type |
| 207 | |
| 208 | # client_id lock_type |
| 209 | HMCID-01 ReadCase1 |
| 210 | HMCID-01 ReadCase2 |
| 211 | HMCID-01 ReadCase3 |
| 212 | HMCID-01 WriteCase1 |
| 213 | HMCID-01 WriteCase2 |
| 214 | HMCID-01 WriteCase3 |
| 215 | |
| 216 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 217 | Fail To Acquire Lock For Invalid Lock Type |
| 218 | [Documentation] Failed to acquire read, write lock for invalid lock data passed. |
| 219 | [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Type |
| 220 | [Template] Verify Fail To Acquire Lock For Invalid Lock Data |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 221 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 222 | # client_id lock_type message |
| 223 | HMCID-01 ReadCase1 ${BAD_REQUEST} |
| 224 | HMCID-01 ReadCase2 ${BAD_REQUEST} |
| 225 | HMCID-01 ReadCase3 ${BAD_REQUEST} |
| 226 | HMCID-01 ReadCase4 ${BAD_REQUEST} |
| 227 | HMCID-01 ReadCase5 ${BAD_REQUEST} |
| 228 | HMCID-01 WriteCase1 ${BAD_REQUEST} |
| 229 | HMCID-01 WriteCase2 ${BAD_REQUEST} |
| 230 | HMCID-01 WriteCase3 ${BAD_REQUEST} |
| 231 | HMCID-01 WriteCase4 ${BAD_REQUEST} |
| 232 | HMCID-01 WriteCase5 ${BAD_REQUEST} |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 233 | |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 234 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 235 | Fail To Acquire Lock For Invalid Lock Flag |
| 236 | [Documentation] Failed to acquire read write lock for invalid lock flag passed. |
| 237 | [Tags] Fail_To_Acquire_Lock_For_Invalid_Lock_Flag |
| 238 | [Template] Verify Fail To Acquire Lock For Invalid Lock Data |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 239 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 240 | # client_id lock_type message |
| 241 | HMCID-01 ReadCase6 ${BAD_REQUEST} |
| 242 | HMCID-01 ReadCase7 ${BAD_REQUEST} |
| 243 | HMCID-01 ReadCase8 ${BAD_REQUEST} |
| 244 | HMCID-01 ReadCase9 ${BAD_REQUEST} |
| 245 | HMCID-01 ReadCase10 ${BAD_REQUEST} |
| 246 | HMCID-01 ReadCase11 ${BAD_REQUEST} |
| 247 | HMCID-01 WriteCase6 ${BAD_REQUEST} |
| 248 | HMCID-01 WriteCase7 ${BAD_REQUEST} |
| 249 | HMCID-01 WriteCase8 ${BAD_REQUEST} |
| 250 | HMCID-01 WriteCase9 ${BAD_REQUEST} |
| 251 | HMCID-01 WriteCase10 ${BAD_REQUEST} |
| 252 | HMCID-01 WriteCase11 ${BAD_REQUEST} |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 253 | |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 254 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 255 | Fail To Acquire Lock For Invalid Segment Flag |
| 256 | [Documentation] Failed to acquire read write lock for invalid segment flag passed. |
| 257 | [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Flag |
| 258 | [Template] Verify Fail To Acquire Lock For Invalid Lock Data |
| 259 | |
| 260 | # client_id lock_type message |
| 261 | HMCID-01 ReadCase12 ${BAD_REQUEST} |
| 262 | HMCID-01 ReadCase13 ${BAD_REQUEST} |
| 263 | HMCID-01 ReadCase14 ${BAD_REQUEST} |
| 264 | HMCID-01 WriteCase12 ${BAD_REQUEST} |
| 265 | HMCID-01 WriteCase13 ${BAD_REQUEST} |
| 266 | HMCID-01 WriteCase14 ${BAD_REQUEST} |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 267 | |
Sushil Singh | bace300 | 2020-10-08 08:12:58 -0500 | [diff] [blame] | 268 | |
Sushil Singh | 3b3a7ec | 2020-11-23 03:54:06 -0600 | [diff] [blame] | 269 | Fail To Acquire Lock For Invalid Segment Data Type Flag |
| 270 | [Documentation] Failed to acquire read write lock for invalid segment flag passed. |
| 271 | [Tags] Fail_To_Acquire_Lock_For_Invalid_Segment_Data_Type_Flag |
| 272 | [Template] Verify Fail To Acquire Lock For Invalid Lock Data |
| 273 | |
| 274 | # client_id lock_type message |
| 275 | HMCID-01 ReadCase15 ${EMPTY} |
| 276 | HMCID-01 ReadCase16 ${EMPTY} |
| 277 | HMCID-01 ReadCase17 ${EMPTY} |
| 278 | HMCID-01 ReadCase18 ${EMPTY} |
| 279 | HMCID-01 WriteCase15 ${EMPTY} |
| 280 | HMCID-01 WriteCase16 ${EMPTY} |
| 281 | HMCID-01 WriteCase17 ${EMPTY} |
| 282 | HMCID-01 WriteCase18 ${EMPTY} |
| 283 | |
| 284 | |
Sushil Singh | bace300 | 2020-10-08 08:12:58 -0500 | [diff] [blame] | 285 | Get Empty Lock Records For Session Where No Locks Acquired |
| 286 | [Documentation] If session does not acquire locks then get lock should return |
| 287 | ... empty lock records. |
| 288 | [Tags] Get_Empty_Lock_Records_For_Session_Where_No_Locks_Acquired |
| 289 | [Template] Verify No Locks Records For Session With No Acquired Lock |
| 290 | |
| 291 | # client_id |
| 292 | HMCID-01 |
| 293 | |
Sushil Singh | 728ef9c | 2020-10-28 04:25:39 -0500 | [diff] [blame] | 294 | |
Sushil Singh | f9a536c | 2020-11-09 07:33:17 -0600 | [diff] [blame] | 295 | Get Lock Records Empty For Invalid Session |
| 296 | [Documentation] Record of lock list is empty for invalid session. |
| 297 | [Tags] Get_Lock_Records_Empty_For_Invalid_Session |
| 298 | [Template] Verify Empty Lock Records For Invalid Session |
| 299 | |
| 300 | # client_id |
| 301 | HMCID-01 |
| 302 | |
| 303 | |
Sushil Singh | 728ef9c | 2020-10-28 04:25:39 -0500 | [diff] [blame] | 304 | Get Lock Records For Multiple Session |
| 305 | [Documentation] Get lock records of multiple session. |
| 306 | [Tags] Get_Lock_Records_For_Multiple_Session |
| 307 | [Template] Verify Lock Records Of Multiple Session |
| 308 | |
| 309 | # client_ids lock_type |
| 310 | HMCID-01,HMCID-02 ReadCase1,ReadCase1 |
| 311 | |
| 312 | |
Sushil Singh | f9a536c | 2020-11-09 07:33:17 -0600 | [diff] [blame] | 313 | Get Lock Records For Multiple Invalid Session |
| 314 | [Documentation] Record of lock list is empty for list of invalid session. |
| 315 | [Tags] Get_Lock_Records_For_Multiple_Invalid_Session |
| 316 | [Template] Verify Lock Records For Multiple Invalid Session |
| 317 | |
| 318 | # client_id |
| 319 | HMCID-01 |
| 320 | |
Sushil Singh | 11949a2 | 2020-11-13 06:12:16 -0600 | [diff] [blame] | 321 | |
| 322 | Get Lock Records For Multiple Invalid And Valid Session |
| 323 | [Documentation] Get record of lock from invalid and valid session. |
| 324 | [Tags] Get_Lock_Records_For_Multiple_Invalid_And_Valid_Session |
| 325 | [Template] Verify Lock Records For Multiple Invalid And Valid Session |
| 326 | |
| 327 | # client_id lock_type |
| 328 | HMCID-01,HMCID-02 ReadCase1 |
| 329 | |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 330 | *** Keywords *** |
| 331 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 332 | Create Redfish Session With ClientID |
| 333 | [Documentation] Create redifish session with client id. |
| 334 | [Arguments] ${client_id} |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 335 | |
| 336 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 337 | # client_id This client id can contain string value |
| 338 | # (e.g. 12345, "HMCID"). |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 339 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 340 | ${session_info}= Create Dictionary |
| 341 | ${session}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}} |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 342 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 343 | Set To Dictionary ${session_info} SessionIDs ${session['Id']} |
| 344 | Set To Dictionary ${session_info} ClientID ${session["Oem"]["OpenBMC"]["ClientID"]} |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 345 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 346 | [Return] ${session_info} |
Vijay | 85610ee | 2020-04-03 05:30:28 -0500 | [diff] [blame] | 347 | |
| 348 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 349 | RW General Dictionary |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 350 | [Documentation] Create dictionary of lock request. |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 351 | [Arguments] ${read_case} ${res_id} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 352 | |
| 353 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 354 | # read_case Read or Write lock type. |
| 355 | # res_id Resource id. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 356 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 357 | ${request_dict}= Create Dictionary |
George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 358 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 359 | FOR ${key} IN @{read_case.keys()} |
| 360 | Set To Dictionary ${request_dict} LockType ${key} |
| 361 | Set To Dictionary ${request_dict} SegmentFlags ${read_case["${key}"]} |
| 362 | END |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 363 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 364 | Set To Dictionary ${request_dict} ResourceID ${res_id} |
| 365 | |
| 366 | [Return] ${request_dict} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 367 | |
| 368 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 369 | Return Description Of Response |
| 370 | [Documentation] Return description of REST response. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 371 | [Arguments] ${resp_text} |
| 372 | |
| 373 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 374 | # resp_text REST response body. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 375 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 376 | # resp_text after successful partition file upload looks like: |
| 377 | # { |
| 378 | # "Description": "File Created" |
| 379 | # } |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 380 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 381 | ${message}= Evaluate json.loads('''${resp_text}''') json |
| 382 | |
| 383 | [Return] ${message} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 384 | |
| 385 | |
Sushil Singh | a7d71f0 | 2020-11-02 05:24:22 -0600 | [diff] [blame] | 386 | Verify Redfish Session Deleted |
| 387 | [Documentation] Verify the redfish session is deleted. |
| 388 | [Arguments] ${session_info} |
| 389 | |
| 390 | # Description of argument(s): |
| 391 | # session_info Session information are stored in dictionary. |
| 392 | |
| 393 | # ${session_info} = { |
| 394 | # 'SessionIDs': 'XXXXXXXXX', |
| 395 | # 'ClientID': 'XXXXXX', |
| 396 | # 'SessionToken': 'XXXXXXXXX', |
| 397 | # 'SessionResp': session response from redfish login |
| 398 | # } |
| 399 | |
| 400 | # SessionIDs : Session IDs |
| 401 | # ClientID : Client ID |
| 402 | # SessionToken : Session token |
| 403 | # SessionResp : Response of creating an redfish login session |
| 404 | |
| 405 | ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions |
| 406 | |
| 407 | FOR ${session} IN @{sessions['Members']} |
Sushil Singh | 8a3efe7 | 2021-08-26 08:16:41 -0500 | [diff] [blame] | 408 | Should Not Be Equal As Strings |
| 409 | ... session ['/redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}'] |
Sushil Singh | a7d71f0 | 2020-11-02 05:24:22 -0600 | [diff] [blame] | 410 | END |
| 411 | |
| 412 | |
| 413 | Verify Redfish List Of Session Deleted |
| 414 | [Documentation] Verify all the list of redfish session is deleted. |
| 415 | [Arguments] ${session_info_list} |
| 416 | |
| 417 | # Description of argument(s): |
| 418 | # session_info_list List contains individual session record are stored in dictionary. |
| 419 | |
| 420 | # ${session_info_list} = [{ |
| 421 | # 'SessionIDs': 'XXXXXXXXX', |
| 422 | # 'ClientID': 'XXXXXX', |
| 423 | # 'SessionToken': 'XXXXXXXXX', |
| 424 | # 'SessionResp': session response from redfish login |
| 425 | # }] |
| 426 | |
| 427 | # SessionIDs : Session IDs |
| 428 | # ClientID : Client ID |
| 429 | # SessionToken : Session token |
| 430 | # SessionResp : Response of creating an redfish login session |
| 431 | |
| 432 | FOR ${session_record} IN @{session_info_list} |
| 433 | Verify Redfish Session Deleted ${session_record} |
| 434 | END |
| 435 | |
| 436 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 437 | Redfish Post Acquire Lock |
| 438 | [Documentation] Acquire and release lock. |
| 439 | [Arguments] ${lock_type} ${status_code}=${HTTP_OK} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 440 | |
| 441 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 442 | # lock_type Read lock or Write lock. |
| 443 | # status_code HTTP status code. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 444 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 445 | ${lock_dict_param}= Form Data To Acquire Lock ${lock_type} |
Sushil Singh | 8a3efe7 | 2021-08-26 08:16:41 -0500 | [diff] [blame] | 446 | ${resp}= Redfish Post Request |
| 447 | ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 448 | Should Be Equal As Strings ${resp.status_code} ${status_code} |
Sushil Singh | df390b6 | 2021-01-19 00:50:05 -0600 | [diff] [blame] | 449 | |
| 450 | Run Keyword If ${status_code} == ${HTTP_BAD_REQUEST} |
| 451 | ... Valid Value ${BAD_REQUEST} ['${resp.content}'] |
| 452 | ... ELSE |
| 453 | ... Run Keyword And Return Return Description Of Response ${resp.content} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 454 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 455 | [Return] ${resp} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 456 | |
| 457 | |
Sushil Singh | 977f8f5 | 2020-11-20 06:32:50 -0600 | [diff] [blame] | 458 | Redfish Post Acquire List Lock |
| 459 | [Documentation] Acquire and release lock. |
| 460 | [Arguments] ${lock_type} ${status_code}=${HTTP_OK} |
| 461 | |
| 462 | # Description of argument(s): |
| 463 | # lock_type Read lock or Write lock. |
| 464 | # status_code HTTP status code. |
| 465 | |
| 466 | ${lock_dict_param}= Create Data To Acquire List Of Lock ${lock_type} |
Sushil Singh | 8a3efe7 | 2021-08-26 08:16:41 -0500 | [diff] [blame] | 467 | ${resp}= Redfish Post Request |
| 468 | ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} |
Sushil Singh | 977f8f5 | 2020-11-20 06:32:50 -0600 | [diff] [blame] | 469 | Should Be Equal As Strings ${resp.status_code} ${status_code} |
| 470 | |
| 471 | [Return] ${resp} |
| 472 | |
| 473 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 474 | Redfish Post Acquire Invalid Lock |
| 475 | [Documentation] Redfish to post request to acquire in-valid lock. |
| 476 | [Arguments] ${lock_type} ${message} ${status_code}=${HTTP_OK} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 477 | |
| 478 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 479 | # lock_type Read lock or Write lock. |
| 480 | # message Return message from URI. |
| 481 | # status_code HTTP status code. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 482 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 483 | ${lock_dict_param}= Form Data To Acquire Invalid Lock ${lock_type} |
Sushil Singh | 8a3efe7 | 2021-08-26 08:16:41 -0500 | [diff] [blame] | 484 | ${resp}= Redfish Post Request |
| 485 | ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 486 | Should Be Equal As Strings ${resp.status_code} ${status_code} |
Sushil Singh | 3b3a7ec | 2020-11-23 03:54:06 -0600 | [diff] [blame] | 487 | Run Keyword If '${message}' != '${EMPTY}' |
| 488 | ... Valid Value message ['${resp.content}'] |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 489 | |
| 490 | [Return] ${resp} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 491 | |
| 492 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 493 | Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID |
| 494 | [Documentation] Redfish to post request to acquire in-valid lock with invalid data type of resource id. |
| 495 | [Arguments] ${lock_type} ${status_code}=${HTTP_OK} |
| 496 | |
| 497 | # Description of argument(s): |
| 498 | # lock_type Read lock or Write lock. |
| 499 | # status_code HTTP status code. |
| 500 | |
Sushil Singh | 8a3efe7 | 2021-08-26 08:16:41 -0500 | [diff] [blame] | 501 | ${lock_dict_param}= |
| 502 | ... Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID ${lock_type} |
| 503 | ${resp}= Redfish Post Request |
| 504 | ... /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param} |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 505 | Should Be Equal As Strings ${resp.status_code} ${status_code} |
| 506 | |
| 507 | [Return] ${resp} |
| 508 | |
| 509 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 510 | Form Data To Acquire Lock |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 511 | [Documentation] Create a dictionary for lock request. |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 512 | [Arguments] ${lock_type} |
| 513 | |
| 514 | # Description of argument(s): |
| 515 | # lock_type Read lock or Write lock. |
| 516 | |
| 517 | ${lock_res_info}= Get Lock Resource Information |
| 518 | ${resp}= RW General Dictionary |
| 519 | ... ${lock_res_info["Valid Case"]["${lock_type}"]} |
| 520 | ... ${lock_res_info["Valid Case"]["ResourceID"]} |
| 521 | ${temp_list}= Create List ${resp} |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 522 | ${lock_request_dict}= Create Dictionary Request=${temp_list} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 523 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 524 | [Return] ${lock_request_dict} |
| 525 | |
| 526 | |
Sushil Singh | 977f8f5 | 2020-11-20 06:32:50 -0600 | [diff] [blame] | 527 | Create Data To Acquire List Of Lock |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 528 | [Documentation] Create a dictionary for list of lock request. |
Sushil Singh | 977f8f5 | 2020-11-20 06:32:50 -0600 | [diff] [blame] | 529 | [Arguments] ${lock_type_list} |
| 530 | |
| 531 | # Description of argument(s): |
| 532 | # lock_type Read lock or Write lock. |
| 533 | |
| 534 | ${temp_list}= Create List |
| 535 | ${lock_res_info}= Get Lock Resource Information |
| 536 | |
| 537 | FOR ${lock_type} IN @{lock_type_list} |
| 538 | ${resp}= RW General Dictionary |
| 539 | ... ${lock_res_info["Valid Case"]["${lock_type}"]} |
| 540 | ... ${lock_res_info["Valid Case"]["ResourceID"]} |
| 541 | Append To List ${temp_list} ${resp} |
| 542 | END |
| 543 | |
| 544 | ${lock_request_dict}= Create Dictionary Request=${temp_list} |
| 545 | |
| 546 | [Return] ${lock_request_dict} |
| 547 | |
| 548 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 549 | Form Data To Acquire Invalid Lock With Invalid Data Type Of Resource ID |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 550 | [Documentation] Create a dictionary for in-valid lock request. |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 551 | [Arguments] ${lock_type} |
| 552 | |
| 553 | # Description of argument(s): |
| 554 | # lock_type Read lock or Write lock. |
| 555 | |
| 556 | ${lock_res_info}= Get Lock Resource Information |
| 557 | ${resp}= RW General Dictionary |
| 558 | ... ${lock_res_info["Valid Case"]["${lock_type}"]} |
| 559 | ... ${lock_res_info["Invalid Case"]["ResourceIDInvalidDataType"]} |
| 560 | ${temp_list}= Create List ${resp} |
| 561 | ${lock_request_dict}= Create Dictionary Request=${temp_list} |
| 562 | |
| 563 | [Return] ${lock_request_dict} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 564 | |
| 565 | |
| 566 | Form Data To Acquire Invalid Lock |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 567 | [Documentation] Create a dictionary for in-valid lock request. |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 568 | [Arguments] ${lock_type} |
| 569 | |
| 570 | # Description of argument(s): |
| 571 | # lock_type Read lock or Write lock. |
| 572 | |
| 573 | ${lock_res_info}= Get Lock Resource Information |
| 574 | ${resp}= RW General Dictionary |
| 575 | ... ${lock_res_info["Invalid Case"]["${lock_type}"]} |
| 576 | ... ${lock_res_info["Valid Case"]["ResourceID"]} |
| 577 | ${temp_list}= Create List ${resp} |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 578 | ${lock_request_dict}= Create Dictionary Request=${temp_list} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 579 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 580 | [Return] ${lock_request_dict} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 581 | |
| 582 | |
| 583 | Get Locks List On Resource |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 584 | [Documentation] Get locks list. |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 585 | [Arguments] ${session_info} ${exp_status_code}=${HTTP_OK} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 586 | |
| 587 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 588 | # session_info Session information in dict. |
| 589 | # exp_status_code Expected HTTP status code. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 590 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 591 | ${data}= Set Variable {"SessionIDs": ["${session_info['SessionIDs']}"]} |
George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 592 | ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList |
| 593 | ... data=${data} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 594 | ${locks}= Evaluate json.loads('''${resp.text}''') json |
| 595 | |
| 596 | [Return] ${locks["Records"]} |
| 597 | |
| 598 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 599 | Verify Lock On Resource |
| 600 | [Documentation] Verify lock on resource. |
| 601 | [Arguments] ${session_info} ${transaction_id} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 602 | |
| 603 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 604 | # session_info Session information in dict. |
| 605 | # transaction_id Transaction id in list stored in dict. |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 606 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 607 | ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']} |
| 608 | Rprint Vars sessions |
| 609 | ${lock_list}= Get Locks List On Resource ${session_info} |
| 610 | ${lock_length}= Get Length ${lock_list} |
| 611 | ${tran_id_length}= Get Length ${transaction_id} |
| 612 | Should Be Equal As Integers ${tran_id_length} ${lock_length} |
Vijay | afdd2a1 | 2020-04-09 02:03:20 -0500 | [diff] [blame] | 613 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 614 | FOR ${tran_id} ${lock} IN ZIP ${transaction_id} ${lock_list} |
| 615 | Valid Value session_info['ClientID'] ['${lock['HMCID']}'] |
| 616 | Valid Value session_info['SessionIDs'] ['${lock['SessionID']}'] |
| 617 | Should Be Equal As Integers ${tran_id['TransactionID']} ${lock['TransactionID']} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 618 | END |
| 619 | |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 620 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 621 | Acquire Lock On Resource |
| 622 | [Documentation] Acquire lock on resource. |
| 623 | [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 624 | |
| 625 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 626 | # client_id This client id can contain string value |
| 627 | # (e.g. 12345, "HMCID"). |
| 628 | # lock_type Read lock or Write lock. |
| 629 | # reboot_flag Flag is used to run reboot the BMC code. |
| 630 | # (e.g. True or False). |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 631 | |
Sushil Singh | 8a3efe7 | 2021-08-26 08:16:41 -0500 | [diff] [blame] | 632 | ${trans_id_emptylist}= Create List |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 633 | ${trans_id_list}= Create List |
Sushil Singh | 8a3efe7 | 2021-08-26 08:16:41 -0500 | [diff] [blame] | 634 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 635 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 636 | ${trans_id}= Redfish Post Acquire Lock ${lock_type} |
| 637 | Append To List ${trans_id_list} ${trans_id} |
Sushil Singh | 8a3efe7 | 2021-08-26 08:16:41 -0500 | [diff] [blame] | 638 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 639 | Verify Lock On Resource ${session_info} ${trans_id_list} |
George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 640 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 641 | ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 642 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 643 | Run Keyword If '${reboot_flag}' == 'True' |
Sushil Singh | 8a3efe7 | 2021-08-26 08:16:41 -0500 | [diff] [blame] | 644 | ... Run Keywords Redfish BMC Reset Operation AND |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 645 | ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND |
Sushil Singh | 8a3efe7 | 2021-08-26 08:16:41 -0500 | [diff] [blame] | 646 | ... Is BMC Standby AND |
| 647 | ... Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 648 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 649 | Run Keyword If '${reboot_flag}' == 'False' |
| 650 | ... Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 651 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 652 | ${trans_id_emptylist}= Create List |
| 653 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 654 | Redfish Delete Session ${session_info} |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 655 | |
Vijay | bc331e2 | 2020-02-27 04:17:37 -0600 | [diff] [blame] | 656 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 657 | Form Data To Release Lock |
| 658 | [Documentation] Create a dictonay to release lock. |
| 659 | [Arguments] ${trans_id_list} |
Vijay | 355daac | 2020-03-26 12:06:08 -0500 | [diff] [blame] | 660 | |
| 661 | # Description of argument(s): |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 662 | # trans_id_list |
Vijay | 355daac | 2020-03-26 12:06:08 -0500 | [diff] [blame] | 663 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 664 | @{tran_ids}= Create List |
Vijay | 355daac | 2020-03-26 12:06:08 -0500 | [diff] [blame] | 665 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 666 | FOR ${item} IN @{trans_id_list} |
| 667 | Append To List ${tran_ids} ${item['TransactionID']} |
| 668 | END |
| 669 | |
| 670 | [Return] ${tran_ids} |
| 671 | |
| 672 | |
| 673 | Release Locks On Resource |
| 674 | [Documentation] Redfish request to release a lock. |
Sushil Singh | 8a3efe7 | 2021-08-26 08:16:41 -0500 | [diff] [blame] | 675 | [Arguments] ${session_info} ${trans_id_list} ${release_lock_type}=Transaction |
| 676 | ... ${status_code}=${HTTP_OK} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 677 | |
| 678 | # Description of argument(s): |
| 679 | # session_info Session information in dict. |
| 680 | # trans_id_list Transaction id list. |
| 681 | # release_lock_type Release lock by Transaction, Session. |
| 682 | # status_code HTTP status code. |
| 683 | |
| 684 | ${tran_ids}= Form Data To Release Lock ${trans_id_list} |
| 685 | ${data}= Set Variable {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}} |
| 686 | ${data}= Evaluate json.dumps(${data}) json |
| 687 | ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data} |
| 688 | Should Be Equal As Strings ${resp.status_code} ${status_code} |
| 689 | |
| 690 | |
Sushil Singh | df390b6 | 2021-01-19 00:50:05 -0600 | [diff] [blame] | 691 | Release locks And Delete Session |
| 692 | [Documentation] Release locks and delete redfish session. |
| 693 | [Arguments] ${session_info} ${trans_id_list} |
| 694 | |
| 695 | Release Locks On Resource ${session_info} ${trans_id_list} |
| 696 | |
| 697 | ${trans_id_emptylist}= Create List |
| 698 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 699 | |
| 700 | Redfish Delete Session ${session_info} |
| 701 | |
| 702 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 703 | Acquire Lock On Another Lock |
| 704 | [Documentation] Acquire lock on another lock. |
| 705 | [Arguments] ${client_id} |
| 706 | |
| 707 | # Description of argument(s): |
| 708 | # client_id This client id can contain string value |
| 709 | # (e.g. 12345, "HMCID"). |
| 710 | |
| 711 | ${trans_id_list}= Create List |
| 712 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 713 | |
| 714 | ${trans_id}= Redfish Post Acquire Lock ReadCase1 |
| 715 | Append To List ${trans_id_list} ${trans_id} |
| 716 | |
| 717 | ${trans_id}= Redfish Post Acquire Lock ReadCase1 |
| 718 | Append To List ${trans_id_list} ${trans_id} |
| 719 | |
| 720 | Verify Lock On Resource ${session_info} ${trans_id_list} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 721 | |
Sushil Singh | df390b6 | 2021-01-19 00:50:05 -0600 | [diff] [blame] | 722 | Release locks And Delete Session ${session_info} ${trans_id_list} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 723 | |
| 724 | |
Sushil Singh | 977f8f5 | 2020-11-20 06:32:50 -0600 | [diff] [blame] | 725 | Verify Fail To Acquire Read And Write In Single Request |
| 726 | [Documentation] Verify fail to acquire read and write lock passed in single request. |
| 727 | [Arguments] ${client_id} ${lock_type} |
| 728 | |
| 729 | # Description of argument(s): |
| 730 | # client_id This client id can contain string value |
| 731 | # (e.g. 12345, "HMCID"). |
| 732 | # lock_type Read lock or Write lock. |
| 733 | |
| 734 | ${lock_type_list}= Split String ${lock_type} , |
| 735 | |
| 736 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 737 | ${trans_id}= Redfish Post Acquire List Lock ${lock_type_list} status_code=${HTTP_BAD_REQUEST} |
| 738 | Redfish Delete Session ${session_info} |
| 739 | |
| 740 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 741 | Verify Empty Lock Records For Invalid Session |
| 742 | [Documentation] Verify no lock record found for invalid session. |
| 743 | [Arguments] ${client_id} |
| 744 | |
| 745 | # Description of argument(s): |
| 746 | # client_id This client id can contain string value |
| 747 | # (e.g. 12345, "HMCID"). |
| 748 | |
| 749 | ${session_info1}= Create Redfish Session With ClientID ${client_id} |
| 750 | |
| 751 | ${lock_list1}= Get Locks List On Resource ${session_info1} |
| 752 | ${lock_length1}= Get Length ${lock_list1} |
| 753 | |
| 754 | ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True |
| 755 | set to dictionary ${session_info2} SessionIDs xxyXyyYZZz |
| 756 | |
| 757 | ${lock_list2}= Get Locks List On Resource ${session_info2} |
Sushil Singh | f9a536c | 2020-11-09 07:33:17 -0600 | [diff] [blame] | 758 | ${lock_length2}= Get Length ${lock_list2} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 759 | |
Sushil Singh | f9a536c | 2020-11-09 07:33:17 -0600 | [diff] [blame] | 760 | Should Be Equal As Integers ${lock_length1} ${lock_length2} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 761 | |
| 762 | Redfish Delete Session ${session_info1} |
| 763 | |
| 764 | |
| 765 | Verify Acquire Lock Fails On Another Lock |
| 766 | [Documentation] Verify acquire lock on another lock fails. |
| 767 | [Arguments] ${client_id} ${lock_type} |
| 768 | |
| 769 | # Description of argument(s): |
| 770 | # client_id This client id can contain string value |
| 771 | # (e.g. 12345, "HMCID"). |
| 772 | # lock_type Read lock or Write lock. |
| 773 | |
| 774 | @{lock_type_list}= Split String ${lock_type} , |
| 775 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 776 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 777 | |
| 778 | ${trans_id_list}= Create List |
| 779 | Append To List ${trans_id_list} ${trans_id} |
| 780 | |
| 781 | Verify Lock On Resource ${session_info} ${trans_id_list} |
| 782 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 783 | |
Sushil Singh | df390b6 | 2021-01-19 00:50:05 -0600 | [diff] [blame] | 784 | Release locks And Delete Session ${session_info} ${trans_id_list} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 785 | |
| 786 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 787 | Verify Acquire Lock After Reboot |
| 788 | [Documentation] Acquire read and write lock after the reboot and release lock. |
| 789 | [Arguments] ${client_id} ${lock_type} |
| 790 | |
| 791 | # Description of argument(s): |
| 792 | # client_id This client id can contain string value |
| 793 | # (e.g. 12345, "HMCID"). |
| 794 | # lock_type Read lock or Write lock. |
| 795 | |
| 796 | ${trans_id_list}= Create List |
Sushil Singh | f9a536c | 2020-11-09 07:33:17 -0600 | [diff] [blame] | 797 | ${session_info}= Create Session With ClientID ${client_id} |
Sushil Singh | ac229c7 | 2021-09-13 02:26:51 -0500 | [diff] [blame] | 798 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 799 | ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} |
Sushil Singh | ac229c7 | 2021-09-13 02:26:51 -0500 | [diff] [blame] | 800 | Redfish BMC Reset Operation |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 801 | Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} |
Sushil Singh | ac229c7 | 2021-09-13 02:26:51 -0500 | [diff] [blame] | 802 | Is BMC Standby |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 803 | |
| 804 | ${trans_id}= Redfish Post Acquire Lock ${lock_type} |
| 805 | Append To List ${trans_id_list} ${trans_id} |
| 806 | Verify Lock On Resource ${session_info} ${trans_id_list} |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 807 | |
Sushil Singh | df390b6 | 2021-01-19 00:50:05 -0600 | [diff] [blame] | 808 | Release locks And Delete Session ${session_info} ${trans_id_list} |
| 809 | |
| 810 | |
| 811 | Verify Acquire Multiple Lock Request At CEC Level |
| 812 | [Documentation] Acquire lock in loop. |
| 813 | [Arguments] ${client_id} ${lock_type} |
| 814 | |
| 815 | # Description of argument(s): |
| 816 | # client_id This client id can contain string value |
| 817 | # (e.g. 12345, "HMCID"). |
| 818 | # lock_type Read lock or Write lock. |
| 819 | |
| 820 | ${trans_id_list}= Create List |
| 821 | @{lock_type_list}= Split String ${lock_type} , |
| 822 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 823 | |
| 824 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 825 | Append To List ${trans_id_list} ${trans_id} |
| 826 | |
| 827 | Verify Lock On Resource ${session_info} ${trans_id_list} |
| 828 | |
| 829 | Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT} |
| 830 | |
| 831 | Release locks And Delete Session ${session_info} ${trans_id_list} |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 832 | |
| 833 | |
Sushil Singh | 8d420bf | 2021-09-06 08:27:41 -0500 | [diff] [blame] | 834 | Post Reboot Acquire Lock |
| 835 | [Documentation] Post reboot acquire lock and verify the transaction id is 1. |
| 836 | [Arguments] ${session_info} ${lock_type} |
| 837 | |
| 838 | # Description of argument(s): |
| 839 | # session_info Session information. |
| 840 | # lock_type Read lock or Write lock. |
| 841 | |
| 842 | ${trans_id_list}= Create List |
| 843 | ${trans_id_list_var}= Create List |
| 844 | ${trans_id}= Redfish Post Acquire Lock ${lock_type} |
| 845 | Append To List ${trans_id_list} ${trans_id} |
| 846 | Append To List ${trans_id_list_var} ${default_trans_id} |
| 847 | Verify Lock On Resource ${session_info} ${trans_id_list} |
| 848 | Verify Lock On Resource ${session_info} ${trans_id_list_var} |
| 849 | Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} |
| 850 | ${trans_id_emptylist}= Create List |
| 851 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 852 | |
| 853 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 854 | Verify Acquire And Release Lock In Loop |
| 855 | [Documentation] Acquire lock in loop. |
Sushil Singh | 8d420bf | 2021-09-06 08:27:41 -0500 | [diff] [blame] | 856 | [Arguments] ${client_id} ${lock_type} ${reboot_flag}=False |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 857 | |
| 858 | # Description of argument(s): |
| 859 | # client_id This client id can contain string value |
| 860 | # (e.g. 12345, "HMCID"). |
| 861 | # lock_type Read lock or Write lock. |
Sushil Singh | 8d420bf | 2021-09-06 08:27:41 -0500 | [diff] [blame] | 862 | # reboot_flag Flag is used to run reboot the BMC code. |
| 863 | # (e.g. True or False). |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 864 | |
| 865 | FOR ${count} IN RANGE 1 11 |
| 866 | ${trans_id_list}= Create List |
| 867 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 868 | ${trans_id}= Redfish Post Acquire Lock ${lock_type} |
| 869 | Append To List ${trans_id_list} ${trans_id} |
| 870 | Verify Lock On Resource ${session_info} ${trans_id_list} |
| 871 | Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK} |
| 872 | ${trans_id_emptylist}= Create List |
| 873 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
Sushil Singh | 8d420bf | 2021-09-06 08:27:41 -0500 | [diff] [blame] | 874 | Redfish Delete Session ${session_info} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 875 | END |
| 876 | |
Sushil Singh | 8d420bf | 2021-09-06 08:27:41 -0500 | [diff] [blame] | 877 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 878 | ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} |
| 879 | |
| 880 | Run Keyword If '${reboot_flag}' == 'True' |
| 881 | ... Run Keywords Redfish BMC Reset Operation AND |
| 882 | ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND |
| 883 | ... Is BMC Standby AND |
| 884 | ... Post Reboot Acquire Lock ${session_info} ${lock_type} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 885 | Redfish Delete Session ${session_info} |
| 886 | |
| 887 | |
| 888 | Acquire And Release Multiple Locks |
| 889 | [Documentation] Acquire mutilple locks on resource. |
| 890 | [Arguments] ${client_id} ${lock_type} ${release_lock_type} |
| 891 | |
| 892 | # Description of argument(s): |
| 893 | # client_id This client id can contain string value |
| 894 | # (e.g. 12345, "HMCID"). |
| 895 | # lock_type Read lock or Write lock. |
| 896 | # release_lock_type The value can be Transaction or Session. |
| 897 | |
| 898 | @{lock_type_list}= Split String ${lock_type} , |
| 899 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 900 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 901 | |
| 902 | ${trans_id_list}= Create List |
| 903 | |
| 904 | Append To List ${trans_id_list} ${trans_id} |
| 905 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] |
| 906 | |
| 907 | Append To List ${trans_id_list} ${trans_id} |
| 908 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] |
| 909 | |
| 910 | Append To List ${trans_id_list} ${trans_id} |
| 911 | Verify Lock On Resource ${session_info} ${trans_id_list} |
| 912 | Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} |
| 913 | |
| 914 | ${trans_id_emptylist}= Create List |
| 915 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 916 | Redfish Delete Session ${session_info} |
| 917 | |
| 918 | |
susilsi7 | 94116c6 | 2021-03-04 07:57:51 -0600 | [diff] [blame] | 919 | Verify Release Lock When Session Deleted |
| 920 | [Documentation] Verify lock get released when session are deleted. |
| 921 | [Arguments] ${client_id} ${lock_type} |
| 922 | |
| 923 | # Description of argument(s): |
| 924 | # client_ids This client id can contain string value |
| 925 | # (e.g. 12345, "HMCID"). |
| 926 | # lock_type Read lock or Write lock. |
| 927 | |
| 928 | ${trans_id_list}= Create List |
| 929 | @{lock_type_list}= Split String ${lock_type} , |
| 930 | |
| 931 | ${pre_session_info}= Create Redfish Session With ClientID ${client_id} |
| 932 | |
| 933 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 934 | Append To List ${trans_id_list} ${trans_id} |
| 935 | Verify Lock On Resource ${pre_session_info} ${trans_id_list} |
| 936 | |
| 937 | Redfish Delete Session ${pre_session_info} |
| 938 | ${post_session_info}= Create Redfish Session With ClientID ${client_id} |
| 939 | ${resp}= Get Locks List On Resource With Session List ${pre_session_info} ${HTTP_BAD_REQUEST} |
| 940 | |
| 941 | Redfish Delete Session ${post_session_info} |
| 942 | |
| 943 | |
| 944 | |
Sushil Singh | 59011d0 | 2021-01-27 23:00:20 -0600 | [diff] [blame] | 945 | Verify Fail To Release Lock With Invalid TransactionID |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 946 | [Documentation] Verify fail to be release lock with invalid transaction ID. |
Sushil Singh | 59011d0 | 2021-01-27 23:00:20 -0600 | [diff] [blame] | 947 | [Arguments] ${client_id} ${lock_type} ${release_lock_type} |
| 948 | |
| 949 | # Description of argument(s): |
| 950 | # client_id This client id can contain string value |
| 951 | # (e.g. 12345, "HMCID"). |
| 952 | # lock_type Read lock or Write lock. |
| 953 | # release_lock_type The value can be Transaction or Session. |
| 954 | |
| 955 | ${trans_id_list}= Create List |
| 956 | @{lock_type_list}= Split String ${lock_type} , |
| 957 | |
| 958 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 959 | |
| 960 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 961 | ${value}= Get From Dictionary ${trans_id} TransactionID |
| 962 | ${value}= Evaluate ${value} + 10 |
| 963 | Set To Dictionary ${trans_id} TransactionID ${value} |
| 964 | Append To List ${trans_id_list} ${trans_id} |
| 965 | |
| 966 | Release Locks On Resource |
| 967 | ... ${session_info} ${trans_id_list} |
| 968 | ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} |
| 969 | Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session |
| 970 | |
| 971 | ${trans_id_emptylist}= Create List |
| 972 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 973 | Redfish Delete Session ${session_info} |
| 974 | |
| 975 | |
Sushil Singh | 1b59053 | 2021-01-20 05:13:54 -0600 | [diff] [blame] | 976 | Verify Fail To Release Multiple Lock With Invalid TransactionID |
| 977 | [Documentation] Verify release multiple locks with invalid transaction ID fails. |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 978 | [Arguments] ${client_id} ${lock_type} ${release_lock_type} |
| 979 | |
| 980 | # Description of argument(s): |
| 981 | # client_id This client id can contain string value |
| 982 | # (e.g. 12345, "HMCID"). |
| 983 | # lock_type Read lock or Write lock. |
| 984 | # release_lock_type The value can be Transaction or Session. |
| 985 | |
| 986 | ${trans_id_list}= Create List |
| 987 | @{lock_type_list}= Split String ${lock_type} , |
| 988 | |
| 989 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 990 | |
| 991 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 992 | ${value}= Get From Dictionary ${trans_id} TransactionID |
| 993 | ${value}= Evaluate ${value} + 10 |
| 994 | Set To Dictionary ${trans_id} TransactionID ${value} |
| 995 | Append To List ${trans_id_list} ${trans_id} |
| 996 | |
| 997 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] |
| 998 | ${value}= Get From Dictionary ${trans_id} TransactionID |
| 999 | ${value}= Evaluate ${value} + 10 |
| 1000 | Set To Dictionary ${trans_id} TransactionID ${value} |
| 1001 | Append To List ${trans_id_list} ${trans_id} |
| 1002 | |
| 1003 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[2] |
| 1004 | ${value}= Get From Dictionary ${trans_id} TransactionID |
| 1005 | ${value}= Evaluate ${value} + 10 |
| 1006 | Set To Dictionary ${trans_id} TransactionID ${value} |
| 1007 | Append To List ${trans_id_list} ${trans_id} |
| 1008 | |
| 1009 | Release Locks On Resource |
| 1010 | ... ${session_info} ${trans_id_list} |
| 1011 | ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} |
| 1012 | Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session |
| 1013 | |
| 1014 | ${trans_id_emptylist}= Create List |
| 1015 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 1016 | Redfish Delete Session ${session_info} |
| 1017 | |
| 1018 | |
Sushil Singh | 8bee358 | 2021-01-27 23:46:48 -0600 | [diff] [blame] | 1019 | Verify Fail To Release Multiple Lock With Valid And Invalid TransactionID |
George Keishing | 9614383 | 2021-03-23 07:55:08 -0500 | [diff] [blame] | 1020 | [Documentation] Verify fail to be release multiple lock with valid and invalid transaction ID. |
Sushil Singh | 8bee358 | 2021-01-27 23:46:48 -0600 | [diff] [blame] | 1021 | [Arguments] ${client_id} ${lock_type} ${release_lock_type} |
| 1022 | |
| 1023 | # Description of argument(s): |
| 1024 | # client_id This client id can contain string value |
| 1025 | # (e.g. 12345, "HMCID"). |
| 1026 | # lock_type Read lock or Write lock. |
| 1027 | # release_lock_type The value can be Transaction or Session. |
| 1028 | |
| 1029 | ${trans_id_list}= Create List |
| 1030 | @{lock_type_list}= Split String ${lock_type} , |
| 1031 | |
| 1032 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 1033 | |
| 1034 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 1035 | Append To List ${trans_id_list} ${trans_id} |
| 1036 | |
| 1037 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] |
| 1038 | ${value}= Get From Dictionary ${trans_id} TransactionID |
| 1039 | ${value}= Evaluate ${value} + 10 |
| 1040 | Set To Dictionary ${trans_id} TransactionID ${value} |
| 1041 | Append To List ${trans_id_list} ${trans_id} |
| 1042 | |
| 1043 | Release Locks On Resource |
| 1044 | ... ${session_info} ${trans_id_list} |
| 1045 | ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} |
| 1046 | Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=Session |
| 1047 | |
| 1048 | ${trans_id_emptylist}= Create List |
| 1049 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 1050 | Redfish Delete Session ${session_info} |
| 1051 | |
| 1052 | |
susilsi7 | 1d7b996 | 2021-03-02 03:06:18 -0600 | [diff] [blame] | 1053 | Verify Fail To Release Lock With TransactionID As String Type |
George Keishing | 9614383 | 2021-03-23 07:55:08 -0500 | [diff] [blame] | 1054 | [Documentation] Verify fail to be release lock with transaction ID as string data type. |
susilsi7 | 1d7b996 | 2021-03-02 03:06:18 -0600 | [diff] [blame] | 1055 | [Arguments] ${client_id} ${lock_type} ${release_lock_type} |
| 1056 | |
| 1057 | # Description of argument(s): |
| 1058 | # client_id This client id can contain string value |
| 1059 | # (e.g. 12345, "HMCID"). |
| 1060 | # lock_type Read lock or Write lock. |
| 1061 | # release_lock_type The value can be Transaction or Session. |
| 1062 | |
| 1063 | ${trans_id_list}= Create List |
| 1064 | @{lock_type_list}= Split String ${lock_type} , |
| 1065 | |
| 1066 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 1067 | |
| 1068 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 1069 | |
| 1070 | Append To List ${trans_id_list} ${trans_id} |
| 1071 | |
| 1072 | ${temp_trans_id_list}= Copy Dictionary ${trans_id_list} deepcopy=True |
| 1073 | |
| 1074 | ${value}= Get From Dictionary ${trans_id_list}[0] TransactionID |
| 1075 | ${value}= Set Variable \'${value}\' |
| 1076 | Set To Dictionary ${temp_trans_id_list}[0] TransactionID ${value} |
| 1077 | |
| 1078 | Release Locks On Resource |
| 1079 | ... ${session_info} ${temp_trans_id_list} |
| 1080 | ... release_lock_type=${release_lock_type} status_code=${HTTP_BAD_REQUEST} |
| 1081 | |
| 1082 | Release Locks On Resource ${session_info} ${trans_id_list} release_lock_type=${release_lock_type} |
| 1083 | |
| 1084 | ${trans_id_emptylist}= Create List |
| 1085 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 1086 | Redfish Delete Session ${session_info} |
| 1087 | |
| 1088 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 1089 | Verify Fail To Release Lock For Another Session |
| 1090 | [Documentation] Verify failed to release the lock form another session. |
| 1091 | [Arguments] ${client_id} ${lock_type} |
| 1092 | |
| 1093 | # Description of argument(s): |
| 1094 | # client_id This client id can contain string value |
| 1095 | # (e.g. 12345, "HMCID"). |
| 1096 | # lock_type Read lock or Write lock. |
| 1097 | |
| 1098 | ${client_ids}= Split String ${client_id} , |
| 1099 | ${lock_type_list}= Split String ${lock_type} , |
| 1100 | ${trans_id_list1}= Create List |
| 1101 | ${trans_id_list2}= Create List |
| 1102 | |
| 1103 | ${session_info1}= Create Redfish Session With ClientID ${client_ids}[0] |
| 1104 | |
| 1105 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 1106 | Append To List ${trans_id_list1} ${trans_id} |
| 1107 | Verify Lock On Resource ${session_info1} ${trans_id_list1} |
| 1108 | |
| 1109 | ${session_info2}= Create Redfish Session With ClientID ${client_ids}[1] |
| 1110 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] |
| 1111 | Append To List ${trans_id_list2} ${trans_id} |
| 1112 | Verify Lock On Resource ${session_info2} ${trans_id_list2} |
| 1113 | |
| 1114 | Release Locks On Resource |
| 1115 | ... ${session_info1} ${trans_id_list1} Transaction status_code=${HTTP_UNAUTHORIZED} |
| 1116 | Verify Lock On Resource ${session_info1} ${trans_id_list1} |
| 1117 | Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Session |
| 1118 | Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Session |
| 1119 | Redfish Delete Session ${session_info1} |
| 1120 | Redfish Delete Session ${session_info2} |
| 1121 | |
| 1122 | |
Sushil Singh | e33c6e6 | 2020-09-29 06:34:35 -0500 | [diff] [blame] | 1123 | Verify Fail To Acquire Lock For Invalid Resource ID Data Type |
| 1124 | [Documentation] Verify fail to acquire the lock with invalid resource id data type. |
| 1125 | [Arguments] ${client_id} ${lock_type} |
| 1126 | |
| 1127 | # Description of argument(s): |
| 1128 | # client_id This client id can contain string value |
| 1129 | # (e.g. 12345, "HMCID"). |
| 1130 | # lock_type Read lock or Write lock. |
| 1131 | |
| 1132 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 1133 | Redfish Post Acquire Invalid Lock With Invalid Data Type Of Resource ID |
| 1134 | ... ${lock_type} status_code=${HTTP_BAD_REQUEST} |
| 1135 | Redfish Delete Session ${session_info} |
| 1136 | |
| 1137 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 1138 | Verify Fail To Acquire Lock For Invalid Lock Data |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 1139 | [Documentation] Verify fail to acquired lock with invalid lock types, lock flags, segment flags. |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 1140 | [Arguments] ${client_id} ${lock_type} ${message} |
| 1141 | |
| 1142 | # Description of argument(s): |
| 1143 | # client_id This client id can contain string value |
| 1144 | # (e.g. 12345, "HMCID"). |
| 1145 | # lock_type Read lock or Write lock. |
| 1146 | # message Return message from URI. |
| 1147 | |
| 1148 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
Sushil Singh | 8a3efe7 | 2021-08-26 08:16:41 -0500 | [diff] [blame] | 1149 | ${trans_id}= Redfish Post Acquire Invalid Lock |
| 1150 | ... ${lock_type} message=${message} status_code=${HTTP_BAD_REQUEST} |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 1151 | Redfish Delete Session ${session_info} |
Sushil Singh | bace300 | 2020-10-08 08:12:58 -0500 | [diff] [blame] | 1152 | |
| 1153 | |
| 1154 | Verify No Locks Records For Session With No Acquired Lock |
| 1155 | [Documentation] Verify no records found for a session where no lock is acquired. |
| 1156 | [Arguments] ${client_id} |
| 1157 | |
| 1158 | # Description of argument(s): |
| 1159 | # client_id This client id can contain string value |
| 1160 | # (e.g. 12345, "HMCID"). |
| 1161 | |
| 1162 | ${session_info}= Create Redfish Session With ClientID ${client_id} |
| 1163 | ${trans_id_emptylist}= Create List |
| 1164 | Verify Lock On Resource ${session_info} ${trans_id_emptylist} |
| 1165 | Redfish Delete Session ${session_info} |
Sushil Singh | 728ef9c | 2020-10-28 04:25:39 -0500 | [diff] [blame] | 1166 | |
| 1167 | |
| 1168 | Create List Of Session ID |
| 1169 | [Documentation] Create session id list from session dict info. |
| 1170 | [Arguments] ${session_dict_info} |
| 1171 | |
| 1172 | # Description of argument(s): |
| 1173 | # session_dict_info Session information in dict. |
| 1174 | |
| 1175 | @{session_id_list}= Create List |
| 1176 | |
| 1177 | FOR ${session} IN @{session_dict_info} |
| 1178 | Append To List ${session_id_list} ${session["SessionIDs"]} |
| 1179 | END |
| 1180 | |
| 1181 | ${num_id}= Get Length ${session_id_list} |
| 1182 | Should Not Be Equal As Integers ${num_id} ${0} |
| 1183 | |
| 1184 | ${session_id_list}= Evaluate json.dumps(${session_id_list}) json |
| 1185 | |
| 1186 | [Return] ${session_id_list} |
| 1187 | |
| 1188 | |
| 1189 | Get Locks List On Resource With Session List |
| 1190 | [Documentation] Get locks list from session of list. |
| 1191 | [Arguments] ${session_id_list} ${exp_status_code}=${HTTP_OK} |
| 1192 | |
| 1193 | # Description of argument(s): |
| 1194 | # session_id_list Session ids list. |
| 1195 | # exp_status_code Expected HTTP status code. |
| 1196 | |
| 1197 | ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList |
| 1198 | ... data={"SessionIDs": ${session_id_list}} |
susilsi7 | 94116c6 | 2021-03-04 07:57:51 -0600 | [diff] [blame] | 1199 | Should Be Equal As Strings ${resp.status_code} ${exp_status_code} |
Sushil Singh | 728ef9c | 2020-10-28 04:25:39 -0500 | [diff] [blame] | 1200 | ${locks}= Evaluate json.loads('''${resp.text}''') json |
| 1201 | |
| 1202 | [Return] ${locks} |
| 1203 | |
| 1204 | |
| 1205 | Verify List Of Session Lock On Resource |
| 1206 | [Documentation] Verify list of lock record from list of sessions. |
| 1207 | [Arguments] ${session_dict_info} ${transaction_id_list} |
| 1208 | |
| 1209 | # Description of argument(s): |
| 1210 | # session_dict_info Session information in dict. |
| 1211 | # transaction_id_list Transaction id in list stored in dict. |
| 1212 | |
| 1213 | ${session_id_list}= Create List Of Session ID ${session_dict_info} |
| 1214 | ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} |
| 1215 | ${lock_list}= Set Variable ${lock_list_resp['Records']} |
| 1216 | |
Sushil Singh | 8a3efe7 | 2021-08-26 08:16:41 -0500 | [diff] [blame] | 1217 | FOR ${session_id} ${tran_id} ${lock_record} IN ZIP |
| 1218 | ... ${session_dict_info} ${transaction_id_list} ${lock_list} |
Sushil Singh | 728ef9c | 2020-10-28 04:25:39 -0500 | [diff] [blame] | 1219 | Valid Value session_id['SessionIDs'] ['${lock_record['SessionID']}'] |
| 1220 | Should Be Equal As Integers ${tran_id['TransactionID']} ${lock_record['TransactionID']} |
| 1221 | END |
| 1222 | |
| 1223 | |
| 1224 | Verify Lock Records Of Multiple Session |
| 1225 | [Documentation] Verify all records found for a multiple sessions. |
| 1226 | [Arguments] ${client_ids} ${lock_type} |
| 1227 | |
| 1228 | # Description of argument(s): |
| 1229 | # client_ids This client id can contain string value |
| 1230 | # (e.g. 12345, "HMCID"). |
| 1231 | # lock_type Read lock or Write lock. |
| 1232 | |
| 1233 | ${client_id_list}= Split String ${client_ids} , |
| 1234 | ${lock_type_list}= Split String ${lock_type} , |
| 1235 | ${trans_id_list1}= Create List |
| 1236 | ${trans_id_list2}= Create List |
| 1237 | |
| 1238 | ${session_dict_list}= Create List |
| 1239 | ${lock_list}= Create List |
| 1240 | |
| 1241 | ${client_id1}= Create List |
| 1242 | Append To List ${client_id1} ${client_id_list}[0] |
| 1243 | ${session_info1}= Create Session With List Of ClientID ${client_id1} |
| 1244 | Append To List ${session_dict_list} ${session_info1}[0] |
| 1245 | Verify A Session Created With ClientID ${client_id1} ${session_info1} |
| 1246 | |
| 1247 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 1248 | Append To List ${trans_id_list1} ${trans_id} |
| 1249 | Append To List ${lock_list} ${trans_id} |
| 1250 | Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} |
| 1251 | |
| 1252 | |
| 1253 | ${client_id2}= Create List |
| 1254 | Append To List ${client_id2} ${client_id_list}[1] |
| 1255 | ${session_info2}= Create Session With List Of ClientID ${client_id2} |
| 1256 | Append To List ${session_dict_list} ${session_info2}[0] |
| 1257 | Verify A Session Created With ClientID ${client_id2} ${session_info2} |
| 1258 | |
| 1259 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] |
| 1260 | Append To List ${trans_id_list2} ${trans_id} |
| 1261 | Append To List ${lock_list} ${trans_id} |
| 1262 | Verify Lock On Resource ${session_info2}[0] ${trans_id_list2} |
| 1263 | |
| 1264 | Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} |
| 1265 | |
| 1266 | ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken |
| 1267 | Set Global Variable ${XAUTH_TOKEN} ${session_token} |
| 1268 | |
| 1269 | Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction |
| 1270 | |
| 1271 | ${session_token}= Get From Dictionary ${session_info2}[0] SessionToken |
| 1272 | Set Global Variable ${XAUTH_TOKEN} ${session_token} |
| 1273 | |
| 1274 | Release Locks On Resource ${session_info2} ${trans_id_list2} release_lock_type=Transaction |
| 1275 | |
| 1276 | ${trans_id_emptylist}= Create List |
| 1277 | Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} |
| 1278 | Verify Lock On Resource ${session_info2}[0] ${trans_id_emptylist} |
| 1279 | |
| 1280 | Redfish Delete List Of Session ${session_dict_list} |
Sushil Singh | f9a536c | 2020-11-09 07:33:17 -0600 | [diff] [blame] | 1281 | |
| 1282 | |
| 1283 | Verify Lock Records For Multiple Invalid Session |
| 1284 | [Documentation] Verify no lock record found for multiple invalid session. |
| 1285 | [Arguments] ${client_id} |
| 1286 | |
| 1287 | # Description of argument(s): |
| 1288 | # client_id This client id can contain string value |
| 1289 | # (e.g. 12345, "HMCID"). |
| 1290 | |
| 1291 | ${session_dict_list}= Create List |
| 1292 | ${invalid_session_ids}= Create List xxyXyyYZZz xXyXYyYZzz |
| 1293 | |
| 1294 | ${session_info1}= Create Session With ClientID ${client_id} |
| 1295 | |
| 1296 | ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True |
| 1297 | set to dictionary ${session_info2} SessionIDs ${invalid_session_ids}[0] |
| 1298 | Append To List ${session_dict_list} ${session_info2} |
| 1299 | |
| 1300 | ${session_info3}= Copy Dictionary ${session_info1} deepcopy=True |
| 1301 | set to dictionary ${session_info3} SessionIDs ${invalid_session_ids}[0] |
| 1302 | Append To List ${session_dict_list} ${session_info3} |
| 1303 | |
| 1304 | ${lock_list1}= Get Locks List On Resource ${session_info1} |
| 1305 | ${lock_length1}= Get Length ${lock_list1} |
| 1306 | |
| 1307 | ${session_id_list}= Create List Of Session ID ${session_dict_list} |
| 1308 | ${lock_list_resp}= Get Locks List On Resource With Session List ${session_id_list} |
| 1309 | ${lock_length2}= Get Length ${lock_list_resp['Records']} |
| 1310 | |
| 1311 | Should Be Equal As Integers ${lock_length1} ${lock_length2} |
| 1312 | |
| 1313 | Redfish Delete Session ${session_info1} |
Sushil Singh | 11949a2 | 2020-11-13 06:12:16 -0600 | [diff] [blame] | 1314 | |
| 1315 | |
| 1316 | Verify Lock Records For Multiple Invalid And Valid Session |
| 1317 | [Documentation] Verify all records found for a valid and invalid sessions. |
| 1318 | [Arguments] ${client_ids} ${lock_type} |
| 1319 | |
| 1320 | # Description of argument(s): |
| 1321 | # client_ids This client id can contain string value |
| 1322 | # (e.g. 12345, "HMCID"). |
| 1323 | # lock_type Read lock or Write lock. |
| 1324 | |
| 1325 | ${client_id_list}= Split String ${client_ids} , |
| 1326 | ${lock_type_list}= Split String ${lock_type} , |
| 1327 | ${trans_id_list1}= Create List |
| 1328 | ${invalid_session_ids}= Create List xxyXyyYZZz |
| 1329 | |
| 1330 | ${session_dict_list}= Create List |
| 1331 | ${lock_list}= Create List |
| 1332 | |
| 1333 | ${client_id1}= Create List |
| 1334 | Append To List ${client_id1} ${client_id_list}[0] |
| 1335 | ${session_info1}= Create Session With List Of ClientID ${client_id1} |
| 1336 | Append To List ${session_dict_list} ${session_info1}[0] |
| 1337 | Verify A Session Created With ClientID ${client_id1} ${session_info1} |
| 1338 | |
| 1339 | ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0] |
| 1340 | Append To List ${trans_id_list1} ${trans_id} |
| 1341 | Append To List ${lock_list} ${trans_id} |
| 1342 | Verify Lock On Resource ${session_info1}[0] ${trans_id_list1} |
| 1343 | |
| 1344 | ${session_info2}= Copy Dictionary ${session_info1} deepcopy=True |
| 1345 | set to dictionary ${session_info2}[0] SessionIDs ${invalid_session_ids}[0] |
| 1346 | Append To List ${session_dict_list} ${session_info2}[0] |
| 1347 | |
| 1348 | Verify List Of Session Lock On Resource ${session_dict_list} ${lock_list} |
| 1349 | |
| 1350 | ${session_token}= Get From Dictionary ${session_info1}[0] SessionToken |
| 1351 | Set Global Variable ${XAUTH_TOKEN} ${session_token} |
| 1352 | |
| 1353 | Release Locks On Resource ${session_info1} ${trans_id_list1} release_lock_type=Transaction |
| 1354 | |
| 1355 | ${trans_id_emptylist}= Create List |
| 1356 | Verify Lock On Resource ${session_info1}[0] ${trans_id_emptylist} |
| 1357 | |
| 1358 | Redfish Delete Session ${session_info1}[0] |