blob: 3bfe5a7ad76df8a7ef4471aa6ebe957da36d9e68 [file] [log] [blame]
Anusha Dathatri062cba22022-07-28 09:30:08 -05001*** Settings ***
2
3Documentation Resource file for event notification subscription.
4
5*** Keywords ***
6
7Delete All Event Subscriptions
8 [Documentation] Delete all event subscriptions.
9
10 ${subscriptions}= Redfish.Get Attribute /redfish/v1/EventService/Subscriptions Members
11 Return From Keyword If ${subscriptions} is None
12 FOR ${subscription} IN @{subscriptions}
13 Redfish.Delete ${subscription['@odata.id']}
14 END
15
16Get Event Subscription IDs
17 [Documentation] Get event subscription IDs.
18
19 ${subscription_ids}= Create List
20 ${subscriptions}= Redfish.Get Attribute /redfish/v1/EventService/Subscriptions Members
21 Log ${subscriptions}
22 FOR ${subscription} IN @{subscriptions}
23 Append To List ${subscription_ids}
24 ... ${subscription['@odata.id'].split("/redfish/v1/EventService/Subscriptions/")[-1]}
25 END
26 [Return] ${subscription_ids}
27
Anusha Dathatrid1c5fb12023-11-24 08:00:01 -060028Get Destination IPs Of Event Subscriptions
29 [Documentation] Get all subscribed server IPs as a list from event subscriptions.
30
31 ${subscription_ids}= Get Event Subscription IDs
32
33 ${server_ips}= Create List
34 FOR ${id} IN @{subscription_ids}
35 ${destination}= Redfish.Get Attribute /redfish/v1/EventService/Subscriptions/${id} Destination
36 # E.g. https://xx.xx.xx.xx:xxxx/redfish/events
37 ${dest_ip}= Get Regexp Matches ${destination} .*://(.*):.* 1
38 ${server_ips}= Combine Lists ${server_ips} ${dest_ip}
39 END
40 [Return] ${server_ips}
srichn28f854f8b2024-03-12 07:32:19 -050041
42Delete Event Subscription Of Unpingable Destination IPs
43 [Documentation] Delete event subscription with non-pinging destination IPs.
44
45 ${subscription_ids}= Get Event Subscription IDs
46
47 FOR ${id} IN @{subscription_ids}
48 ${destination}= Redfish.Get Attribute /redfish/v1/EventService/Subscriptions/${id} Destination
49 ${dest_ip}= Get Regexp Matches ${destination} .*://(.*):.* 1
50 ${status}= Run Keyword And Return Status Ping Host ${dest_ip}[0]
51
52 IF ${status} == False
53 Redfish.Delete /redfish/v1/EventService/Subscriptions/${id}
54 END
55 END