Secureboot test cases:
Added:
- Test to verify TPMPolicy Enabled and Disabled.
Resolves openbmc/openbmc-test-automation#1312
Change-Id: I1c2562bb4bc9bb8910d393fdc27ea6489549dec8
Signed-off-by: Sweta Potthuri <spotthur@in.ibm.com>
diff --git a/lib/open_power_utils.robot b/lib/open_power_utils.robot
index c657d05..84eb0b9 100644
--- a/lib/open_power_utils.robot
+++ b/lib/open_power_utils.robot
@@ -162,3 +162,11 @@
... Append To List ${power_supply_avg_list} ${entry}
[Return] ${power_supply_avg_list} ${power_supply_max_list}
+
+
+REST Verify No Gard Records
+ [Documentation] Verify no gard records are present.
+
+ ${resp}= Read Properties ${OPENPOWER_CONTROL}gard/enumerate
+ Log Dictionary ${resp}
+ Should Be Empty ${resp} msg=Found gard records.
diff --git a/lib/secure_utils.robot b/lib/secure_utils.robot
new file mode 100755
index 0000000..9e645e5
--- /dev/null
+++ b/lib/secure_utils.robot
@@ -0,0 +1,27 @@
+*** Settings ***
+Documentation Secure boot keywords.
+
+*** Keywords ***
+
+Set TPMEnable Policy
+ [Documentation] Enable or disable TPM Policy.
+ [Arguments] ${tpm_policy}
+
+ # Description of argument(s):
+ # tpm_policy Enable-1 or Disable-0.
+
+ ${value_dict}= Create Dictionary data=${tpm_policy}
+ Write Attribute ${CONTROL_HOST_URI}/TPMEnable TPMEnable
+ ... data=${value_dict}
+
+
+Set And Verify TPM Policy
+ [Documentation] Enable or disable and verify TPM Policy.
+ [Arguments] ${tpm_policy}
+
+ # Description of argument(s):
+ # tpm_policy Enable-1 or Disable-0.
+
+ Set TPMEnable Policy ${tpm_policy}
+ ${resp}= Verify The Attribute
+ ... ${CONTROL_URI}/host0/TPMEnable TPMEnable ${tpm_policy}
diff --git a/lib/utils.robot b/lib/utils.robot
index f77f057..e550491 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -1511,3 +1511,16 @@
... xyz.openbmc_project.Led.Physical.Action.${expected_state}
... msg=Unexpected LED state.
+
+Verify The Attribute
+ [Arguments] ${uri} ${attribute_name} ${attribute_value}
+
+ # Description of argument(s):
+ # uri URI path
+ # (e.g. "/xyz/openbmc_project/control/host0/TPMEnable").
+ # attribute_name Name of attribute to be verified (e.g. "TPMEnable").
+ # attribute_value The expected value of attribute (e.g. "1", "0", etc.)
+
+ ${output}= Read Attribute ${uri} ${attribute_name}
+ Should Be Equal ${attribute_value} ${output}
+ ... msg=Attribute "${attribute_name} does not have the expected value.