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