psu-ng: Update supported configuration properties
The Supported Configuration schema has been updated to have a single
model instead of array of models, and to have an array of input voltages
instead of a single voltage.
In addition, update the name of the supported number of power supplies
from max to count, so that it better reflects that a specific number of
power supplies are expected, and not an 'up to' max number.
Change-Id: I7a4bfa9b195ce7b9d13802dbb234018c6f217fda
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/phosphor-power-supply/psu_manager.cpp b/phosphor-power-supply/psu_manager.cpp
index 73a974e..c6d5855 100644
--- a/phosphor-power-supply/psu_manager.cpp
+++ b/phosphor-power-supply/psu_manager.cpp
@@ -154,44 +154,39 @@
return;
}
- std::vector<std::string> models;
propIt = properties.find("SupportedModel");
if (propIt == properties.end())
{
return;
}
- const std::vector<std::string>* modelsPtr =
- std::get_if<std::vector<std::string>>(&(propIt->second));
- if (modelsPtr == nullptr)
+ const std::string* model = std::get_if<std::string>(&(propIt->second));
+ if (model == nullptr)
{
return;
}
- models = *modelsPtr;
- sys_properties sys{0, 0};
+ sys_properties sys;
propIt = properties.find("RedundantCount");
if (propIt != properties.end())
{
const uint64_t* count = std::get_if<uint64_t>(&(propIt->second));
if (count != nullptr)
{
- sys.maxPowerSupplies = *count;
+ sys.powerSupplyCount = *count;
}
}
propIt = properties.find("InputVoltage");
if (propIt != properties.end())
{
- const uint64_t* voltage = std::get_if<uint64_t>(&(propIt->second));
+ const std::vector<uint64_t>* voltage =
+ std::get_if<std::vector<uint64_t>>(&(propIt->second));
if (voltage != nullptr)
{
sys.inputVoltage = *voltage;
}
}
- for (const auto& model : models)
- {
- supportedConfigs.insert(std::make_pair(model, sys));
- }
+ supportedConfigs.emplace(*model, sys);
}
catch (std::exception& e)
{