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