Automation code update utility function to get image id

Change-Id: I6d1105ceb171109c254cf92f421462969ca549cb
Signed-off-by: Sushil Singh <susilsi7@in.ibm.com>
diff --git a/lib/code_update_utils.robot b/lib/code_update_utils.robot
index 0761314..d06c1ae 100644
--- a/lib/code_update_utils.robot
+++ b/lib/code_update_utils.robot
@@ -552,6 +552,25 @@
     Valid Value  state  valid_values=[${match_state}]
 
 
+Get Image Id
+    [Documentation]  Get image id.
+    [Arguments]  ${match_state}
+
+    # Description of argument(s):
+    # match_state    The expected state. This may be one or more comma-separated values
+    #                (e.g. "Disabled", "Disabled, Updating"). If the actual state matches
+    #                any of the states named in this argument, this keyword passes.
+
+    ${sw_member_list}=  Redfish.Get Members List  /redfish/v1/UpdateService/FirmwareInventory
+
+    FOR  ${sw_member}  IN  @{sw_member_list}
+      ${status}=  Redfish.Get Attribute  ${sw_member}  Status
+      Return From Keyword If  '${status['State']}' == ${match_state}  ${sw_member.split('/')[-1]}
+    END
+
+    [Return]  None
+
+
 Get Image Update Progress State
     [Documentation]  Return the current state of the image update.
     [Arguments]  ${image_id}