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