regulators: Add detectPhaseFaults() to Chassis
Add a detectPhaseFaults() method to the Chassis class. This method
detects redundant phase faults in all regulator devices in the chassis.
Add a gtest test case to exercise the new code.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: Ie4efce27e4c96c2f77831434c94e07dcd5c3d7db
diff --git a/phosphor-regulators/src/chassis.cpp b/phosphor-regulators/src/chassis.cpp
index 425c20e..a8c8ed6 100644
--- a/phosphor-regulators/src/chassis.cpp
+++ b/phosphor-regulators/src/chassis.cpp
@@ -74,6 +74,15 @@
}
}
+void Chassis::detectPhaseFaults(Services& services, System& system)
+{
+ // Detect phase faults in each device
+ for (std::unique_ptr<Device>& device : devices)
+ {
+ device->detectPhaseFaults(services, system, *this);
+ }
+}
+
void Chassis::monitorSensors(Services& services, System& system)
{
// Monitor sensors in each device
diff --git a/phosphor-regulators/src/chassis.hpp b/phosphor-regulators/src/chassis.hpp
index 0ba4154..b0f8561 100644
--- a/phosphor-regulators/src/chassis.hpp
+++ b/phosphor-regulators/src/chassis.hpp
@@ -120,6 +120,16 @@
void configure(Services& services, System& system);
/**
+ * Detect redundant phase faults in regulator devices in this chassis.
+ *
+ * This method should be called every 15 seconds.
+ *
+ * @param services system services like error logging and the journal
+ * @param system system that contains this chassis
+ */
+ void detectPhaseFaults(Services& services, System& system);
+
+ /**
* Returns the devices within this chassis, if any.
*
* The vector contains regulator devices and any related devices