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