BMC driver version check

Checks the user specified BMC version string and if found installed
on the BMC, skip the update process.

Resolves  openbmc/openbmc-test-automation#780

Change-Id: Ia48c90a0db74b02d82cad5f7ac1c2a4586214c99
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/extended/code_update/code_update_utils.robot b/extended/code_update/code_update_utils.robot
index 5ec74c8..8be8876 100755
--- a/extended/code_update/code_update_utils.robot
+++ b/extended/code_update/code_update_utils.robot
@@ -114,19 +114,16 @@
 
 
 Validate BMC Version
-    [Arguments]   ${args}=post
-    # Check BMC installed version
+    [Documentation]  Get BMC version from /etc/os-release and compare.
+    [Arguments]  ${version}
+
+    # Description of argument(s):
+    # version  Software version (e.g. "v1.99.8-41-g86a4abc").
+
     Open Connection And Log In
-    ${version}   ${stderr}=    Execute Command   cat /etc/version
-    ...    return_stderr=True
-    Should Be Empty     ${stderr}
-    # The File name contains the version installed
-    Run Keyword If   '${args}' == 'before'
-    ...    Should not Contain  ${FILE_PATH}   ${version}
-    ...    msg=Same version already installed
-    ...    ELSE
-    ...    Should Contain      ${FILE_PATH}   ${version}
-    ...    msg=Code update Failed
+    ${cmd}=  Set Variable  grep ^VERSION_ID= /etc/os-release | cut -f 2 -d '='
+    ${output}=  Execute Command On BMC  ${cmd}
+    Should Be Equal As Strings  ${version}  ${output[1:-1]}
 
 
 Trigger Warm Reset via Reboot