blob: 441bbfe0a280a4f79a13b02c330420a4498936f1 [file] [log] [blame]
Shawn McCarneyc3991f12020-04-05 13:16:06 -05001/**
2 * Copyright © 2020 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Shawn McCarney17bac892021-05-08 07:55:52 -050016#include "action.hpp"
Shawn McCarneyc3991f12020-04-05 13:16:06 -050017#include "chassis.hpp"
Shawn McCarney17bac892021-05-08 07:55:52 -050018#include "configuration.hpp"
Shawn McCarneydb0b8332020-04-06 14:13:04 -050019#include "device.hpp"
Shawn McCarney17bac892021-05-08 07:55:52 -050020#include "i2c_interface.hpp"
Shawn McCarneydb0b8332020-04-06 14:13:04 -050021#include "id_map.hpp"
Shawn McCarney17bac892021-05-08 07:55:52 -050022#include "mock_action.hpp"
Shawn McCarney23b0d0d2021-05-14 15:27:59 -050023#include "mock_error_logging.hpp"
Shawn McCarney2af52892020-04-14 11:54:45 -050024#include "mock_journal.hpp"
Shawn McCarney17bac892021-05-08 07:55:52 -050025#include "mock_sensors.hpp"
Bob King23243f82020-07-29 10:38:57 +080026#include "mock_services.hpp"
Bob King8e2294d2020-07-14 17:41:31 +080027#include "mocked_i2c_interface.hpp"
Shawn McCarney17bac892021-05-08 07:55:52 -050028#include "presence_detection.hpp"
Shawn McCarneydb0b8332020-04-06 14:13:04 -050029#include "rail.hpp"
Shawn McCarneyc3991f12020-04-05 13:16:06 -050030#include "rule.hpp"
Shawn McCarney17bac892021-05-08 07:55:52 -050031#include "sensor_monitoring.hpp"
Shawn McCarney2f9e14f2021-04-29 02:45:18 -050032#include "sensors.hpp"
Bob King5cfe5102020-07-30 16:26:18 +080033#include "services.hpp"
Shawn McCarneyc3991f12020-04-05 13:16:06 -050034#include "system.hpp"
Shawn McCarney23b0d0d2021-05-14 15:27:59 -050035#include "test_sdbus_error.hpp"
Shawn McCarneydb0b8332020-04-06 14:13:04 -050036#include "test_utils.hpp"
Shawn McCarneyc3991f12020-04-05 13:16:06 -050037
38#include <memory>
Shawn McCarneydb0b8332020-04-06 14:13:04 -050039#include <stdexcept>
Shawn McCarney2af52892020-04-14 11:54:45 -050040#include <string>
Shawn McCarneyc3991f12020-04-05 13:16:06 -050041#include <utility>
42#include <vector>
43
Bob King8e2294d2020-07-14 17:41:31 +080044#include <gmock/gmock.h>
Shawn McCarneyc3991f12020-04-05 13:16:06 -050045#include <gtest/gtest.h>
46
47using namespace phosphor::power::regulators;
Shawn McCarneydb0b8332020-04-06 14:13:04 -050048using namespace phosphor::power::regulators::test_utils;
Shawn McCarneyc3991f12020-04-05 13:16:06 -050049
Bob King8e2294d2020-07-14 17:41:31 +080050using ::testing::A;
51using ::testing::Return;
Shawn McCarney23b0d0d2021-05-14 15:27:59 -050052using ::testing::Throw;
Bob King8e2294d2020-07-14 17:41:31 +080053using ::testing::TypedEq;
54
Shawn McCarneycb3f6a62021-04-30 10:54:30 -050055static const std::string chassisInvPath{
56 "/xyz/openbmc_project/inventory/system/chassis"};
57
Shawn McCarneyc3991f12020-04-05 13:16:06 -050058TEST(SystemTests, Constructor)
59{
60 // Create Rules
61 std::vector<std::unique_ptr<Rule>> rules{};
Shawn McCarneydb0b8332020-04-06 14:13:04 -050062 rules.emplace_back(createRule("set_voltage_rule"));
Shawn McCarneyc3991f12020-04-05 13:16:06 -050063
64 // Create Chassis
65 std::vector<std::unique_ptr<Chassis>> chassis{};
Shawn McCarneydb0b8332020-04-06 14:13:04 -050066 std::vector<std::unique_ptr<Device>> devices{};
67 devices.emplace_back(createDevice("reg1", {"rail1"}));
Shawn McCarneycb3f6a62021-04-30 10:54:30 -050068 chassis.emplace_back(
69 std::make_unique<Chassis>(1, chassisInvPath, std::move(devices)));
Shawn McCarneyc3991f12020-04-05 13:16:06 -050070
71 // Create System
72 System system{std::move(rules), std::move(chassis)};
73 EXPECT_EQ(system.getChassis().size(), 1);
74 EXPECT_EQ(system.getChassis()[0]->getNumber(), 1);
Shawn McCarneydb0b8332020-04-06 14:13:04 -050075 EXPECT_NO_THROW(system.getIDMap().getRule("set_voltage_rule"));
76 EXPECT_NO_THROW(system.getIDMap().getDevice("reg1"));
77 EXPECT_NO_THROW(system.getIDMap().getRail("rail1"));
78 EXPECT_THROW(system.getIDMap().getRail("rail2"), std::invalid_argument);
Shawn McCarneyc3991f12020-04-05 13:16:06 -050079 EXPECT_EQ(system.getRules().size(), 1);
80 EXPECT_EQ(system.getRules()[0]->getID(), "set_voltage_rule");
81}
82
Shawn McCarney9bd94d32021-01-25 19:40:42 -060083TEST(SystemTests, ClearCache)
84{
85 // Create PresenceDetection
86 std::vector<std::unique_ptr<Action>> actions{};
87 std::unique_ptr<PresenceDetection> presenceDetection =
88 std::make_unique<PresenceDetection>(std::move(actions));
89 PresenceDetection* presenceDetectionPtr = presenceDetection.get();
90
91 // Create Device that contains PresenceDetection
92 std::unique_ptr<i2c::I2CInterface> i2cInterface = createI2CInterface();
93 std::unique_ptr<Device> device = std::make_unique<Device>(
94 "reg1", true,
95 "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
96 std::move(i2cInterface), std::move(presenceDetection));
97 Device* devicePtr = device.get();
98
99 // Create Chassis that contains Device
100 std::vector<std::unique_ptr<Device>> devices{};
101 devices.emplace_back(std::move(device));
102 std::unique_ptr<Chassis> chassis =
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500103 std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Shawn McCarney9bd94d32021-01-25 19:40:42 -0600104 Chassis* chassisPtr = chassis.get();
105
106 // Create System that contains Chassis
107 std::vector<std::unique_ptr<Rule>> rules{};
108 std::vector<std::unique_ptr<Chassis>> chassisVec{};
109 chassisVec.emplace_back(std::move(chassis));
110 System system{std::move(rules), std::move(chassisVec)};
111
112 // Cache presence value in PresenceDetection
113 MockServices services{};
114 presenceDetectionPtr->execute(services, system, *chassisPtr, *devicePtr);
115 EXPECT_TRUE(presenceDetectionPtr->getCachedPresence().has_value());
116
117 // Clear cached data in System
118 system.clearCache();
119
120 // Verify presence value no longer cached in PresenceDetection
121 EXPECT_FALSE(presenceDetectionPtr->getCachedPresence().has_value());
122}
123
Shawn McCarney23b0d0d2021-05-14 15:27:59 -0500124TEST(SystemTests, ClearErrorHistory)
125{
126 // Create SensorMonitoring. Will fail with a DBus exception.
127 std::unique_ptr<MockAction> action = std::make_unique<MockAction>();
128 EXPECT_CALL(*action, execute)
129 .WillRepeatedly(Throw(TestSDBusError{"Unable to set sensor value"}));
130 std::vector<std::unique_ptr<Action>> actions{};
131 actions.emplace_back(std::move(action));
132 std::unique_ptr<SensorMonitoring> sensorMonitoring =
133 std::make_unique<SensorMonitoring>(std::move(actions));
134
135 // Create Rail
136 std::unique_ptr<Configuration> configuration{};
137 std::unique_ptr<Rail> rail = std::make_unique<Rail>(
138 "vddr1", std::move(configuration), std::move(sensorMonitoring));
139
140 // Create Device that contains Rail
141 std::unique_ptr<i2c::MockedI2CInterface> i2cInterface =
142 std::make_unique<i2c::MockedI2CInterface>();
143 std::unique_ptr<PresenceDetection> presenceDetection{};
144 std::unique_ptr<Configuration> deviceConfiguration{};
145 std::vector<std::unique_ptr<Rail>> rails{};
146 rails.emplace_back(std::move(rail));
147 std::unique_ptr<Device> device = std::make_unique<Device>(
148 "reg1", true,
149 "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
150 std::move(i2cInterface), std::move(presenceDetection),
151 std::move(deviceConfiguration), std::move(rails));
152
153 // Create Chassis that contains Device
154 std::vector<std::unique_ptr<Device>> devices{};
155 devices.emplace_back(std::move(device));
156 std::unique_ptr<Chassis> chassis =
157 std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
158
159 // Create System that contains Chassis
160 std::vector<std::unique_ptr<Rule>> rules{};
161 std::vector<std::unique_ptr<Chassis>> chassisVec{};
162 chassisVec.emplace_back(std::move(chassis));
163 System system{std::move(rules), std::move(chassisVec)};
164
165 // Create mock services
166 MockServices services{};
167
168 // Expect Sensors service to be called 5+5=10 times
169 MockSensors& sensors = services.getMockSensors();
170 EXPECT_CALL(sensors, startRail).Times(10);
171 EXPECT_CALL(sensors, setValue).Times(0);
172 EXPECT_CALL(sensors, endRail).Times(10);
173
174 // Expect Journal service to be called 3+3=6 times to log error messages
175 MockJournal& journal = services.getMockJournal();
176 EXPECT_CALL(journal, logError(A<const std::vector<std::string>&>()))
177 .Times(6);
178 EXPECT_CALL(journal, logError(A<const std::string&>())).Times(6);
179
180 // Expect ErrorLogging service to be called 1+1=2 times to log a DBus error
181 MockErrorLogging& errorLogging = services.getMockErrorLogging();
182 EXPECT_CALL(errorLogging, logDBusError).Times(2);
183
184 // Monitor sensors 5 times. Should fail every time, write to journal 3
185 // times, and log one error.
186 for (int i = 1; i <= 5; ++i)
187 {
188 system.monitorSensors(services);
189 }
190
191 // Clear error history
192 system.clearErrorHistory();
193
194 // Monitor sensors 5 times again. Should fail every time, write to journal
195 // 3 times, and log one error.
196 for (int i = 1; i <= 5; ++i)
197 {
198 system.monitorSensors(services);
199 }
200}
201
Shawn McCarney5b19ea52020-06-02 18:52:56 -0500202TEST(SystemTests, CloseDevices)
203{
204 // Specify an empty rules vector
205 std::vector<std::unique_ptr<Rule>> rules{};
206
Bob Kingd692d6d2020-09-14 13:42:57 +0800207 // Create mock services. Expect logDebug() to be called.
208 MockServices services{};
209 MockJournal& journal = services.getMockJournal();
210 EXPECT_CALL(journal, logDebug("Closing devices in chassis 1")).Times(1);
211 EXPECT_CALL(journal, logDebug("Closing devices in chassis 3")).Times(1);
212 EXPECT_CALL(journal, logInfo(A<const std::string&>())).Times(0);
213 EXPECT_CALL(journal, logError(A<const std::string&>())).Times(0);
214
Shawn McCarney5b19ea52020-06-02 18:52:56 -0500215 // Create Chassis
216 std::vector<std::unique_ptr<Chassis>> chassis{};
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500217 chassis.emplace_back(std::make_unique<Chassis>(1, chassisInvPath + '1'));
218 chassis.emplace_back(std::make_unique<Chassis>(3, chassisInvPath + '3'));
Shawn McCarney5b19ea52020-06-02 18:52:56 -0500219
220 // Create System
221 System system{std::move(rules), std::move(chassis)};
222
223 // Call closeDevices()
Bob Kingd692d6d2020-09-14 13:42:57 +0800224 system.closeDevices(services);
Shawn McCarney5b19ea52020-06-02 18:52:56 -0500225}
226
Shawn McCarney2af52892020-04-14 11:54:45 -0500227TEST(SystemTests, Configure)
228{
Bob King5cfe5102020-07-30 16:26:18 +0800229 // Create mock services. Expect logInfo() to be called.
Bob King23243f82020-07-29 10:38:57 +0800230 MockServices services{};
Bob King5cfe5102020-07-30 16:26:18 +0800231 MockJournal& journal = services.getMockJournal();
232 EXPECT_CALL(journal, logInfo("Configuring chassis 1")).Times(1);
233 EXPECT_CALL(journal, logInfo("Configuring chassis 3")).Times(1);
234 EXPECT_CALL(journal, logDebug(A<const std::string&>())).Times(0);
235 EXPECT_CALL(journal, logError(A<const std::string&>())).Times(0);
Bob King23243f82020-07-29 10:38:57 +0800236
Shawn McCarney2af52892020-04-14 11:54:45 -0500237 // Specify an empty rules vector
238 std::vector<std::unique_ptr<Rule>> rules{};
239
240 // Create Chassis
241 std::vector<std::unique_ptr<Chassis>> chassis{};
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500242 chassis.emplace_back(std::make_unique<Chassis>(1, chassisInvPath + '1'));
243 chassis.emplace_back(std::make_unique<Chassis>(3, chassisInvPath + '3'));
Shawn McCarney2af52892020-04-14 11:54:45 -0500244
245 // Create System
246 System system{std::move(rules), std::move(chassis)};
247
248 // Call configure()
Bob King23243f82020-07-29 10:38:57 +0800249 system.configure(services);
Shawn McCarney2af52892020-04-14 11:54:45 -0500250}
251
Shawn McCarneyc3991f12020-04-05 13:16:06 -0500252TEST(SystemTests, GetChassis)
253{
254 // Specify an empty rules vector
255 std::vector<std::unique_ptr<Rule>> rules{};
256
257 // Create Chassis
258 std::vector<std::unique_ptr<Chassis>> chassis{};
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500259 chassis.emplace_back(std::make_unique<Chassis>(1, chassisInvPath + '1'));
260 chassis.emplace_back(std::make_unique<Chassis>(3, chassisInvPath + '3'));
Shawn McCarneyc3991f12020-04-05 13:16:06 -0500261
262 // Create System
263 System system{std::move(rules), std::move(chassis)};
264 EXPECT_EQ(system.getChassis().size(), 2);
265 EXPECT_EQ(system.getChassis()[0]->getNumber(), 1);
266 EXPECT_EQ(system.getChassis()[1]->getNumber(), 3);
267}
268
269TEST(SystemTests, GetIDMap)
270{
Shawn McCarneydb0b8332020-04-06 14:13:04 -0500271 // Create Rules
272 std::vector<std::unique_ptr<Rule>> rules{};
273 rules.emplace_back(createRule("set_voltage_rule"));
274 rules.emplace_back(createRule("read_sensors_rule"));
275
276 // Create Chassis
277 std::vector<std::unique_ptr<Chassis>> chassis{};
278 {
279 // Chassis 1
280 std::vector<std::unique_ptr<Device>> devices{};
281 devices.emplace_back(createDevice("reg1", {"rail1"}));
282 devices.emplace_back(createDevice("reg2", {"rail2a", "rail2b"}));
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500283 chassis.emplace_back(std::make_unique<Chassis>(1, chassisInvPath + '1',
284 std::move(devices)));
Shawn McCarneydb0b8332020-04-06 14:13:04 -0500285 }
286 {
287 // Chassis 2
288 std::vector<std::unique_ptr<Device>> devices{};
289 devices.emplace_back(createDevice("reg3", {"rail3a", "rail3b"}));
290 devices.emplace_back(createDevice("reg4"));
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500291 chassis.emplace_back(std::make_unique<Chassis>(2, chassisInvPath + '2',
292 std::move(devices)));
Shawn McCarneydb0b8332020-04-06 14:13:04 -0500293 }
294
295 // Create System
296 System system{std::move(rules), std::move(chassis)};
297 const IDMap& idMap = system.getIDMap();
298
299 // Verify all Rules are in the IDMap
300 EXPECT_NO_THROW(idMap.getRule("set_voltage_rule"));
301 EXPECT_NO_THROW(idMap.getRule("read_sensors_rule"));
302 EXPECT_THROW(idMap.getRule("set_voltage_rule2"), std::invalid_argument);
303
304 // Verify all Devices are in the IDMap
305 EXPECT_NO_THROW(idMap.getDevice("reg1"));
306 EXPECT_NO_THROW(idMap.getDevice("reg2"));
307 EXPECT_NO_THROW(idMap.getDevice("reg3"));
308 EXPECT_NO_THROW(idMap.getDevice("reg4"));
309 EXPECT_THROW(idMap.getDevice("reg5"), std::invalid_argument);
310
311 // Verify all Rails are in the IDMap
312 EXPECT_NO_THROW(idMap.getRail("rail1"));
313 EXPECT_NO_THROW(idMap.getRail("rail2a"));
314 EXPECT_NO_THROW(idMap.getRail("rail2b"));
315 EXPECT_NO_THROW(idMap.getRail("rail3a"));
316 EXPECT_NO_THROW(idMap.getRail("rail3b"));
317 EXPECT_THROW(idMap.getRail("rail4"), std::invalid_argument);
Shawn McCarneyc3991f12020-04-05 13:16:06 -0500318}
319
320TEST(SystemTests, GetRules)
321{
322 // Create Rules
323 std::vector<std::unique_ptr<Rule>> rules{};
Shawn McCarneydb0b8332020-04-06 14:13:04 -0500324 rules.emplace_back(createRule("set_voltage_rule"));
325 rules.emplace_back(createRule("read_sensors_rule"));
Shawn McCarneyc3991f12020-04-05 13:16:06 -0500326
327 // Create Chassis
328 std::vector<std::unique_ptr<Chassis>> chassis{};
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500329 chassis.emplace_back(std::make_unique<Chassis>(1, chassisInvPath));
Shawn McCarneyc3991f12020-04-05 13:16:06 -0500330
331 // Create System
332 System system{std::move(rules), std::move(chassis)};
333 EXPECT_EQ(system.getRules().size(), 2);
334 EXPECT_EQ(system.getRules()[0]->getID(), "set_voltage_rule");
335 EXPECT_EQ(system.getRules()[1]->getID(), "read_sensors_rule");
336}
Bob King8e2294d2020-07-14 17:41:31 +0800337
338TEST(SystemTests, MonitorSensors)
339{
Shawn McCarney17bac892021-05-08 07:55:52 -0500340 // Create mock services. Set Sensors service expectations.
Bob King8a552922020-08-05 17:02:31 +0800341 MockServices services{};
Shawn McCarney17bac892021-05-08 07:55:52 -0500342 MockSensors& sensors = services.getMockSensors();
343 EXPECT_CALL(sensors, startRail("c1_vdd0",
344 "/xyz/openbmc_project/inventory/system/"
345 "chassis1/motherboard/vdd0_reg",
346 chassisInvPath + '1'))
Bob King8e2294d2020-07-14 17:41:31 +0800347 .Times(1);
Shawn McCarney17bac892021-05-08 07:55:52 -0500348 EXPECT_CALL(sensors, startRail("c2_vdd0",
349 "/xyz/openbmc_project/inventory/system/"
350 "chassis2/motherboard/vdd0_reg",
351 chassisInvPath + '2'))
352 .Times(1);
353 EXPECT_CALL(sensors, setValue).Times(0);
354 EXPECT_CALL(sensors, endRail(false)).Times(2);
Bob King8e2294d2020-07-14 17:41:31 +0800355
Shawn McCarney17bac892021-05-08 07:55:52 -0500356 std::vector<std::unique_ptr<Chassis>> chassisVec{};
Bob King8e2294d2020-07-14 17:41:31 +0800357
Shawn McCarney17bac892021-05-08 07:55:52 -0500358 // Create Chassis 1
359 {
360 // Create SensorMonitoring for Rail
361 std::unique_ptr<MockAction> action = std::make_unique<MockAction>();
362 EXPECT_CALL(*action, execute).Times(1).WillOnce(Return(true));
363 std::vector<std::unique_ptr<Action>> actions{};
364 actions.emplace_back(std::move(action));
365 std::unique_ptr<SensorMonitoring> sensorMonitoring =
366 std::make_unique<SensorMonitoring>(std::move(actions));
Bob King8e2294d2020-07-14 17:41:31 +0800367
Shawn McCarney17bac892021-05-08 07:55:52 -0500368 // Create Rail
369 std::unique_ptr<Configuration> configuration{};
370 std::unique_ptr<Rail> rail = std::make_unique<Rail>(
371 "c1_vdd0", std::move(configuration), std::move(sensorMonitoring));
Bob King8e2294d2020-07-14 17:41:31 +0800372
Shawn McCarney17bac892021-05-08 07:55:52 -0500373 // Create Device
374 std::unique_ptr<i2c::I2CInterface> i2cInterface = createI2CInterface();
375 std::unique_ptr<PresenceDetection> presenceDetection{};
376 std::unique_ptr<Configuration> deviceConfiguration{};
377 std::vector<std::unique_ptr<Rail>> rails{};
378 rails.emplace_back(std::move(rail));
379 std::unique_ptr<Device> device = std::make_unique<Device>(
380 "c1_vdd0_reg", true,
381 "/xyz/openbmc_project/inventory/system/chassis1/motherboard/"
382 "vdd0_reg",
383 std::move(i2cInterface), std::move(presenceDetection),
384 std::move(deviceConfiguration), std::move(rails));
385
386 // Create Chassis
387 std::vector<std::unique_ptr<Device>> devices{};
388 devices.emplace_back(std::move(device));
389 std::unique_ptr<Chassis> chassis = std::make_unique<Chassis>(
390 1, chassisInvPath + '1', std::move(devices));
391 chassisVec.emplace_back(std::move(chassis));
392 }
393
394 // Create Chassis 2
395 {
396 // Create SensorMonitoring for Rail
397 std::unique_ptr<MockAction> action = std::make_unique<MockAction>();
398 EXPECT_CALL(*action, execute).Times(1).WillOnce(Return(true));
399 std::vector<std::unique_ptr<Action>> actions{};
400 actions.emplace_back(std::move(action));
401 std::unique_ptr<SensorMonitoring> sensorMonitoring =
402 std::make_unique<SensorMonitoring>(std::move(actions));
403
404 // Create Rail
405 std::unique_ptr<Configuration> configuration{};
406 std::unique_ptr<Rail> rail = std::make_unique<Rail>(
407 "c2_vdd0", std::move(configuration), std::move(sensorMonitoring));
408
409 // Create Device
410 std::unique_ptr<i2c::I2CInterface> i2cInterface = createI2CInterface();
411 std::unique_ptr<PresenceDetection> presenceDetection{};
412 std::unique_ptr<Configuration> deviceConfiguration{};
413 std::vector<std::unique_ptr<Rail>> rails{};
414 rails.emplace_back(std::move(rail));
415 std::unique_ptr<Device> device = std::make_unique<Device>(
416 "c2_vdd0_reg", true,
417 "/xyz/openbmc_project/inventory/system/chassis2/motherboard/"
418 "vdd0_reg",
419 std::move(i2cInterface), std::move(presenceDetection),
420 std::move(deviceConfiguration), std::move(rails));
421
422 // Create Chassis
423 std::vector<std::unique_ptr<Device>> devices{};
424 devices.emplace_back(std::move(device));
425 std::unique_ptr<Chassis> chassis = std::make_unique<Chassis>(
426 2, chassisInvPath + '2', std::move(devices));
427 chassisVec.emplace_back(std::move(chassis));
428 }
Bob King8e2294d2020-07-14 17:41:31 +0800429
430 // Create System that contains Chassis
431 std::vector<std::unique_ptr<Rule>> rules{};
Bob King8e2294d2020-07-14 17:41:31 +0800432 System system{std::move(rules), std::move(chassisVec)};
433
434 // Call monitorSensors()
Bob King8a552922020-08-05 17:02:31 +0800435 system.monitorSensors(services);
Bob King8e2294d2020-07-14 17:41:31 +0800436}