1*ee2ecbfaSAlexander Hansen #include "ledlayout.hpp" 2*ee2ecbfaSAlexander Hansen #include "manager.hpp" 3*ee2ecbfaSAlexander Hansen 4*ee2ecbfaSAlexander Hansen #include <sdbusplus/bus.hpp> 5*ee2ecbfaSAlexander Hansen #include <xyz/openbmc_project/Led/Physical/server.hpp> 6*ee2ecbfaSAlexander Hansen 7*ee2ecbfaSAlexander Hansen #include <set> 8*ee2ecbfaSAlexander Hansen 9*ee2ecbfaSAlexander Hansen #include <gtest/gtest.h> 10*ee2ecbfaSAlexander Hansen 11*ee2ecbfaSAlexander Hansen using namespace phosphor::led; 12*ee2ecbfaSAlexander Hansen class LedTest : public ::testing::Test 13*ee2ecbfaSAlexander Hansen { 14*ee2ecbfaSAlexander Hansen public: 15*ee2ecbfaSAlexander Hansen sdbusplus::bus_t bus; 16*ee2ecbfaSAlexander Hansen LedTest() : bus(sdbusplus::bus::new_default()) 17*ee2ecbfaSAlexander Hansen { 18*ee2ecbfaSAlexander Hansen // Nothing here 19*ee2ecbfaSAlexander Hansen } 20*ee2ecbfaSAlexander Hansen ~LedTest() 21*ee2ecbfaSAlexander Hansen { 22*ee2ecbfaSAlexander Hansen // Leaving up to auto cleanup. 23*ee2ecbfaSAlexander Hansen } 24*ee2ecbfaSAlexander Hansen }; 25*ee2ecbfaSAlexander Hansen 26*ee2ecbfaSAlexander Hansen static void assertMap(std::map<LedName, Layout::LedAction> map, 27*ee2ecbfaSAlexander Hansen std::map<LedName, Layout::Action> expect) 28*ee2ecbfaSAlexander Hansen { 29*ee2ecbfaSAlexander Hansen EXPECT_EQ(map.size(), expect.size()); 30*ee2ecbfaSAlexander Hansen for (auto& [key, expect_value] : expect) 31*ee2ecbfaSAlexander Hansen { 32*ee2ecbfaSAlexander Hansen ASSERT_TRUE(map.contains(key)); 33*ee2ecbfaSAlexander Hansen EXPECT_EQ(expect_value, map[key].action); 34*ee2ecbfaSAlexander Hansen } 35*ee2ecbfaSAlexander Hansen } 36*ee2ecbfaSAlexander Hansen 37*ee2ecbfaSAlexander Hansen static const phosphor::led::GroupMap groups1 = { 38*ee2ecbfaSAlexander Hansen {"/xyz/openbmc_project/ledmanager/groups/groupA", 39*ee2ecbfaSAlexander Hansen {0, 40*ee2ecbfaSAlexander Hansen { 41*ee2ecbfaSAlexander Hansen {"led1", Layout::Action::On, 0, 0, std::nullopt}, 42*ee2ecbfaSAlexander Hansen {"led2", Layout::Action::On, 0, 0, std::nullopt}, 43*ee2ecbfaSAlexander Hansen }}}, 44*ee2ecbfaSAlexander Hansen {"/xyz/openbmc_project/ledmanager/groups/groupB", 45*ee2ecbfaSAlexander Hansen {0, 46*ee2ecbfaSAlexander Hansen { 47*ee2ecbfaSAlexander Hansen {"led3", Layout::Action::On, 0, 0, std::nullopt}, 48*ee2ecbfaSAlexander Hansen {"led4", Layout::Action::On, 0, 0, std::nullopt}, 49*ee2ecbfaSAlexander Hansen }}}, 50*ee2ecbfaSAlexander Hansen }; 51*ee2ecbfaSAlexander Hansen 52*ee2ecbfaSAlexander Hansen /** @brief Assert one group*/ 53*ee2ecbfaSAlexander Hansen TEST_F(LedTest, assertOneGroup) 54*ee2ecbfaSAlexander Hansen { 55*ee2ecbfaSAlexander Hansen Manager manager(bus, groups1); 56*ee2ecbfaSAlexander Hansen 57*ee2ecbfaSAlexander Hansen std::set<const Layout::GroupLayout*> assertedGroups; 58*ee2ecbfaSAlexander Hansen 59*ee2ecbfaSAlexander Hansen Layout::GroupLayout mygroup = 60*ee2ecbfaSAlexander Hansen groups1.at("/xyz/openbmc_project/ledmanager/groups/groupA"); 61*ee2ecbfaSAlexander Hansen 62*ee2ecbfaSAlexander Hansen assertedGroups.insert(&mygroup); 63*ee2ecbfaSAlexander Hansen 64*ee2ecbfaSAlexander Hansen std::map<LedName, Layout::LedAction> map = 65*ee2ecbfaSAlexander Hansen manager.getNewMap(assertedGroups); 66*ee2ecbfaSAlexander Hansen 67*ee2ecbfaSAlexander Hansen assertMap(map, { 68*ee2ecbfaSAlexander Hansen {"led1", Layout::Action::On}, 69*ee2ecbfaSAlexander Hansen {"led2", Layout::Action::On}, 70*ee2ecbfaSAlexander Hansen }); 71*ee2ecbfaSAlexander Hansen } 72*ee2ecbfaSAlexander Hansen 73*ee2ecbfaSAlexander Hansen static const phosphor::led::GroupMap groups2 = { 74*ee2ecbfaSAlexander Hansen {"/xyz/openbmc_project/ledmanager/groups/groupA", 75*ee2ecbfaSAlexander Hansen {0, 76*ee2ecbfaSAlexander Hansen { 77*ee2ecbfaSAlexander Hansen {"led1", Layout::Action::On, 0, 0, std::nullopt}, 78*ee2ecbfaSAlexander Hansen {"led2", Layout::Action::On, 0, 0, std::nullopt}, 79*ee2ecbfaSAlexander Hansen }}}, 80*ee2ecbfaSAlexander Hansen {"/xyz/openbmc_project/ledmanager/groups/groupB", 81*ee2ecbfaSAlexander Hansen {2, 82*ee2ecbfaSAlexander Hansen { 83*ee2ecbfaSAlexander Hansen {"led2", Layout::Action::Off, 0, 0, std::nullopt}, 84*ee2ecbfaSAlexander Hansen {"led3", Layout::Action::On, 0, 0, std::nullopt}, 85*ee2ecbfaSAlexander Hansen }}}, 86*ee2ecbfaSAlexander Hansen {"/xyz/openbmc_project/ledmanager/groups/groupC", 87*ee2ecbfaSAlexander Hansen {1, 88*ee2ecbfaSAlexander Hansen { 89*ee2ecbfaSAlexander Hansen {"led3", Layout::Action::Blink, 0, 0, std::nullopt}, 90*ee2ecbfaSAlexander Hansen {"led4", Layout::Action::Blink, 0, 0, std::nullopt}, 91*ee2ecbfaSAlexander Hansen }}}, 92*ee2ecbfaSAlexander Hansen }; 93*ee2ecbfaSAlexander Hansen 94*ee2ecbfaSAlexander Hansen /** @brief Assert multiple groups which overwrite each other*/ 95*ee2ecbfaSAlexander Hansen TEST_F(LedTest, assertMultipleGroups) 96*ee2ecbfaSAlexander Hansen { 97*ee2ecbfaSAlexander Hansen Manager manager(bus, groups2); 98*ee2ecbfaSAlexander Hansen 99*ee2ecbfaSAlexander Hansen std::set<const Layout::GroupLayout*> assertedGroups; 100*ee2ecbfaSAlexander Hansen 101*ee2ecbfaSAlexander Hansen Layout::GroupLayout groupA = 102*ee2ecbfaSAlexander Hansen groups2.at("/xyz/openbmc_project/ledmanager/groups/groupA"); 103*ee2ecbfaSAlexander Hansen Layout::GroupLayout groupB = 104*ee2ecbfaSAlexander Hansen groups2.at("/xyz/openbmc_project/ledmanager/groups/groupB"); 105*ee2ecbfaSAlexander Hansen Layout::GroupLayout groupC = 106*ee2ecbfaSAlexander Hansen groups2.at("/xyz/openbmc_project/ledmanager/groups/groupC"); 107*ee2ecbfaSAlexander Hansen 108*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groupA); 109*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groupB); 110*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groupC); 111*ee2ecbfaSAlexander Hansen 112*ee2ecbfaSAlexander Hansen std::map<LedName, Layout::LedAction> map = 113*ee2ecbfaSAlexander Hansen manager.getNewMap(assertedGroups); 114*ee2ecbfaSAlexander Hansen 115*ee2ecbfaSAlexander Hansen assertMap(map, { 116*ee2ecbfaSAlexander Hansen {"led1", Layout::Action::On}, 117*ee2ecbfaSAlexander Hansen {"led2", Layout::Action::Off}, 118*ee2ecbfaSAlexander Hansen {"led3", Layout::Action::On}, 119*ee2ecbfaSAlexander Hansen {"led4", Layout::Action::Blink}, 120*ee2ecbfaSAlexander Hansen }); 121*ee2ecbfaSAlexander Hansen } 122*ee2ecbfaSAlexander Hansen 123*ee2ecbfaSAlexander Hansen TEST_F(LedTest, test_OCP_Panel_Indicator_6_1_System_Power_Status) 124*ee2ecbfaSAlexander Hansen { 125*ee2ecbfaSAlexander Hansen const int dutyon = 50; // Spec says 50% duty cycle 126*ee2ecbfaSAlexander Hansen const int period = 1; // Spec says 1Hz 127*ee2ecbfaSAlexander Hansen 128*ee2ecbfaSAlexander Hansen // Example from OCP Panel Indicator Specification rev 1.0, Section 6.1 129*ee2ecbfaSAlexander Hansen // "System Power Control / Status" 130*ee2ecbfaSAlexander Hansen // The group priorities here are chosen arbitrarily, assuming that locating 131*ee2ecbfaSAlexander Hansen // the hw has highest priority 132*ee2ecbfaSAlexander Hansen const std::string groupOffServiceAction = 133*ee2ecbfaSAlexander Hansen "/xyz/openbmc_project/ledmanager/groups/SysOffServiceAction"; 134*ee2ecbfaSAlexander Hansen const std::string groupSysOnOk = 135*ee2ecbfaSAlexander Hansen "/xyz/openbmc_project/ledmanager/groups/SysOnOK"; 136*ee2ecbfaSAlexander Hansen const std::string groupSysOffFault = 137*ee2ecbfaSAlexander Hansen "/xyz/openbmc_project/ledmanager/groups/SysOffFault"; 138*ee2ecbfaSAlexander Hansen const std::string groupSysOnLocate = 139*ee2ecbfaSAlexander Hansen "/xyz/openbmc_project/ledmanager/groups/SysOnLocate"; 140*ee2ecbfaSAlexander Hansen const std::string groupSysOffLocate = 141*ee2ecbfaSAlexander Hansen "/xyz/openbmc_project/ledmanager/groups/SysOffLocate"; 142*ee2ecbfaSAlexander Hansen const std::string groupSysOnFault = 143*ee2ecbfaSAlexander Hansen "/xyz/openbmc_project/ledmanager/groups/SysOnFault"; 144*ee2ecbfaSAlexander Hansen 145*ee2ecbfaSAlexander Hansen const std::string pwr = "pwr"; 146*ee2ecbfaSAlexander Hansen const std::string fault = "fault"; 147*ee2ecbfaSAlexander Hansen 148*ee2ecbfaSAlexander Hansen static const phosphor::led::GroupMap groups_ocp_6_1_power_control = { 149*ee2ecbfaSAlexander Hansen {groupOffServiceAction, 150*ee2ecbfaSAlexander Hansen {2, 151*ee2ecbfaSAlexander Hansen { 152*ee2ecbfaSAlexander Hansen {pwr, Layout::Action::Off, 0, 0, std::nullopt}, 153*ee2ecbfaSAlexander Hansen {fault, Layout::Action::Off, 0, 0, std::nullopt}, 154*ee2ecbfaSAlexander Hansen }}}, 155*ee2ecbfaSAlexander Hansen {groupSysOnOk, 156*ee2ecbfaSAlexander Hansen {3, 157*ee2ecbfaSAlexander Hansen { 158*ee2ecbfaSAlexander Hansen {pwr, Layout::Action::On, 0, 0, std::nullopt}, 159*ee2ecbfaSAlexander Hansen {fault, Layout::Action::Off, 0, 0, std::nullopt}, 160*ee2ecbfaSAlexander Hansen }}}, 161*ee2ecbfaSAlexander Hansen {groupSysOffFault, 162*ee2ecbfaSAlexander Hansen {38, 163*ee2ecbfaSAlexander Hansen { 164*ee2ecbfaSAlexander Hansen {pwr, Layout::Action::Off, 0, 0, std::nullopt}, 165*ee2ecbfaSAlexander Hansen {fault, Layout::Action::On, 0, 0, std::nullopt}, 166*ee2ecbfaSAlexander Hansen }}}, 167*ee2ecbfaSAlexander Hansen {groupSysOnLocate, 168*ee2ecbfaSAlexander Hansen {99, 169*ee2ecbfaSAlexander Hansen { 170*ee2ecbfaSAlexander Hansen {pwr, Layout::Action::On, 0, 0, std::nullopt}, 171*ee2ecbfaSAlexander Hansen {fault, Layout::Action::Blink, dutyon, period, std::nullopt}, 172*ee2ecbfaSAlexander Hansen }}}, 173*ee2ecbfaSAlexander Hansen {groupSysOffLocate, 174*ee2ecbfaSAlexander Hansen {98, 175*ee2ecbfaSAlexander Hansen { 176*ee2ecbfaSAlexander Hansen {pwr, Layout::Action::Off, 0, 0, std::nullopt}, 177*ee2ecbfaSAlexander Hansen {fault, Layout::Action::Blink, dutyon, period, std::nullopt}, 178*ee2ecbfaSAlexander Hansen }}}, 179*ee2ecbfaSAlexander Hansen {groupSysOnFault, 180*ee2ecbfaSAlexander Hansen {39, 181*ee2ecbfaSAlexander Hansen { 182*ee2ecbfaSAlexander Hansen {pwr, Layout::Action::On, 0, 0, std::nullopt}, 183*ee2ecbfaSAlexander Hansen {fault, Layout::Action::On, 0, 0, std::nullopt}, 184*ee2ecbfaSAlexander Hansen }}}, 185*ee2ecbfaSAlexander Hansen }; 186*ee2ecbfaSAlexander Hansen 187*ee2ecbfaSAlexander Hansen const phosphor::led::GroupMap* groups = &groups_ocp_6_1_power_control; 188*ee2ecbfaSAlexander Hansen 189*ee2ecbfaSAlexander Hansen Manager manager(bus, *groups); 190*ee2ecbfaSAlexander Hansen 191*ee2ecbfaSAlexander Hansen std::set<const Layout::GroupLayout*> assertedGroups; 192*ee2ecbfaSAlexander Hansen 193*ee2ecbfaSAlexander Hansen // Off Service Action 194*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groups->at(groupOffServiceAction)); 195*ee2ecbfaSAlexander Hansen 196*ee2ecbfaSAlexander Hansen assertMap(manager.getNewMap(assertedGroups), 197*ee2ecbfaSAlexander Hansen { 198*ee2ecbfaSAlexander Hansen {pwr, Layout::Action::Off}, 199*ee2ecbfaSAlexander Hansen {fault, Layout::Action::Off}, 200*ee2ecbfaSAlexander Hansen }); 201*ee2ecbfaSAlexander Hansen 202*ee2ecbfaSAlexander Hansen // On Ok 203*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groups->at(groupSysOnOk)); 204*ee2ecbfaSAlexander Hansen assertMap(manager.getNewMap(assertedGroups), 205*ee2ecbfaSAlexander Hansen { 206*ee2ecbfaSAlexander Hansen {pwr, Layout::Action::On}, 207*ee2ecbfaSAlexander Hansen {fault, Layout::Action::Off}, 208*ee2ecbfaSAlexander Hansen }); 209*ee2ecbfaSAlexander Hansen 210*ee2ecbfaSAlexander Hansen // Off Fault 211*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groups->at(groupSysOffFault)); 212*ee2ecbfaSAlexander Hansen assertMap(manager.getNewMap(assertedGroups), 213*ee2ecbfaSAlexander Hansen { 214*ee2ecbfaSAlexander Hansen {pwr, Layout::Action::Off}, 215*ee2ecbfaSAlexander Hansen {fault, Layout::Action::On}, 216*ee2ecbfaSAlexander Hansen }); 217*ee2ecbfaSAlexander Hansen 218*ee2ecbfaSAlexander Hansen // Off Fault 219*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groups->at(groupSysOffFault)); 220*ee2ecbfaSAlexander Hansen assertMap(manager.getNewMap(assertedGroups), 221*ee2ecbfaSAlexander Hansen { 222*ee2ecbfaSAlexander Hansen {pwr, Layout::Action::Off}, 223*ee2ecbfaSAlexander Hansen {fault, Layout::Action::On}, 224*ee2ecbfaSAlexander Hansen }); 225*ee2ecbfaSAlexander Hansen 226*ee2ecbfaSAlexander Hansen // On Fault 227*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groups->at(groupSysOnFault)); 228*ee2ecbfaSAlexander Hansen assertMap(manager.getNewMap(assertedGroups), 229*ee2ecbfaSAlexander Hansen { 230*ee2ecbfaSAlexander Hansen {pwr, Layout::Action::On}, 231*ee2ecbfaSAlexander Hansen {fault, Layout::Action::On}, 232*ee2ecbfaSAlexander Hansen }); 233*ee2ecbfaSAlexander Hansen 234*ee2ecbfaSAlexander Hansen // Off Locate 235*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groups->at(groupSysOffLocate)); 236*ee2ecbfaSAlexander Hansen assertMap(manager.getNewMap(assertedGroups), 237*ee2ecbfaSAlexander Hansen { 238*ee2ecbfaSAlexander Hansen {pwr, Layout::Action::Off}, 239*ee2ecbfaSAlexander Hansen {fault, Layout::Action::Blink}, 240*ee2ecbfaSAlexander Hansen }); 241*ee2ecbfaSAlexander Hansen 242*ee2ecbfaSAlexander Hansen // On Locate 243*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groups->at(groupSysOnLocate)); 244*ee2ecbfaSAlexander Hansen assertMap(manager.getNewMap(assertedGroups), 245*ee2ecbfaSAlexander Hansen { 246*ee2ecbfaSAlexander Hansen {pwr, Layout::Action::On}, 247*ee2ecbfaSAlexander Hansen {fault, Layout::Action::Blink}, 248*ee2ecbfaSAlexander Hansen }); 249*ee2ecbfaSAlexander Hansen } 250*ee2ecbfaSAlexander Hansen 251*ee2ecbfaSAlexander Hansen TEST_F(LedTest, test_OCP_Panel_Indicator_6_5_BBU_status) 252*ee2ecbfaSAlexander Hansen { 253*ee2ecbfaSAlexander Hansen // Example from OCP Panel Indicator Specification rev 1.0, Section 6.5 254*ee2ecbfaSAlexander Hansen // "BBU Status" 255*ee2ecbfaSAlexander Hansen // The group priorities here are chosen arbitrarily, assuming that locating 256*ee2ecbfaSAlexander Hansen // the hw has highest priority 257*ee2ecbfaSAlexander Hansen const std::string gBBUSleep = 258*ee2ecbfaSAlexander Hansen "/xyz/openbmc_project/ledmanager/groups/BBUSleep"; 259*ee2ecbfaSAlexander Hansen const std::string gBBUOn = "/xyz/openbmc_project/ledmanager/groups/BBUOn"; 260*ee2ecbfaSAlexander Hansen const std::string gBBUFault = 261*ee2ecbfaSAlexander Hansen "/xyz/openbmc_project/ledmanager/groups/BBUFault"; 262*ee2ecbfaSAlexander Hansen const std::string gBBUUnderVolt = 263*ee2ecbfaSAlexander Hansen "/xyz/openbmc_project/ledmanager/groups/BBUUnderVolt"; 264*ee2ecbfaSAlexander Hansen const std::string gBBUEOL = "/xyz/openbmc_project/ledmanager/groups/BBUEOL"; 265*ee2ecbfaSAlexander Hansen const std::string gBBUOffLocate = 266*ee2ecbfaSAlexander Hansen "/xyz/openbmc_project/ledmanager/groups/BBUOffLocate"; 267*ee2ecbfaSAlexander Hansen const std::string gBBUOnLocate = 268*ee2ecbfaSAlexander Hansen "/xyz/openbmc_project/ledmanager/groups/BBUOnLocate"; 269*ee2ecbfaSAlexander Hansen 270*ee2ecbfaSAlexander Hansen const std::string bbu_ok = "bbu_ok"; 271*ee2ecbfaSAlexander Hansen const std::string bbu_fault = "bbu_fault"; 272*ee2ecbfaSAlexander Hansen const std::string bbu_lowv = "bbu_lowv"; 273*ee2ecbfaSAlexander Hansen const std::string bbu_eol = "bbu_eol"; 274*ee2ecbfaSAlexander Hansen 275*ee2ecbfaSAlexander Hansen static const phosphor::led::GroupMap groups_ocp_6_5_bbu_status = { 276*ee2ecbfaSAlexander Hansen {gBBUSleep, 277*ee2ecbfaSAlexander Hansen {9, 278*ee2ecbfaSAlexander Hansen { 279*ee2ecbfaSAlexander Hansen {bbu_ok, Layout::Action::Off, 0, 0, std::nullopt}, 280*ee2ecbfaSAlexander Hansen {bbu_fault, Layout::Action::Off, 0, 0, std::nullopt}, 281*ee2ecbfaSAlexander Hansen {bbu_lowv, Layout::Action::Off, 0, 0, std::nullopt}, 282*ee2ecbfaSAlexander Hansen {bbu_eol, Layout::Action::Off, 0, 0, std::nullopt}, 283*ee2ecbfaSAlexander Hansen }}}, 284*ee2ecbfaSAlexander Hansen {gBBUOn, 285*ee2ecbfaSAlexander Hansen {10, 286*ee2ecbfaSAlexander Hansen { 287*ee2ecbfaSAlexander Hansen {bbu_ok, Layout::Action::On, 0, 0, std::nullopt}, 288*ee2ecbfaSAlexander Hansen {bbu_fault, Layout::Action::Off, 0, 0, std::nullopt}, 289*ee2ecbfaSAlexander Hansen {bbu_lowv, Layout::Action::Off, 0, 0, std::nullopt}, 290*ee2ecbfaSAlexander Hansen {bbu_eol, Layout::Action::Off, 0, 0, std::nullopt}, 291*ee2ecbfaSAlexander Hansen }}}, 292*ee2ecbfaSAlexander Hansen {gBBUFault, 293*ee2ecbfaSAlexander Hansen {38, 294*ee2ecbfaSAlexander Hansen { 295*ee2ecbfaSAlexander Hansen {bbu_ok, Layout::Action::Off, 0, 0, std::nullopt}, 296*ee2ecbfaSAlexander Hansen {bbu_fault, Layout::Action::On, 0, 0, std::nullopt}, 297*ee2ecbfaSAlexander Hansen {bbu_lowv, Layout::Action::Off, 0, 0, std::nullopt}, 298*ee2ecbfaSAlexander Hansen {bbu_eol, Layout::Action::Off, 0, 0, std::nullopt}, 299*ee2ecbfaSAlexander Hansen }}}, 300*ee2ecbfaSAlexander Hansen {gBBUUnderVolt, 301*ee2ecbfaSAlexander Hansen {39, 302*ee2ecbfaSAlexander Hansen { 303*ee2ecbfaSAlexander Hansen {bbu_ok, Layout::Action::Off, 0, 0, std::nullopt}, 304*ee2ecbfaSAlexander Hansen {bbu_fault, Layout::Action::On, 0, 0, std::nullopt}, 305*ee2ecbfaSAlexander Hansen {bbu_lowv, Layout::Action::On, 0, 0, std::nullopt}, 306*ee2ecbfaSAlexander Hansen {bbu_eol, Layout::Action::Off, 0, 0, std::nullopt}, 307*ee2ecbfaSAlexander Hansen }}}, 308*ee2ecbfaSAlexander Hansen {gBBUEOL, 309*ee2ecbfaSAlexander Hansen {40, 310*ee2ecbfaSAlexander Hansen { 311*ee2ecbfaSAlexander Hansen {bbu_ok, Layout::Action::Off, 0, 0, std::nullopt}, 312*ee2ecbfaSAlexander Hansen {bbu_fault, Layout::Action::On, 0, 0, std::nullopt}, 313*ee2ecbfaSAlexander Hansen {bbu_lowv, Layout::Action::Off, 0, 0, std::nullopt}, 314*ee2ecbfaSAlexander Hansen {bbu_eol, Layout::Action::On, 0, 0, std::nullopt}, 315*ee2ecbfaSAlexander Hansen }}}, 316*ee2ecbfaSAlexander Hansen {gBBUOffLocate, 317*ee2ecbfaSAlexander Hansen {98, 318*ee2ecbfaSAlexander Hansen { 319*ee2ecbfaSAlexander Hansen {bbu_ok, Layout::Action::Off, 0, 0, std::nullopt}, 320*ee2ecbfaSAlexander Hansen {bbu_fault, Layout::Action::Blink, 0, 0, std::nullopt}, 321*ee2ecbfaSAlexander Hansen {bbu_lowv, Layout::Action::Off, 0, 0, std::nullopt}, 322*ee2ecbfaSAlexander Hansen {bbu_eol, Layout::Action::Off, 0, 0, std::nullopt}, 323*ee2ecbfaSAlexander Hansen }}}, 324*ee2ecbfaSAlexander Hansen {gBBUOnLocate, 325*ee2ecbfaSAlexander Hansen {99, 326*ee2ecbfaSAlexander Hansen { 327*ee2ecbfaSAlexander Hansen {bbu_ok, Layout::Action::On, 0, 0, std::nullopt}, 328*ee2ecbfaSAlexander Hansen {bbu_fault, Layout::Action::Blink, 0, 0, std::nullopt}, 329*ee2ecbfaSAlexander Hansen {bbu_lowv, Layout::Action::Off, 0, 0, std::nullopt}, 330*ee2ecbfaSAlexander Hansen {bbu_eol, Layout::Action::Off, 0, 0, std::nullopt}, 331*ee2ecbfaSAlexander Hansen }}}, 332*ee2ecbfaSAlexander Hansen }; 333*ee2ecbfaSAlexander Hansen 334*ee2ecbfaSAlexander Hansen const phosphor::led::GroupMap* groups = &groups_ocp_6_5_bbu_status; 335*ee2ecbfaSAlexander Hansen 336*ee2ecbfaSAlexander Hansen Manager manager(bus, *groups); 337*ee2ecbfaSAlexander Hansen 338*ee2ecbfaSAlexander Hansen std::set<const Layout::GroupLayout*> assertedGroups; 339*ee2ecbfaSAlexander Hansen 340*ee2ecbfaSAlexander Hansen // Sleep 341*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groups->at(gBBUSleep)); 342*ee2ecbfaSAlexander Hansen assertMap(manager.getNewMap(assertedGroups), 343*ee2ecbfaSAlexander Hansen { 344*ee2ecbfaSAlexander Hansen {bbu_ok, Layout::Action::Off}, 345*ee2ecbfaSAlexander Hansen {bbu_fault, Layout::Action::Off}, 346*ee2ecbfaSAlexander Hansen {bbu_lowv, Layout::Action::Off}, 347*ee2ecbfaSAlexander Hansen {bbu_eol, Layout::Action::Off}, 348*ee2ecbfaSAlexander Hansen }); 349*ee2ecbfaSAlexander Hansen 350*ee2ecbfaSAlexander Hansen // Fault 351*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groups->at(gBBUFault)); 352*ee2ecbfaSAlexander Hansen assertMap(manager.getNewMap(assertedGroups), 353*ee2ecbfaSAlexander Hansen { 354*ee2ecbfaSAlexander Hansen {bbu_ok, Layout::Action::Off}, 355*ee2ecbfaSAlexander Hansen {bbu_fault, Layout::Action::On}, 356*ee2ecbfaSAlexander Hansen {bbu_lowv, Layout::Action::Off}, 357*ee2ecbfaSAlexander Hansen {bbu_eol, Layout::Action::Off}, 358*ee2ecbfaSAlexander Hansen }); 359*ee2ecbfaSAlexander Hansen 360*ee2ecbfaSAlexander Hansen // EOL 361*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groups->at(gBBUEOL)); 362*ee2ecbfaSAlexander Hansen assertMap(manager.getNewMap(assertedGroups), 363*ee2ecbfaSAlexander Hansen { 364*ee2ecbfaSAlexander Hansen {bbu_ok, Layout::Action::Off}, 365*ee2ecbfaSAlexander Hansen {bbu_fault, Layout::Action::On}, 366*ee2ecbfaSAlexander Hansen {bbu_lowv, Layout::Action::Off}, 367*ee2ecbfaSAlexander Hansen {bbu_eol, Layout::Action::On}, 368*ee2ecbfaSAlexander Hansen }); 369*ee2ecbfaSAlexander Hansen 370*ee2ecbfaSAlexander Hansen // On + Locate 371*ee2ecbfaSAlexander Hansen assertedGroups.insert(&groups->at(gBBUOnLocate)); 372*ee2ecbfaSAlexander Hansen assertMap(manager.getNewMap(assertedGroups), 373*ee2ecbfaSAlexander Hansen { 374*ee2ecbfaSAlexander Hansen {bbu_ok, Layout::Action::On}, 375*ee2ecbfaSAlexander Hansen {bbu_fault, Layout::Action::Blink}, 376*ee2ecbfaSAlexander Hansen {bbu_lowv, Layout::Action::Off}, 377*ee2ecbfaSAlexander Hansen {bbu_eol, Layout::Action::Off}, 378*ee2ecbfaSAlexander Hansen }); 379*ee2ecbfaSAlexander Hansen } 380