Refactor boot policies suite test case to use new xyz
Resolves openbmc/openbmc-test-automation#848
Change-Id: I48a5bce0440c264e2638c6afbd377f889870396a
Signed-off-by: Sweta Potthuri <spotthur@in.ibm.com>
diff --git a/tests/test_boot_policies.robot b/tests/test_boot_policies.robot
index 0c2e572..ee65546 100644
--- a/tests/test_boot_policies.robot
+++ b/tests/test_boot_policies.robot
@@ -9,16 +9,16 @@
Resource ../lib/state_manager.robot
Resource ../lib/boot_utils.robot
-Suite Setup Test Suite Setup
-Test Setup Test Init Setup
+Suite Setup Suite Setup Execution
+Test Setup Test Setup Execution
Test Teardown FFDC On Test Case Fail
-Suite Teardown Restore Boot Settings
+Suite Teardown Suite Teardown Execution
Force Tags boot_policy_test
*** Variables ***
-${stack_mode} skip
-${HOST_SETTINGS} ${SETTINGS_URI}host0
+${ONETIME} ${1}
+${PERMANENT} ${0}
*** Test Cases ***
@@ -27,23 +27,20 @@
... using ipmitool.
[Tags] Set_Boot_Policy_To_ONETIME_via_REST
- Set Boot Policy ONETIME
-
- ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
- Should Be Equal ${boot} ONETIME
+ Set Boot Policy ${ONETIME}
+ ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
+ Should Be Equal ${boot} ${ONETIME}
${output}= Run IPMI Standard Command chassis bootparam get 5
Should Contain ${output} Options apply to only next boot
-
Set Boot Policy To PERMANENT via REST
- [Documentation] Set boot policy to PERMANENT via REST URI and verify
+ [Documentation] Set boot policy to PERMANENT using REST URI and verify
... using ipmitool.
[Tags] Set_Boot_Policy_To_PERMANENT_via_REST
- Set Boot Policy PERMANENT
-
- ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
- Should Be Equal ${boot} PERMANENT
+ Set Boot Policy ${PERMANENT}
+ ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
+ Should Be Equal ${boot} ${PERMANENT}
${output}= Run IPMI Standard Command chassis bootparam get 5
Should Contain ${output} Options apply to all future boots
@@ -53,8 +50,8 @@
[Tags] Set_Boot_Policy_To_ONETIME_via_IPMITOOL
Run IPMI command 0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
- ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
- Should Be Equal ${boot} ONETIME
+ ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
+ Should Be Equal ${boot} ${ONETIME}
${output}= Run IPMI Standard Command chassis bootparam get 5
Should Contain ${output} Options apply to only next boot
@@ -63,13 +60,12 @@
... using REST URI.
[Tags] Set_Boot_Policy_To_PERMANENT_via_IPMITOOL
- Run IPMI command 0x0 0x8 0x05 0xC0 0x00 0x00 0x00 0x00
- ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
- Should Be Equal ${boot} PERMANENT
+ Run IPMI command 0x0 0x8 0x05 0xC0 0x00 0x00 0x00 0x0
+ ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
+ Should Be Equal ${boot} ${PERMANENT}
${output}= Run IPMI Standard Command chassis bootparam get 5
Should Contain ${output} Options apply to all future boots
-
Test Boot Order via REST
[Documentation] Set boot policy to PERMANENT and boot device to CDROM
... and verify that the order doesn't change post power on.
@@ -77,17 +73,17 @@
Initiate Power Off
- Set Boot Policy PERMANENT
+ Set Boot Policy ${PERMANENT}
- Set Boot Device CDROM
+ Set Boot Source ${BOOT_SOURCE_CDROM}
Initiate Host Boot
- ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
- Should Be Equal ${boot} PERMANENT
+ ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
+ Should Be Equal ${boot} ${PERMANENT}
- ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
- Should Be Equal ${flag} CDROM
+ ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
+ Should Be Equal ${flag} ${BOOT_SOURCE_CDROM}
Persist ONETIME Boot Policy After Reset
[Documentation] Verify ONETIME boot policy order does not change
@@ -96,17 +92,17 @@
Initiate Host Boot
- Set Boot Policy ONETIME
+ Set Boot Policy ${ONETIME}
- Set Boot Device Network
+ Set Boot Source ${BOOT_SOURCE_NETWORK}
- Trigger Warm Reset
+ OBMC Reboot (off)
- ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
- Should Be Equal ${boot} ONETIME
+ ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
+ Should Be Equal ${boot} ${ONETIME}
- ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
- Should Be Equal ${flag} Network
+ ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
+ Should Be Equal ${flag} ${BOOT_SOURCE_NETWORK}
Persist PERMANENT Boot Policy After Reset
[Documentation] Verify PERMANENT boot policy order does not change
@@ -115,28 +111,17 @@
Initiate Host Boot
- Set Boot Policy PERMANENT
+ Set Boot Policy ${PERMANENT}
- Set Boot Device CDROM
+ Set Boot Source ${BOOT_SOURCE_CDROM}
- Trigger Warm Reset
+ OBMC Reboot (off)
- ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
- Should Be Equal ${boot} PERMANENT
+ ${boot}= Read Attribute ${CONTROL_URI}/host0/boot/one_time Enabled
+ Should Be Equal ${boot} ${PERMANENT}
- ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
- Should Be Equal ${flag} CDROM
-
-Set Boot Policy To Invalid Value
- [Documentation] This testcase verify that the boot policy doesn't get
- ... updated with invalid policy supplied by user.
- [Tags] Set_Boot_Policy_To_Invalid_Value
-
- Run Keyword and Ignore Error Set Boot Policy abc
-
- ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
- Should Not Be Equal ${boot} abc
-
+ ${flag}= Read Attribute ${CONTROL_URI}/host0/boot/ BootSource
+ Should Be Equal ${flag} ${BOOT_SOURCE_CDROM}
Verify Boot Mode Persistency After BMC Reboot
[Documentation] Verify boot mode persistency after BMC reboot.
@@ -146,58 +131,66 @@
# Record initial bootmode setting.
${boot_mode}= Read Attribute
- ... ${CONTROL_HOST_URI}/boot_mode BootMode
+ ... ${CONTROL_HOST_URI}/boot BootMode
Set Suite Variable ${initial_boot_mode} ${boot_mode}
# Set bootmode to non default value.
- Set Boot Mode xyz.openbmc_project.Control.Boot.Mode.Modes.Safe
+ Set Boot Mode ${BOOT_MODE_SAFE}
Initiate BMC Reboot
Wait Until Keyword Succeeds 10 min 10 sec Is BMC Ready
${boot_mode_after}= Read Attribute
- ... ${CONTROL_HOST_URI}/boot_mode BootMode
+ ... ${CONTROL_HOST_URI}/boot BootMode
Should Be Equal As Strings
- ... ${boot_mode_after} xyz.openbmc_project.Control.Boot.Mode.Modes.Safe
-
+ ... ${boot_mode_after} ${BOOT_MODE_SAFE}
*** Keywords ***
Set Boot Mode
[Arguments] ${args}
- ${bootmode}= Set Variable ${args}
+ ${bootmode}= Set Variable ${args}
${valueDict}= Create Dictionary data=${bootmode}
- Write Attribute ${CONTROL_HOST_URI}/boot_mode BootMode data=${valueDict}
+ Write Attribute ${CONTROL_HOST_URI}/boot/ BootMode data=${valueDict}
Set Boot Policy
[Arguments] ${args}
- ${bootpolicy}= Set Variable ${args}
- ${valueDict}= create dictionary data=${bootpolicy}
- Write Attribute ${HOST_SETTINGS} boot_policy data=${valueDict}
+ ${bootpolicy}= Set Variable ${args}
+ ${valueDict}= Create Dictionary data=${bootpolicy}
+ Write Attribute ${CONTROL_URI}/host0/boot/one_time Enabled data=${valueDict}
-Set Boot Device
- [Arguments] ${args}
- ${bootDevice} = Set Variable ${args}
- ${valueDict} = create dictionary data=${bootDevice}
- Write Attribute ${HOST_SETTINGS} boot_flags data=${valueDict}
+Set Boot Source
+ [Documentation] Set given boot source.
+ [Arguments] ${boot_source}
+ # Description of argument(s):
+ # boot_source Boot source which need to be set.
-Restore Boot Settings
+ ${valueDict}= Create Dictionary data=${boot_source}
+ Write Attribute ${CONTROL_HOST_URI}/boot/ BootSource data=${valueDict}
+
+Suite Teardown Execution
[Documentation] Restore default settings.
- Set Boot Policy ONETIME
- Set Boot Device Default
+ Set Boot Policy ${ONETIME}
+ Set Boot Source ${BOOT_SOURCE_DEFAULT}
Close All Connections
-Test Init Setup
+Test Setup Execution
[Documentation] Do the initial test setup.
Open Connection And Log In
Initialize DBUS cmd "boot_flags"
-Test Suite Setup
+Suite Setup Execution
[Documentation] Do the initial suite setup.
- #Boot Host.
- REST Power On
+ # Reboot host to re-power on clean if host is not "off".
+ ${current_state}= Get Host State
+ Run Keyword If '${current_state}' == 'Off'
+ ... Initiate Host Boot
+ ... ELSE Initiate Host Reboot
+
+ Wait Until Keyword Succeeds
+ ... 10 min 10 sec Is OS Starting
Restore Bootmode Setting
[Documentation] Restore initial bootmode setting.