summaryrefslogtreecommitdiff
path: root/redfish-core/include/event_service_manager.hpp
AgeCommit message (Collapse)AuthorFilesLines
2021-06-30Add DateTime & Offset in Managers & LogServicesTejas Patil1-10/+11
This commit adds the support for "DateTimeLocalOffset" property under "/redfish/v1/Managers/bmc/" Redfish URI. And it also adds the support for "DateTime" & "DateTimeLocalOffset" properties under "/redfish/v1/Systems/system/LogServices/<id>/" & "/redfish/v1/Managers/bmc/LogServices/<id>/" Redfish URI's. These properties shows the current Date, Time & the UTC offset that the current DateTime property value contains. Tested: - Redfish Validator Test passed. curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X GET https://${bmc}/redfish/v1/Managers/bmc/ { "@odata.id": "/redfish/v1/Managers/bmc", "@odata.type": "#Manager.v1_11_0.Manager", "Actions": { "#Manager.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Managers/bmc/ResetActionInfo", "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset" }, "#Manager.ResetToDefaults": { "ResetType@Redfish.AllowableValues": [ "ResetAll" ], "target": "/redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults" } }, "DateTime": "2021-06-04T12:18:28+00:00", "DateTimeLocalOffset": "+00:00", "Description": "Baseboard Management Controller", "EthernetInterfaces": { "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces" }, "FirmwareVersion": "2.11.0-dev-114-gc1989599d", "GraphicalConsole": { "ConnectTypesSupported": [ "KVMIP" ], "MaxConcurrentSessions": 4, "ServiceEnabled": true }, "Id": "bmc", "LastResetTime": "2021-06-04T12:07:02+00:00", "Links": { "ActiveSoftwareImage": { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/419c86fb" }, "ManagerForServers": [ { "@odata.id": "/redfish/v1/Systems/system" } ], "ManagerForServers@odata.count": 1, "SoftwareImages": [ { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/419c86fb" } ], "SoftwareImages@odata.count": 1 }, "LogServices": { "@odata.id": "/redfish/v1/Managers/bmc/LogServices" }, "ManagerType": "BMC", "Model": "OpenBmc", "Name": "OpenBmc Manager", "NetworkProtocol": { "@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol" }, "Oem": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem", "@odata.type": "#OemManager.Oem", "OpenBmc": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc", "@odata.type": "#OemManager.OpenBmc", "Certificates": { "@odata.id": "/redfish/v1/Managers/bmc/Truststore/Certificates" } } }, "PowerState": "On", "SerialConsole": { "ConnectTypesSupported": [ "IPMI", "SSH" ], "MaxConcurrentSessions": 15, "ServiceEnabled": true }, "ServiceEntryPointUUID": "1832ebbb-0b54-44e9-90d7-b49108f6863c", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "UUID": "7fe3d13d-4ae7-4a4f-add1-2d60308124b4" } curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X GET https://${bmc}/redfish/v1/Systems/system/LogServices/EventLog/ { "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog", "@odata.type": "#LogService.v1_1_0.LogService", "Actions": { "#LogService.ClearLog": { "target": "/redfish/v1/Systems/system/LogServices/EventLog/Actions/LogService.ClearLog" } }, "DateTime": "2021-06-04T12:11:10+00:00", "DateTimeLocalOffset": "+00:00", "Description": "System Event Log Service", "Entries": { "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries" }, "Id": "EventLog", "Name": "Event Log Service", "OverWritePolicy": "WrapsWhenFull" } Signed-off-by: Tejas Patil <tejaspp@ami.com> Change-Id: I416d13ae11e236cf4552f817a9bd69b48f9b5afb
2021-06-09Remove the Node classEd Tanous1-1/+0
Fixes #181 Lots of specific details around why the node class have been removed are in the previous patchsets. This commit actually does the deed and makes it go away entirely. Now that this is finally done, we can compare binary size. Surprisingly enough, this series saves a full 72KB of compressed binary size, which amounts to about 6.4% of the total code size. Before: 1197632 bytes After: 1124688 bytes This IMO makes it worth it, considering we've significantly reduced the amount of code at the same time. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I3c8688715f933b381cad0be75a079ccfd72c3130
2021-05-04Change the word TS to Time Stamp & add time unitManojkiran Eda1-1/+1
- The Message argument in the BIOSPOSTCode Message Entry uses short form wording for TS (Time Stamp) & without any time unit. - As the Message argument is directly displayed on OpenBMC GUI as it is, word "TS" would create customer confusion due to it not being a well known acronym. Also a field like this that captures a physical quantity(time) should have units. - Redfish clients should not be parsing the message argument, so changing this wording should not break them. - Also, this commit changes ":" to ";" in the Message argument to makes things look consistent. - As we changed the content of Message in the Message Entry, we had to bump up the minor version of the Message registry. Tested By: 1. Redfish Validator Passed. Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com> Change-Id: I17924c2dfdcf34563f8f8cd325011e13cb70e476
2021-04-14Fix publish a registry to verify messageIdGeorge Liu1-14/+17
- Base on the b304bd7965 commit, there is a potential bug here. - Currently, the registry is only published when `BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES` is disabled. In fact, regardless of whether `BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES` is enabled or disabled, the registry needs to be published. Tested: built bmcweb repo successfully and validator passes. Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I2e9d96c3b3eef0606e35c146b3d77b5aa2bb066c
2021-04-10Added Validation on MessageId and RegistryPrefixP Dheeraj Srujan Kumar1-12/+20
Message ID's and Registry prefixes used to subscribe to an event will be checked against allowed values. Corrected "Task" registry prefix to "TaskEvent". Tested: - Validated POST action with different combinations of Message id's and Registry Prefix. - Redfish validator passed. Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> Change-Id: I921cafeca8b2a1813f4aa4c41ecd01c831e3465b
2021-02-19Fix nlohmann::json::dump callsEd Tanous1-6/+12
The nlohmann::json::dump call needs to be called with specific arguments to avoid throwing in failure cases. http connection already does this properly, but a bunch of code has snuck in (mostly in redfish) that ignores this, and calls it incorrectly. This can potentially lead to a crash if the wrong thing throws on invalid UTF8 characters. This audits the whole codebase, and replaces every dump() call with the correct dump(2, ' ', true, nlohmann::json::error_handler_t::replace) call. For correct output, the callers should expect no change, and in practice, this would require injecting non-utf8 characters into the BMC. Tested: Ran several of the endpoints/error conditions in question, including some of the error cases. Observed correct responses. I don't know of a security issue that would allow injecting invalid utf8 into the BMC, but in theory if it were possible, this would prevent a crash. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I4a15b8e260e3db129bc20484ade4ed5449f75ad0
2021-02-01Fix wrong check in EventService eventsAppaRao Puli1-1/+1
Sending async event logs to event listener is broken due to commit 23a21a1cbed23ace4174664950e595df961e9e69. Correct the check to make EventService back to functional state. Tested: - Redfish event logs are properly sent to subscribers. Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> Change-Id: If232846a2b0ac694205731a801e55dc4bd5e928a
2020-10-23Turn on ALL perf checksEd Tanous1-8/+8
1st, alphabetize the tidy-list for good housekeeping. Next, enable all the clang-tidy performance checks, and resolve all the issues. most of the issues boil down to: 1. Using std::move on const variables. This does nothing. 2. Passing big variables (like std::string) by value. 3. Using double quotes on a find call, which constructs an intermediate string, rather than using the character overload. Tested Loaded on system, logged in successfully and pulled down webui-vue. No new errors. Walked the Redfish tree a bit, and observed no new problems. Ran redfish service validator. Got no new failures (although there are a lot of log service deprecation warnings that we should look at). Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I2238958c4b22c1e554e09a0a1787c744bdbca43e
2020-10-15Lots of performance improvementsEd Tanous1-2/+2
(In the voice of the kid from sixth sense) I see string copies... Apparently there are a lot of places we make unnecessary copies. This fixes all of them. Not sure how to split this up into smaller patches, or if it even needs split up. It seems pretty easy to review to me, because basically every diff is identical. Change-Id: I22b4ae4f96f7e4082d2bc701098a04f7bed95369 Signed-off-by: Ed Tanous <ed@tanous.net> Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
2020-10-09Write the clang-tidy file OpenBMC needsEd Tanous1-1/+1
Now that CI can handle clang-tidy, and a lot of the individual fixes have landed for the various static analysis checks, lets see how close we are. This includes bringing a bunch of the code up to par with the checks that require. Most of them fall into the category of extraneous else statements, const correctness problems, or extra copies. Tested: CI only. Unit tests pass. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I9fbd346560a75fdd3901fa40c57932486275e912
2020-10-09Move Openssl GeneratorEd Tanous1-2/+11
This commit moves the openssl random number generator into its own file, so it can be used in EventService, and moves it to its own file. Seeding a random number generator with time is bad practice in general, so much so that there's a CERT rule about it as well as a clang-tidy check. https://clang.llvm.org/extra/clang-tidy/checks/cert-msc51-cpp.html This doesn't matter much in this case, as we're generating a randomized int for an ID, but it will matter in other cases, and we'd like to have the check on to verify that. Change-Id: I8e6aebb7962d259045ffd558eea22f07f9c23821 Signed-off-by: Ed Tanous <ed@tanous.net>
2020-10-06Modernize event service manager and sseEd Tanous1-12/+10
Move static initialization of variables into the variables themselves and use = default for the destructor. Also, deleted constructors/destructors/move operators should be public, not private. Tested: Code builds. No substantial changes. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I156b6d7ce4c59d636bec6e722de981bbd0f727c3
2020-09-22Fix IBM management console to match coding standardEd Tanous1-2/+0
Lots of missing inline definitions, a case where a RVO move is not guaranteed when returning a variant, and removing the header checks, which means that these types of build errors wont happen in the future. Tested: Should be no impact, but could someone from the IBM team grab these changes and sanity check them? Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Iea0a06b8e744542a7d08e38217718e7a969f2827
2020-09-17Fix using namespaceEd Tanous1-1/+1
We inherited a "using namespace" crow. Lets fix it. Tested: Code compiles. No functional changes. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Id47446150dfb312c5cd84a4b4284fb824eba8021
2020-09-09EventService: Fix type mismatch in MetricReportWludzik, Jozef1-10/+13
Fix the type mismatch in MetricReport data which is sent to Event Subscribers. Change below properties type to match with MetricReport schema. - Timestamp: It should be uint32_t type. - MetricValue: It should be string type. Tested: - Create MetricReport subscription and report contains correct data types for Timestamp and MetricValue. Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> Change-Id: I0a52b6963e7bedda89a216256f64764cd8799bf1
2020-08-17Enable clang warningsEd Tanous1-29/+30
This commit enables clang warnings, and fixes all warnings that were found. Most of these fall into a couple categories: Variable shadow issues were fixed by renaming variables unused parameter warnings were resolved by either checking error codes that had been ignored, or removing the name of the variable from the scope. Other various warnings were fixed in the best way I was able to come up with. Note, the redfish Node class is especially insidious, as it causes all imlementers to have variables for parameters, regardless of whether or not they are used. Deprecating the Node class is on my list of things to do, as it adds extra overhead, and in general isn't a useful abstraction. For now, I have simply fixed all the handlers. Tested: Added the current meta-clang meta layer into bblayers.conf, and added TOOLCHAIN_pn-bmcweb = "clang" to my local.conf Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Ia75b94010359170159c703e535d1c1af182fe700
2020-08-06Fix: EventService stops sending eventsAppaRao Puli1-4/+8
When redfish log file(/var/log/redfish) is recreated by rsyslog daemon, EventService stops sending events to subscribers. The rsyslog service take redfish log files to back up as per design. EventService has inotify on redfish log file modifications. It needs to be removed from inotify watcher list and added with new File descriptor. Corrected code to handle remove & add of new descriptor. Also corrected code to properly handle last event timestamp. Tested: - Ran stress test on redfish log file to create multiple backup files and events sends to clients properly, in all switching scenarios. Change-Id: Ic0378edfc2cae86d1f69f6df4c429d07c2744bdf Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-08-06Fix: MetricReportDefinitions filter not workingAppaRao Puli1-2/+2
The metric reports are not sending when user configures the MetricReportDefinitions filter. This is of odata json object type. Corrected code to properly handle odata type object and store it as string array to make filters faster. Tested: - Created metric report EventService subscription type with MetricReportDefinitions and events properly sent to Event listener. Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> Change-Id: If96564219da7d38a2ee5e415b89824ba25cd686d
2020-08-05Handling Broadcast message serviceAsmitha Karunanithi1-0/+15
This commit implements the broadcast of the messages from one connected client to other connected clients via BMC. When the management console creates a subscription on the BMC, they will be provided with the broadcast message service. Tested by: (Used https://github.com/DMTF/Redfish-Event-Listener) 1. Create a subscription POST -D headers.txt https://${bmc}/redfish/v1/EventService/Subscriptions -d '{"Destination":"https://<host:port>","Protocol":"Redfish"}' 2. Send the message POST https://${bmc}/ibm/v1/HMC/BroadcastService -d '{"Message":"<msg>"}' 3. Verify the event is generated and posted to the subscriber: bodydata: {"Message":"<The message from HMC to be forwarded>", "Name":"Broadcast Event","OriginOfCondition": "/ibm/v1/HMC/BroadcastService", "Timestamp":"2020-07-15T12:03:30+00:00"} Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: Ib36b4f25505cf66251adc5aeda282312996c25af
2020-08-04EventService : Send event for the ConfigFile creationSunitha Harish1-3/+70
This implements the sendEvent when the IBM management console creates the ConfigFile at BMC using the PUT operation on the url /ibm/v1/Host/ConfigFiles Tested by: (Used https://github.com/DMTF/Redfish-Event-Listener) 1. Create a subscription by passing "ResourceTypes" as ["IBMConfigFile"] POST -D headers.txt https://${bmc}/redfish/v1/EventService/Subscriptions -d '{"Destination" : "https://<host:port>,"ResourceTypes":["IBMConfigFile"],"Protocol":"Redfish"}' 2. Create a ConfigFile PUT https://${bmc}/ibm/v1/Host/ConfigFiles/<filename> --data-binary "@<local_path>" 3. Verify the event is generated and posted to the subscriber as below example bodydata: { "@odata.type":"#Event.v1_4_0.Event", "Events":[ { "EventId":1, "EventTimestamp":"2020-06-26T08:40:04+00:00", "EventType":"ResourceAdded", "MemberId":0, "Message":"The resource has been created successfully.", "MessageArgs":null, "MessageId":"ResourceEvent.1.0.3.ResourceCreated", "OriginOfCondition":"/ibm/v1/Host/ConfigFiles/<filename>", "MessageSeverity":"OK" } ], "Id":1, "Name":"Event Log" } 4. Verified the event is sent to the subscriber when the resourceType list is empty. 5. Verified the client subscribes for other resource - not ConfigFile ; then the event is not sent to the subscriber. Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com> Change-Id: Ic9b195266fe2df67a3160197d03d9ac155ef0cd1
2020-07-31EventService: Add the parameter ResourceTypes to subscriptionSunitha Harish1-0/+4
This commit supports sending the ResourceTypes list while subscribing to the events. The "Task" resource is added as a supported type to receive the task life cycle events. For IBM's management console along with the Task resource, the support is provided to subscribe to the "IBMConfigFile" ResourceType to receive events while creating/updating the ConfigFiles. Tested by: 1. GET https://${bmc}/redfish/v1/EventService 2. Create subscription : POST https://${bmc}/redfish/v1/EventService/Subscriptions -d '{"Destination" : <>, "Protocol":"Redfish", "ResourceTypes": ["Task"]}' 3. GET https://${bmc}/redfish/v1/EventService/Subscriptions/<id> 3. Redfish validator was run successfully Signed-off-by: Sunitha Harish <sunharis@in.ibm.com> Change-Id: Ibaf3f4f5f005a1beedf0a1cd049ae11d93a3af36
2020-07-23EventService: Add nullptr check to avoid crashAppaRao Puli1-2/+8
Subscribing for events using SSE subscription type is crashing the bmcweb. Add nullptr check around the connection object which is created for 'Push Style Events', to avoid the crash in case of SSE. Tested: - SSE subscription works fine and crash goes way. - 'Push style event' works fine. Change-Id: I8ad5b63ca5a82d7ffe41054eee5f4ab6dcb9d72f Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-07-10Codespell redfish-core spelling fixesGunnar Mills1-2/+2
These spelling errors were found using https://github.com/codespell-project/codespell Tested: Top commit (along with this) was built and ran against validator. Change-Id: Ic9dce27b1de8567eedf7753164ef564d3aedf8ca Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-07-02Support the $filter query params for SSE streamAyushi Smriti1-0/+89
This commit adds the support for $filter query paramater in the URI for SSE stream. Method: GET URI: /redfish/v1/EventService/Subscriptions/SSE? $filter=(MessageIds%20eq%20DCPowerOn) or (MessageIds%20eq%20DCPowerOn) Tested: - From browser sent request using SSE URI along with filter query param - query params were read and parsed successfully. - used SubmitTestEvent and could see test events coming to BMC. - Ran redfish validator successfully. - Performed GET on Subscription collections and Subscription/<id> URI and checked for valid data. Change-Id: Ie18546749495175ede918ab933ff8dd1d65b775f Signed-off-by: Ayushi Smriti <smriti.ayushi@linux.intel.com> Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-07-02EventService: Support for Server Sent Events(SSE)AppaRao Puli1-16/+52
Add support for Server Sent Events(SSE) Filters support is not part of this commit. Tested: - GET on URI /redfish/v1/EventService/Subscriptions/SSE/ from chrome browser, can see all BMC Events on browser. - Redfish validator is successful. Change-Id: Icd10cdad20c4529f64c97b67d46f2e4a7e0c329c Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-07-02EventService: Add retry configuration supportAyushi Smriti1-1/+31
This commit is to pass configuration parameters: retry attempts, retry interval secs and retry policy to http client and take required delivery retry policy action. Also, perform async wait for retryTimeoutInterval before each retry attempts. Tested: - Set and verified config properties by sending PATCH req on EventService and EventDestination uri. - Verified the appropriate delivery retry policy action block reached. - Verified the async_wait logic by triggering retry case depending failed state of connection. - could see a wait for timeout interval before next retry. Signed-off-by: Ayushi Smriti <smriti.ayushi@linux.intel.com> Change-Id: Id1366fca59dc9e6543c553bfe5df95a59f468bc7 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-06-29Fix: Replace span with vectorAppaRao Puli1-10/+7
The message args in the event service data is coming empty and also crashing bmcweb when multiple arguments present. The boost::beast::span has issue in passing it as reference to function for assignment. Replaced span with std::vector to avoid empty response to caller function. Tested: - All message arguments are working fine and resolved crash. Change-Id: I800247cfd0d5dba7698cdb3e60c1290e478bf3ac Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-06-29EventService: Add inotify on dir for event logAppaRao Puli1-15/+91
Redfish event log file (/var/log/redfish) may or may not exist while starting bmcweb. Also when event logs are cleared this file will be removed and rsync service will create it again. To handle above cases, Added inotify on /var/log/ directory. This directory watch will handle create/delete of log file and add/remove watch on event log file. Tested: - Removed event log file, re-started the bmcweb and did Ac cycle. Works fine. - Started bmcweb with existing event log file. - Verified the functionality by doing removal(clear event log) and creation of redfish event log file during run time. Change-Id: I6a6c48cf4a410ed6f11d73dae8484d4c21d01e37 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-06-29Revert "Revert "EventService: Add event log support with inotify""AppaRao Puli1-1/+457
This reverts commit 29d2a95ba12f8b5abed040df7fd59790d6ba2517. Enable EventService back by fixing issue with not having '/var/log/redfish' file. Fix is at: https://gerrit.openbmc-project.xyz/#/c/openbmc/bmcweb/+/33639/ Tested: - Along with above mentioned change, removed '/var/log/redfish' file and restarted bmcweb. It works. Change-Id: Ia908bbdf5b9a643afee212a526074f62372208dc Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-06-11clang-format: update to latest from docs repoGunnar Mills1-5/+5
This is from openbmc/docs/style/cpp/.clang-format Other OpenBMC repos are doing the same. Tested: Built and validator passed. Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-06-11Revert "EventService: Add event log support with inotify"James Feist1-457/+1
This reverts commit e9a14131650d30389eaf9dc38a3c32f1cb552f52. Reason for revert: if /var/log/redfish does not exist this causes bmcweb to crash on start Fixes #126 Change-Id: If6ba4717a32d4cd72aa92a9bc9c696d5813b5cac Signed-off-by: James Feist <james.feist@linux.intel.com>
2020-06-05bmcweb: Replace deprecated boost::asio::io_serviceZhenfei Tai1-1/+2
bmcweb will not build when boost library is version 1.71.0. Also fix code format. In CMakeLists.txt 271 if ("${Boost_VERSION}" STREQUAL "107100") 272 add_definitions (-DBOOST_ASIO_NO_DEPRECATED) 273 endif () Signed-off-by: Zhenfei Tai <ztai@google.com> Change-Id: I4ebbf3cfcfd767ea016b4efd19704d25b845f86c
2020-05-29EventService:persistent config & subscription infoAyushi Smriti1-11/+238
This commit is to persist EventService configuration and subscription information across the bmcweb service restart or bmc reboot by reading/writing config store data to the json file (location: /var/lib/bmcweb/eventservice_config.json) and loads this while initializing bmcweb EventService. URI's: /redfish/v1/EventService /redfish/v1/EventService/Subscriptions /redfish/v1/EventService/Subscriptions/<id> Tested: - Validated initialization and reading of config and subscription info from persist store. - Validated updation and writing of config and subscription info to the persist store: - Added new subscription using POST and validated using GET. - Validated delete subscription. - Validated subscription list is persistent after multiple bmc reboots - Verified by GET req on subscription collection and getting specific subscription id's. - Ran redfish validator successfully - Created some subscriptions - Rebooted BMC - Previous subscriptions were intact - Ran validator and verified. Change-Id: I9f044887b0c5b7559be58a6564b04585dc384be2 Signed-off-by: Ayushi Smriti <smriti.ayushi@linux.intel.com> Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-05-21EventService: Add enable/disable supportAppaRao Puli1-32/+94
Add EventService enable/disable support. When EventService is enabled - Check for no of event log subscribers and then only process events async sending. - Check for no of metric report subscribers and register for metric report signal. When EventService is disabled - Discard the inotify event for redfish logs. - Unregister the metric report signal. Tested: - Modified ServieEnabled, DeliveryRetryAttempts, DeliveryRetryInterval values using patch and it reflects on subsequent gets. - Above mentioned functionality tested with Service enabled & disabled modifications. - Ran redfish validator successfully. Change-Id: Id049860a89d3040d859ac8907e7bad5b4209b73d Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-05-15Conditional build issue fixAppaRao Puli1-1/+1
When BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES is set to "ON", bmcweb build is failing. This flag is set to ON for some OEM and causing build failures. Corrected the placement of #endif. Tested: Set the BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES compile flag to "ON" and build is successful. Change-Id: I88b3b40d0a22600c0f592219f8b7b976e7e6c5f5 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-05-14EventService: Add MetricReport supportAppaRao Puli1-1/+174
Add Telemetry metric report support to EventService. - Adding MetricReport support to schema implemenation. - Dynamically register and unregister the metric report signal. - Reads Telemtry data using D-Bus calls. - Filter the metric reports depending on user configured MetricReportDefinition. - Format the Telemetry readings as per MetricReport schema. - Send the formatted data to the client. Tested: - HTTP client successfully received asynchronous metric reports data. - valdiated the register and unregister by adding and deleting subscriptions. - Ran Redfish validator successfully. Change-Id: I7b59ac3ecad169a7959a800730dbc2fe85baf068 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-05-08EventService: Add event log support with inotifyAppaRao Puli1-0/+457
Add event logs support - Event log monitor by adding inotify on redfish log file. - Read event logs from "/var/log/redfish" file. - Filter the event logs using configured settings. - Format the event log data as per Events schema. - Send event log information to subcribed client. Tested: - Added new event log subscription with filters and verified the event logs on event listener. - Ran redfish validater successfully. - Disabled BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES and build successful. Event on listener looks as below: { "@odata.type":"#Event.v1_4_0.Event", "Events":[ { "Context":"CustomText", "EventId":"94787", "EventTimestamp":"1970-01-02T02:19:47+00:00", "EventType":"Event", "Message":"Memory ThermTrip asserted: .", "MessageArgs":[ "" ], "MessageId":"OpenBMC.0.1.MemoryThermTrip", "Severity":"Critical" } ], "Id":"3", "Name":"Event Log" } Change-Id: Ie87322ff59f9f7caa26fb18d2e3b8d7af77ec540 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-05-07EventService: SubmitTestEvent initial supportAppaRao Puli1-2/+36
This commit adds SubmitTestEvent initial support to send out test events to subscribers. URI: /redfish/v1/EventService/Actions/EventService.SubmitTestEvent Tested: - Client subscribed to event listener via destination uri. After sending POST request on SubmitTestEvent uri, could see generated test event. - Successfully ran the redfish validator. Counter({'metadataNamespaces': 1739, 'pass': 26, 'skipOptional': 22, 'serviceNamespaces': 3, 'passGet': 3, 'passAction': 1}) Validation has succeeded. Change-Id: I16e02c1977e99af39317070567196767ac7c7400 Signed-off-by: Ayushi Smriti <smriti.ayushi@linux.intel.com>
2020-05-02EventService: Queuing the request data and retryAppaRao Puli1-2/+2
Add support to queue the request event data. Maintaining the proper state of connection and retry for appropriate action depending on state. If max retries are reached then suspend the retries. Need to add async timeout between retries and take action as configured 'DeliveryRetryPolicy' by user. Tested: - Using Telemetry reports, streamed data to validate the queue by stopping listener. - Verified the retry logic. - Verfiied the appropriate action depending failed state of connection. Change-Id: Idd562cd512897625bf7b0d9a376207db5cb8642f Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-04-24EventService: Manager and subscriptions supportAppaRao Puli1-0/+213
Add EventService Manager which will manage all the EventService configuration and subscriptions. This includes API for add or update or delete subscriptions along with other supported API support. Also includes http connection open and send event code using "push style eventing". Added BMCWEB_INSECURE_HTTP_PUSH_STYLE_EVENTING build flag to enable/disable http push style eventing which is not a secure channel. Tested: - Tested along with other patches such as http client and Event log support, SubmitTestEvent and its works. - Ran Redfish validation successfully. Change-Id: Ie4687e4cbfabd525b7a8ad4e615510f034edc6e9 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>