Support redfish boot defaults

Changes:
    - Create new keyword in lib/utils.robot.
    - Remove the current redfish setting default and call the new
      keyword.
    - Add the new keyword in redfish default in __init__.robot

Change-Id: I886a638ca47f81f28dbf60f644c6192cfaf14376
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index e56eb8b..26e200a 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -777,3 +777,24 @@
 
     [Return]  ${post_code_update_actions}
 
+
+Redfish Set Boot Default
+    [Documentation]  Set and Verify BootSource and BootType.
+    [Arguments]      ${override_enabled}  ${override_target}
+
+    # Description of argument(s):
+    # override_enabled    Boot source enable type.
+    #                     ('Once', 'Continuous', 'Disabled').
+    # override_target     Boot target type.
+    #                     ('Pxe', 'Cd', 'Hdd', 'Diags', 'BiosSetup', 'None').
+
+    ${data}=  Create Dictionary  BootSourceOverrideEnabled=${override_enabled}
+    ...  BootSourceOverrideTarget=${override_target}
+    ${payload}=  Create Dictionary  Boot=${data}
+
+    Redfish.Patch  /redfish/v1/Systems/system  body=&{payload}
+    ...  valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}]
+
+    ${resp}=  Redfish.Get Attribute  /redfish/v1/Systems/system  Boot
+    Should Be Equal As Strings  ${resp["BootSourceOverrideEnabled"]}  ${override_enabled}
+    Should Be Equal As Strings  ${resp["BootSourceOverrideTarget"]}  ${override_target}
diff --git a/redfish/systems/test_boot_devices.robot b/redfish/systems/test_boot_devices.robot
index a6d325a..4d685e2 100644
--- a/redfish/systems/test_boot_devices.robot
+++ b/redfish/systems/test_boot_devices.robot
@@ -101,18 +101,8 @@
     # - BIOS Mux Control Override : BIOS uses recommended setting of the mux at
     #   the end of POST
 
-    ${data}=  Create Dictionary  BootSourceOverrideEnabled=${override_enabled}
-    ...  BootSourceOverrideTarget=${override_target}
-    ${payload}=  Create Dictionary  Boot=${data}
+    Redfish Set Boot Default  ${override_enabled}  ${override_target}
 
-    Redfish.Patch  /redfish/v1/Systems/system  body=&{payload}
-    ...  valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}]
-
-    ${resp}=  Redfish.Get  /redfish/v1/Systems/system
-    Should Be Equal As Strings  ${resp.dict["Boot"]["BootSourceOverrideEnabled"]}
-    ...  ${override_enabled}
-    Should Be Equal As Strings  ${resp.dict["Boot"]["BootSourceOverrideTarget"]}
-    ...  ${override_target}
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
     Should Contain  ${output}  ${redfish_ipmi_enabled_map['${override_enabled}']}
     Should Contain  ${output}  ${redfish_ipmi_target_map['${override_target}']}
diff --git a/tests/__init__.robot b/tests/__init__.robot
index 5ddee6e..e38e93b 100644
--- a/tests/__init__.robot
+++ b/tests/__init__.robot
@@ -43,6 +43,7 @@
     [Documentation]  Set REST defaults.
 
     Redfish.Login
+    Run Keyword And Ignore Error  Redfish Set Boot Default  Disabled  None
     Run Keyword And Ignore Error  Redfish Set Power Restore Policy  AlwaysOff
     Redfish.Logout