Fix to accommodate xyz's BMC dump path changes

BMC dump uri has changed from /xyz/openbmc_project/dump/entry/ to
/xyz/openbmc_project/dump/bmc/entry/. This change is to make dump
automation work on builds with or without this url changes.

Change-Id: I27b010d67f17efb88d60b673153fafa5a3b0565f
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/data/variables.py b/data/variables.py
index 30418eb..1cb5e28 100755
--- a/data/variables.py
+++ b/data/variables.py
@@ -98,7 +98,7 @@
 ALWAYS_POWER_OFF = CONTROL_DBUS_BASE + 'Power.RestorePolicy.Policy.AlwaysOff'
 
 # Dump URI variables.
-DUMP_URI = OPENBMC_BASE_URI + 'dump/'
+DUMP_URI = OPENBMC_BASE_URI + 'dump/bmc/'
 DUMP_ENTRY_URI = DUMP_URI + 'entry/'
 DUMP_DOWNLOAD_URI = "/download/dump/"
 # The path on the BMC where dumps are stored.
diff --git a/lib/dump_utils.robot b/lib/dump_utils.robot
index cb88423..19884fe 100644
--- a/lib/dump_utils.robot
+++ b/lib/dump_utils.robot
@@ -21,6 +21,10 @@
     #                      returned if out of dump space was
     #                      detected when creating the dump.
 
+    ${resp}=  OpenBMC Get Request  ${DUMP_URI}
+    Run Keyword If  '${resp.status_code}' == '${HTTP_NOT_FOUND}'
+    ...  Set Test Variable  ${DUMP_URI}  /xyz/openbmc_project/dump/
+
     ${data}=  Create Dictionary  data=@{EMPTY}
     ${resp}=  OpenBMC Post Request
     ...  ${DUMP_URI}action/CreateDump  data=${data}  quiet=${1}
@@ -108,6 +112,10 @@
     # dump_id  An integer value that identifies a particular dump
     #          object(e.g. 1, 3, 5).
 
+    ${resp}=  OpenBMC Get Request  ${DUMP_URI}
+    Run Keyword If  '${resp.status_code}' == '${HTTP_NOT_FOUND}'
+    ...  Set Test Variable  ${DUMP_ENTRY_URI}  /xyz/openbmc_project/dump/entry/
+
     ${resp}=  OpenBMC Get Request  ${DUMP_ENTRY_URI}${dump_id}
     Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK}
 
@@ -119,6 +127,10 @@
     # Description of Argument(s):
     # dump_id  An integer value that identifies a particular dump (e.g. 1, 3).
 
+    ${resp}=  OpenBMC Get Request  ${DUMP_URI}
+    Run Keyword If  '${resp.status_code}' == '${HTTP_NOT_FOUND}'
+    ...  Set Test Variable  ${DUMP_ENTRY_URI}  /xyz/openbmc_project/dump/entry/
+
     ${data}=  Create Dictionary  data=@{EMPTY}
     ${resp}=  OpenBMC Post Request
     ...  ${DUMP_ENTRY_URI}${dump_id}/action/Delete  data=${data}
@@ -128,6 +140,10 @@
 Delete All Dumps
     [Documentation]  Delete all dumps.
 
+    ${resp}=  OpenBMC Get Request  ${DUMP_URI}
+    Run Keyword If  '${resp.status_code}' == '${HTTP_NOT_FOUND}'
+    ...  Set Test Variable  ${DUMP_ENTRY_URI}  /xyz/openbmc_project/dump/entry/
+
     # Check if dump entries exist, if not return.
     ${resp}=  OpenBMC Get Request  ${DUMP_ENTRY_URI}list  quiet=${1}
     Return From Keyword If  ${resp.status_code} == ${HTTP_NOT_FOUND}
@@ -163,6 +179,10 @@
 Delete All BMC Dump
     [Documentation]  Delete all BMC dump entries using "DeleteAll" interface.
 
+    ${resp}=  OpenBMC Get Request  ${DUMP_URI}
+    Run Keyword If  '${resp.status_code}' == '${HTTP_NOT_FOUND}'
+    ...  Set Test Variable  ${DUMP_URI}  /xyz/openbmc_project/dump/
+
     ${data}=  Create Dictionary  data=@{EMPTY}
     ${resp}=  Openbmc Post Request  ${DUMP_URI}action/DeleteAll  data=${data}
     Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK}
@@ -170,6 +190,10 @@
 Dump Should Not Exist
     [Documentation]  Verify that BMC dumps do not exist.
 
+    ${resp}=  OpenBMC Get Request  ${DUMP_URI}
+    Run Keyword If  '${resp.status_code}' == '${HTTP_NOT_FOUND}'
+    ...  Set Test Variable  ${DUMP_ENTRY_URI}  /xyz/openbmc_project/dump/entry/
+
     ${resp}=  OpenBMC Get Request  ${DUMP_ENTRY_URI}list  quiet=${1}
     Should Be Equal As Strings  ${resp.status_code}  ${HTTP_NOT_FOUND}
 
@@ -193,6 +217,10 @@
 Get Dump Entries
     [Documentation]  Return dump entries list.
 
+    ${resp}=  OpenBMC Get Request  ${DUMP_URI}
+    Run Keyword If  '${resp.status_code}' == '${HTTP_NOT_FOUND}'
+    ...  Set Test Variable  ${DUMP_ENTRY_URI}  /xyz/openbmc_project/dump/entry/
+
     ${dump_entries}=  Get URL List  ${DUMP_ENTRY_URI}
     [Return]  ${dump_entries}
 
diff --git a/lib/openbmc_ffdc_methods.robot b/lib/openbmc_ffdc_methods.robot
index c5a0281..817ec06 100755
--- a/lib/openbmc_ffdc_methods.robot
+++ b/lib/openbmc_ffdc_methods.robot
@@ -507,6 +507,10 @@
     [Documentation]  Collect dumps from dump entry.
     [Arguments]  ${log_prefix_path}=${LOG_PREFIX}
 
+    ${resp}=  OpenBMC Get Request  ${DUMP_URI}
+    Run Keyword If  '${resp.status_code}' == '${HTTP_NOT_FOUND}'
+    ...  Set Test Variable  ${DUMP_ENTRY_URI}  /xyz/openbmc_project/dump/entry/
+
     ${data}=  Read Properties  ${DUMP_ENTRY_URI}enumerate  quiet=${1}  timeout=${30}
 
     # Grab the list of entries from dump/entry/
diff --git a/openpower/ras/ras_utils.robot b/openpower/ras/ras_utils.robot
index c6bab0f..f6dc00a 100755
--- a/openpower/ras/ras_utils.robot
+++ b/openpower/ras/ras_utils.robot
@@ -107,10 +107,19 @@
 
     Wait for OS
     Verify Error Log Entry  ${signature_desc}  ${log_prefix}
+
+    ${dump_service_status}  ${stderr}  ${rc}=  BMC Execute Command  systemctl status xyz.openbmc_project.Dump.Manager.service
+    Should Contain  ${dump_service_status}  Active: active (running)
+
+    ${resp}=  OpenBMC Get Request  ${DUMP_URI}
+    Run Keyword If  '${resp.status_code}' == '${HTTP_NOT_FOUND}'
+    ...  Set Test Variable  ${DUMP_ENTRY_URI}  /xyz/openbmc_project/dump/entry/
+
     Read Properties  ${DUMP_ENTRY_URI}list
     Delete All BMC Dump
     Verify And Clear Gard Records On HOST
 
+
 Fetch FIR Address Translation Value
     [Documentation]  Fetch FIR address translation value through HOST.
     [Arguments]  ${fir_address}  ${target_type}
diff --git a/redfish/extended/test_bmc_dump.robot b/redfish/extended/test_bmc_dump.robot
index 9d075a4..d1094cc 100644
--- a/redfish/extended/test_bmc_dump.robot
+++ b/redfish/extended/test_bmc_dump.robot
@@ -10,6 +10,7 @@
 Resource            ../../lib/state_manager.robot
 Library             ../../lib/bmc_ssh_utils.py
 
+Suite Setup         Suite Setup Execution
 Test Setup          Open Connection And Log In
 Test Teardown       Test Teardown Execution
 
@@ -248,6 +249,15 @@
 
 *** Keywords ***
 
+Suite Setup Execution
+    [Documentation]  Do initial suite setup tasks.
+
+    ${resp}=  OpenBMC Get Request  ${DUMP_URI}
+    Run Keyword If  '${resp.status_code}' == '${HTTP_NOT_FOUND}'
+    ...  Run Keywords  Set Suite Variable  ${DUMP_URI}  /xyz/openbmc_project/dump/  AND
+    ...  Set Suite Variable  ${DUMP_ENTRY_URI}  /xyz/openbmc_project/dump/entry/
+
+
 Test Teardown Execution
     [Documentation]  Do the post test teardown.
 
diff --git a/tests/test_xit.robot b/tests/test_xit.robot
index 5b06919..c60af1f 100644
--- a/tests/test_xit.robot
+++ b/tests/test_xit.robot
@@ -28,6 +28,10 @@
     [Documentation]  Verify no BMC dump exist.
     [Tags]  Verify_No_BMC_Dump_And_Application_Failures
 
+    ${resp}=  OpenBMC Get Request  ${DUMP_URI}
+    Run Keyword If  '${resp.status_code}' == '${HTTP_NOT_FOUND}'
+    ...  Set Test Variable  ${DUMP_ENTRY_URI}  /xyz/openbmc_project/dump/entry/
+
     ${resp}=  OpenBMC Get Request  ${DUMP_ENTRY_URI}list
     Should Be Equal As Strings  ${resp.status_code}  ${HTTP_NOT_FOUND}
     ...  msg=BMC dump(s) were not deleted as expected.