Test to set software object "Priority"

Resolves  openbmc/openbmc-test-automation#817

Change-Id: Iffc483d97319466846d4a633176596be29b34c31
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/extended/code_update/code_update.robot b/extended/code_update/code_update.robot
index a4fcd37..d2e16ed 100644
--- a/extended/code_update/code_update.robot
+++ b/extended/code_update/code_update.robot
@@ -19,9 +19,9 @@
 Library           code_update.py
 Library           OperatingSystem
 Variables         ../../data/variables.py
-Resource          code_update_utils.robot
 Resource          ../lib/rest_client.robot
 Resource          ../lib/openbmc_ffdc.robot
+Resource          ../../lib/code_update_utils.robot
 
 Test Teardown     Code Update Teardown
 
@@ -69,8 +69,41 @@
     ${software_state}=  Read Properties  ${SOFTWARE_VERSION_URI}${version_id}
     Should Be Equal As Strings  &{software_state}[Activation]  ${ACTIVE}
 
+
+Host Image Priority Attribute Test
+    [Documentation]  Set "Priority" attribute.
+    [Tags]  Host_Image_Priority_Attribute_Test
+    [Template]  Set PNOR Attribute
+
+    # Property        Value
+    Priority          ${0}
+    Priority          ${1}
+    Priority          ${127}
+
 *** Keywords ***
 
+Set PNOR Attribute
+    [Documentation]  Update the attribute value.
+    [Arguments]  ${attribute_name}  ${value}
+
+    # Description of argument(s):
+    # attribute_name   Host software attribute name (e.g. "Priority").
+    # value            Value to be written.
+
+    ${image_ids}=  Get Software Objects
+    ${resp}=  Get Host Software Property  ${image_ids[0]}
+    ${initial_value}=  Set Variable  ${resp["Priority"]}
+
+    Set Host Software Property  ${image_ids[0]}  ${attribute_name}  ${value}
+
+    ${resp}=  Get Host Software Property  ${image_ids[0]}
+    Should Be Equal As Integers  ${resp["Priority"]}  ${value}
+
+    # Revert to to initial value.
+    Set Host Software Property
+    ...  ${image_ids[0]}  ${attribute_name}  ${initial_value}
+
+
 Code Update Setup
     [Documentation]  Do code update test case setup.