Fixes for Verify IPMI, DCMI Temperature Readings using Redfish
Changes:
- Sensor name changes
- Code changes to get all the sensors(PCIE, Ambient) available
Tested:
- Ran test cases successfully from sandbox.
Signed-off-by: srichn28 <srichn28@in.ibm.com>
Change-Id: Ia2f8f234c2cbacc8284d68beeb17896ac704b5e3
Signed-off-by: srichn28 <srichn28@in.ibm.com>
diff --git a/ipmi/test_ipmi_sensor.robot b/ipmi/test_ipmi_sensor.robot
index 42c1401..5f70ab9 100644
--- a/ipmi/test_ipmi_sensor.robot
+++ b/ipmi/test_ipmi_sensor.robot
@@ -25,8 +25,8 @@
[Template] Get Temperature Reading And Verify In Redfish
# command_type sensor_id member_id
- IPMI pcie pcie
- IPMI ambient ambient
+ IPMI PCIE PCIE
+ IPMI Ambient Ambient
Verify DCMI Temperature Readings using Redfish
@@ -35,8 +35,8 @@
[Template] Get Temperature Reading And Verify In Redfish
# command_type sensor_id member_id
- DCMI pcie pcie
- DCMI ambient ambient
+ DCMI PCIE PCIE
+ DCMI Ambient Ambient
Test Ambient Temperature Via IPMI
@@ -215,40 +215,65 @@
${redfish_value}= Get Temperature Reading From Redfish ${member_id}
- Valid Range ${ipmi_value} ${redfish_value-1.000} ${redfish_value+1.000}
+ ${keys}= Get Dictionary Keys ${ipmi_value}
+ FOR ${index} IN @{keys}
+ ${value_diff}= Evaluate abs(${redfish_value["${index}"]} - ${ipmi_value["${index}"]})
+ Should Be True ${value_diff} <= ${allowed_temp_diff}
+ END
+
Get IPMI Sensor Reading
- [Documentation] Get reading from IPMI sensor reading command.
+ [Documentation] Get IPMI sensor readings as a dictionary.
[Arguments] ${sensor_id}
# Description of argument(s):
# sensor_id Sensor id used to get reading in IPMI.
- ${data}= Run IPMI Standard Command sensor reading ${sensor_id}
+ ${sensor_list}= Get Available Sensors ${sensor_id}
+ ${sensor_value_dict}= Create Dictionary
- # Example reading:
- # pcie | 28.500
+ FOR ${ids} IN @{sensor_list}
+ ${data}= Run IPMI Standard Command sensor reading ${ids}
- ${sensor_value}= Set Variable ${data.split('| ')[1].strip()}
- [Return] ${sensor_value}
+ # Example reading:
+ # PCIE_0_Temp | 5Ch | ok | 41.1 | 27 degrees C
+
+ ${sensor_key}= Set Variable ${data.split('| ')[0].strip()}
+ ${sensor_value}= Set Variable ${data.split('| ')[1].strip()}
+ Set To Dictionary ${sensor_value_dict} ${sensor_key} ${sensor_value}
+ END
+
+ [Return] ${sensor_value_dict}
Get DCMI Sensor Reading
- [Documentation] Get reading from DCMI sensors command.
+ [Documentation] Get DCMI sensor readings as a dictionary.
[Arguments] ${sensor_id}
# Description of argument(s):
# sensor_id Sensor id used to get reading in DCMI.
${data}= Run IPMI Standard Command dcmi sensors
- ${sensor_data}= Get Lines Containing String ${data} ${sensor_id}
+ ${sensor_data}= Get Lines Containing String ${data} ${sensor_id} case_insensitive
+ ${sensor_lines}= Split To Lines ${sensor_data}
# Example reading:
- # Record ID 0x00fd: pcie | 28.50 degrees C | ok
+ # Record ID 0x005c: PCIE_0_Temp | 27 degrees C | ok
- ${sensor_value}= Set Variable ${sensor_data.split(' | ')[1].strip('degrees C').strip()}
- [Return] ${sensor_value}
+ ${sensor_value_dict}= Create Dictionary
+
+ FOR ${line} IN @{sensor_lines}
+ ${sensor}= Set Variable ${line.split(' | ')}
+ ${sensor_key}= Set Variable ${sensor[0].split(':')[1].strip()}
+ ${sensor_value}= Set Variable ${sensor[1].split()[0].strip()}
+ ${contains}= Evaluate """disabled""" in "${sensor_value}"
+
+ Run Keyword IF "${contains}" != """True"""
+ ... Set To Dictionary ${sensor_value_dict} ${sensor_key} ${sensor_value}
+ END
+
+ [Return] ${sensor_value_dict}
Get Temperature Reading From Redfish
@@ -462,7 +487,7 @@
${resp}= Run IPMI Standard Command sdr elist
${sensor_list}= Create List
- ${sensors}= Get Lines Containing String ${resp} ${sensor_component}
+ ${sensors}= Get Lines Containing String ${resp} ${sensor_component} case-insensitive
${sensors}= Split To Lines ${sensors}
# Example of IPMI sdr elist command.
@@ -480,7 +505,7 @@
${sensor_name}= Set Variable ${line.split('|')[0].strip()}
# Adding sensors to the list whose presence is detected.
- ${contains}= Evaluate "Presence detected" in "${line}"
+ ${contains}= Evaluate "Presence detected" in "${line}" or "ok" in "${line}"
Run Keyword IF "${contains}" == "True"
... Append To List ${sensor_list} ${sensor_name}
END