Add test cases for setting invalid image priorities
Resolves openbmc/openbmc-test-automation#970
Change-Id: Ife4c5c4d19a60f191436faf8712abfc45103f168
Signed-off-by: Charles Paul Hofer <Charles.Hofer@ibm.com>
diff --git a/extended/code_update/bmc_code_update.robot b/extended/code_update/bmc_code_update.robot
index b462e1f..71395f7 100644
--- a/extended/code_update/bmc_code_update.robot
+++ b/extended/code_update/bmc_code_update.robot
@@ -42,6 +42,17 @@
${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_BMC}
+BMC Set Priority To Invalid Values
+ [Documentation] Attempt to set the priority of an image to an invalid
+ ... value and expect an error.
+ [Tags] BMC_Set_Priority_To_Invalid_Values
+ [Template] Set Priority To Invalid Value And Expect Error
+
+ # Version Type Priority
+ ${VERSION_PURPOSE_BMC} ${-1}
+ ${VERSION_PURPOSE_BMC} ${256}
+
+
Delete BMC Image
[Documentation] Delete a BMC image from the BMC flash chip.
[Tags] Delete_BMC_Image
diff --git a/extended/code_update/host_code_update.robot b/extended/code_update/host_code_update.robot
index 6d250bd..df16823 100644
--- a/extended/code_update/host_code_update.robot
+++ b/extended/code_update/host_code_update.robot
@@ -75,6 +75,17 @@
Priority ${127}
+Host Set Priority To Invalid Values
+ [Documentation] Attempt to set the priority of an image to an invalid
+ ... value and expect an error.
+ [Tags] Host_Set_Priority_To_Invalid_Values
+ [Template] Set Priority To Invalid Value And Expect Error
+
+ # Version Type Priority
+ ${VERSION_PURPOSE_HOST} ${-1}
+ ${VERSION_PURPOSE_HOST} ${256}
+
+
Set RequestedActivation To None
[Documentation] Set the RequestedActivation of the image to None and
... verify that it is in fact set to None.
diff --git a/lib/code_update_utils.robot b/lib/code_update_utils.robot
index 5286b6a..2346147 100644
--- a/lib/code_update_utils.robot
+++ b/lib/code_update_utils.robot
@@ -114,6 +114,26 @@
... &{cur_properties}[${property}]
+Set Priority To Invalid Value And Expect Error
+ [Documentation] Set the priority of an image to an invalid value and
+ ... check that an error was returned.
+ [Arguments] ${version_type} ${priority}
+
+ # Description of argument(s):
+ # version_type Either BMC or host version purpose.
+ # (e.g. "xyz.openbmc_project.Software.Version.VersionPurpose.BMC"
+ # "xyz.openbmc_project.Software.Version.VersionPurpose.Host").
+ # priority The priority value to set. Should be an integer outside of
+ # the range of 0 through 255.
+
+ ${images}= Get Software Objects version_type=${version_type}
+ ${num_images}= Get Length ${images}
+ Should Be True 0 < ${num_images}
+
+ Run Keyword And Expect Error 403 != 200
+ ... Set Host Software Property @{images}[0] Priority ${priority}
+
+
Upload And Activate Image
[Documentation] Upload an image to the BMC and activate it with REST.
[Arguments] ${image_file_path}