PEL: Let Callout object ctor take a MRU list
A list of MRUs (Manufacturing Replaceable Units) can now be passed into
the Callout object constructor. There is also a new MRU object
constructor that will build that object with a MRU list as well.
This will be used in the future when someone wants to add MRUs to a
callout.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ic0e93e081a91ffc47dfd6642a34f02fd9a6edb8e
diff --git a/extensions/openpower-pels/callout.cpp b/extensions/openpower-pels/callout.cpp
index 4ddb897..f54d77e 100644
--- a/extensions/openpower-pels/callout.cpp
+++ b/extensions/openpower-pels/callout.cpp
@@ -80,7 +80,16 @@
Callout::Callout(CalloutPriority priority, const std::string& locationCode,
const std::string& partNumber, const std::string& ccin,
- const std::string& serialNumber)
+ const std::string& serialNumber) :
+ Callout(priority, locationCode, partNumber, ccin, serialNumber,
+ std::vector<MRU::MRUCallout>{})
+{
+}
+
+Callout::Callout(CalloutPriority priority, const std::string& locationCode,
+ const std::string& partNumber, const std::string& ccin,
+ const std::string& serialNumber,
+ const std::vector<MRU::MRUCallout>& mrus)
{
_flags = calloutType | fruIdentIncluded;
@@ -91,6 +100,12 @@
_fruIdentity =
std::make_unique<FRUIdentity>(partNumber, ccin, serialNumber);
+ if (!mrus.empty())
+ {
+ _flags |= mruIncluded;
+ _mru = std::make_unique<MRU>(mrus);
+ }
+
_size = flattenedSize();
}