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