Add tests for Legacy/EFI boot type selector
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Change-Id: I61d2219c462812c5fc2c2b2271514fe509df32fa
diff --git a/data/variables.py b/data/variables.py
index 0658cb6..0173e4e 100755
--- a/data/variables.py
+++ b/data/variables.py
@@ -132,6 +132,8 @@
BOOT_MODE_SAFE = 'xyz.openbmc_project.Control.Boot.Mode.Modes.Safe'
BOOT_MODE_SETUP = 'xyz.openbmc_project.Control.Boot.Mode.Modes.Setup'
BOOT_MODE_REGULAR = 'xyz.openbmc_project.Control.Boot.Mode.Modes.Regular'
+BOOT_TYPE_LEGACY = 'xyz.openbmc_project.Control.Boot.Type.Types.Legacy'
+BOOT_TYPE_EFI = 'xyz.openbmc_project.Control.Boot.Type.Types.EFI'
# Time variables.
TIME_DBUS_BASE = 'xyz.openbmc_project.Time.'
diff --git a/tests/test_boot_devices.robot b/tests/test_boot_devices.robot
index 45f400b..215f43c 100644
--- a/tests/test_boot_devices.robot
+++ b/tests/test_boot_devices.robot
@@ -194,6 +194,62 @@
Should Contain ${output} Force Boot into BIOS Setup
+Set The Boot Type As Legacy Using REST API
+ [Documentation] Set boot type as Legacy via REST and verify with both
+ ... REST and IPMI.
+ [Tags] Set_The_Boot_Type_As_Legacy_Using_REST_API
+
+ Set Boot Type ${BOOT_TYPE_LEGACY}
+
+ ${boot_type}= Read Attribute ${CONTROL_HOST_URI}boot/one_time BootType
+ Should Be Equal As Strings ${boot_type} ${BOOT_TYPE_LEGACY}
+
+ ${output}= Run IPMI Standard Command chassis bootparam get 5
+ Should Contain ${output} BIOS PC Compatible (legacy) boot
+
+
+Set The Boot Type As Legacy Using Ipmitool
+ [Documentation] Set boot type as Legacy via IPMI and verify with both
+ ... REST and IPMI.
+ [Tags] Set_The_Boot_Type_As_Legacy_Using_Ipmitool
+
+ Run IPMI command 0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
+
+ ${boot_type}= Read Attribute ${CONTROL_HOST_URI}boot/one_time BootType
+ Should Be Equal As Strings ${boot_type} ${BOOT_TYPE_LEGACY}
+
+ ${output}= Run IPMI Standard Command chassis bootparam get 5
+ Should Contain ${output} BIOS PC Compatible (legacy) boot
+
+
+Set The Boot Type As EFI Using REST API
+ [Documentation] Set boot type as EFI via REST and verify with both
+ ... REST and IPMI.
+ [Tags] Set_The_Boot_Type_As_EFI_Using_REST_API
+
+ Set Boot Type ${BOOT_TYPE_EFI}
+
+ ${boot_type}= Read Attribute ${CONTROL_HOST_URI}boot/one_time BootType
+ Should Be Equal As Strings ${boot_type} ${BOOT_TYPE_EFI}
+
+ ${output}= Run IPMI Standard Command chassis bootparam get 5
+ Should Contain ${output} BIOS EFI boot
+
+
+Set The Boot Type As EFI Using Ipmitool
+ [Documentation] Set boot type as EFI via IPMI and verify with both
+ ... REST and IPMI.
+ [Tags] Set_The_Boot_Type_As_EFI_Using_Ipmitool
+
+ Run IPMI command 0x0 0x8 0x05 0xA0 0x00 0x00 0x00 0x00
+
+ ${boot_type}= Read Attribute ${CONTROL_HOST_URI}boot/one_time BootType
+ Should Be Equal As Strings ${boot_type} ${BOOT_TYPE_EFI}
+
+ ${output}= Run IPMI Standard Command chassis bootparam get 5
+ Should Contain ${output} BIOS EFI boot
+
+
*** Keywords ***
Set Boot Source
@@ -218,6 +274,17 @@
... data=${valueDict}
+Set Boot Type
+ [Documentation] Set given boot type.
+ [Arguments] ${boot_type}
+ # Description of argument(s):
+ # boot_type Boot type which need to be set.
+
+ ${valueDict}= Create Dictionary data=${boot_type}
+ Write Attribute ${CONTROL_HOST_URI}boot/one_time BootType
+ ... data=${valueDict}
+
+
Response Should Be Equal
[Documentation] Verify that the output is equal to the given args.
[Arguments] ${args}