Move LED testing keywords to the library
Move the keywords from tests/test_led.robot to lib/utils.robot.
Resolves openbmc/openbmc-test-automation#1245
Change-Id: I08de681db9c5e506370003331fef0570a1938abf
Signed-off-by: Steven Sombar <ssombar@us.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index e41b240..8487b82 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -1262,6 +1262,31 @@
[Return] ${state.rsplit('.', 1)[1]}
+Set System LED State
+ [Documentation] Set given system LED via REST.
+ [Arguments] ${led_name} ${led_state}
+ # Description of argument(s):
+ # led_name System LED name (e.g. heartbeat, identify, beep).
+ # led_state LED state to be set (e.g. On, Off).
+
+ ${args}= Create Dictionary
+ ... data=xyz.openbmc_project.Led.Physical.Action.${led_state}
+ Write Attribute ${LED_PHYSICAL_URI}${led_name} State data=${args}
+
+ Verify LED State ${led_name} ${led_state}
+
+
+Verify LED State
+ [Documentation] Checks if LED is in given state.
+ [Arguments] ${led_name} ${led_state}
+ # Description of argument(s):
+ # led_name System LED name (e.g. heartbeat, identify, beep).
+ # led_state LED state to be verified (e.g. On, Off).
+
+ ${state}= Get System LED State ${led_name}
+ Should Be Equal ${state} ${led_state}
+
+
Delete Error Logs
[Documentation] Delete error logs.
diff --git a/tests/test_led.robot b/tests/test_led.robot
index 86446ee..a060829 100644
--- a/tests/test_led.robot
+++ b/tests/test_led.robot
@@ -6,6 +6,7 @@
Resource ../lib/state_manager.robot
Resource ../lib/resource.txt
Resource ../lib/openbmc_ffdc.robot
+Resource ../lib/utils.robot
Test Teardown FFDC On Test Case Fail
@@ -97,27 +98,3 @@
Should Be Equal ${resp} On
${resp}= Get System LED State front_power
Should Be Equal ${resp} On
-
-*** Keywords ***
-
-Set System LED State
- [Documentation] Set given system LED via REST.
- [Arguments] ${led_name} ${led_state}
- # Description of arguments:
- # led_name System LED name (e.g. heartbeat, identify, beep).
- # led_state LED state to be set (e.g. On, Off).
-
- ${args}= Create Dictionary data=xyz.openbmc_project.Led.Physical.Action.${led_state}
- Write Attribute ${LED_PHYSICAL_URI}${led_name} State data=${args}
-
- Verify LED State ${led_name} ${led_state}
-
-Verify LED State
- [Documentation] Checks if LED is in given state.
- [Arguments] ${led_name} ${led_state}
- # Description of arguments:
- # led_name System LED name (e.g. heartbeat, identify, beep).
- # led_state LED state to be verified (e.g. On, Off).
-
- ${state}= Get System LED State ${led_name}
- Should Be Equal ${state} ${led_state}