summaryrefslogtreecommitdiffstats
path: root/src/resolve_errors.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolve_errors.cpp')
-rw-r--r--src/resolve_errors.cpp52
1 files changed, 51 insertions, 1 deletions
diff --git a/src/resolve_errors.cpp b/src/resolve_errors.cpp
index c08e489..6f3c4be 100644
--- a/src/resolve_errors.cpp
+++ b/src/resolve_errors.cpp
@@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <phosphor-logging/log.hpp>
#include "resolve_errors.hpp"
+#include "sdbusplus.hpp"
namespace phosphor
{
@@ -22,9 +24,57 @@ namespace dbus
namespace monitoring
{
+constexpr auto PROPERTY_IFACE = "org.freedesktop.DBus.Properties";
+constexpr auto ASSOCIATION_IFACE = "org.openbmc.Association";
+constexpr auto ENDPOINTS_PROPERTY = "endpoints";
+
+using namespace phosphor::logging;
+using EndpointList = std::vector<std::string>;
+using EndpointsProperty = sdbusplus::message::variant<EndpointList>;
+
void ResolveCallout::operator()()
{
- //TODO: fill in
+ //Resolve all errors for this callout:
+ // 1) Read the 'endpoints' property for the callout/fault object
+ //
+ // 2) Follow each endpoint to its log entry
+ //
+ // 3) Set the Resolved property to true on the entry
+
+ try
+ {
+ auto path = callout + "/fault";
+ auto busName = SDBusPlus::getBusName(path, ASSOCIATION_IFACE);
+
+ if (busName.empty())
+ {
+ //Just means there are no error logs with this callout
+ return;
+ }
+
+ auto endpoints = SDBusPlus::callMethodAndRead<EndpointsProperty>(
+ busName,
+ path,
+ PROPERTY_IFACE,
+ "Get",
+ ASSOCIATION_IFACE,
+ ENDPOINTS_PROPERTY);
+
+ const auto& logEntries = endpoints.get<EndpointList>();
+
+ //Resolve each log entry
+ for (const auto& logEntry : logEntries)
+ {
+ resolve(logEntry);
+ }
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>(
+ "Failed getting callout fault associations",
+ entry("CALLOUT=%s", callout.c_str()),
+ entry("MESSAGE=%s", e.what()));
+ }
}
void ResolveCallout::resolve(const std::string& logEntry)
OpenPOWER on IntegriCloud