BMC Dump:Verify error when previous dump is in progress

Changes:

       - Added testcase to verify error is shown with BMC dump
         attempt till earlier request completes.

Tested:

       - Ran ‘Verify BMC Dump Create Errors While Another BMC Dump In Progress'
         from sandbox successfully.

Change-Id: I39d2a50ef3d30a2e7baaecf983cc81db4ca30709
Signed-off-by: manashsarma <manashsarma@in.ibm.com>
diff --git a/redfish/managers/test_bmc_dumps.robot b/redfish/managers/test_bmc_dumps.robot
index 69ac142..d38c085 100644
--- a/redfish/managers/test_bmc_dumps.robot
+++ b/redfish/managers/test_bmc_dumps.robot
@@ -265,6 +265,33 @@
     ...  body=${payload}  valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}]
 
 
+Verify BMC Dump Create Errors While Another BMC Dump In Progress
+    [Documentation]  Verify BMC dump creation error until older BMC dump completion.
+    [Tags]  Verify_BMC_Dump_Create_Errors_While_Another_BMC_Dump_In_Progress
+
+    # Initiate a BMC dump that returns without completion.
+    ${task_id}=  Create User Initiated BMC Dump Via Redfish  ${1}
+
+    # Now continue to initiate multiple dump request which is not expected to be accepted
+    # till earlier BMC dump task is completed. A limit is set to avoid risk of infinite loop.
+    ${payload}=  Create Dictionary  DiagnosticDataType=Manager
+    WHILE  True  limit=1000
+        ${task_dict}=  Redfish.Get Properties  /redfish/v1/TaskService/Tasks/${task_id}
+        IF  '${task_dict['TaskState']}' == 'Completed'  BREAK
+        Redfish.Post
+        ...  /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
+        ...  body=${payload}  valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}]
+    END
+
+    # The next BMC dump initiation request should be accepted as earlier dump is completed.
+    ${resp}=  Redfish.Post
+    ...  /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
+    ...  body=${payload}  valid_status_codes=[${HTTP_ACCEPTED}]
+
+    # Wait for above initiated dump to complete. Otherwise, on going dump would impact next test.
+    Wait Until Keyword Succeeds  5 min  15 sec  Check Task Completion  ${resp.dict['Id']}
+
+
 *** Keywords ***
 
 Get BMC Dump Entries