Test delete errorlog and callout association

Added the following test cases:
   1. Create a test error log with callout and delete it.
   2. Create two test error logs and delete one.
   3. Create Test Error Callout And Verify Device Path.

Resolves openbmc/openbmc-test-automation#586

Change-Id: Ic2b9cf0d705c6b8e54af3026651ea05125b8567d
Signed-off-by: Sweta Potthuri <spotthur@in.ibm.com>
diff --git a/tests/test_association.robot b/tests/test_association.robot
index 52b7011..4692527 100755
--- a/tests/test_association.robot
+++ b/tests/test_association.robot
@@ -10,9 +10,14 @@
 ...                 Boot Host  AND
 ...                 Clear Existing Error Logs
 Test Setup          Pre Test Case Execution
+Test Setup          Open Connection And Log In  AND
+...                 Delete Error logs
 Test Teardown       Close All Connections
 Suite Teardown      Clear Existing Error Logs
 
+***Variables***
+${target_device_path}  /sys/devices/platform/fsi-master/slave@00:00
+
 *** Test Cases ***
 
 Create Test Error Callout And Verify
@@ -22,6 +27,125 @@
     Create Test Error With Callout
     Verify Test Error Log And Callout
 
+Create Test Error Callout And Verify AdditionalData
+    [Documentation]  Create Test Error Callout And Verify AdditionalData.
+    [Tags]  Create_Test_Error_Callout_And_Verify_AdditionalData
+
+    # Test error log entry example:
+    #  "/xyz/openbmc_project/logging/entry/1": {
+    #  "AdditionalData": [
+    #      "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
+    #      "CALLOUT_ERRNO_TEST=0",
+    #      "DEV_ADDR=0x0DEADEAD"
+    #    ]
+
+    Create Test Error With Callout
+    ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}${1}
+    ${jsondata}=  To JSON  ${resp.content}
+    Should Contain  ${jsondata}["data"]["AdditionalData"]}  ${target_device_path}
+    Should Contain  ${jsondata}["data"]["AdditionalData"]}  0x0DEADEAD
+
+Create Test Error Callout And Delete
+    [Documentation]  Create Test Error Callout And Delete.
+    [Tags]  Create_Test_Error_Callout_And_Delete
+
+    # Test error log entry example:
+    #  "/xyz/openbmc_project/logging/entry/1": {
+    #  "AdditionalData": [
+    #      "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
+    #      "CALLOUT_ERRNO_TEST=0",
+    #      "DEV_ADDR=0x0DEADEAD"
+    #    ],
+    #    "Id": 1,
+    #    "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
+    #    "Resolved": 0,
+    #    "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
+    #    "Timestamp": 1487747332528,
+    #    "associations": [
+    #        [
+    #          "callout",
+    #          "fault",
+    #          "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
+    #        ]
+    #    ]
+    # },
+    # "/xyz/openbmc_project/logging/entry/1/callout": {
+    #    "endpoints": [
+    #        "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
+    #    ]
+    # },
+
+    Create Test Error With Callout
+    Delete Error Log Entry  ${BMC_LOGGING_ENTRY}${1}
+    ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}${1}/callout
+    Should Be Equal As Strings  ${resp.status_code}  ${HTTP_NOT_FOUND}
+
+Create Two Test Error Callout And Delete
+    [Documentation]  Create Two Test Error Callout And Delete.
+    [Tags]  Create_Two_Test_Error_Callout_And_Delete
+
+    # Test error log entry example:
+    #  "/xyz/openbmc_project/logging/entry/1": {
+    #  "AdditionalData": [
+    #      "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
+    #      "CALLOUT_ERRNO_TEST=0",
+    #      "DEV_ADDR=0x0DEADEAD"
+    #    ],
+    #    "Id": 1,
+    #    "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
+    #    "Resolved": 0,
+    #    "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
+    #    "Timestamp": 1487747332528,
+    #    "associations": [
+    #        [
+    #          "callout",
+    #          "fault",
+    #          "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
+    #        ]
+    #    ]
+    # },
+    # "/xyz/openbmc_project/logging/entry/1/callout": {
+    #    "endpoints": [
+    #        "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
+    #    ]
+    # },
+    # "/xyz/openbmc_project/logging/entry/2": {
+    #  "AdditionalData": [
+    #      "CALLOUT_DEVICE_PATH_TEST=/sys/devices/platform/fsi-master/slave@00:00",
+    #      "CALLOUT_ERRNO_TEST=0",
+    #      "DEV_ADDR=0x0DEADEAD"
+    #    ],
+    #    "Id": 2,
+    #    "Message": "example.xyz.openbmc_project.Example.Elog.TestCallout",
+    #    "Resolved": 0,
+    #    "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
+    #    "Timestamp": 1487747332528,
+    #    "associations": [
+    #        [
+    #          "callout",
+    #          "fault",
+    #          "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
+    #        ]
+    #    ]
+    # },
+    # "/xyz/openbmc_project/logging/entry/2/callout": {
+    #    "endpoints": [
+    #        "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
+    #    ]
+    # },
+
+    # Create two error logs.
+    Create Test Error With Callout
+    Create Test Error With Callout
+
+    # Delete entry/2 elog entry.
+    Delete Error Log Entry  ${BMC_LOGGING_ENTRY}${2}
+
+    # Verify if entry/1 exist and entry/2 is deleted.
+    ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}/list
+    ${jsondata}=  To JSON  ${resp.content}
+    Should Contain  ${jsondata["data"]}  ${BMC_LOGGING_ENTRY}${1}
+    Should Not Contain  ${jsondata["data"]}  ${BMC_LOGGING_ENTRY}${2}
 
 Create Test Error Callout And Verify LED
     [Documentation]  Create an error log callout and verify respective