Verify switch fan setting modes
Modes are set as Current or Supported
Mode Types if available are Default and Custom
Signed-off-by: Marissa Garza <garzam@us.ibm.com>
Change-Id: Id39d2cbc64d0ffdef7d80fee405cc13d39957554
diff --git a/tests/test_alternate_fan_settings.robot b/tests/test_alternate_fan_settings.robot
index dd5ef63..dba2267 100755
--- a/tests/test_alternate_fan_settings.robot
+++ b/tests/test_alternate_fan_settings.robot
@@ -21,8 +21,9 @@
Library ../lib/gen_robot_valid.py
Test Setup Open Connection And Log In
-Suite Setup REST Power On stack_mode=skip
+Suite Setup Suite Setup Execution
Test Teardown FFDC On Test Case Fail
+Suite Teardown Suite Teardown Execution
*** Variables ***
@@ -32,34 +33,56 @@
*** Test Cases ***
-Verify Thermal Current Mode
- [Documentation] Check current mode value.
- [Tags] Verify_Thermal_Current_Mode
+Switch To Thermal Mode
+ [Documentation] Change thermal modes on the system.
+ [Tags] Switch_To_Thermal_Mode
- # Example:
- # /xyz/openbmc_project/control/thermal/0
- #
- # Response code:200, Content: {
- # "data": {
- # "Current": "DEFAULT",
- # "Supported": [
- # "DEFAULT",
- # "CUSTOM"
- # },
- # },
- # "message": "200 OK",
- # "status": "ok"
- # }
+ ${value_dict}= Create Dictionary data=CUSTOM
+ ${expected_value}= Set Variable If 'CUSTOM' in ${supported} CUSTOM DEFAULT
+ Write Attribute ${CONTROL_URI}thermal/0 current verify=${True}
+ ... expected_value=${expected_value} data=${value_dict}
+
+ Pass Execution If 'CUSTOM' not in ${supported} Custom mode not supported
+
+ REST Power On stack_mode=normal
${current}= Read Attribute ${CONTROL_URI}thermal/0 current
Rprint Vars current
-
- Rvalid Value current valid_values=${VALID_MODE_VALUES}
+ Should Be Equal As Strings ${current} CUSTOM
+ ... msg=Thermal mode setting was changed by reboot to the OS.
-Verify Supported Modes Available
- [Documentation] Check supported modes available.
- [Tags] Verify_Supported_Modes_Available
+*** Keywords ***
+
+Suite Setup Execution
+ [Documentation] Do suite setup tasks.
+
+ REST Power On stack_mode=skip
${supported}= Read Attribute ${CONTROL_URI}thermal/0 supported
- Rprint Vars supported
+ ${current}= Read Attribute ${CONTROL_URI}thermal/0 current
+ Rprint Vars supported current
+
+ Set Suite Variable ${supported}
+ Set Suite Variable ${current}
+
+Suite Teardown Execution
+ [Documentation] Do the post suite teardown.
+
+ ${supported}= Read Attribute ${CONTROL_URI}thermal/0 supported
+ ${current}= Read Attribute ${CONTROL_URI}thermal/0 current
+ Rprint Vars supported current
+
+ # If CUSTOM mode is not supported, no cleanup needed.
+ Return From Keyword If 'CUSTOM' not in ${supported}
+
+ # If DEFAULT mode currently set, no cleanup needed.
+ Return From Keyword If '${current}' == 'DEFAULT'
+
+ # Restore the DEFAULT setting.
+ ${value_dict}= Create Dictionary data=DEFAULT
+ Write Attribute ${CONTROL_URI}thermal/0 current verify=${True}
+ ... data=${value_dict}
+
+ # Reboot system required for change take effect.
+ REST Power On stack_mode=normal