Replaced REST with Redfish for IPMI ambient temperature test case

Change-Id: I1e6b3ccf4418c82ce05d4731d503fdcd9bcdb270
Signed-off-by: Sushma M M <sushmm99@in.ibm.com>
diff --git a/ipmi/test_ipmi_sensor.robot b/ipmi/test_ipmi_sensor.robot
index aa16e37..e2d4c46 100644
--- a/ipmi/test_ipmi_sensor.robot
+++ b/ipmi/test_ipmi_sensor.robot
@@ -9,6 +9,11 @@
 Test Setup        Printn
 Test Teardown     FFDC On Test Case Fail
 
+
+*** Variables ***
+${allowed_temp_diff}    ${1}
+
+
 *** Test Cases ***
 
 Verify IPMI Temperature Readings using Redfish
@@ -30,6 +35,66 @@
     DCMI            pcie       pcie
     DCMI            ambient    ambient
 
+
+Test Ambient Temperature Via IPMI
+    [Documentation]  Test ambient temperature via IPMI and verify using Redfish.
+    [Tags]  Test_Ambient_Temperature_Via_IPMI
+
+    # Example of IPMI dcmi get_temp_reading output:
+    #        Entity ID                       Entity Instance    Temp. Readings
+    # Inlet air temperature(40h)                      1               +19 C
+    # CPU temperature sensors(41h)                    5               +51 C
+    # CPU temperature sensors(41h)                    6               +50 C
+    # CPU temperature sensors(41h)                    7               +50 C
+    # CPU temperature sensors(41h)                    8               +50 C
+    # CPU temperature sensors(41h)                    9               +50 C
+    # CPU temperature sensors(41h)                    10              +48 C
+    # CPU temperature sensors(41h)                    11              +49 C
+    # CPU temperature sensors(41h)                    12              +47 C
+    # CPU temperature sensors(41h)                    8               +50 C
+    # CPU temperature sensors(41h)                    16              +51 C
+    # CPU temperature sensors(41h)                    24              +50 C
+    # CPU temperature sensors(41h)                    32              +43 C
+    # CPU temperature sensors(41h)                    40              +43 C
+    # Baseboard temperature sensors(42h)              1               +35 C
+
+    ${temp_reading}=  Run IPMI Standard Command  dcmi get_temp_reading -N 10
+    Should Contain  ${temp_reading}  Inlet air temperature
+    ...  msg="Unable to get inlet temperature via DCMI".
+
+    ${ambient_temp_line}=
+    ...  Get Lines Containing String  ${temp_reading}
+    ...  Inlet air temperature  case-insensitive
+
+    ${ambient_temp_ipmi}=  Set Variable  ${ambient_temp_line.split('+')[1].strip(' C')}
+
+    # Example of ambient temperature via Redfish
+
+    #"@odata.id": "/redfish/v1/Chassis/chassis/Thermal#/Temperatures/0",
+    #"@odata.type": "#Thermal.v1_3_0.Temperature",
+    #"LowerThresholdCritical": 0.0,
+    #"LowerThresholdNonCritical": 0.0,
+    #"MaxReadingRangeTemp": 0.0,
+    #"MemberId": "ambient",
+    #"MinReadingRangeTemp": 0.0,
+    #"Name": "ambient",
+    #"ReadingCelsius": 24.987000000000002,
+    #"Status": {
+          #"Health": "OK",
+          #"State": "Enabled"
+    #},
+    #"UpperThresholdCritical": 35.0,
+    #"UpperThresholdNonCritical": 25.0
+
+    ${ambient_temp_redfish}=  Get Temperature Reading From Redfish  ambient
+
+    ${ipmi_redfish_temp_diff}=
+    ...  Evaluate  abs(${ambient_temp_redfish} - ${ambient_temp_ipmi})
+
+    Should Be True  ${ipmi_redfish_temp_diff} <= ${allowed_temp_diff}
+    ...  msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
+
+
 *** Keywords ***
 
 Get Temperature Reading And Verify In Redfish
diff --git a/tests/ipmi/test_general_ipmi.robot b/tests/ipmi/test_general_ipmi.robot
index 3608174..60de795 100755
--- a/tests/ipmi/test_general_ipmi.robot
+++ b/tests/ipmi/test_general_ipmi.robot
@@ -96,64 +96,6 @@
     ...  msg=msg=Verification failed for watchdog off check.
 
 
-Test Ambient Temperature Via IPMI
-    [Documentation]  Test ambient temperature via IPMI and verify using REST.
-    [Tags]  Test_Ambient_Temperature_Via_IPMI
-
-    #        Entity ID                       Entity Instance    Temp. Readings
-    # Inlet air temperature(40h)                      1               +19 C
-    # CPU temperature sensors(41h)                    5               +51 C
-    # CPU temperature sensors(41h)                    6               +50 C
-    # CPU temperature sensors(41h)                    7               +50 C
-    # CPU temperature sensors(41h)                    8               +50 C
-    # CPU temperature sensors(41h)                    9               +50 C
-    # CPU temperature sensors(41h)                    10              +48 C
-    # CPU temperature sensors(41h)                    11              +49 C
-    # CPU temperature sensors(41h)                    12              +47 C
-    # CPU temperature sensors(41h)                    8               +50 C
-    # CPU temperature sensors(41h)                    16              +51 C
-    # CPU temperature sensors(41h)                    24              +50 C
-    # CPU temperature sensors(41h)                    32              +43 C
-    # CPU temperature sensors(41h)                    40              +43 C
-    # Baseboard temperature sensors(42h)              1               +35 C
-
-    ${temp_reading}=  Run IPMI Standard Command  dcmi get_temp_reading -N 10
-    Should Contain  ${temp_reading}  Inlet air temperature
-    ...  msg="Unable to get inlet temperature via DCMI".
-    ${ambient_temp_line}=
-    ...  Get Lines Containing String  ${temp_reading}
-    ...  Inlet air temperature  case-insensitive
-
-    ${ambient_temp_ipmi}=  Fetch From Right  ${ambient_temp_line}  +
-    ${ambient_temp_ipmi}=  Remove String  ${ambient_temp_ipmi}  ${SPACE}C
-
-    ${ambient_temp_rest}=  Read Attribute
-    ...  ${SENSORS_URI}temperature/ambient  Value
-
-    # Example of ambient temperature via REST
-    #  "CriticalAlarmHigh": 0,
-    #  "CriticalAlarmLow": 0,
-    #  "CriticalHigh": 35000,
-    #  "CriticalLow": 0,
-    #  "Scale": -3,
-    #  "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
-    #  "Value": 21775,
-    #  "WarningAlarmHigh": 0,
-    #  "WarningAlarmLow": 0,
-    #  "WarningHigh": 25000,
-    #  "WarningLow": 0
-
-    # Get temperature value based on scale i.e. Value * (10 power Scale Value)
-    # e.g. from above case 21775 * (10 power -3) = 21775/1000
-
-    ${ambient_temp_rest}=  Evaluate  ${ambient_temp_rest}/1000
-    ${ipmi_rest_temp_diff}=
-    ...  Evaluate  abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
-
-    Should Be True  ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
-    ...  msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
-
-
 Test Power Reading Via IPMI With Host Off
     [Documentation]  Test power reading via IPMI with host off state and
     ...  verify using REST.