List the BMC/PNOR images before code update.

Resolves openbmc/openbmc-test-automation#1198

Change-Id: I8b894377fc9955ffd3012fb53bb44947381c89c1
Signed-off-by: Sweta Potthuri <spotthur@in.ibm.com>
diff --git a/lib/code_update_utils.robot b/lib/code_update_utils.robot
index fbd68b8..89c00f0 100644
--- a/lib/code_update_utils.robot
+++ b/lib/code_update_utils.robot
@@ -414,3 +414,27 @@
 
     ${value}=  Read Attribute  ${SOFTWARE_VERSION_URI}  FieldModeEnabled
     Should Be True  ${value}  ${1}
+
+List Installed Images
+    [Documentation]  List all the installed images.
+    [Arguments]  ${image_type}
+
+    # Desciption of argument(s):
+    # image_type  Either "BMC" or "PNOR".
+
+    # List the installed images.
+    ${installed_images}=  Get Software Objects
+    ...  ${SOFTWARE_PURPOSE}.${image_type}
+
+    Run Keyword If  ${installed_images} != []
+    ...  Get List of Images  ${installed_images}
+    ...  ELSE  Log  No ${image_type} images are present.
+
+Get List of Images
+    [Documentation]  Get List of Images
+    [Arguments]  ${installed_images}
+
+    :FOR  ${uri}  IN  @{installed_images}
+    \  ${resp}=  OpenBMC Get Request  ${uri}
+    \  ${json}=  To JSON  ${resp.content}
+    \  Log  ${json}["data"]