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/service_indicators.cpp b/extensions/openpower-pels/service_indicators.cpp
index 7f795f9..1c9eff0 100644
--- a/extensions/openpower-pels/service_indicators.cpp
+++ b/extensions/openpower-pels/service_indicators.cpp
@@ -75,12 +75,11 @@
         auto locCodes = getLocationCodes(callouts);
         if (!locCodes.empty())
         {
-            // Find the LED groups for those location codes.
-            auto ledPaths = getLEDGroupPaths(locCodes);
-            if (!ledPaths.empty())
+            // Find the inventory paths for those location codes.
+            auto paths = getInventoryPaths(locCodes);
+            if (!paths.empty())
             {
-                // Tell the LED groups to assert their LEDs.
-                assertLEDs(ledPaths);
+                setNotFunctional(paths);
                 sai = false;
             }
         }
@@ -193,18 +192,19 @@
     return false;
 }
 
-std::vector<std::string> LightPath::getLEDGroupPaths(
+std::vector<std::string> LightPath::getInventoryPaths(
     const std::vector<std::string>& locationCodes) const
 {
-    std::vector<std::string> ledGroups;
+    std::vector<std::string> paths;
     std::string inventoryPath;
 
     for (const auto& locCode : locationCodes)
     {
         try
         {
-            inventoryPath =
+            auto inventoryPath =
                 _dataIface.getInventoryFromLocCode(locCode, 0, true);
+            paths.push_back(std::move(inventoryPath));
         }
         catch (const std::exception& e)
         {
@@ -213,43 +213,31 @@
                                         locCode, e.what())
                                 .c_str());
 
-            // Unless we can get the LEDs for all FRUs, we can't turn
+            // Unless we can set the LEDs for all FRUs, we can't turn
             // on any of them, so clear the list and quit.
-            ledGroups.clear();
-            break;
-        }
-
-        try
-        {
-            ledGroups.push_back(_dataIface.getFaultLEDGroup(inventoryPath));
-        }
-        catch (const std::exception& e)
-        {
-            log<level::ERR>(fmt::format("Could not get LED group path for "
-                                        "inventory path {} ({}).",
-                                        inventoryPath, e.what())
-                                .c_str());
-            ledGroups.clear();
+            paths.clear();
             break;
         }
     }
 
-    return ledGroups;
+    return paths;
 }
 
-void LightPath::assertLEDs(const std::vector<std::string>& ledGroups) const
+void LightPath::setNotFunctional(
+    const std::vector<std::string>& inventoryPaths) const
 {
-    for (const auto& ledGroup : ledGroups)
+    for (const auto& path : inventoryPaths)
     {
         try
         {
-            _dataIface.assertLEDGroup(ledGroup, true);
+            _dataIface.setFunctional(path, false);
         }
         catch (const std::exception& e)
         {
-            log<level::ERR>(fmt::format("Failed to assert LED group {} ({})",
-                                        ledGroup, e.what())
-                                .c_str());
+            log<level::INFO>(
+                fmt::format("Could not write Functional property on {} ({})",
+                            path, e.what())
+                    .c_str());
         }
     }
 }