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