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