Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test Redfish event service. |
| 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 | |
| 9 | Test Setup Test Setup Execution |
| 10 | Test Teardown Test Teardown Execution |
| 11 | Suite Setup Suite Setup Execution |
| 12 | Suite teardown Run Keyword And Ignore Error Delete All Redfish Sessions |
| 13 | |
| 14 | ***Variables*** |
| 15 | |
| 16 | ${REMOTE_SERVER_IP} |
| 17 | |
| 18 | ** Test Cases ** |
| 19 | |
| 20 | Verify Event Service Available |
| 21 | [Documentation] Verify Redfish event service is available. |
| 22 | [Tags] Verify_Event_Service_Available |
| 23 | |
| 24 | ${resp} = Redfish_utils.Get Attribute /redfish/v1/EventService ServiceEnabled |
| 25 | Should Be Equal As Strings ${resp} ${True} |
| 26 | |
| 27 | |
| 28 | Verify Subscribe An Event |
| 29 | [Documentation] Subscribe to an event and verify. |
| 30 | [Tags] Verify_Subscribe_An_Event |
| 31 | |
| 32 | ${subscription_list}= Redfish_Utils.Get Member List |
| 33 | ... /redfish/v1/EventService/Subscriptions |
| 34 | |
| 35 | Should Be Empty ${subscription_list} |
| 36 | |
| 37 | ${HttpHeaders_dict}= Create Dictionary Content=application/json |
| 38 | ${HttpHeaders_list}= Create List ${HttpHeaders_dict} |
Tim Lee | 62acabc | 2021-06-15 17:04:59 +0800 | [diff] [blame] | 39 | ${RegistryPrefixes_list}= Create List Base OpenBMC TaskEvent |
Tony Lee | 78059b6 | 2021-02-24 17:11:09 +0800 | [diff] [blame] | 40 | ${ResourceTypes_list}= Create List Task |
| 41 | |
| 42 | ${payload}= Create Dictionary |
| 43 | ... Context=Test_Context Destination=https://${REMOTE_SERVER_IP}:${HTTPS_PORT}/ |
| 44 | ... EventFormatType=Event Protocol=Redfish HttpHeaders=${HttpHeaders_list} |
| 45 | ... SubscriptionType=RedfishEvent RegistryPrefixes=${RegistryPrefixes_list} |
| 46 | ... ResourceTypes=${ResourceTypes_list} |
| 47 | |
| 48 | Redfish.Post /redfish/v1/EventService/Subscriptions body=&{payload} |
| 49 | ... valid_status_codes=[${HTTP_CREATED}] |
| 50 | |
| 51 | ${subscription_list}= Redfish_Utils.Get Member List |
| 52 | ... /redfish/v1/EventService/Subscriptions |
| 53 | |
| 54 | ${resp}= redfish.Get ${subscription_list[0]} |
| 55 | |
| 56 | Dictionary Should Contain Sub Dictionary ${resp.dict} ${payload} |
| 57 | |
| 58 | |
| 59 | *** Keywords *** |
| 60 | |
| 61 | Suite Setup Execution |
| 62 | [Documentation] Do the suite setup. |
| 63 | |
| 64 | Should Not be Empty ${REMOTE_SERVER_IP} |
| 65 | Should Not be Empty ${HTTPS_PORT} |
| 66 | |
| 67 | |
| 68 | Test Setup Execution |
| 69 | [Documentation] Do the test setup. |
| 70 | |
| 71 | Redfish.Login |
| 72 | |
| 73 | ${subscription_list}= Redfish_Utils.Get Member List |
| 74 | ... /redfish/v1/EventService/Subscriptions |
| 75 | |
| 76 | Delete All Subscriptions ${subscription_list} |
| 77 | |
| 78 | |
| 79 | Test Teardown Execution |
| 80 | [Documentation] Do the post test teardown. |
| 81 | |
| 82 | FFDC On Test Case Fail |
| 83 | Run Keyword And Ignore Error Redfish.Logout |
| 84 | |
| 85 | |
| 86 | Delete All Subscriptions |
| 87 | [Documentation] Delete all subscriptions. |
| 88 | [Arguments] ${subscription_list} |
| 89 | |
| 90 | # Description of argument(s): |
| 91 | # subscription_list List of all subscriptions. |
| 92 | |
| 93 | FOR ${url} IN @{subscription_list} |
| 94 | Redfish.Delete ${url} |
| 95 | END |
| 96 | |