Read thermal ambient temperatures

Signed-off-by: Marissa Garza <garzam@us.ibm.com>
Change-Id: Ib16e7dbe723bbaebbdbc9e867d0d5d1eaee8e3ca
diff --git a/data/variables.py b/data/variables.py
index 473bb10..cf541bf 100755
--- a/data/variables.py
+++ b/data/variables.py
@@ -155,6 +155,8 @@
 REDFISH_LDAP_CERTIFICATE_URI = REDFISH_BASE_URI + REDFISH_LDAP_CERTIFICATE
 REDFISH_CA_CERTIFICATE = 'Managers/bmc/Truststore/Certificates'
 REDFISH_CA_CERTIFICATE_URI = REDFISH_BASE_URI + REDFISH_CA_CERTIFICATE
+REDFISH_CHASSIS_THERMAL = 'Chassis/chassis/Thermal'
+REDFISH_CHASSIS_THERMAL_URI = REDFISH_BASE_URI + REDFISH_CHASSIS_THERMAL
 
 # Boot options and URI variables.
 POWER_ON = 'On'
diff --git a/redfish/systems/test_thermal_ambient_temperatures.robot b/redfish/systems/test_thermal_ambient_temperatures.robot
new file mode 100755
index 0000000..3562710
--- /dev/null
+++ b/redfish/systems/test_thermal_ambient_temperatures.robot
@@ -0,0 +1,64 @@
+*** Settings ***
+Documentation       Getting the systems thermal records for temperature.
+
+Resource            ../../lib/bmc_redfish_resource.robot
+Resource            ../../lib/bmc_redfish_utils.robot
+Resource            ../../lib/openbmc_ffdc.robot
+
+Suite Setup         Suite Setup Execution
+Suite Teardown      Suite Teardown Execution
+Test Teardown       Test Teardown Execution
+
+
+*** Test Cases ***
+
+Get Ambient Temperature Records
+    [Documentation]  Get the ambient temperature records.
+    [Tags]  Get_Ambient_Temperature_Records
+    [Template]  Get Thermal Records and Verify
+
+    # record_type   reading_type
+    Temperatures    ReadingCelsius
+
+
+*** Keywords ***
+
+Get Thermal Records and Verify
+    [Documentation]  Get the thermal records for temperatures.
+    [Arguments]  ${record_type}  ${reading_type}
+
+    # Description of Arguments(s):
+    # record_type    The thermal record type (e.g. "Temperatures")
+    # reading_type   The thermal temperature readings (e.g. "ReadingCelsius")
+
+    # A valid record will have "State" key "Enabled" and "Health" key "OK"
+
+    ${records}=  Redfish.Get Attribute
+    ...  ${REDFISH_CHASSIS_THERMAL_URI}  ${record_type}
+
+    ${num_records}=  Get Length  ${records}
+
+    ${valid_records}=  Filter Struct  ${records}
+    ...  [('Health', '^OK$'), ('State', '^Enabled$'), ('${reading_type}', '')]  regex=1
+
+    ${num_valid_records}=  Get Length  ${valid_records}
+
+    Rprint Vars  num_records  records  valid_records
+    ...  num_valid_records  fmt=terse
+
+    Should Be Equal As Integers  ${num_records}  ${num_valid_records}
+
+Suite Teardown Execution
+    [Documentation]  Do the post suite teardown.
+
+    Redfish.Logout
+
+Suite Setup Execution
+    [Documentation]  Do test case setup tasks.
+
+    Redfish.Login
+
+Test Teardown Execution
+    [Documentation]  Do the post test teardown.
+
+    FFDC On Test Case Fail