Anusha Dathatri | 062cba2 | 2022-07-28 09:30:08 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Resource file for event notification subscription. |
| 4 | |
| 5 | *** Keywords *** |
| 6 | |
| 7 | Delete 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 | |
| 16 | Get 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 Dathatri | d1c5fb1 | 2023-11-24 08:00:01 -0600 | [diff] [blame] | 28 | Get 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} |
srichn28 | f854f8b | 2024-03-12 07:32:19 -0500 | [diff] [blame] | 41 | |
| 42 | Delete 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 |