Add new SEL test cases

Changes:
    - Added validation for Reserver ID, Most Recent Timestamps,
      Clear SEL and modifications in Add SEL Entry and Reserver ID

Testcases Modified:
          - Verify Reserve SEL
New Testcases:
          - Verify Add SEL Entry For Any Random Sensor
          - Verify IPMI SEL Most Recent Addition Timestamp
          - Verify IPMI SEL Most Recent Erase Timestamp
          - Verify Clear SEL With Invalid Reservation ID
          - Verify Reservation ID Erasure Status
          - Verify Clear SEL After Cold Reset

Verify Add SEL Entry For Any Random Sensor
    - Modified with create SEL by sensor number and type taken i
      from sensor list and sdr get. Verified the result with sel elist last 1

Verify Reserve SEL
    - Added condition to check if the sel entry is empty.

Verify IPMI SEL Most Recent Addition Timestamp
     - Gets Most Recent Addition Timestamp from IPMI Sel Info raw command
       and validate against sel entry date. If no sel entry present, newi
       sel entry will be created and validates the SEL date againt IPMI
       Sel Most Recent Addition Timestamp.

Verify IPMI SEL Most Recent Erase Timestamp
     - Clears the SEL and  validates Most Recent Erase Timestamp from SEL
       Info against bmc current time. Also verifies if Most Recent Addition
       Timestamp is not available.

Verify Clear SEL With Invalid Reservation ID
     - Creates two reservation id, stores first reservation id created and
       tries to clear sel with stored reservation id. Once a new reservationi
       id is created, previous reservation id generated will no longer be valid.

Verify Reservation ID Erasure Status
     - Creates a reservation id, clears the sel using the reservation id created,
       generate a new reservation id, check the erasure status using new reservation id

Verify Clear SEL After Cold Reset
     - Creates a new reservation id, runs cold reset from lanplus, once bmc is booted,
       checks whether the generated reservation id is accessible.

Tested: Run robot ipmi/test_ipmi_sel.robot

Signed-off-by: chithrag <chithrag@ami.com>
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
Change-Id: I3cd71447debaa6ddca05a9d7613e369bea6514b6
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/ipmi_client.robot b/lib/ipmi_client.robot
index bfed034..d6b944c 100755
--- a/lib/ipmi_client.robot
+++ b/lib/ipmi_client.robot
@@ -457,6 +457,8 @@
     ${resp}=  Run IPMI Command
     ...  ${IPMI_RAW_CMD['SEL_entry']['Create_SEL'][0]} 0x${sensor_type} 0x${sensor_number} ${IPMI_RAW_CMD['SEL_entry']['Create_SEL'][1]}
 
+    Should Not Contain  ${resp}  00 00  msg=SEL not created.
+
     [Return]  ${resp}
 
 
@@ -536,3 +538,24 @@
     ${date}=  Convert Date  ${date}  date_format=%b %d %H:%M:%S %Y  result_format=%m/%d/%Y %H:%M:%S  exclude_millis=True
 
     [Return]   ${date}
+
+
+Get SEL Info Via IPMI
+    [Documentation]  Get the SEL Info via IPMI raw command
+
+    # Get SEL Info response consist of 14 bytes of hexadecimal data.
+
+    # Byte 1 - SEL Version,
+    # Byte 2 & 3 - Entry bytes - LSB MSB,
+    # Byte 4 & 5 - Free Space in bytes, LS Byte first.
+    # Byte 6 - 9 - Most recent addition timestamp,
+    # Byte 10-13 - Most recent erase timestamp,
+    # Byte 14 - Operation Support
+
+    # Example: ${resp} will be "51 XX XX XX XX ff ff ff ff ff ff ff ff XX"
+
+    ${resp}=  Run IPMI Standard Command
+    ...  raw ${IPMI_RAW_CMD['SEL_entry']['SEL_info'][0]}
+    ${resp}=  Split String  ${resp}
+
+    [Return]  ${resp}