Back port BMC Max dump and watchdog dump use case

Change-Id: I962b2fe364bcdbc65836c4ac9218b4c4ea08979a
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tests/test_bmc_dump.robot b/tests/test_bmc_dump.robot
index 9478e2c..82fc163 100644
--- a/tests/test_bmc_dump.robot
+++ b/tests/test_bmc_dump.robot
@@ -125,7 +125,7 @@
     ...  verify dump entry for it.
     [Tags]  Verify_User_Initiated_BMC_Dump_When_Host_Booted
 
-    REST Power On  stack_mode=skip  quiet=1
+    REST Power On  stack_mode=skip
     Create User Initiated Dump
 
 
@@ -144,6 +144,33 @@
     Should Be True  0 < ${dump_size} < 204800  msg=Size of dump is incorrect.
 
 
+Dump Out Of Space Test
+    [Documentation]  Verify out of dump space is reported when attempt
+    ...  to create too many dumps.
+    [Tags]  Dump_Out_Of_Space_Test
+
+    # Systems typically hold 8-14 dumps before running out of dump space.
+    # Attempt to create too_many_dumps.  Expect to run out of space
+    # before this.
+    ${too_many_dumps}  Set Variable  ${100}
+
+    # Should be able to create at least this many dumps.
+    ${minimum_number_of_dumps}   Set Variable  ${7}
+
+    # Loop, creating a dump each iteration.  Will either get dump_id or
+    # will get EMPTY when out of dump space.
+    :FOR  ${n}  IN RANGE  ${too_many_dumps}
+    \  ${dump_id}=  Create User Initiated Dump  check_out_of_space=${True}
+    \  Exit For Loop If  '${dump_id}' == '${EMPTY}'
+    \  Check Existence of BMC Dump file  ${dump_id}
+
+    Run Keyword If  '${dump_id}' != '${EMPTY}'  Fail
+    ...  msg=Did not run out of dump space as expected.
+
+    Run Keyword If  ${n} < ${minimum_number_of_dumps}  Fail
+    ...  msg=Insufficient space for at least ${minimum_number_of_dumps} dumps.
+
+
 Post Dump BMC Performance Test
     [Documentation]  Check performance of memory, CPU & file system of BMC.
     [Tags]  Post_Dump_BMC_Performance_Test
@@ -151,6 +178,7 @@
     Open Connection And Log In
     Check BMC Performance
 
+
 Post Dump Core Dump Check
     [Documentation]  Check core dump existence on BMC after code update.
     [Tags]  Post_Dump_Core_Dump_Check
@@ -158,12 +186,44 @@
     Check For Core Dumps
 
 
+Verify Dump After Host Watchdog Error Injection
+    [Documentation]  Inject host watchdog error and verify whether dump is generated.
+    [Tags]  Verify_Dump_After_Host_Watchdog_Error_Injection
+
+    REST Power On
+
+    Run Keyword And Ignore Error  Delete All Dumps
+
+    # Enable auto reboot
+    Set Auto Reboot  ${1}
+
+    Trigger Host Watchdog Error  2000  30
+
+    Wait Until Keyword Succeeds  300 sec  20 sec  Is Host Rebooted
+
+    #Get dump details
+    @{dump_entry_list}=  Read Properties  ${DUMP_ENTRY_URI}
+
+    # Verifing that there is only one dump
+    ${length}=  Get length  ${dump_entry_list}
+    Should Be Equal As Integers  ${length}  ${1}
+
+    # Get dump id
+    ${value}=  Get From List  ${dump_entry_list}  0
+    @{split_value}=  Split String  ${value}  /
+    ${dump_id}=  Get From List  ${split_value}  -1
+
+    # Max size for dump is 200k = 200x1024
+    ${dump_size}=  Read Attribute  ${DUMP_ENTRY_URI}${dump_id}  Size
+    Should Be True  0 < ${dump_size} < 204800
+
+
 *** Keywords ***
 
 Test Teardown Execution
     [Documentation]  Do the post test teardown.
 
     Wait Until Keyword Succeeds  3 min  15 sec  Verify No Dump In Progress
-    FFDC On Test Case Fail
+    #FFDC On Test Case Fail
     Delete All BMC Dump
     Close All Connections