Added Fix for BMC dump automation testcase

Changes:
       -  Added fix for 'Verify BMC Dump Create Errors While Another BMC Dump In Progress'.
          An extra check is added if the new dump initiation request is accepted,then
          earlier dump initiated must be completed.

Tested:
       - Ran the test case with fix from sandbox successfully.

Change-Id: I48e43f774df8d7385de7d69373c954a1fdb10895
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 66fe4dd..c20047c 100644
--- a/redfish/managers/test_bmc_dumps.robot
+++ b/redfish/managers/test_bmc_dumps.robot
@@ -324,9 +324,50 @@
     WHILE  True  limit=1000
         ${task_dict}=  Redfish.Get Properties  /redfish/v1/TaskService/Tasks/${task_id}
         IF  '${task_dict['TaskState']}' == 'Completed'  BREAK
-        Redfish.Post
+        ${resp}=  Redfish.Post
         ...  /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
-        ...  body=${payload}  valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}]
+        ...  body=${payload}  valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}, ${HTTP_ACCEPTED}]
+
+        # Sample response of above POST request:
+        # 503
+        # Strict-Transport-Security max-age=31536000; includeSubdomains; preload
+        # X-Frame-Options DENY
+        # Pragma no-cache
+        # Cache-Control no-Store,no-Cache
+        # X-XSS-Protection 1; mode=block
+        # X-Content-Type-Options nosniff
+        # Content-Security-Policy default-src 'none'; img-src 'self' data:; font-src 'self'; style-src
+        # 'self'; script-src 'self'; connect-src 'self' wss:; form-action 'none'; frame-ancestors 'none';
+        # object-src 'none'; base-uri 'none'
+        # Content-Type application/json
+        # Date Thu, 16 Mar 2023 06:41:06 GMT
+        # Content-Length 573
+        # {
+        # "error": {
+        # "@Message.ExtendedInfo": [
+        # {
+        # "@odata.type": "#Message.v1_1_1.Message",
+        # "Message": "The request could not be performed because the resource is in standby.",
+        # "MessageArgs": [],
+        # "MessageId": "Base.1.8.1.ResourceInStandby",
+        # "MessageSeverity": "Critical",
+        # "Resolution": "Ensure that the resource is in the correct power state and resubmit the request."
+        # }
+        # ],
+        # "code": "Base.1.8.1.ResourceInStandby",
+        # "message": "The request could not be performed because the resource is in standby."
+        # }
+        # }
+
+        # At this point the request HTTPS response should be HTTP_SERVICE_UNAVAILABLE. However, if the
+        # response contains the HTTPS response code HTTP_ACCEPTED, it means there is a dump initiation
+        # request which is completed. We verify this with below check.
+        ${resp}=  Convert To String  ${resp}
+        ${contains}=  Run Keyword And Return Status  Should Contain  ${resp.split()[0]}  ${HTTP_ACCEPTED}
+        IF  ${contains}
+           ${task_dict}=  Redfish.Get Properties  /redfish/v1/TaskService/Tasks/${task_id}
+           Should Be True  '${task_dict['TaskState']}' == 'Completed'
+        END
     END
 
     # The next BMC dump initiation request should be accepted as earlier dump is completed.