Added test cases for BMC core dump.

Testcases added:
    - Verify core dump size.

Resolves openbmc/openbmc-test-automation#920

Change-Id: I6ad832463ed3e52aa9f16a171e1db3dad2e5d98e
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/lib/dump_utils.robot b/lib/dump_utils.robot
index 8607195..23bf0dd 100644
--- a/lib/dump_utils.robot
+++ b/lib/dump_utils.robot
@@ -1,6 +1,7 @@
 *** Settings ***
 Documentation  This module provides general keywords for dump.
 
+Library         bmc_ssh_utils.py
 
 *** Variables ***
 
@@ -109,3 +110,22 @@
     ${file_there}  ${stderr}  ${rc}=  BMC Execute Command
     ...  ${dump_check_cmd}/${dump_id}
     Should End With  ${file_there}  tar.xz  msg=BMC dump file not found.
+
+Get Dump Entries
+    [Documentation]  Return dump entries list.
+
+    ${dump_entries}=  Get URL List  ${DUMP_ENTRY_URI}
+    [Return]  ${dump_entries}
+
+
+Trigger Core Dump
+    [Documentation]  Trigger core dump.
+
+    # Find the pid of the active ipmid and kill it.
+    ${cmd_buf}=  Catenate  kill -s SEGV $(ps -ef | egrep ' ipmid$' |
+    ...  egrep -v grep | \ cut -c1-6)
+
+    ${cmd_output}  ${stderr}  ${rc}=  BMC Execute Command  ${cmd_buf}
+    Should Be Empty  ${stderr}  msg=BMC execute command error.
+    Should Be Equal As Integers  ${rc}  ${0}
+    ...  msg=BMC execute command return code is not zero.
diff --git a/tests/test_bmc_dump.robot b/tests/test_bmc_dump.robot
index 7204d50..a8958ae 100644
--- a/tests/test_bmc_dump.robot
+++ b/tests/test_bmc_dump.robot
@@ -129,6 +129,21 @@
     Create User Initiated Dump
 
 
+Verify Core Dump Size
+    [Documentation]  Verify BMC core dump size is under 200k.
+    [Tags]  Verify_Core_Dump_Size
+
+    Delete All Dumps
+    Trigger Core Dump
+    Wait Until Keyword Succeeds  1 min  10 sec  Get Dump Entries
+
+    ${dump_entries}=  Get URL List  ${DUMP_ENTRY_URI}
+    ${dump_size}=  Read Attribute  ${dump_entries[0]}  Size
+
+    # Max size for dump is 200k = 200x1024
+    Should Be True  0 < ${dump_size} < 204800  msg=Size of dump is incorrect.
+
+
 Post Dump BMC Performance Test
     [Documentation]  Check performance of memory, CPU & file system of BMC.
     [Tags]  Post_Dump_BMC_Performance_Test
@@ -142,6 +157,7 @@
 
     Check For Core Dumps
 
+
 *** Keywords ***
 
 Test Teardown Execution