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