IPMI: Added the logic to extract oem record count from sdr elist
Changes:
- In test_ipmi_sdr.robot under "Verify SDR Info" added new keyword
Fetch Sdr Type to extract the oem record count from sdr elist.
New keyword logic has been added in lib/ipmi_util.py
Tested:
- Ran ipmi/test_ipmi_sdr.robot script Successfully
Change-Id: I466e353c1224590fddc6175fa3c7dfe9ebbe5a2b
Signed-off-by: manimozhik <manimozhik@ami.com>
diff --git a/lib/ipmi_utils.py b/lib/ipmi_utils.py
index 5d1598c..34fd701 100644
--- a/lib/ipmi_utils.py
+++ b/lib/ipmi_utils.py
@@ -353,6 +353,32 @@
return result
+def fetch_sdr_count(sdr_data):
+ r"""
+ Get IPMI SDR list and return the SDR OEM count.
+
+ The data is obtained by issuing the IPMI "sdr elist -vvv" command. An
+ example is shown below:
+
+ SDR record ID : 0x00cb
+ SDR record ID : 0x00cc
+ SDR record type : 0xc0
+ SDR record next : 0xffff
+ SDR record bytes: 11
+ Getting 11 bytes from SDR at offset 5
+
+ For the data shown above, the SDR record type with 0xc0 count will be returned.
+ """
+
+ data = sdr_data.split("\n")
+ sdr_list = []
+ for i, j in enumerate(data):
+ a = j.split(":")
+ if a[0].strip() == "SDR record type":
+ sdr_list.append(a[1].strip())
+ return sdr_list.count("0xc0")
+
+
def get_aux_version(version_id):
r"""
Get IPMI Aux version info data and return it.