Add support for Legacy/EFI selector in Redfish boot tests

BootSourceOverrideMode is the BIOS boot mode to use when
the system boots from the BootSourceOverrideTarget boot source.

Possible values are:
  Legacy - The system boots in non-UEFI boot mode to
           the boot source override target
  UEFI   - The system boots in UEFI boot mode to
           the boot source override target

This setting is relevant for x86 and is not important for POWER.

Intended design of bmcweb is not to publish BootSourceOverrideMode
interface if it is not used in arch.
Therefore use/check BootSourceOverrideMode only on x86.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Change-Id: Ib23e3ae2fd5113730d75da4cb7ac352c0ae96e66
diff --git a/lib/utils.robot b/lib/utils.robot
index 264b165..5a6efde 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -801,17 +801,23 @@
 
 
 Redfish Set Boot Default
-    [Documentation]  Set and Verify BootSource and BootType.
-    [Arguments]      ${override_enabled}  ${override_target}
+    [Documentation]  Set and Verify Boot source override
+    [Arguments]      ${override_enabled}  ${override_target}  ${override_mode}=UEFI
 
     # Description of argument(s):
-    # override_enabled    Boot source enable type.
+    # override_enabled    Boot source override enable type.
     #                     ('Once', 'Continuous', 'Disabled').
-    # override_target     Boot target type.
+    # override_target     Boot source override target.
     #                     ('Pxe', 'Cd', 'Hdd', 'Diags', 'BiosSetup', 'None').
+    # override_mode       Boot source override mode (relevant only for x86 arch).
+    #                     ('Legacy', 'UEFI').
 
     ${data}=  Create Dictionary  BootSourceOverrideEnabled=${override_enabled}
     ...  BootSourceOverrideTarget=${override_target}
+
+    Run Keyword If  '${PLATFORM_ARCH_TYPE}' == 'x86'
+    ...  Set To Dictionary  ${data}  BootSourceOverrideMode  ${override_mode}
+
     ${payload}=  Create Dictionary  Boot=${data}
 
     Redfish.Patch  /redfish/v1/Systems/system  body=&{payload}
@@ -820,6 +826,8 @@
     ${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}
+    Run Keyword If  '${PLATFORM_ARCH_TYPE}' == 'x86'
+    ...  Should Be Equal As Strings  ${resp["BootSourceOverrideMode"]}  ${override_mode}
 
 
 # Redfish state keywords.
diff --git a/redfish/systems/test_boot_devices.robot b/redfish/systems/test_boot_devices.robot
index 4d685e2..ee84659 100644
--- a/redfish/systems/test_boot_devices.robot
+++ b/redfish/systems/test_boot_devices.robot
@@ -31,43 +31,62 @@
 ...                         BiosSetup=Force Boot into BIOS Setup
 ...                         None=No override
 
+# This dictionary maps the redfish 'BootSourceOverrideMode' value to the
+# corresponding IPMI output value.
+&{redfish_ipmi_mode_map}  Legacy=BIOS PC Compatible (legacy) boot
+...                       UEFI=BIOS EFI boot
+
 *** Test Cases ***
 
-Verify BMC Redfish Boot Types With BootSource As Once
-    [Documentation]  Verify BMC Redfish Boot Types With BootSource As Once.
-    [Tags]           Verify_BMC_Redfish_Boot_Types_With_BootSource_As_Once
-    [Template]  Set And Verify BootSource And BootType
+Verify BMC Redfish Boot Source Override with Enabled Mode As Once
+    [Documentation]  Verify BMC Redfish Boot Source Override with Enabled Mode As Once.
+    [Tags]           Verify_BMC_Redfish_Boot_Source_Override_with_Enabled_Mode_As_Once
+    [Template]  Set And Verify Boot Source Override
 
-    #BootSourceEnableType    BootTargetType
-    Once                     Hdd
-    Once                     Pxe
-    Once                     Diags
-    Once                     Cd
-    Once                     BiosSetup
+    #BootSourceOverrideEnabled    BootSourceOverrideTarget    BootSourceOverrideMode
+    Once                          Hdd                         UEFI
+    Once                          Pxe                         UEFI
+    Once                          Diags                       UEFI
+    Once                          Cd                          UEFI
+    Once                          BiosSetup                   UEFI
+    Once                          Hdd                         Legacy
+    Once                          Pxe                         Legacy
+    Once                          Diags                       Legacy
+    Once                          Cd                          Legacy
+    Once                          BiosSetup                   Legacy
 
-Verify BMC Redfish Boot Types With BootSource As Continuous
-    [Documentation]  Verify BMC Redfish Boot Types With BootSource As Continuous.
-    [Tags]           Verify_BMC_Redfish_Boot_Types_With_BootSource_As_Continuous
-    [Template]  Set And Verify BootSource And BootType
 
-    #BootSourceEnable    BootTargetType
-    Continuous           Hdd
-    Continuous           Pxe
-    Continuous           Diags
-    Continuous           Cd
-    Continuous           BiosSetup
+Verify BMC Redfish Boot Source Override with Enabled Mode As Continuous
+    [Documentation]  Verify BMC Redfish Boot Source Override with Enabled Mode As Continuous.
+    [Tags]           Verify_BMC_Redfish_Boot_Source_Override_with_Enabled_Mode_As_Continuous
+    [Template]  Set And Verify Boot Source Override
+
+    #BootSourceOverrideEnabled    BootSourceOverrideTarget    BootSourceOverrideMode
+    Continuous                    Hdd                         UEFI
+    Continuous                    Pxe                         UEFI
+    Continuous                    Diags                       UEFI
+    Continuous                    Cd                          UEFI
+    Continuous                    BiosSetup                   UEFI
+    Continuous                    Hdd                         Legacy
+    Continuous                    Pxe                         Legacy
+    Continuous                    Diags                       Legacy
+    Continuous                    Cd                          Legacy
+    Continuous                    BiosSetup                   Legacy
+
 
 *** Keywords ***
 
-Set And Verify BootSource And BootType
-    [Documentation]  Set And Verify BootSource And BootType.
-    [Arguments]      ${override_enabled}  ${override_target}
+Set And Verify Boot Source Override
+    [Documentation]  Set and Verify Boot source override
+    [Arguments]      ${override_enabled}  ${override_target}  ${override_mode}=UEFI
 
     # Description of argument(s):
-    # override_enabled    Boot source enable type.
+    # override_enabled    Boot source override enable type.
     #                     ('Once', 'Continuous', 'Disabled').
-    # override_target     Boot target type.
+    # override_target     Boot source override target.
     #                     ('Pxe', 'Cd', 'Hdd', 'Diags', 'BiosSetup', 'None').
+    # override_mode       Boot source override mode (relevant only for x86 arch).
+    #                     ('Legacy', 'UEFI').
 
     # Example:
     # "Boot": {
@@ -101,17 +120,20 @@
     # - BIOS Mux Control Override : BIOS uses recommended setting of the mux at
     #   the end of POST
 
-    Redfish Set Boot Default  ${override_enabled}  ${override_target}
+    Redfish Set Boot Default  ${override_enabled}  ${override_target}  ${override_mode}
 
     ${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}']}
+    Run Keyword If  '${PLATFORM_ARCH_TYPE}' == 'x86'
+    ...  Should Contain  ${output}  ${redfish_ipmi_mode_map['${override_mode}']}
+
 
 Suite Teardown Execution
     [Documentation]  Do the post suite teardown.
 
     Redfish.Login
-    Set And Verify BootSource And BootType  Disabled  None
+    Set And Verify Boot Source Override  Disabled  None  UEFI
     Redfish.Logout