1*** 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
28Get 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}
41