Test LED groups using new xyz interface.
- Added keywords to Get and Set LEDs state using new
xyz interface
- Created testcases to set on and off all different LEDs
using new xyz interface.
- Added skip list for Barreleye.
- Skipped new LED group TCs for NA system i.e. Barreleye
and Palmetto.
Resolves openbmc/openbmc-test-automation#159
Change-Id: I0cc7a7226a7b2b10c3f326f4071bf192ebd65e70
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/data/variables.py b/data/variables.py
index 14c2a46..2070c51 100644
--- a/data/variables.py
+++ b/data/variables.py
@@ -47,6 +47,10 @@
# Inventory URI
HOST_INVENTORY_URI = '/xyz/openbmc_project/inventory/'
+# Led URI variable
+LED_GROUPS_URI = '/xyz/openbmc_project/led/groups/'
+
+
'''
QEMU HTTPS variable:
diff --git a/test_lists/skip_test_barreleye b/test_lists/skip_test_barreleye
new file mode 100644
index 0000000..c76503e
--- /dev/null
+++ b/test_lists/skip_test_barreleye
@@ -0,0 +1,57 @@
+-e known_issue
+#https://github.com/openbmc/openbmc-test-automation/issues/123
+-e Execute_ipmi_BT_capabilities_command
+#https://github.com/openbmc/openbmc/issues/539
+-e Test_Wrong_Reservation_ID
+#https://github.com/openbmc/openbmc/issues/539
+-e Test_Correct_Reservation_ID
+#https://github.com/openbmc/openbmc-test-automation/issues/107
+-e Set_valid_Mac_address
+#https://github.com/openbmc/openbmc-test-automation/issues/107
+-e Revert_old_Mac_addres
+#https://github.com/openbmc/openbmc-test-automation/issues/137
+-e Set_invalid_Mac_address
+#https://github.com/openbmc/openbmc-test-automation/issues/22
+-e Validate_Heartbeat_LEDs_Test_Cases
+-e Validate_Identify_LEDs_Test_Cases
+-e Validate_Beep_LEDs_Test_Cases
+#https://github.com/openbmc/openbmc-test-automation/issues/90
+-e Verify_System_VPD_Properties
+#https://github.com/openbmc/openbmc/issues/93
+-e Minimal_Fan_Inventory
+#https://github.com/openbmc/openbmc-test-automation/issues/139
+-e Empty_Fan_Test
+#https://github.com/openbmc/openbmc/issues/612
+-e Create_and_delete_user_without_group_name
+-e Create_and_delete_user_with_user_group_name
+-e Create_multiple_users
+-e Create_and_delete_user_without_password
+-e Set_password_for_existing_user
+-e Set_password_with_empty_password_for_existing
+-e Create_existing_user
+#https://github.com/openbmc/openbmc-test-automation/issues/148
+-e Get_System_Time
+-e Set_Valid_System_Time
+-e Set_Invalid_System_Time
+-e Set_System_Time_with_no_time
+-e IPMI_Chassis_Status_On
+-e IPMI_Chassis_Status_Off
+-e IPMI_Chassis_Restore_Power_Policy
+#https://github.com/openbmc/openbmc/issues/830
+-e Good_connection_for_testing
+-e get_directory_listing
+-e get_directory_listing_xyz
+-e get_names
+-e get_names_org
+#https://github.com/openbmc/openbmc/issues/928
+-e Set_Host_Time_With_Both_And_NTP
+#https://github.com/openbmc/openbmc/issues/901
+-e Set_BMC_Time_With_Split_And_Manual
+#https://github.com/openbmc/openbmc/issues/1142
+-e Check_BMC_Name_Property_Is_Set
+-e Check_BMC_Clocks_Name_Property_Is_Set
+-e Check_BMC_Clocks_Compatible_Property_Is_Set
+#openbmc/openbmc-test-automation/issues/75
+-e eSEL_Logging
+# Led groups test cases are NA for Barreleye and Palmetto
+-e LED_Group
diff --git a/test_lists/skip_test_palmetto b/test_lists/skip_test_palmetto
index 11d0797..e0c2c84 100644
--- a/test_lists/skip_test_palmetto
+++ b/test_lists/skip_test_palmetto
@@ -55,3 +55,5 @@
-e eSEL_Logging
#openbmc/openbmc-test-automation/issues/396
-e NetworkManager
+# Led groups test cases are NA for Barreleye and Palmetto
+-e LED_Group
diff --git a/tests/test_ledgroup.robot b/tests/test_ledgroup.robot
new file mode 100644
index 0000000..705780a
--- /dev/null
+++ b/tests/test_ledgroup.robot
@@ -0,0 +1,153 @@
+*** Settings ***
+
+Documentation Test LED groups in OpenBMC.
+
+Resource ../lib/rest_client.robot
+Resource ../lib/resource.txt
+Resource ../lib/openbmc_ffdc.robot
+
+Suite Setup Setup The Suite
+Test Teardown FFDC On Test Case Fail
+
+Force Tags LED_Group
+
+*** Variables ***
+
+
+*** Test Cases ***
+
+Verify CPU Fault LEDs Group
+ [Documentation] Verify CPU's fault LEDs.
+ [Tags] Verify_CPU_Fault_LEDs_Group
+
+ Verify LED Group cpu Fault
+
+Verify Fan Fault LEDs Group
+ [Documentation] Verify fan's fault LEDs.
+ [Tags] Verify_Fan_Fault_LEDs_Group
+
+ Verify LED Group Fan Fault
+
+Verify DIMM Fault LEDs Group
+ [Documentation] Verify DIMM's fault LEDs.
+ [Tags] Verify_DIMM_Fault_LEDs_Group
+
+ Verify LED Group dimm Fault
+
+Verify GPU Fault LEDs Group
+ [Documentation] Verify GPU's fault LEDs.
+ [Tags] Verify_GPU_Fault_LEDs_Group
+
+ Verify LED Group gpu Fault
+
+Verify Power Supply Fault LEDs Group
+ [Documentation] Verify power supply's fault LEDs.
+ [Tags] Verify_Power_Supply_Fault_LEDs_Group
+
+ Verify LED Group powersupply Fault
+
+Verify Enclosure Fault LED Group
+ [Documentation] Validate enclosure's fault LED.
+ [Tags] Verify_Enclosure_Fault_LED_Group
+
+ Verify LED Group Enclosure Fault
+
+Verify Power State LEDs Group
+ [Documentation] Verify power state LEDs.
+ [Tags] Verify_Power_State_LEDs_Group
+
+ Verify LED Group Power
+
+Verify Enclosure Identify LED Group
+ [Documentation] Validate enclosure's identify LED.
+ [Tags] Verify_Enclosure_Identify_LED_Group
+
+ Verify LED Group Enclosure Identify
+
+Verify Fan Identify LEDs Group
+ [Documentation] Verify fan's identify LEDs.
+ [Tags] Verify_Fan_Identify_LEDs_Group
+
+ Verify LED Group Fan Identify
+
+Verify Other Fault LEDs Group
+ [Documentation] Verify other fault LEDs.
+ [Tags] Verify_Other_Fault_LEDs_Group
+
+ Verify LED Group systemFault
+ Verify LED Group boxelderFault
+ Verify LED Group bmcFault
+ Verify LED Group motherboardFault
+
+*** Keywords ***
+
+Get LED State XYZ
+ [Documentation] Returns state of given LED.
+ [Arguments] ${led_name}
+ # Description of arguments:
+ # led_name Name of LED
+
+ ${state}= Read Attribute ${LED_GROUPS_URI}${led_name} Asserted
+ [Return] ${state}
+
+Set LED State
+ [Documentation] Set state of given LED to on or off.
+ [Arguments] ${state} ${led_name}
+ # Description of arguments:
+ # state LED's state to set, i.e. On or Off
+ # led_name Name of LED
+
+ ${data}= Run Keyword If
+ ... '${state}' == 'On' Create Dictionary data=${True}
+ ... ELSE IF '${state}' == 'Off' Create Dictionary data=${False}
+ ... ELSE Fail msg=Invalid LED state
+
+ ${resp}= OpenBMC Put Request
+ ... ${LED_GROUPS_URI}${led_name}/attr/Asserted data=${data}
+ ${jsondata}= to JSON ${resp.content}
+ Should Be Equal As Strings ${jsondata['status']} ok
+
+Verify LED Group
+ [Documentation] Set and validate state of all LEDs with given name.
+ [Arguments] ${led_prefix} ${led_suffix}=${EMPTY}
+ # Description of arguments:
+ # led_prefix LED name's prefix
+ # led_suffix LED name's suffix
+
+ ${led_list}= Get LED List ${led_prefix} ${led_suffix}
+
+ ${list_length}= Get Length ${led_list}
+ Should Be True ${list_length} > 0
+ ... msg=No ${led_prefix} ${led_suffix} LED found
+
+ :FOR ${led} IN @{led_list}
+ \ Set LED State On ${led}
+ \ ${resp}= Get LED State XYZ ${led}
+ \ Should Be Equal ${resp} ${1}
+ \ Set LED State Off ${led}
+ \ ${resp}= Get LED State XYZ ${led}
+ \ Should Be Equal ${resp} ${0}
+
+Setup The Suite
+ [Documentation] Test setup before running this suite.
+
+ ${resp}= Read Properties ${LED_GROUPS_URI}
+ Set Suite Variable ${LED_GROUPS} ${resp}
+
+Get LED List
+ [Documentation] Returns all LEDs with given name.
+ [Arguments] ${led_prefix} ${led_suffix}=${EMPTY}
+ # Description of arguments:
+ # led_prefix LED name's prefix
+ # led_suffix LED name's suffix
+
+ ${list}= Get Matches
+ ... ${LED_GROUPS} regexp=^.*[0-9a-z_].${led_prefix}.*${led_suffix}
+ ${led_list}= Create List
+
+ : FOR ${element} IN @{list}
+ \ ${element}= Remove String ${element} ${LED_GROUPS_URI}
+ \ Append To List ${led_list} ${element}
+ Sort List ${led_list}
+
+ [Return] ${led_list}