blob: c04e9170a7c5415f78fe7d9c998ba70113afc21a [file] [log] [blame]
Shawn McCarney8a3afd72020-03-12 14:28:44 -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 McCarney525e20c2020-04-14 11:05:39 -050016#include "action.hpp"
Shawn McCarney8a3afd72020-03-12 14:28:44 -050017#include "chassis.hpp"
Shawn McCarney525e20c2020-04-14 11:05:39 -050018#include "configuration.hpp"
Shawn McCarney8a3afd72020-03-12 14:28:44 -050019#include "device.hpp"
20#include "i2c_interface.hpp"
Shawn McCarneydb0b8332020-04-06 14:13:04 -050021#include "id_map.hpp"
Shawn McCarney525e20c2020-04-14 11:05:39 -050022#include "mock_journal.hpp"
Bob King23243f82020-07-29 10:38:57 +080023#include "mock_services.hpp"
Shawn McCarney050531f2020-06-02 14:17:12 -050024#include "mocked_i2c_interface.hpp"
Bob Kinga2c81a62020-07-08 13:31:16 +080025#include "pmbus_read_sensor_action.hpp"
Shawn McCarney525e20c2020-04-14 11:05:39 -050026#include "presence_detection.hpp"
27#include "rail.hpp"
28#include "rule.hpp"
Shawn McCarney2f9e14f2021-04-29 02:45:18 -050029#include "sensors.hpp"
Shawn McCarney525e20c2020-04-14 11:05:39 -050030#include "system.hpp"
Shawn McCarney8a3afd72020-03-12 14:28:44 -050031#include "test_utils.hpp"
32
33#include <memory>
34#include <stdexcept>
Shawn McCarney525e20c2020-04-14 11:05:39 -050035#include <string>
Shawn McCarney8a3afd72020-03-12 14:28:44 -050036#include <utility>
37#include <vector>
38
Bob Kinga2c81a62020-07-08 13:31:16 +080039#include <gmock/gmock.h>
Shawn McCarney8a3afd72020-03-12 14:28:44 -050040#include <gtest/gtest.h>
41
42using namespace phosphor::power::regulators;
43using namespace phosphor::power::regulators::test_utils;
44
Bob Kinga2c81a62020-07-08 13:31:16 +080045using ::testing::A;
Shawn McCarney050531f2020-06-02 14:17:12 -050046using ::testing::Return;
Bob Kinga2c81a62020-07-08 13:31:16 +080047using ::testing::TypedEq;
Shawn McCarney050531f2020-06-02 14:17:12 -050048
Shawn McCarneycb3f6a62021-04-30 10:54:30 -050049// Default chassis inventory path
50static const std::string defaultInventoryPath{
51 "/xyz/openbmc_project/inventory/system/chassis"};
52
Shawn McCarney8a3afd72020-03-12 14:28:44 -050053TEST(ChassisTests, Constructor)
54{
55 // Test where works: Only required parameters are specified
56 {
Shawn McCarneycb3f6a62021-04-30 10:54:30 -050057 Chassis chassis{2, defaultInventoryPath};
Shawn McCarney8a3afd72020-03-12 14:28:44 -050058 EXPECT_EQ(chassis.getNumber(), 2);
Shawn McCarneycb3f6a62021-04-30 10:54:30 -050059 EXPECT_EQ(chassis.getInventoryPath(), defaultInventoryPath);
Shawn McCarney8a3afd72020-03-12 14:28:44 -050060 EXPECT_EQ(chassis.getDevices().size(), 0);
61 }
62
63 // Test where works: All parameters are specified
64 {
65 // Create vector of Device objects
66 std::vector<std::unique_ptr<Device>> devices{};
Shawn McCarneydb0b8332020-04-06 14:13:04 -050067 devices.emplace_back(createDevice("vdd_reg1"));
68 devices.emplace_back(createDevice("vdd_reg2"));
Shawn McCarney8a3afd72020-03-12 14:28:44 -050069
70 // Create Chassis
Shawn McCarneycb3f6a62021-04-30 10:54:30 -050071 Chassis chassis{1, defaultInventoryPath, std::move(devices)};
Shawn McCarney8a3afd72020-03-12 14:28:44 -050072 EXPECT_EQ(chassis.getNumber(), 1);
Shawn McCarneycb3f6a62021-04-30 10:54:30 -050073 EXPECT_EQ(chassis.getInventoryPath(), defaultInventoryPath);
Shawn McCarney8a3afd72020-03-12 14:28:44 -050074 EXPECT_EQ(chassis.getDevices().size(), 2);
75 }
76
77 // Test where fails: Invalid chassis number < 1
78 try
79 {
Shawn McCarneycb3f6a62021-04-30 10:54:30 -050080 Chassis chassis{0, defaultInventoryPath};
Shawn McCarney8a3afd72020-03-12 14:28:44 -050081 ADD_FAILURE() << "Should not have reached this line.";
82 }
83 catch (const std::invalid_argument& e)
84 {
85 EXPECT_STREQ(e.what(), "Invalid chassis number: 0");
86 }
87 catch (...)
88 {
89 ADD_FAILURE() << "Should not have caught exception.";
90 }
91}
92
Shawn McCarneydb0b8332020-04-06 14:13:04 -050093TEST(ChassisTests, AddToIDMap)
94{
95 // Create vector of Device objects
96 std::vector<std::unique_ptr<Device>> devices{};
97 devices.emplace_back(createDevice("reg1", {"rail1"}));
98 devices.emplace_back(createDevice("reg2", {"rail2a", "rail2b"}));
99 devices.emplace_back(createDevice("reg3"));
100
101 // Create Chassis
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500102 Chassis chassis{1, defaultInventoryPath, std::move(devices)};
Shawn McCarneydb0b8332020-04-06 14:13:04 -0500103
104 // Add Device and Rail objects within the Chassis to an IDMap
105 IDMap idMap{};
106 chassis.addToIDMap(idMap);
107
108 // Verify all Devices are in the IDMap
109 EXPECT_NO_THROW(idMap.getDevice("reg1"));
110 EXPECT_NO_THROW(idMap.getDevice("reg2"));
111 EXPECT_NO_THROW(idMap.getDevice("reg3"));
112 EXPECT_THROW(idMap.getDevice("reg4"), std::invalid_argument);
113
114 // Verify all Rails are in the IDMap
115 EXPECT_NO_THROW(idMap.getRail("rail1"));
116 EXPECT_NO_THROW(idMap.getRail("rail2a"));
117 EXPECT_NO_THROW(idMap.getRail("rail2b"));
118 EXPECT_THROW(idMap.getRail("rail3"), std::invalid_argument);
119}
120
Shawn McCarney9bd94d32021-01-25 19:40:42 -0600121TEST(ChassisTests, ClearCache)
122{
123 // Create PresenceDetection
124 std::vector<std::unique_ptr<Action>> actions{};
125 std::unique_ptr<PresenceDetection> presenceDetection =
126 std::make_unique<PresenceDetection>(std::move(actions));
127 PresenceDetection* presenceDetectionPtr = presenceDetection.get();
128
129 // Create Device that contains PresenceDetection
130 std::unique_ptr<i2c::I2CInterface> i2cInterface = createI2CInterface();
131 std::unique_ptr<Device> device = std::make_unique<Device>(
132 "reg1", true,
133 "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
134 std::move(i2cInterface), std::move(presenceDetection));
135 Device* devicePtr = device.get();
136
137 // Create Chassis that contains Device
138 std::vector<std::unique_ptr<Device>> devices{};
139 devices.emplace_back(std::move(device));
140 std::unique_ptr<Chassis> chassis =
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500141 std::make_unique<Chassis>(1, defaultInventoryPath, std::move(devices));
Shawn McCarney9bd94d32021-01-25 19:40:42 -0600142 Chassis* chassisPtr = chassis.get();
143
144 // Create System that contains Chassis
145 std::vector<std::unique_ptr<Rule>> rules{};
146 std::vector<std::unique_ptr<Chassis>> chassisVec{};
147 chassisVec.emplace_back(std::move(chassis));
148 System system{std::move(rules), std::move(chassisVec)};
149
150 // Cache presence value in PresenceDetection
151 MockServices services{};
152 presenceDetectionPtr->execute(services, system, *chassisPtr, *devicePtr);
153 EXPECT_TRUE(presenceDetectionPtr->getCachedPresence().has_value());
154
155 // Clear cached data in Chassis
156 chassisPtr->clearCache();
157
158 // Verify presence value no longer cached in PresenceDetection
159 EXPECT_FALSE(presenceDetectionPtr->getCachedPresence().has_value());
160}
161
Shawn McCarney050531f2020-06-02 14:17:12 -0500162TEST(ChassisTests, CloseDevices)
163{
164 // Test where no devices were specified in constructor
165 {
Bob Kingd692d6d2020-09-14 13:42:57 +0800166 // Create mock services. Expect logDebug() to be called.
167 MockServices services{};
168 MockJournal& journal = services.getMockJournal();
169 EXPECT_CALL(journal, logDebug("Closing devices in chassis 2")).Times(1);
170
Shawn McCarney050531f2020-06-02 14:17:12 -0500171 // Create Chassis
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500172 Chassis chassis{2, defaultInventoryPath};
Shawn McCarney050531f2020-06-02 14:17:12 -0500173
174 // Call closeDevices()
Bob Kingd692d6d2020-09-14 13:42:57 +0800175 chassis.closeDevices(services);
Shawn McCarney050531f2020-06-02 14:17:12 -0500176 }
177
178 // Test where devices were specified in constructor
179 {
180 std::vector<std::unique_ptr<Device>> devices{};
181
Bob Kingd692d6d2020-09-14 13:42:57 +0800182 // Create mock services. Expect logDebug() to be called.
183 MockServices services{};
184 MockJournal& journal = services.getMockJournal();
185 EXPECT_CALL(journal, logDebug("Closing devices in chassis 1")).Times(1);
186
Shawn McCarney050531f2020-06-02 14:17:12 -0500187 // Create Device vdd0_reg
188 {
189 // Create mock I2CInterface: isOpen() and close() should be called
190 std::unique_ptr<i2c::MockedI2CInterface> i2cInterface =
191 std::make_unique<i2c::MockedI2CInterface>();
192 EXPECT_CALL(*i2cInterface, isOpen).Times(1).WillOnce(Return(true));
193 EXPECT_CALL(*i2cInterface, close).Times(1);
194
195 // Create Device
Bob Kinga76898f2020-10-13 15:08:33 +0800196 std::unique_ptr<Device> device =
197 std::make_unique<Device>("vdd0_reg", true,
198 "/xyz/openbmc_project/inventory/"
199 "system/chassis/motherboard/vdd0_reg",
200 std::move(i2cInterface));
Shawn McCarney050531f2020-06-02 14:17:12 -0500201 devices.emplace_back(std::move(device));
202 }
203
204 // Create Device vdd1_reg
205 {
206 // Create mock I2CInterface: isOpen() and close() should be called
207 std::unique_ptr<i2c::MockedI2CInterface> i2cInterface =
208 std::make_unique<i2c::MockedI2CInterface>();
209 EXPECT_CALL(*i2cInterface, isOpen).Times(1).WillOnce(Return(true));
210 EXPECT_CALL(*i2cInterface, close).Times(1);
211
212 // Create Device
Bob Kinga76898f2020-10-13 15:08:33 +0800213 std::unique_ptr<Device> device =
214 std::make_unique<Device>("vdd1_reg", true,
215 "/xyz/openbmc_project/inventory/"
216 "system/chassis/motherboard/vdd1_reg",
217 std::move(i2cInterface));
Shawn McCarney050531f2020-06-02 14:17:12 -0500218 devices.emplace_back(std::move(device));
219 }
220
221 // Create Chassis
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500222 Chassis chassis{1, defaultInventoryPath, std::move(devices)};
Shawn McCarney050531f2020-06-02 14:17:12 -0500223
224 // Call closeDevices()
Bob Kingd692d6d2020-09-14 13:42:57 +0800225 chassis.closeDevices(services);
Shawn McCarney050531f2020-06-02 14:17:12 -0500226 }
227}
228
Shawn McCarney525e20c2020-04-14 11:05:39 -0500229TEST(ChassisTests, Configure)
230{
231 // Test where no devices were specified in constructor
232 {
Bob King5cfe5102020-07-30 16:26:18 +0800233 // Create mock services. Expect logInfo() to be called.
Bob King23243f82020-07-29 10:38:57 +0800234 MockServices services{};
Bob King5cfe5102020-07-30 16:26:18 +0800235 MockJournal& journal = services.getMockJournal();
236 EXPECT_CALL(journal, logInfo("Configuring chassis 1")).Times(1);
237 EXPECT_CALL(journal, logDebug(A<const std::string&>())).Times(0);
238 EXPECT_CALL(journal, logError(A<const std::string&>())).Times(0);
Bob King23243f82020-07-29 10:38:57 +0800239
Shawn McCarney525e20c2020-04-14 11:05:39 -0500240 // Create Chassis
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500241 std::unique_ptr<Chassis> chassis =
242 std::make_unique<Chassis>(1, defaultInventoryPath);
Shawn McCarney525e20c2020-04-14 11:05:39 -0500243 Chassis* chassisPtr = chassis.get();
244
245 // Create System that contains Chassis
246 std::vector<std::unique_ptr<Rule>> rules{};
247 std::vector<std::unique_ptr<Chassis>> chassisVec{};
248 chassisVec.emplace_back(std::move(chassis));
249 System system{std::move(rules), std::move(chassisVec)};
250
251 // Call configure()
Bob King23243f82020-07-29 10:38:57 +0800252 chassisPtr->configure(services, system);
Shawn McCarney525e20c2020-04-14 11:05:39 -0500253 }
254
255 // Test where devices were specified in constructor
256 {
257 std::vector<std::unique_ptr<Device>> devices{};
258
Bob King5cfe5102020-07-30 16:26:18 +0800259 // Create mock services. Expect logInfo() and logDebug() to be called.
260 MockServices services{};
261 MockJournal& journal = services.getMockJournal();
262 EXPECT_CALL(journal, logInfo("Configuring chassis 2")).Times(1);
263 EXPECT_CALL(journal, logDebug("Configuring vdd0_reg: volts=1.300000"))
264 .Times(1);
265 EXPECT_CALL(journal, logDebug("Configuring vdd1_reg: volts=1.200000"))
266 .Times(1);
267 EXPECT_CALL(journal, logError(A<const std::string&>())).Times(0);
268
Shawn McCarney525e20c2020-04-14 11:05:39 -0500269 // Create Device vdd0_reg
270 {
271 // Create Configuration
272 std::vector<std::unique_ptr<Action>> actions{};
273 std::unique_ptr<Configuration> configuration =
274 std::make_unique<Configuration>(1.3, std::move(actions));
275
276 // Create Device
277 std::unique_ptr<i2c::I2CInterface> i2cInterface =
278 createI2CInterface();
279 std::unique_ptr<PresenceDetection> presenceDetection{};
280 std::unique_ptr<Device> device = std::make_unique<Device>(
Bob Kinga76898f2020-10-13 15:08:33 +0800281 "vdd0_reg", true,
282 "/xyz/openbmc_project/inventory/system/chassis/motherboard/"
283 "vdd0_reg",
Shawn McCarney525e20c2020-04-14 11:05:39 -0500284 std::move(i2cInterface), std::move(presenceDetection),
285 std::move(configuration));
286 devices.emplace_back(std::move(device));
287 }
288
289 // Create Device vdd1_reg
290 {
291 // Create Configuration
292 std::vector<std::unique_ptr<Action>> actions{};
293 std::unique_ptr<Configuration> configuration =
294 std::make_unique<Configuration>(1.2, std::move(actions));
295
296 // Create Device
297 std::unique_ptr<i2c::I2CInterface> i2cInterface =
298 createI2CInterface();
299 std::unique_ptr<PresenceDetection> presenceDetection{};
300 std::unique_ptr<Device> device = std::make_unique<Device>(
Bob Kinga76898f2020-10-13 15:08:33 +0800301 "vdd1_reg", true,
302 "/xyz/openbmc_project/inventory/system/chassis/motherboard/"
303 "vdd1_reg",
Shawn McCarney525e20c2020-04-14 11:05:39 -0500304 std::move(i2cInterface), std::move(presenceDetection),
305 std::move(configuration));
306 devices.emplace_back(std::move(device));
307 }
308
309 // Create Chassis
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500310 std::unique_ptr<Chassis> chassis = std::make_unique<Chassis>(
311 2, defaultInventoryPath, std::move(devices));
Shawn McCarney525e20c2020-04-14 11:05:39 -0500312 Chassis* chassisPtr = chassis.get();
313
314 // Create System that contains Chassis
315 std::vector<std::unique_ptr<Rule>> rules{};
316 std::vector<std::unique_ptr<Chassis>> chassisVec{};
317 chassisVec.emplace_back(std::move(chassis));
318 System system{std::move(rules), std::move(chassisVec)};
319
320 // Call configure()
Bob King23243f82020-07-29 10:38:57 +0800321 chassisPtr->configure(services, system);
Shawn McCarney525e20c2020-04-14 11:05:39 -0500322 }
323}
324
Shawn McCarney8a3afd72020-03-12 14:28:44 -0500325TEST(ChassisTests, GetDevices)
326{
327 // Test where no devices were specified in constructor
328 {
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500329 Chassis chassis{2, defaultInventoryPath};
Shawn McCarney8a3afd72020-03-12 14:28:44 -0500330 EXPECT_EQ(chassis.getDevices().size(), 0);
331 }
332
333 // Test where devices were specified in constructor
334 {
335 // Create vector of Device objects
336 std::vector<std::unique_ptr<Device>> devices{};
Shawn McCarneydb0b8332020-04-06 14:13:04 -0500337 devices.emplace_back(createDevice("vdd_reg1"));
338 devices.emplace_back(createDevice("vdd_reg2"));
Shawn McCarney8a3afd72020-03-12 14:28:44 -0500339
340 // Create Chassis
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500341 Chassis chassis{1, defaultInventoryPath, std::move(devices)};
Shawn McCarney8a3afd72020-03-12 14:28:44 -0500342 EXPECT_EQ(chassis.getDevices().size(), 2);
343 EXPECT_EQ(chassis.getDevices()[0]->getID(), "vdd_reg1");
344 EXPECT_EQ(chassis.getDevices()[1]->getID(), "vdd_reg2");
345 }
346}
347
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500348TEST(ChassisTests, GetInventoryPath)
349{
350 Chassis chassis{3, defaultInventoryPath};
351 EXPECT_EQ(chassis.getInventoryPath(), defaultInventoryPath);
352}
353
Shawn McCarney8a3afd72020-03-12 14:28:44 -0500354TEST(ChassisTests, GetNumber)
355{
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500356 Chassis chassis{3, defaultInventoryPath};
Shawn McCarney8a3afd72020-03-12 14:28:44 -0500357 EXPECT_EQ(chassis.getNumber(), 3);
358}
Bob Kinga2c81a62020-07-08 13:31:16 +0800359
360TEST(ChassisTests, MonitorSensors)
361{
362 // Test where no devices were specified in constructor
363 {
Bob King8a552922020-08-05 17:02:31 +0800364 // Create mock services. No logging should occur.
365 MockServices services{};
366 MockJournal& journal = services.getMockJournal();
367 EXPECT_CALL(journal, logDebug(A<const std::string&>())).Times(0);
368 EXPECT_CALL(journal, logError(A<const std::string&>())).Times(0);
369
Bob Kinga2c81a62020-07-08 13:31:16 +0800370 // Create Chassis
371 std::vector<std::unique_ptr<Device>> devices{};
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500372 std::unique_ptr<Chassis> chassis = std::make_unique<Chassis>(
373 1, defaultInventoryPath, std::move(devices));
Bob Kinga2c81a62020-07-08 13:31:16 +0800374 Chassis* chassisPtr = chassis.get();
375
376 // Create System that contains Chassis
377 std::vector<std::unique_ptr<Rule>> rules{};
378 std::vector<std::unique_ptr<Chassis>> chassisVec{};
379 chassisVec.emplace_back(std::move(chassis));
380 System system{std::move(rules), std::move(chassisVec)};
381
382 // Call monitorSensors(). Should do nothing.
Bob King8a552922020-08-05 17:02:31 +0800383 chassisPtr->monitorSensors(services, system);
Bob Kinga2c81a62020-07-08 13:31:16 +0800384 }
385
386 // Test where devices were specified in constructor
387 {
Bob King8a552922020-08-05 17:02:31 +0800388 // Create mock services. No logging should occur.
389 MockServices services{};
390 MockJournal& journal = services.getMockJournal();
391 EXPECT_CALL(journal, logDebug(A<const std::string&>())).Times(0);
392 EXPECT_CALL(journal, logError(A<const std::string&>())).Times(0);
393
Bob Kinga2c81a62020-07-08 13:31:16 +0800394 std::vector<std::unique_ptr<Device>> devices{};
395
396 // Create PMBusReadSensorAction
Shawn McCarney2f9e14f2021-04-29 02:45:18 -0500397 SensorType type{SensorType::iout};
Bob Kinga2c81a62020-07-08 13:31:16 +0800398 uint8_t command = 0x8C;
399 pmbus_utils::SensorDataFormat format{
400 pmbus_utils::SensorDataFormat::linear_11};
401 std::optional<int8_t> exponent{};
402 std::unique_ptr<PMBusReadSensorAction> action =
403 std::make_unique<PMBusReadSensorAction>(type, command, format,
404 exponent);
405
406 // Create mock I2CInterface. A two-byte read should occur.
407 std::unique_ptr<i2c::MockedI2CInterface> i2cInterface =
408 std::make_unique<i2c::MockedI2CInterface>();
409 EXPECT_CALL(*i2cInterface, isOpen).Times(1).WillOnce(Return(true));
410 EXPECT_CALL(*i2cInterface, read(TypedEq<uint8_t>(0x8C), A<uint16_t&>()))
411 .Times(1);
412
413 // Create SensorMonitoring
414 std::vector<std::unique_ptr<Action>> actions{};
415 actions.emplace_back(std::move(action));
416 std::unique_ptr<SensorMonitoring> sensorMonitoring =
417 std::make_unique<SensorMonitoring>(std::move(actions));
418
419 // Create Rail
420 std::vector<std::unique_ptr<Rail>> rails{};
421 std::unique_ptr<Configuration> configuration{};
422 std::unique_ptr<Rail> rail = std::make_unique<Rail>(
423 "vdd0", std::move(configuration), std::move(sensorMonitoring));
424 rails.emplace_back(std::move(rail));
425
426 // Create Device
427 std::unique_ptr<PresenceDetection> presenceDetection{};
428 std::unique_ptr<Configuration> deviceConfiguration{};
429 std::unique_ptr<Device> device = std::make_unique<Device>(
Bob Kinga76898f2020-10-13 15:08:33 +0800430 "reg1", true,
431 "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
Bob Kinga2c81a62020-07-08 13:31:16 +0800432 std::move(i2cInterface), std::move(presenceDetection),
433 std::move(deviceConfiguration), std::move(rails));
434
435 // Create Chassis
436 devices.emplace_back(std::move(device));
Shawn McCarneycb3f6a62021-04-30 10:54:30 -0500437 std::unique_ptr<Chassis> chassis = std::make_unique<Chassis>(
438 1, defaultInventoryPath, std::move(devices));
Bob Kinga2c81a62020-07-08 13:31:16 +0800439 Chassis* chassisPtr = chassis.get();
440
441 // Create System that contains Chassis
442 std::vector<std::unique_ptr<Rule>> rules{};
443 std::vector<std::unique_ptr<Chassis>> chassisVec{};
444 chassisVec.emplace_back(std::move(chassis));
445 System system{std::move(rules), std::move(chassisVec)};
446
447 // Call monitorSensors()
Bob King8a552922020-08-05 17:02:31 +0800448 chassisPtr->monitorSensors(services, system);
Bob Kinga2c81a62020-07-08 13:31:16 +0800449 }
450}