Show option->text of BIOS knob in Redfish response.
GET on /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry/
shows list of Attributes under RegistryEntries. Each attribute
corresponds to a knob in BIOS.
If knob in BIOS is of type Enumeration, it will have 'option' with
'text' and 'value'. This text should be mapped to
attribute->Value->ValueDisplayName.
Code changes are made for the same.
Tested
Sample knobs from BIOS.
<knob name="AdaptiveRefreshMgmtLevel" ... >
<options>
<option text="Default" value="0x0"/>
<option text="Level A" value="0x1"/>
<option text="Level B" value="0x2"/>
<option text="Level C" value="0x3"/>
</options>
</knob>
<knob name="ADDDCEn" ... >
<options>
<option text="Disable" value="0x0"/>
<option text="Enable" value="0x1"/>
</options>
</knob>
Corresponding Redfish response in BiosAttributeRegistry
{
"AttributeName": "AdaptiveRefreshMgmtLevel",
"CurrentValue": "0x00",
"DefaultValue": "0x00",
"DisplayName": "AdaptiveRefreshMgmtLevel",
"HelpText": "ARFM Level when ... ",
"MenuPath": "./",
"ReadOnly": false,
"Type": "Enumeration",
"Value": [
{
"ValueDisplayName": "Default",
"ValueName": "0x0"
},
{
"ValueDisplayName": "Level A",
"ValueName": "0x1"
},
{
"ValueDisplayName": "Level B",
"ValueName": "0x2"
},
{
"ValueDisplayName": "Level C",
"ValueName": "0x3"
}
]
},
{
"AttributeName": "ADDDCEn",
"CurrentValue": "0x00",
"DefaultValue": "0x00",
"DisplayName": "ADDDCEn",
"HelpText": "Enable/Disable ADDDC Sparing",
"MenuPath": "./",
"ReadOnly": false,
"Type": "Enumeration",
"Value": [
{
"ValueDisplayName": "Disable",
"ValueName": "0x0"
},
{
"ValueDisplayName": "Enable",
"ValueName": "0x1"
}
]
}
Change-Id: Ie0134c3d47a5eae85b6838e6fe44e3ba31090c8e
Signed-off-by: Arun Lal K M <arun.lal@intel.com>
diff --git a/include/manager.hpp b/include/manager.hpp
index 3f91c88..680ad6d 100644
--- a/include/manager.hpp
+++ b/include/manager.hpp
@@ -43,11 +43,12 @@
public:
using BaseTable = std::map<
std::string,
- std::tuple<AttributeType, bool, std::string, std::string, std::string,
- std::variant<int64_t, std::string>,
- std::variant<int64_t, std::string>,
- std::vector<std::tuple<
- BoundType, std::variant<int64_t, std::string>>>>>;
+ std::tuple<
+ AttributeType, bool, std::string, std::string, std::string,
+ std::variant<int64_t, std::string>,
+ std::variant<int64_t, std::string>,
+ std::vector<std::tuple<
+ BoundType, std::variant<int64_t, std::string>, std::string>>>>;
using ResetFlag = std::map<std::string, ResetFlag>;
@@ -140,20 +141,20 @@
bool validateEnumOption(
const std::string& attrValue,
- const std::vector<
- std::tuple<BoundType, std::variant<int64_t, std::string>>>&
+ const std::vector<std::tuple<
+ BoundType, std::variant<int64_t, std::string>, std::string>>&
options);
bool validateStringOption(
const std::string& attrValue,
- const std::vector<
- std::tuple<BoundType, std::variant<int64_t, std::string>>>&
+ const std::vector<std::tuple<
+ BoundType, std::variant<int64_t, std::string>, std::string>>&
options);
bool validateIntegerOption(
const int64_t& attrValue,
- const std::vector<
- std::tuple<BoundType, std::variant<int64_t, std::string>>>&
+ const std::vector<std::tuple<
+ BoundType, std::variant<int64_t, std::string>, std::string>>&
options);
sdbusplus::asio::object_server& objServer;
diff --git a/src/manager.cpp b/src/manager.cpp
index fa619a8..cccd433 100644
--- a/src/manager.cpp
+++ b/src/manager.cpp
@@ -104,8 +104,8 @@
bool Manager::validateEnumOption(
const std::string& attrValue,
- const std::vector<
- std::tuple<BoundType, std::variant<int64_t, std::string>>>& options)
+ const std::vector<std::tuple<BoundType, std::variant<int64_t, std::string>,
+ std::string>>& options)
{
for (const auto& enumOptions : options)
{
@@ -122,8 +122,8 @@
bool Manager::validateStringOption(
const std::string& attrValue,
- const std::vector<
- std::tuple<BoundType, std::variant<int64_t, std::string>>>& options)
+ const std::vector<std::tuple<BoundType, std::variant<int64_t, std::string>,
+ std::string>>& options)
{
size_t minStringLength = 0;
size_t maxStringLength = 0;
@@ -158,8 +158,8 @@
bool Manager::validateIntegerOption(
const int64_t& attrValue,
- const std::vector<
- std::tuple<BoundType, std::variant<int64_t, std::string>>>& options)
+ const std::vector<std::tuple<BoundType, std::variant<int64_t, std::string>,
+ std::string>>& options)
{
int64_t lowerBound = 0;
int64_t upperBound = 0;