Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 3 | Documentation Test Save Area feature of Management Console on BMC. |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 4 | |
| 5 | Resource ../../lib/rest_client.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | Resource ../../lib/resource.robot |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 8 | Resource ../../lib/bmc_redfish_utils.robot |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 9 | Resource ../../lib/utils.robot |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 10 | Resource ../../lib/bmc_redfish_resource.robot |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 11 | |
Vijay | 3937315 | 2020-02-14 08:08:20 -0600 | [diff] [blame] | 12 | Suite Setup Suite Setup Execution |
| 13 | Test Teardown Test Teardown Execution |
| 14 | Suite Teardown Suite Teardown Execution |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 15 | |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 16 | *** Variables *** |
| 17 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 18 | ${MAXIMUM_SIZE_MESSAGE} File size exceeds maximum allowed size[500KB] |
| 19 | ${FILE_UPLOAD_MESSAGE} File Created |
| 20 | ${FILE_DELETED_MESSAGE} File Deleted |
| 21 | ${FILE_UPDATED} File Updated |
| 22 | ${FORBIDDEN_MESSAGE} Forbidden |
| 23 | ${ERROR_MESSAGE} Error while creating the file |
| 24 | ${RESOURCE_NOT_FOUND} Resource Not Found |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 25 | |
| 26 | *** Test Cases *** |
| 27 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 28 | Redfish Upload Partition File To BMC |
| 29 | [Documentation] Upload partition file to BMC using redfish. |
| 30 | [Tags] Redfish_Upload_Partition_File_To_BMC |
| 31 | [Template] Redfish Upload Partition File |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 32 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 33 | # file_name |
| 34 | 500KB_file |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 35 | |
| 36 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 37 | Redfish Fail To Upload Partition File To BMC |
| 38 | [Documentation] Fail to upload partition file to BMC using redfish. |
| 39 | [Tags] Redfish_Fail_To_Upload_Partition_File_To_BMC |
| 40 | [Template] Redfish Fail To Upload Partition File |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 41 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 42 | # file_name |
| 43 | 501KB_file |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 44 | |
| 45 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 46 | Redfish Upload Multiple Partition File To BMC |
| 47 | [Documentation] Upload multiple partition file to BMC using redfish. |
| 48 | [Tags] Redfish_Upload_Multiple_Partition_File_To_BMC |
| 49 | [Template] Redfish Upload Partition File |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 50 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 51 | # file_name |
| 52 | 250KB_file,500KB_file |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 53 | |
| 54 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 55 | Redfish Fail To Upload Multiple Partition File To BMC |
| 56 | [Documentation] Fail to upload multiple partition file to BMC using redfish. |
| 57 | [Tags] Redfish_Fail_To_Upload_Multiple_Partition_File_To_BMC |
| 58 | [Template] Redfish Fail To Upload Partition File |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 59 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 60 | # file_name |
| 61 | 650KB_file,501KB_file |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 62 | |
| 63 | |
Sushil Singh | df6ba52 | 2020-11-24 04:17:00 -0600 | [diff] [blame] | 64 | Redfish Upload Same Partition File To BMC In Loop |
| 65 | [Documentation] Upload same partition file to BMC using redfish in loop. |
| 66 | [Tags] Redfish_Upload_Same_Partition_File_To_BMC_In_Loop |
| 67 | [Template] Redfish Upload Partition File In Loop |
| 68 | |
| 69 | # file_name |
| 70 | 500KB_file |
| 71 | |
| 72 | |
Sushil Singh | 5d0782f | 2020-11-23 06:35:35 -0600 | [diff] [blame] | 73 | Redfish Partition File Upload Post BMC Reboot |
| 74 | [Documentation] Upload partition file to BMC using redfish, after the BMC reboot. |
| 75 | [Tags] Redfish_Partition_File_Upload_Post_BMC_Reboot |
| 76 | [Template] Verify Partition File Upload Post BMC Reboot |
| 77 | |
| 78 | # file_name |
| 79 | 500KB_file |
| 80 | |
| 81 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 82 | Redfish Partition File Persistency On BMC Reboot |
| 83 | [Documentation] Upload partition file to BMC using redfish and is same after reboot. |
| 84 | [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot |
| 85 | [Template] Redfish Partition File Persistency |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 86 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 87 | # file_name |
| 88 | 500KB_file |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 89 | |
| 90 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 91 | Redfish Multiple Partition File Persistency On BMC Reboot |
| 92 | [Documentation] Upload partition file to BMC using redfish and is same after reboot. |
| 93 | [Tags] Redfish_Multiple_Partition_File_Persistency_On_BMC_Reboot |
| 94 | [Template] Redfish Partition File Persistency |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 95 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 96 | # file_name |
| 97 | 250KB_file,500KB_file |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 98 | |
| 99 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 100 | Redfish Read Partition File On BMC |
| 101 | [Documentation] Upload partition file to BMC using redfish and verify the content. |
| 102 | [Tags] Redfish_Read_Partition_File_On_BMC |
| 103 | [Template] Redfish Read Partition File |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 104 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 105 | # file_name reboot_flag |
| 106 | testfile False |
| 107 | testfile01,testfile02 False |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 108 | |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 109 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 110 | Redfish Read Partition File On BMC Reboot |
| 111 | [Documentation] Upload partition file to BMC using redfish and verify the content after reboot. |
| 112 | [Tags] Check_Redfish_Read_Partition_File_On_BMC_Reboot |
| 113 | [Template] Redfish Read Partition File |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 114 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 115 | # file_name reboot_flag |
| 116 | testfile True |
| 117 | testfile01,testfile02 True |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 118 | |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 119 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 120 | Redfish Update Partition File On BMC |
| 121 | [Documentation] Upload partition file to BMC using redfish and verify the content. |
| 122 | [Tags] Redfish_Update_Partition_File_On_BMC |
| 123 | [Template] Redfish Update Partition File With Different Content |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 124 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 125 | # file_name reboot_flag |
| 126 | testfile01 False |
| 127 | |
| 128 | |
| 129 | Redfish Update Partition File On BMC Reboot |
| 130 | [Documentation] Upload partition file to BMC using redfish and verify the content after the reboot. |
| 131 | [Tags] Redfish_Update_Partition_File_On_BMC_Reboot |
| 132 | [Template] Redfish Update Partition File With Different Content |
| 133 | |
| 134 | # file_name reboot_flag |
| 135 | testfile01 True |
| 136 | |
| 137 | |
| 138 | Redfish Persistency Update Partition File On BMC |
| 139 | [Documentation] Upload partition file to BMC using redfish and verify the content. |
| 140 | [Tags] Redfish_Persistency_Update_Partition_File_On_BMC |
| 141 | [Template] Redfish Update Partition File With Same Content |
| 142 | |
| 143 | # file_name reboot_flag |
| 144 | testfile01 False |
| 145 | |
| 146 | |
| 147 | Redfish Persistency Update Partition File On BMC Reboot |
| 148 | [Documentation] Upload partition file to BMC using redfish and verify the content after the reboot. |
| 149 | [Tags] Redfish_Persistency_Update_Partition_File_On_BMC_Reboot |
| 150 | [Template] Redfish Update Partition File With Same Content |
| 151 | |
| 152 | # file_name reboot_flag |
| 153 | testfile01 True |
| 154 | |
| 155 | |
| 156 | Redfish Delete Non Existence Of Partition File |
| 157 | [Documentation] Delete the partition file if do not exists. |
| 158 | [Tags] Redfish_Delete_Non_Existence_Of_Partition_File |
| 159 | [Template] Redfish Delete Non Existence Partition File |
| 160 | |
| 161 | # file_name |
| 162 | testfile01 |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 163 | |
| 164 | |
| 165 | Verify One Thousand Partitions File Upload |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 166 | [Documentation] Upload 1000 partition file to BMC. |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 167 | [Tags] Verify_One_Thousand_Partitions_File_Upload |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 168 | [Template] Redfish Upload Partition File With Range |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 169 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 170 | # range |
| 171 | 1000 |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 172 | |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 173 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 174 | Non Admin Users Fail To Upload Partition File |
| 175 | [Documentation] Non admin user will fail to upload the partition file. |
| 176 | [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File |
| 177 | [Template] Non Admin User To Upload Partition File |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 178 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 179 | # file_name username password role_id |
| 180 | 500KB_file operator_user TestPwd123 Operator |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 181 | |
| 182 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 183 | Non Admin User Delete Non Existence Of Partition File |
| 184 | [Documentation] Delete the partion file if does not exists. |
| 185 | [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File |
| 186 | [Template] Non Admin Delete Non Existence Partition File |
| 187 | |
| 188 | # file_name username password role_id |
| 189 | 500KB_file operator_user TestPwd123 Operator |
| 190 | |
| 191 | |
| 192 | Redfish Update Wrong Partition File To BMC |
| 193 | [Documentation] Upload partition file to BMC by wrong URI using redfish. |
| 194 | [Tags] Redfish_Update_Wrong_Partition_File_To_BMC |
| 195 | [Template] Verify Update Wrong Partition File To BMC |
| 196 | |
| 197 | # file_name |
| 198 | 500KB_file |
| 199 | |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 200 | *** Keywords *** |
| 201 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 202 | Suite Setup Execution |
| 203 | [Documentation] Suite setup execution. |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 204 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 205 | Redfish.Login |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 206 | |
| 207 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 208 | Test Teardown Execution |
| 209 | [Documentation] Test teardown execution. |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 210 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 211 | Delete All BMC Partition File ${HTTP_OK} |
| 212 | FFDC On Test Case Fail |
| 213 | |
| 214 | |
| 215 | Suite Teardown Execution |
| 216 | [Documentation] Suite teardown execution. |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 217 | |
| 218 | Delete All Sessions |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 219 | |
| 220 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 221 | Delete Local Partition File |
| 222 | [Documentation] Delete local partition file. |
| 223 | [Arguments] ${file_name} |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 224 | |
| 225 | # Description of argument(s): |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 226 | # file_name Partition file name. |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 227 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 228 | FOR ${conf_file} IN @{file_name} |
| 229 | ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file} |
| 230 | Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file} |
| 231 | END |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 232 | |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 233 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 234 | Create Partition File |
| 235 | [Documentation] Create Partition file. |
| 236 | [Arguments] ${file_name} |
| 237 | |
| 238 | # Description of argument(s): |
| 239 | # file_name Partition file name. |
| 240 | |
| 241 | Delete Local Partition File ${file_name} |
| 242 | |
| 243 | FOR ${conf_file} IN @{file_name} |
| 244 | @{words}= Split String ${conf_file} _ |
| 245 | Run dd if=/dev/zero of=${conf_file} bs=1 count=0 seek=${words}[-0] |
| 246 | OperatingSystem.File Should Exist ${conf_file} |
| 247 | END |
| 248 | |
| 249 | |
| 250 | Delete BMC Partition File |
| 251 | [Documentation] Delete single partition file on BMC via redfish. |
| 252 | [Arguments] ${file_name} ${status_code} ${expected_message} |
| 253 | |
| 254 | # Description of argument(s): |
| 255 | # file_name Partition file name. |
| 256 | # status_code HTTPS status code. |
| 257 | # expected_message Expected message of URI. |
| 258 | |
| 259 | FOR ${conf_file} IN @{file_name} |
| 260 | ${data}= Create Dictionary |
| 261 | ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} |
| 262 | Set To Dictionary ${data} headers ${headers} |
| 263 | |
| 264 | ${resp}= Delete Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data} |
| 265 | Should Be Equal As Strings ${resp.status_code} ${status_code} |
| 266 | |
| 267 | Run Keyword If ${resp.status_code} == ${HTTP_FORBIDDEN} |
| 268 | ... Should Be Equal As Strings ${resp.text} ${expected_message} |
| 269 | ${description}= Run Keyword If ${resp.status_code} == ${HTTP_OK} |
| 270 | ... Return Description Of Response ${resp.text} |
| 271 | Run Keyword If '${description}' != 'None' |
| 272 | ... Should Be Equal As Strings ${description} ${expected_message} |
| 273 | END |
| 274 | |
| 275 | |
| 276 | Delete All BMC Partition File |
| 277 | [Documentation] Delete multiple partition file on BMC via redfish. |
| 278 | [Arguments] ${status_code} |
| 279 | |
| 280 | # Description of argument(s): |
| 281 | # status_code HTTPS status code. |
| 282 | |
| 283 | Initialize OpenBMC |
| 284 | ${data}= Create Dictionary |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 285 | ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 286 | Set To Dictionary ${data} headers ${headers} |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 287 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 288 | ${resp}= Post Request openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data} |
| 289 | Should Be Equal As Strings ${resp.status_code} ${status_code} |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 290 | |
| 291 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 292 | Return Description Of Response |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 293 | [Documentation] Return description of REST response. |
| 294 | [Arguments] ${resp_text} |
| 295 | |
| 296 | # Description of argument(s): |
| 297 | # resp_text REST response body. |
| 298 | |
| 299 | # resp_text after successful partition file upload looks like: |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 300 | # { |
| 301 | # "Description": "File Created" |
| 302 | # } |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 303 | |
| 304 | ${message}= Evaluate json.loads('''${resp_text}''') json |
| 305 | |
| 306 | [Return] ${message["Description"]} |
| 307 | |
| 308 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 309 | Upload Partition File To BMC |
| 310 | [Documentation] Upload partition file to BMC. |
| 311 | [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True} |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 312 | |
| 313 | # Description of argument(s): |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 314 | # file_name Partition file name. |
| 315 | # status_code HTTPS status code. |
| 316 | # expected_message Expected message of URI. |
| 317 | # flag If True run part of program, else skip. |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 318 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 319 | Run Keyword If '${flag}' == '${True}' Initialize OpenBMC |
| 320 | FOR ${conf_file} IN @{file_name} |
| 321 | # Get the content of the file and upload to BMC. |
| 322 | ${image_data}= OperatingSystem.Get Binary File ${conf_file} |
| 323 | ${data}= Create Dictionary data ${image_data} |
| 324 | ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} |
| 325 | Set To Dictionary ${data} headers ${headers} |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 326 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 327 | ${resp}= Put Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data} |
| 328 | Should Be Equal As Strings ${resp.status_code} ${status_code} |
| 329 | |
| 330 | Run Keyword If ${resp.status_code} == ${HTTP_FORBIDDEN} |
| 331 | ... Should Be Equal As Strings ${resp.text} ${expected_message} |
| 332 | ${description}= Run Keyword If ${resp.status_code} == ${HTTP_OK} |
| 333 | ... Return Description Of Response ${resp.text} |
| 334 | Run Keyword If '${description}' != 'None' |
| 335 | ... Should Be Equal As Strings ${description} ${expected_message} |
| 336 | END |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 337 | |
| 338 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 339 | Verify Partition File On BMC |
| 340 | [Documentation] Verify partition file on BMC. |
| 341 | [Arguments] ${file_name} ${Partition_status} |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 342 | |
| 343 | # Description of argument(s): |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 344 | # file_name Partition file name. |
| 345 | # Partition_status Partition file status on BMC. |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 346 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 347 | FOR ${conf_file} IN @{file_name} |
| 348 | ${status} ${stderr} ${rc}= BMC Execute Command |
| 349 | ... ls -l /var/lib/obmc/bmc-console-mgmt/save-area/${conf_file} | wc -l |
| 350 | Valid Value ${status} [${Partition_status}] |
| 351 | END |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 352 | |
| 353 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 354 | Redfish Upload Partition File |
| 355 | [Documentation] Upload the partition file. |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 356 | [Arguments] ${file_name} |
| 357 | |
| 358 | # Description of argument(s): |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 359 | # file_name Partition file name. |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 360 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 361 | @{Partition_file_list} = Split String ${file_name} , |
| 362 | ${num_records}= Get Length ${Partition_file_list} |
| 363 | Create Partition File ${Partition_file_list} |
| 364 | Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE} |
| 365 | Verify Partition File On BMC ${Partition_file_list} Partition_status=1 |
| 366 | Run Keyword If ${num_records} == ${1} |
| 367 | ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE} |
| 368 | ... ELSE |
| 369 | ... Delete All BMC Partition File ${HTTP_OK} |
| 370 | Delete Local Partition File ${Partition_file_list} |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 371 | |
| 372 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 373 | Redfish Fail To Upload Partition File |
| 374 | [Documentation] Fail to uplaod the partition file. |
| 375 | [Arguments] ${file_name} |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 376 | |
| 377 | # Description of argument(s): |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 378 | # file_name Partition file name. |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 379 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 380 | @{Partition_file_list} = Split String ${file_name} , |
| 381 | Create Partition File ${Partition_file_list} |
| 382 | Upload Partition File To BMC ${Partition_file_list} ${HTTP_BAD_REQUEST} ${MAXIMUM_SIZE_MESSAGE} |
| 383 | Verify Partition File On BMC ${Partition_file_list} Partition_status=0 |
| 384 | Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND} |
| 385 | Delete Local Partition File ${Partition_file_list} |
Vijay | 09839e2 | 2020-02-05 02:54:44 -0600 | [diff] [blame] | 386 | |
| 387 | |
Sushil Singh | df6ba52 | 2020-11-24 04:17:00 -0600 | [diff] [blame] | 388 | Redfish Upload Partition File In Loop |
| 389 | [Documentation] Upload the same partition file multiple times in loop to BMC. |
| 390 | [Arguments] ${file_name} |
| 391 | |
| 392 | # Description of argument(s): |
| 393 | # file_name Partition file name. |
| 394 | |
| 395 | @{Partition_file_list} = Split String ${file_name} , |
| 396 | Create Partition File ${Partition_file_list} |
| 397 | |
| 398 | Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE} |
| 399 | Verify Partition File On BMC ${Partition_file_list} Partition_status=1 |
| 400 | |
| 401 | FOR ${count} IN RANGE 1 11 |
| 402 | Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED} |
| 403 | Verify Partition File On BMC ${Partition_file_list} Partition_status=1 |
| 404 | END |
| 405 | |
| 406 | Initialize OpenBMC |
| 407 | Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE} |
| 408 | Delete Local Partition File ${Partition_file_list} |
| 409 | |
| 410 | |
Sushil Singh | 5d0782f | 2020-11-23 06:35:35 -0600 | [diff] [blame] | 411 | Verify Partition File Upload Post BMC Reboot |
| 412 | [Documentation] Upload the partition file, after BMC reboot. |
| 413 | [Arguments] ${file_name} |
| 414 | |
| 415 | # Description of argument(s): |
| 416 | # file_name Partition file name. |
| 417 | |
| 418 | Redfish OBMC Reboot (off) |
| 419 | |
| 420 | Redfish Upload Partition File ${file_name} |
| 421 | |
| 422 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 423 | Redfish Partition File Persistency |
| 424 | [Documentation] Upload the partition file and check for persistency after reboot. |
| 425 | [Arguments] ${file_name} |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 426 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 427 | # Description of argument(s): |
| 428 | # file_name Partition file name. |
| 429 | |
| 430 | @{Partition_file_list} = Split String ${file_name} , |
| 431 | ${num_records}= Get Length ${Partition_file_list} |
| 432 | Create Partition File ${Partition_file_list} |
| 433 | Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE} |
| 434 | Verify Partition File On BMC ${Partition_file_list} Partition_status=1 |
| 435 | Redfish OBMC Reboot (off) |
| 436 | Verify Partition File On BMC ${Partition_file_list} Partition_status=1 |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 437 | Initialize OpenBMC |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 438 | Run Keyword If ${num_records} == ${1} |
| 439 | ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE} |
| 440 | ... ELSE |
| 441 | ... Delete All BMC Partition File ${HTTP_OK} |
| 442 | Delete Local Partition File ${Partition_file_list} |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 443 | |
| 444 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 445 | Verify Redfish Partition File Content |
| 446 | [Documentation] Verify partition file content. |
| 447 | [Arguments] ${file_name} ${content_dict} ${status_code} |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 448 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 449 | # Description of argument(s): |
| 450 | # file_name Partition file name. |
| 451 | # content_dict Dict contain the content. |
| 452 | # status_code HTTPS status code. |
| 453 | |
| 454 | FOR ${conf_file} IN @{file_name} |
| 455 | ${resp}= Get Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} |
| 456 | Should Be Equal As Strings ${resp.status_code} ${status_code} |
| 457 | |
| 458 | ${Partition_file_data}= Remove String ${resp.text} \\n |
| 459 | ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json |
| 460 | Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']} |
| 461 | END |
Vijay | fcdadc5 | 2020-01-21 01:48:19 -0600 | [diff] [blame] | 462 | |
Vijay | 3937315 | 2020-02-14 08:08:20 -0600 | [diff] [blame] | 463 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 464 | Add Content To Files |
| 465 | [Documentation] Add defined content in partition file. |
| 466 | [Arguments] ${file_name} ${index}=${0} |
Vijay | 3937315 | 2020-02-14 08:08:20 -0600 | [diff] [blame] | 467 | |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 468 | # Description of argument(s): |
| 469 | # file_name Partition file name. |
| 470 | # index Index |
| 471 | |
| 472 | ${num_records}= Get Length ${file_name} |
| 473 | Set Test Variable ${content-1} Sample Content to test partition file upload |
| 474 | Set Test Variable ${content-2} Sample Content to test partition file upload after reboot |
| 475 | &{content_dict}= Create Dictionary |
| 476 | FOR ${conf_file} IN @{file_name} |
| 477 | ${index}= Get Index From List ${file_name} ${conf_file} |
| 478 | ${index}= Evaluate ${index} + 1 |
| 479 | |
| 480 | Run echo "${content-${index}}" > ${conf_file} |
| 481 | OperatingSystem.File Should Exist ${conf_file} |
| 482 | |
| 483 | Set To Dictionary ${content_dict} ${conf_file} ${content-${index}} |
| 484 | END |
| 485 | |
| 486 | [Return] &{content_dict} |
| 487 | |
| 488 | |
| 489 | Redfish Read Partition File |
| 490 | [Documentation] Read partition file content. |
| 491 | [Arguments] ${file_name} ${reboot_flag}=False |
| 492 | |
| 493 | # Description of argument(s): |
| 494 | # file_name Partition file name. |
| 495 | # reboot_flag Reboot flag. |
| 496 | |
| 497 | @{Partition_file_list} = Split String ${file_name} , |
| 498 | ${content_dict}= Add Content To Files ${Partition_file_list} |
| 499 | |
| 500 | ${num_records}= Get Length ${Partition_file_list} |
| 501 | |
| 502 | Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE} |
| 503 | Verify Partition File On BMC ${Partition_file_list} Partition_status=1 |
| 504 | Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK} |
| 505 | |
| 506 | Run Keyword If ${True} == ${reboot_flag} |
| 507 | ... Run Keywords Redfish OBMC Reboot (off) AND |
| 508 | ... Initialize OpenBMC AND |
| 509 | ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK} |
| 510 | Run Keyword If ${num_records} == ${1} |
| 511 | ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE} |
| 512 | ... ELSE |
| 513 | ... Delete All BMC Partition File ${HTTP_OK} |
| 514 | Delete Local Partition File ${Partition_file_list} |
| 515 | |
| 516 | |
| 517 | Redfish Update Partition File With Same Content |
| 518 | [Documentation] Update partition file with same content. |
| 519 | [Arguments] ${file_name} ${reboot_flag}=False |
| 520 | |
| 521 | # Description of argument(s): |
| 522 | # file_name Partition file name. |
| 523 | # reboot_flag Reboot flag. |
| 524 | |
| 525 | @{Partition_file_list} = Split String ${file_name} , |
| 526 | ${content_dict}= Add Content To Files ${Partition_file_list} ${0} |
| 527 | |
| 528 | Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE} |
| 529 | Verify Partition File On BMC ${Partition_file_list} Partition_status=1 |
| 530 | Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK} |
| 531 | |
| 532 | Run Keyword If ${True} == ${reboot_flag} |
| 533 | ... Run Keywords Redfish OBMC Reboot (off) AND |
| 534 | ... Initialize OpenBMC |
| 535 | |
| 536 | ${content_dict}= Add Content To Files ${Partition_file_list} ${0} |
| 537 | Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED} |
| 538 | Verify Partition File On BMC ${Partition_file_list} Partition_status=1 |
| 539 | Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK} |
| 540 | |
| 541 | Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE} |
| 542 | Delete Local Partition File ${Partition_file_list} |
| 543 | |
| 544 | |
| 545 | Redfish Update Partition File With Different Content |
| 546 | [Documentation] Update partition file with different content. |
| 547 | [Arguments] ${file_name} ${reboot_flag}=False |
| 548 | |
| 549 | # Description of argument(s): |
| 550 | # file_name Partition file name. |
| 551 | # reboot_flag Reboot flag. |
| 552 | |
| 553 | @{Partition_file_list} = Split String ${file_name} , |
| 554 | ${content_dict}= Add Content To Files ${Partition_file_list} ${0} |
| 555 | |
| 556 | Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE} |
| 557 | Verify Partition File On BMC ${Partition_file_list} Partition_status=1 |
| 558 | Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK} |
| 559 | |
| 560 | Run Keyword If ${True} == ${reboot_flag} |
| 561 | ... Run Keywords Redfish OBMC Reboot (off) AND |
| 562 | ... Initialize OpenBMC |
| 563 | |
| 564 | ${content_dict}= Add Content To Files ${Partition_file_list} ${1} |
| 565 | Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED} |
| 566 | Verify Partition File On BMC ${Partition_file_list} Partition_status=1 |
| 567 | Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK} |
| 568 | |
| 569 | Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE} |
| 570 | Delete Local Partition File ${Partition_file_list} |
| 571 | |
| 572 | |
| 573 | Create File Names |
| 574 | [Documentation] Create partition file names. |
| 575 | [Arguments] ${range} |
| 576 | |
| 577 | # Description of argument(s): |
| 578 | # range Range in numbers. |
| 579 | |
| 580 | @{file_name_list}= Create List |
| 581 | Set Test Variable ${file_name} rangefile |
| 582 | FOR ${count} IN RANGE ${range} |
| 583 | Append To List ${file_name_list} 200KB_file${count} |
| 584 | END |
| 585 | [Return] ${file_name_list} |
| 586 | |
| 587 | |
| 588 | Redfish Upload Partition File With Range |
| 589 | [Documentation] Upload the partition file with the range of files. |
| 590 | [Arguments] ${range} |
| 591 | |
| 592 | # Description of argument(s): |
| 593 | # range Range in numbers. |
| 594 | |
| 595 | ${Partition_file_list}= Create File Names ${range} |
| 596 | Create Partition File ${Partition_file_list} |
| 597 | Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE} |
| 598 | Verify Partition File On BMC ${Partition_file_list} Partition_status=1 |
| 599 | Delete All BMC Partition File ${HTTP_OK} |
| 600 | Delete Local Partition File ${Partition_file_list} |
| 601 | |
| 602 | |
| 603 | Redfish Delete Non Existence Partition File |
| 604 | [Documentation] Delete the partition file if do not exists. |
| 605 | [Arguments] ${file_name} |
| 606 | |
| 607 | # Description of argument(s): |
| 608 | # file_name Partition file name. |
| 609 | |
| 610 | @{Partition_file_list} = Split String ${file_name} , |
| 611 | Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND} |
| 612 | |
| 613 | |
| 614 | Non Admin User To Upload Partition File |
| 615 | [Documentation] Non admin user to uplaod the partition file. |
| 616 | [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True} |
| 617 | |
| 618 | # Description of argument(s): |
| 619 | # file_name Partition file name. |
| 620 | # username Username. |
| 621 | # password Password. |
| 622 | # role Role of user. |
| 623 | # enabled Value can be True or False. |
| 624 | |
| 625 | Redfish Create User ${username} ${password} ${role} ${enabled} |
Vijay | 3937315 | 2020-02-14 08:08:20 -0600 | [diff] [blame] | 626 | Delete All Sessions |
Sushil Singh | cbbce6a | 2020-09-07 00:57:37 -0500 | [diff] [blame] | 627 | Initialize OpenBMC rest_username=${username} rest_password=${password} |
| 628 | @{Partition_file_list} = Split String ${file_name} , |
| 629 | Create Partition File ${Partition_file_list} |
| 630 | Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False} |
| 631 | Delete Local Partition File ${Partition_file_list} |
| 632 | Redfish.Delete /redfish/v1/AccountService/Accounts/${username} |
| 633 | |
| 634 | |
| 635 | Non Admin Delete Non Existence Partition File |
| 636 | [Documentation] Non admin user to uplaod the partition file. |
| 637 | [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True} |
| 638 | |
| 639 | # Description of argument(s): |
| 640 | # file_name Partition file name. |
| 641 | # username Username. |
| 642 | # password Password. |
| 643 | # role Role of user. |
| 644 | # enabled Value can be True or False. |
| 645 | |
| 646 | Redfish Create User ${username} ${password} ${role} ${enabled} |
| 647 | Delete All Sessions |
| 648 | Initialize OpenBMC rest_username=${username} rest_password=${password} |
| 649 | @{Partition_file_list} = Split String ${file_name} , |
| 650 | Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} |
| 651 | |
| 652 | |
| 653 | Verify Update Wrong Partition File To BMC |
| 654 | [Documentation] Upload the wrong partition file to BMC. |
| 655 | [Arguments] ${file_name} |
| 656 | |
| 657 | # Description of argument(s): |
| 658 | # file_name Partition file name. |
| 659 | |
| 660 | Redfish.Login |
| 661 | ${resp}= Run Keyword And Return Status |
| 662 | ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"} |
| 663 | Should Be Equal As Strings ${resp} False |