PEL: Change method of asserting a fault LED

There was a recent change in direction on how PELs should request that
fault LEDs be turned on.  Previously, the code would talk to the LED
group objects directly.  The new direction is to set the Functional
property on the OperationalStatus interface on the inventory objects in
question to false, and the LED manager code will watch that to know when
to turn on the LEDs.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ieebb09ba002843cf863359a09aba26540356aa91
diff --git a/extensions/openpower-pels/data_interface.cpp b/extensions/openpower-pels/data_interface.cpp
index 518df8f..adea6c9 100644
--- a/extensions/openpower-pels/data_interface.cpp
+++ b/extensions/openpower-pels/data_interface.cpp
@@ -67,8 +67,9 @@
 constexpr auto compatible =
     "xyz.openbmc_project.Configuration.IBMCompatibleSystem";
 constexpr auto vpdManager = "com.ibm.VPD.Manager";
-constexpr auto association = "xyz.openbmc_project.Association";
 constexpr auto ledGroup = "xyz.openbmc_project.Led.Group";
+constexpr auto operationalStatus =
+    "xyz.openbmc_project.State.Decorator.OperationalStatus";
 } // namespace interface
 
 using namespace sdbusplus::xyz::openbmc_project::State::Boot::server;
@@ -409,24 +410,6 @@
     return shortest;
 }
 
-std::string
-    DataInterface::getFaultLEDGroup(const std::string& inventoryPath) const
-{
-    auto associationPath = inventoryPath + "/" + "fault_led_group";
-    auto service = getService(associationPath, interface::association);
-
-    DBusValue endpoints;
-    getProperty(service, associationPath, interface::association, "endpoints",
-                endpoints);
-    auto paths = std::get<std::vector<std::string>>(endpoints);
-    if (paths.empty())
-    {
-        throw std::runtime_error("Association endpoints property empty");
-    }
-
-    return paths[0];
-}
-
 void DataInterface::assertLEDGroup(const std::string& ledGroup,
                                    bool value) const
 {
@@ -438,6 +421,19 @@
     _bus.call(method);
 }
 
+void DataInterface::setFunctional(const std::string& objectPath,
+                                  bool value) const
+{
+    DBusValue variant = value;
+    auto service = getService(objectPath, interface::operationalStatus);
+
+    auto method = _bus.new_method_call(service.c_str(), objectPath.c_str(),
+                                       interface::dbusProperty, "Set");
+
+    method.append(interface::operationalStatus, "Functional", variant);
+    _bus.call(method);
+}
+
 std::vector<std::string> DataInterface::getSystemNames() const
 {
     DBusSubTree subtree;