Updated and added ambient temperature test case

Resolves openbmc/openbmc-test-automation#1965

Signed-off-by: Marissa Garza <garzam@us.ibm.com>
Change-Id: I984485bd2404ebe209eafae2c0823ec812407457
diff --git a/redfish/systems/test_thermal_ambient_temperatures.robot b/redfish/systems/test_thermal_ambient_temperatures.robot
index 57d877e..b51f1c2 100755
--- a/redfish/systems/test_thermal_ambient_temperatures.robot
+++ b/redfish/systems/test_thermal_ambient_temperatures.robot
@@ -3,8 +3,11 @@
 
 Resource            ../../lib/bmc_redfish_resource.robot
 Resource            ../../lib/bmc_redfish_utils.robot
+Resource            ../../lib/logging_utils.robot
+Resource            ../../lib/boot_utils.robot
 Resource            ../../lib/openbmc_ffdc.robot
 Library             ../../lib/gen_robot_valid.py
+Library             ../../lib/logging_utils.py
 
 Suite Setup         Suite Setup Execution
 Suite Teardown      Suite Teardown Execution
@@ -23,6 +26,16 @@
     Temperatures    ReadingCelsius
 
 
+Reboot And Check Ambient Temperature Records Are Valid
+    [Documentation]  Check the ambient temperature records are valid after a reboot.
+    [Tags]  Reboot_And_Check_Ambient_Temperature_Records_Are_Valid
+
+    Redfish OBMC Reboot (run)
+    Redfish.Login
+
+    Get Thermal Records and Verify  Temperatures  ReadingCelsius
+
+
 *** Keywords ***
 
 Get Thermal Records and Verify
@@ -33,39 +46,35 @@
     # 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}
+    ${records}=  Verify Valid Records  ${record_type}  ${REDFISH_CHASSIS_THERMAL_URI}  ${reading_type}
 
     ${num_records}=  Get Length  ${records}
     Rprint Vars  num_records  records
 
-    ${invalid_records}=  Filter Struct  ${records}
-    ...  [('Health', '^OK$'), ('State', '^Enabled$'), ('${reading_type}', '')]  regex=1  invert=1
-    ${num_invalid_records}=  Get Length  ${invalid_records}
-
-    Run Keyword If  ${num_invalid_records} > ${0}
-    ...  Rprint Vars  num_invalid_records  invalid_records
-    Valid Value  num_invalid_records  valid_values=[0]
-
     ${invalid_records}=  Evaluate
-    ...  [x for x in ${records} if not x['LowerThresholdNonCritical'] <= x['ReadingCelsius'] <= x['UpperThresholdNonCritical']]
+    ...  [x for x in ${records} if not x['LowerThresholdNonCritical'] <= x['${reading_type}'] <= x['UpperThresholdNonCritical']]
 
     ${num_invalid_records}=  Get Length  ${invalid_records}
     Run Keyword If  ${num_invalid_records} > ${0}
     ...  Rprint Vars  num_invalid_records  invalid_records
     Valid Value   num_invalid_records  valid_values=[0]
 
+    Error Logs Should Not Exist
+
+
 Suite Teardown Execution
     [Documentation]  Do the post suite teardown.
 
     Redfish.Logout
 
+
 Suite Setup Execution
     [Documentation]  Do test case setup tasks.
 
     Printn
     Redfish.Login
+    Redfish Purge Event Log
+
 
 Test Teardown Execution
     [Documentation]  Do the post test teardown.