Add PLDM test suite to test firmware boot side
Changes:
- New PLDM test suite to test firmware boot side in loop
- Added new parameter to skip state checking post BMC reset
Tested:
robot -v OPENBMCHOST:xx.xx.xx.xx -v pldm/test_firmware_boot_side.robot
Change-Id: I6ffc639736427325e996ba993d395672a4637f82
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/tftp_update_utils.py b/lib/tftp_update_utils.py
index 6220591..266e774 100644
--- a/lib/tftp_update_utils.py
+++ b/lib/tftp_update_utils.py
@@ -26,7 +26,7 @@
return state
-def wait_for_reboot(start_boot_seconds):
+def wait_for_reboot(start_boot_seconds, wait_state_check=True):
r"""
Wait for the BMC to complete a previously initiated reboot.
@@ -41,10 +41,12 @@
by the caller prior to initiating a reboot. It can be
obtained as follows:
state = st.get_state(req_states=['epoch_seconds'])
+ wait_state_check By default check the state, ignore if set to False.
"""
st.wait_for_comm_cycle(int(start_boot_seconds))
gp.qprintn()
- st.wait_state(st.standby_match_state, wait_time="10 mins", interval="10 seconds")
+ if wait_state_check:
+ st.wait_state(st.standby_match_state, wait_time="10 mins", interval="10 seconds")
diff --git a/pldm/test_firmware_boot_side.robot b/pldm/test_firmware_boot_side.robot
new file mode 100755
index 0000000..bde3888
--- /dev/null
+++ b/pldm/test_firmware_boot_side.robot
@@ -0,0 +1,98 @@
+*** Settings ***
+
+Documentation Test firmware boot side switch using pldmtool.
+
+# Test Procedure:
+# 1. Power off the host or post firmware is updated.
+# 2. Check the firmware boot side ( login to BMC and execute )
+# Example:
+# pldmtool bios GetBIOSAttributeCurrentValueByHandle -a fw_boot_side
+#
+# It should return response either Temp or Perm
+# 3. Set the firmware boot side to Temp or Perm accordingly
+# Example:
+# pldmtool bios SetBIOSAttributeCurrentValue -a fw_boot_side -d Temp
+#
+# 4. Power on
+# 5. BMC take reset during power on ( expected )
+# 6. Check the system booted to Runtime
+# 7. Verify the boot side is still same which was set.
+
+Library Collections
+Library ../lib/tftp_update_utils.py
+Resource ../lib/bmc_redfish_resource.robot
+Resource ../lib/openbmc_ffdc.robot
+
+Test Setup Printn
+Test Teardown FFDC On Test Case Fail
+
+*** Variables ***
+
+# By default 2, to ensure, it performs both Perm and Temp side switch and boot.
+${LOOP_COUNT} 2
+
+# This dictionary is for Temp -> Perm or vice versa in the test code.
+&{FW_BOOT_SIDE_DICT} Perm=Temp Temp=Perm
+
+*** Test Cases ***
+
+Test Firmware Boot Side Using Pldmtool
+ [Documentation] Power off the host , set the firmware boot side via pldmtool,
+ ... power on the host and confirm the fw_boot_side attribute is
+ ... still set.
+ [Tags] Test_Firmware_Boot_Side_Using_Pldmtool
+ [Template] Firmware Side Switch Power On Loop
+
+ # iteration
+ ${LOOP_COUNT}
+
+
+*** Keywords ***
+
+Firmware Side Switch Power On Loop
+ [Documentation] Number of iteration, test should perform switch side and boot.
+ [Arguments] ${iteration}
+
+ # Description of argument(s):
+ # iteration Number of switch it needs to perform.
+
+ FOR ${count} IN RANGE 0 ${iteration}
+ Print Timen The Current Loop Count is ${count} of ${iteration}
+
+ # Get the current system state before BMC reset.
+ ${state}= Get Pre Reboot State
+
+ Redfish Power Off stack_mode=skip
+
+ ${cur_boot_side}= PLDM Get BIOS Attribute fw_boot_side
+ Print Timen Current BIOS attribute fw_boot_side: ${cur_boot_side}
+
+ ${next_boot_side}= Set Variable ${FW_BOOT_SIDE_DICT["${cur_boot_side["CurrentValue"]}"]}
+ Print Timen Set BIOS attribute fw_boot_side: ${next_boot_side}
+ PLDM Set BIOS Attribute fw_boot_side ${next_boot_side}
+
+ ${cur_boot_side}= PLDM Get BIOS Attribute fw_boot_side
+ Print Timen Next boot will apply BIOS attribute fw_boot_side: ${cur_boot_side}
+
+ Print Timen Perform power on operation and expect BMC to take reset.
+ Redfish Power Operation On
+ Print Timen Wait for the BMC to take reset and come back online.
+ Wait For Reboot start_boot_seconds=${state['epoch_seconds']} wait_state_check=0
+
+ Print Timen BMC rebooted, wait for host to boot to Runtime.
+ # Post BMC reset, host should auto power on back to runtime.
+ Wait Until Keyword Succeeds 10 min 20 sec Is Boot Progress Runtime Matched
+
+ # Verify the system is booting up with the new fw_boot_side set.
+ ${cur_boot_side}= PLDM Get BIOS Attribute fw_boot_side
+ Should Be Equal As Strings ${cur_boot_side["CurrentValue"]} ${next_boot_side}
+ Print Timen Current: ${cur_boot_side["CurrentValue"]} and set side: ${next_boot_side} are same.
+ END
+
+
+Is Boot Progress Runtime Matched
+ [Documentation] Get BootProgress state and expect boot state mismatch.
+
+ # Match any of the BootProgress state SystemHardwareInitializationComplete|OSBootStarted|OSRunning
+ ${boot_progress} ${host_state}= Redfish Get Boot Progress
+ Should Contain Any ${boot_progress} SystemHardwareInitializationComplete OSBootStarted OSRunning