entry: add AdditionalData2
Support metadata as dict property "AdditionalData2".
Tested: Created a new event and ensured property is created. Reloaded
the daemon with an old event and ensured property exists and is
populated.
```
.AdditionalData2 property a{ss} 8 "READING_VALUE" "98.6" "SENSOR_NAME" "Inlet Temperature" "THRESHOLD_VALUE" "40.0" "UNITS" "xyz.openbmc_project.Sensor.Value.Unit.DegreesC" "_CODE_FILE" "../log_create_main.cpp" "_CODE_FUNC" "int generate_event(const std::string&, const nlohmann::json_abi_v3_11_2::json&)" "_CODE_LINE" "34" "_PID" "2239596" emits-change writable
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I4f96370b9fb07664192e4fe09308cab170176213
diff --git a/elog_entry.hpp b/elog_entry.hpp
index d4fa5ae..4290a50 100644
--- a/elog_entry.hpp
+++ b/elog_entry.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include "util.hpp"
#include "xyz/openbmc_project/Logging/Entry/server.hpp"
#include "xyz/openbmc_project/Object/Delete/server.hpp"
#include "xyz/openbmc_project/Software/Version/server.hpp"
@@ -76,6 +77,7 @@
updateTimestamp(timestampErr, true);
message(std::move(msgErr), true);
additionalData(std::move(additionalDataErr), true);
+ additionalData2(util::additional_data::parse(additionalData()), true);
associations(std::move(objects), true);
// Store a copy of associations in case we need to recreate
assocs = associations();
diff --git a/elog_serialize.cpp b/elog_serialize.cpp
index 7d0a0aa..1fd5a1f 100644
--- a/elog_serialize.cpp
+++ b/elog_serialize.cpp
@@ -92,6 +92,7 @@
e.timestamp(timestamp, true);
e.message(message, true);
e.additionalData(additionalData, true);
+ e.additionalData2(util::additional_data::parse(additionalData), true);
e.sdbusplus::server::xyz::openbmc_project::logging::Entry::resolved(
resolved, true);
e.associations(associations, true);
diff --git a/test/serialization_test_properties.cpp b/test/serialization_test_properties.cpp
index 2c83f1e..d7d5455 100644
--- a/test/serialization_test_properties.cpp
+++ b/test/serialization_test_properties.cpp
@@ -36,6 +36,7 @@
EXPECT_EQ(input->timestamp(), output->timestamp());
EXPECT_EQ(input->message(), output->message());
EXPECT_EQ(input->additionalData(), output->additionalData());
+ EXPECT_EQ(input->additionalData2(), output->additionalData2());
EXPECT_EQ(input->resolved(), output->resolved());
EXPECT_EQ(input->associations(), output->associations());
EXPECT_EQ(input->version(), output->version());