Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 1 | *** Settings *** |
George Keishing | ba86864 | 2022-02-17 05:41:40 -0600 | [diff] [blame] | 2 | Documentation Test Redfish event service subscription function. |
Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 3 | |
| 4 | Resource ../../../lib/resource.robot |
| 5 | Resource ../../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../../lib/openbmc_ffdc.robot |
| 7 | Resource ../../../lib/bmc_redfish_utils.robot |
| 8 | |
George Keishing | ba86864 | 2022-02-17 05:41:40 -0600 | [diff] [blame] | 9 | Suite Setup Suite Setup Execution |
| 10 | Suite teardown Suite Teardown Execution |
| 11 | |
Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 12 | Test Setup Test Setup Execution |
| 13 | Test Teardown Test Teardown Execution |
Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 14 | |
| 15 | ***Variables*** |
| 16 | |
George Keishing | ba86864 | 2022-02-17 05:41:40 -0600 | [diff] [blame] | 17 | # override this default using -v REMOTE_SERVER_IP:<IP> from CLI |
| 18 | ${REMOTE_SERVER_IP} 10.7.7.7 |
Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 19 | |
| 20 | ** Test Cases ** |
| 21 | |
George Keishing | ba86864 | 2022-02-17 05:41:40 -0600 | [diff] [blame] | 22 | Verify Add Subscribe Server For Event Notification |
| 23 | [Documentation] Subscribe a remote server and verify if added successful. |
| 24 | [Tags] Verify_Add_Subscribe_Server_For_Event_Notification |
Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 25 | |
| 26 | ${subscription_list}= Redfish_Utils.Get Member List |
| 27 | ... /redfish/v1/EventService/Subscriptions |
| 28 | |
| 29 | Should Be Empty ${subscription_list} |
| 30 | |
Tim Lee | 62acabc | 2021-06-15 17:04:59 +0800 | [diff] [blame] | 31 | ${RegistryPrefixes_list}= Create List Base OpenBMC TaskEvent |
Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 32 | ${ResourceTypes_list}= Create List Task |
| 33 | |
| 34 | ${payload}= Create Dictionary |
| 35 | ... Context=Test_Context Destination=https://${REMOTE_SERVER_IP}:${HTTPS_PORT}/ |
Tim Lee | 380880d | 2021-12-09 10:21:15 +0800 | [diff] [blame] | 36 | ... EventFormatType=Event Protocol=Redfish SubscriptionType=RedfishEvent |
| 37 | ... RegistryPrefixes=${RegistryPrefixes_list} ResourceTypes=${ResourceTypes_list} |
Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 38 | |
| 39 | Redfish.Post /redfish/v1/EventService/Subscriptions body=&{payload} |
| 40 | ... valid_status_codes=[${HTTP_CREATED}] |
| 41 | |
| 42 | ${subscription_list}= Redfish_Utils.Get Member List |
| 43 | ... /redfish/v1/EventService/Subscriptions |
| 44 | |
| 45 | ${resp}= redfish.Get ${subscription_list[0]} |
| 46 | |
| 47 | Dictionary Should Contain Sub Dictionary ${resp.dict} ${payload} |
| 48 | |
| 49 | |
| 50 | *** Keywords *** |
| 51 | |
| 52 | Suite Setup Execution |
| 53 | [Documentation] Do the suite setup. |
| 54 | |
| 55 | Should Not be Empty ${REMOTE_SERVER_IP} |
| 56 | Should Not be Empty ${HTTPS_PORT} |
| 57 | |
George Keishing | ba86864 | 2022-02-17 05:41:40 -0600 | [diff] [blame] | 58 | Redfish.Login |
| 59 | |
| 60 | |
| 61 | Suite Teardown Execution |
| 62 | [Documentation] Do the suite teardown. |
| 63 | |
| 64 | Run Keyword And Ignore Error Delete All Redfish Sessions |
| 65 | Run Keyword And Ignore Error Redfish.Logout |
| 66 | |
Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 67 | |
| 68 | Test Setup Execution |
| 69 | [Documentation] Do the test setup. |
| 70 | |
Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 71 | ${subscription_list}= Redfish_Utils.Get Member List |
| 72 | ... /redfish/v1/EventService/Subscriptions |
| 73 | |
| 74 | Delete All Subscriptions ${subscription_list} |
| 75 | |
George Keishing | ba86864 | 2022-02-17 05:41:40 -0600 | [diff] [blame] | 76 | # Verify Redfish event service attribute ServiceEnabled is set to True. |
| 77 | ${resp} = Redfish_utils.Get Attribute /redfish/v1/EventService ServiceEnabled |
| 78 | Should Be Equal As Strings ${resp} ${True} |
| 79 | |
Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 80 | |
| 81 | Test Teardown Execution |
| 82 | [Documentation] Do the post test teardown. |
| 83 | |
| 84 | FFDC On Test Case Fail |
George Keishing | ba86864 | 2022-02-17 05:41:40 -0600 | [diff] [blame] | 85 | |
| 86 | ${subscription_list}= Redfish_Utils.Get Member List |
| 87 | ... /redfish/v1/EventService/Subscriptions |
| 88 | |
| 89 | Delete All Subscriptions ${subscription_list} |
Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 90 | |
| 91 | |
| 92 | Delete All Subscriptions |
| 93 | [Documentation] Delete all subscriptions. |
| 94 | [Arguments] ${subscription_list} |
| 95 | |
| 96 | # Description of argument(s): |
| 97 | # subscription_list List of all subscriptions. |
| 98 | |
| 99 | FOR ${url} IN @{subscription_list} |
| 100 | Redfish.Delete ${url} |
| 101 | END |
| 102 | |