Add policy::Table class to Manager
As the data the class uses is system specific and has to be
defined by an external team, have the code default to not
using this class and allow it to be enabled with a configure
flag.
Change-Id: I28482981f3b23af1cf0545565bfb93d63ad47730
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/configure.ac b/configure.ac
index b58aebe..320b330 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,6 +47,22 @@
AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
)
+#The policy data must have been defined by the service folks
+#for it to be used, so allow its use to be configurable and
+#default it to off.
+AC_ARG_ENABLE([policy-interface],
+ AS_HELP_STRING([--enable-policy-interface],
+ [Enable the Policy D-Bus interface])
+)
+
+AC_ARG_VAR(USE_POLICY_INTERFACE, [If the Policy D-Bus interface should be created])
+
+AS_IF([test "x$enable_policy_interface" == "xyes"],
+ [USE_POLICY_INTERFACE="yes"]
+ AC_DEFINE_UNQUOTED([USE_POLICY_INTERFACE], ["$USE_POLICY_INTERFACE"],
+ [If the Policy D-Bus interface should be created])
+)
+
AC_DEFINE(LOGGING_PATH, "/xyz/openbmc_project/logging",
[The xyz log manager DBus object path])
AC_DEFINE(LOGGING_IFACE, "xyz.openbmc_project.Logging.Entry",
@@ -56,5 +72,9 @@
AC_DEFINE(IBM_LOGGING_BUSNAME, "com.ibm.Logging",
[The IBM log manager DBus busname to own])
+AC_ARG_VAR(POLICY_JSON_PATH, [The path to the policy json file])
+AS_IF([test "x$POLICY_JSON_PATH" == "x"], [POLICY_JSON_PATH="/usr/share/ibm-logging/policy.json"])
+AC_DEFINE_UNQUOTED([POLICY_JSON_PATH], ["$POLICY_JSON_PATH"], [The path to the policy json file on the BMC])
+
AC_CONFIG_FILES([Makefile test/Makefile])
AC_OUTPUT
diff --git a/manager.cpp b/manager.cpp
index 773ef08..978d8b6 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -35,6 +35,9 @@
sdbusplus::bus::match::rules::path_namespace(LOGGING_PATH),
std::bind(std::mem_fn(&Manager::interfaceRemoved),
this, std::placeholders::_1))
+#ifdef USE_POLICY_INTERFACE
+ , policies(POLICY_JSON_PATH)
+#endif
{
createAll();
}
diff --git a/manager.hpp b/manager.hpp
index 53441e6..0f44a2b 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -4,8 +4,12 @@
#include <experimental/filesystem>
#include <map>
#include <sdbusplus/bus.hpp>
+#include "config.h"
#include "dbus.hpp"
#include "interfaces.hpp"
+#ifdef USE_POLICY_INTERFACE
+#include "policy_table.hpp"
+#endif
namespace ibm
{
@@ -116,6 +120,13 @@
* There may be multiple interfaces per ID.
*/
EntryMap entries;
+
+#ifdef USE_POLICY_INTERFACE
+ /**
+ * The class the wraps the IBM error logging policy table.
+ */
+ policy::Table policies;
+#endif
};
}