Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Secure boot related test cases. |
| 3 | |
| 4 | Resource ../lib/utils.robot |
| 5 | Resource ../lib/boot_utils.robot |
| 6 | Resource ../lib/secure_utils.robot |
| 7 | Resource ../lib/open_power_utils.robot |
George Keishing | ce72d96 | 2018-04-06 03:32:19 -0500 | [diff] [blame] | 8 | Resource ../lib/logging_utils.robot |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 9 | |
| 10 | Test Setup Test Setup Execution |
| 11 | Test Teardown Test Teardown Execution |
| 12 | |
| 13 | *** Variables *** |
| 14 | |
| 15 | ${security_access_bit_mask} ${0xC000000000000000} |
| 16 | |
| 17 | *** Test Cases *** |
| 18 | |
| 19 | Validate Secure Boot With TPM Policy Disabled |
| 20 | [Documentation] Validate secure boot with TPM policy disabled. |
| 21 | [Tags] Validate_Secure_Boot_With_TPM_Policy_Disabled |
| 22 | |
| 23 | Validate Secure Boot With TPM Policy Enabled Or Disabled ${0} |
| 24 | |
| 25 | |
| 26 | Validate Secure Boot With TPM Policy Enabled |
| 27 | [Documentation] Validate secure boot with TPM policy enabled. |
| 28 | [Tags] Validate_Secure_Boot_With_TPM_Policy_Enabled |
| 29 | |
| 30 | Validate Secure Boot With TPM Policy Enabled Or Disabled ${1} |
| 31 | |
| 32 | |
| 33 | *** Keywords *** |
| 34 | |
| 35 | Get And Verify Security Access Bit |
| 36 | [Documentation] Get and verify security access bit. |
| 37 | [Arguments] ${sol_log_file_path} |
| 38 | |
| 39 | # Description of argument(s): |
| 40 | # sol_log_file_path The path to the file containing SOL data |
| 41 | # which was collected during a REST Power On. |
| 42 | |
| 43 | # Sample output: |
| 44 | # 19.68481|SECURE|Security Access Bit> 0xC000000000000000 |
| 45 | |
| 46 | ${cmd}= Catenate |
| 47 | ... grep "Security Access Bit" ${sol_log_file_path} | awk '{ print $4 }' |
| 48 | ${rc} ${security_access_bit_str}= Run and Return RC and Output ${cmd} |
| 49 | Should Be Equal ${rc} ${0} |
| 50 | ... msg=Return code from ${cmd} not zero. |
| 51 | |
| 52 | # Verify the value of "Security Access Bit". |
| 53 | |
| 54 | ${security_access_bit}= Convert to Integer ${security_access_bit_str} |
| 55 | ${result}= Evaluate ${security_access_bit_mask} & ${security_access_bit} |
| 56 | Should Be Equal ${result} ${security_access_bit_mask} |
| 57 | ... msg=System is not booted in secure mode. values=False |
| 58 | |
| 59 | |
| 60 | Validate Secure Boot With TPM Policy Enabled Or Disabled |
| 61 | [Documentation] Validate secure boot with TPM policy enabled or disabled. |
| 62 | [Arguments] ${tpm_policy} |
| 63 | |
| 64 | # Description of argument(s): |
| 65 | # tpm_policy Enable-0 or Disable-1. |
| 66 | |
| 67 | Set And Verify TPM Policy ${tpm_policy} |
| 68 | REST Power On quiet=1 |
| 69 | Validate Secure Boot ${sol_log_file_path} |
| 70 | |
| 71 | |
| 72 | Validate Secure Boot |
| 73 | [Documentation] Validate secure boot. |
| 74 | [Arguments] ${sol_log_file_path} |
| 75 | |
| 76 | # Description of argument(s): |
| 77 | # sol_log_file_path The path to the file containing SOL data |
| 78 | # which was collected during a REST Power On. |
| 79 | |
| 80 | Get And Verify Security Access Bit ${sol_log_file_path} |
| 81 | Error Logs Should Not Exist |
| 82 | REST Verify No Gard Records |
| 83 | |
| 84 | |
| 85 | Test Setup Execution |
| 86 | [Documentation] Test setup execution. |
| 87 | |
| 88 | ${timestamp}= Get Current Date result_format=%Y%m%d%H%M%S |
| 89 | ${sol_log_file_path}= Catenate ${EXECDIR}/Secure_SOL${timestamp} |
| 90 | Start SOL Console Logging ${sol_log_file_path} |
| 91 | Set Suite Variable ${sol_log_file_path} |
| 92 | |
| 93 | REST Power Off stack_mode=skip quiet=1 |
| 94 | Delete Error Logs And Verify |
| 95 | Clear BMC Gard record |
| 96 | |
| 97 | |
| 98 | Test Teardown Execution |
| 99 | [Documentation] Test teardown execution. |
| 100 | |
| 101 | Stop SOL Console Logging |
| 102 | Run rm -rf ${sol_log_file_path} |