Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Secure boot related test cases. |
| 3 | |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 4 | # Test Parameters: |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 5 | # SEL to PEL conversion: |
| 6 | # https://github.com/openbmc/openbmc-test-automation/blob/master/docs/ |
| 7 | # openbmc_test_tools.md#converting-sels-to-readable-format |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 8 | # |
| 9 | # Definition of each partition acronyms |
| 10 | # HBB: Hostboot Base |
| 11 | # HBI: Hostboot Extended Image |
| 12 | # HBRT: Hostboot Runtime |
| 13 | # HBD: Hostboot Data |
| 14 | # HBBL: Bostboot Base loader |
| 15 | # SBE: Self Boot Engine |
| 16 | # OCC: On Chip Controller |
Lakshminarayana R. Kammath | 2c0f28e | 2019-04-12 12:59:34 -0500 | [diff] [blame] | 17 | # PAYLOAD : OPAL Partition |
| 18 | # HCODE : Hardware Code |
| 19 | # BOOTKERNEL : OPAL Boot Kernel |
| 20 | # WOFDATA : Workload Optimized Frequency Data |
| 21 | # MEMD : Memory VPD |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 22 | |
George Keishing | a8b2549 | 2018-06-07 01:15:37 -0500 | [diff] [blame] | 23 | Resource ../../lib/utils.robot |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 24 | Resource ../../lib/state_manager.robot |
George Keishing | a8b2549 | 2018-06-07 01:15:37 -0500 | [diff] [blame] | 25 | Resource ../../lib/boot_utils.robot |
Lakshminarayana R. Kammath | eca4dce | 2019-03-27 12:28:06 -0500 | [diff] [blame] | 26 | Resource ../../lib/secureboot/secureboot.robot |
George Keishing | a8b2549 | 2018-06-07 01:15:37 -0500 | [diff] [blame] | 27 | Resource ../../lib/open_power_utils.robot |
| 28 | Resource ../../lib/logging_utils.robot |
| 29 | Resource ../../lib/openbmc_ffdc_methods.robot |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 30 | |
George Keishing | a8b2549 | 2018-06-07 01:15:37 -0500 | [diff] [blame] | 31 | Library ../../lib/gen_misc.py |
Lakshminarayana R. Kammath | eca4dce | 2019-03-27 12:28:06 -0500 | [diff] [blame] | 32 | Library ../../lib/secureboot/secureboot.py |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 33 | |
| 34 | Suite Setup Suite Setup Execution |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 35 | Test Setup Test Setup Execution |
| 36 | Test Teardown Test Teardown Execution |
| 37 | |
| 38 | *** Variables *** |
| 39 | |
| 40 | ${security_access_bit_mask} ${0xC000000000000000} |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 41 | # TODO: will enable this in next commit |
| 42 | #${pnor_corruption_rc} SECUREBOOT::RC_ROM_VERIFY |
| 43 | ${pnor_corruption_rc} 0x1E07 |
Lakshminarayana R. Kammath | 2c0f28e | 2019-04-12 12:59:34 -0500 | [diff] [blame] | 44 | ${bootkernel_corruption_rc} log=0xffffffffffff8160 |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 45 | ${bmc_image_dir_path} /usr/local/share/pnor |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 46 | ${bmc_guard_part_path} /var/lib/phosphor-software-manager/pnor/prsv/GUARD |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 47 | ${HB_PART_LIST} [HBB, HBD, HBI, HBRT, HBBL] |
Lakshminarayana R. Kammath | 2c0f28e | 2019-04-12 12:59:34 -0500 | [diff] [blame] | 48 | ${NON_HB_PART_LIST} [SBE, OCC, HCODE, WOFDATA, MEMD, PAYLOAD] |
| 49 | ${MIXED_PART_LIST} [SBE, HBD, OCC, HBRT, HBBL, HCODE, WOFDATA, MEMD, PAYLOAD] |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 50 | |
| 51 | *** Test Cases *** |
| 52 | |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 53 | # All the test cases requires by default jumpers to be positioned |
| 54 | # between 1 & 2. If this is not met test cases would fail |
| 55 | # TODO:https://github.com/openbmc/openbmc-test-automation/issues/1644 |
| 56 | Validate Secure Cold Boot With TPM Policy Disabled |
| 57 | [Documentation] Validate secure cold boot with TPM policy disabled. |
| 58 | [Tags] Validate_Secure_Cold_Boot_With_TPM_Policy_Disabled |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 59 | |
| 60 | Validate Secure Boot With TPM Policy Enabled Or Disabled ${0} |
| 61 | |
| 62 | |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 63 | Validate Secure Cold Boot With TPM Policy Enabled |
| 64 | [Documentation] Validate secure cold boot with TPM policy enabled. |
| 65 | [Tags] Validate_Secure_Cold_Boot_With_TPM_Policy_Enabled |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 66 | |
| 67 | Validate Secure Boot With TPM Policy Enabled Or Disabled ${1} |
| 68 | |
| 69 | |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 70 | Secure Boot Violation Using Corrupt SBE Image On Cold Boot |
| 71 | [Documentation] Secure boot violation using corrupt SBE image on cold boot. |
| 72 | [Tags] Secure_Boot_Violation_Using_Corrupt_SBE_Image_On_Cold_Boot |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 73 | |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 74 | Violate Secure Boot Using Corrupt Image |
| 75 | ... SBE ${pnor_corruption_rc} ${bmc_image_dir_path} |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 76 | |
| 77 | |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 78 | Secure Boot Violation Using Corrupt HBD Image On Cold Boot |
| 79 | [Documentation] Secure boot violation using corrupt HBD image on cold boot. |
| 80 | [Tags] Secure_Boot_Violation_Using_Corrupt_HBD_Image_On_Cold_Boot |
| 81 | |
| 82 | Violate Secure Boot Using Corrupt Image |
| 83 | ... HBD ${pnor_corruption_rc} ${bmc_image_dir_path} |
| 84 | |
| 85 | Secure Boot Violation Using Corrupt HBB Image On Cold Boot |
| 86 | [Documentation] Secure boot violation using corrupt HBB image on cold boot. |
| 87 | [Tags] Secure_Boot_Violation_Using_Corrupt_HBB_Image_On_Cold_Boot |
| 88 | |
| 89 | Violate Secure Boot Using Corrupt Image |
| 90 | ... HBB ${pnor_corruption_rc} ${bmc_image_dir_path} |
| 91 | |
Lakshminarayana R. Kammath | 2c0f28e | 2019-04-12 12:59:34 -0500 | [diff] [blame] | 92 | |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 93 | Secure Boot Violation Using Corrupt HBBL Image On Cold Boot |
| 94 | [Documentation] Secure boot violation using corrupt HBBL image on cold boot. |
| 95 | [Tags] Secure_Boot_Violation_Using_Corrupt_HBBL_Image_On_Cold_Boot |
| 96 | |
| 97 | Violate Secure Boot Using Corrupt Image |
| 98 | ... HBBL ${pnor_corruption_rc} ${bmc_image_dir_path} |
| 99 | |
| 100 | |
| 101 | Secure Boot Violation Using Corrupt HBI Image On Cold Boot |
| 102 | [Documentation] Secure boot violation using corrupt HBI image on cold boot. |
| 103 | [Tags] Secure_Boot_Violation_Using_Corrupt_HBI_Image_On_Cold_Boot |
| 104 | |
| 105 | Violate Secure Boot Using Corrupt Image |
| 106 | ... HBI ${pnor_corruption_rc} ${bmc_image_dir_path} |
| 107 | |
| 108 | |
| 109 | Secure Boot Violation Using Corrupt HBRT Image On Cold Boot |
| 110 | [Documentation] Secure boot violation using corrupt HBRT image on cold boot. |
| 111 | [Tags] Secure_Boot_Violation_Using_Corrupt_HBRT_Image_On_Cold_Boot |
| 112 | |
| 113 | Violate Secure Boot Using Corrupt Image |
| 114 | ... HBRT ${pnor_corruption_rc} ${bmc_image_dir_path} |
| 115 | |
| 116 | |
| 117 | Secure Boot Violation Using Corrupt OCC Image On Cold Boot |
| 118 | [Documentation] Secure boot violation using corrupt OCC image on cold boot. |
| 119 | [Tags] Secure_Boot_Violation_Using_Corrupt_OCC_Image_On_Cold_Boot |
| 120 | |
| 121 | Violate Secure Boot Using Corrupt Image |
| 122 | ... OCC ${pnor_corruption_rc} ${bmc_image_dir_path} |
| 123 | |
Lakshminarayana R. Kammath | 2c0f28e | 2019-04-12 12:59:34 -0500 | [diff] [blame] | 124 | |
| 125 | Secure Boot Violation Using Corrupt HCODE Image On Cold Boot |
| 126 | [Documentation] Secure boot violation using corrupt HCODE image on cold boot. |
| 127 | [Tags] Secure_Boot_Violation_Using_Corrupt_HCODE_Image_On_Cold_Boot |
| 128 | |
| 129 | Violate Secure Boot Using Corrupt Image |
| 130 | ... HCODE ${pnor_corruption_rc} ${bmc_image_dir_path} |
| 131 | |
| 132 | |
| 133 | Secure Boot Violation Using Corrupt WOFDATA Image On Cold Boot |
| 134 | [Documentation] Secure boot violation using corrupt HCODE image on cold boot. |
| 135 | [Tags] Secure_Boot_Violation_Using_Corrupt_WOFDATA_Image_On_Cold_Boot |
| 136 | |
| 137 | Violate Secure Boot Using Corrupt Image |
| 138 | ... WOFDATA ${pnor_corruption_rc} ${bmc_image_dir_path} |
| 139 | |
| 140 | |
| 141 | Secure Boot Violation Using Corrupt BOOTKERNEL Image On Cold Boot |
| 142 | [Documentation] Secure boot violation using corrupt BOOTKERNEL image on cold boot. |
| 143 | [Tags] Secure_Boot_Violation_Using_Corrupt_BOOTKERNEL_Image_On_Cold_Boot |
| 144 | |
| 145 | Violate Secure Boot Using Corrupt Image |
| 146 | ... BOOTKERNEL ${bootkernel_corruption_rc} ${bmc_image_dir_path} |
| 147 | |
| 148 | |
| 149 | Secure Boot Violation Using Corrupt MEMD Image On Cold Boot |
| 150 | [Documentation] Secure boot violation using corrupt MEMD image on cold boot. |
| 151 | [Tags] Secure_Boot_Violation_Using_Corrupt_MEMD_Image_On_Cold_Boot |
| 152 | |
| 153 | Violate Secure Boot Using Corrupt Image |
| 154 | ... MEMD ${pnor_corruption_rc} ${bmc_image_dir_path} |
| 155 | |
| 156 | |
| 157 | Secure Boot Violation Using Corrupt PAYLOAD Image On Cold Boot |
| 158 | [Documentation] Secure boot violation using corrupt PAYLOAD image on cold boot. |
| 159 | [Tags] Secure_Boot_Violation_Using_Corrupt_PAYLOAD_Image_On_Cold_Boot |
| 160 | |
| 161 | Violate Secure Boot Using Corrupt Image |
| 162 | ... PAYLOAD ${pnor_corruption_rc} ${bmc_image_dir_path} |
| 163 | |
| 164 | |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 165 | *** Keywords *** |
| 166 | |
Lakshminarayana R. Kammath | eca4dce | 2019-03-27 12:28:06 -0500 | [diff] [blame] | 167 | Validate Secure Boot Setup |
| 168 | [Documentation] Validates setup to make sure it's secureboot run capable. |
| 169 | |
| 170 | # Check the jumper position and Security settings before moving ahead. |
| 171 | ${num_procs} ${secureboot_state} ${jumper_state}= Get Secure Boot Info |
| 172 | |
| 173 | Rprint Vars secureboot_state jumper_state |
| 174 | |
| 175 | Should Be True ${secureboot_state} == True and ${jumper_state} == False |
Lakshminarayana R. Kammath | 0d7b6a6 | 2019-04-02 00:46:58 -0500 | [diff] [blame] | 176 | ... msg=Jumper is on while secureboot is disabled. Put the jumpers between pins 2 and 3. |
Lakshminarayana R. Kammath | eca4dce | 2019-03-27 12:28:06 -0500 | [diff] [blame] | 177 | |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 178 | Violate Secure Boot Using Corrupt Image |
| 179 | [Documentation] Cause secure boot violation during cold boot |
| 180 | ... with corrupted image. |
| 181 | [Arguments] ${partition} ${error_rc} ${bmc_image_dir_path} |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 182 | |
Gunnar Mills | 7732c7e | 2018-08-14 11:54:24 -0500 | [diff] [blame] | 183 | # Description of argument(s): |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 184 | # partition The partition which is to be corrupted |
| 185 | # (e.g. "SBE", "HBI", "HBB", "HBRT", "HBBL", "OCC"). |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 186 | # error_rc The RC that is expected as a |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 187 | # result of the secure boot violation |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 188 | # (e.g. "SECUREBOOT::RC_ROM_VERIFY"). |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 189 | # bmc_image_dir_path BMC image path. |
| 190 | |
| 191 | Set And Verify TPM Policy ${1} |
| 192 | |
| 193 | # Descipiton: |
| 194 | # Cause a secure boot violation by copying an BMC image file to the |
| 195 | # target BMC and then starting a power on. |
| 196 | # This action should result in: |
| 197 | # 1) an error log entry |
| 198 | # 2) the system going to "Quiesced" state. |
| 199 | |
| 200 | # Load corrupted image to /usr/local/share/pnor. |
| 201 | Open Connection For SCP |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 202 | |
Lakshminarayana R. Kammath | 2c0f28e | 2019-04-12 12:59:34 -0500 | [diff] [blame] | 203 | # Some times it is observed that bigger size files doesn't get copied. |
| 204 | # Our intention here is to test bad image. Even if it is truncated/partial, |
| 205 | # that should be fine |
| 206 | Run Keyword And Ignore Error scp.Put File |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 207 | ... ${ENV_SB_CORRUPTED_BIN_PATH}/${partition} ${bmc_image_dir_path} |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 208 | |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 209 | ${error_log_path}= Catenate ${SB_LOG_DIR_PATH}/partition-corruption |
| 210 | Create Directory ${error_log_path} |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 211 | |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 212 | Set Global Variable ${error_log_path} |
| 213 | Log ${error_log_path} |
| 214 | |
| 215 | # Starting a power on. |
| 216 | # TODO: Need to move to REST Power On. Needs more testing. |
| 217 | BMC Execute Command /usr/sbin/obmcutil poweron |
| 218 | Wait Until Keyword Succeeds 15 min 15 sec Error Logs Should Exist |
| 219 | |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 220 | #TODO: This will be enabled little later as more tesing required |
| 221 | #Wait Until Keyword Succeeds 5 min 5 sec |
| 222 | #... Collect Error Logs and Verify SRC ${error_rc} ${error_log_path} |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 223 | |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 224 | # Expected behavior is that the error occurs early in the boot process, |
| 225 | # therefore, no entry in the error log and nothing to decode. |
| 226 | # The 1E07 error is written to PNOR & then goes into Quiesced state. |
| 227 | # On the next valid boot, the error log will be sent to BMC & |
| 228 | # seen on SOL console |
| 229 | Run Keyword If '${partition}' in '${NON_HB_PART_LIST}' |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 230 | # Verify the RC 0x1E07 in the SOL logs. |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 231 | ... Get And Verify Partition Corruption ${partition} ${sol_log_file_path} |
| 232 | ... ELSE IF '${partition}' in '${HB_PART_LIST}' |
| 233 | ... Log To Console ${partition} corrupted, Going to quiesced state. |
Lakshminarayana R. Kammath | 2c0f28e | 2019-04-12 12:59:34 -0500 | [diff] [blame] | 234 | # If the partition corrupted is BOOTKERNEL then, host will not reach quisced. |
| 235 | # It will keep rebooting in loop for ever. |
| 236 | ... ELSE IF '${partition}' == 'BOOTKERNEL' |
| 237 | ... Log To Console ${partition} corrupted, It will keep rebooting in loop. |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 238 | |
| 239 | # Remove the file from /usr/local/share/pnor/. |
| 240 | BMC Execute Command rm -rf ${bmc_image_dir_path}* |
| 241 | |
| 242 | # Check if system reaches quiesce state. |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 243 | # Default system state will be power off at the end of the verification. |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 244 | Run Keywords |
| 245 | ... Wait Until Keyword Succeeds 3 min 5 sec Is Host Quiesced AND |
| 246 | ... Recover Quiesced Host |
| 247 | |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 248 | # We will retry boot with corrupted partition removed |
| 249 | # SOL console should show previous boot fail message (1E07) on current boot |
| 250 | # HBB corruption will never get far enough to log into PNOR. |
| 251 | # so, it should be removed from consideration for this check |
| 252 | Run Keyword If '${partition}' == 'HBB' |
| 253 | ... Log To Console No more action on ${partition} corruption required. |
| 254 | ... ELSE IF '${partition}' in '[HBD, HBI, HBRT, HBBL]' |
| 255 | ... Run Keywords |
| 256 | ... REST Power On stack_mode=skip quiet=1 AND |
| 257 | ... Wait Until Keyword Succeeds 5 min 5 sec Error Logs Should Exist AND |
| 258 | ... Get And Verify Partition Corruption ${partition} ${sol_log_file_path} AND |
| 259 | ... REST Power Off stack_mode=skip quiet=1 |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 260 | |
| 261 | Collect Error Logs and Verify SRC |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 262 | [Documentation] Verify error log entry & signature description. |
| 263 | [Arguments] ${error_rc} ${log_prefix} |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 264 | |
| 265 | # Description of argument(s): |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 266 | # error_rc Error log signature description. |
| 267 | # log_prefix Log path prefix. |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 268 | |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 269 | Error Logs Should Not Exist |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 270 | |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 271 | Collect eSEL Log ${log_prefix} |
| 272 | ${error_log_file_path}= Catenate ${log_prefix}esel.txt |
| 273 | ${rc} ${output}= Run and Return RC and Output |
| 274 | ... grep -i ${error_rc} ${error_log_file_path} |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 275 | Should Be Equal ${rc} ${0} |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 276 | Should Not Be Empty ${output} |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 277 | |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 278 | Get And Verify Security Access Bit |
| 279 | [Documentation] Get and verify security access bit. |
| 280 | [Arguments] ${sol_log_file_path} |
| 281 | |
| 282 | # Description of argument(s): |
| 283 | # sol_log_file_path The path to the file containing SOL data |
| 284 | # which was collected during a REST Power On. |
| 285 | |
| 286 | # Sample output: |
| 287 | # 19.68481|SECURE|Security Access Bit> 0xC000000000000000 |
| 288 | |
| 289 | ${cmd}= Catenate |
| 290 | ... grep "Security Access Bit" ${sol_log_file_path} | awk '{ print $4 }' |
| 291 | ${rc} ${security_access_bit_str}= Run and Return RC and Output ${cmd} |
| 292 | Should Be Equal ${rc} ${0} |
| 293 | ... msg=Return code from ${cmd} not zero. |
| 294 | |
| 295 | # Verify the value of "Security Access Bit". |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 296 | # If fails, probable issue is Jumper position. |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 297 | |
| 298 | ${security_access_bit}= Convert to Integer ${security_access_bit_str} |
| 299 | ${result}= Evaluate ${security_access_bit_mask} & ${security_access_bit} |
| 300 | Should Be Equal ${result} ${security_access_bit_mask} |
| 301 | ... msg=System is not booted in secure mode. values=False |
| 302 | |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 303 | Get And Verify Partition Corruption |
| 304 | [Documentation] Get and verify partition corruption. |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 305 | [Arguments] ${partition} ${sol_log_file_path} |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 306 | |
| 307 | # Description of argument(s): |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 308 | # partition The partition which is to be corrupted |
| 309 | # (e.g. "SBE", "HBI", "HBB", "HBRT", "HBBL", "OCC"). |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 310 | # sol_log_file_path The path to the file containing SOL data |
| 311 | # which was collected during a REST Power On. |
| 312 | |
| 313 | # Sample output: |
| 314 | # 44.47498|secure|Secureboot Failure plid = 0x90000007, rc = 0x1E07 |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 315 | # OR |
| 316 | # 14.94315|Error reported by secure (0x1E00) PLID 0x90000002 |
| 317 | # 14.99659| ROM_verify() Call Failed |
| 318 | # 14.99659| ModuleId 0x03 SECUREBOOT::MOD_SECURE_ROM_VERIFY |
| 319 | # 14.99660| ReasonCode 0x1e07 SECUREBOOT::RC_ROM_VERIFY |
Lakshminarayana R. Kammath | 2c0f28e | 2019-04-12 12:59:34 -0500 | [diff] [blame] | 320 | # OR |
| 321 | # 113.150162849,0] STB: BOOTKERNEL verification FAILED. log=0xffffffffffff8160 |
| 322 | # |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 323 | |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 324 | ${cmd}= Run Keyword If '${partition}' in '${MIXED_PART_LIST}' |
| 325 | ... Catenate |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 326 | ... grep -i "Secureboot Failure" ${sol_log_file_path} | awk '{ print $8 }' |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 327 | ... ELSE IF '${partition}' == 'HBI' |
| 328 | ... Catenate |
| 329 | ... grep -i "ReasonCode" ${sol_log_file_path} | awk '{ print $3 }' |
Lakshminarayana R. Kammath | 2c0f28e | 2019-04-12 12:59:34 -0500 | [diff] [blame] | 330 | ... ELSE IF '{$partition}' == 'BOOTKERNEL' |
| 331 | ... Catenate |
| 332 | ... grep -i "STB: BOOTKERNEL verification FAILED" ${sol_log_file_path} | awk '{ print $7}' |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 333 | |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 334 | ${rc} ${corruption_rc_str}= Run and Return RC and Output ${cmd} |
| 335 | Should Be Equal ${rc} ${0} |
| 336 | ... msg=Return code from ${cmd} not zero. |
| 337 | |
| 338 | # Verify the RC 0x1E07 from sol output". |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 339 | Should Be Equal As Strings |
| 340 | ... ${corruption_rc_str} ${pnor_corruption_rc} ignore_case=True |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 341 | ... msg=SB violation due to PNOR partition corruption not reported. values=False |
| 342 | |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 343 | |
| 344 | Validate Secure Boot With TPM Policy Enabled Or Disabled |
| 345 | [Documentation] Validate secure boot with TPM policy enabled or disabled. |
| 346 | [Arguments] ${tpm_policy} |
| 347 | |
| 348 | # Description of argument(s): |
| 349 | # tpm_policy Enable-0 or Disable-1. |
| 350 | |
| 351 | Set And Verify TPM Policy ${tpm_policy} |
| 352 | REST Power On quiet=1 |
| 353 | Validate Secure Boot ${sol_log_file_path} |
| 354 | |
| 355 | |
| 356 | Validate Secure Boot |
| 357 | [Documentation] Validate secure boot. |
| 358 | [Arguments] ${sol_log_file_path} |
| 359 | |
| 360 | # Description of argument(s): |
| 361 | # sol_log_file_path The path to the file containing SOL data |
| 362 | # which was collected during a REST Power On. |
| 363 | |
| 364 | Get And Verify Security Access Bit ${sol_log_file_path} |
| 365 | Error Logs Should Not Exist |
| 366 | REST Verify No Gard Records |
| 367 | |
| 368 | |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 369 | Suite Setup Execution |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 370 | [Documentation] Suite Setup Execution. |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 371 | |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 372 | ${bmc_image_dir_path}= Add Trailing Slash ${bmc_image_dir_path} |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 373 | |
| 374 | ${SB_LOG_DIR_PATH}= Catenate ${EXECDIR}/SB_logs/ |
| 375 | Set Suite Variable ${SB_LOG_DIR_PATH} |
| 376 | |
| 377 | Create Directory ${SB_LOG_DIR_PATH} |
| 378 | Empty Directory ${SB_LOG_DIR_PATH} |
Lakshminarayana R. Kammath | 077fbf9 | 2019-02-20 11:15:18 -0600 | [diff] [blame] | 379 | |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 380 | Set Global Variable ${bmc_image_dir_path} |
| 381 | Log ${bmc_image_dir_path} |
| 382 | BMC Execute Command rm -rf ${bmc_image_dir_path}* |
| 383 | |
Lakshminarayana R. Kammath | 6c91829 | 2019-02-22 05:05:22 -0600 | [diff] [blame] | 384 | Set Global Variable ${bmc_guard_part_path} |
| 385 | Log ${bmc_guard_part_path} |
| 386 | BMC Execute Command rm -rf ${bmc_guard_part_path} |
Lakshminarayana R. Kammath | 077fbf9 | 2019-02-20 11:15:18 -0600 | [diff] [blame] | 387 | |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 388 | # All the corrupted binaries will go in here |
| 389 | # Run this as input param |
| 390 | Should Not Be Empty ${ENV_SB_CORRUPTED_BIN_PATH} |
| 391 | Set Environment Variable PATH %{PATH}:${ENV_SB_CORRUPTED_BIN_PATH} |
| 392 | |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 393 | |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 394 | Test Setup Execution |
| 395 | [Documentation] Test setup execution. |
| 396 | |
| 397 | ${timestamp}= Get Current Date result_format=%Y%m%d%H%M%S |
| 398 | ${sol_log_file_path}= Catenate ${EXECDIR}/Secure_SOL${timestamp} |
| 399 | Start SOL Console Logging ${sol_log_file_path} |
| 400 | Set Suite Variable ${sol_log_file_path} |
| 401 | |
Lakshminarayana R. Kammath | eca4dce | 2019-03-27 12:28:06 -0500 | [diff] [blame] | 402 | REST Power On stack_mode=skip quiet=1 |
| 403 | |
| 404 | # Validate the secureboot setup. If not met with required state then, fail. |
| 405 | Validate Secure Boot Setup |
| 406 | |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 407 | REST Power Off stack_mode=skip quiet=1 |
| 408 | Delete Error Logs And Verify |
Lakshminarayana R. Kammath | 077fbf9 | 2019-02-20 11:15:18 -0600 | [diff] [blame] | 409 | |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 410 | |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 411 | Test Teardown Execution |
| 412 | [Documentation] Test teardown execution. |
| 413 | |
| 414 | Stop SOL Console Logging |
| 415 | Run rm -rf ${sol_log_file_path} |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 416 | |
devindia | 54b1393 | 2019-03-20 04:38:08 -0500 | [diff] [blame] | 417 | # Collect FFDC on failure |
| 418 | FFDC On Test Case Fail |
| 419 | |
Sweta Potthuri | d3c0343 | 2018-04-19 11:30:27 -0500 | [diff] [blame] | 420 | # Removing the corrupted file from BMC. |
| 421 | BMC Execute Command rm -rf ${bmc_image_dir_path}* |