summaryrefslogtreecommitdiffstats
path: root/test/openpower-pels/repository_test.cpp
Commit message (Collapse)AuthorAgeFilesLines
* PEL: Add repo function to get a PEL FDMatt Spinler2019-12-171-0/+48
| | | | | | | | | | | Add Repository::getPELFD() to return a file descriptor to a PEL data file based on its ID. This will be used by a future D-Bus method to return the descriptor to the PLDM daemon. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I1110a514e30a9387d9672e42862139b988717c53
* PEL: Add Repo API to update transmission statesMatt Spinler2019-12-091-0/+86
| | | | | | | | | Provided APIs for the Repository class to update the host and HMC transmission states on a PEL it contains. It saves the updated PEL data in the filesystem. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Iadbc589ee85d4408339e1171c36b8324910f4f0a
* PEL: Keep PEL attributes in Repository mapMatt Spinler2019-12-031-0/+45
| | | | | | | | | | | | Instead of the Repository class only storing the path to a PEL file for a corresponding PEL ID, change it to a structure that includes the PEL's size and action flags as well as the path. This way, a PEL won't have to be read from the filesystem to find these values every time someone needs them. These new fields will be needed by the code that sends PELs to the host. Change-Id: I7650b6cbad12cc120426854767403f5cba2ee572
* PEL: Add subscriptions for new and deleted PELsMatt Spinler2019-12-031-0/+43
| | | | | | | | | | | Add functionality to the Repository class to be able to call functions provided by others when PELs are added or removed from the repository. This will be used in the future for things like knowing when a new PEL is added so it can be sent to the host. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I2effc9d5fa9a38890311a88bcfb07eed1292a453
* PEL: Run a user defined function on every PELMatt Spinler2019-11-121-0/+36
| | | | | | | | | | | | | | | | | | | | | | | Add a for_each() function to the PEL repository that takes a user defined function that will be run on every PEL, unless that function says to stop early. The user defined function is a std::function<bool>(const PEL&); For example, to save up to 100 IDs in the repo into a vector: std::vector<uint32_t> ids; ForEachFunc f = [&ids](const PEL& pel) { ids.push_back(pel.id()); return ids.size() == 100 ? true : false; }; repo.for_each(f); This will be used to find which PELs still need to be sent up to the host after a reboot, among other things. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Ic60525a8ab3dd593ba37e43a6cb0b3db8dda7cee
* PEL: Add license prologue to test source filesMatt Spinler2019-11-061-0/+15
| | | | | Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I67c62ab5ac6e69ad0a84937834581f9a280a9167
* PEL: Const accessors for Private/UserHeaderMatt Spinler2019-11-041-1/+1
| | | | | | | | | | | | | | | | | | | Change the combined non-const accessor/setter functions for the PrivateHeader and UserHeader fields to the standard const accessors, and have separate setters for the fields that need to be modified. In addition, make the 'get PrivateHeader' and 'get UserHeader' functions on the PEL class return a const reference. This allows const enforcement on the PEL class, for things like: void func(const PEL& pel) { auto id = pel.privateHeader().id(); } Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I840170e72b41e9e2465f716617500269244de6d9
* PEL: Refactor the test data factoryMatt Spinler2019-10-221-9/+9
| | | | | | | | | | | | | | | This commit has no functional changes, it just does some things to make the PEL data creator for testcases, pelDataFactory(), be more manageable: - Change to return a plain vector instead of a unique_ptr<vector>. - Keeps the data for each section in separate vectors and then either returns those as-is or combines them into a PEL. - Change the TestPelType enum to TestPELType to match the style guide. - Have pelDataFactory provide the SRC section instead of srcDataFactory. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I4770aa6a8169e89b6b8f685a9994d845c9e93cfe
* PEL: New repository method to get PEL dataMatt Spinler2019-08-051-0/+23
| | | | | | | | | | | | | Add the getPELData() function on the Repository class to return PEL data based on a PEL ID or OBMC event log ID. The intended use for this will be a D-Bus method, mainly used for debug via the REST interface, to get the PEL data off the BMC when only the OpenBMC event log ID is known, which will be the case until the Redfish APIs are ready. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Ia1d8bff627992fae16be9136f2814f01ea69009e
* PEL: Remove a PEL based on an IDMatt Spinler2019-08-051-0/+67
| | | | | | | | | | | | | | | | | | | When someone deletes an OpenBMC event log, the corresponding PEL should also be deleted. This commit adds support for that by keeping an internal map of the IDs to the files that contain the PEL data in the repository in order to find the file to remove. This will then get called in the phosphor-logging extension's delete hook. The actual map key is a structure of both the PEL ID and OpenBMC log ID, so either can be used to find a PEL in the repository, which will be useful in other cases, for example for retrieving PEL data based on the PEL ID. As the map needs to match the actual repository file contents, it will get built on startup, and modified when PELs are added and removed. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I33bb96da297c770e175c5c6b19705dda1c8766b6
* PEL: Add repository to save PELsMatt Spinler2019-08-051-0/+73
Create the Repository class that can save PELs in (and later retrieve them from) the filesystem. It provides an add() method that can add a PEL object to the repository. Now, when the Manager class sees an OpenBMC event log created with the RAWPEL metadata in the AdditionalData property that points at a file that contains a PEL, it can save that PEL. Before the PEL is saved, the log ID and commit timestamp fields in the PEL will be updated - the log ID to a unique value, and the timestamp to the current time. Change-Id: I8dbaddf0f155bcb6d40b933294ada83feb75ce53
OpenPOWER on IntegriCloud