Wait for software object priority update.
Added:
- Keyword to read software attribute and verify.
- Wait for "Priority" update to complete for 10 seconds.
Resolves openbmc/openbmc-test-automation#1220
Change-Id: I33e56cbea09a0e6536c3da050864f3fca87fd9d7
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/code_update_utils.robot b/lib/code_update_utils.robot
index 0e5308e..5c8d025 100644
--- a/lib/code_update_utils.robot
+++ b/lib/code_update_utils.robot
@@ -180,6 +180,7 @@
# set priority to 0 and reboot the BMC.
${software_state}= Read Properties ${SOFTWARE_VERSION_URI}${version_id}
${activation}= Set Variable &{software_state}[Activation]
+
Run Keyword If
... '${skip_if_active}' == 'true' and '${activation}' == '${ACTIVE}'
... Run Keywords
@@ -206,6 +207,11 @@
${software_state}= Read Properties ${SOFTWARE_VERSION_URI}${version_id}
Should Be Equal As Strings &{software_state}[Activation] ${ACTIVE}
+ # Uploaded and activated image should have priority set to 0. Due to timing
+ # contention, it may take upto 10 seconds to complete updating priority.
+ Wait Until Keyword Succeeds 10 sec 5 sec
+ ... Check Software Object Attribute ${version_id} Priority ${0}
+
[Return] ${version_id}
@@ -440,3 +446,20 @@
\ ${resp}= OpenBMC Get Request ${uri}
\ ${json}= To JSON ${resp.content}
\ Log ${json}["data"]
+
+
+Check Software Object Attribute
+ [Documentation] Get the software property of a given object and verify.
+ [Arguments] ${image_object} ${sw_attribute} ${value}
+
+ # Description of argument(s):
+ # image_object Image software object name.
+ # sw_attribute Software attribute name.
+ # (e.g. "Activation", "Priority", "RequestedActivation" etc).
+ # value Software attribute value to compare.
+
+ ${data}= Read Attribute
+ ... ${SOFTWARE_VERSION_URI}${image_object} ${sw_attribute}
+
+ Should Be True ${data} == ${value}
+ ... msg=Given attribute value ${data} mismatch ${value}.