Add error and metadata yaml for OCC metrics
This commit adds the error and metadata yaml for the OCC metrics
which would be logged when the host sends the ESEL info.
Change-Id: I0c1faba6d152f2bd4cbf504ece96eb36980f36ac
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/Makefile.am b/Makefile.am
index aa44203..7f3648f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,11 @@
liboemhandler_LTLIBRARIES = liboemhandler.la
liboemhandler_la_SOURCES = oemhandler.cpp \
- host-interface.cpp
+ host-interface.cpp \
+ org/open_power/OCC/Metrics/error.cpp
+
+BUILT_SOURCES = org/open_power/OCC/Metrics/error.hpp \
+ org/open_power/OCC/Metrics/error.cpp
liboemhandler_la_LDFLAGS = $(SYSTEMD_LIBS)\
$(SDBUSPLUS_LIBS) \
@@ -15,3 +19,11 @@
$(OPENPOWER_DBUS_INTERFACES_CFLAGS) \
$(PHOSPHOR_LOGGING_CFLAGS) \
$(AM_CXXFLAGS)
+
+org/open_power/OCC/Metrics/error.hpp: ${top_srcdir}/org/open_power/OCC/Metrics.errors.yaml
+ @mkdir -p `dirname $@`
+ $(SDBUSPLUSPLUS) -r $(top_srcdir) error exception-header org.open_power.OCC.Metrics > $@
+
+org/open_power/OCC/Metrics/error.cpp: ${top_srcdir}/org/open_power/OCC/Metrics.errors.yaml
+ @mkdir -p `dirname $@`
+ $(SDBUSPLUSPLUS) -r $(top_srcdir) error exception-cpp org.open_power.OCC.Metrics > $@
diff --git a/configure.ac b/configure.ac
index 2198682..5fa47b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,6 +19,14 @@
AC_CHECK_HEADER(host-ipmid/ipmid-api.h, ,[AC_MSG_ERROR([Could not find host-ipmid/ipmid-api.h...host-ipmid package required])])
PKG_CHECK_MODULES([OPENPOWER_DBUS_INTERFACES], [openpower-dbus-interfaces],,
[AC_MSG_ERROR([Could not find openpower-dbus-interfaces...openbmc/openpower-dbus-interfaces package required])])
+PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],,\
+ AC_MSG_ERROR(["Requires sdbusplus package."]))
+PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],,\
+ AC_MSG_ERROR(["Requires phosphor-logging package."]))
+
+# Check for sdbus++ tool
+AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
+AS_IF([test "x$SDBUSPLUSPLUS" == "x"], AC_MSG_ERROR([Cannot find sdbus++]))
# Checks for typedefs, structures, and compiler characteristics.
AX_CXX_COMPILE_STDCXX(14, [noext])
diff --git a/elog-errors.hpp b/elog-errors.hpp
new file mode 100644
index 0000000..6eb9e21
--- /dev/null
+++ b/elog-errors.hpp
@@ -0,0 +1,88 @@
+// This file was autogenerated. Do not edit!
+// See elog-gen.py for more details
+#pragma once
+
+#include <string>
+#include <tuple>
+#include <type_traits>
+#include <sdbusplus/exception.hpp>
+#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/elog.hpp>
+
+namespace sdbusplus
+{
+namespace org
+{
+namespace open_power
+{
+namespace OCC
+{
+namespace Metrics
+{
+namespace Error
+{
+ struct Event;
+} // namespace Error
+} // namespace Metrics
+} // namespace OCC
+} // namespace open_power
+} // namespace org
+} // namespace sdbusplus
+
+
+namespace phosphor
+{
+
+namespace logging
+{
+
+namespace org
+{
+namespace open_power
+{
+namespace OCC
+{
+namespace Metrics
+{
+namespace _Event
+{
+
+struct ESEL
+{
+ static constexpr auto str = "ESEL=%s";
+ static constexpr auto str_short = "ESEL";
+ using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
+ explicit constexpr ESEL(const char* a) : _entry(entry(str, a)) {};
+ type _entry;
+};
+
+} // namespace _Event
+
+struct Event
+{
+ static constexpr auto L = level::INFO;
+ using ESEL = _Event::ESEL;
+ using metadata_types = std::tuple<ESEL>;
+
+};
+
+} // namespace Metrics
+} // namespace OCC
+} // namespace open_power
+} // namespace org
+
+
+namespace details
+{
+
+template <>
+struct map_exception_type<sdbusplus::org::open_power::OCC::Metrics::Error::Event>
+{
+ using type = org::open_power::OCC::Metrics::Event;
+};
+
+}
+
+} // namespace logging
+
+} // namespace phosphor
diff --git a/org/open_power/OCC/Metrics.errors.yaml b/org/open_power/OCC/Metrics.errors.yaml
new file mode 100644
index 0000000..087a9ad
--- /dev/null
+++ b/org/open_power/OCC/Metrics.errors.yaml
@@ -0,0 +1,2 @@
+- name: Event
+ description: OCC Metrics Data
diff --git a/org/open_power/OCC/Metrics.metadata.yaml b/org/open_power/OCC/Metrics.metadata.yaml
new file mode 100644
index 0000000..7516c61
--- /dev/null
+++ b/org/open_power/OCC/Metrics.metadata.yaml
@@ -0,0 +1,5 @@
+- name: Event
+ level: INFO
+ meta:
+ - str: "ESEL=%s"
+ type: string