Automation fix for code update
Changes:
- New code enhancement is to handle scenario when BMC,
have single firmware as functional.
these changes will skip the keyword,
"Switch Backup Firmware Image To Functional"
- this scenario will come when system is new or
factory reset is performed. Then it might have
single image only.
Change-Id: I92104261cf2aaaf5aeb7b3e89621c4b654bf2ec8
Signed-off-by: Sushil Singh <susilsi7@in.ibm.com>
diff --git a/lib/redfish_code_update_utils.robot b/lib/redfish_code_update_utils.robot
index 7f82c1f..a383614 100644
--- a/lib/redfish_code_update_utils.robot
+++ b/lib/redfish_code_update_utils.robot
@@ -135,6 +135,11 @@
# functional_state Functional state can be either True or False.
${resp}= Filter Struct ${sw_inv} [('functional', ${functional_state})]
+
+ ${num_records}= Get Length ${resp}
+ Set Global Variable ${num_records}
+ Return From Keyword If ${num_records} == ${0} ${EMPTY}
+
${list_inv_dict}= Get Dictionary Values ${resp}
[Return] ${list_inv_dict}[0]
diff --git a/redfish/extended/redfish_bmc_code_update.robot b/redfish/extended/redfish_bmc_code_update.robot
index fafc3c5..2e1df12 100644
--- a/redfish/extended/redfish_bmc_code_update.robot
+++ b/redfish/extended/redfish_bmc_code_update.robot
@@ -62,11 +62,12 @@
# Redfish active software image API.
Run Keyword If not ${FORCE_UPDATE}
- ... Run Keyword If '${nonfunctional_sw_inv['version']}' == '${image_version}'
- ... Run Keywords Switch Backup Firmware Image To Functional AND
- ... Wait For Reboot start_boot_seconds=${state['epoch_seconds']} AND
- ... Redfish Verify BMC Version ${IMAGE_FILE_PATH} AND
- ... Pass Execution The firmware ${image_version} is backup image.
+ ... Run Keyword If ${num_records} > 0
+ ... Run Keyword If '${nonfunctional_sw_inv['version']}' == '${image_version}'
+ ... Run Keywords Switch Backup Firmware Image To Functional AND
+ ... Wait For Reboot start_boot_seconds=${state['epoch_seconds']} AND
+ ... Redfish Verify BMC Version ${IMAGE_FILE_PATH} AND
+ ... Pass Execution The firmware ${image_version} is backup image.
# Firmware inventory record of the given image version.
${image_info}= Get Software Inventory State By Version ${image_version}