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