IPMI: Device ID Script Fix
Changes:
- Created python function to get major version and minor version in list from cat /etc/os-release command
- Sometimes in cat /etc/os-release command aux version will not present.
- Hence handled code to validate auxillary version from ipmi response against aux version from "/usr/share/ipmi-providers/dev_id.json" file
Tested:
- Ran ipmi/test_ipmi_device_id.robot Successfully
Change-Id: I73dae3459fd1d160761eeb2918451198612b8c31
Signed-off-by: ganesanb <ganesanb@ami.com>
diff --git a/lib/utils.py b/lib/utils.py
index d19f840..ee167de 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -492,3 +492,16 @@
"""
return re.sub("`-|\\|-", "", uri)
+
+
+def get_bmc_major_minor_version(version):
+ r"""
+ returns major version and minor version
+ from cat /etc/os-release command.
+ For example,
+ xyz23.01 --> [23, 01]
+ xyz.0-112 --> [0, 112]
+ ZERzzYY-23.04-1-xx3 --> [23, 04, 1, 3]
+ """
+
+ return re.findall(r"\d+", re.sub("[A-Z]|[a-z]", "", version))