BMC and PNOR software version test
Update existing test case to handle BMC and PNOR software
version objects.
Resolves openbmc/openbmc-test-automation#837
Change-Id: I7fc355dbf1d08946ea15db4552713ae95e25e040
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tests/test_fw_version.robot b/tests/test_fw_version.robot
index d58c363..bbfcccc 100755
--- a/tests/test_fw_version.robot
+++ b/tests/test_fw_version.robot
@@ -5,57 +5,72 @@
Resource ../lib/rest_client.robot
Resource ../lib/openbmc_ffdc.robot
Resource ../lib/connection_client.robot
+Resource ../lib/code_update_utils.robot
Test Teardown FFDC On Test Case Fail
-*** Variables ***
-
-
*** Test Cases ***
-Software Version Management
- [Documentation] Verify version and activation status.
- [Tags] Software_Version_Management
- ${managed_list}= Get Software Version List
- :FOR ${element} IN @{managed_list}
- \ Verify Software Properties ${element}
+BMC Software Version
+ [Documentation] Verify BMC version and activation status.
+ [Tags] BMC_Software_Version
+ [Template] Verify Software Version
+
+ # Software Version Purpose
+ ${VERSION_PURPOSE_BMC}
+
+Host Software Version
+ [Documentation] Verify host version and activation status.
+ [Tags] Host_Software_Version
+ [Template] Verify Software Version
+
+ # Software Version Purpose
+ ${VERSION_PURPOSE_HOST}
*** Keywords ***
-Get Software Version List
- [Documentation] Get the software version endpoints list.
- # Example of JSON body data returned
- # "data": [
- # "/xyz/openbmc_project/software/53c70e7b"
- # ],
+Verify Software Version
+ [Documentation] Verify version and activation status.
+ [Arguments] ${software_purpose}
- ${resp}= OpenBMC Get Request ${SOFTWARE_VERSION_URI}
- Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
- ${jsondata}= To JSON ${resp.content}
- [Return] ${jsondata["data"]}
+ # Description of argument(s):
+ # software_purpose BMC or host software purpose.
+
+ # Example:
+ # /xyz/openbmc_project/software/list
+ # [
+ # "/xyz/openbmc_project/software/2f974579",
+ # "/xyz/openbmc_project/software/136cf504"
+ # ]
+ ${obj_list}= Get Software Objects ${software_purpose}
+ : FOR ${index} IN @{obj_list}
+ \ ${resp}= Get Host Software Property ${index}
+ \ Verify Software Properties ${resp} ${software_purpose}
Verify Software Properties
- [Documentation] Verify the software endpoints properties.
- [Arguments] ${endpoint}
- # Description of arguments:
- # endpoint Managed element by software version manager.
- # Endpoint URI would be as shown below
- # https://xx.xx.xx.xx/xyz/openbmc_project/software/53c70e7b
- ${resp}= OpenBMC Get Request ${endpoint}
- Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
- ${jsondata}= To JSON ${resp.content}
+ [Documentation] Verify the software object properties.
+ [Arguments] ${software_property} ${software_purpose}
- Check Activation Status ${jsondata["data"]["Activation"]}
- Check BMC Version ${jsondata["data"]["Version"]}
+ # Description of argument(s):
+ # software_property JSON response data.
+ # software_purpose BMC or host software purpose
+ # (e.g. "xyz.openbmc_project.Software.Version.VersionPurpose.BMC"
+ # "xyz.openbmc_project.Software.Version.VersionPurpose.Host").
+
+ Check Activation Status ${software_property["Activation"]}
+ Run Keyword If '${software_purpose}' == '${VERSION_PURPOSE_BMC}'
+ ... Check BMC Version ${software_property["Version"]}
Check BMC Version
[Documentation] Get BMC version from /etc/os-release and compare.
[Arguments] ${version}
- # Description of arguments:
+
+ # Description of argument(s):
# version Software version (e.g. "v1.99.2-107-g2be34d2-dirty")
+
Open Connection And Log In
${cmd}= Set Variable grep ^VERSION_ID= /etc/os-release | cut -f 2 -d '='
${output}= Execute Command On BMC ${cmd}
@@ -65,7 +80,8 @@
Check Activation Status
[Documentation] Check if software state is "Active".
[Arguments] ${status}
- # Description of arguments:
+
+ # Description of argument(s):
# status Activation status
# (e.g. "xyz.openbmc_project.Software.Activation.Activations.Active")
Should Be Equal As Strings ${ACTIVE} ${status}