PEL: Set platform SAI LED group

There is now an LED group to set when the platform SAI LED needs to be
asserted when handling the service indicators for PEL callouts.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I2af66c8c1820c131e1d4d7dede802b5f128b79a4
diff --git a/extensions/openpower-pels/service_indicators.cpp b/extensions/openpower-pels/service_indicators.cpp
index 3f934c7..7f795f9 100644
--- a/extensions/openpower-pels/service_indicators.cpp
+++ b/extensions/openpower-pels/service_indicators.cpp
@@ -25,6 +25,9 @@
 
 using namespace phosphor::logging;
 
+static constexpr auto platformSaiLedGroup =
+    "/xyz/openbmc_project/led/groups/platform_system_attention_indicator";
+
 std::unique_ptr<Policy> getPolicy(const DataInterfaceBase& dataIface)
 {
     // At the moment there is just one type of policy.
@@ -85,8 +88,17 @@
 
     if (sai)
     {
-        log<level::INFO>("The System Attention Indicator needs to be turned "
-                         "on, when available");
+        try
+        {
+            _dataIface.assertLEDGroup(platformSaiLedGroup, true);
+        }
+        catch (const std::exception& e)
+        {
+            log<level::ERR>(
+                fmt::format("Failed to assert platform SAI LED group: {}",
+                            e.what())
+                    .c_str());
+        }
     }
 }
 
diff --git a/test/openpower-pels/pel_utils.cpp b/test/openpower-pels/pel_utils.cpp
index 8da41ba..a42b0b9 100644
--- a/test/openpower-pels/pel_utils.cpp
+++ b/test/openpower-pels/pel_utils.cpp
@@ -39,7 +39,7 @@
 
     0x20, 0x30, 0x05, 0x09, 0x11, 0x1E, 0x1,  0x63, // create timestamp
     0x20, 0x31, 0x06, 0x0F, 0x09, 0x22, 0x3A, 0x00, // commit timestamp
-    0xAA,                                           // creatorID
+    0x4F,                                           // creatorID 'O'
     0x00,                                           // logtype
     0x00,                                           // reserved
     0x02,                                           // section count
diff --git a/test/openpower-pels/private_header_test.cpp b/test/openpower-pels/private_header_test.cpp
index 0349a94..31a1b61 100644
--- a/test/openpower-pels/private_header_test.cpp
+++ b/test/openpower-pels/private_header_test.cpp
@@ -63,7 +63,7 @@
     EXPECT_EQ(mt.seconds, 0x3A);
     EXPECT_EQ(mt.hundredths, 0x00);
 
-    EXPECT_EQ(ph.creatorID(), 0xAA);
+    EXPECT_EQ(ph.creatorID(), 0x4F);
     EXPECT_EQ(ph.logType(), 0x00);
     EXPECT_EQ(ph.sectionCount(), 0x02);
     EXPECT_EQ(ph.obmcLogID(), 0x90919293);
diff --git a/test/openpower-pels/service_indicators_test.cpp b/test/openpower-pels/service_indicators_test.cpp
index 8f1d9ab..f83edeb 100644
--- a/test/openpower-pels/service_indicators_test.cpp
+++ b/test/openpower-pels/service_indicators_test.cpp
@@ -282,7 +282,24 @@
         lightPath.activate(pel);
     }
 
-    // Make getInventoryFromLocCode fail
+    // A non-info BMC PEL with no callouts will set the platform SAI LED.
+    {
+        MockDataInterface dataIface;
+        service_indicators::LightPath lightPath{dataIface};
+
+        EXPECT_CALL(dataIface,
+                    assertLEDGroup("/xyz/openbmc_project/led/groups/"
+                                   "platform_system_attention_indicator",
+                                   true))
+            .Times(1);
+
+        auto data = pelDataFactory(TestPELType::pelSimple);
+        PEL pel{data};
+
+        lightPath.activate(pel);
+    }
+
+    // Make getInventoryFromLocCode fail - will set the platform SAI LED
     {
         MockDataInterface dataIface;
         service_indicators::LightPath lightPath{dataIface};
@@ -292,7 +309,11 @@
 
         EXPECT_CALL(dataIface, getFaultLEDGroup(_)).Times(0);
 
-        EXPECT_CALL(dataIface, assertLEDGroup(_, true)).Times(0);
+        EXPECT_CALL(dataIface,
+                    assertLEDGroup("/xyz/openbmc_project/led/groups/"
+                                   "platform_system_attention_indicator",
+                                   true))
+            .Times(1);
 
         auto data = pelFactory(1, 'O', 0x20, 0xA400, 500);
         PEL pel{data};
@@ -300,7 +321,7 @@
         lightPath.activate(pel);
     }
 
-    // Make getFaultLEDGroup fail
+    // Make getFaultLEDGroup fail - will set the platform SAI LED
     {
         MockDataInterface dataIface;
         service_indicators::LightPath lightPath{dataIface};
@@ -311,7 +332,11 @@
         EXPECT_CALL(dataIface, getFaultLEDGroup("/system/chassis/processor"))
             .WillOnce(Throw(std::runtime_error("Fail")));
 
-        EXPECT_CALL(dataIface, assertLEDGroup(_, true)).Times(0);
+        EXPECT_CALL(dataIface,
+                    assertLEDGroup("/xyz/openbmc_project/led/groups/"
+                                   "platform_system_attention_indicator",
+                                   true))
+            .Times(1);
 
         auto data = pelFactory(1, 'O', 0x20, 0xA400, 500);
         PEL pel{data};