Test to verify fan sensor properties

This is the base code for thermal fan sensor test suite.

Resolves openbmc/openbmc-test-automation#587

Change-Id: I95f2425192433a587e28abea8808a9bae74ea73f
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/test_lists/skip_test b/test_lists/skip_test
index d524d92..eea698d 100644
--- a/test_lists/skip_test
+++ b/test_lists/skip_test
@@ -11,8 +11,6 @@
 -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/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
diff --git a/test_lists/skip_test_barreleye b/test_lists/skip_test_barreleye
index d248fdd..06b5c3d 100644
--- a/test_lists/skip_test_barreleye
+++ b/test_lists/skip_test_barreleye
@@ -11,8 +11,6 @@
 -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/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
diff --git a/test_lists/skip_test_witherspoon b/test_lists/skip_test_witherspoon
index 4a43a80..391bb80 100644
--- a/test_lists/skip_test_witherspoon
+++ b/test_lists/skip_test_witherspoon
@@ -11,8 +11,6 @@
 -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/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
diff --git a/tests/test_fan.robot b/tests/test_fan.robot
index ce7e990..188a8cc 100644
--- a/tests/test_fan.robot
+++ b/tests/test_fan.robot
@@ -1,13 +1,52 @@
 *** Settings ***
-Documentation     This testsuite is for testing fan interface for openbmc
-Suite Teardown    Delete All Sessions
+Documentation     Test module for testing fan interface.
+
 Resource          ../lib/rest_client.robot
 Resource          ../lib/openbmc_ffdc.robot
+
 Test Teardown     FFDC On Test Case Fail
 
 *** Test Cases ***
-Empty Fan Test
-   [Documentation]   Dummy Test case. We can't have an empty test case in
-   ...               the testcase directory.
-   [Tags]  Empty_Fan_Test
-   Log    This is a dummy test case.. Ignore
+
+Verify Fan Sensors Atrributes
+   [Documentation]  Check fan attributes.
+   [Tags]  Verify_Fan_Sensor_Attributes
+
+   ${fans}=  Get Fan Sensor List
+
+   # Access the properties of the fan and it should contain
+   # the following entries:
+   # /xyz/openbmc_project/sensors/fan_tach/fan0
+   # {
+   #     "Scale": 0,
+   #     "Target": 0,
+   #     "Unit": "xyz.openbmc_project.Sensor.Value.Unit.RPMS",
+   #     "Value": 0
+   # }
+
+   :FOR  ${entry}  IN  @{fans}
+   \  ${resp}=  OpenBMC Get Request  ${entry}
+   \  ${json}=  To Json  ${resp.content}
+   \  Should Be True  ${json["data"]["Scale"]} >= 0
+   \  Should Be True  ${json["data"]["Target"]} >= 0
+   \  Should Be Equal As Strings
+   ...  ${json["data"]["Unit"]}  xyz.openbmc_project.Sensor.Value.Unit.RPMS
+   \  Should Be True  ${json["data"]["Value"]} >= 0
+
+
+*** Keywords ***
+
+Get Fan Sensor List
+    [Documentation]  Get a list of fan sensor URLs.
+    # Example:
+    # /xyz/openbmc_project/sensors/fan_tach/fan0
+    # /xyz/openbmc_project/sensors/fan_tach/fan1
+    # /xyz/openbmc_project/sensors/fan_tach/fan2
+    # /xyz/openbmc_project/sensors/fan_tach/fan3
+
+    ${resp}=  Openbmc Get Request
+    ...  /xyz/openbmc_project/sensors/fan_tach/list
+    Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK}
+    ${jsondata}=  To JSON  ${resp.content}
+    Should Not Be Empty  ${jsondata["data"]}
+    [Return]  ${jsondata["data"]}