BIOS: Create API to set fw_boot_side value.

Changes:

-- Added three new keywords as mentioned below.

 - Switch BIOS Attribute Firmware Boot Side
 - Is Boot Progress At Any State
 - Is Boot Progress At Required State

Tested:

Created a unit testcase and verified on BMC environment.

Change-Id: I37cb070fb1269c5d90cc1cbe3906f04262a2334d
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/lib/bios_attr_utils.robot b/lib/bios_attr_utils.robot
index ec01d1a..a76582a 100644
--- a/lib/bios_attr_utils.robot
+++ b/lib/bios_attr_utils.robot
@@ -4,6 +4,8 @@
 Resource         resource.robot
 Resource         bmc_redfish_resource.robot
 Resource         common_utils.robot
+Resource         utils.robot
+Library          tftp_update_utils.py
 
 
 *** Keywords ***
@@ -56,3 +58,49 @@
 
     ${output}=  Redfish.Get Attribute  ${BIOS_ATTR_URI}  Attributes
     Should Be Equal  ${output['${attr_handle}']}  ${attr_val}
+
+
+Switch And Verify BIOS Attribute Firmware Boot Side
+    [Documentation]  Switch BIOS attribute firmware boot side value to Perm/Temp
+    ...              at host power off state and verify firmware boot side
+    ...              value after BMC reboot.
+    [Arguments]      ${set_fw_boot_side}
+
+    # Description of argument(s):
+    # set_fw_boot_side    Firmware boot side optional value Perm/Temp.
+
+    # Do host power off.
+    Redfish Power Off  stack_mode=skip  quiet=1
+
+    # Get pre reboot state.
+    ${pre_reboot_state}=  Get Pre Reboot State
+
+    # Get fw_boot_side value, make sure given set_fw_boot_side and
+    # fw_boot_side values are not same.
+
+    ${cur_boot_side}=  Redfish.Get Attribute  ${BIOS_ATTR_URI}  Attributes
+    Should Not Be Equal  ${cur_boot_side["fw_boot_side_current"]}  ${set_fw_boot_side}
+    ...  msg=Current firmware boot side & the given firmware boot side are same...
+
+    Log To Console  Current firmware boot side :: ${cur_boot_side["fw_boot_side"]}
+    Log To Console  Given firmware boot side :: ${set_fw_boot_side}
+
+    # Set the given firmware boot side value.
+    Set BIOS Attribute Value And Verify  fw_boot_side  ${set_fw_boot_side}  False
+
+    # Power on BMC and wait for BMC to take reboot.
+    Log To Console  Perform power on operation & expect BMC to take reboot...
+    Redfish Power Operation  On
+
+    Log To Console  Wait for the BMC to take reboot and come back online...
+    Wait For Reboot  start_boot_seconds=${pre_reboot_state['epoch_seconds']}
+    ...  wait_state_check=0
+
+    # Post BMC reboot, host should auto power on back to runtime.
+    Log To Console  BMC rebooted, wait for host to boot...
+    Wait Until Keyword Succeeds  ${OS_RUNNING_TIMEOUT} min  20 sec
+    ...  Is Boot Progress At Any State
+
+    # Verify firmware boot side values after BMC reboot.
+    Verify BIOS Attribute  fw_boot_side  ${set_fw_boot_side}
+    Verify BIOS Attribute  fw_boot_side_current  ${set_fw_boot_side}