Add tests for properly formed software objects
Resolves openbmc/openbmc-test-automation#1009
Change-Id: If9bf96073ccc4658fef85b55f5e1409f8a13c6f9
Signed-off-by: Charles Paul Hofer <Charles.Hofer@ibm.com>
diff --git a/tests/test_software_manager.robot b/tests/test_software_manager.robot
index 73af849..8351584 100755
--- a/tests/test_software_manager.robot
+++ b/tests/test_software_manager.robot
@@ -6,8 +6,8 @@
Resource ../lib/openbmc_ffdc.robot
Resource ../lib/connection_client.robot
Resource ../lib/code_update_utils.robot
-Test Teardown FFDC On Test Case Fail
+Test Teardown FFDC On Test Case Fail
*** Variables ***
@@ -16,6 +16,29 @@
*** Test Cases ***
+Verify Software Purposes
+ [Documentation] Verify that all software objects have a valid 'Purpose'
+ ... field.
+ [Tags] Verify_Software_Purpose
+
+ ${object_uris}= Read Properties ${SOFTWARE_VERSION_URI}/list
+
+ :FOR ${uri} IN @{object_uris}
+ \ ${object}= Read Properties ${uri}
+ \ Continue For Loop If not 'Purpose' in ${object}
+ \ Should Contain Any &{object}[Purpose] ${VERSION_PURPOSE_HOST}
+ ... ${VERSION_PURPOSE_BMC}
+
+
+BMC Software Hex ID
+ [Documentation] Verify BMC images have valid 8-digit hex IDs.
+ [Tags] BMC_Software_Hex_ID
+ [Template] Verify Software Hex IDs
+
+ # Software Purpose
+ ${VERSION_PURPOSE_BMC}
+
+
BMC Software Version
[Documentation] Verify BMC version and activation status.
[Tags] BMC_Software_Version
@@ -25,6 +48,25 @@
${VERSION_PURPOSE_BMC}
+BMC Software Path
+ [Documentation] Verify BMC images have valid 'Path' properties.
+ [Tags] BMC_Software_Path
+ [Template] Verify Software Path
+
+ # Software Version
+ ${VERSION_PURPOSE_BMC}
+
+
+BMC Software RequestedActivation
+ [Documentation] Veriify BMC images have valid 'RequestedActivation'
+ ... properties.
+ [Tags] BMC_Software_RequestedActivation
+ [Template] Verify Software RequestedActivation
+
+ # Software Purpose
+ ${VERSION_PURPOSE_BMC}
+
+
BMC Software Activation Association
[Documentation] Verify BMC association.
[Tags] BMC_Software_Activation_Association
@@ -34,6 +76,15 @@
${VERSION_PURPOSE_BMC} ${BMC_SW_PATH}
+Host Software Hex ID
+ [Documentation] Verify host images have valid 8-digit hex IDs.
+ [Tags] Host_Software_Hex_ID
+ [Template] Verify Software Hex IDs
+
+ # Software Purpose
+ ${VERSION_PURPOSE_HOST}
+
+
Host Software Version
[Documentation] Verify host version and activation status.
[Tags] Host_Software_Version
@@ -43,6 +94,25 @@
${VERSION_PURPOSE_HOST}
+Host Software Path
+ [Documentation] Verify host images have valid 'Path' properties.
+ [Tags] Host_Software_Path
+ [Template] Verify Software Path
+
+ # Software Version
+ ${VERSION_PURPOSE_HOST}
+
+
+Host Software RequestedActivation
+ [Documentation] Veriify host images have valid 'RequestedActivation'
+ ... properties.
+ [Tags] BMC_Software_RequestedActivation
+ [Template] Verify Software RequestedActivation
+
+ # Software Purpose
+ ${VERSION_PURPOSE_HOST}
+
+
Host Software Activation Association
[Documentation] Verify Host association.
[Tags] Host_Software_Activation_Association
@@ -54,6 +124,41 @@
*** Keywords ***
+Verify Software Hex IDs
+ [Documentation] Verify software has valid hex IDs.
+ [Arguments] ${software_purpose}
+
+ ${software_ids}= Get Software Objects Id ${software_purpose}
+
+ : FOR ${id} IN @{software_ids}
+ \ Length Should Be ${id} ${8}
+ \ Should Match Regexp ${id} [0-9a-f]*
+
+
+Verify Software Path
+ [Documentation] Verify software has valid 'Path' properties.
+ [Arguments] ${software_purpose}
+
+ ${software_uris}= Get Software Objects ${software_purpose}
+
+ : FOR ${uri} IN @{software_uris}
+ \ ${software_object}= Get Host Software Property ${uri}
+ \ Return From Keyword If len('&{software_object}[Path]') == ${0}
+ \ BMC Execute Command [ -d "${path}" ]
+
+
+Verify Software RequestedActivation
+ [Documentation] Verify that software has valid 'Purpose' properties.
+ [Arguments] ${software_purpose}
+
+ ${software_uris}= Get Software Objects ${software_purpose}
+
+ : FOR ${uri} IN @{software_uris}
+ \ ${software_object}= Get Host Software Property ${uri}
+ \ Should Contain Any &{software_object}[RequestedActivation]
+ ... ${REQUESTED_ACTIVE} ${REQUESTED_NONE}
+
+
Verify Software Activation Association
[Documentation] Verify software activation association.
[Arguments] ${software_purpose} ${assoiation_path}