Utility new keyword for event notification

Changes:
    - Remove the non-pingable IP of the destination from
      redfish event subscriptions.

Tested:
    - Ran test case from sandbox.

Change-Id: Icfb21434143b86d122ed6e4df76401e4d5b09802
Signed-off-by: srichn28 <srichn28@in.ibm.com>
diff --git a/lib/event_notification_utils.robot b/lib/event_notification_utils.robot
index d91f1c5..3bfe5a7 100644
--- a/lib/event_notification_utils.robot
+++ b/lib/event_notification_utils.robot
@@ -38,3 +38,18 @@
         ${server_ips}=  Combine Lists  ${server_ips}  ${dest_ip}
     END
     [Return]  ${server_ips}
+
+Delete Event Subscription Of Unpingable Destination IPs
+    [Documentation]  Delete event subscription with non-pinging destination IPs.
+
+    ${subscription_ids}=  Get Event Subscription IDs
+
+    FOR  ${id}  IN  @{subscription_ids}
+        ${destination}=  Redfish.Get Attribute  /redfish/v1/EventService/Subscriptions/${id}  Destination
+        ${dest_ip}=  Get Regexp Matches  ${destination}  .*://(.*):.*  1
+        ${status}=  Run Keyword And Return Status  Ping Host  ${dest_ip}[0]
+
+        IF  ${status} == False
+            Redfish.Delete   /redfish/v1/EventService/Subscriptions/${id}
+        END
+    END