Test IPMI SDR info output.
Resolves openbmc/openbmc-test-automation#1302
Change-Id: I7179c79b3bc83bd0884741460066720cea912184
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/lib/ipmi_utils.py b/lib/ipmi_utils.py
index ed5e370..38d98f7 100644
--- a/lib/ipmi_utils.py
+++ b/lib/ipmi_utils.py
@@ -251,3 +251,46 @@
result = vf.key_value_outbuf_to_dict(ret_values, process_indent=1)
return result
+
+
+def get_sdr_info():
+
+ r"""
+ Get IPMI sdr info data and return it as a dictionary.
+
+ The data is obtained by issuing the IPMI "sdr info" command. An
+ example is shown below:
+
+ SDR Version : 0x51
+ Record Count : 216
+ Free Space : unspecified
+ Most recent Addition :
+ Most recent Erase :
+ SDR overflow : no
+ SDR Repository Update Support : unspecified
+ Delete SDR supported : no
+ Partial Add SDR supported : no
+ Reserve SDR repository supported : no
+ SDR Repository Alloc info supported : no
+
+ For the data shown above, the following dictionary will be returned.
+ mc_info:
+
+ [sdr_version]: 0x51
+ [record_Count]: 216
+ [free_space]: unspecified
+ [most_recent_addition]:
+ [most_recent_erase]:
+ [sdr_overflow]: no
+ [sdr_repository_update_support]: unspecified
+ [delete_sdr_supported]: no
+ [partial_add_sdr_supported]: no
+ [reserve_sdr_repository_supported]: no
+ [sdr_repository_alloc_info_supported]: no
+ """
+
+ status, ret_values = \
+ grk.run_key_u("Run IPMI Standard Command sdr info")
+ result = vf.key_value_outbuf_to_dict(ret_values, process_indent=1)
+
+ return result
diff --git a/tests/ipmi/test_general_ipmi.robot b/tests/ipmi/test_general_ipmi.robot
index 9a0594d..7cf4294 100644
--- a/tests/ipmi/test_general_ipmi.robot
+++ b/tests/ipmi/test_general_ipmi.robot
@@ -466,8 +466,72 @@
Should Contain X Times ${mc_info['aux_firmware_rev_info']} 0x00 4
+Verify SDR Info
+ [Documentation] Verify sdr info command output.
+ [Tags] Verify_SDR_Info
+
+ # Example of SDR info command output:
+ # SDR Version : 0x51
+ # Record Count : 216
+ # Free Space : unspecified
+ # Most recent Addition :
+ # Most recent Erase :
+ # SDR overflow : no
+ # SDR Repository Update Support : unspecified
+ # Delete SDR supported : no
+ # Partial Add SDR supported : no
+ # Reserve SDR repository supported : no
+ # SDR Repository Alloc info supported : no
+
+ ${sdr_info}= Get SDR Info
+ Should Be Equal ${sdr_info['sdr_version']} 0x51
+
+ # Get sensor count from "sdr elist all" command output.
+ ${sensor_count}= Get Sensor Count
+ Should Be Equal As Strings
+ ... ${sdr_info['record_count']} ${sensor_count}
+
+ Should Be Equal ${sdr_info['free_space']} unspecified
+ Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
+ Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
+ Should Be Equal ${sdr_info['sdr_overflow']} no
+ Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
+ Should Be Equal ${sdr_info['delete_sdr_supported']} no
+ Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
+ Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
+ Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
+
+
*** Keywords ***
+Get Sensor Count
+ [Documentation] Get sensors count using "sdr elist all" command.
+
+ # Example of "sdr elist all" command output:
+ # BootProgress | 03h | ok | 34.2 |
+ # OperatingSystemS | 05h | ok | 35.1 |
+ # AttemptsLeft | 07h | ok | 34.1 |
+ # occ0 | 08h | ok | 210.1 | Device Disabled
+ # occ1 | 09h | ok | 210.2 | Device Disabled
+ # p0_core0_temp | 11h | ns | 3.1 | Disabled
+ # cpu0_core0 | 12h | ok | 208.1 | Presence detected
+ # p0_core1_temp | 14h | ns | 3.2 | Disabled
+ # cpu0_core1 | 15h | ok | 208.2 | Presence detected
+ # p0_core2_temp | 17h | ns | 3.3 | Disabled
+ # ..
+ # ..
+ # ..
+ # ..
+ # ..
+ # ..
+ # fan3 | 00h | ns | 29.4 | Logical FRU @35h
+ # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
+ # ethernet | 00h | ns | 1.1 | Logical FRU @46h
+
+ ${output}= Run IPMI Standard Command sdr elist all
+ ${sensor_list}= Split String ${output} \n
+ ${sensor_count}= Get Length ${sensor_list}
+ [Return] ${sensor_count}
Set Management Controller ID String
[Documentation] Set the management controller ID string.