blob: 7c9c3ae445ee5f3c647b56897d0d1313eb2ebf06 [file] [log] [blame]
Matt Spinler97f7abc2019-11-06 09:40:23 -06001/**
2 * Copyright © 2019 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Matt Spinler89fa0822019-07-17 13:54:30 -050016#include "extensions/openpower-pels/manager.hpp"
17#include "log_manager.hpp"
Matt Spinlere6b48f12020-04-02 09:51:39 -050018#include "mocks.hpp"
Matt Spinler89fa0822019-07-17 13:54:30 -050019#include "pel_utils.hpp"
20
21#include <fstream>
22#include <regex>
Matt Spinlere6b48f12020-04-02 09:51:39 -050023#include <sdbusplus/test/sdbus_mock.hpp>
Matt Spinlera34ab722019-12-16 10:39:32 -060024#include <xyz/openbmc_project/Common/error.hpp>
Matt Spinler89fa0822019-07-17 13:54:30 -050025
26#include <gtest/gtest.h>
27
28using namespace openpower::pels;
29namespace fs = std::filesystem;
30
Matt Spinlere6b48f12020-04-02 09:51:39 -050031using ::testing::NiceMock;
Matt Spinler3dd17e92020-08-05 15:04:27 -050032using ::testing::Return;
Matt Spinlere6b48f12020-04-02 09:51:39 -050033
Matt Spinler05c2c6c2019-12-18 14:02:09 -060034class TestLogger
35{
36 public:
37 void log(const std::string& name, phosphor::logging::Entry::Level level,
38 const EventLogger::ADMap& additionalData)
39 {
40 errName = name;
41 errLevel = level;
42 ad = additionalData;
43 }
44
45 std::string errName;
46 phosphor::logging::Entry::Level errLevel;
47 EventLogger::ADMap ad;
48};
49
Matt Spinler89fa0822019-07-17 13:54:30 -050050class ManagerTest : public CleanPELFiles
51{
Matt Spinler6b1a5c82020-01-07 08:48:53 -060052 public:
Matt Spinlere6b48f12020-04-02 09:51:39 -050053 ManagerTest() :
54 bus(sdbusplus::get_mocked_new(&sdbusInterface)),
55 logManager(bus, "logging_path")
Matt Spinler6b1a5c82020-01-07 08:48:53 -060056 {
57 sd_event_default(&sdEvent);
Matt Spinler6b1a5c82020-01-07 08:48:53 -060058 }
59
60 ~ManagerTest()
61 {
62 sd_event_unref(sdEvent);
63 }
64
Matt Spinlere6b48f12020-04-02 09:51:39 -050065 NiceMock<sdbusplus::SdBusMock> sdbusInterface;
66 sdbusplus::bus::bus bus;
Matt Spinler6b1a5c82020-01-07 08:48:53 -060067 phosphor::logging::internal::Manager logManager;
68 sd_event* sdEvent;
Matt Spinler05c2c6c2019-12-18 14:02:09 -060069 TestLogger logger;
Matt Spinler89fa0822019-07-17 13:54:30 -050070};
71
72fs::path makeTempDir()
73{
74 char path[] = "/tmp/tempnameXXXXXX";
75 std::filesystem::path dir = mkdtemp(path);
76 return dir;
77}
78
Matt Spinler67456c22019-10-21 12:22:49 -050079std::optional<fs::path> findAnyPELInRepo()
80{
81 // PELs are named <timestamp>_<ID>
82 std::regex expr{"\\d+_\\d+"};
83
84 for (auto& f : fs::directory_iterator(getPELRepoPath() / "logs"))
85 {
86 if (std::regex_search(f.path().string(), expr))
87 {
88 return f.path();
89 }
90 }
91 return std::nullopt;
92}
93
Matt Spinler7e727a32020-07-07 15:00:17 -050094size_t countPELsInRepo()
95{
96 size_t count = 0;
97 std::regex expr{"\\d+_\\d+"};
98
99 for (auto& f : fs::directory_iterator(getPELRepoPath() / "logs"))
100 {
101 if (std::regex_search(f.path().string(), expr))
102 {
103 count++;
104 }
105 }
106 return count;
107}
108
Matt Spinlerff9cec22020-07-15 13:06:35 -0500109void deletePELFile(uint32_t id)
110{
111 char search[20];
112
113 sprintf(search, "\\d+_%.8X", id);
114 std::regex expr{search};
115
116 for (auto& f : fs::directory_iterator(getPELRepoPath() / "logs"))
117 {
118 if (std::regex_search(f.path().string(), expr))
119 {
120 fs::remove(f.path());
121 break;
122 }
123 }
124}
125
Matt Spinler89fa0822019-07-17 13:54:30 -0500126// Test that using the RAWPEL=<file> with the Manager::create() call gets
127// a PEL saved in the repository.
128TEST_F(ManagerTest, TestCreateWithPEL)
129{
Matt Spinlerc8705e22019-09-11 12:36:07 -0500130 std::unique_ptr<DataInterfaceBase> dataIface =
Matt Spinlere6b48f12020-04-02 09:51:39 -0500131 std::make_unique<MockDataInterface>();
Matt Spinler89fa0822019-07-17 13:54:30 -0500132
Matt Spinler05c2c6c2019-12-18 14:02:09 -0600133 openpower::pels::Manager manager{
134 logManager, std::move(dataIface),
135 std::bind(std::mem_fn(&TestLogger::log), &logger, std::placeholders::_1,
136 std::placeholders::_2, std::placeholders::_3)};
Matt Spinler89fa0822019-07-17 13:54:30 -0500137
138 // Create a PEL, write it to a file, and pass that filename into
139 // the create function.
Matt Spinler42828bd2019-10-11 10:39:30 -0500140 auto data = pelDataFactory(TestPELType::pelSimple);
Matt Spinler89fa0822019-07-17 13:54:30 -0500141
142 fs::path pelFilename = makeTempDir() / "rawpel";
143 std::ofstream pelFile{pelFilename};
Matt Spinler42828bd2019-10-11 10:39:30 -0500144 pelFile.write(reinterpret_cast<const char*>(data.data()), data.size());
Matt Spinler89fa0822019-07-17 13:54:30 -0500145 pelFile.close();
146
147 std::string adItem = "RAWPEL=" + pelFilename.string();
148 std::vector<std::string> additionalData{adItem};
149 std::vector<std::string> associations;
150
Matt Spinler367144c2019-09-19 15:33:52 -0500151 manager.create("error message", 42, 0,
152 phosphor::logging::Entry::Level::Error, additionalData,
Matt Spinler89fa0822019-07-17 13:54:30 -0500153 associations);
154
Matt Spinler67456c22019-10-21 12:22:49 -0500155 // Find the file in the PEL repository directory
156 auto pelPathInRepo = findAnyPELInRepo();
Matt Spinler89fa0822019-07-17 13:54:30 -0500157
Matt Spinler67456c22019-10-21 12:22:49 -0500158 EXPECT_TRUE(pelPathInRepo);
Matt Spinler89fa0822019-07-17 13:54:30 -0500159
Matt Spinler475e5742019-07-18 16:09:49 -0500160 // Now remove it based on its OpenBMC event log ID
161 manager.erase(42);
162
Matt Spinler67456c22019-10-21 12:22:49 -0500163 pelPathInRepo = findAnyPELInRepo();
Matt Spinler475e5742019-07-18 16:09:49 -0500164
Matt Spinler67456c22019-10-21 12:22:49 -0500165 EXPECT_FALSE(pelPathInRepo);
Matt Spinler475e5742019-07-18 16:09:49 -0500166
Matt Spinler89fa0822019-07-17 13:54:30 -0500167 fs::remove_all(pelFilename.parent_path());
168}
Matt Spinler67456c22019-10-21 12:22:49 -0500169
Matt Spinlere95fd012020-01-07 12:53:16 -0600170TEST_F(ManagerTest, TestCreateWithInvalidPEL)
171{
172 std::unique_ptr<DataInterfaceBase> dataIface =
Matt Spinlere6b48f12020-04-02 09:51:39 -0500173 std::make_unique<MockDataInterface>();
Matt Spinlere95fd012020-01-07 12:53:16 -0600174
175 openpower::pels::Manager manager{
176 logManager, std::move(dataIface),
177 std::bind(std::mem_fn(&TestLogger::log), &logger, std::placeholders::_1,
178 std::placeholders::_2, std::placeholders::_3)};
179
180 // Create a PEL, write it to a file, and pass that filename into
181 // the create function.
182 auto data = pelDataFactory(TestPELType::pelSimple);
183
184 // Truncate it to make it invalid.
185 data.resize(200);
186
187 fs::path pelFilename = makeTempDir() / "rawpel";
188 std::ofstream pelFile{pelFilename};
189 pelFile.write(reinterpret_cast<const char*>(data.data()), data.size());
190 pelFile.close();
191
192 std::string adItem = "RAWPEL=" + pelFilename.string();
193 std::vector<std::string> additionalData{adItem};
194 std::vector<std::string> associations;
195
196 manager.create("error message", 42, 0,
197 phosphor::logging::Entry::Level::Error, additionalData,
198 associations);
199
200 // Run the event loop to log the bad PEL event
201 sdeventplus::Event e{sdEvent};
202 e.run(std::chrono::milliseconds(1));
203
204 PEL invalidPEL{data};
205 EXPECT_EQ(logger.errName, "org.open_power.Logging.Error.BadHostPEL");
206 EXPECT_EQ(logger.errLevel, phosphor::logging::Entry::Level::Error);
207 EXPECT_EQ(std::stoi(logger.ad["PLID"], nullptr, 16), invalidPEL.plid());
208 EXPECT_EQ(logger.ad["OBMC_LOG_ID"], "42");
209 EXPECT_EQ(logger.ad["SRC"], (*invalidPEL.primarySRC())->asciiString());
210 EXPECT_EQ(logger.ad["PEL_SIZE"], std::to_string(data.size()));
211
Matt Spinlerfe721892020-04-02 10:28:08 -0500212 // Check that the bad PEL data was saved to a file.
213 auto badPELData = readPELFile(getPELRepoPath() / "badPEL");
214 EXPECT_EQ(*badPELData, data);
215
Matt Spinlere95fd012020-01-07 12:53:16 -0600216 fs::remove_all(pelFilename.parent_path());
217}
218
Matt Spinler67456c22019-10-21 12:22:49 -0500219// Test that the message registry can be used to build a PEL.
220TEST_F(ManagerTest, TestCreateWithMessageRegistry)
221{
222 const auto registry = R"(
223{
224 "PELs":
225 [
226 {
227 "Name": "xyz.openbmc_project.Error.Test",
228 "Subsystem": "power_supply",
229 "ActionFlags": ["service_action", "report"],
230 "SRC":
231 {
232 "ReasonCode": "0x2030"
Harisuddin Mohamed Isa0f717e12020-01-15 20:05:33 +0800233 },
234 "Documentation":
235 {
236 "Description": "A PGOOD Fault",
237 "Message": "PS had a PGOOD Fault"
Matt Spinler67456c22019-10-21 12:22:49 -0500238 }
Matt Spinler30ddc9f2020-07-16 15:39:59 -0500239 },
240 {
241 "Name": "xyz.openbmc_project.Logging.Error.Default",
242 "Subsystem": "bmc_firmware",
243 "SRC":
244 {
245 "ReasonCode": "0x2031"
246 },
247 "Documentation":
248 {
249 "Description": "The entry used when no match found",
250 "Message": "This is a generic SRC"
251 }
Matt Spinler67456c22019-10-21 12:22:49 -0500252 }
253 ]
254}
255)";
256
Matt Spinler0d804ef2020-05-12 16:16:26 -0500257 auto path = getPELReadOnlyDataPath();
Matt Spinlerd4ffb652019-11-12 14:16:14 -0600258 fs::create_directories(path);
259 path /= "message_registry.json";
260
Matt Spinler67456c22019-10-21 12:22:49 -0500261 std::ofstream registryFile{path};
262 registryFile << registry;
263 registryFile.close();
264
Matt Spinler67456c22019-10-21 12:22:49 -0500265 std::unique_ptr<DataInterfaceBase> dataIface =
Matt Spinlere6b48f12020-04-02 09:51:39 -0500266 std::make_unique<MockDataInterface>();
Matt Spinler67456c22019-10-21 12:22:49 -0500267
Matt Spinler05c2c6c2019-12-18 14:02:09 -0600268 openpower::pels::Manager manager{
269 logManager, std::move(dataIface),
270 std::bind(std::mem_fn(&TestLogger::log), &logger, std::placeholders::_1,
271 std::placeholders::_2, std::placeholders::_3)};
Matt Spinler67456c22019-10-21 12:22:49 -0500272
Matt Spinler30ddc9f2020-07-16 15:39:59 -0500273 std::vector<std::string> additionalData{"FOO=BAR"};
Matt Spinler67456c22019-10-21 12:22:49 -0500274 std::vector<std::string> associations;
275
276 // Create the event log to create the PEL from.
277 manager.create("xyz.openbmc_project.Error.Test", 33, 0,
278 phosphor::logging::Entry::Level::Error, additionalData,
279 associations);
280
281 // Ensure a PEL was created in the repository
282 auto pelFile = findAnyPELInRepo();
283 ASSERT_TRUE(pelFile);
284
285 auto data = readPELFile(*pelFile);
286 PEL pel(*data);
287
288 // Spot check it. Other testcases cover the details.
289 EXPECT_TRUE(pel.valid());
290 EXPECT_EQ(pel.obmcLogID(), 33);
291 EXPECT_EQ(pel.primarySRC().value()->asciiString(),
292 "BD612030 ");
Vijay Lobod354a392021-06-01 16:21:02 -0500293 // Check if the eventId creation is good
294 EXPECT_EQ(manager.getEventId(pel),
295 "BD612030 00000055 00000010 00000000 00000000 00000000 00000000 "
296 "00000000 00000000");
Matt Spinler67456c22019-10-21 12:22:49 -0500297
298 // Remove it
299 manager.erase(33);
300 pelFile = findAnyPELInRepo();
301 EXPECT_FALSE(pelFile);
302
303 // Create an event log that can't be found in the registry.
Matt Spinler30ddc9f2020-07-16 15:39:59 -0500304 // In this case, xyz.openbmc_project.Logging.Error.Default will
305 // be used as the key instead to find a registry match.
306 manager.create("xyz.openbmc_project.Error.Foo", 42, 0,
Matt Spinler67456c22019-10-21 12:22:49 -0500307 phosphor::logging::Entry::Level::Error, additionalData,
308 associations);
309
Matt Spinler30ddc9f2020-07-16 15:39:59 -0500310 // Ensure a PEL was still created in the repository
Matt Spinler67456c22019-10-21 12:22:49 -0500311 pelFile = findAnyPELInRepo();
Matt Spinler30ddc9f2020-07-16 15:39:59 -0500312 ASSERT_TRUE(pelFile);
313
314 data = readPELFile(*pelFile);
315 PEL newPEL(*data);
316
317 EXPECT_TRUE(newPEL.valid());
318 EXPECT_EQ(newPEL.obmcLogID(), 42);
319 EXPECT_EQ(newPEL.primarySRC().value()->asciiString(),
320 "BD8D2031 ");
321
322 // Check for both the original AdditionalData item as well as
323 // the ERROR_NAME item that should contain the error message
324 // property that wasn't found.
325 std::string errorName;
326 std::string adItem;
327
328 for (const auto& section : newPEL.optionalSections())
329 {
330 if (SectionID::userData == static_cast<SectionID>(section->header().id))
331 {
332 if (UserDataFormat::json ==
333 static_cast<UserDataFormat>(section->header().subType))
334 {
335 auto ud = static_cast<UserData*>(section.get());
336
337 // Check that there was a UserData section added that
338 // contains debug details about the device.
339 const auto& d = ud->data();
340 std::string jsonString{d.begin(), d.end()};
341 auto json = nlohmann::json::parse(jsonString);
342
343 if (json.contains("ERROR_NAME"))
344 {
345 errorName = json["ERROR_NAME"].get<std::string>();
346 }
347
348 if (json.contains("FOO"))
349 {
350 adItem = json["FOO"].get<std::string>();
351 }
352 }
353 }
354 if (!errorName.empty())
355 {
356 break;
357 }
358 }
359
360 EXPECT_EQ(errorName, "xyz.openbmc_project.Error.Foo");
361 EXPECT_EQ(adItem, "BAR");
Matt Spinler67456c22019-10-21 12:22:49 -0500362}
Matt Spinlera34ab722019-12-16 10:39:32 -0600363
364TEST_F(ManagerTest, TestDBusMethods)
365{
Matt Spinlera34ab722019-12-16 10:39:32 -0600366 std::unique_ptr<DataInterfaceBase> dataIface =
Matt Spinlere6b48f12020-04-02 09:51:39 -0500367 std::make_unique<MockDataInterface>();
Matt Spinlera34ab722019-12-16 10:39:32 -0600368
Matt Spinler05c2c6c2019-12-18 14:02:09 -0600369 Manager manager{logManager, std::move(dataIface),
370 std::bind(std::mem_fn(&TestLogger::log), &logger,
371 std::placeholders::_1, std::placeholders::_2,
372 std::placeholders::_3)};
Matt Spinlera34ab722019-12-16 10:39:32 -0600373
374 // Create a PEL, write it to a file, and pass that filename into
375 // the create function so there's one in the repo.
376 auto data = pelDataFactory(TestPELType::pelSimple);
377
378 fs::path pelFilename = makeTempDir() / "rawpel";
379 std::ofstream pelFile{pelFilename};
380 pelFile.write(reinterpret_cast<const char*>(data.data()), data.size());
381 pelFile.close();
382
383 std::string adItem = "RAWPEL=" + pelFilename.string();
384 std::vector<std::string> additionalData{adItem};
385 std::vector<std::string> associations;
386
387 manager.create("error message", 42, 0,
388 phosphor::logging::Entry::Level::Error, additionalData,
389 associations);
390
391 // getPELFromOBMCID
392 auto newData = manager.getPELFromOBMCID(42);
393 EXPECT_EQ(newData.size(), data.size());
394
395 // Read the PEL to get the ID for later
396 PEL pel{newData};
397 auto id = pel.id();
398
399 EXPECT_THROW(
400 manager.getPELFromOBMCID(id + 1),
401 sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument);
402
403 // getPEL
404 auto unixfd = manager.getPEL(id);
405
406 // Get the size
407 struct stat s;
408 int r = fstat(unixfd, &s);
409 ASSERT_EQ(r, 0);
410 auto size = s.st_size;
411
412 // Open the FD and check the contents
413 FILE* fp = fdopen(unixfd, "r");
414 ASSERT_NE(fp, nullptr);
415
416 std::vector<uint8_t> fdData;
417 fdData.resize(size);
418 r = fread(fdData.data(), 1, size, fp);
419 EXPECT_EQ(r, size);
420
421 EXPECT_EQ(newData, fdData);
422
423 fclose(fp);
424
Matt Spinler05c2c6c2019-12-18 14:02:09 -0600425 // Run the event loop to close the FD
426 sdeventplus::Event e{sdEvent};
427 e.run(std::chrono::milliseconds(1));
428
Matt Spinlera34ab722019-12-16 10:39:32 -0600429 EXPECT_THROW(
430 manager.getPEL(id + 1),
431 sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument);
432
433 // hostAck
434 manager.hostAck(id);
435
436 EXPECT_THROW(
437 manager.hostAck(id + 1),
438 sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument);
439
440 // hostReject
441 manager.hostReject(id, Manager::RejectionReason::BadPEL);
Matt Spinler05c2c6c2019-12-18 14:02:09 -0600442
443 // Run the event loop to log the bad PEL event
444 e.run(std::chrono::milliseconds(1));
445
446 EXPECT_EQ(logger.errName, "org.open_power.Logging.Error.SentBadPELToHost");
447 EXPECT_EQ(id, std::stoi(logger.ad["BAD_ID"], nullptr, 16));
448
Matt Spinlera34ab722019-12-16 10:39:32 -0600449 manager.hostReject(id, Manager::RejectionReason::HostFull);
450
451 EXPECT_THROW(
452 manager.hostReject(id + 1, Manager::RejectionReason::BadPEL),
453 sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument);
454
455 fs::remove_all(pelFilename.parent_path());
Ramesh Iyyarf4203c42021-06-24 06:09:23 -0500456
457 // GetPELIdFromBMCLogId
458 EXPECT_EQ(pel.id(), manager.getPELIdFromBMCLogId(pel.obmcLogID()));
459 EXPECT_THROW(
460 manager.getPELIdFromBMCLogId(pel.obmcLogID() + 1),
461 sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument);
Matt Spinlera34ab722019-12-16 10:39:32 -0600462}
Matt Spinler19e72902020-01-24 11:05:20 -0600463
464// An ESEL from the wild
465const std::string esel{
466 "00 00 df 00 00 00 00 20 00 04 12 01 6f aa 00 00 "
467 "50 48 00 30 01 00 33 00 00 00 00 07 5c 69 cc 0d 00 00 00 07 5c d5 50 db "
468 "42 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 90 00 00 4e 90 00 00 4e "
469 "55 48 00 18 01 00 09 00 8a 03 40 00 00 00 00 00 ff ff 00 00 00 00 00 00 "
470 "50 53 00 50 01 01 00 00 02 00 00 09 33 2d 00 48 00 00 00 e0 00 00 10 00 "
471 "00 00 00 00 00 20 00 00 00 0c 00 02 00 00 00 fa 00 00 0c e4 00 00 00 12 "
472 "42 43 38 41 33 33 32 44 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 "
473 "20 20 20 20 20 20 20 20 55 44 00 1c 01 06 01 00 02 54 41 4b 00 00 00 06 "
474 "00 00 00 55 00 01 f9 20 00 00 00 00 55 44 00 24 01 06 01 00 01 54 41 4b "
475 "00 00 00 05 00 00 00 00 00 00 00 00 00 00 00 00 23 01 00 02 00 05 00 00 "
476 "55 44 00 0c 01 0b 01 00 0f 01 00 00 55 44 00 10 01 04 01 00 0f 9f de 6a "
477 "00 01 00 00 55 44 00 7c 00 0c 01 00 00 13 0c 02 00 fa 0c e4 16 00 01 2c "
478 "0c 1c 16 00 00 fa 0a f0 14 00 00 fa 0b b8 14 00 00 be 09 60 12 00 01 2c "
479 "0d 7a 12 00 00 fa 0c 4e 10 00 00 fa 0c e4 10 00 00 be 0a 8c 16 00 01 2c "
480 "0c 1c 16 00 01 09 09 f6 16 00 00 fa 09 f6 14 00 00 fa 0b b8 14 00 00 fa "
481 "0a f0 14 00 00 be 08 ca 12 00 01 2c 0c e4 12 00 00 fa 0b 54 10 00 00 fa "
482 "0c 2d 10 00 00 be 08 ca 55 44 00 58 01 03 01 00 00 00 00 00 00 05 31 64 "
483 "00 00 00 00 00 05 0d d4 00 00 00 00 40 5f 06 e0 00 00 00 00 40 5d d2 00 "
484 "00 00 00 00 40 57 d3 d0 00 00 00 00 40 58 f6 a0 00 00 00 00 40 54 c9 34 "
485 "00 00 00 00 40 55 9a 10 00 00 00 00 40 4c 0a 80 00 00 00 00 00 00 27 14 "
486 "55 44 01 84 01 01 01 00 48 6f 73 74 62 6f 6f 74 20 42 75 69 6c 64 20 49 "
487 "44 3a 20 68 6f 73 74 62 6f 6f 74 2d 66 65 63 37 34 64 66 2d 70 30 61 38 "
488 "37 64 63 34 2f 68 62 69 63 6f 72 65 2e 62 69 6e 00 49 42 4d 2d 77 69 74 "
489 "68 65 72 73 70 6f 6f 6e 2d 4f 50 39 2d 76 32 2e 34 2d 39 2e 32 33 34 0a "
490 "09 6f 70 2d 62 75 69 6c 64 2d 38 32 66 34 63 66 30 0a 09 62 75 69 6c 64 "
491 "72 6f 6f 74 2d 32 30 31 39 2e 30 35 2e 32 2d 31 30 2d 67 38 39 35 39 31 "
492 "31 34 0a 09 73 6b 69 62 6f 6f 74 2d 76 36 2e 35 2d 31 38 2d 67 34 37 30 "
493 "66 66 62 35 66 32 39 64 37 0a 09 68 6f 73 74 62 6f 6f 74 2d 66 65 63 37 "
494 "34 64 66 2d 70 30 61 38 37 64 63 34 0a 09 6f 63 63 2d 65 34 35 39 37 61 "
495 "62 0a 09 6c 69 6e 75 78 2d 35 2e 32 2e 31 37 2d 6f 70 65 6e 70 6f 77 65 "
496 "72 31 2d 70 64 64 63 63 30 33 33 0a 09 70 65 74 69 74 62 6f 6f 74 2d 76 "
497 "31 2e 31 30 2e 34 0a 09 6d 61 63 68 69 6e 65 2d 78 6d 6c 2d 63 36 32 32 "
498 "63 62 35 2d 70 37 65 63 61 62 33 64 0a 09 68 6f 73 74 62 6f 6f 74 2d 62 "
499 "69 6e 61 72 69 65 73 2d 36 36 65 39 61 36 30 0a 09 63 61 70 70 2d 75 63 "
500 "6f 64 65 2d 70 39 2d 64 64 32 2d 76 34 0a 09 73 62 65 2d 36 30 33 33 30 "
501 "65 30 0a 09 68 63 6f 64 65 2d 68 77 30 39 32 31 31 39 61 2e 6f 70 6d 73 "
502 "74 0a 00 00 55 44 00 70 01 04 01 00 0f 9f de 6a 00 05 00 00 07 5f 1d f4 "
503 "30 32 43 59 34 37 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
504 "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
505 "0b ac 54 02 59 41 31 39 33 34 36 39 37 30 35 38 00 00 00 00 00 00 05 22 "
506 "a1 58 01 8a 00 58 40 20 17 18 4d 2c 00 00 00 fc 01 a1 00 00 55 44 00 14 "
507 "01 08 01 00 00 00 00 01 00 00 00 5a 00 00 00 05 55 44 03 fc 01 15 31 00 "
508 "01 28 00 42 46 41 50 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 f4 "
509 "00 00 00 00 00 00 03 f4 00 00 00 0b 00 00 00 00 00 00 00 3d 2c 9b c2 84 "
510 "00 00 01 e4 00 48 43 4f fb ed 70 b1 00 00 02 01 00 00 00 00 00 00 00 09 "
511 "00 00 00 00 00 11 bd 20 00 00 00 00 00 01 f8 80 00 00 00 00 00 00 00 01 "
512 "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00 00 00 00 01 2c "
513 "00 00 00 00 00 00 07 d0 00 00 00 00 00 00 0c 1c 00 00 00 64 00 00 00 3d "
514 "2c 9b d1 11 00 00 01 e4 00 48 43 4f fb ed 70 b1 00 00 02 01 00 00 00 00 "
515 "00 00 00 0a 00 00 00 00 00 13 b5 a0 00 00 00 00 00 01 f8 80 00 00 00 00 "
516 "00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 "
517 "00 00 00 be 00 00 00 00 00 00 07 d0 00 00 00 00 00 00 0a 8c 00 00 00 64 "
518 "00 00 00 3d 2c 9b df 98 00 00 01 e4 00 48 43 4f fb ed 70 b1 00 00 02 01 "
519 "00 00 00 00 00 00 00 0b 00 00 00 00 00 15 ae 20 00 00 00 00 00 01 f8 80 "
520 "00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 "
521 "00 00 00 00 00 00 00 fa 00 00 00 00 00 00 07 d0 00 00 00 00 00 00 0c e4 "
522 "00 00 00 64 00 00 00 3d 2c 9b ea b7 00 00 01 e4 00 48 43 4f fb ed 70 b1 "
523 "00 00 02 01 00 00 00 00 00 00 00 0c 00 00 00 00 00 17 a6 a0 00 00 00 00 "
524 "00 01 f8 80 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 "
525 "00 00 00 12 00 00 00 00 00 00 00 fa 00 00 00 00 00 00 07 d0 00 00 00 00 "
526 "00 00 0c 4e 00 00 00 64 00 00 00 3d 2c 9b f6 27 00 00 01 e4 00 48 43 4f "
527 "fb ed 70 b1 00 00 02 01 00 00 00 00 00 00 00 0d 00 00 00 00 00 19 9f 20 "
528 "00 00 00 00 00 01 f8 80 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 "
529 "00 00 00 00 00 00 00 12 00 00 00 00 00 00 01 2c 00 00 00 00 00 00 07 d0 "
530 "00 00 00 00 00 00 0d 7a 00 00 00 64 00 00 00 3d 2c 9c 05 75 00 00 01 e4 "
531 "00 48 43 4f fb ed 70 b1 00 00 02 01 00 00 00 00 00 00 00 0e 00 00 00 00 "
532 "00 1b 97 a0 00 00 00 00 00 01 f8 80 00 00 00 00 00 00 00 01 00 00 00 00 "
533 "00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 be 00 00 00 00 "
534 "00 00 07 d0 00 00 00 00 00 00 09 60 00 00 00 64 00 00 00 3d 2c 9c 11 29 "
535 "00 00 01 e4 00 48 43 4f fb ed 70 b1 00 00 02 01 00 00 00 00 00 00 00 0f "
536 "00 00 00 00 00 1d 90 20 00 00 00 00 00 01 f8 80 00 00 00 00 00 00 00 01 "
537 "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 fa "
538 "00 00 00 00 00 00 07 d0 00 00 00 00 00 00 0b b8 00 00 00 64 00 00 00 3d "
539 "2c 9c 1c 45 00 00 01 e4 00 48 43 4f fb ed 70 b1 00 00 02 01 00 00 00 00 "
540 "00 00 00 10 00 00 00 00 00 1f 88 a0 00 00 00 00 00 01 f8 80 00 00 00 00 "
541 "00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00 00 "
542 "00 00 00 fa 00 00 00 00 00 00 07 d0 00 00 00 00 00 00 0a f0 00 00 00 64 "
543 "00 00 00 3d 2c 9c 2b 14 00 00 01 e4 00 48 43 4f fb ed 70 b1 00 00 02 01 "
544 "00 00 00 00 00 00 00 11 00 00 00 00 00 21 81 20 00 00 00 00 00 01 f8 80 "
545 "00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 "
546 "00 00 00 00 00 00 01 2c 00 00 00 00 00 00 07 d0 00 00 00 00 00 00 0c 1c "
547 "00 00 00 64 00 00 00 3d 2d 6d 8f 9e 00 00 01 e4 00 00 43 4f 52 d7 9c 36 "
548 "00 00 04 73 00 00 00 1c 00 00 00 3d 2d 6d 99 ac 00 00 01 e4 00 10 43 4f "
549 "3f f2 02 3d 00 00 05 58 00 00 00 00 02 00 00 01 00 00 00 00 00 00 00 40 "
550 "00 00 00 2c 55 44 00 30 01 15 31 00 01 28 00 42 46 41 50 49 5f 44 42 47 "
551 "00 00 00 00 00 00 00 00 00 00 00 28 00 00 00 00 00 00 00 28 00 00 00 00 "
552 "00 00 00 00 55 44 01 74 01 15 31 00 01 28 00 42 46 41 50 49 5f 49 00 00 "
553 "00 00 00 00 00 00 00 00 00 00 01 6c 00 00 00 00 00 00 01 6c 00 00 00 0b "
554 "00 00 00 00 00 00 00 3c 0d 52 18 5e 00 00 01 e4 00 08 43 4f 46 79 94 13 "
555 "00 00 0a 5b 00 00 00 00 00 00 2c 00 00 00 00 24 00 00 00 3c 0d 6b 26 6c "
556 "00 00 01 e4 00 00 43 4f 4e 9b 18 74 00 00 01 03 00 00 00 1c 00 00 00 3c "
557 "12 b9 2d 13 00 00 01 e4 00 00 43 4f ea 31 ed d4 00 00 05 c4 00 00 00 1c "
558 "00 00 00 3c 13 02 73 53 00 00 01 e4 00 00 43 4f ea 31 ed d4 00 00 05 c4 "
559 "00 00 00 1c 00 00 00 3c 13 04 7c 94 00 00 01 e4 00 00 43 4f ea 31 ed d4 "
560 "00 00 05 c4 00 00 00 1c 00 00 00 3c 13 06 ad e1 00 00 01 e4 00 00 43 4f "
561 "ea 31 ed d4 00 00 05 c4 00 00 00 1c 00 00 00 3c 13 07 3f 77 00 00 01 e4 "
562 "00 00 43 4f 5e 4a 55 32 00 00 10 f2 00 00 00 1c 00 00 00 3c 13 07 4e e4 "
563 "00 00 01 e4 00 00 43 4f 5e 4a 55 32 00 00 0d 68 00 00 00 1c 00 00 00 3c "
564 "13 36 79 18 00 00 01 e4 00 00 43 4f ea 31 ed d4 00 00 05 c4 00 00 00 1c "
565 "00 00 00 3d 2c 9c 36 70 00 00 01 e4 00 00 43 4f 23 45 90 97 00 00 02 47 "
566 "00 00 00 1c 00 00 00 3d 2d 6d a3 ed 00 00 01 e4 00 08 43 4f 74 3a 5b 1a "
567 "00 00 04 cc 00 00 00 00 02 00 00 01 00 00 00 24 55 44 00 30 01 15 31 00 "
568 "01 28 00 42 53 43 41 4e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 28 "
569 "00 00 00 00 00 00 00 28 00 00 00 00 00 00 00 00"};
570
571TEST_F(ManagerTest, TestESELToRawData)
572{
573 auto data = Manager::eselToRawData(esel);
574
575 EXPECT_EQ(data.size(), 2464);
576
577 PEL pel{data};
578 EXPECT_TRUE(pel.valid());
579}
580
581TEST_F(ManagerTest, TestCreateWithESEL)
582{
583 std::unique_ptr<DataInterfaceBase> dataIface =
Matt Spinlere6b48f12020-04-02 09:51:39 -0500584 std::make_unique<MockDataInterface>();
Matt Spinler19e72902020-01-24 11:05:20 -0600585
586 openpower::pels::Manager manager{
587 logManager, std::move(dataIface),
588 std::bind(std::mem_fn(&TestLogger::log), &logger, std::placeholders::_1,
589 std::placeholders::_2, std::placeholders::_3)};
590
591 {
592 std::string adItem = "ESEL=" + esel;
593 std::vector<std::string> additionalData{adItem};
594 std::vector<std::string> associations;
595
596 manager.create("error message", 37, 0,
597 phosphor::logging::Entry::Level::Error, additionalData,
598 associations);
599
600 auto data = manager.getPELFromOBMCID(37);
601 PEL pel{data};
602 EXPECT_TRUE(pel.valid());
603 }
604
605 // Now an invalid one
606 {
607 std::string adItem = "ESEL=" + esel;
608
609 // Crop it
610 adItem.resize(adItem.size() - 300);
611
612 std::vector<std::string> additionalData{adItem};
613 std::vector<std::string> associations;
614
615 manager.create("error message", 38, 0,
616 phosphor::logging::Entry::Level::Error, additionalData,
617 associations);
618
619 EXPECT_THROW(
620 manager.getPELFromOBMCID(38),
621 sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument);
622
623 // Run the event loop to log the bad PEL event
624 sdeventplus::Event e{sdEvent};
625 e.run(std::chrono::milliseconds(1));
626
627 EXPECT_EQ(logger.errName, "org.open_power.Logging.Error.BadHostPEL");
628 EXPECT_EQ(logger.errLevel, phosphor::logging::Entry::Level::Error);
629 }
630}
Matt Spinler7e727a32020-07-07 15:00:17 -0500631
632// Test that PELs will be pruned when necessary
633TEST_F(ManagerTest, TestPruning)
634{
635 sdeventplus::Event e{sdEvent};
636
637 std::unique_ptr<DataInterfaceBase> dataIface =
638 std::make_unique<MockDataInterface>();
639
640 openpower::pels::Manager manager{
641 logManager, std::move(dataIface),
642 std::bind(std::mem_fn(&TestLogger::log), &logger, std::placeholders::_1,
643 std::placeholders::_2, std::placeholders::_3)};
644
645 // Create 25 1000B (4096B on disk each, which is what is used for pruning)
646 // BMC non-informational PELs in the 100KB repository. After the 24th one,
647 // the repo will be 96% full and a prune should be triggered to remove all
648 // but 7 to get under 30% full. Then when the 25th is added there will be
649 // 8 left.
650
651 auto dir = makeTempDir();
652 for (int i = 1; i <= 25; i++)
653 {
654 auto data = pelFactory(42, 'O', 0x40, 0x8800, 1000);
655
656 fs::path pelFilename = dir / "rawpel";
657 std::ofstream pelFile{pelFilename};
658 pelFile.write(reinterpret_cast<const char*>(data.data()), data.size());
659 pelFile.close();
660
661 std::string adItem = "RAWPEL=" + pelFilename.string();
662 std::vector<std::string> additionalData{adItem};
663 std::vector<std::string> associations;
664
665 manager.create("error message", 42, 0,
666 phosphor::logging::Entry::Level::Error, additionalData,
667 associations);
668
669 // Simulate the code getting back to the event loop
670 // after each create.
671 e.run(std::chrono::milliseconds(1));
672
673 if (i < 24)
674 {
675 EXPECT_EQ(countPELsInRepo(), i);
676 }
677 else if (i == 24)
678 {
679 // Prune occured
680 EXPECT_EQ(countPELsInRepo(), 7);
681 }
682 else // i == 25
683 {
684 EXPECT_EQ(countPELsInRepo(), 8);
685 }
686 }
687
688 try
689 {
690 // Make sure the 8 newest ones are still found.
691 for (uint32_t i = 0; i < 8; i++)
692 {
693 manager.getPEL(0x50000012 + i);
694 }
695 }
696 catch (sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument& e)
697 {
698 ADD_FAILURE() << "PELs should have all been found";
699 }
700
701 fs::remove_all(dir);
702}
Matt Spinlerff9cec22020-07-15 13:06:35 -0500703
704// Test that manually deleting a PEL file will be recognized by the code.
705TEST_F(ManagerTest, TestPELManualDelete)
706{
707 sdeventplus::Event e{sdEvent};
708
709 std::unique_ptr<DataInterfaceBase> dataIface =
710 std::make_unique<MockDataInterface>();
711
712 openpower::pels::Manager manager{
713 logManager, std::move(dataIface),
714 std::bind(std::mem_fn(&TestLogger::log), &logger, std::placeholders::_1,
715 std::placeholders::_2, std::placeholders::_3)};
716
717 auto data = pelDataFactory(TestPELType::pelSimple);
718 auto dir = makeTempDir();
719 fs::path pelFilename = dir / "rawpel";
720
721 std::string adItem = "RAWPEL=" + pelFilename.string();
722 std::vector<std::string> additionalData{adItem};
723 std::vector<std::string> associations;
724
725 // Add 20 PELs, they will get incrementing IDs like
726 // 0x50000001, 0x50000002, etc.
727 for (int i = 1; i <= 20; i++)
728 {
729 std::ofstream pelFile{pelFilename};
730 pelFile.write(reinterpret_cast<const char*>(data.data()), data.size());
731 pelFile.close();
732
733 manager.create("error message", 42, 0,
734 phosphor::logging::Entry::Level::Error, additionalData,
735 associations);
736
737 // Sanity check this ID is really there so we can test
738 // it was deleted later. This will throw an exception if
739 // not present.
740 manager.getPEL(0x50000000 + i);
741
742 // Run an event loop pass where the internal FD is deleted
743 // after the getPEL function call.
744 e.run(std::chrono::milliseconds(1));
745 }
746
747 EXPECT_EQ(countPELsInRepo(), 20);
748
749 deletePELFile(0x50000001);
750
751 // Run a single event loop pass so the inotify event can run
752 e.run(std::chrono::milliseconds(1));
753
754 EXPECT_EQ(countPELsInRepo(), 19);
755
756 EXPECT_THROW(
757 manager.getPEL(0x50000001),
758 sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument);
759
760 // Delete a few more, they should all get handled in the same
761 // event loop pass
762 std::vector<uint32_t> toDelete{0x50000002, 0x50000003, 0x50000004,
763 0x50000005, 0x50000006};
764 std::for_each(toDelete.begin(), toDelete.end(),
765 [](auto i) { deletePELFile(i); });
766
767 e.run(std::chrono::milliseconds(1));
768
769 EXPECT_EQ(countPELsInRepo(), 14);
770
771 std::for_each(toDelete.begin(), toDelete.end(), [&manager](const auto i) {
772 EXPECT_THROW(
773 manager.getPEL(i),
774 sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument);
775 });
776
777 fs::remove_all(dir);
778}
779
780// Test that deleting all PELs at once is handled OK.
781TEST_F(ManagerTest, TestPELManualDeleteAll)
782{
783 sdeventplus::Event e{sdEvent};
784
785 std::unique_ptr<DataInterfaceBase> dataIface =
786 std::make_unique<MockDataInterface>();
787
788 openpower::pels::Manager manager{
789 logManager, std::move(dataIface),
790 std::bind(std::mem_fn(&TestLogger::log), &logger, std::placeholders::_1,
791 std::placeholders::_2, std::placeholders::_3)};
792
793 auto data = pelDataFactory(TestPELType::pelSimple);
794 auto dir = makeTempDir();
795 fs::path pelFilename = dir / "rawpel";
796
797 std::string adItem = "RAWPEL=" + pelFilename.string();
798 std::vector<std::string> additionalData{adItem};
799 std::vector<std::string> associations;
800
801 // Add 200 PELs, they will get incrementing IDs like
802 // 0x50000001, 0x50000002, etc.
803 for (int i = 1; i <= 200; i++)
804 {
805 std::ofstream pelFile{pelFilename};
806 pelFile.write(reinterpret_cast<const char*>(data.data()), data.size());
807 pelFile.close();
808
809 manager.create("error message", 42, 0,
810 phosphor::logging::Entry::Level::Error, additionalData,
811 associations);
812
813 // Sanity check this ID is really there so we can test
814 // it was deleted later. This will throw an exception if
815 // not present.
816 manager.getPEL(0x50000000 + i);
817
818 // Run an event loop pass where the internal FD is deleted
819 // after the getPEL function call.
820 e.run(std::chrono::milliseconds(1));
821 }
822
823 // Delete them all at once
824 auto logPath = getPELRepoPath() / "logs";
Sumit Kumar1d8835b2021-06-07 09:35:30 -0500825 std::string cmd = "rm " + logPath.string() + "/*_*";
Patrick Williamsd26fa3e2021-04-21 15:22:23 -0500826
827 {
828 auto rc = system(cmd.c_str());
829 EXPECT_EQ(rc, 0);
830 }
Matt Spinlerff9cec22020-07-15 13:06:35 -0500831
832 EXPECT_EQ(countPELsInRepo(), 0);
833
834 // It will take 5 event loop passes to process them all
835 for (int i = 0; i < 5; i++)
836 {
837 e.run(std::chrono::milliseconds(1));
838 }
839
840 for (int i = 1; i <= 200; i++)
841 {
842 EXPECT_THROW(
843 manager.getPEL(0x50000000 + i),
844 sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument);
845 }
846
847 fs::remove_all(dir);
848}
Matt Spinler3dd17e92020-08-05 15:04:27 -0500849
850// Test that fault LEDs are turned on when PELs are created
851TEST_F(ManagerTest, TestServiceIndicators)
852{
853 std::unique_ptr<DataInterfaceBase> dataIface =
854 std::make_unique<MockDataInterface>();
855
856 MockDataInterface* mockIface =
857 reinterpret_cast<MockDataInterface*>(dataIface.get());
858
859 openpower::pels::Manager manager{
860 logManager, std::move(dataIface),
861 std::bind(std::mem_fn(&TestLogger::log), &logger, std::placeholders::_1,
862 std::placeholders::_2, std::placeholders::_3)};
863
864 // Add a PEL with a callout as if hostboot added it
865 {
866 EXPECT_CALL(*mockIface, getInventoryFromLocCode("U42", 0, true))
867 .WillOnce(Return("/system/chassis/processor"));
868
Matt Spinler993168d2021-04-07 16:05:03 -0500869 EXPECT_CALL(*mockIface,
870 setFunctional("/system/chassis/processor", false))
Matt Spinler3dd17e92020-08-05 15:04:27 -0500871 .Times(1);
872
873 // This hostboot PEL has a single hardware callout in it.
874 auto data = pelFactory(1, 'B', 0x20, 0xA400, 500);
875
876 fs::path pelFilename = makeTempDir() / "rawpel";
877 std::ofstream pelFile{pelFilename};
878 pelFile.write(reinterpret_cast<const char*>(data.data()), data.size());
879 pelFile.close();
880
881 std::string adItem = "RAWPEL=" + pelFilename.string();
882 std::vector<std::string> additionalData{adItem};
883 std::vector<std::string> associations;
884
885 manager.create("error message", 42, 0,
886 phosphor::logging::Entry::Level::Error, additionalData,
887 associations);
888
889 fs::remove_all(pelFilename.parent_path());
890 }
891
892 // Add a BMC PEL with a callout that uses the message registry
893 {
894 std::vector<std::string> names{"systemA"};
895 EXPECT_CALL(*mockIface, getSystemNames)
896 .Times(1)
Matt Spinler1ab66962020-10-29 13:21:44 -0500897 .WillOnce(Return(names));
Matt Spinler3dd17e92020-08-05 15:04:27 -0500898
899 EXPECT_CALL(*mockIface, expandLocationCode("P42-C23", 0))
900 .WillOnce(Return("U42-P42-C23"));
901
902 // First call to this is when building the Callout section
903 EXPECT_CALL(*mockIface, getInventoryFromLocCode("P42-C23", 0, false))
904 .WillOnce(Return("/system/chassis/processor"));
905
906 // Second call to this is finding the associated LED group
907 EXPECT_CALL(*mockIface, getInventoryFromLocCode("U42-P42-C23", 0, true))
908 .WillOnce(Return("/system/chassis/processor"));
909
Matt Spinler993168d2021-04-07 16:05:03 -0500910 EXPECT_CALL(*mockIface,
911 setFunctional("/system/chassis/processor", false))
Matt Spinler3dd17e92020-08-05 15:04:27 -0500912 .Times(1);
913
914 const auto registry = R"(
915 {
916 "PELs":
917 [
918 {
919 "Name": "xyz.openbmc_project.Error.Test",
920 "Subsystem": "power_supply",
921 "ActionFlags": ["service_action", "report"],
922 "SRC":
923 {
924 "ReasonCode": "0x2030"
925 },
926 "Callouts": [
927 {
928 "CalloutList": [
929 {"Priority": "high", "LocCode": "P42-C23"}
930 ]
931 }
932 ],
933 "Documentation":
934 {
935 "Description": "Test Error",
936 "Message": "Test Error"
937 }
938 }
939 ]
940 })";
941
942 auto path = getPELReadOnlyDataPath();
943 fs::create_directories(path);
944 path /= "message_registry.json";
945
946 std::ofstream registryFile{path};
947 registryFile << registry;
948 registryFile.close();
949
950 std::vector<std::string> additionalData;
951 std::vector<std::string> associations;
952
953 manager.create("xyz.openbmc_project.Error.Test", 42, 0,
954 phosphor::logging::Entry::Level::Error, additionalData,
955 associations);
956 }
957}