1*** Settings *** 2Documentation Test Redfish event service. 3 4Resource ../../../lib/resource.robot 5Resource ../../../lib/bmc_redfish_resource.robot 6Resource ../../../lib/openbmc_ffdc.robot 7Resource ../../../lib/bmc_redfish_utils.robot 8 9Test Setup Test Setup Execution 10Test Teardown Test Teardown Execution 11Suite Setup Suite Setup Execution 12Suite teardown Run Keyword And Ignore Error Delete All Redfish Sessions 13 14***Variables*** 15 16${REMOTE_SERVER_IP} 17 18** Test Cases ** 19 20Verify 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 28Verify 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} 39 ${RegistryPrefixes_list}= Create List Base OpenBMC TaskEvent 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 61Suite 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 68Test 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 79Test 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 86Delete 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 97