Validate BMC system and file name before code update.
Resolves openbmc/openbmc-test-automation#466
Change-Id: I4cfd325c184c7de23b5bf4ca89387e699257c29b
Signed-off-by: Sivas SRR <sivas.srr@in.ibm.com>
diff --git a/extended/code_update/code_update_utils.robot b/extended/code_update/code_update_utils.robot
index dac252b..2b301ec 100644
--- a/extended/code_update/code_update_utils.robot
+++ b/extended/code_update/code_update_utils.robot
@@ -15,6 +15,19 @@
*** Keywords ***
+Validate BMC Image File Name
+ [Documentation] Check that correct BMC image is in use.
+ [Arguments] ${file_path}
+ # Description of argument(s):
+ # file_path The name of the file path to be validated
+ # (e.g. /home/XXX/Downloads/witherspoon-XXX.all.tar).
+ Open Connection And Log In
+ ${bmc_model}= Get BMC System Model
+ ${file_name}= Fetch From Right ${filepath} /
+ ${status}= Run Keyword And Return Status Should Contain ${file_name}
+ ... ${bmc_model} ignore_case=True
+ Run Keyword If '${status}'=='False' Fatal Error Wrong Image
+
Preserve BMC Network Setting
[Documentation] Preserve Network setting
${policy}= Set Variable ${1}
diff --git a/extended/code_update/update_bmc.robot b/extended/code_update/update_bmc.robot
index bb4a43c..9ba485b 100644
--- a/extended/code_update/update_bmc.robot
+++ b/extended/code_update/update_bmc.robot
@@ -28,6 +28,9 @@
Resource ../../lib/utils.robot
Resource ../../lib/openbmc_ffdc.robot
+Library String
+Suite Setup Validate BMC Image File Name ${FILE_PATH}
+
Test Teardown FFDC On Test Case Fail
*** Variables ***