Added test cases for uploading multiple images
Resolves openbmc/openbmc-test-automation#873
Change-Id: I2ac5b9acd6955c5d600099e39771f1feeeddc2c9
Signed-off-by: Charles Paul Hofer <Charles.Hofer@ibm.com>
diff --git a/lib/code_update_utils.py b/lib/code_update_utils.py
index 5026878..5dd0ca7 100644
--- a/lib/code_update_utils.py
+++ b/lib/code_update_utils.py
@@ -20,6 +20,34 @@
from robot.libraries.BuiltIn import BuiltIn
###############################################################################
+def verify_no_duplicate_image_priorities(image_purpose):
+
+ r"""
+ Check that there are no active images with the same purpose and priority.
+
+ Description of argument(s):
+ image_purpose The purpose that images must have to be checked for
+ priority duplicates.
+ """
+
+ taken_priorities = {}
+ _, image_names = keyword.run_key("Get Software Objects "
+ + "version_type=" + image_purpose)
+
+ for image_name in image_names:
+ _, image = keyword.run_key("Get Host Software Property " + image_name)
+ if image["Activation"] != var.ACTIVE:
+ continue
+ image_priority = image["Priority"]
+ if image_priority in taken_priorities:
+ BuiltIn().fail("Found active images with the same priority.\n"
+ + gp.sprint_vars(image, taken_priorities[image_priority]))
+ taken_priorities[image_priority] = image
+
+###############################################################################
+
+
+###############################################################################
def get_non_running_bmc_software_object():
r"""