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/data/variables.py b/data/variables.py
index f621315..d071a0d 100644
--- a/data/variables.py
+++ b/data/variables.py
@@ -7,7 +7,6 @@
 
 # REST URI base endpoint paths
 CONTROL_URI = OPENBMC_BASE_URI + 'control/'
-SENSORS_URI = OPENBMC_BASE_URI + 'sensors/'
 RECORDS_URI = OPENBMC_BASE_URI + 'records/'
 BUTTONS_URI = OPENBMC_BASE_URI + 'buttons/'
 SETTINGS_URI = OPENBMC_BASE_URI + 'settings/'
@@ -18,6 +17,9 @@
 TIME_MANAGER_URI = OPENBMC_BASE_URI + 'TimeManager/'
 XYZ_NETWORK_MANAGER = '/xyz/openbmc_project/network/'
 
+# Sensors base variables.
+SENSORS_URI = '/xyz/openbmc_project/sensors/'
+
 # State Manager base variables.
 BMC_REBOOT_TRANS = 'xyz.openbmc_project.State.BMC.Transition.Reboot'
 
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
+