Delete all errorlog

Resolves openbmc/openbmc-test-automation#733

Change-Id: If1a0dd0362824dc35878c853af76e1181cccca72
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index 3ac9086..9e5b5ce 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -928,18 +928,20 @@
     [Return]  ${state.rsplit('.', 1)[1]}
 
 ###############################################################################
-Delete Error logs
+Delete Error Logs
     [Documentation]  Delete error logs.
 
-    # The REST method to delete error openbmc/openbmc#1327
-    # until then using logging restart.
-    Open Connection And Log In
-    Execute Command On BMC
-    ...  systemctl restart xyz.openbmc_project.Logging.service
-    Sleep  10s  reason=Wait for logging service to restart properly.
+    # Check if error logs entries exist, if not return.
+    ${resp}=  OpenBMC Get Request  /xyz/openbmc_project/logging/entry/list
+    Return From Keyword If  ${resp.status_code} == ${HTTP_NOT_FOUND}
+
+    # Get the list of error logs entries and delete them all.
+    ${elog_entries}=  Get URL List  /xyz/openbmc_project/logging/entry
+    :FOR  ${entry}  IN  @{elog_entries}
+    \  Delete Error Log Entry  ${entry}
 
 ###############################################################################
-Delete Error log Entry
+Delete Error Log Entry
     [Documentation]  Delete error log entry.
     [Arguments]  ${entry_path}