Added New script for IPMI Cold Reset command

The Cold reset command directs the Responder to perform a ‘Cold Reset’ action, which causes default setting of interrupt enables, event message generation, sensor scanning, threshold values, and other ‘power up default’ state to be restored.

The script consist of 3 testcases:
-  Cold_Reset_Via_IPMI
-  Cold_Reset_With_Invalid_Data_Request_Via_IPMI
-  Verify_Cold_Reset_Impact_On_Sensor_Threshold_Via_IPMI

Request data for cold reset present in data/ipmi_raw_cmd_table.py

Python basic operations under file lib/ipmi_utils.py like threshold value calculation - 'Identify Threshold'  and under lib/utils.py for striping extra characters across the strings - 'Remove Whitespace' fucntion (check commit - https://gerrit.openbmc-project.xyz/c/openbmc/openbmc-test-automation/+/51641 for remove_whitespace function).

The script verifies command execution for cold reset, invalid data request verification of cold reset and impact on sensor threshold value change with cold reset.

The script changes sensor threshold value for Fan sensor, executes cold reset IPMI command, verifies sensor threshold values of initial and reading after cold reset.

Tested: Run robot ipmi/test_ipmi_cold_reset.robot

Signed-off-by: chithrag <chithrag@ami.com>
Change-Id: I116fad1fc8c8c9c7c3b1e4d6d26fc9a4412a5637
diff --git a/lib/ipmi_utils.py b/lib/ipmi_utils.py
index af5ee6d..16c50e3 100644
--- a/lib/ipmi_utils.py
+++ b/lib/ipmi_utils.py
@@ -759,3 +759,34 @@
         item = "0x" + item
         listy.append(item)
     return listy
+
+
+def identify_threshold(old_threshold, threshold_list):
+    r"""
+    Gets threshold values and threshold levels from sensor list.
+    Modify the values and returns updated threshold.
+    Description of argument(s):
+
+        old_threshold              List of thresold values of sensor,
+        threshold_list             List of higher and lower of critical and non-critical values.
+
+    For example :
+        If old_threshold list is [ 1, 2, 3, 4] then the newthreshold_list will be [ 101, 102, 103, 104 ].
+        If old_threshold has 'na' the same will be appended to new list.
+
+    The newthreshold_list will be zipped to dictionary with threshold_list levels,
+    Example : threshold_dict = { 'lcr': 101, 'lnc': 102, 'unc': 103, 'ucr': 104 }
+    """
+
+    n = 100
+    newthreshold_list = []
+    for th in old_threshold:
+        th = th.strip()
+        if th == 'na':
+            newthreshold_list.append('na')
+        else:
+            x = int(float(th)) + n
+            newthreshold_list.append(x)
+            n = n + 100
+    threshold_dict = dict(zip(threshold_list, newthreshold_list))
+    return newthreshold_list, threshold_dict