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