Skip BMC image install if already functional

Changes:
    - Added check to skip image upload if the same version is
      already functional else the upload would fail otherwise
      with "Version already exists or failed to be extracted."

Change-Id: I1e6c2e36cc39787873f3f8e3860bbc72cd4ad2fd
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/extended/code_update/bmc_code_update.robot b/extended/code_update/bmc_code_update.robot
index 6771f53..54a48c9 100644
--- a/extended/code_update/bmc_code_update.robot
+++ b/extended/code_update/bmc_code_update.robot
@@ -74,6 +74,16 @@
 
     Run Keyword And Ignore Error  List Installed Images  BMC
 
+    ${image_version}=  Get Version Tar  ${IMAGE_FILE_PATH}
+    Rprint Vars  image_version
+
+    ${functional_version}=  Get BMC Version
+    Rprint Vars  functional_version
+
+    # Check if the existing firmware is functional.
+    Pass Execution If  ${functional_version} == "${image_version}"
+    ...  The existing ${image_version} firmware is already functional.
+
     Upload And Activate Image  ${IMAGE_FILE_PATH}
     ...  skip_if_active=${SKIP_UPDATE_IF_ACTIVE}
     OBMC Reboot (off)