New logging library support

Due to mutliple logs being created, there is a need for test
to be able to find the log it created for validation. This can
also be extended for more generic usage ahead.

Resolves  openbmc/openbmc-test-automation#1099

Change-Id: Ic0e261adfc03f9cf704951db3cc5ea4cfe50f69c
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/logging_utils.robot b/lib/logging_utils.robot
new file mode 100644
index 0000000..11eeb18
--- /dev/null
+++ b/lib/logging_utils.robot
@@ -0,0 +1,44 @@
+*** Settings ***
+Documentation    Error logging utility keywords.
+
+Resource        rest_client.robot
+Variables       ../data/variables.py
+
+*** Keywords ***
+
+Get Logging Entry List
+    [Documentation]  Get logging entry and return the object list.
+
+    ${entry_list}=  Create List
+    ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}list  quiet=${1}
+    Return From Keyword If  ${resp.status_code} == ${HTTP_NOT_FOUND}
+    ${jsondata}=  To JSON  ${resp.content}
+
+    :FOR  ${entry}  IN  @{jsondata["data"]}
+    \  Continue For Loop If  '${entry.rsplit('/', 1)[1]}' == 'callout'
+    \  Append To List  ${entry_list}  ${entry}
+
+    # Logging entries list.
+    # ['/xyz/openbmc_project/logging/entry/14',
+    #  '/xyz/openbmc_project/logging/entry/15']
+    [Return]  ${entry_list}
+
+
+Logging Entry Should Exist
+    [Documentation]  Find the matching message id and return the entry id.
+    [Arguments]  ${message_id}
+
+    # Description of argument(s):
+    # message_id    Logging message string.
+    #               Example: "xyz.openbmc_project.Common.Error.InternalFailure"
+
+    ${elog_entries}=  Get Logging Entry List
+
+    :FOR  ${entry}  IN  @{elog_entries}
+    \  ${resp}=  Read Properties  ${entry}
+    \  ${status}=  Run Keyword And Return Status
+    ...  Should Be Equal As Strings  ${message_id}  ${resp["Message"]}
+    \  Return From Keyword If  ${status} == ${TRUE}  ${entry}
+
+    Fail  No ${message_id} logging entry found.
+