Changes in ipmi/test_ipmi_fru_device.robot

Added Following Test Case

	- Read Fru Device configuration
	- Verify Get FRU Inventory Area Info
	- Verify Get FRU Inventory Area Info For Invalid Device Data
	- Verify Get FRU Inventory Area Info For Invalid Data Request
	- Verify IPMI Write FRU Data
	- Verify IPMI Write FRU Data With BMC Reboot

Functions required are defined under lib/bmc_dbus.robot, lib/ipmi_client.robot and lib/utils.py

Request data for fru data present in data/ipmi_raw_cmd_table.py.

Read Fru Device configuration - Validates each ipmi fru device data with corresponding dbus data.

Verify Get FRU Inventory Area Info - Validates fru inventory byte size with ipmi read fru count returned.

Verify Get FRU Inventory Area Info For Invalid Device Data - Validates the response of inventory fru area info command with invalid device id.

Verify Get FRU Inventory Area Info For Invalid Data Request - Validates the response of inventory fru area info command with invalid request data by giving extra bytes.

Verify IPMI Write FRU Data - Verify write fru data with the response returned with read fru data after data is written.

Verify IPMI Write FRU Data With BMC Reboot -  Verify the response of read fru data after the bmc is rebooted once the data is written to the fru device.

Signed-off-by: ganesanb <ganesanb@ami.com>
Change-Id: I2ea51ad51512ecbcc4036e2d2593cafaa40a2d3c
diff --git a/lib/ipmi_client.robot b/lib/ipmi_client.robot
index 5fdd39d..cf2a24a 100755
--- a/lib/ipmi_client.robot
+++ b/lib/ipmi_client.robot
@@ -612,4 +612,35 @@
 
     ${resp}=  Run External IPMI Raw Command  ${ipmi_cmd}  fail_on_err=0
 
-    Should Contain  ${resp}  rsp=${error_code}
\ No newline at end of file
+    Should Contain  ${resp}  rsp=${error_code}
+
+
+Identify Request Data
+    [Documentation]  Convert text from variable declared to request data.
+    [Arguments]  ${string}
+
+    # Convert string to hexadecimal data for each character.
+    # Return the hex data with prefix of 0x as string and list of hex data.
+    # Description of argument(s):
+    #    string             Any string to be converted to hex.
+
+    # Given a string, convert to hexadecimal and prefix with 0x
+    ${hex1}=  Create List
+    ${hex2}=  Create List
+    ${resp_data}=  Split String With Index  ${string}  1
+    FOR  ${data}  IN  @{resp_data}
+        # prefixes 0x by default
+        ${hex_value}=  Evaluate  hex(ord("${data}"))
+        # prefixes string with bytes prefixed 0x by default
+        Append To List  ${hex1}  ${hex_value}
+        # provides only hexadecimal bytes
+        ${hex}=  Evaluate  hex(ord("${data}"))[2:]
+        # provides string with only hexadecimal bytes
+        Append To List  ${hex2}  ${hex}
+    END
+    ${hex1}=  Evaluate  " ".join(${hex1})
+
+    # ${hex1} will contains the data to write for fru in list.
+    # ${hex2} will contains the data to verify fru after write operation completed.
+
+    [Return]  ${hex1}  ${hex2}
\ No newline at end of file