Ambient temperature test

Boot host and check the ambient temperature and should not cross
50 degree celsius. This temperature is an agreed round figure to
use for validation from development team.

Resolves  openbmc/openbmc-test-automation#934

Change-Id: I00c5c0b1eac7d182dc535c949e49f34bc0c15659
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tests/test_hardware_sensors.robot b/tests/test_hardware_sensors.robot
new file mode 100644
index 0000000..48fff13
--- /dev/null
+++ b/tests/test_hardware_sensors.robot
@@ -0,0 +1,52 @@
+*** Settings ***
+Documentation   Suite to test harware sensors.
+
+Resource        ../lib/utils.robot
+Resource        ../lib/boot_utils.robot
+Resource        ../lib/state_manager.robot
+Resource        ../lib/openbmc_ffdc.robot
+
+Suite Setup     Pre Test Suite Execution
+Test Teardown   Post Test Case Execution
+
+*** Test Cases ***
+
+Verify System Ambient Temperature
+    [Documentation]  Check the ambient sensor temperature.
+    [Tags]  Verify_System_Ambient_Temperature
+
+    # Example:
+    # /xyz/openbmc_project/sensors/temperature/ambient
+    # {
+    #     "Scale": -3,
+    #     "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
+    #     "Value": 25767
+    # }
+
+    ${temp_data}=  Read Properties  ${SENSORS_URI}temperature/ambient
+    Should Be True  ${temp_data["Scale"]} == ${-3}
+    Should Be Equal As Strings
+    ...  ${temp_data["Unit"]}  xyz.openbmc_project.Sensor.Value.Unit.DegreesC
+    Should Be True  ${temp_data["Value"]/1000} <= ${50}
+    ...  msg=System working temperature crossed 50 degree celsius.
+
+
+*** Keywords ***
+
+Pre Test Suite Execution
+    [Documentation]  Do the initial test suite setup.
+    # - Power off.
+    # - Boot Host.
+    REST Power Off  stack_mode=skip
+    REST Power On
+
+Post Test Case Execution
+    [Documentation]  Do the post test teardown.
+    # - Capture FFDC on test failure.
+    # - Delete error logs.
+    # - Close all open SSH connections.
+
+   FFDC On Test Case Fail
+   Delete Error Logs
+   Close All Connections
+