Support new boot override design in IPMI/REST boot tests

Several changes are made in support of new design of boot override
settings:
- as all the boot override settings BootSource/BootMode/BootType now
are kept in one place under '${CONTROL_HOST_URI}boot' URL addresses
need to be modified,
- with the new override enable interface it is possible to disable boot
override on test suite end,
- with the new override enable interface it is possible to add tests
for the boot override enable/disable.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Change-Id: I623929dc20e67fee6bf6ef6c3a904855b6db425f
diff --git a/tests/test_boot_devices.robot b/tests/test_boot_devices.robot
index a358e49..2a723c6 100644
--- a/tests/test_boot_devices.robot
+++ b/tests/test_boot_devices.robot
@@ -26,7 +26,7 @@
     Set Boot Source  ${BOOT_SOURCE_DEFAULT}
 
     ${boot_source}=
-    ...  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootSource
+    ...  Read Attribute  ${CONTROL_HOST_URI}boot  BootSource
     Should Be Equal As Strings  ${boot_source}  ${BOOT_SOURCE_DEFAULT}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -41,7 +41,7 @@
     Run IPMI command  0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
 
     ${boot_source}=
-    ...  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootSource
+    ...  Read Attribute  ${CONTROL_HOST_URI}boot  BootSource
     Should Be Equal As Strings  ${boot_source}  ${BOOT_SOURCE_DEFAULT}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -56,7 +56,7 @@
     Set Boot Source  ${BOOT_SOURCE_NETWORK}
 
     ${boot_source}=
-    ...  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootSource
+    ...  Read Attribute  ${CONTROL_HOST_URI}boot  BootSource
     Should Be Equal As Strings  ${boot_source}  ${BOOT_SOURCE_NETWORK}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -71,7 +71,7 @@
     Run IPMI command  0x0 0x8 0x05 0x80 0x04 0x00 0x00 0x00
 
     ${boot_source}=
-    ...  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootSource
+    ...  Read Attribute  ${CONTROL_HOST_URI}boot  BootSource
     Should Be Equal As Strings  ${boot_source}  ${BOOT_SOURCE_NETWORK}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -86,7 +86,7 @@
     Set Boot Source  ${BOOT_SOURCE_DISK}
 
     ${boot_source}=
-    ...  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootSource
+    ...  Read Attribute  ${CONTROL_HOST_URI}boot  BootSource
     Should Be Equal As Strings  ${boot_source}  ${BOOT_SOURCE_DISK}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -101,7 +101,7 @@
     Run IPMI command  0x0 0x8 0x05 0x80 0x08 0x00 0x00 0x00
 
     ${boot_source}=
-    ...  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootSource
+    ...  Read Attribute  ${CONTROL_HOST_URI}boot  BootSource
     Should Be Equal As Strings  ${boot_source}  ${BOOT_SOURCE_DISK}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -115,7 +115,7 @@
 
     Set Boot Mode  ${BOOT_MODE_SAFE}
 
-    ${boot_mode}=  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootMode
+    ${boot_mode}=  Read Attribute  ${CONTROL_HOST_URI}boot  BootMode
     Should Be Equal As Strings  ${boot_mode}  ${BOOT_MODE_SAFE}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -129,7 +129,7 @@
 
     Run IPMI command  0x0 0x8 0x05 0x80 0x0C 0x00 0x00 0x00
 
-    ${boot_mode}=  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootMode
+    ${boot_mode}=  Read Attribute  ${CONTROL_HOST_URI}boot  BootMode
     Should Be Equal As Strings  ${boot_mode}  ${BOOT_MODE_SAFE}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -144,7 +144,7 @@
     Set Boot Source  ${BOOT_SOURCE_CDROM}
 
     ${boot_source}=
-    ...  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootSource
+    ...  Read Attribute  ${CONTROL_HOST_URI}boot  BootSource
     Should Be Equal As Strings  ${boot_source}  ${BOOT_SOURCE_CDROM}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -159,7 +159,7 @@
     Run IPMI command  0x0 0x8 0x05 0x80 0x14 0x00 0x00 0x00
 
     ${boot_source}=
-    ...  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootSource
+    ...  Read Attribute  ${CONTROL_HOST_URI}boot  BootSource
     Should Be Equal As Strings  ${boot_source}  ${BOOT_SOURCE_CDROM}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -173,7 +173,7 @@
 
     Set Boot Mode  ${BOOT_MODE_SETUP}
 
-    ${boot_mode}=  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootMode
+    ${boot_mode}=  Read Attribute  ${CONTROL_HOST_URI}boot  BootMode
     Should Be Equal As Strings  ${boot_mode}  ${BOOT_MODE_SETUP}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -187,7 +187,7 @@
 
     Run IPMI command  0x0 0x8 0x05 0x80 0x18 0x00 0x00 0x00
 
-    ${boot_mode}=  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootMode
+    ${boot_mode}=  Read Attribute  ${CONTROL_HOST_URI}boot  BootMode
     Should Be Equal As Strings  ${boot_mode}  ${BOOT_MODE_SETUP}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -199,9 +199,12 @@
     ...              REST and IPMI.
     [Tags]  Set_The_Boot_Type_As_Legacy_Using_REST_API
 
+    Pass Execution If  '${PLATFORM_ARCH_TYPE}' != 'x86'
+    ...  BootType selector is implemented only in x86 arch
+
     Set Boot Type  ${BOOT_TYPE_LEGACY}
 
-    ${boot_type}=  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootType
+    ${boot_type}=  Read Attribute  ${CONTROL_HOST_URI}boot  BootType
     Should Be Equal As Strings  ${boot_type}  ${BOOT_TYPE_LEGACY}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -213,9 +216,12 @@
     ...              REST and IPMI.
     [Tags]  Set_The_Boot_Type_As_Legacy_Using_Ipmitool
 
+    Pass Execution If  '${PLATFORM_ARCH_TYPE}' != 'x86'
+    ...  BootType selector is implemented only in x86 arch
+
     Run IPMI command  0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
 
-    ${boot_type}=  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootType
+    ${boot_type}=  Read Attribute  ${CONTROL_HOST_URI}boot  BootType
     Should Be Equal As Strings  ${boot_type}  ${BOOT_TYPE_LEGACY}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -227,9 +233,12 @@
     ...              REST and IPMI.
     [Tags]  Set_The_Boot_Type_As_EFI_Using_REST_API
 
+    Pass Execution If  '${PLATFORM_ARCH_TYPE}' != 'x86'
+    ...  BootType selector is implemented only in x86 arch
+
     Set Boot Type  ${BOOT_TYPE_EFI}
 
-    ${boot_type}=  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootType
+    ${boot_type}=  Read Attribute  ${CONTROL_HOST_URI}boot  BootType
     Should Be Equal As Strings  ${boot_type}  ${BOOT_TYPE_EFI}
 
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
@@ -241,17 +250,86 @@
     ...              REST and IPMI.
     [Tags]  Set_The_Boot_Type_As_EFI_Using_Ipmitool
 
+    Pass Execution If  '${PLATFORM_ARCH_TYPE}' != 'x86'
+    ...  BootType selector is implemented only in x86 arch
+
     Run IPMI command  0x0 0x8 0x05 0xA0 0x00 0x00 0x00 0x00
 
-    ${boot_type}=  Read Attribute  ${CONTROL_HOST_URI}boot/one_time  BootType
+    ${boot_type}=  Read Attribute  ${CONTROL_HOST_URI}boot  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 Boot As Enabled Using REST API
+    [Documentation]  Enable boot override via REST and verify with both
+    ...              REST and IPMI.
+    [Tags]  Set_Boot_As_Enabled_Using_REST_API
+
+    Set Boot Enable  True
+
+    ${boot_enable}=  Read Attribute  ${CONTROL_HOST_URI}boot  Enabled
+    Should Be Equal As Strings  ${boot_enable}  True
+
+    ${output}=  Run IPMI Standard Command  chassis bootparam get 5
+    Should Contain  ${output}  Boot Flag Valid
+
+
+Set Boot As Enabled Using Ipmitool
+    [Documentation]  Enable boot override via IPMI and verify with both
+    ...              REST and IPMI.
+    [Tags]  Set_Boot_As_Enabled_Using_Ipmitool
+
+    Run IPMI command  0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
+
+    ${boot_type}=  Read Attribute  ${CONTROL_HOST_URI}boot  Enabled
+    Should Be Equal As Strings  ${boot_type}  True
+
+    ${output}=  Run IPMI Standard Command  chassis bootparam get 5
+    Should Contain  ${output}  Boot Flag Valid
+
+
+Set Boot As Disabled Using REST API
+    [Documentation]  Disable boot override via REST and verify with both
+    ...              REST and IPMI.
+    [Tags]  Set_Boot_As_Disabled_Using_REST_API
+
+    Set Boot Enable  False
+
+    ${boot_enable}=  Read Attribute  ${CONTROL_HOST_URI}boot  Enabled
+    Should Be Equal As Strings  ${boot_enable}  False
+
+    ${output}=  Run IPMI Standard Command  chassis bootparam get 5
+    Should Contain  ${output}  Boot Flag Invalid
+
+
+Set Boot As Disabled Using Ipmitool
+    [Documentation]  Disable boot override via IPMI and verify with both
+    ...              REST and IPMI.
+    [Tags]  Set_Boot_As_Disabled_Using_Ipmitool
+
+    Run IPMI command  0x0 0x8 0x05 0x00 0x00 0x00 0x00 0x00
+
+    ${boot_type}=  Read Attribute  ${CONTROL_HOST_URI}boot  Enabled
+    Should Be Equal As Strings  ${boot_type}  False
+
+    ${output}=  Run IPMI Standard Command  chassis bootparam get 5
+    Should Contain  ${output}  Boot Flag Invalid
+
+
 *** Keywords ***
 
+Set Boot Enable
+    [Documentation]  Set boot enable.
+    [Arguments]  ${boot_enable}
+    # Description of argument(s):
+    # boot_enable  Boot enable status which need to be set.
+
+    ${valueDict}=  Create Dictionary  data=${boot_enable}
+    Write Attribute  ${CONTROL_HOST_URI}boot  Enabled
+    ...  data=${valueDict}
+
 Set Boot Source
     [Documentation]  Set given boot source.
     [Arguments]  ${boot_source}
@@ -259,7 +337,7 @@
     # boot_source  Boot source which need to be set.
 
     ${valueDict}=  Create Dictionary  data=${boot_source}
-    Write Attribute  ${CONTROL_HOST_URI}boot/one_time  BootSource
+    Write Attribute  ${CONTROL_HOST_URI}boot  BootSource
     ...  data=${valueDict}
 
 
@@ -270,7 +348,7 @@
     # boot_mode  Boot mode which need to be set.
 
     ${valueDict}=  Create Dictionary  data=${boot_mode}
-    Write Attribute  ${CONTROL_HOST_URI}boot/one_time  BootMode
+    Write Attribute  ${CONTROL_HOST_URI}boot  BootMode
     ...  data=${valueDict}
 
 
@@ -281,7 +359,7 @@
     # boot_type  Boot type which need to be set.
 
     ${valueDict}=  Create Dictionary  data=${boot_type}
-    Write Attribute  ${CONTROL_HOST_URI}boot/one_time  BootType
+    Write Attribute  ${CONTROL_HOST_URI}boot  BootType
     ...  data=${valueDict}
 
 
@@ -304,6 +382,7 @@
    Set Boot Mode  ${BOOT_MODE_REGULAR}
    Run Keyword If  '${PLATFORM_ARCH_TYPE}' == 'x86'
    ...  Set Boot Type  ${BOOT_TYPE_EFI}
+   Set Boot Enable  false
 
 Test Suite Setup
     [Documentation]  Do the initial suite setup.