Consistently use generated enumerations
This commit causes all of Redfish to use generated enum values for enum
types. Using generated code prevents problems, and makes it more clear
what types are allowed.
Doing this found two places where we had structs that didn't fulfill the
schema. They have been commented, but will be fixed with a breaking
change at some point in the future.
Tested: WIP
Change-Id: I5fdd2f2dfb6ec05606a522e1f4e331f982c8e476
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/redfish-core/lib/cable.hpp b/redfish-core/lib/cable.hpp
index bc73267..41a5588 100644
--- a/redfish-core/lib/cable.hpp
+++ b/redfish-core/lib/cable.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "dbus_utility.hpp"
+#include "generated/enums/resource.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include "utils/collection.hpp"
@@ -121,7 +122,8 @@
if (!present)
{
- asyncResp->res.jsonValue["Status"]["State"] = "Absent";
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Absent;
}
});
}
@@ -178,7 +180,8 @@
boost::urls::format("/redfish/v1/Cables/{}", cableId);
asyncResp->res.jsonValue["Id"] = cableId;
asyncResp->res.jsonValue["Name"] = "Cable";
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Enabled;
getCableProperties(asyncResp, objectPath, serviceMap);
return;
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index f250c2f..676c52a 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -17,6 +17,9 @@
#include "app.hpp"
#include "dbus_utility.hpp"
+#include "generated/enums/action_info.hpp"
+#include "generated/enums/chassis.hpp"
+#include "generated/enums/resource.hpp"
#include "led.hpp"
#include "query.hpp"
#include "redfish_util.hpp"
@@ -121,14 +124,16 @@
// Verify Chassis State
if (chassisState == "xyz.openbmc_project.State.Chassis.PowerState.On")
{
- asyncResp->res.jsonValue["PowerState"] = "On";
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["PowerState"] = resource::PowerState::On;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Enabled;
}
else if (chassisState ==
"xyz.openbmc_project.State.Chassis.PowerState.Off")
{
- asyncResp->res.jsonValue["PowerState"] = "Off";
- asyncResp->res.jsonValue["Status"]["State"] = "StandbyOffline";
+ asyncResp->res.jsonValue["PowerState"] = resource::PowerState::On;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::StandbyOffline;
}
});
}
@@ -435,7 +440,7 @@
// SensorCollection
asyncResp->res.jsonValue["Sensors"]["@odata.id"] =
boost::urls::format("/redfish/v1/Chassis/{}/Sensors", chassisId);
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
nlohmann::json::array_t computerSystems;
nlohmann::json::object_t system;
@@ -494,7 +499,8 @@
asyncResp->res.jsonValue["@odata.id"] =
boost::urls::format("/redfish/v1/Chassis/{}", chassisId);
asyncResp->res.jsonValue["Name"] = "Chassis Collection";
- asyncResp->res.jsonValue["ChassisType"] = "RackMount";
+ asyncResp->res.jsonValue["ChassisType"] =
+ chassis::ChassisType::RackMount;
asyncResp->res.jsonValue["Actions"]["#Chassis.Reset"]["target"] =
boost::urls::format("/redfish/v1/Chassis/{}/Actions/Chassis.Reset",
chassisId);
@@ -895,7 +901,7 @@
nlohmann::json::object_t parameter;
parameter["Name"] = "ResetType";
parameter["Required"] = true;
- parameter["DataType"] = "String";
+ parameter["DataType"] = action_info::ParameterTypes::String;
nlohmann::json::array_t allowed;
allowed.emplace_back("PowerCycle");
parameter["AllowableValues"] = std::move(allowed);
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index a3cda9c..3e97869 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -19,6 +19,8 @@
#include "dbus_singleton.hpp"
#include "dbus_utility.hpp"
#include "error_messages.hpp"
+#include "generated/enums/ethernet_interface.hpp"
+#include "generated/enums/resource.hpp"
#include "human_sort.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
@@ -1849,13 +1851,15 @@
if (ethData.nicEnabled)
{
- jsonResponse["LinkStatus"] = ethData.linkUp ? "LinkUp" : "LinkDown";
- jsonResponse["Status"]["State"] = "Enabled";
+ jsonResponse["LinkStatus"] =
+ ethData.linkUp ? ethernet_interface::LinkStatus::LinkUp
+ : ethernet_interface::LinkStatus::LinkDown;
+ jsonResponse["Status"]["State"] = resource::State::Enabled;
}
else
{
- jsonResponse["LinkStatus"] = "NoLink";
- jsonResponse["Status"]["State"] = "Disabled";
+ jsonResponse["LinkStatus"] = ethernet_interface::LinkStatus::NoLink;
+ jsonResponse["Status"]["State"] = resource::State::Disabled;
}
jsonResponse["SpeedMbps"] = ethData.speed;
@@ -1892,7 +1896,8 @@
if (ethData.vlanId)
{
- jsonResponse["EthernetInterfaceType"] = "Virtual";
+ jsonResponse["EthernetInterfaceType"] =
+ ethernet_interface::EthernetDeviceType::Virtual;
jsonResponse["VLAN"]["VLANEnable"] = true;
jsonResponse["VLAN"]["VLANId"] = *ethData.vlanId;
jsonResponse["VLAN"]["Tagged"] = true;
@@ -1908,7 +1913,8 @@
}
else
{
- jsonResponse["EthernetInterfaceType"] = "Physical";
+ jsonResponse["EthernetInterfaceType"] =
+ ethernet_interface::EthernetDeviceType::Physical;
}
jsonResponse["NameServers"] = ethData.nameServers;
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
index 7307571..0b6dce6 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -16,6 +16,7 @@
#pragma once
#include "app.hpp"
#include "event_service_manager.hpp"
+#include "generated/enums/event_service.hpp"
#include "http/utility.hpp"
#include "logging.hpp"
#include "query.hpp"
@@ -662,7 +663,8 @@
asyncResp->res.jsonValue["@odata.type"] =
"#EventDestination.v1_8_0.EventDestination";
- asyncResp->res.jsonValue["Protocol"] = "Redfish";
+ asyncResp->res.jsonValue["Protocol"] =
+ event_destination::EventDestinationProtocol::Redfish;
asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
"/redfish/v1/EventService/Subscriptions/{}", id);
asyncResp->res.jsonValue["Id"] = id;
diff --git a/redfish-core/lib/fabric_adapters.hpp b/redfish-core/lib/fabric_adapters.hpp
index 11dc7c6..c7bdbb7 100644
--- a/redfish-core/lib/fabric_adapters.hpp
+++ b/redfish-core/lib/fabric_adapters.hpp
@@ -2,6 +2,7 @@
#include "app.hpp"
#include "dbus_utility.hpp"
+#include "generated/enums/resource.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include "utils/collection.hpp"
@@ -127,7 +128,8 @@
if (!present)
{
- asyncResp->res.jsonValue["Status"]["State"] = "Absent";
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Absent;
}
});
}
@@ -154,7 +156,8 @@
if (!functional)
{
- asyncResp->res.jsonValue["Status"]["Health"] = "Critical";
+ asyncResp->res.jsonValue["Status"]["Health"] =
+ resource::Health::Critical;
}
});
}
@@ -175,8 +178,8 @@
asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
"/redfish/v1/Systems/{}/FabricAdapters/{}", systemName, adapterId);
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
- asyncResp->res.jsonValue["Status"]["Health"] = "OK";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
+ asyncResp->res.jsonValue["Status"]["Health"] = resource::Health::OK;
getFabricAdapterLocation(asyncResp, serviceName, fabricAdapterPath);
getFabricAdapterAsset(asyncResp, serviceName, fabricAdapterPath);
diff --git a/redfish-core/lib/fan.hpp b/redfish-core/lib/fan.hpp
index 39b9e2a..7245287 100644
--- a/redfish-core/lib/fan.hpp
+++ b/redfish-core/lib/fan.hpp
@@ -3,6 +3,7 @@
#include "app.hpp"
#include "dbus_utility.hpp"
#include "error_messages.hpp"
+#include "generated/enums/resource.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include "utils/chassis_utils.hpp"
@@ -224,8 +225,8 @@
resp.jsonValue["Id"] = fanId;
resp.jsonValue["@odata.id"] = boost::urls::format(
"/redfish/v1/Chassis/{}/ThermalSubsystem/Fans/{}", chassisId, fanId);
- resp.jsonValue["Status"]["State"] = "Enabled";
- resp.jsonValue["Status"]["Health"] = "OK";
+ resp.jsonValue["Status"]["State"] = resource::State::Enabled;
+ resp.jsonValue["Status"]["Health"] = resource::Health::OK;
}
inline void getFanHealth(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
@@ -248,7 +249,8 @@
if (!value)
{
- asyncResp->res.jsonValue["Status"]["Health"] = "Critical";
+ asyncResp->res.jsonValue["Status"]["Health"] =
+ resource::Health::Critical;
}
});
}
@@ -273,7 +275,8 @@
if (!value)
{
- asyncResp->res.jsonValue["Status"]["State"] = "Absent";
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Absent;
}
});
}
diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp
index 963fbfb..a69908a 100644
--- a/redfish-core/lib/hypervisor_system.hpp
+++ b/redfish-core/lib/hypervisor_system.hpp
@@ -5,6 +5,9 @@
#include "dbus_utility.hpp"
#include "error_messages.hpp"
#include "ethernet.hpp"
+#include "generated/enums/action_info.hpp"
+#include "generated/enums/computer_system.hpp"
+#include "generated/enums/resource.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include "utils/ip_utils.hpp"
@@ -53,37 +56,45 @@
// Verify Host State
if (hostState == "xyz.openbmc_project.State.Host.HostState.Running")
{
- asyncResp->res.jsonValue["PowerState"] = "On";
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["PowerState"] = resource::PowerState::On;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Enabled;
}
else if (hostState == "xyz.openbmc_project.State.Host.HostState."
"Quiesced")
{
- asyncResp->res.jsonValue["PowerState"] = "On";
- asyncResp->res.jsonValue["Status"]["State"] = "Quiesced";
+ asyncResp->res.jsonValue["PowerState"] = resource::PowerState::On;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Quiesced;
}
else if (hostState == "xyz.openbmc_project.State.Host.HostState."
"Standby")
{
- asyncResp->res.jsonValue["PowerState"] = "On";
- asyncResp->res.jsonValue["Status"]["State"] = "StandbyOffline";
+ asyncResp->res.jsonValue["PowerState"] = resource::PowerState::On;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::StandbyOffline;
}
else if (hostState == "xyz.openbmc_project.State.Host.HostState."
"TransitioningToRunning")
{
- asyncResp->res.jsonValue["PowerState"] = "PoweringOn";
- asyncResp->res.jsonValue["Status"]["State"] = "Starting";
+ asyncResp->res.jsonValue["PowerState"] =
+ resource::PowerState::PoweringOn;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Starting;
}
else if (hostState == "xyz.openbmc_project.State.Host.HostState."
"TransitioningToOff")
{
- asyncResp->res.jsonValue["PowerState"] = "PoweringOff";
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["PowerState"] =
+ resource::PowerState::PoweringOff;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Enabled;
}
else if (hostState == "xyz.openbmc_project.State.Host.HostState.Off")
{
- asyncResp->res.jsonValue["PowerState"] = "Off";
- asyncResp->res.jsonValue["Status"]["State"] = "Disabled";
+ asyncResp->res.jsonValue["PowerState"] = resource::PowerState::Off;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Disabled;
}
else
{
@@ -711,7 +722,8 @@
asyncResp->res.jsonValue["Description"] = "Hypervisor";
asyncResp->res.jsonValue["Name"] = "Hypervisor";
asyncResp->res.jsonValue["Id"] = "hypervisor";
- asyncResp->res.jsonValue["SystemType"] = "OS";
+ asyncResp->res.jsonValue["SystemType"] =
+ computer_system::SystemType::OS;
nlohmann::json::array_t managedBy;
nlohmann::json::object_t manager;
manager["@odata.id"] = boost::urls::format(
@@ -875,7 +887,7 @@
nlohmann::json::object_t parameter;
parameter["Name"] = "ResetType";
parameter["Required"] = true;
- parameter["DataType"] = "String";
+ parameter["DataType"] = action_info::ParameterTypes::String;
nlohmann::json::array_t allowed;
allowed.emplace_back("On");
parameter["AllowableValues"] = std::move(allowed);
diff --git a/redfish-core/lib/led.hpp b/redfish-core/lib/led.hpp
index 8cbe86a..b54edb0 100644
--- a/redfish-core/lib/led.hpp
+++ b/redfish-core/lib/led.hpp
@@ -18,6 +18,7 @@
#include "app.hpp"
#include "async_resp.hpp"
#include "dbus_utility.hpp"
+#include "generated/enums/chassis.hpp"
#include "redfish_util.hpp"
#include <sdbusplus/asio/property.hpp>
@@ -54,7 +55,8 @@
// Blinking ON, no need to check enclosure_identify assert.
if (!ec && blinking)
{
- asyncResp->res.jsonValue["IndicatorLED"] = "Blinking";
+ asyncResp->res.jsonValue["IndicatorLED"] =
+ chassis::IndicatorLED::Blinking;
return;
}
@@ -80,11 +82,13 @@
if (ledOn)
{
- asyncResp->res.jsonValue["IndicatorLED"] = "Lit";
+ asyncResp->res.jsonValue["IndicatorLED"] =
+ chassis::IndicatorLED::Lit;
}
else
{
- asyncResp->res.jsonValue["IndicatorLED"] = "Off";
+ asyncResp->res.jsonValue["IndicatorLED"] =
+ chassis::IndicatorLED::Off;
}
});
});
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 540a1be..7f27515 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -19,6 +19,7 @@
#include "dbus_utility.hpp"
#include "error_messages.hpp"
#include "generated/enums/log_entry.hpp"
+#include "generated/enums/log_service.hpp"
#include "gzfile.hpp"
#include "http_utility.hpp"
#include "human_sort.hpp"
@@ -1241,7 +1242,8 @@
asyncResp->res.jsonValue["Name"] = "Event Log Service";
asyncResp->res.jsonValue["Description"] = "System Event Log Service";
asyncResp->res.jsonValue["Id"] = "EventLog";
- asyncResp->res.jsonValue["OverWritePolicy"] = "WrapsWhenFull";
+ asyncResp->res.jsonValue["OverWritePolicy"] =
+ log_service::OverWritePolicy::WrapsWhenFull;
std::pair<std::string, std::string> redfishDateTimeOffset =
redfish::time_utils::getDateTimeOffsetNow();
@@ -2076,8 +2078,8 @@
logEntryJson["Name"] = "Host Logger Entry";
logEntryJson["Id"] = logEntryID;
logEntryJson["Message"] = msg;
- logEntryJson["EntryType"] = "Oem";
- logEntryJson["Severity"] = "OK";
+ logEntryJson["EntryType"] = log_entry::LogEntryType::Oem;
+ logEntryJson["Severity"] = log_entry::EventSeverity::OK;
logEntryJson["OemRecordFormat"] = "Host Logger Entry";
}
@@ -2384,28 +2386,29 @@
const std::string& dumpType)
{
std::string dumpPath;
- std::string overWritePolicy;
+ log_service::OverWritePolicy overWritePolicy =
+ log_service::OverWritePolicy::Invalid;
bool collectDiagnosticDataSupported = false;
if (dumpType == "BMC")
{
dumpPath = std::format("/redfish/v1/Managers/{}/LogServices/Dump",
BMCWEB_REDFISH_MANAGER_URI_NAME);
- overWritePolicy = "WrapsWhenFull";
+ overWritePolicy = log_service::OverWritePolicy::WrapsWhenFull;
collectDiagnosticDataSupported = true;
}
else if (dumpType == "FaultLog")
{
dumpPath = std::format("/redfish/v1/Managers/{}/LogServices/FaultLog",
BMCWEB_REDFISH_MANAGER_URI_NAME);
- overWritePolicy = "Unknown";
+ overWritePolicy = log_service::OverWritePolicy::Unknown;
collectDiagnosticDataSupported = false;
}
else if (dumpType == "System")
{
dumpPath = std::format("/redfish/v1/Systems/{}/LogServices/Dump",
BMCWEB_REDFISH_SYSTEM_URI_NAME);
- overWritePolicy = "WrapsWhenFull";
+ overWritePolicy = log_service::OverWritePolicy::WrapsWhenFull;
collectDiagnosticDataSupported = true;
}
else
@@ -2421,7 +2424,7 @@
asyncResp->res.jsonValue["Name"] = "Dump LogService";
asyncResp->res.jsonValue["Description"] = dumpType + " Dump LogService";
asyncResp->res.jsonValue["Id"] = std::filesystem::path(dumpPath).filename();
- asyncResp->res.jsonValue["OverWritePolicy"] = std::move(overWritePolicy);
+ asyncResp->res.jsonValue["OverWritePolicy"] = overWritePolicy;
std::pair<std::string, std::string> redfishDateTimeOffset =
redfish::time_utils::getDateTimeOffsetNow();
@@ -2940,7 +2943,8 @@
asyncResp->res.jsonValue["Name"] = "Open BMC Oem Crashdump Service";
asyncResp->res.jsonValue["Description"] = "Oem Crashdump Service";
asyncResp->res.jsonValue["Id"] = "Crashdump";
- asyncResp->res.jsonValue["OverWritePolicy"] = "WrapsWhenFull";
+ asyncResp->res.jsonValue["OverWritePolicy"] =
+ log_service::OverWritePolicy::WrapsWhenFull;
asyncResp->res.jsonValue["MaxNumberOfRecords"] = 3;
std::pair<std::string, std::string> redfishDateTimeOffset =
@@ -3051,7 +3055,7 @@
BMCWEB_REDFISH_SYSTEM_URI_NAME, logID);
logEntry["Name"] = "CPU Crashdump";
logEntry["Id"] = logID;
- logEntry["EntryType"] = "Oem";
+ logEntry["EntryType"] = log_entry::LogEntryType::Oem;
logEntry["AdditionalDataURI"] = std::move(crashdumpURI);
logEntry["DiagnosticDataType"] = "OEM";
logEntry["OEMDiagnosticDataType"] = "PECICrashdump";
@@ -3525,7 +3529,8 @@
asyncResp->res.jsonValue["Name"] = "POST Code Log Service";
asyncResp->res.jsonValue["Description"] = "POST Code Log Service";
asyncResp->res.jsonValue["Id"] = "PostCodes";
- asyncResp->res.jsonValue["OverWritePolicy"] = "WrapsWhenFull";
+ asyncResp->res.jsonValue["OverWritePolicy"] =
+ log_service::OverWritePolicy::WrapsWhenFull;
asyncResp->res.jsonValue["Entries"]["@odata.id"] =
std::format("/redfish/v1/Systems/{}/LogServices/PostCodes/Entries",
BMCWEB_REDFISH_SYSTEM_URI_NAME);
diff --git a/redfish-core/lib/manager_logservices_journal.hpp b/redfish-core/lib/manager_logservices_journal.hpp
index 797a44b..c8926c3 100644
--- a/redfish-core/lib/manager_logservices_journal.hpp
+++ b/redfish-core/lib/manager_logservices_journal.hpp
@@ -207,7 +207,7 @@
bmcJournalLogEntryJson["Name"] = "BMC Journal Entry";
bmcJournalLogEntryJson["Id"] = bmcJournalLogEntryID;
bmcJournalLogEntryJson["Message"] = std::move(message);
- bmcJournalLogEntryJson["EntryType"] = "Oem";
+ bmcJournalLogEntryJson["EntryType"] = log_entry::LogEntryType::Oem;
log_entry::EventSeverity severityEnum = log_entry::EventSeverity::OK;
if (severity <= 2)
{
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index c9ac95c..3c08cb5 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -19,6 +19,9 @@
#include "app.hpp"
#include "dbus_utility.hpp"
+#include "generated/enums/action_info.hpp"
+#include "generated/enums/manager.hpp"
+#include "generated/enums/resource.hpp"
#include "query.hpp"
#include "redfish_util.hpp"
#include "registries/privilege_registry.hpp"
@@ -288,7 +291,7 @@
nlohmann::json::object_t parameter;
parameter["Name"] = "ResetType";
parameter["Required"] = true;
- parameter["DataType"] = "String";
+ parameter["DataType"] = action_info::ParameterTypes::String;
nlohmann::json::array_t allowableValues;
allowableValues.emplace_back("GracefulRestart");
@@ -1938,13 +1941,15 @@
{
if (val == "active")
{
- asyncResp->res.jsonValue["Status"]["Health"] = "Critical";
- asyncResp->res.jsonValue["Status"]["State"] = "Quiesced";
+ asyncResp->res.jsonValue["Status"]["Health"] =
+ resource::Health::Critical;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Quiesced;
return;
}
}
- asyncResp->res.jsonValue["Status"]["Health"] = "OK";
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["Health"] = resource::Health::OK;
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
});
}
@@ -1976,9 +1981,9 @@
asyncResp->res.jsonValue["Name"] = "OpenBmc Manager";
asyncResp->res.jsonValue["Description"] =
"Baseboard Management Controller";
- asyncResp->res.jsonValue["PowerState"] = "On";
+ asyncResp->res.jsonValue["PowerState"] = resource::PowerState::On;
- asyncResp->res.jsonValue["ManagerType"] = "BMC";
+ asyncResp->res.jsonValue["ManagerType"] = manager::ManagerType::BMC;
asyncResp->res.jsonValue["UUID"] = systemd_utils::getUuid();
asyncResp->res.jsonValue["ServiceEntryPointUUID"] = uuid;
asyncResp->res.jsonValue["Model"] = "OpenBmc"; // TODO(ed), get model
@@ -2126,8 +2131,10 @@
}
if (val < 1.0)
{
- asyncResp->res.jsonValue["Status"]["Health"] = "OK";
- asyncResp->res.jsonValue["Status"]["State"] = "Starting";
+ asyncResp->res.jsonValue["Status"]["Health"] =
+ resource::Health::OK;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Starting;
return;
}
checkForQuiesced(asyncResp);
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index c77a534..cd87d42 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -19,6 +19,8 @@
#include "app.hpp"
#include "dbus_utility.hpp"
+#include "generated/enums/memory.hpp"
+#include "generated/enums/resource.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include "utils/collection.hpp"
@@ -399,8 +401,10 @@
{
asyncResp->res.jsonValue[jsonPtr]["Id"] = dimmId;
asyncResp->res.jsonValue[jsonPtr]["Name"] = "DIMM Slot";
- asyncResp->res.jsonValue[jsonPtr]["Status"]["State"] = "Enabled";
- asyncResp->res.jsonValue[jsonPtr]["Status"]["Health"] = "OK";
+ asyncResp->res.jsonValue[jsonPtr]["Status"]["State"] =
+ resource::State::Enabled;
+ asyncResp->res.jsonValue[jsonPtr]["Status"]["Health"] =
+ resource::Health::OK;
const uint16_t* memoryDataWidth = nullptr;
const size_t* memorySizeInKB = nullptr;
@@ -477,7 +481,8 @@
if (present != nullptr && !*present)
{
- asyncResp->res.jsonValue[jsonPtr]["Status"]["State"] = "Absent";
+ asyncResp->res.jsonValue[jsonPtr]["Status"]["State"] =
+ resource::State::Absent;
}
if (memoryTotalWidth != nullptr)
@@ -552,11 +557,13 @@
}
if (memoryType->find("DDR") != std::string::npos)
{
- asyncResp->res.jsonValue[jsonPtr]["MemoryType"] = "DRAM";
+ asyncResp->res.jsonValue[jsonPtr]["MemoryType"] =
+ memory::MemoryType::DRAM;
}
else if (memoryType->ends_with("Logical"))
{
- asyncResp->res.jsonValue[jsonPtr]["MemoryType"] = "IntelOptane";
+ asyncResp->res.jsonValue[jsonPtr]["MemoryType"] =
+ memory::MemoryType::IntelOptane;
}
}
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
index 36f2334..06244ac 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -3,6 +3,7 @@
#include "app.hpp"
#include "dbus_utility.hpp"
#include "generated/enums/metric_report_definition.hpp"
+#include "generated/enums/resource.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include "sensors.hpp"
@@ -356,11 +357,11 @@
if (enabled)
{
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
}
else
{
- asyncResp->res.jsonValue["Status"]["State"] = "Disabled";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Disabled;
}
metric_report_definition::ReportUpdatesEnum redfishReportUpdates =
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 410c32c..2b67f18 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -18,6 +18,7 @@
#include "app.hpp"
#include "dbus_utility.hpp"
#include "error_messages.hpp"
+#include "generated/enums/resource.hpp"
#include "query.hpp"
#include "redfish_util.hpp"
#include "registries/privilege_registry.hpp"
@@ -171,9 +172,9 @@
asyncResp->res.jsonValue["Id"] = "NetworkProtocol";
asyncResp->res.jsonValue["Name"] = "Manager Network Protocol";
asyncResp->res.jsonValue["Description"] = "Manager Network Service";
- asyncResp->res.jsonValue["Status"]["Health"] = "OK";
- asyncResp->res.jsonValue["Status"]["HealthRollup"] = "OK";
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["Health"] = resource::Health::OK;
+ asyncResp->res.jsonValue["Status"]["HealthRollup"] = resource::Health::OK;
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
// HTTP is Mandatory attribute as per OCP Baseline Profile - v1.0.0,
// but from security perspective it is not recommended to use.
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index 3cfed3a..4ab2fd8 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -18,6 +18,7 @@
#include "app.hpp"
#include "dbus_utility.hpp"
+#include "generated/enums/resource.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include "utils/collection.hpp"
@@ -316,7 +317,8 @@
if (!value)
{
- asyncResp->res.jsonValue["Status"]["Health"] = "Critical";
+ asyncResp->res.jsonValue["Status"]["Health"] =
+ resource::Health::Critical;
}
});
}
@@ -342,7 +344,8 @@
if (!value)
{
- asyncResp->res.jsonValue["Status"]["State"] = "Absent";
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Absent;
}
});
}
@@ -546,8 +549,8 @@
BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId);
asyncResp->res.jsonValue["Name"] = "PCIe Device";
asyncResp->res.jsonValue["Id"] = pcieDeviceId;
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
- asyncResp->res.jsonValue["Status"]["Health"] = "OK";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
+ asyncResp->res.jsonValue["Status"]["Health"] = resource::Health::OK;
}
inline void afterGetValidPcieDevicePath(
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index cd7fa0f..c43c71d 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -18,6 +18,7 @@
#include "app.hpp"
#include "dbus_utility.hpp"
+#include "generated/enums/power.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include "sensors.hpp"
@@ -183,7 +184,8 @@
// LimitException is Mandatory attribute as per OCP
// Baseline Profile – v1.0.0, so currently making it
// "NoAction" as default value to make it OCP Compliant.
- sensorJson["PowerLimit"]["LimitException"] = "NoAction";
+ sensorJson["PowerLimit"]["LimitException"] =
+ power::PowerLimitException::NoAction;
if (enabled)
{
diff --git a/redfish-core/lib/power_subsystem.hpp b/redfish-core/lib/power_subsystem.hpp
index d54fd18..ff7d52c 100644
--- a/redfish-core/lib/power_subsystem.hpp
+++ b/redfish-core/lib/power_subsystem.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "app.hpp"
+#include "generated/enums/resource.hpp"
#include "logging.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
@@ -35,8 +36,8 @@
asyncResp->res.jsonValue["Id"] = "PowerSubsystem";
asyncResp->res.jsonValue["@odata.id"] =
boost::urls::format("/redfish/v1/Chassis/{}/PowerSubsystem", chassisId);
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
- asyncResp->res.jsonValue["Status"]["Health"] = "OK";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
+ asyncResp->res.jsonValue["Status"]["Health"] = resource::Health::OK;
asyncResp->res.jsonValue["PowerSupplies"]["@odata.id"] =
boost::urls::format(
"/redfish/v1/Chassis/{}/PowerSubsystem/PowerSupplies", chassisId);
diff --git a/redfish-core/lib/power_supply.hpp b/redfish-core/lib/power_supply.hpp
index f59ed57..31cd1f9 100644
--- a/redfish-core/lib/power_supply.hpp
+++ b/redfish-core/lib/power_supply.hpp
@@ -2,6 +2,7 @@
#include "app.hpp"
#include "dbus_utility.hpp"
+#include "generated/enums/resource.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include "utils/chassis_utils.hpp"
@@ -222,7 +223,8 @@
if (!value)
{
- asyncResp->res.jsonValue["Status"]["State"] = "Absent";
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Absent;
}
});
}
@@ -248,7 +250,8 @@
if (!value)
{
- asyncResp->res.jsonValue["Status"]["Health"] = "Critical";
+ asyncResp->res.jsonValue["Status"]["Health"] =
+ resource::Health::Critical;
}
});
}
@@ -475,8 +478,8 @@
"/redfish/v1/Chassis/{}/PowerSubsystem/PowerSupplies/{}", chassisId,
powerSupplyId);
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
- asyncResp->res.jsonValue["Status"]["Health"] = "OK";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
+ asyncResp->res.jsonValue["Status"]["Health"] = resource::Health::OK;
dbus::utility::getDbusObject(
powerSupplyPath, powerSupplyInterface,
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 8015369..b49f13b 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -20,6 +20,7 @@
#include "dbus_utility.hpp"
#include "error_messages.hpp"
#include "generated/enums/processor.hpp"
+#include "generated/enums/resource.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include "utils/collection.hpp"
@@ -83,8 +84,8 @@
BMCWEB_LOG_DEBUG("Get CPU resources by interface.");
// Set the default value of state
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
- asyncResp->res.jsonValue["Status"]["Health"] = "OK";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
+ asyncResp->res.jsonValue["Status"]["Health"] = resource::Health::OK;
for (const auto& interface : cpuInterfacesProperties)
{
@@ -102,7 +103,8 @@
if (!*cpuPresent)
{
// Slot is not populated
- asyncResp->res.jsonValue["Status"]["State"] = "Absent";
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Absent;
}
}
else if (property.first == "Functional")
@@ -115,7 +117,8 @@
}
if (!*cpuFunctional)
{
- asyncResp->res.jsonValue["Status"]["Health"] = "Critical";
+ asyncResp->res.jsonValue["Status"]["Health"] =
+ resource::Health::Critical;
}
}
else if (property.first == "CoreCount")
@@ -240,7 +243,8 @@
}
asyncResp->res.jsonValue["Id"] = cpuId;
asyncResp->res.jsonValue["Name"] = "Processor";
- asyncResp->res.jsonValue["ProcessorType"] = "CPU";
+ asyncResp->res.jsonValue["ProcessorType"] =
+ processor::ProcessorType::CPU;
bool slotPresent = false;
std::string corePath = objPath + "/core";
@@ -542,7 +546,8 @@
asyncResp->res.jsonValue["Name"] = "Processor";
asyncResp->res.jsonValue["Status"]["State"] = state;
asyncResp->res.jsonValue["Status"]["Health"] = health;
- asyncResp->res.jsonValue["ProcessorType"] = "Accelerator";
+ asyncResp->res.jsonValue["ProcessorType"] =
+ processor::ProcessorType::Accelerator;
});
}
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 8be861b..228fae04 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -18,8 +18,10 @@
#include "app.hpp"
#include "dbus_singleton.hpp"
#include "dbus_utility.hpp"
+#include "generated/enums/redundancy.hpp"
#include "generated/enums/resource.hpp"
#include "generated/enums/sensor.hpp"
+#include "generated/enums/thermal.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include "str_utility.hpp"
@@ -714,13 +716,13 @@
switch (inventoryItem->ledState)
{
case LedState::OFF:
- sensorJson["IndicatorLED"] = "Off";
+ sensorJson["IndicatorLED"] = resource::IndicatorLED::Off;
break;
case LedState::ON:
- sensorJson["IndicatorLED"] = "Lit";
+ sensorJson["IndicatorLED"] = resource::IndicatorLED::Lit;
break;
case LedState::BLINK:
- sensorJson["IndicatorLED"] = "Blinking";
+ sensorJson["IndicatorLED"] = resource::IndicatorLED::Blinking;
break;
default:
break;
@@ -832,7 +834,7 @@
else if (sensorType == "fan" || sensorType == "fan_tach")
{
unit = "/Reading"_json_pointer;
- sensorJson["ReadingUnits"] = "RPM";
+ sensorJson["ReadingUnits"] = thermal::ReadingUnits::RPM;
sensorJson["@odata.type"] = "#Thermal.v1_3_0.Fan";
setLedState(sensorJson, inventoryItem);
forceToInt = true;
@@ -840,7 +842,7 @@
else if (sensorType == "fan_pwm")
{
unit = "/Reading"_json_pointer;
- sensorJson["ReadingUnits"] = "Percent";
+ sensorJson["ReadingUnits"] = thermal::ReadingUnits::Percent;
sensorJson["@odata.type"] = "#Thermal.v1_3_0.Fan";
setLedState(sensorJson, inventoryItem);
forceToInt = true;
@@ -1174,11 +1176,11 @@
redundancy["@odata.id"] = std::move(url);
redundancy["@odata.type"] = "#Redundancy.v1_3_2.Redundancy";
redundancy["MinNumNeeded"] = minNumNeeded;
- redundancy["Mode"] = "N+m";
+ redundancy["Mode"] = redundancy::RedundancyType::NPlusM;
redundancy["Name"] = name;
redundancy["RedundancySet"] = redfishCollection;
redundancy["Status"]["Health"] = health;
- redundancy["Status"]["State"] = "Enabled";
+ redundancy["Status"]["State"] = resource::State::Enabled;
jResp.emplace_back(std::move(redundancy));
});
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index e0ad737..cb5e752 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -21,6 +21,7 @@
#include "dbus_utility.hpp"
#include "generated/enums/drive.hpp"
#include "generated/enums/protocol.hpp"
+#include "generated/enums/resource.hpp"
#include "human_sort.hpp"
#include "query.hpp"
#include "redfish_util.hpp"
@@ -178,7 +179,7 @@
BMCWEB_REDFISH_SYSTEM_URI_NAME, storageId);
asyncResp->res.jsonValue["Name"] = "Storage";
asyncResp->res.jsonValue["Id"] = storageId;
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
getDrives(asyncResp);
asyncResp->res.jsonValue["Controllers"]["@odata.id"] =
@@ -242,7 +243,7 @@
boost::urls::format("/redfish/v1/Storage/{}", storageId);
asyncResp->res.jsonValue["Name"] = "Storage";
asyncResp->res.jsonValue["Id"] = storageId;
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
// Storage subsystem to Storage link.
nlohmann::json::array_t storageServices;
@@ -360,7 +361,8 @@
if (!isPresent)
{
- asyncResp->res.jsonValue["Status"]["State"] = "Absent";
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Absent;
}
});
}
@@ -386,7 +388,8 @@
// calls
if (updating)
{
- asyncResp->res.jsonValue["Status"]["State"] = "Updating";
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Updating;
}
});
}
@@ -680,7 +683,7 @@
});
// default it to Enabled
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
addAllDriveInfo(asyncResp, connectionNames[0].first, path,
connectionNames[0].second);
@@ -865,7 +868,7 @@
asyncResp->res.jsonValue["Name"] = driveName;
asyncResp->res.jsonValue["Id"] = driveName;
// default it to Enabled
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
nlohmann::json::object_t linkChassisNav;
linkChassisNav["@odata.id"] =
@@ -1031,7 +1034,7 @@
BMCWEB_REDFISH_SYSTEM_URI_NAME, controllerId);
asyncResp->res.jsonValue["Name"] = controllerId;
asyncResp->res.jsonValue["Id"] = controllerId;
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
sdbusplus::asio::getProperty<bool>(
*crow::connections::systemBus, connectionName, path,
@@ -1046,7 +1049,8 @@
}
if (!isPresent)
{
- asyncResp->res.jsonValue["Status"]["State"] = "Absent";
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Absent;
}
});
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 8c4f991..8a0b1c3 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -20,7 +20,9 @@
#include "app.hpp"
#include "dbus_singleton.hpp"
#include "dbus_utility.hpp"
+#include "generated/enums/action_info.hpp"
#include "generated/enums/computer_system.hpp"
+#include "generated/enums/open_bmc_computer_system.hpp"
#include "generated/enums/resource.hpp"
#include "hypervisor_system.hpp"
#include "led.hpp"
@@ -557,38 +559,46 @@
// Verify Host State
if (hostState == "xyz.openbmc_project.State.Host.HostState.Running")
{
- asyncResp->res.jsonValue["PowerState"] = "On";
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["PowerState"] = resource::PowerState::On;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Enabled;
}
else if (hostState ==
"xyz.openbmc_project.State.Host.HostState.Quiesced")
{
- asyncResp->res.jsonValue["PowerState"] = "On";
- asyncResp->res.jsonValue["Status"]["State"] = "Quiesced";
+ asyncResp->res.jsonValue["PowerState"] = resource::PowerState::On;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Quiesced;
}
else if (hostState ==
"xyz.openbmc_project.State.Host.HostState.DiagnosticMode")
{
- asyncResp->res.jsonValue["PowerState"] = "On";
- asyncResp->res.jsonValue["Status"]["State"] = "InTest";
+ asyncResp->res.jsonValue["PowerState"] = resource::PowerState::On;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::InTest;
}
else if (
hostState ==
"xyz.openbmc_project.State.Host.HostState.TransitioningToRunning")
{
- asyncResp->res.jsonValue["PowerState"] = "PoweringOn";
- asyncResp->res.jsonValue["Status"]["State"] = "Starting";
+ asyncResp->res.jsonValue["PowerState"] =
+ resource::PowerState::PoweringOn;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Starting;
}
else if (hostState ==
"xyz.openbmc_project.State.Host.HostState.TransitioningToOff")
{
- asyncResp->res.jsonValue["PowerState"] = "PoweringOff";
- asyncResp->res.jsonValue["Status"]["State"] = "Disabled";
+ asyncResp->res.jsonValue["PowerState"] =
+ resource::PowerState::PoweringOff;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Disabled;
}
else
{
- asyncResp->res.jsonValue["PowerState"] = "Off";
- asyncResp->res.jsonValue["Status"]["State"] = "Disabled";
+ asyncResp->res.jsonValue["PowerState"] = resource::PowerState::Off;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Disabled;
}
});
}
@@ -1373,11 +1383,13 @@
if (value)
{
- asyncResp->res.jsonValue["Boot"]["StopBootOnFault"] = "AnyFault";
+ asyncResp->res.jsonValue["Boot"]["StopBootOnFault"] =
+ computer_system::StopBootOnFault::AnyFault;
}
else
{
- asyncResp->res.jsonValue["Boot"]["StopBootOnFault"] = "Never";
+ asyncResp->res.jsonValue["Boot"]["StopBootOnFault"] =
+ computer_system::StopBootOnFault::Never;
}
});
}
@@ -1972,7 +1984,8 @@
{
BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
// not an error, don't have to have the interface
- oemPFR["ProvisioningStatus"] = "NotProvisioned";
+ oemPFR["ProvisioningStatus"] = open_bmc_computer_system::
+ FirmwareProvisioningStatus::NotProvisioned;
return;
}
@@ -2000,16 +2013,19 @@
{
if (*lockState)
{
- oemPFR["ProvisioningStatus"] = "ProvisionedAndLocked";
+ oemPFR["ProvisioningStatus"] = open_bmc_computer_system::
+ FirmwareProvisioningStatus::ProvisionedAndLocked;
}
else
{
- oemPFR["ProvisioningStatus"] = "ProvisionedButNotLocked";
+ oemPFR["ProvisioningStatus"] = open_bmc_computer_system::
+ FirmwareProvisioningStatus::ProvisionedButNotLocked;
}
}
else
{
- oemPFR["ProvisioningStatus"] = "NotProvisioned";
+ oemPFR["ProvisioningStatus"] = open_bmc_computer_system::
+ FirmwareProvisioningStatus::NotProvisioned;
}
});
}
@@ -2408,7 +2424,7 @@
asyncResp->res.jsonValue["HostWatchdogTimer"];
// watchdog service is running/enabled
- hostWatchdogTimer["Status"]["State"] = "Enabled";
+ hostWatchdogTimer["Status"]["State"] = resource::State::Enabled;
const bool* enabled = nullptr;
const std::string* expireAction = nullptr;
@@ -3036,7 +3052,8 @@
"#ComputerSystem.v1_22_0.ComputerSystem";
asyncResp->res.jsonValue["Name"] = BMCWEB_REDFISH_SYSTEM_URI_NAME;
asyncResp->res.jsonValue["Id"] = BMCWEB_REDFISH_SYSTEM_URI_NAME;
- asyncResp->res.jsonValue["SystemType"] = "Physical";
+ asyncResp->res.jsonValue["SystemType"] =
+ computer_system::SystemType::Physical;
asyncResp->res.jsonValue["Description"] = "Computer System";
asyncResp->res.jsonValue["ProcessorSummary"]["Count"] = 0;
asyncResp->res.jsonValue["MemorySummary"]["TotalSystemMemoryGiB"] =
@@ -3073,8 +3090,8 @@
manager["@odata.id"] = boost::urls::format("/redfish/v1/Managers/{}",
BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["Links"]["ManagedBy"] = std::move(managedBy);
- asyncResp->res.jsonValue["Status"]["Health"] = "OK";
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["Health"] = resource::Health::OK;
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
// Fill in SerialConsole info
asyncResp->res.jsonValue["SerialConsole"]["MaxConcurrentSessions"] = 15;
@@ -3373,7 +3390,7 @@
nlohmann::json::object_t parameter;
parameter["Name"] = "ResetType";
parameter["Required"] = true;
- parameter["DataType"] = "String";
+ parameter["DataType"] = action_info::ParameterTypes::String;
parameter["AllowableValues"] = std::move(allowableValues);
nlohmann::json::array_t parameters;
parameters.emplace_back(std::move(parameter));
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index ec92aca..084e561 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -18,6 +18,8 @@
#include "app.hpp"
#include "dbus_utility.hpp"
#include "event_service_manager.hpp"
+#include "generated/enums/resource.hpp"
+#include "generated/enums/task_service.hpp"
#include "http/parsing.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
@@ -478,11 +480,12 @@
asyncResp->res.jsonValue["Id"] = "TaskService";
asyncResp->res.jsonValue["DateTime"] =
redfish::time_utils::getDateTimeOffsetNow().first;
- asyncResp->res.jsonValue["CompletedTaskOverWritePolicy"] = "Oldest";
+ asyncResp->res.jsonValue["CompletedTaskOverWritePolicy"] =
+ task_service::OverWritePolicy::Oldest;
asyncResp->res.jsonValue["LifeCycleEventOnTaskStateChange"] = true;
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
asyncResp->res.jsonValue["ServiceEnabled"] = true;
asyncResp->res.jsonValue["Tasks"]["@odata.id"] =
"/redfish/v1/TaskService/Tasks";
diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
index 724e8aa..19eccba 100644
--- a/redfish-core/lib/telemetry_service.hpp
+++ b/redfish-core/lib/telemetry_service.hpp
@@ -2,6 +2,7 @@
#include "app.hpp"
#include "dbus_utility.hpp"
+#include "generated/enums/resource.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include "utils/dbus_utils.hpp"
@@ -43,7 +44,8 @@
const dbus::utility::DBusPropertiesMap& ret) {
if (ec == boost::system::errc::host_unreachable)
{
- asyncResp->res.jsonValue["Status"]["State"] = "Absent";
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Absent;
return;
}
if (ec)
@@ -53,7 +55,7 @@
return;
}
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
const size_t* maxReports = nullptr;
const uint64_t* minInterval = nullptr;
diff --git a/redfish-core/lib/thermal_subsystem.hpp b/redfish-core/lib/thermal_subsystem.hpp
index c52f395..5365cb5 100644
--- a/redfish-core/lib/thermal_subsystem.hpp
+++ b/redfish-core/lib/thermal_subsystem.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "app.hpp"
+#include "generated/enums/resource.hpp"
#include "logging.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
@@ -46,8 +47,8 @@
"/redfish/v1/Chassis/{}/ThermalSubsystem/ThermalMetrics",
chassisId);
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
- asyncResp->res.jsonValue["Status"]["Health"] = "OK";
+ asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
+ asyncResp->res.jsonValue["Status"]["Health"] = resource::Health::OK;
}
inline void handleThermalSubsystemCollectionHead(
diff --git a/redfish-core/lib/trigger.hpp b/redfish-core/lib/trigger.hpp
index a6101a2..02885d2 100644
--- a/redfish-core/lib/trigger.hpp
+++ b/redfish-core/lib/trigger.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "app.hpp"
+#include "generated/enums/metric_definition.hpp"
#include "generated/enums/resource.hpp"
#include "generated/enums/triggers.hpp"
#include "query.hpp"
@@ -900,7 +901,7 @@
json["DiscreteTriggers"] = *discreteTriggers;
json["DiscreteTriggerCondition"] =
discreteTriggers->empty() ? "Changed" : "Specified";
- json["MetricType"] = "Discrete";
+ json["MetricType"] = metric_definition::MetricType::Discrete;
}
else
{
@@ -916,7 +917,7 @@
}
json["NumericThresholds"] = *numericThresholds;
- json["MetricType"] = "Numeric";
+ json["MetricType"] = metric_definition::MetricType::Numeric;
}
}
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index ade9e57..533d146 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -1187,8 +1187,9 @@
updateSvcSimpleUpdate["TransferProtocol@Redfish.AllowableValues"] =
std::move(allowed);
- asyncResp->res.jsonValue["HttpPushUriOptions"]["HttpPushUriApplyTime"]
- ["ApplyTime"] = "Immediate";
+ asyncResp->res
+ .jsonValue["HttpPushUriOptions"]["HttpPushUriApplyTime"]["ApplyTime"] =
+ update_service::ApplyTime::Immediate;
}
inline void handleUpdateServiceFirmwareInventoryCollectionGet(
@@ -1377,7 +1378,8 @@
asyncResp->res.jsonValue["@odata.type"] =
"#SoftwareInventory.v1_1_0.SoftwareInventory";
asyncResp->res.jsonValue["Name"] = "Software Inventory";
- asyncResp->res.jsonValue["Status"]["HealthRollup"] = "OK";
+ asyncResp->res.jsonValue["Status"]["HealthRollup"] =
+ resource::Health::OK;
asyncResp->res.jsonValue["Updateable"] = false;
sw_util::getSwUpdatableStatus(asyncResp, swId);
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 6e4be6d..76286ff 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -257,7 +257,7 @@
item["WriteProtected"] = true;
item["ConnectedVia"] = virtual_media::ConnectedVia::NotConnected;
item["MediaTypes"] = nlohmann::json::array_t({"CD", "USBStick"});
- item["TransferMethod"] = "Stream";
+ item["TransferMethod"] = virtual_media::TransferMethod::Stream;
item["Oem"]["OpenBMC"]["@odata.type"] =
"#OpenBMCVirtualMedia.v1_0_0.VirtualMedia";
item["Oem"]["OpenBMC"]["@odata.id"] = boost::urls::format(