diff options
author | Ed Tanous <edtanous@google.com> | 2022-03-15 00:56:47 +0300 |
---|---|---|
committer | Ed Tanous <edtanous@google.com> | 2022-12-08 23:08:01 +0300 |
commit | 0ec8b83db7e8629c721c0e632de702bf1018f58f (patch) | |
tree | 207fa734b40162e4953f4c8c229cbcfb4c02900d | |
parent | 7e8890c5c2b8d69c104f2db4e82fb06c40374c08 (diff) | |
download | bmcweb-0ec8b83db7e8629c721c0e632de702bf1018f58f.tar.xz |
Generate Redfish enums from schemas
OpenBMC tends to have a significant problem in doing the appropriate
lookups from the schema files, and many bugs have been injected by users
picking a bad enum, or mistyping the casing of an enum value.
At the same time, nlohmann::json has recently added first class support
for enums, https://json.nlohmann.me/features/enum_conversion/
This commit attempts to build a set of redfish includes file with all
the available Redfish enums in an easy to use enum class. This makes it
very clear which enums are supported by the schemas we produce, and adds
very little to no extra boilerplate on the human-written code we
produced previously.
Note, in the generated enum class, because of our use of the clang-tidy
check for macros, the clang-tidy check needs an exception for these
macros that don't technically follow the coding standard. This seems
like a reasonable compromise, and in this case, given that nlohmann
doesn't support a non-macro version of this.
One question that arises is what this does to the binary size.... Under
the current compiler optimizations, and with the current best practices,
it leads to an overall increase in binary size of ~1200 bytes for the
enum machinery, then approximately 200 bytes for every call site we
switch over. We should decide if this nominal increase is reasonable.
Tested: Redfish protocol validator runs with same number of failures as
previously.
Redfish Service Validator passes (one unrelated qemu-specific exception)
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I7c7ee4db0823f7c57ecaa59620b280b53a46e2c1
54 files changed, 4162 insertions, 42 deletions
diff --git a/.clang-tidy b/.clang-tidy index bed3fadfd8..8af0822656 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -315,3 +315,4 @@ CheckOptions: - { key: readability-identifier-naming.ParameterCase, value: camelBack } - { key: readability-identifier-naming.NamespaceCase, value: lower_case } - { key: readability-identifier-naming.StructCase, value: CamelCase } + - { key: cppcoreguidelines-macro-usage.AllowedRegexp, value: DEBUG*|NLOHMANN_JSON_SERIALIZE_ENUM } diff --git a/redfish-core/include/generated/enums/account_service.hpp b/redfish-core/include/generated/enums/account_service.hpp new file mode 100644 index 0000000000..169b5f9b2a --- /dev/null +++ b/redfish-core/include/generated/enums/account_service.hpp @@ -0,0 +1,91 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace account_service +{ +// clang-format off + +enum class LocalAccountAuth{ + Invalid, + Enabled, + Disabled, + Fallback, + LocalFirst, +}; + +enum class AccountProviderTypes{ + Invalid, + RedfishService, + ActiveDirectoryService, + LDAPService, + OEM, + TACACSplus, + OAuth2, +}; + +enum class AuthenticationTypes{ + Invalid, + Token, + KerberosKeytab, + UsernameAndPassword, + OEM, +}; + +enum class TACACSplusPasswordExchangeProtocol{ + Invalid, + ASCII, + PAP, + CHAP, + MSCHAPv1, + MSCHAPv2, +}; + +enum class OAuth2Mode{ + Invalid, + Discovery, + Offline, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(LocalAccountAuth, { + {LocalAccountAuth::Invalid, "Invalid"}, + {LocalAccountAuth::Enabled, "Enabled"}, + {LocalAccountAuth::Disabled, "Disabled"}, + {LocalAccountAuth::Fallback, "Fallback"}, + {LocalAccountAuth::LocalFirst, "LocalFirst"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(AccountProviderTypes, { + {AccountProviderTypes::Invalid, "Invalid"}, + {AccountProviderTypes::RedfishService, "RedfishService"}, + {AccountProviderTypes::ActiveDirectoryService, "ActiveDirectoryService"}, + {AccountProviderTypes::LDAPService, "LDAPService"}, + {AccountProviderTypes::OEM, "OEM"}, + {AccountProviderTypes::TACACSplus, "TACACSplus"}, + {AccountProviderTypes::OAuth2, "OAuth2"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(AuthenticationTypes, { + {AuthenticationTypes::Invalid, "Invalid"}, + {AuthenticationTypes::Token, "Token"}, + {AuthenticationTypes::KerberosKeytab, "KerberosKeytab"}, + {AuthenticationTypes::UsernameAndPassword, "UsernameAndPassword"}, + {AuthenticationTypes::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(TACACSplusPasswordExchangeProtocol, { + {TACACSplusPasswordExchangeProtocol::Invalid, "Invalid"}, + {TACACSplusPasswordExchangeProtocol::ASCII, "ASCII"}, + {TACACSplusPasswordExchangeProtocol::PAP, "PAP"}, + {TACACSplusPasswordExchangeProtocol::CHAP, "CHAP"}, + {TACACSplusPasswordExchangeProtocol::MSCHAPv1, "MSCHAPv1"}, + {TACACSplusPasswordExchangeProtocol::MSCHAPv2, "MSCHAPv2"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(OAuth2Mode, { + {OAuth2Mode::Invalid, "Invalid"}, + {OAuth2Mode::Discovery, "Discovery"}, + {OAuth2Mode::Offline, "Offline"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/action_info.hpp b/redfish-core/include/generated/enums/action_info.hpp new file mode 100644 index 0000000000..4934abc569 --- /dev/null +++ b/redfish-core/include/generated/enums/action_info.hpp @@ -0,0 +1,31 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace action_info +{ +// clang-format off + +enum class ParameterTypes{ + Invalid, + Boolean, + Number, + NumberArray, + String, + StringArray, + Object, + ObjectArray, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(ParameterTypes, { + {ParameterTypes::Invalid, "Invalid"}, + {ParameterTypes::Boolean, "Boolean"}, + {ParameterTypes::Number, "Number"}, + {ParameterTypes::NumberArray, "NumberArray"}, + {ParameterTypes::String, "String"}, + {ParameterTypes::StringArray, "StringArray"}, + {ParameterTypes::Object, "Object"}, + {ParameterTypes::ObjectArray, "ObjectArray"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/attribute_registry.hpp b/redfish-core/include/generated/enums/attribute_registry.hpp new file mode 100644 index 0000000000..b24a7885ea --- /dev/null +++ b/redfish-core/include/generated/enums/attribute_registry.hpp @@ -0,0 +1,141 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace attribute_registry +{ +// clang-format off + +enum class AttributeType{ + Invalid, + Enumeration, + String, + Integer, + Boolean, + Password, +}; + +enum class DependencyType{ + Invalid, + Map, +}; + +enum class MapFromCondition{ + Invalid, + EQU, + NEQ, + GTR, + GEQ, + LSS, + LEQ, +}; + +enum class MapFromProperty{ + Invalid, + CurrentValue, + DefaultValue, + ReadOnly, + WriteOnly, + GrayOut, + Hidden, + LowerBound, + UpperBound, + MinLength, + MaxLength, + ScalarIncrement, +}; + +enum class MapTerms{ + Invalid, + AND, + OR, +}; + +enum class MapToProperty{ + Invalid, + CurrentValue, + DefaultValue, + ReadOnly, + WriteOnly, + GrayOut, + Hidden, + Immutable, + HelpText, + WarningText, + DisplayName, + DisplayOrder, + LowerBound, + UpperBound, + MinLength, + MaxLength, + ScalarIncrement, + ValueExpression, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(AttributeType, { + {AttributeType::Invalid, "Invalid"}, + {AttributeType::Enumeration, "Enumeration"}, + {AttributeType::String, "String"}, + {AttributeType::Integer, "Integer"}, + {AttributeType::Boolean, "Boolean"}, + {AttributeType::Password, "Password"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(DependencyType, { + {DependencyType::Invalid, "Invalid"}, + {DependencyType::Map, "Map"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(MapFromCondition, { + {MapFromCondition::Invalid, "Invalid"}, + {MapFromCondition::EQU, "EQU"}, + {MapFromCondition::NEQ, "NEQ"}, + {MapFromCondition::GTR, "GTR"}, + {MapFromCondition::GEQ, "GEQ"}, + {MapFromCondition::LSS, "LSS"}, + {MapFromCondition::LEQ, "LEQ"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(MapFromProperty, { + {MapFromProperty::Invalid, "Invalid"}, + {MapFromProperty::CurrentValue, "CurrentValue"}, + {MapFromProperty::DefaultValue, "DefaultValue"}, + {MapFromProperty::ReadOnly, "ReadOnly"}, + {MapFromProperty::WriteOnly, "WriteOnly"}, + {MapFromProperty::GrayOut, "GrayOut"}, + {MapFromProperty::Hidden, "Hidden"}, + {MapFromProperty::LowerBound, "LowerBound"}, + {MapFromProperty::UpperBound, "UpperBound"}, + {MapFromProperty::MinLength, "MinLength"}, + {MapFromProperty::MaxLength, "MaxLength"}, + {MapFromProperty::ScalarIncrement, "ScalarIncrement"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(MapTerms, { + {MapTerms::Invalid, "Invalid"}, + {MapTerms::AND, "AND"}, + {MapTerms::OR, "OR"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(MapToProperty, { + {MapToProperty::Invalid, "Invalid"}, + {MapToProperty::CurrentValue, "CurrentValue"}, + {MapToProperty::DefaultValue, "DefaultValue"}, + {MapToProperty::ReadOnly, "ReadOnly"}, + {MapToProperty::WriteOnly, "WriteOnly"}, + {MapToProperty::GrayOut, "GrayOut"}, + {MapToProperty::Hidden, "Hidden"}, + {MapToProperty::Immutable, "Immutable"}, + {MapToProperty::HelpText, "HelpText"}, + {MapToProperty::WarningText, "WarningText"}, + {MapToProperty::DisplayName, "DisplayName"}, + {MapToProperty::DisplayOrder, "DisplayOrder"}, + {MapToProperty::LowerBound, "LowerBound"}, + {MapToProperty::UpperBound, "UpperBound"}, + {MapToProperty::MinLength, "MinLength"}, + {MapToProperty::MaxLength, "MaxLength"}, + {MapToProperty::ScalarIncrement, "ScalarIncrement"}, + {MapToProperty::ValueExpression, "ValueExpression"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/cable.hpp b/redfish-core/include/generated/enums/cable.hpp new file mode 100644 index 0000000000..1d316b9180 --- /dev/null +++ b/redfish-core/include/generated/enums/cable.hpp @@ -0,0 +1,105 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace cable +{ +// clang-format off + +enum class CableClass{ + Invalid, + Power, + Network, + Storage, + Fan, + PCIe, + USB, + Video, + Fabric, + Serial, + General, +}; + +enum class ConnectorType{ + Invalid, + ACPower, + DB9, + DCPower, + DisplayPort, + HDMI, + ICI, + IPASS, + PCIe, + Proprietary, + RJ45, + SATA, + SCSI, + SlimSAS, + SFP, + SFPPlus, + USBA, + USBC, + QSFP, + CDFP, + OSFP, +}; + +enum class CableStatus{ + Invalid, + Normal, + Degraded, + Failed, + Testing, + Disabled, + SetByService, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(CableClass, { + {CableClass::Invalid, "Invalid"}, + {CableClass::Power, "Power"}, + {CableClass::Network, "Network"}, + {CableClass::Storage, "Storage"}, + {CableClass::Fan, "Fan"}, + {CableClass::PCIe, "PCIe"}, + {CableClass::USB, "USB"}, + {CableClass::Video, "Video"}, + {CableClass::Fabric, "Fabric"}, + {CableClass::Serial, "Serial"}, + {CableClass::General, "General"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ConnectorType, { + {ConnectorType::Invalid, "Invalid"}, + {ConnectorType::ACPower, "ACPower"}, + {ConnectorType::DB9, "DB9"}, + {ConnectorType::DCPower, "DCPower"}, + {ConnectorType::DisplayPort, "DisplayPort"}, + {ConnectorType::HDMI, "HDMI"}, + {ConnectorType::ICI, "ICI"}, + {ConnectorType::IPASS, "IPASS"}, + {ConnectorType::PCIe, "PCIe"}, + {ConnectorType::Proprietary, "Proprietary"}, + {ConnectorType::RJ45, "RJ45"}, + {ConnectorType::SATA, "SATA"}, + {ConnectorType::SCSI, "SCSI"}, + {ConnectorType::SlimSAS, "SlimSAS"}, + {ConnectorType::SFP, "SFP"}, + {ConnectorType::SFPPlus, "SFPPlus"}, + {ConnectorType::USBA, "USBA"}, + {ConnectorType::USBC, "USBC"}, + {ConnectorType::QSFP, "QSFP"}, + {ConnectorType::CDFP, "CDFP"}, + {ConnectorType::OSFP, "OSFP"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(CableStatus, { + {CableStatus::Invalid, "Invalid"}, + {CableStatus::Normal, "Normal"}, + {CableStatus::Degraded, "Degraded"}, + {CableStatus::Failed, "Failed"}, + {CableStatus::Testing, "Testing"}, + {CableStatus::Disabled, "Disabled"}, + {CableStatus::SetByService, "SetByService"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/certificate.hpp b/redfish-core/include/generated/enums/certificate.hpp new file mode 100644 index 0000000000..860319733d --- /dev/null +++ b/redfish-core/include/generated/enums/certificate.hpp @@ -0,0 +1,81 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace certificate +{ +// clang-format off + +enum class CertificateType{ + Invalid, + PEM, + PEMchain, + PKCS7, +}; + +enum class KeyUsage{ + Invalid, + DigitalSignature, + NonRepudiation, + KeyEncipherment, + DataEncipherment, + KeyAgreement, + KeyCertSign, + CRLSigning, + EncipherOnly, + DecipherOnly, + ServerAuthentication, + ClientAuthentication, + CodeSigning, + EmailProtection, + Timestamping, + OCSPSigning, +}; + +enum class CertificateUsageType{ + Invalid, + User, + Web, + SSH, + Device, + Platform, + BIOS, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(CertificateType, { + {CertificateType::Invalid, "Invalid"}, + {CertificateType::PEM, "PEM"}, + {CertificateType::PEMchain, "PEMchain"}, + {CertificateType::PKCS7, "PKCS7"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(KeyUsage, { + {KeyUsage::Invalid, "Invalid"}, + {KeyUsage::DigitalSignature, "DigitalSignature"}, + {KeyUsage::NonRepudiation, "NonRepudiation"}, + {KeyUsage::KeyEncipherment, "KeyEncipherment"}, + {KeyUsage::DataEncipherment, "DataEncipherment"}, + {KeyUsage::KeyAgreement, "KeyAgreement"}, + {KeyUsage::KeyCertSign, "KeyCertSign"}, + {KeyUsage::CRLSigning, "CRLSigning"}, + {KeyUsage::EncipherOnly, "EncipherOnly"}, + {KeyUsage::DecipherOnly, "DecipherOnly"}, + {KeyUsage::ServerAuthentication, "ServerAuthentication"}, + {KeyUsage::ClientAuthentication, "ClientAuthentication"}, + {KeyUsage::CodeSigning, "CodeSigning"}, + {KeyUsage::EmailProtection, "EmailProtection"}, + {KeyUsage::Timestamping, "Timestamping"}, + {KeyUsage::OCSPSigning, "OCSPSigning"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(CertificateUsageType, { + {CertificateUsageType::Invalid, "Invalid"}, + {CertificateUsageType::User, "User"}, + {CertificateUsageType::Web, "Web"}, + {CertificateUsageType::SSH, "SSH"}, + {CertificateUsageType::Device, "Device"}, + {CertificateUsageType::Platform, "Platform"}, + {CertificateUsageType::BIOS, "BIOS"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/chassis.hpp b/redfish-core/include/generated/enums/chassis.hpp new file mode 100644 index 0000000000..562862433a --- /dev/null +++ b/redfish-core/include/generated/enums/chassis.hpp @@ -0,0 +1,149 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace chassis +{ +// clang-format off + +enum class ChassisType{ + Invalid, + Rack, + Blade, + Enclosure, + StandAlone, + RackMount, + Card, + Cartridge, + Row, + Pod, + Expansion, + Sidecar, + Zone, + Sled, + Shelf, + Drawer, + Module, + Component, + IPBasedDrive, + RackGroup, + StorageEnclosure, + Other, +}; + +enum class IndicatorLED{ + Invalid, + Unknown, + Lit, + Blinking, + Off, +}; + +enum class PowerState{ + Invalid, + On, + Off, + PoweringOn, + PoweringOff, +}; + +enum class IntrusionSensor{ + Invalid, + Normal, + HardwareIntrusion, + TamperingDetected, +}; + +enum class IntrusionSensorReArm{ + Invalid, + Manual, + Automatic, +}; + +enum class EnvironmentalClass{ + Invalid, + A1, + A2, + A3, + A4, +}; + +enum class ThermalDirection{ + Invalid, + FrontToBack, + BackToFront, + TopExhaust, + Sealed, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(ChassisType, { + {ChassisType::Invalid, "Invalid"}, + {ChassisType::Rack, "Rack"}, + {ChassisType::Blade, "Blade"}, + {ChassisType::Enclosure, "Enclosure"}, + {ChassisType::StandAlone, "StandAlone"}, + {ChassisType::RackMount, "RackMount"}, + {ChassisType::Card, "Card"}, + {ChassisType::Cartridge, "Cartridge"}, + {ChassisType::Row, "Row"}, + {ChassisType::Pod, "Pod"}, + {ChassisType::Expansion, "Expansion"}, + {ChassisType::Sidecar, "Sidecar"}, + {ChassisType::Zone, "Zone"}, + {ChassisType::Sled, "Sled"}, + {ChassisType::Shelf, "Shelf"}, + {ChassisType::Drawer, "Drawer"}, + {ChassisType::Module, "Module"}, + {ChassisType::Component, "Component"}, + {ChassisType::IPBasedDrive, "IPBasedDrive"}, + {ChassisType::RackGroup, "RackGroup"}, + {ChassisType::StorageEnclosure, "StorageEnclosure"}, + {ChassisType::Other, "Other"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(IndicatorLED, { + {IndicatorLED::Invalid, "Invalid"}, + {IndicatorLED::Unknown, "Unknown"}, + {IndicatorLED::Lit, "Lit"}, + {IndicatorLED::Blinking, "Blinking"}, + {IndicatorLED::Off, "Off"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(PowerState, { + {PowerState::Invalid, "Invalid"}, + {PowerState::On, "On"}, + {PowerState::Off, "Off"}, + {PowerState::PoweringOn, "PoweringOn"}, + {PowerState::PoweringOff, "PoweringOff"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(IntrusionSensor, { + {IntrusionSensor::Invalid, "Invalid"}, + {IntrusionSensor::Normal, "Normal"}, + {IntrusionSensor::HardwareIntrusion, "HardwareIntrusion"}, + {IntrusionSensor::TamperingDetected, "TamperingDetected"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(IntrusionSensorReArm, { + {IntrusionSensorReArm::Invalid, "Invalid"}, + {IntrusionSensorReArm::Manual, "Manual"}, + {IntrusionSensorReArm::Automatic, "Automatic"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(EnvironmentalClass, { + {EnvironmentalClass::Invalid, "Invalid"}, + {EnvironmentalClass::A1, "A1"}, + {EnvironmentalClass::A2, "A2"}, + {EnvironmentalClass::A3, "A3"}, + {EnvironmentalClass::A4, "A4"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ThermalDirection, { + {ThermalDirection::Invalid, "Invalid"}, + {ThermalDirection::FrontToBack, "FrontToBack"}, + {ThermalDirection::BackToFront, "BackToFront"}, + {ThermalDirection::TopExhaust, "TopExhaust"}, + {ThermalDirection::Sealed, "Sealed"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/computer_system.hpp b/redfish-core/include/generated/enums/computer_system.hpp new file mode 100644 index 0000000000..2545a22dce --- /dev/null +++ b/redfish-core/include/generated/enums/computer_system.hpp @@ -0,0 +1,373 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace computer_system +{ +// clang-format off + +enum class BootSource{ + Invalid, + None, + Pxe, + Floppy, + Cd, + Usb, + Hdd, + BiosSetup, + Utilities, + Diags, + UefiShell, + UefiTarget, + SDCard, + UefiHttp, + RemoteDrive, + UefiBootNext, + Recovery, +}; + +enum class SystemType{ + Invalid, + Physical, + Virtual, + OS, + PhysicallyPartitioned, + VirtuallyPartitioned, + Composed, + DPU, +}; + +enum class IndicatorLED{ + Invalid, + Unknown, + Lit, + Blinking, + Off, +}; + +enum class PowerState{ + Invalid, + On, + Off, + PoweringOn, + PoweringOff, +}; + +enum class BootSourceOverrideEnabled{ + Invalid, + Disabled, + Once, + Continuous, +}; + +enum class MemoryMirroring{ + Invalid, + System, + DIMM, + Hybrid, + None, +}; + +enum class BootSourceOverrideMode{ + Invalid, + Legacy, + UEFI, +}; + +enum class InterfaceType{ + Invalid, + TPM1_2, + TPM2_0, + TCM1_0, +}; + +enum class HostingRole{ + Invalid, + ApplicationServer, + StorageServer, + Switch, + Appliance, + BareMetalServer, + VirtualMachineServer, + ContainerServer, +}; + +enum class InterfaceTypeSelection{ + Invalid, + None, + FirmwareUpdate, + BiosSetting, + OemMethod, +}; + +enum class WatchdogWarningActions{ + Invalid, + None, + DiagnosticInterrupt, + SMI, + MessagingInterrupt, + SCI, + OEM, +}; + +enum class WatchdogTimeoutActions{ + Invalid, + None, + ResetSystem, + PowerCycle, + PowerDown, + OEM, +}; + +enum class PowerRestorePolicyTypes{ + Invalid, + AlwaysOn, + AlwaysOff, + LastState, +}; + +enum class BootOrderTypes{ + Invalid, + BootOrder, + AliasBootOrder, +}; + +enum class AutomaticRetryConfig{ + Invalid, + Disabled, + RetryAttempts, + RetryAlways, +}; + +enum class BootProgressTypes{ + Invalid, + None, + PrimaryProcessorInitializationStarted, + BusInitializationStarted, + MemoryInitializationStarted, + SecondaryProcessorInitializationStarted, + PCIResourceConfigStarted, + SystemHardwareInitializationComplete, + SetupEntered, + OSBootStarted, + OSRunning, + OEM, +}; + +enum class GraphicalConnectTypesSupported{ + Invalid, + KVMIP, + OEM, +}; + +enum class TrustedModuleRequiredToBoot{ + Invalid, + Disabled, + Required, +}; + +enum class StopBootOnFault{ + Invalid, + Never, + AnyFault, +}; + +enum class PowerMode{ + Invalid, + MaximumPerformance, + BalancedPerformance, + PowerSaving, + Static, + OSControlled, + OEM, +}; + +enum class CompositionUseCase{ + Invalid, + ResourceBlockCapable, + ExpandableSystem, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(BootSource, { + {BootSource::Invalid, "Invalid"}, + {BootSource::None, "None"}, + {BootSource::Pxe, "Pxe"}, + {BootSource::Floppy, "Floppy"}, + {BootSource::Cd, "Cd"}, + {BootSource::Usb, "Usb"}, + {BootSource::Hdd, "Hdd"}, + {BootSource::BiosSetup, "BiosSetup"}, + {BootSource::Utilities, "Utilities"}, + {BootSource::Diags, "Diags"}, + {BootSource::UefiShell, "UefiShell"}, + {BootSource::UefiTarget, "UefiTarget"}, + {BootSource::SDCard, "SDCard"}, + {BootSource::UefiHttp, "UefiHttp"}, + {BootSource::RemoteDrive, "RemoteDrive"}, + {BootSource::UefiBootNext, "UefiBootNext"}, + {BootSource::Recovery, "Recovery"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SystemType, { + {SystemType::Invalid, "Invalid"}, + {SystemType::Physical, "Physical"}, + {SystemType::Virtual, "Virtual"}, + {SystemType::OS, "OS"}, + {SystemType::PhysicallyPartitioned, "PhysicallyPartitioned"}, + {SystemType::VirtuallyPartitioned, "VirtuallyPartitioned"}, + {SystemType::Composed, "Composed"}, + {SystemType::DPU, "DPU"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(IndicatorLED, { + {IndicatorLED::Invalid, "Invalid"}, + {IndicatorLED::Unknown, "Unknown"}, + {IndicatorLED::Lit, "Lit"}, + {IndicatorLED::Blinking, "Blinking"}, + {IndicatorLED::Off, "Off"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(PowerState, { + {PowerState::Invalid, "Invalid"}, + {PowerState::On, "On"}, + {PowerState::Off, "Off"}, + {PowerState::PoweringOn, "PoweringOn"}, + {PowerState::PoweringOff, "PoweringOff"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(BootSourceOverrideEnabled, { + {BootSourceOverrideEnabled::Invalid, "Invalid"}, + {BootSourceOverrideEnabled::Disabled, "Disabled"}, + {BootSourceOverrideEnabled::Once, "Once"}, + {BootSourceOverrideEnabled::Continuous, "Continuous"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(MemoryMirroring, { + {MemoryMirroring::Invalid, "Invalid"}, + {MemoryMirroring::System, "System"}, + {MemoryMirroring::DIMM, "DIMM"}, + {MemoryMirroring::Hybrid, "Hybrid"}, + {MemoryMirroring::None, "None"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(BootSourceOverrideMode, { + {BootSourceOverrideMode::Invalid, "Invalid"}, + {BootSourceOverrideMode::Legacy, "Legacy"}, + {BootSourceOverrideMode::UEFI, "UEFI"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(InterfaceType, { + {InterfaceType::Invalid, "Invalid"}, + {InterfaceType::TPM1_2, "TPM1_2"}, + {InterfaceType::TPM2_0, "TPM2_0"}, + {InterfaceType::TCM1_0, "TCM1_0"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(HostingRole, { + {HostingRole::Invalid, "Invalid"}, + {HostingRole::ApplicationServer, "ApplicationServer"}, + {HostingRole::StorageServer, "StorageServer"}, + {HostingRole::Switch, "Switch"}, + {HostingRole::Appliance, "Appliance"}, + {HostingRole::BareMetalServer, "BareMetalServer"}, + {HostingRole::VirtualMachineServer, "VirtualMachineServer"}, + {HostingRole::ContainerServer, "ContainerServer"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(InterfaceTypeSelection, { + {InterfaceTypeSelection::Invalid, "Invalid"}, + {InterfaceTypeSelection::None, "None"}, + {InterfaceTypeSelection::FirmwareUpdate, "FirmwareUpdate"}, + {InterfaceTypeSelection::BiosSetting, "BiosSetting"}, + {InterfaceTypeSelection::OemMethod, "OemMethod"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(WatchdogWarningActions, { + {WatchdogWarningActions::Invalid, "Invalid"}, + {WatchdogWarningActions::None, "None"}, + {WatchdogWarningActions::DiagnosticInterrupt, "DiagnosticInterrupt"}, + {WatchdogWarningActions::SMI, "SMI"}, + {WatchdogWarningActions::MessagingInterrupt, "MessagingInterrupt"}, + {WatchdogWarningActions::SCI, "SCI"}, + {WatchdogWarningActions::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(WatchdogTimeoutActions, { + {WatchdogTimeoutActions::Invalid, "Invalid"}, + {WatchdogTimeoutActions::None, "None"}, + {WatchdogTimeoutActions::ResetSystem, "ResetSystem"}, + {WatchdogTimeoutActions::PowerCycle, "PowerCycle"}, + {WatchdogTimeoutActions::PowerDown, "PowerDown"}, + {WatchdogTimeoutActions::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(PowerRestorePolicyTypes, { + {PowerRestorePolicyTypes::Invalid, "Invalid"}, + {PowerRestorePolicyTypes::AlwaysOn, "AlwaysOn"}, + {PowerRestorePolicyTypes::AlwaysOff, "AlwaysOff"}, + {PowerRestorePolicyTypes::LastState, "LastState"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(BootOrderTypes, { + {BootOrderTypes::Invalid, "Invalid"}, + {BootOrderTypes::BootOrder, "BootOrder"}, + {BootOrderTypes::AliasBootOrder, "AliasBootOrder"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(AutomaticRetryConfig, { + {AutomaticRetryConfig::Invalid, "Invalid"}, + {AutomaticRetryConfig::Disabled, "Disabled"}, + {AutomaticRetryConfig::RetryAttempts, "RetryAttempts"}, + {AutomaticRetryConfig::RetryAlways, "RetryAlways"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(BootProgressTypes, { + {BootProgressTypes::Invalid, "Invalid"}, + {BootProgressTypes::None, "None"}, + {BootProgressTypes::PrimaryProcessorInitializationStarted, "PrimaryProcessorInitializationStarted"}, + {BootProgressTypes::BusInitializationStarted, "BusInitializationStarted"}, + {BootProgressTypes::MemoryInitializationStarted, "MemoryInitializationStarted"}, + {BootProgressTypes::SecondaryProcessorInitializationStarted, "SecondaryProcessorInitializationStarted"}, + {BootProgressTypes::PCIResourceConfigStarted, "PCIResourceConfigStarted"}, + {BootProgressTypes::SystemHardwareInitializationComplete, "SystemHardwareInitializationComplete"}, + {BootProgressTypes::SetupEntered, "SetupEntered"}, + {BootProgressTypes::OSBootStarted, "OSBootStarted"}, + {BootProgressTypes::OSRunning, "OSRunning"}, + {BootProgressTypes::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(GraphicalConnectTypesSupported, { + {GraphicalConnectTypesSupported::Invalid, "Invalid"}, + {GraphicalConnectTypesSupported::KVMIP, "KVMIP"}, + {GraphicalConnectTypesSupported::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(TrustedModuleRequiredToBoot, { + {TrustedModuleRequiredToBoot::Invalid, "Invalid"}, + {TrustedModuleRequiredToBoot::Disabled, "Disabled"}, + {TrustedModuleRequiredToBoot::Required, "Required"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(StopBootOnFault, { + {StopBootOnFault::Invalid, "Invalid"}, + {StopBootOnFault::Never, "Never"}, + {StopBootOnFault::AnyFault, "AnyFault"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(PowerMode, { + {PowerMode::Invalid, "Invalid"}, + {PowerMode::MaximumPerformance, "MaximumPerformance"}, + {PowerMode::BalancedPerformance, "BalancedPerformance"}, + {PowerMode::PowerSaving, "PowerSaving"}, + {PowerMode::Static, "Static"}, + {PowerMode::OSControlled, "OSControlled"}, + {PowerMode::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(CompositionUseCase, { + {CompositionUseCase::Invalid, "Invalid"}, + {CompositionUseCase::ResourceBlockCapable, "ResourceBlockCapable"}, + {CompositionUseCase::ExpandableSystem, "ExpandableSystem"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/drive.hpp b/redfish-core/include/generated/enums/drive.hpp new file mode 100644 index 0000000000..c0eb2f0d73 --- /dev/null +++ b/redfish-core/include/generated/enums/drive.hpp @@ -0,0 +1,119 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace drive +{ +// clang-format off + +enum class MediaType{ + Invalid, + HDD, + SSD, + SMR, +}; + +enum class HotspareType{ + Invalid, + None, + Global, + Chassis, + Dedicated, +}; + +enum class EncryptionAbility{ + Invalid, + None, + SelfEncryptingDrive, + Other, +}; + +enum class EncryptionStatus{ + Invalid, + Unecrypted, + Unlocked, + Locked, + Foreign, + Unencrypted, +}; + +enum class StatusIndicator{ + Invalid, + OK, + Fail, + Rebuild, + PredictiveFailureAnalysis, + Hotspare, + InACriticalArray, + InAFailedArray, +}; + +enum class HotspareReplacementModeType{ + Invalid, + Revertible, + NonRevertible, +}; + +enum class DataSanitizationType{ + Invalid, + BlockErase, + CryptographicErase, + Overwrite, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(MediaType, { + {MediaType::Invalid, "Invalid"}, + {MediaType::HDD, "HDD"}, + {MediaType::SSD, "SSD"}, + {MediaType::SMR, "SMR"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(HotspareType, { + {HotspareType::Invalid, "Invalid"}, + {HotspareType::None, "None"}, + {HotspareType::Global, "Global"}, + {HotspareType::Chassis, "Chassis"}, + {HotspareType::Dedicated, "Dedicated"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(EncryptionAbility, { + {EncryptionAbility::Invalid, "Invalid"}, + {EncryptionAbility::None, "None"}, + {EncryptionAbility::SelfEncryptingDrive, "SelfEncryptingDrive"}, + {EncryptionAbility::Other, "Other"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(EncryptionStatus, { + {EncryptionStatus::Invalid, "Invalid"}, + {EncryptionStatus::Unecrypted, "Unecrypted"}, + {EncryptionStatus::Unlocked, "Unlocked"}, + {EncryptionStatus::Locked, "Locked"}, + {EncryptionStatus::Foreign, "Foreign"}, + {EncryptionStatus::Unencrypted, "Unencrypted"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(StatusIndicator, { + {StatusIndicator::Invalid, "Invalid"}, + {StatusIndicator::OK, "OK"}, + {StatusIndicator::Fail, "Fail"}, + {StatusIndicator::Rebuild, "Rebuild"}, + {StatusIndicator::PredictiveFailureAnalysis, "PredictiveFailureAnalysis"}, + {StatusIndicator::Hotspare, "Hotspare"}, + {StatusIndicator::InACriticalArray, "InACriticalArray"}, + {StatusIndicator::InAFailedArray, "InAFailedArray"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(HotspareReplacementModeType, { + {HotspareReplacementModeType::Invalid, "Invalid"}, + {HotspareReplacementModeType::Revertible, "Revertible"}, + {HotspareReplacementModeType::NonRevertible, "NonRevertible"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(DataSanitizationType, { + {DataSanitizationType::Invalid, "Invalid"}, + {DataSanitizationType::BlockErase, "BlockErase"}, + {DataSanitizationType::CryptographicErase, "CryptographicErase"}, + {DataSanitizationType::Overwrite, "Overwrite"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/ethernet_interface.hpp b/redfish-core/include/generated/enums/ethernet_interface.hpp new file mode 100644 index 0000000000..f69aba1d9a --- /dev/null +++ b/redfish-core/include/generated/enums/ethernet_interface.hpp @@ -0,0 +1,89 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace ethernet_interface +{ +// clang-format off + +enum class LinkStatus{ + Invalid, + LinkUp, + NoLink, + LinkDown, +}; + +enum class DHCPv6OperatingMode{ + Invalid, + Stateful, + Stateless, + Disabled, + Enabled, +}; + +enum class DHCPFallback{ + Invalid, + Static, + AutoConfig, + None, +}; + +enum class EthernetDeviceType{ + Invalid, + Physical, + Virtual, +}; + +enum class TeamMode{ + Invalid, + None, + RoundRobin, + ActiveBackup, + XOR, + Broadcast, + IEEE802_3ad, + AdaptiveTransmitLoadBalancing, + AdaptiveLoadBalancing, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(LinkStatus, { + {LinkStatus::Invalid, "Invalid"}, + {LinkStatus::LinkUp, "LinkUp"}, + {LinkStatus::NoLink, "NoLink"}, + {LinkStatus::LinkDown, "LinkDown"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(DHCPv6OperatingMode, { + {DHCPv6OperatingMode::Invalid, "Invalid"}, + {DHCPv6OperatingMode::Stateful, "Stateful"}, + {DHCPv6OperatingMode::Stateless, "Stateless"}, + {DHCPv6OperatingMode::Disabled, "Disabled"}, + {DHCPv6OperatingMode::Enabled, "Enabled"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(DHCPFallback, { + {DHCPFallback::Invalid, "Invalid"}, + {DHCPFallback::Static, "Static"}, + {DHCPFallback::AutoConfig, "AutoConfig"}, + {DHCPFallback::None, "None"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(EthernetDeviceType, { + {EthernetDeviceType::Invalid, "Invalid"}, + {EthernetDeviceType::Physical, "Physical"}, + {EthernetDeviceType::Virtual, "Virtual"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(TeamMode, { + {TeamMode::Invalid, "Invalid"}, + {TeamMode::None, "None"}, + {TeamMode::RoundRobin, "RoundRobin"}, + {TeamMode::ActiveBackup, "ActiveBackup"}, + {TeamMode::XOR, "XOR"}, + {TeamMode::Broadcast, "Broadcast"}, + {TeamMode::IEEE802_3ad, "IEEE802_3ad"}, + {TeamMode::AdaptiveTransmitLoadBalancing, "AdaptiveTransmitLoadBalancing"}, + {TeamMode::AdaptiveLoadBalancing, "AdaptiveLoadBalancing"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/event.hpp b/redfish-core/include/generated/enums/event.hpp new file mode 100644 index 0000000000..a88bac3dc1 --- /dev/null +++ b/redfish-core/include/generated/enums/event.hpp @@ -0,0 +1,31 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace event +{ +// clang-format off + +enum class EventType{ + Invalid, + StatusChange, + ResourceUpdated, + ResourceAdded, + ResourceRemoved, + Alert, + MetricReport, + Other, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(EventType, { + {EventType::Invalid, "Invalid"}, + {EventType::StatusChange, "StatusChange"}, + {EventType::ResourceUpdated, "ResourceUpdated"}, + {EventType::ResourceAdded, "ResourceAdded"}, + {EventType::ResourceRemoved, "ResourceRemoved"}, + {EventType::Alert, "Alert"}, + {EventType::MetricReport, "MetricReport"}, + {EventType::Other, "Other"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/event_destination.hpp b/redfish-core/include/generated/enums/event_destination.hpp new file mode 100644 index 0000000000..02fb8e6465 --- /dev/null +++ b/redfish-core/include/generated/enums/event_destination.hpp @@ -0,0 +1,205 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace event_destination +{ +// clang-format off + +enum class EventFormatType{ + Invalid, + Event, + MetricReport, +}; + +enum class EventDestinationProtocol{ + Invalid, + Redfish, + SNMPv1, + SNMPv2c, + SNMPv3, + SMTP, + SyslogTLS, + SyslogTCP, + SyslogUDP, + SyslogRELP, + OEM, +}; + +enum class SubscriptionType{ + Invalid, + RedfishEvent, + SSE, + SNMPTrap, + SNMPInform, + Syslog, + OEM, +}; + +enum class DeliveryRetryPolicy{ + Invalid, + TerminateAfterRetries, + SuspendRetries, + RetryForever, + RetryForeverWithBackoff, +}; + +enum class SNMPAuthenticationProtocols{ + Invalid, + None, + CommunityString, + HMAC_MD5, + HMAC_SHA96, + HMAC128_SHA224, + HMAC192_SHA256, + HMAC256_SHA384, + HMAC384_SHA512, +}; + +enum class SNMPEncryptionProtocols{ + Invalid, + None, + CBC_DES, + CFB128_AES128, +}; + +enum class SyslogSeverity{ + Invalid, + Emergency, + Alert, + Critical, + Error, + Warning, + Notice, + Informational, + Debug, + All, +}; + +enum class SyslogFacility{ + Invalid, + Kern, + User, + Mail, + Daemon, + Auth, + Syslog, + LPR, + News, + UUCP, + Cron, + Authpriv, + FTP, + NTP, + Security, + Console, + SolarisCron, + Local0, + Local1, + Local2, + Local3, + Local4, + Local5, + Local6, + Local7, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(EventFormatType, { + {EventFormatType::Invalid, "Invalid"}, + {EventFormatType::Event, "Event"}, + {EventFormatType::MetricReport, "MetricReport"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(EventDestinationProtocol, { + {EventDestinationProtocol::Invalid, "Invalid"}, + {EventDestinationProtocol::Redfish, "Redfish"}, + {EventDestinationProtocol::SNMPv1, "SNMPv1"}, + {EventDestinationProtocol::SNMPv2c, "SNMPv2c"}, + {EventDestinationProtocol::SNMPv3, "SNMPv3"}, + {EventDestinationProtocol::SMTP, "SMTP"}, + {EventDestinationProtocol::SyslogTLS, "SyslogTLS"}, + {EventDestinationProtocol::SyslogTCP, "SyslogTCP"}, + {EventDestinationProtocol::SyslogUDP, "SyslogUDP"}, + {EventDestinationProtocol::SyslogRELP, "SyslogRELP"}, + {EventDestinationProtocol::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SubscriptionType, { + {SubscriptionType::Invalid, "Invalid"}, + {SubscriptionType::RedfishEvent, "RedfishEvent"}, + {SubscriptionType::SSE, "SSE"}, + {SubscriptionType::SNMPTrap, "SNMPTrap"}, + {SubscriptionType::SNMPInform, "SNMPInform"}, + {SubscriptionType::Syslog, "Syslog"}, + {SubscriptionType::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(DeliveryRetryPolicy, { + {DeliveryRetryPolicy::Invalid, "Invalid"}, + {DeliveryRetryPolicy::TerminateAfterRetries, "TerminateAfterRetries"}, + {DeliveryRetryPolicy::SuspendRetries, "SuspendRetries"}, + {DeliveryRetryPolicy::RetryForever, "RetryForever"}, + {DeliveryRetryPolicy::RetryForeverWithBackoff, "RetryForeverWithBackoff"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SNMPAuthenticationProtocols, { + {SNMPAuthenticationProtocols::Invalid, "Invalid"}, + {SNMPAuthenticationProtocols::None, "None"}, + {SNMPAuthenticationProtocols::CommunityString, "CommunityString"}, + {SNMPAuthenticationProtocols::HMAC_MD5, "HMAC_MD5"}, + {SNMPAuthenticationProtocols::HMAC_SHA96, "HMAC_SHA96"}, + {SNMPAuthenticationProtocols::HMAC128_SHA224, "HMAC128_SHA224"}, + {SNMPAuthenticationProtocols::HMAC192_SHA256, "HMAC192_SHA256"}, + {SNMPAuthenticationProtocols::HMAC256_SHA384, "HMAC256_SHA384"}, + {SNMPAuthenticationProtocols::HMAC384_SHA512, "HMAC384_SHA512"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SNMPEncryptionProtocols, { + {SNMPEncryptionProtocols::Invalid, "Invalid"}, + {SNMPEncryptionProtocols::None, "None"}, + {SNMPEncryptionProtocols::CBC_DES, "CBC_DES"}, + {SNMPEncryptionProtocols::CFB128_AES128, "CFB128_AES128"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SyslogSeverity, { + {SyslogSeverity::Invalid, "Invalid"}, + {SyslogSeverity::Emergency, "Emergency"}, + {SyslogSeverity::Alert, "Alert"}, + {SyslogSeverity::Critical, "Critical"}, + {SyslogSeverity::Error, "Error"}, + {SyslogSeverity::Warning, "Warning"}, + {SyslogSeverity::Notice, "Notice"}, + {SyslogSeverity::Informational, "Informational"}, + {SyslogSeverity::Debug, "Debug"}, + {SyslogSeverity::All, "All"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SyslogFacility, { + {SyslogFacility::Invalid, "Invalid"}, + {SyslogFacility::Kern, "Kern"}, + {SyslogFacility::User, "User"}, + {SyslogFacility::Mail, "Mail"}, + {SyslogFacility::Daemon, "Daemon"}, + {SyslogFacility::Auth, "Auth"}, + {SyslogFacility::Syslog, "Syslog"}, + {SyslogFacility::LPR, "LPR"}, + {SyslogFacility::News, "News"}, + {SyslogFacility::UUCP, "UUCP"}, + {SyslogFacility::Cron, "Cron"}, + {SyslogFacility::Authpriv, "Authpriv"}, + {SyslogFacility::FTP, "FTP"}, + {SyslogFacility::NTP, "NTP"}, + {SyslogFacility::Security, "Security"}, + {SyslogFacility::Console, "Console"}, + {SyslogFacility::SolarisCron, "SolarisCron"}, + {SyslogFacility::Local0, "Local0"}, + {SyslogFacility::Local1, "Local1"}, + {SyslogFacility::Local2, "Local2"}, + {SyslogFacility::Local3, "Local3"}, + {SyslogFacility::Local4, "Local4"}, + {SyslogFacility::Local5, "Local5"}, + {SyslogFacility::Local6, "Local6"}, + {SyslogFacility::Local7, "Local7"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/event_service.hpp b/redfish-core/include/generated/enums/event_service.hpp new file mode 100644 index 0000000000..08a40d97e4 --- /dev/null +++ b/redfish-core/include/generated/enums/event_service.hpp @@ -0,0 +1,43 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace event_service +{ +// clang-format off + +enum class SMTPConnectionProtocol{ + Invalid, + None, + AutoDetect, + StartTLS, + TLS_SSL, +}; + +enum class SMTPAuthenticationMethods{ + Invalid, + None, + AutoDetect, + Plain, + Login, + CRAM_MD5, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(SMTPConnectionProtocol, { + {SMTPConnectionProtocol::Invalid, "Invalid"}, + {SMTPConnectionProtocol::None, "None"}, + {SMTPConnectionProtocol::AutoDetect, "AutoDetect"}, + {SMTPConnectionProtocol::StartTLS, "StartTLS"}, + {SMTPConnectionProtocol::TLS_SSL, "TLS_SSL"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SMTPAuthenticationMethods, { + {SMTPAuthenticationMethods::Invalid, "Invalid"}, + {SMTPAuthenticationMethods::None, "None"}, + {SMTPAuthenticationMethods::AutoDetect, "AutoDetect"}, + {SMTPAuthenticationMethods::Plain, "Plain"}, + {SMTPAuthenticationMethods::Login, "Login"}, + {SMTPAuthenticationMethods::CRAM_MD5, "CRAM_MD5"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/ip_addresses.hpp b/redfish-core/include/generated/enums/ip_addresses.hpp new file mode 100644 index 0000000000..546b06a445 --- /dev/null +++ b/redfish-core/include/generated/enums/ip_addresses.hpp @@ -0,0 +1,57 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace ip_addresses +{ +// clang-format off + +enum class IPv4AddressOrigin{ + Invalid, + Static, + DHCP, + BOOTP, + IPv4LinkLocal, +}; + +enum class IPv6AddressOrigin{ + Invalid, + Static, + DHCPv6, + LinkLocal, + SLAAC, +}; + +enum class AddressState{ + Invalid, + Preferred, + Deprecated, + Tentative, + Failed, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(IPv4AddressOrigin, { + {IPv4AddressOrigin::Invalid, "Invalid"}, + {IPv4AddressOrigin::Static, "Static"}, + {IPv4AddressOrigin::DHCP, "DHCP"}, + {IPv4AddressOrigin::BOOTP, "BOOTP"}, + {IPv4AddressOrigin::IPv4LinkLocal, "IPv4LinkLocal"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(IPv6AddressOrigin, { + {IPv6AddressOrigin::Invalid, "Invalid"}, + {IPv6AddressOrigin::Static, "Static"}, + {IPv6AddressOrigin::DHCPv6, "DHCPv6"}, + {IPv6AddressOrigin::LinkLocal, "LinkLocal"}, + {IPv6AddressOrigin::SLAAC, "SLAAC"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(AddressState, { + {AddressState::Invalid, "Invalid"}, + {AddressState::Preferred, "Preferred"}, + {AddressState::Deprecated, "Deprecated"}, + {AddressState::Tentative, "Tentative"}, + {AddressState::Failed, "Failed"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/log_entry.hpp b/redfish-core/include/generated/enums/log_entry.hpp new file mode 100644 index 0000000000..a36c7dcbe8 --- /dev/null +++ b/redfish-core/include/generated/enums/log_entry.hpp @@ -0,0 +1,71 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace log_entry +{ +// clang-format off + +enum class EventSeverity{ + Invalid, + OK, + Warning, + Critical, +}; + +enum class LogEntryType{ + Invalid, + Event, + SEL, + Oem, +}; + +enum class LogDiagnosticDataTypes{ + Invalid, + Manager, + PreOS, + OS, + OEM, + CPER, + CPERSection, +}; + +enum class OriginatorTypes{ + Invalid, + Client, + Internal, + SupportingService, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(EventSeverity, { + {EventSeverity::Invalid, "Invalid"}, + {EventSeverity::OK, "OK"}, + {EventSeverity::Warning, "Warning"}, + {EventSeverity::Critical, "Critical"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(LogEntryType, { + {LogEntryType::Invalid, "Invalid"}, + {LogEntryType::Event, "Event"}, + {LogEntryType::SEL, "SEL"}, + {LogEntryType::Oem, "Oem"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(LogDiagnosticDataTypes, { + {LogDiagnosticDataTypes::Invalid, "Invalid"}, + {LogDiagnosticDataTypes::Manager, "Manager"}, + {LogDiagnosticDataTypes::PreOS, "PreOS"}, + {LogDiagnosticDataTypes::OS, "OS"}, + {LogDiagnosticDataTypes::OEM, "OEM"}, + {LogDiagnosticDataTypes::CPER, "CPER"}, + {LogDiagnosticDataTypes::CPERSection, "CPERSection"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(OriginatorTypes, { + {OriginatorTypes::Invalid, "Invalid"}, + {OriginatorTypes::Client, "Client"}, + {OriginatorTypes::Internal, "Internal"}, + {OriginatorTypes::SupportingService, "SupportingService"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/log_service.hpp b/redfish-core/include/generated/enums/log_service.hpp new file mode 100644 index 0000000000..caa5582555 --- /dev/null +++ b/redfish-core/include/generated/enums/log_service.hpp @@ -0,0 +1,137 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace log_service +{ +// clang-format off + +enum class OverWritePolicy{ + Invalid, + Unknown, + WrapsWhenFull, + NeverOverWrites, +}; + +enum class LogEntryTypes{ + Invalid, + Event, + SEL, + Multiple, + OEM, +}; + +enum class SyslogSeverity{ + Invalid, + Emergency, + Alert, + Critical, + Error, + Warning, + Notice, + Informational, + Debug, + All, +}; + +enum class SyslogFacility{ + Invalid, + Kern, + User, + Mail, + Daemon, + Auth, + Syslog, + LPR, + News, + UUCP, + Cron, + Authpriv, + FTP, + NTP, + Security, + Console, + SolarisCron, + Local0, + Local1, + Local2, + Local3, + Local4, + Local5, + Local6, + Local7, +}; + +enum class LogDiagnosticDataTypes{ + Invalid, + Manager, + PreOS, + OS, + OEM, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(OverWritePolicy, { + {OverWritePolicy::Invalid, "Invalid"}, + {OverWritePolicy::Unknown, "Unknown"}, + {OverWritePolicy::WrapsWhenFull, "WrapsWhenFull"}, + {OverWritePolicy::NeverOverWrites, "NeverOverWrites"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(LogEntryTypes, { + {LogEntryTypes::Invalid, "Invalid"}, + {LogEntryTypes::Event, "Event"}, + {LogEntryTypes::SEL, "SEL"}, + {LogEntryTypes::Multiple, "Multiple"}, + {LogEntryTypes::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SyslogSeverity, { + {SyslogSeverity::Invalid, "Invalid"}, + {SyslogSeverity::Emergency, "Emergency"}, + {SyslogSeverity::Alert, "Alert"}, + {SyslogSeverity::Critical, "Critical"}, + {SyslogSeverity::Error, "Error"}, + {SyslogSeverity::Warning, "Warning"}, + {SyslogSeverity::Notice, "Notice"}, + {SyslogSeverity::Informational, "Informational"}, + {SyslogSeverity::Debug, "Debug"}, + {SyslogSeverity::All, "All"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SyslogFacility, { + {SyslogFacility::Invalid, "Invalid"}, + {SyslogFacility::Kern, "Kern"}, + {SyslogFacility::User, "User"}, + {SyslogFacility::Mail, "Mail"}, + {SyslogFacility::Daemon, "Daemon"}, + {SyslogFacility::Auth, "Auth"}, + {SyslogFacility::Syslog, "Syslog"}, + {SyslogFacility::LPR, "LPR"}, + {SyslogFacility::News, "News"}, + {SyslogFacility::UUCP, "UUCP"}, + {SyslogFacility::Cron, "Cron"}, + {SyslogFacility::Authpriv, "Authpriv"}, + {SyslogFacility::FTP, "FTP"}, + {SyslogFacility::NTP, "NTP"}, + {SyslogFacility::Security, "Security"}, + {SyslogFacility::Console, "Console"}, + {SyslogFacility::SolarisCron, "SolarisCron"}, + {SyslogFacility::Local0, "Local0"}, + {SyslogFacility::Local1, "Local1"}, + {SyslogFacility::Local2, "Local2"}, + {SyslogFacility::Local3, "Local3"}, + {SyslogFacility::Local4, "Local4"}, + {SyslogFacility::Local5, "Local5"}, + {SyslogFacility::Local6, "Local6"}, + {SyslogFacility::Local7, "Local7"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(LogDiagnosticDataTypes, { + {LogDiagnosticDataTypes::Invalid, "Invalid"}, + {LogDiagnosticDataTypes::Manager, "Manager"}, + {LogDiagnosticDataTypes::PreOS, "PreOS"}, + {LogDiagnosticDataTypes::OS, "OS"}, + {LogDiagnosticDataTypes::OEM, "OEM"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/manager.hpp b/redfish-core/include/generated/enums/manager.hpp new file mode 100644 index 0000000000..72dc0e8400 --- /dev/null +++ b/redfish-core/include/generated/enums/manager.hpp @@ -0,0 +1,87 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace manager +{ +// clang-format off + +enum class ManagerType{ + Invalid, + ManagementController, + EnclosureManager, + BMC, + RackManager, + AuxiliaryController, + Service, +}; + +enum class SerialConnectTypesSupported{ + Invalid, + SSH, + Telnet, + IPMI, + Oem, +}; + +enum class CommandConnectTypesSupported{ + Invalid, + SSH, + Telnet, + IPMI, + Oem, +}; + +enum class GraphicalConnectTypesSupported{ + Invalid, + KVMIP, + Oem, +}; + +enum class ResetToDefaultsType{ + Invalid, + ResetAll, + PreserveNetworkAndUsers, + PreserveNetwork, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(ManagerType, { + {ManagerType::Invalid, "Invalid"}, + {ManagerType::ManagementController, "ManagementController"}, + {ManagerType::EnclosureManager, "EnclosureManager"}, + {ManagerType::BMC, "BMC"}, + {ManagerType::RackManager, "RackManager"}, + {ManagerType::AuxiliaryController, "AuxiliaryController"}, + {ManagerType::Service, "Service"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SerialConnectTypesSupported, { + {SerialConnectTypesSupported::Invalid, "Invalid"}, + {SerialConnectTypesSupported::SSH, "SSH"}, + {SerialConnectTypesSupported::Telnet, "Telnet"}, + {SerialConnectTypesSupported::IPMI, "IPMI"}, + {SerialConnectTypesSupported::Oem, "Oem"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(CommandConnectTypesSupported, { + {CommandConnectTypesSupported::Invalid, "Invalid"}, + {CommandConnectTypesSupported::SSH, "SSH"}, + {CommandConnectTypesSupported::Telnet, "Telnet"}, + {CommandConnectTypesSupported::IPMI, "IPMI"}, + {CommandConnectTypesSupported::Oem, "Oem"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(GraphicalConnectTypesSupported, { + {GraphicalConnectTypesSupported::Invalid, "Invalid"}, + {GraphicalConnectTypesSupported::KVMIP, "KVMIP"}, + {GraphicalConnectTypesSupported::Oem, "Oem"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ResetToDefaultsType, { + {ResetToDefaultsType::Invalid, "Invalid"}, + {ResetToDefaultsType::ResetAll, "ResetAll"}, + {ResetToDefaultsType::PreserveNetworkAndUsers, "PreserveNetworkAndUsers"}, + {ResetToDefaultsType::PreserveNetwork, "PreserveNetwork"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/manager_account.hpp b/redfish-core/include/generated/enums/manager_account.hpp new file mode 100644 index 0000000000..94bce3221f --- /dev/null +++ b/redfish-core/include/generated/enums/manager_account.hpp @@ -0,0 +1,71 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace manager_account +{ +// clang-format off + +enum class AccountTypes{ + Invalid, + Redfish, + SNMP, + OEM, + HostConsole, + ManagerConsole, + IPMI, + KVMIP, + VirtualMedia, + WebUI, +}; + +enum class SNMPAuthenticationProtocols{ + Invalid, + None, + HMAC_MD5, + HMAC_SHA96, + HMAC128_SHA224, + HMAC192_SHA256, + HMAC256_SHA384, + HMAC384_SHA512, +}; + +enum class SNMPEncryptionProtocols{ + Invalid, + None, + CBC_DES, + CFB128_AES128, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(AccountTypes, { + {AccountTypes::Invalid, "Invalid"}, + {AccountTypes::Redfish, "Redfish"}, + {AccountTypes::SNMP, "SNMP"}, + {AccountTypes::OEM, "OEM"}, + {AccountTypes::HostConsole, "HostConsole"}, + {AccountTypes::ManagerConsole, "ManagerConsole"}, + {AccountTypes::IPMI, "IPMI"}, + {AccountTypes::KVMIP, "KVMIP"}, + {AccountTypes::VirtualMedia, "VirtualMedia"}, + {AccountTypes::WebUI, "WebUI"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SNMPAuthenticationProtocols, { + {SNMPAuthenticationProtocols::Invalid, "Invalid"}, + {SNMPAuthenticationProtocols::None, "None"}, + {SNMPAuthenticationProtocols::HMAC_MD5, "HMAC_MD5"}, + {SNMPAuthenticationProtocols::HMAC_SHA96, "HMAC_SHA96"}, + {SNMPAuthenticationProtocols::HMAC128_SHA224, "HMAC128_SHA224"}, + {SNMPAuthenticationProtocols::HMAC192_SHA256, "HMAC192_SHA256"}, + {SNMPAuthenticationProtocols::HMAC256_SHA384, "HMAC256_SHA384"}, + {SNMPAuthenticationProtocols::HMAC384_SHA512, "HMAC384_SHA512"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SNMPEncryptionProtocols, { + {SNMPEncryptionProtocols::Invalid, "Invalid"}, + {SNMPEncryptionProtocols::None, "None"}, + {SNMPEncryptionProtocols::CBC_DES, "CBC_DES"}, + {SNMPEncryptionProtocols::CFB128_AES128, "CFB128_AES128"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/manager_network_protocol.hpp b/redfish-core/include/generated/enums/manager_network_protocol.hpp new file mode 100644 index 0000000000..aa203c988c --- /dev/null +++ b/redfish-core/include/generated/enums/manager_network_protocol.hpp @@ -0,0 +1,75 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace manager_network_protocol +{ +// clang-format off + +enum class NotifyIPv6Scope{ + Invalid, + Link, + Site, + Organization, +}; + +enum class SNMPCommunityAccessMode{ + Invalid, + Full, + Limited, +}; + +enum class SNMPAuthenticationProtocols{ + Invalid, + Account, + CommunityString, + HMAC_MD5, + HMAC_SHA96, + HMAC128_SHA224, + HMAC192_SHA256, + HMAC256_SHA384, + HMAC384_SHA512, +}; + +enum class SNMPEncryptionProtocols{ + Invalid, + None, + Account, + CBC_DES, + CFB128_AES128, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(NotifyIPv6Scope, { + {NotifyIPv6Scope::Invalid, "Invalid"}, + {NotifyIPv6Scope::Link, "Link"}, + {NotifyIPv6Scope::Site, "Site"}, + {NotifyIPv6Scope::Organization, "Organization"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SNMPCommunityAccessMode, { + {SNMPCommunityAccessMode::Invalid, "Invalid"}, + {SNMPCommunityAccessMode::Full, "Full"}, + {SNMPCommunityAccessMode::Limited, "Limited"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SNMPAuthenticationProtocols, { + {SNMPAuthenticationProtocols::Invalid, "Invalid"}, + {SNMPAuthenticationProtocols::Account, "Account"}, + {SNMPAuthenticationProtocols::CommunityString, "CommunityString"}, + {SNMPAuthenticationProtocols::HMAC_MD5, "HMAC_MD5"}, + {SNMPAuthenticationProtocols::HMAC_SHA96, "HMAC_SHA96"}, + {SNMPAuthenticationProtocols::HMAC128_SHA224, "HMAC128_SHA224"}, + {SNMPAuthenticationProtocols::HMAC192_SHA256, "HMAC192_SHA256"}, + {SNMPAuthenticationProtocols::HMAC256_SHA384, "HMAC256_SHA384"}, + {SNMPAuthenticationProtocols::HMAC384_SHA512, "HMAC384_SHA512"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SNMPEncryptionProtocols, { + {SNMPEncryptionProtocols::Invalid, "Invalid"}, + {SNMPEncryptionProtocols::None, "None"}, + {SNMPEncryptionProtocols::Account, "Account"}, + {SNMPEncryptionProtocols::CBC_DES, "CBC_DES"}, + {SNMPEncryptionProtocols::CFB128_AES128, "CFB128_AES128"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/memory.hpp b/redfish-core/include/generated/enums/memory.hpp new file mode 100644 index 0000000000..fe506fa9a2 --- /dev/null +++ b/redfish-core/include/generated/enums/memory.hpp @@ -0,0 +1,209 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace memory +{ +// clang-format off + +enum class MemoryType{ + Invalid, + DRAM, + NVDIMM_N, + NVDIMM_F, + NVDIMM_P, + IntelOptane, +}; + +enum class MemoryDeviceType{ + Invalid, + DDR, + DDR2, + DDR3, + DDR4, + DDR4_SDRAM, + DDR4E_SDRAM, + LPDDR4_SDRAM, + DDR3_SDRAM, + LPDDR3_SDRAM, + DDR2_SDRAM, + DDR2_SDRAM_FB_DIMM, + DDR2_SDRAM_FB_DIMM_PROBE, + DDR_SGRAM, + DDR_SDRAM, + ROM, + SDRAM, + EDO, + FastPageMode, + PipelinedNibble, + Logical, + HBM, + HBM2, + HBM3, + GDDR, + GDDR2, + GDDR3, + GDDR4, + GDDR5, + GDDR5X, + GDDR6, + DDR5, + OEM, +}; + +enum class BaseModuleType{ + Invalid, + RDIMM, + UDIMM, + SO_DIMM, + LRDIMM, + Mini_RDIMM, + Mini_UDIMM, + SO_RDIMM_72b, + SO_UDIMM_72b, + SO_DIMM_16b, + SO_DIMM_32b, + Die, +}; + +enum class MemoryMedia{ + Invalid, + DRAM, + NAND, + Intel3DXPoint, + Proprietary, +}; + +enum class SecurityStates{ + Invalid, + Enabled, + Disabled, + Unlocked, + Locked, + Frozen, + Passphraselimit, +}; + +enum class ErrorCorrection{ + Invalid, + NoECC, + SingleBitECC, + MultiBitECC, + AddressParity, +}; + +enum class MemoryClassification{ + Invalid, + Volatile, + ByteAccessiblePersistent, + Block, +}; + +enum class OperatingMemoryModes{ + Invalid, + Volatile, + PMEM, + Block, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(MemoryType, { + {MemoryType::Invalid, "Invalid"}, + {MemoryType::DRAM, "DRAM"}, + {MemoryType::NVDIMM_N, "NVDIMM_N"}, + {MemoryType::NVDIMM_F, "NVDIMM_F"}, + {MemoryType::NVDIMM_P, "NVDIMM_P"}, + {MemoryType::IntelOptane, "IntelOptane"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(MemoryDeviceType, { + {MemoryDeviceType::Invalid, "Invalid"}, + {MemoryDeviceType::DDR, "DDR"}, + {MemoryDeviceType::DDR2, "DDR2"}, + {MemoryDeviceType::DDR3, "DDR3"}, + {MemoryDeviceType::DDR4, "DDR4"}, + {MemoryDeviceType::DDR4_SDRAM, "DDR4_SDRAM"}, + {MemoryDeviceType::DDR4E_SDRAM, "DDR4E_SDRAM"}, + {MemoryDeviceType::LPDDR4_SDRAM, "LPDDR4_SDRAM"}, + {MemoryDeviceType::DDR3_SDRAM, "DDR3_SDRAM"}, + {MemoryDeviceType::LPDDR3_SDRAM, "LPDDR3_SDRAM"}, + {MemoryDeviceType::DDR2_SDRAM, "DDR2_SDRAM"}, + {MemoryDeviceType::DDR2_SDRAM_FB_DIMM, "DDR2_SDRAM_FB_DIMM"}, + {MemoryDeviceType::DDR2_SDRAM_FB_DIMM_PROBE, "DDR2_SDRAM_FB_DIMM_PROBE"}, + {MemoryDeviceType::DDR_SGRAM, "DDR_SGRAM"}, + {MemoryDeviceType::DDR_SDRAM, "DDR_SDRAM"}, + {MemoryDeviceType::ROM, "ROM"}, + {MemoryDeviceType::SDRAM, "SDRAM"}, + {MemoryDeviceType::EDO, "EDO"}, + {MemoryDeviceType::FastPageMode, "FastPageMode"}, + {MemoryDeviceType::PipelinedNibble, "PipelinedNibble"}, + {MemoryDeviceType::Logical, "Logical"}, + {MemoryDeviceType::HBM, "HBM"}, + {MemoryDeviceType::HBM2, "HBM2"}, + {MemoryDeviceType::HBM3, "HBM3"}, + {MemoryDeviceType::GDDR, "GDDR"}, + {MemoryDeviceType::GDDR2, "GDDR2"}, + {MemoryDeviceType::GDDR3, "GDDR3"}, + {MemoryDeviceType::GDDR4, "GDDR4"}, + {MemoryDeviceType::GDDR5, "GDDR5"}, + {MemoryDeviceType::GDDR5X, "GDDR5X"}, + {MemoryDeviceType::GDDR6, "GDDR6"}, + {MemoryDeviceType::DDR5, "DDR5"}, + {MemoryDeviceType::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(BaseModuleType, { + {BaseModuleType::Invalid, "Invalid"}, + {BaseModuleType::RDIMM, "RDIMM"}, + {BaseModuleType::UDIMM, "UDIMM"}, + {BaseModuleType::SO_DIMM, "SO_DIMM"}, + {BaseModuleType::LRDIMM, "LRDIMM"}, + {BaseModuleType::Mini_RDIMM, "Mini_RDIMM"}, + {BaseModuleType::Mini_UDIMM, "Mini_UDIMM"}, + {BaseModuleType::SO_RDIMM_72b, "SO_RDIMM_72b"}, + {BaseModuleType::SO_UDIMM_72b, "SO_UDIMM_72b"}, + {BaseModuleType::SO_DIMM_16b, "SO_DIMM_16b"}, + {BaseModuleType::SO_DIMM_32b, "SO_DIMM_32b"}, + {BaseModuleType::Die, "Die"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(MemoryMedia, { + {MemoryMedia::Invalid, "Invalid"}, + {MemoryMedia::DRAM, "DRAM"}, + {MemoryMedia::NAND, "NAND"}, + {MemoryMedia::Intel3DXPoint, "Intel3DXPoint"}, + {MemoryMedia::Proprietary, "Proprietary"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SecurityStates, { + {SecurityStates::Invalid, "Invalid"}, + {SecurityStates::Enabled, "Enabled"}, + {SecurityStates::Disabled, "Disabled"}, + {SecurityStates::Unlocked, "Unlocked"}, + {SecurityStates::Locked, "Locked"}, + {SecurityStates::Frozen, "Frozen"}, + {SecurityStates::Passphraselimit, "Passphraselimit"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ErrorCorrection, { + {ErrorCorrection::Invalid, "Invalid"}, + {ErrorCorrection::NoECC, "NoECC"}, + {ErrorCorrection::SingleBitECC, "SingleBitECC"}, + {ErrorCorrection::MultiBitECC, "MultiBitECC"}, + {ErrorCorrection::AddressParity, "AddressParity"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(MemoryClassification, { + {MemoryClassification::Invalid, "Invalid"}, + {MemoryClassification::Volatile, "Volatile"}, + {MemoryClassification::ByteAccessiblePersistent, "ByteAccessiblePersistent"}, + {MemoryClassification::Block, "Block"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(OperatingMemoryModes, { + {OperatingMemoryModes::Invalid, "Invalid"}, + {OperatingMemoryModes::Volatile, "Volatile"}, + {OperatingMemoryModes::PMEM, "PMEM"}, + {OperatingMemoryModes::Block, "Block"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/message_registry.hpp b/redfish-core/include/generated/enums/message_registry.hpp new file mode 100644 index 0000000000..1e90e96e4e --- /dev/null +++ b/redfish-core/include/generated/enums/message_registry.hpp @@ -0,0 +1,31 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace message_registry +{ +// clang-format off + +enum class ParamType{ + Invalid, + string, + number, +}; + +enum class ClearingType{ + Invalid, + SameOriginOfCondition, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(ParamType, { + {ParamType::Invalid, "Invalid"}, + {ParamType::string, "string"}, + {ParamType::number, "number"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ClearingType, { + {ClearingType::Invalid, "Invalid"}, + {ClearingType::SameOriginOfCondition, "SameOriginOfCondition"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/metric_definition.hpp b/redfish-core/include/generated/enums/metric_definition.hpp new file mode 100644 index 0000000000..4bc3c599b8 --- /dev/null +++ b/redfish-core/include/generated/enums/metric_definition.hpp @@ -0,0 +1,95 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace metric_definition +{ +// clang-format off + +enum class MetricType{ + Invalid, + Numeric, + Discrete, + Gauge, + Counter, + Countdown, + String, +}; + +enum class ImplementationType{ + Invalid, + PhysicalSensor, + Calculated, + Synthesized, + DigitalMeter, +}; + +enum class MetricDataType{ + Invalid, + Boolean, + DateTime, + Decimal, + Integer, + String, + Enumeration, +}; + +enum class Calculable{ + Invalid, + NonCalculatable, + Summable, + NonSummable, +}; + +enum class CalculationAlgorithmEnum{ + Invalid, + Average, + Maximum, + Minimum, + OEM, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(MetricType, { + {MetricType::Invalid, "Invalid"}, + {MetricType::Numeric, "Numeric"}, + {MetricType::Discrete, "Discrete"}, + {MetricType::Gauge, "Gauge"}, + {MetricType::Counter, "Counter"}, + {MetricType::Countdown, "Countdown"}, + {MetricType::String, "String"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ImplementationType, { + {ImplementationType::Invalid, "Invalid"}, + {ImplementationType::PhysicalSensor, "PhysicalSensor"}, + {ImplementationType::Calculated, "Calculated"}, + {ImplementationType::Synthesized, "Synthesized"}, + {ImplementationType::DigitalMeter, "DigitalMeter"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(MetricDataType, { + {MetricDataType::Invalid, "Invalid"}, + {MetricDataType::Boolean, "Boolean"}, + {MetricDataType::DateTime, "DateTime"}, + {MetricDataType::Decimal, "Decimal"}, + {MetricDataType::Integer, "Integer"}, + {MetricDataType::String, "String"}, + {MetricDataType::Enumeration, "Enumeration"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(Calculable, { + {Calculable::Invalid, "Invalid"}, + {Calculable::NonCalculatable, "NonCalculatable"}, + {Calculable::Summable, "Summable"}, + {Calculable::NonSummable, "NonSummable"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(CalculationAlgorithmEnum, { + {CalculationAlgorithmEnum::Invalid, "Invalid"}, + {CalculationAlgorithmEnum::Average, "Average"}, + {CalculationAlgorithmEnum::Maximum, "Maximum"}, + {CalculationAlgorithmEnum::Minimum, "Minimum"}, + {CalculationAlgorithmEnum::OEM, "OEM"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/metric_report_definition.hpp b/redfish-core/include/generated/enums/metric_report_definition.hpp new file mode 100644 index 0000000000..4ffa11182c --- /dev/null +++ b/redfish-core/include/generated/enums/metric_report_definition.hpp @@ -0,0 +1,81 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace metric_report_definition +{ +// clang-format off + +enum class MetricReportDefinitionType{ + Invalid, + Periodic, + OnChange, + OnRequest, +}; + +enum class ReportActionsEnum{ + Invalid, + LogToMetricReportsCollection, + RedfishEvent, +}; + +enum class ReportUpdatesEnum{ + Invalid, + Overwrite, + AppendWrapsWhenFull, + AppendStopsWhenFull, + NewReport, +}; + +enum class CalculationAlgorithmEnum{ + Invalid, + Average, + Maximum, + Minimum, + Summation, +}; + +enum class CollectionTimeScope{ + Invalid, + Point, + Interval, + StartupInterval, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(MetricReportDefinitionType, { + {MetricReportDefinitionType::Invalid, "Invalid"}, + {MetricReportDefinitionType::Periodic, "Periodic"}, + {MetricReportDefinitionType::OnChange, "OnChange"}, + {MetricReportDefinitionType::OnRequest, "OnRequest"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ReportActionsEnum, { + {ReportActionsEnum::Invalid, "Invalid"}, + {ReportActionsEnum::LogToMetricReportsCollection, "LogToMetricReportsCollection"}, + {ReportActionsEnum::RedfishEvent, "RedfishEvent"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ReportUpdatesEnum, { + {ReportUpdatesEnum::Invalid, "Invalid"}, + {ReportUpdatesEnum::Overwrite, "Overwrite"}, + {ReportUpdatesEnum::AppendWrapsWhenFull, "AppendWrapsWhenFull"}, + {ReportUpdatesEnum::AppendStopsWhenFull, "AppendStopsWhenFull"}, + {ReportUpdatesEnum::NewReport, "NewReport"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(CalculationAlgorithmEnum, { + {CalculationAlgorithmEnum::Invalid, "Invalid"}, + {CalculationAlgorithmEnum::Average, "Average"}, + {CalculationAlgorithmEnum::Maximum, "Maximum"}, + {CalculationAlgorithmEnum::Minimum, "Minimum"}, + {CalculationAlgorithmEnum::Summation, "Summation"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(CollectionTimeScope, { + {CollectionTimeScope::Invalid, "Invalid"}, + {CollectionTimeScope::Point, "Point"}, + {CollectionTimeScope::Interval, "Interval"}, + {CollectionTimeScope::StartupInterval, "StartupInterval"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/oem_computer_system.hpp b/redfish-core/include/generated/enums/oem_computer_system.hpp new file mode 100644 index 0000000000..a1a4a6e170 --- /dev/null +++ b/redfish-core/include/generated/enums/oem_computer_system.hpp @@ -0,0 +1,23 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace oem_computer_system +{ +// clang-format off + +enum class FirmwareProvisioningStatus{ + Invalid, + NotProvisioned, + ProvisionedButNotLocked, + ProvisionedAndLocked, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(FirmwareProvisioningStatus, { + {FirmwareProvisioningStatus::Invalid, "Invalid"}, + {FirmwareProvisioningStatus::NotProvisioned, "NotProvisioned"}, + {FirmwareProvisioningStatus::ProvisionedButNotLocked, "ProvisionedButNotLocked"}, + {FirmwareProvisioningStatus::ProvisionedAndLocked, "ProvisionedAndLocked"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/pcie_device.hpp b/redfish-core/include/generated/enums/pcie_device.hpp new file mode 100644 index 0000000000..d87f57353a --- /dev/null +++ b/redfish-core/include/generated/enums/pcie_device.hpp @@ -0,0 +1,83 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace pcie_device +{ +// clang-format off + +enum class PCIeTypes{ + Invalid, + Gen1, + Gen2, + Gen3, + Gen4, + Gen5, +}; + +enum class DeviceType{ + Invalid, + SingleFunction, + MultiFunction, + Simulated, + Retimer, +}; + +enum class SlotType{ + Invalid, + FullLength, + HalfLength, + LowProfile, + Mini, + M2, + OEM, + OCP3Small, + OCP3Large, + U2, +}; + +enum class LaneSplittingType{ + Invalid, + None, + Bridged, + Bifurcated, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(PCIeTypes, { + {PCIeTypes::Invalid, "Invalid"}, + {PCIeTypes::Gen1, "Gen1"}, + {PCIeTypes::Gen2, "Gen2"}, + {PCIeTypes::Gen3, "Gen3"}, + {PCIeTypes::Gen4, "Gen4"}, + {PCIeTypes::Gen5, "Gen5"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(DeviceType, { + {DeviceType::Invalid, "Invalid"}, + {DeviceType::SingleFunction, "SingleFunction"}, + {DeviceType::MultiFunction, "MultiFunction"}, + {DeviceType::Simulated, "Simulated"}, + {DeviceType::Retimer, "Retimer"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SlotType, { + {SlotType::Invalid, "Invalid"}, + {SlotType::FullLength, "FullLength"}, + {SlotType::HalfLength, "HalfLength"}, + {SlotType::LowProfile, "LowProfile"}, + {SlotType::Mini, "Mini"}, + {SlotType::M2, "M2"}, + {SlotType::OEM, "OEM"}, + {SlotType::OCP3Small, "OCP3Small"}, + {SlotType::OCP3Large, "OCP3Large"}, + {SlotType::U2, "U2"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(LaneSplittingType, { + {LaneSplittingType::Invalid, "Invalid"}, + {LaneSplittingType::None, "None"}, + {LaneSplittingType::Bridged, "Bridged"}, + {LaneSplittingType::Bifurcated, "Bifurcated"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/pcie_function.hpp b/redfish-core/include/generated/enums/pcie_function.hpp new file mode 100644 index 0000000000..8f3f032ab6 --- /dev/null +++ b/redfish-core/include/generated/enums/pcie_function.hpp @@ -0,0 +1,75 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace pcie_function +{ +// clang-format off + +enum class DeviceClass{ + Invalid, + UnclassifiedDevice, + MassStorageController, + NetworkController, + DisplayController, + MultimediaController, + MemoryController, + Bridge, + CommunicationController, + GenericSystemPeripheral, + InputDeviceController, + DockingStation, + Processor, + SerialBusController, + WirelessController, + IntelligentController, + SatelliteCommunicationsController, + EncryptionController, + SignalProcessingController, + ProcessingAccelerators, + NonEssentialInstrumentation, + Coprocessor, + UnassignedClass, + Other, +}; + +enum class FunctionType{ + Invalid, + Physical, + Virtual, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(DeviceClass, { + {DeviceClass::Invalid, "Invalid"}, + {DeviceClass::UnclassifiedDevice, "UnclassifiedDevice"}, + {DeviceClass::MassStorageController, "MassStorageController"}, + {DeviceClass::NetworkController, "NetworkController"}, + {DeviceClass::DisplayController, "DisplayController"}, + {DeviceClass::MultimediaController, "MultimediaController"}, + {DeviceClass::MemoryController, "MemoryController"}, + {DeviceClass::Bridge, "Bridge"}, + {DeviceClass::CommunicationController, "CommunicationController"}, + {DeviceClass::GenericSystemPeripheral, "GenericSystemPeripheral"}, + {DeviceClass::InputDeviceController, "InputDeviceController"}, + {DeviceClass::DockingStation, "DockingStation"}, + {DeviceClass::Processor, "Processor"}, + {DeviceClass::SerialBusController, "SerialBusController"}, + {DeviceClass::WirelessController, "WirelessController"}, + {DeviceClass::IntelligentController, "IntelligentController"}, + {DeviceClass::SatelliteCommunicationsController, "SatelliteCommunicationsController"}, + {DeviceClass::EncryptionController, "EncryptionController"}, + {DeviceClass::SignalProcessingController, "SignalProcessingController"}, + {DeviceClass::ProcessingAccelerators, "ProcessingAccelerators"}, + {DeviceClass::NonEssentialInstrumentation, "NonEssentialInstrumentation"}, + {DeviceClass::Coprocessor, "Coprocessor"}, + {DeviceClass::UnassignedClass, "UnassignedClass"}, + {DeviceClass::Other, "Other"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(FunctionType, { + {FunctionType::Invalid, "Invalid"}, + {FunctionType::Physical, "Physical"}, + {FunctionType::Virtual, "Virtual"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/pcie_slots.hpp b/redfish-core/include/generated/enums/pcie_slots.hpp new file mode 100644 index 0000000000..38221d08bb --- /dev/null +++ b/redfish-core/include/generated/enums/pcie_slots.hpp @@ -0,0 +1,35 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace pcie_slots +{ +// clang-format off + +enum class SlotTypes{ + Invalid, + FullLength, + HalfLength, + LowProfile, + Mini, + M2, + OEM, + OCP3Small, + OCP3Large, + U2, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(SlotTypes, { + {SlotTypes::Invalid, "Invalid"}, + {SlotTypes::FullLength, "FullLength"}, + {SlotTypes::HalfLength, "HalfLength"}, + {SlotTypes::LowProfile, "LowProfile"}, + {SlotTypes::Mini, "Mini"}, + {SlotTypes::M2, "M2"}, + {SlotTypes::OEM, "OEM"}, + {SlotTypes::OCP3Small, "OCP3Small"}, + {SlotTypes::OCP3Large, "OCP3Large"}, + {SlotTypes::U2, "U2"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/physical_context.hpp b/redfish-core/include/generated/enums/physical_context.hpp new file mode 100644 index 0000000000..aead54eece --- /dev/null +++ b/redfish-core/include/generated/enums/physical_context.hpp @@ -0,0 +1,143 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace physical_context +{ +// clang-format off + +enum class PhysicalContext{ + Invalid, + Room, + Intake, + Exhaust, + LiquidInlet, + LiquidOutlet, + Front, + Back, + Upper, + Lower, + CPU, + CPUSubsystem, + GPU, + GPUSubsystem, + FPGA, + Accelerator, + ASIC, + Backplane, + SystemBoard, + PowerSupply, + PowerSubsystem, + VoltageRegulator, + Rectifier, + StorageDevice, + NetworkingDevice, + ComputeBay, + StorageBay, + NetworkBay, + ExpansionBay, + PowerSupplyBay, + Memory, + MemorySubsystem, + Chassis, + Fan, + CoolingSubsystem, + Motor, + Transformer, + ACUtilityInput, + ACStaticBypassInput, + ACMaintenanceBypassInput, + DCBus, + ACOutput, + ACInput, + TrustedModule, + Board, + Transceiver, + Battery, + Pump, +}; + +enum class PhysicalSubContext{ + Invalid, + Input, + Output, +}; + +enum class LogicalContext{ + Invalid, + Capacity, + Environment, + Network, + Performance, + Security, + Storage, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(PhysicalContext, { + {PhysicalContext::Invalid, "Invalid"}, + {PhysicalContext::Room, "Room"}, + {PhysicalContext::Intake, "Intake"}, + {PhysicalContext::Exhaust, "Exhaust"}, + {PhysicalContext::LiquidInlet, "LiquidInlet"}, + {PhysicalContext::LiquidOutlet, "LiquidOutlet"}, + {PhysicalContext::Front, "Front"}, + {PhysicalContext::Back, "Back"}, + {PhysicalContext::Upper, "Upper"}, + {PhysicalContext::Lower, "Lower"}, + {PhysicalContext::CPU, "CPU"}, + {PhysicalContext::CPUSubsystem, "CPUSubsystem"}, + {PhysicalContext::GPU, "GPU"}, + {PhysicalContext::GPUSubsystem, "GPUSubsystem"}, + {PhysicalContext::FPGA, "FPGA"}, + {PhysicalContext::Accelerator, "Accelerator"}, + {PhysicalContext::ASIC, "ASIC"}, + {PhysicalContext::Backplane, "Backplane"}, + {PhysicalContext::SystemBoard, "SystemBoard"}, + {PhysicalContext::PowerSupply, "PowerSupply"}, + {PhysicalContext::PowerSubsystem, "PowerSubsystem"}, + {PhysicalContext::VoltageRegulator, "VoltageRegulator"}, + {PhysicalContext::Rectifier, "Rectifier"}, + {PhysicalContext::StorageDevice, "StorageDevice"}, + {PhysicalContext::NetworkingDevice, "NetworkingDevice"}, + {PhysicalContext::ComputeBay, "ComputeBay"}, + {PhysicalContext::StorageBay, "StorageBay"}, + {PhysicalContext::NetworkBay, "NetworkBay"}, + {PhysicalContext::ExpansionBay, "ExpansionBay"}, + {PhysicalContext::PowerSupplyBay, "PowerSupplyBay"}, + {PhysicalContext::Memory, "Memory"}, + {PhysicalContext::MemorySubsystem, "MemorySubsystem"}, + {PhysicalContext::Chassis, "Chassis"}, + {PhysicalContext::Fan, "Fan"}, + {PhysicalContext::CoolingSubsystem, "CoolingSubsystem"}, + {PhysicalContext::Motor, "Motor"}, + {PhysicalContext::Transformer, "Transformer"}, + {PhysicalContext::ACUtilityInput, "ACUtilityInput"}, + {PhysicalContext::ACStaticBypassInput, "ACStaticBypassInput"}, + {PhysicalContext::ACMaintenanceBypassInput, "ACMaintenanceBypassInput"}, + {PhysicalContext::DCBus, "DCBus"}, + {PhysicalContext::ACOutput, "ACOutput"}, + {PhysicalContext::ACInput, "ACInput"}, + {PhysicalContext::TrustedModule, "TrustedModule"}, + {PhysicalContext::Board, "Board"}, + {PhysicalContext::Transceiver, "Transceiver"}, + {PhysicalContext::Battery, "Battery"}, + {PhysicalContext::Pump, "Pump"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(PhysicalSubContext, { + {PhysicalSubContext::Invalid, "Invalid"}, + {PhysicalSubContext::Input, "Input"}, + {PhysicalSubContext::Output, "Output"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(LogicalContext, { + {LogicalContext::Invalid, "Invalid"}, + {LogicalContext::Capacity, "Capacity"}, + {LogicalContext::Environment, "Environment"}, + {LogicalContext::Network, "Network"}, + {LogicalContext::Performance, "Performance"}, + {LogicalContext::Security, "Security"}, + {LogicalContext::Storage, "Storage"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/power.hpp b/redfish-core/include/generated/enums/power.hpp new file mode 100644 index 0000000000..89e2ac83b8 --- /dev/null +++ b/redfish-core/include/generated/enums/power.hpp @@ -0,0 +1,85 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace power +{ +// clang-format off + +enum class PowerLimitException{ + Invalid, + NoAction, + HardPowerOff, + LogEventOnly, + Oem, +}; + +enum class PowerSupplyType{ + Invalid, + Unknown, + AC, + DC, + ACorDC, +}; + +enum class LineInputVoltageType{ + Invalid, + Unknown, + ACLowLine, + ACMidLine, + ACHighLine, + DCNeg48V, + DC380V, + AC120V, + AC240V, + AC277V, + ACandDCWideRange, + ACWideRange, + DC240V, +}; + +enum class InputType{ + Invalid, + AC, + DC, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(PowerLimitException, { + {PowerLimitException::Invalid, "Invalid"}, + {PowerLimitException::NoAction, "NoAction"}, + {PowerLimitException::HardPowerOff, "HardPowerOff"}, + {PowerLimitException::LogEventOnly, "LogEventOnly"}, + {PowerLimitException::Oem, "Oem"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(PowerSupplyType, { + {PowerSupplyType::Invalid, "Invalid"}, + {PowerSupplyType::Unknown, "Unknown"}, + {PowerSupplyType::AC, "AC"}, + {PowerSupplyType::DC, "DC"}, + {PowerSupplyType::ACorDC, "ACorDC"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(LineInputVoltageType, { + {LineInputVoltageType::Invalid, "Invalid"}, + {LineInputVoltageType::Unknown, "Unknown"}, + {LineInputVoltageType::ACLowLine, "ACLowLine"}, + {LineInputVoltageType::ACMidLine, "ACMidLine"}, + {LineInputVoltageType::ACHighLine, "ACHighLine"}, + {LineInputVoltageType::DCNeg48V, "DCNeg48V"}, + {LineInputVoltageType::DC380V, "DC380V"}, + {LineInputVoltageType::AC120V, "AC120V"}, + {LineInputVoltageType::AC240V, "AC240V"}, + {LineInputVoltageType::AC277V, "AC277V"}, + {LineInputVoltageType::ACandDCWideRange, "ACandDCWideRange"}, + {LineInputVoltageType::ACWideRange, "ACWideRange"}, + {LineInputVoltageType::DC240V, "DC240V"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(InputType, { + {InputType::Invalid, "Invalid"}, + {InputType::AC, "AC"}, + {InputType::DC, "DC"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/power_supply.hpp b/redfish-core/include/generated/enums/power_supply.hpp new file mode 100644 index 0000000000..898a7a076f --- /dev/null +++ b/redfish-core/include/generated/enums/power_supply.hpp @@ -0,0 +1,39 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace power_supply +{ +// clang-format off + +enum class PowerSupplyType{ + Invalid, + AC, + DC, + ACorDC, + DCRegulator, +}; + +enum class LineStatus{ + Invalid, + Normal, + LossOfInput, + OutOfRange, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(PowerSupplyType, { + {PowerSupplyType::Invalid, "Invalid"}, + {PowerSupplyType::AC, "AC"}, + {PowerSupplyType::DC, "DC"}, + {PowerSupplyType::ACorDC, "ACorDC"}, + {PowerSupplyType::DCRegulator, "DCRegulator"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(LineStatus, { + {LineStatus::Invalid, "Invalid"}, + {LineStatus::Normal, "Normal"}, + {LineStatus::LossOfInput, "LossOfInput"}, + {LineStatus::OutOfRange, "OutOfRange"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/privileges.hpp b/redfish-core/include/generated/enums/privileges.hpp new file mode 100644 index 0000000000..308413167c --- /dev/null +++ b/redfish-core/include/generated/enums/privileges.hpp @@ -0,0 +1,39 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace privileges +{ +// clang-format off + +enum class PrivilegeType{ + Invalid, + Login, + ConfigureManager, + ConfigureUsers, + ConfigureSelf, + ConfigureComponents, + NoAuth, + ConfigureCompositionInfrastructure, + AdministrateSystems, + OperateSystems, + AdministrateStorage, + OperateStorageBackup, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(PrivilegeType, { + {PrivilegeType::Invalid, "Invalid"}, + {PrivilegeType::Login, "Login"}, + {PrivilegeType::ConfigureManager, "ConfigureManager"}, + {PrivilegeType::ConfigureUsers, "ConfigureUsers"}, + {PrivilegeType::ConfigureSelf, "ConfigureSelf"}, + {PrivilegeType::ConfigureComponents, "ConfigureComponents"}, + {PrivilegeType::NoAuth, "NoAuth"}, + {PrivilegeType::ConfigureCompositionInfrastructure, "ConfigureCompositionInfrastructure"}, + {PrivilegeType::AdministrateSystems, "AdministrateSystems"}, + {PrivilegeType::OperateSystems, "OperateSystems"}, + {PrivilegeType::AdministrateStorage, "AdministrateStorage"}, + {PrivilegeType::OperateStorageBackup, "OperateStorageBackup"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/processor.hpp b/redfish-core/include/generated/enums/processor.hpp new file mode 100644 index 0000000000..29e6fae1ed --- /dev/null +++ b/redfish-core/include/generated/enums/processor.hpp @@ -0,0 +1,173 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace processor +{ +// clang-format off + +enum class ProcessorType{ + Invalid, + CPU, + GPU, + FPGA, + DSP, + Accelerator, + Core, + Thread, + OEM, +}; + +enum class ProcessorMemoryType{ + Invalid, + L1Cache, + L2Cache, + L3Cache, + L4Cache, + L5Cache, + L6Cache, + L7Cache, + HBM1, + HBM2, + HBM3, + SGRAM, + GDDR, + GDDR2, + GDDR3, + GDDR4, + GDDR5, + GDDR5X, + GDDR6, + DDR, + DDR2, + DDR3, + DDR4, + DDR5, + SDRAM, + SRAM, + Flash, + OEM, +}; + +enum class FpgaType{ + Invalid, + Integrated, + Discrete, +}; + +enum class SystemInterfaceType{ + Invalid, + QPI, + UPI, + PCIe, + Ethernet, + AMBA, + CCIX, + CXL, + OEM, +}; + +enum class TurboState{ + Invalid, + Enabled, + Disabled, +}; + +enum class BaseSpeedPriorityState{ + Invalid, + Enabled, + Disabled, +}; + +enum class ThrottleCause{ + Invalid, + PowerLimit, + ThermalLimit, + ClockLimit, + Unknown, + OEM, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(ProcessorType, { + {ProcessorType::Invalid, "Invalid"}, + {ProcessorType::CPU, "CPU"}, + {ProcessorType::GPU, "GPU"}, + {ProcessorType::FPGA, "FPGA"}, + {ProcessorType::DSP, "DSP"}, + {ProcessorType::Accelerator, "Accelerator"}, + {ProcessorType::Core, "Core"}, + {ProcessorType::Thread, "Thread"}, + {ProcessorType::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ProcessorMemoryType, { + {ProcessorMemoryType::Invalid, "Invalid"}, + {ProcessorMemoryType::L1Cache, "L1Cache"}, + {ProcessorMemoryType::L2Cache, "L2Cache"}, + {ProcessorMemoryType::L3Cache, "L3Cache"}, + {ProcessorMemoryType::L4Cache, "L4Cache"}, + {ProcessorMemoryType::L5Cache, "L5Cache"}, + {ProcessorMemoryType::L6Cache, "L6Cache"}, + {ProcessorMemoryType::L7Cache, "L7Cache"}, + {ProcessorMemoryType::HBM1, "HBM1"}, + {ProcessorMemoryType::HBM2, "HBM2"}, + {ProcessorMemoryType::HBM3, "HBM3"}, + {ProcessorMemoryType::SGRAM, "SGRAM"}, + {ProcessorMemoryType::GDDR, "GDDR"}, + {ProcessorMemoryType::GDDR2, "GDDR2"}, + {ProcessorMemoryType::GDDR3, "GDDR3"}, + {ProcessorMemoryType::GDDR4, "GDDR4"}, + {ProcessorMemoryType::GDDR5, "GDDR5"}, + {ProcessorMemoryType::GDDR5X, "GDDR5X"}, + {ProcessorMemoryType::GDDR6, "GDDR6"}, + {ProcessorMemoryType::DDR, "DDR"}, + {ProcessorMemoryType::DDR2, "DDR2"}, + {ProcessorMemoryType::DDR3, "DDR3"}, + {ProcessorMemoryType::DDR4, "DDR4"}, + {ProcessorMemoryType::DDR5, "DDR5"}, + {ProcessorMemoryType::SDRAM, "SDRAM"}, + {ProcessorMemoryType::SRAM, "SRAM"}, + {ProcessorMemoryType::Flash, "Flash"}, + {ProcessorMemoryType::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(FpgaType, { + {FpgaType::Invalid, "Invalid"}, + {FpgaType::Integrated, "Integrated"}, + {FpgaType::Discrete, "Discrete"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(SystemInterfaceType, { + {SystemInterfaceType::Invalid, "Invalid"}, + {SystemInterfaceType::QPI, "QPI"}, + {SystemInterfaceType::UPI, "UPI"}, + {SystemInterfaceType::PCIe, "PCIe"}, + {SystemInterfaceType::Ethernet, "Ethernet"}, + {SystemInterfaceType::AMBA, "AMBA"}, + {SystemInterfaceType::CCIX, "CCIX"}, + {SystemInterfaceType::CXL, "CXL"}, + {SystemInterfaceType::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(TurboState, { + {TurboState::Invalid, "Invalid"}, + {TurboState::Enabled, "Enabled"}, + {TurboState::Disabled, "Disabled"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(BaseSpeedPriorityState, { + {BaseSpeedPriorityState::Invalid, "Invalid"}, + {BaseSpeedPriorityState::Enabled, "Enabled"}, + {BaseSpeedPriorityState::Disabled, "Disabled"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ThrottleCause, { + {ThrottleCause::Invalid, "Invalid"}, + {ThrottleCause::PowerLimit, "PowerLimit"}, + {ThrottleCause::ThermalLimit, "ThermalLimit"}, + {ThrottleCause::ClockLimit, "ClockLimit"}, + {ThrottleCause::Unknown, "Unknown"}, + {ThrottleCause::OEM, "OEM"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/redfish_extensions.hpp b/redfish-core/include/generated/enums/redfish_extensions.hpp new file mode 100644 index 0000000000..c4cefcd710 --- /dev/null +++ b/redfish-core/include/generated/enums/redfish_extensions.hpp @@ -0,0 +1,39 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace redfish_extensions +{ +// clang-format off + +enum class ReleaseStatusType{ + Invalid, + Standard, + Informational, + WorkInProgress, + InDevelopment, +}; + +enum class RevisionKind{ + Invalid, + Added, + Modified, + Deprecated, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(ReleaseStatusType, { + {ReleaseStatusType::Invalid, "Invalid"}, + {ReleaseStatusType::Standard, "Standard"}, + {ReleaseStatusType::Informational, "Informational"}, + {ReleaseStatusType::WorkInProgress, "WorkInProgress"}, + {ReleaseStatusType::InDevelopment, "InDevelopment"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(RevisionKind, { + {RevisionKind::Invalid, "Invalid"}, + {RevisionKind::Added, "Added"}, + {RevisionKind::Modified, "Modified"}, + {RevisionKind::Deprecated, "Deprecated"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/redundancy.hpp b/redfish-core/include/generated/enums/redundancy.hpp new file mode 100644 index 0000000000..c894df52e6 --- /dev/null +++ b/redfish-core/include/generated/enums/redundancy.hpp @@ -0,0 +1,27 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace redundancy +{ +// clang-format off + +enum class RedundancyType{ + Invalid, + Failover, + NPlusM, + Sharing, + Sparing, + NotRedundant, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(RedundancyType, { + {RedundancyType::Invalid, "Invalid"}, + {RedundancyType::Failover, "Failover"}, + {RedundancyType::NPlusM, "NPlusM"}, + {RedundancyType::Sharing, "Sharing"}, + {RedundancyType::Sparing, "Sparing"}, + {RedundancyType::NotRedundant, "NotRedundant"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/resource.hpp b/redfish-core/include/generated/enums/resource.hpp new file mode 100644 index 0000000000..76dbe161e0 --- /dev/null +++ b/redfish-core/include/generated/enums/resource.hpp @@ -0,0 +1,219 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace resource +{ +// clang-format off + +enum class State{ + Invalid, + Enabled, + Disabled, + StandbyOffline, + StandbySpare, + InTest, + Starting, + Absent, + UnavailableOffline, + Deferring, + Quiesced, + Updating, + Qualified, +}; + +enum class Health{ + Invalid, + OK, + Warning, + Critical, +}; + +enum class ResetType{ + Invalid, + On, + ForceOff, + GracefulShutdown, + GracefulRestart, + ForceRestart, + Nmi, + ForceOn, + PushPowerButton, + PowerCycle, + Suspend, + Pause, + Resume, +}; + +enum class IndicatorLED{ + Invalid, + Lit, + Blinking, + Off, +}; + +enum class PowerState{ + Invalid, + On, + Off, + PoweringOn, + PoweringOff, + Paused, +}; + +enum class DurableNameFormat{ + Invalid, + NAA, + iQN, + FC_WWN, + UUID, + EUI, + NQN, + NSID, + NGUID, + MACAddress, +}; + +enum class RackUnits{ + Invalid, + OpenU, + EIA_310, +}; + +enum class LocationType{ + Invalid, + Slot, + Bay, + Connector, + Socket, + Backplane, + Embedded, +}; + +enum class Reference{ + Invalid, + Top, + Bottom, + Front, + Rear, + Left, + Right, + Middle, +}; + +enum class Orientation{ + Invalid, + FrontToBack, + BackToFront, + TopToBottom, + BottomToTop, + LeftToRight, + RightToLeft, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(State, { + {State::Invalid, "Invalid"}, + {State::Enabled, "Enabled"}, + {State::Disabled, "Disabled"}, + {State::StandbyOffline, "StandbyOffline"}, + {State::StandbySpare, "StandbySpare"}, + {State::InTest, "InTest"}, + {State::Starting, "Starting"}, + {State::Absent, "Absent"}, + {State::UnavailableOffline, "UnavailableOffline"}, + {State::Deferring, "Deferring"}, + {State::Quiesced, "Quiesced"}, + {State::Updating, "Updating"}, + {State::Qualified, "Qualified"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(Health, { + {Health::Invalid, "Invalid"}, + {Health::OK, "OK"}, + {Health::Warning, "Warning"}, + {Health::Critical, "Critical"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ResetType, { + {ResetType::Invalid, "Invalid"}, + {ResetType::On, "On"}, + {ResetType::ForceOff, "ForceOff"}, + {ResetType::GracefulShutdown, "GracefulShutdown"}, + {ResetType::GracefulRestart, "GracefulRestart"}, + {ResetType::ForceRestart, "ForceRestart"}, + {ResetType::Nmi, "Nmi"}, + {ResetType::ForceOn, "ForceOn"}, + {ResetType::PushPowerButton, "PushPowerButton"}, + {ResetType::PowerCycle, "PowerCycle"}, + {ResetType::Suspend, "Suspend"}, + {ResetType::Pause, "Pause"}, + {ResetType::Resume, "Resume"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(IndicatorLED, { + {IndicatorLED::Invalid, "Invalid"}, + {IndicatorLED::Lit, "Lit"}, + {IndicatorLED::Blinking, "Blinking"}, + {IndicatorLED::Off, "Off"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(PowerState, { + {PowerState::Invalid, "Invalid"}, + {PowerState::On, "On"}, + {PowerState::Off, "Off"}, + {PowerState::PoweringOn, "PoweringOn"}, + {PowerState::PoweringOff, "PoweringOff"}, + {PowerState::Paused, "Paused"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(DurableNameFormat, { + {DurableNameFormat::Invalid, "Invalid"}, + {DurableNameFormat::NAA, "NAA"}, + {DurableNameFormat::iQN, "iQN"}, + {DurableNameFormat::FC_WWN, "FC_WWN"}, + {DurableNameFormat::UUID, "UUID"}, + {DurableNameFormat::EUI, "EUI"}, + {DurableNameFormat::NQN, "NQN"}, + {DurableNameFormat::NSID, "NSID"}, + {DurableNameFormat::NGUID, "NGUID"}, + {DurableNameFormat::MACAddress, "MACAddress"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(RackUnits, { + {RackUnits::Invalid, "Invalid"}, + {RackUnits::OpenU, "OpenU"}, + {RackUnits::EIA_310, "EIA_310"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(LocationType, { + {LocationType::Invalid, "Invalid"}, + {LocationType::Slot, "Slot"}, + {LocationType::Bay, "Bay"}, + {LocationType::Connector, "Connector"}, + {LocationType::Socket, "Socket"}, + {LocationType::Backplane, "Backplane"}, + {LocationType::Embedded, "Embedded"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(Reference, { + {Reference::Invalid, "Invalid"}, + {Reference::Top, "Top"}, + {Reference::Bottom, "Bottom"}, + {Reference::Front, "Front"}, + {Reference::Rear, "Rear"}, + {Reference::Left, "Left"}, + {Reference::Right, "Right"}, + {Reference::Middle, "Middle"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(Orientation, { + {Orientation::Invalid, "Invalid"}, + {Orientation::FrontToBack, "FrontToBack"}, + {Orientation::BackToFront, "BackToFront"}, + {Orientation::TopToBottom, "TopToBottom"}, + {Orientation::BottomToTop, "BottomToTop"}, + {Orientation::LeftToRight, "LeftToRight"}, + {Orientation::RightToLeft, "RightToLeft"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/sensor.hpp b/redfish-core/include/generated/enums/sensor.hpp new file mode 100644 index 0000000000..2f43e10e43 --- /dev/null +++ b/redfish-core/include/generated/enums/sensor.hpp @@ -0,0 +1,139 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace sensor +{ +// clang-format off + +enum class VoltageType{ + Invalid, + AC, + DC, +}; + +enum class ElectricalContext{ + Invalid, + Line1, + Line2, + Line3, + Neutral, + LineToLine, + Line1ToLine2, + Line2ToLine3, + Line3ToLine1, + LineToNeutral, + Line1ToNeutral, + Line2ToNeutral, + Line3ToNeutral, + Line1ToNeutralAndL1L2, + Line2ToNeutralAndL1L2, + Line2ToNeutralAndL2L3, + Line3ToNeutralAndL3L1, + Total, +}; + +enum class ThresholdActivation{ + Invalid, + Increasing, + Decreasing, + Either, +}; + +enum class ReadingType{ + Invalid, + Temperature, + Humidity, + Power, + EnergykWh, + EnergyJoules, + EnergyWh, + ChargeAh, + Voltage, + Current, + Frequency, + Pressure, + PressurekPa, + LiquidLevel, + Rotational, + AirFlow, + LiquidFlow, + Barometric, + Altitude, + Percent, + AbsoluteHumidity, +}; + +enum class ImplementationType{ + Invalid, + PhysicalSensor, + Synthesized, + Reported, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(VoltageType, { + {VoltageType::Invalid, "Invalid"}, + {VoltageType::AC, "AC"}, + {VoltageType::DC, "DC"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ElectricalContext, { + {ElectricalContext::Invalid, "Invalid"}, + {ElectricalContext::Line1, "Line1"}, + {ElectricalContext::Line2, "Line2"}, + {ElectricalContext::Line3, "Line3"}, + {ElectricalContext::Neutral, "Neutral"}, + {ElectricalContext::LineToLine, "LineToLine"}, + {ElectricalContext::Line1ToLine2, "Line1ToLine2"}, + {ElectricalContext::Line2ToLine3, "Line2ToLine3"}, + {ElectricalContext::Line3ToLine1, "Line3ToLine1"}, + {ElectricalContext::LineToNeutral, "LineToNeutral"}, + {ElectricalContext::Line1ToNeutral, "Line1ToNeutral"}, + {ElectricalContext::Line2ToNeutral, "Line2ToNeutral"}, + {ElectricalContext::Line3ToNeutral, "Line3ToNeutral"}, + {ElectricalContext::Line1ToNeutralAndL1L2, "Line1ToNeutralAndL1L2"}, + {ElectricalContext::Line2ToNeutralAndL1L2, "Line2ToNeutralAndL1L2"}, + {ElectricalContext::Line2ToNeutralAndL2L3, "Line2ToNeutralAndL2L3"}, + {ElectricalContext::Line3ToNeutralAndL3L1, "Line3ToNeutralAndL3L1"}, + {ElectricalContext::Total, "Total"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ThresholdActivation, { + {ThresholdActivation::Invalid, "Invalid"}, + {ThresholdActivation::Increasing, "Increasing"}, + {ThresholdActivation::Decreasing, "Decreasing"}, + {ThresholdActivation::Either, "Either"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ReadingType, { + {ReadingType::Invalid, "Invalid"}, + {ReadingType::Temperature, "Temperature"}, + {ReadingType::Humidity, "Humidity"}, + {ReadingType::Power, "Power"}, + {ReadingType::EnergykWh, "EnergykWh"}, + {ReadingType::EnergyJoules, "EnergyJoules"}, + {ReadingType::EnergyWh, "EnergyWh"}, + {ReadingType::ChargeAh, "ChargeAh"}, + {ReadingType::Voltage, "Voltage"}, + {ReadingType::Current, "Current"}, + {ReadingType::Frequency, "Frequency"}, + {ReadingType::Pressure, "Pressure"}, + {ReadingType::PressurekPa, "PressurekPa"}, + {ReadingType::LiquidLevel, "LiquidLevel"}, + {ReadingType::Rotational, "Rotational"}, + {ReadingType::AirFlow, "AirFlow"}, + {ReadingType::LiquidFlow, "LiquidFlow"}, + {ReadingType::Barometric, "Barometric"}, + {ReadingType::Altitude, "Altitude"}, + {ReadingType::Percent, "Percent"}, + {ReadingType::AbsoluteHumidity, "AbsoluteHumidity"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ImplementationType, { + {ImplementationType::Invalid, "Invalid"}, + {ImplementationType::PhysicalSensor, "PhysicalSensor"}, + {ImplementationType::Synthesized, "Synthesized"}, + {ImplementationType::Reported, "Reported"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/session.hpp b/redfish-core/include/generated/enums/session.hpp new file mode 100644 index 0000000000..61da667912 --- /dev/null +++ b/redfish-core/include/generated/enums/session.hpp @@ -0,0 +1,33 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace session +{ +// clang-format off + +enum class SessionTypes{ + Invalid, + HostConsole, + ManagerConsole, + IPMI, + KVMIP, + OEM, + Redfish, + VirtualMedia, + WebUI, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(SessionTypes, { + {SessionTypes::Invalid, "Invalid"}, + {SessionTypes::HostConsole, "HostConsole"}, + {SessionTypes::ManagerConsole, "ManagerConsole"}, + {SessionTypes::IPMI, "IPMI"}, + {SessionTypes::KVMIP, "KVMIP"}, + {SessionTypes::OEM, "OEM"}, + {SessionTypes::Redfish, "Redfish"}, + {SessionTypes::VirtualMedia, "VirtualMedia"}, + {SessionTypes::WebUI, "WebUI"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/settings.hpp b/redfish-core/include/generated/enums/settings.hpp new file mode 100644 index 0000000000..abd6922553 --- /dev/null +++ b/redfish-core/include/generated/enums/settings.hpp @@ -0,0 +1,43 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace settings +{ +// clang-format off + +enum class OperationApplyTime{ + Invalid, + Immediate, + OnReset, + AtMaintenanceWindowStart, + InMaintenanceWindowOnReset, + OnStartUpdateRequest, +}; + +enum class ApplyTime{ + Invalid, + Immediate, + OnReset, + AtMaintenanceWindowStart, + InMaintenanceWindowOnReset, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(OperationApplyTime, { + {OperationApplyTime::Invalid, "Invalid"}, + {OperationApplyTime::Immediate, "Immediate"}, + {OperationApplyTime::OnReset, "OnReset"}, + {OperationApplyTime::AtMaintenanceWindowStart, "AtMaintenanceWindowStart"}, + {OperationApplyTime::InMaintenanceWindowOnReset, "InMaintenanceWindowOnReset"}, + {OperationApplyTime::OnStartUpdateRequest, "OnStartUpdateRequest"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ApplyTime, { + {ApplyTime::Invalid, "Invalid"}, + {ApplyTime::Immediate, "Immediate"}, + {ApplyTime::OnReset, "OnReset"}, + {ApplyTime::AtMaintenanceWindowStart, "AtMaintenanceWindowStart"}, + {ApplyTime::InMaintenanceWindowOnReset, "InMaintenanceWindowOnReset"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/storage.hpp b/redfish-core/include/generated/enums/storage.hpp new file mode 100644 index 0000000000..b9014caf22 --- /dev/null +++ b/redfish-core/include/generated/enums/storage.hpp @@ -0,0 +1,21 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace storage +{ +// clang-format off + +enum class ResetToDefaultsType{ + Invalid, + ResetAll, + PreserveVolumes, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(ResetToDefaultsType, { + {ResetToDefaultsType::Invalid, "Invalid"}, + {ResetToDefaultsType::ResetAll, "ResetAll"}, + {ResetToDefaultsType::PreserveVolumes, "PreserveVolumes"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/storage_controller.hpp b/redfish-core/include/generated/enums/storage_controller.hpp new file mode 100644 index 0000000000..78fca440fe --- /dev/null +++ b/redfish-core/include/generated/enums/storage_controller.hpp @@ -0,0 +1,39 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace storage_controller +{ +// clang-format off + +enum class NVMeControllerType{ + Invalid, + Admin, + Discovery, + IO, +}; + +enum class ANAAccessState{ + Invalid, + Optimized, + NonOptimized, + Inaccessible, + PersistentLoss, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(NVMeControllerType, { + {NVMeControllerType::Invalid, "Invalid"}, + {NVMeControllerType::Admin, "Admin"}, + {NVMeControllerType::Discovery, "Discovery"}, + {NVMeControllerType::IO, "IO"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ANAAccessState, { + {ANAAccessState::Invalid, "Invalid"}, + {ANAAccessState::Optimized, "Optimized"}, + {ANAAccessState::NonOptimized, "NonOptimized"}, + {ANAAccessState::Inaccessible, "Inaccessible"}, + {ANAAccessState::PersistentLoss, "PersistentLoss"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/task.hpp b/redfish-core/include/generated/enums/task.hpp new file mode 100644 index 0000000000..2ef026fe55 --- /dev/null +++ b/redfish-core/include/generated/enums/task.hpp @@ -0,0 +1,43 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace task +{ +// clang-format off + +enum class TaskState{ + Invalid, + New, + Starting, + Running, + Suspended, + Interrupted, + Pending, + Stopping, + Completed, + Killed, + Exception, + Service, + Cancelling, + Cancelled, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(TaskState, { + {TaskState::Invalid, "Invalid"}, + {TaskState::New, "New"}, + {TaskState::Starting, "Starting"}, + {TaskState::Running, "Running"}, + {TaskState::Suspended, "Suspended"}, + {TaskState::Interrupted, "Interrupted"}, + {TaskState::Pending, "Pending"}, + {TaskState::Stopping, "Stopping"}, + {TaskState::Completed, "Completed"}, + {TaskState::Killed, "Killed"}, + {TaskState::Exception, "Exception"}, + {TaskState::Service, "Service"}, + {TaskState::Cancelling, "Cancelling"}, + {TaskState::Cancelled, "Cancelled"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/task_service.hpp b/redfish-core/include/generated/enums/task_service.hpp new file mode 100644 index 0000000000..5e9a5cb752 --- /dev/null +++ b/redfish-core/include/generated/enums/task_service.hpp @@ -0,0 +1,21 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace task_service +{ +// clang-format off + +enum class OverWritePolicy{ + Invalid, + Manual, + Oldest, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(OverWritePolicy, { + {OverWritePolicy::Invalid, "Invalid"}, + {OverWritePolicy::Manual, "Manual"}, + {OverWritePolicy::Oldest, "Oldest"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/telemetry_service.hpp b/redfish-core/include/generated/enums/telemetry_service.hpp new file mode 100644 index 0000000000..9e8cb0b18b --- /dev/null +++ b/redfish-core/include/generated/enums/telemetry_service.hpp @@ -0,0 +1,25 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace telemetry_service +{ +// clang-format off + +enum class CollectionFunction{ + Invalid, + Average, + Maximum, + Minimum, + Summation, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(CollectionFunction, { + {CollectionFunction::Invalid, "Invalid"}, + {CollectionFunction::Average, "Average"}, + {CollectionFunction::Maximum, "Maximum"}, + {CollectionFunction::Minimum, "Minimum"}, + {CollectionFunction::Summation, "Summation"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/thermal.hpp b/redfish-core/include/generated/enums/thermal.hpp new file mode 100644 index 0000000000..50b624e7f4 --- /dev/null +++ b/redfish-core/include/generated/enums/thermal.hpp @@ -0,0 +1,21 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace thermal +{ +// clang-format off + +enum class ReadingUnits{ + Invalid, + RPM, + Percent, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(ReadingUnits, { + {ReadingUnits::Invalid, "Invalid"}, + {ReadingUnits::RPM, "RPM"}, + {ReadingUnits::Percent, "Percent"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/triggers.hpp b/redfish-core/include/generated/enums/triggers.hpp new file mode 100644 index 0000000000..b2720573ff --- /dev/null +++ b/redfish-core/include/generated/enums/triggers.hpp @@ -0,0 +1,73 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace triggers +{ +// clang-format off + +enum class MetricTypeEnum{ + Invalid, + Numeric, + Discrete, +}; + +enum class TriggerActionEnum{ + Invalid, + LogToLogService, + RedfishEvent, + RedfishMetricReport, +}; + +enum class DiscreteTriggerConditionEnum{ + Invalid, + Specified, + Changed, +}; + +enum class ThresholdActivation{ + Invalid, + Increasing, + Decreasing, + Either, +}; + +enum class DirectionOfCrossingEnum{ + Invalid, + Increasing, + Decreasing, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(MetricTypeEnum, { + {MetricTypeEnum::Invalid, "Invalid"}, + {MetricTypeEnum::Numeric, "Numeric"}, + {MetricTypeEnum::Discrete, "Discrete"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(TriggerActionEnum, { + {TriggerActionEnum::Invalid, "Invalid"}, + {TriggerActionEnum::LogToLogService, "LogToLogService"}, + {TriggerActionEnum::RedfishEvent, "RedfishEvent"}, + {TriggerActionEnum::RedfishMetricReport, "RedfishMetricReport"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(DiscreteTriggerConditionEnum, { + {DiscreteTriggerConditionEnum::Invalid, "Invalid"}, + {DiscreteTriggerConditionEnum::Specified, "Specified"}, + {DiscreteTriggerConditionEnum::Changed, "Changed"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ThresholdActivation, { + {ThresholdActivation::Invalid, "Invalid"}, + {ThresholdActivation::Increasing, "Increasing"}, + {ThresholdActivation::Decreasing, "Decreasing"}, + {ThresholdActivation::Either, "Either"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(DirectionOfCrossingEnum, { + {DirectionOfCrossingEnum::Invalid, "Invalid"}, + {DirectionOfCrossingEnum::Increasing, "Increasing"}, + {DirectionOfCrossingEnum::Decreasing, "Decreasing"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/update_service.hpp b/redfish-core/include/generated/enums/update_service.hpp new file mode 100644 index 0000000000..0a1e4773fc --- /dev/null +++ b/redfish-core/include/generated/enums/update_service.hpp @@ -0,0 +1,55 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace update_service +{ +// clang-format off + +enum class TransferProtocolType{ + Invalid, + CIFS, + FTP, + SFTP, + HTTP, + HTTPS, + NSF, + SCP, + TFTP, + OEM, + NFS, +}; + +enum class ApplyTime{ + Invalid, + Immediate, + OnReset, + AtMaintenanceWindowStart, + InMaintenanceWindowOnReset, + OnStartUpdateRequest, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(TransferProtocolType, { + {TransferProtocolType::Invalid, "Invalid"}, + {TransferProtocolType::CIFS, "CIFS"}, + {TransferProtocolType::FTP, "FTP"}, + {TransferProtocolType::SFTP, "SFTP"}, + {TransferProtocolType::HTTP, "HTTP"}, + {TransferProtocolType::HTTPS, "HTTPS"}, + {TransferProtocolType::NSF, "NSF"}, + {TransferProtocolType::SCP, "SCP"}, + {TransferProtocolType::TFTP, "TFTP"}, + {TransferProtocolType::OEM, "OEM"}, + {TransferProtocolType::NFS, "NFS"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ApplyTime, { + {ApplyTime::Invalid, "Invalid"}, + {ApplyTime::Immediate, "Immediate"}, + {ApplyTime::OnReset, "OnReset"}, + {ApplyTime::AtMaintenanceWindowStart, "AtMaintenanceWindowStart"}, + {ApplyTime::InMaintenanceWindowOnReset, "InMaintenanceWindowOnReset"}, + {ApplyTime::OnStartUpdateRequest, "OnStartUpdateRequest"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/generated/enums/virtual_media.hpp b/redfish-core/include/generated/enums/virtual_media.hpp new file mode 100644 index 0000000000..3f9fc78a3b --- /dev/null +++ b/redfish-core/include/generated/enums/virtual_media.hpp @@ -0,0 +1,79 @@ +#pragma once +#include <nlohmann/json.hpp> + +namespace virtual_media +{ +// clang-format off + +enum class MediaType{ + Invalid, + CD, + Floppy, + USBStick, + DVD, +}; + +enum class ConnectedVia{ + Invalid, + NotConnected, + URI, + Applet, + Oem, +}; + +enum class TransferProtocolType{ + Invalid, + CIFS, + FTP, + SFTP, + HTTP, + HTTPS, + NFS, + SCP, + TFTP, + OEM, +}; + +enum class TransferMethod{ + Invalid, + Stream, + Upload, +}; + +NLOHMANN_JSON_SERIALIZE_ENUM(MediaType, { + {MediaType::Invalid, "Invalid"}, + {MediaType::CD, "CD"}, + {MediaType::Floppy, "Floppy"}, + {MediaType::USBStick, "USBStick"}, + {MediaType::DVD, "DVD"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(ConnectedVia, { + {ConnectedVia::Invalid, "Invalid"}, + {ConnectedVia::NotConnected, "NotConnected"}, + {ConnectedVia::URI, "URI"}, + {ConnectedVia::Applet, "Applet"}, + {ConnectedVia::Oem, "Oem"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(TransferProtocolType, { + {TransferProtocolType::Invalid, "Invalid"}, + {TransferProtocolType::CIFS, "CIFS"}, + {TransferProtocolType::FTP, "FTP"}, + {TransferProtocolType::SFTP, "SFTP"}, + {TransferProtocolType::HTTP, "HTTP"}, + {TransferProtocolType::HTTPS, "HTTPS"}, + {TransferProtocolType::NFS, "NFS"}, + {TransferProtocolType::SCP, "SCP"}, + {TransferProtocolType::TFTP, "TFTP"}, + {TransferProtocolType::OEM, "OEM"}, +}); + +NLOHMANN_JSON_SERIALIZE_ENUM(TransferMethod, { + {TransferMethod::Invalid, "Invalid"}, + {TransferMethod::Stream, "Stream"}, + {TransferMethod::Upload, "Upload"}, +}); + +} +// clang-format on diff --git a/redfish-core/include/utils/sw_utils.hpp b/redfish-core/include/utils/sw_utils.hpp index c66bff80fe..e2b90caca2 100644 --- a/redfish-core/include/utils/sw_utils.hpp +++ b/redfish-core/include/utils/sw_utils.hpp @@ -1,6 +1,7 @@ #pragma once #include <async_resp.hpp> #include <dbus_utility.hpp> +#include <generated/enums/resource.hpp> #include <sdbusplus/asio/property.hpp> #include <sdbusplus/unpack_properties.hpp> #include <utils/dbus_utils.hpp> @@ -234,24 +235,24 @@ inline void * * @return The corresponding Redfish state */ -inline std::string getRedfishSwState(const std::string& swState) +inline resource::State getRedfishSwState(const std::string& swState) { if (swState == "xyz.openbmc_project.Software.Activation.Activations.Active") { - return "Enabled"; + return resource::State::Enabled; } if (swState == "xyz.openbmc_project.Software.Activation." "Activations.Activating") { - return "Updating"; + return resource::State::Updating; } if (swState == "xyz.openbmc_project.Software.Activation." "Activations.StandbySpare") { - return "StandbySpare"; + return resource::State::StandbySpare; } BMCWEB_LOG_DEBUG << "Default sw state " << swState << " to Disabled"; - return "Disabled"; + return resource::State::Disabled; } /** diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp index 8ccab655ca..3a8ffbc9a4 100644 --- a/redfish-core/lib/account_service.hpp +++ b/redfish-core/lib/account_service.hpp @@ -15,13 +15,15 @@ */ #pragma once +#include "generated/enums/account_service.hpp" +#include "registries/privilege_registry.hpp" + #include <app.hpp> #include <dbus_utility.hpp> #include <error_messages.hpp> #include <openbmc_dbus_rest.hpp> #include <persistent_data.hpp> #include <query.hpp> -#include <registries/privilege_registry.hpp> #include <sdbusplus/asio/property.hpp> #include <sdbusplus/unpack_properties.hpp> #include <utils/dbus_utils.hpp> @@ -210,7 +212,8 @@ inline void parseLDAPConfigData(nlohmann::json& jsonResponse, ldap["ServiceEnabled"] = confData.serviceEnabled; ldap["ServiceAddresses"] = nlohmann::json::array({confData.uri}); - ldap["Authentication"]["AuthenticationType"] = "UsernameAndPassword"; + ldap["Authentication"]["AuthenticationType"] = + account_service::AuthenticationTypes::UsernameAndPassword; ldap["Authentication"]["Username"] = confData.bindDN; ldap["Authentication"]["Password"] = nullptr; diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp index ebbf9268e3..8af9580609 100644 --- a/redfish-core/lib/pcie.hpp +++ b/redfish-core/lib/pcie.hpp @@ -16,6 +16,8 @@ #pragma once +#include "generated/enums/pcie_device.hpp" + #include <app.hpp> #include <boost/system/linux_error.hpp> #include <dbus_utility.hpp> @@ -111,39 +113,39 @@ inline void requestRoutesSystemPCIeDeviceCollection(App& app) }); } -inline std::optional<std::string> +inline std::optional<pcie_device::PCIeTypes> redfishPcieGenerationFromDbus(const std::string& generationInUse) { if (generationInUse == "xyz.openbmc_project.Inventory.Item.PCIeSlot.Generations.Gen1") { - return "Gen1"; + return pcie_device::PCIeTypes::Gen1; } if (generationInUse == "xyz.openbmc_project.Inventory.Item.PCIeSlot.Generations.Gen2") { - return "Gen2"; + return pcie_device::PCIeTypes::Gen2; } if (generationInUse == "xyz.openbmc_project.Inventory.Item.PCIeSlot.Generations.Gen3") { - return "Gen3"; + return pcie_device::PCIeTypes::Gen3; } if (generationInUse == "xyz.openbmc_project.Inventory.Item.PCIeSlot.Generations.Gen4") { - return "Gen4"; + return pcie_device::PCIeTypes::Gen4; } if (generationInUse == "xyz.openbmc_project.Inventory.Item.PCIeSlot.Generations.Gen5") { - return "Gen5"; + return pcie_device::PCIeTypes::Gen5; } if (generationInUse.empty() || generationInUse == "xyz.openbmc_project.Inventory.Item.PCIeSlot.Generations.Unknown") { - return ""; + return pcie_device::PCIeTypes::Invalid; } // The value is not unknown or Gen1-5, need return an internal error. @@ -208,14 +210,14 @@ inline void requestRoutesSystemPCIeDevice(App& app) if (generationInUse != nullptr) { - std::optional<std::string> redfishGenerationInUse = + std::optional<pcie_device::PCIeTypes> redfishGenerationInUse = redfishPcieGenerationFromDbus(*generationInUse); if (!redfishGenerationInUse) { messages::internalError(asyncResp->res); return; } - if (!redfishGenerationInUse->empty()) + if (*redfishGenerationInUse != pcie_device::PCIeTypes::Invalid) { asyncResp->res.jsonValue["PCIeInterface"]["PCIeType"] = *redfishGenerationInUse; diff --git a/redfish-core/lib/pcie_slots.hpp b/redfish-core/lib/pcie_slots.hpp index 778768f092..668987df2c 100644 --- a/redfish-core/lib/pcie_slots.hpp +++ b/redfish-core/lib/pcie_slots.hpp @@ -1,6 +1,7 @@ #pragma once #include "error_messages.hpp" +#include "generated/enums/pcie_slot.hpp" #include "utility.hpp" #include <app.hpp> @@ -14,53 +15,53 @@ namespace redfish { -inline std::string dbusSlotTypeToRf(const std::string& slotType) +inline pcie_slot::SlotTypes dbusSlotTypeToRf(const std::string& slotType) { if (slotType == "xyz.openbmc_project.Inventory.Item.PCIeSlot.SlotTypes.FullLength") { - return "FullLength"; + return pcie_slot::SlotTypes::FullLength; } if (slotType == "xyz.openbmc_project.Inventory.Item.PCIeSlot.SlotTypes.HalfLength") { - return "HalfLength"; + return pcie_slot::SlotTypes::HalfLength; } if (slotType == "xyz.openbmc_project.Inventory.Item.PCIeSlot.SlotTypes.LowProfile") { - return "LowProfile"; + return pcie_slot::SlotTypes::LowProfile; } if (slotType == "xyz.openbmc_project.Inventory.Item.PCIeSlot.SlotTypes.Mini") { - return "Mini"; + return pcie_slot::SlotTypes::Mini; } if (slotType == "xyz.openbmc_project.Inventory.Item.PCIeSlot.SlotTypes.M_2") { - return "M2"; + return pcie_slot::SlotTypes::M2; } if (slotType == "xyz.openbmc_project.Inventory.Item.PCIeSlot.SlotTypes.OEM") { - return "OEM"; + return pcie_slot::SlotTypes::OEM; } if (slotType == "xyz.openbmc_project.Inventory.Item.PCIeSlot.SlotTypes.OCP3Small") { - return "OCP3Small"; + return pcie_slot::SlotTypes::OCP3Small; } if (slotType == "xyz.openbmc_project.Inventory.Item.PCIeSlot.SlotTypes.OCP3Large") { - return "OCP3Large"; + return pcie_slot::SlotTypes::OCP3Large; } if (slotType == "xyz.openbmc_project.Inventory.Item.PCIeSlot.SlotTypes.U_2") { - return "U2"; + return pcie_slot::SlotTypes::U2; } // Unknown or others - return ""; + return pcie_slot::SlotTypes::Invalid; } inline void @@ -106,7 +107,7 @@ inline void if (generation != nullptr) { - std::optional<std::string> pcieType = + std::optional<pcie_device::PCIeTypes> pcieType = redfishPcieGenerationFromDbus(*generation); if (!pcieType) { diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 390a2a7bf2..5bbb642cc4 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -15,6 +15,8 @@ */ #pragma once +#include "generated/enums/sensor.hpp" + #include <app.hpp> #include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/find.hpp> @@ -89,49 +91,49 @@ static constexpr std::array<sensorPair, 3> paths = { {node::sensors, std::span<std::string_view>(dbus::sensorPaths)}, {node::thermal, std::span<std::string_view>(dbus::thermalPaths)}}}; -inline std::string_view toReadingType(std::string_view sensorType) +inline sensor::ReadingType toReadingType(std::string_view sensorType) { if (sensorType == "voltage") { - return "Voltage"; + return sensor::ReadingType::Voltage; } if (sensorType == "power") { - return "Power"; + return sensor::ReadingType::Power; } if (sensorType == "current") { - return "Current"; + return sensor::ReadingType::Current; } if (sensorType == "fan_tach") { - return "Rotational"; + return sensor::ReadingType::Rotational; } if (sensorType == "temperature") { - return "Temperature"; + return sensor::ReadingType::Temperature; } if (sensorType == "fan_pwm" || sensorType == "utilization") { - return "Percent"; + return sensor::ReadingType::Percent; } if (sensorType == "humidity") { - return "Humidity"; + return sensor::ReadingType::Humidity; } if (sensorType == "altitude") { - return "Altitude"; + return sensor::ReadingType::Altitude; } if (sensorType == "airflow") { - return "AirFlow"; + return sensor::ReadingType::AirFlow; } if (sensorType == "energy") { - return "EnergyJoules"; + return sensor::ReadingType::EnergyJoules; } - return ""; + return sensor::ReadingType::Invalid; } inline std::string_view toReadingUnits(std::string_view sensorType) @@ -842,8 +844,8 @@ inline void objectPropertiesToJson( { sensorJson["@odata.type"] = "#Sensor.v1_2_0.Sensor"; - std::string_view readingType = sensors::toReadingType(sensorType); - if (readingType.empty()) + sensor::ReadingType readingType = sensors::toReadingType(sensorType); + if (readingType == sensor::ReadingType::Invalid) { BMCWEB_LOG_ERROR << "Redfish cannot map reading type for " << sensorType; diff --git a/scripts/generate_schema_enums.py b/scripts/generate_schema_enums.py new file mode 100755 index 0000000000..13fbefe40f --- /dev/null +++ b/scripts/generate_schema_enums.py @@ -0,0 +1,163 @@ +#!/usr/bin/python3 +import os +import xml.etree.ElementTree as ET +from collections import defaultdict +import shutil +import re + + +SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) +REDFISH_SCHEMA_DIR = os.path.realpath( + os.path.join(SCRIPT_DIR, "..", "static", "redfish", "v1", "schema") +) + +OUTFOLDER = os.path.realpath(os.path.join( + SCRIPT_DIR, + "..", + "redfish-core", + "include", + "generated", + "enums" + ) +) + +# Odata string types +EDMX = "{http://docs.oasis-open.org/odata/ns/edmx}" +EDM = "{http://docs.oasis-open.org/odata/ns/edm}" + + +class Enum: + def __init__(self, name, values, namespace, from_file): + self.name = name + self.values = values + self.namespace = namespace + self.from_file = from_file + + +def parse_schema(element, filename): + EntityTypes = [] + namespace = element.attrib["Namespace"] + for schema_element in element: + name = schema_element.attrib.get("Name", None) + if name is None: + continue + if schema_element.tag == EDM + "EnumType": + enums = [] + for member in schema_element.findall(EDM + "Member"): + enums.append(member.attrib["Name"]) + EntityTypes.append(Enum(name, enums, namespace, filename)) + return EntityTypes + + +def parse_file(filename): + tree = ET.parse(filename) + root = tree.getroot() + results = [] + data_services = root.findall(EDMX + "DataServices") + for ds in data_services: + for element in ds: + if element.tag == EDM + "Schema": + results.extend(parse_schema(element, filename)) + + return results + + +def camel_to_snake(name): + # snake casing PCIeDevice and PCIeFunction results in mediocre results + # given that the standard didn't camel case those in a way that the + # algorithm expects, so change the casing explicitly to generate sane + # snake case results. + name = name.replace("PCIe", "Pcie") + name = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name) + return re.sub("([a-z0-9])([A-Z])", r"\1_\2", name).lower() + + +def write_enum_list(redfish_defs_file, enum_list, snake_case_namespace): + redfish_defs_file.write( + "#pragma once\n" + "#include <nlohmann/json.hpp>\n\n" + "namespace {}\n" + "{{\n" + "// clang-format off\n\n".format(snake_case_namespace) + ) + + for element in enum_list: + redfish_defs_file.write("enum class {}{{\n".format(element.name)) + values = element.values + if "Invalid" not in values: + values.insert(0, "Invalid") + + for value in values: + redfish_defs_file.write(" {},\n".format(value)) + + redfish_defs_file.write("};\n\n") + + for element in enum_list: + values = element.values + if "Invalid" not in values: + values.insert(0, "Invalid") + # nlohmann::json aparently uses c style arrays in their enum + # implementation, and clang-tidy isn't smart enough to figure out that + # the C arrays are in their code not bmcwebs, so we have to explicitly + # ignore the error. + redfish_defs_file.write( + "NLOHMANN_JSON_SERIALIZE_ENUM({}, {{\n".format( + element.name + ) + ) + for value in values: + redfish_defs_file.write( + ' {{{}::{}, "{}"}},\n'.format(element.name, value, value) + ) + + redfish_defs_file.write("});\n\n") + + print(element.name) + + redfish_defs_file.write("}\n" "// clang-format on\n") + + +def generate_enums(flat_list): + # clear out the old results if they exist + if os.path.exists(OUTFOLDER): + shutil.rmtree(OUTFOLDER) + os.makedirs(OUTFOLDER) + + enum_by_namespace = defaultdict(list) + + for element in flat_list: + if isinstance(element, Enum): + namespace_split = element.namespace.split(".")[0] + enum_by_namespace[namespace_split].append(element) + + for namespace, enum_list in enum_by_namespace.items(): + snake_case_namespace = camel_to_snake(namespace) + outfile = os.path.join( + OUTFOLDER, "{}.hpp".format(snake_case_namespace) + ) + + with open(outfile, "w") as redfish_defs: + write_enum_list(redfish_defs, enum_list, snake_case_namespace) + + +def main(): + print("Reading from {}".format(REDFISH_SCHEMA_DIR)) + dir_list = os.listdir(REDFISH_SCHEMA_DIR) + + filepaths = [ + os.path.join(REDFISH_SCHEMA_DIR, filename) for filename in dir_list + ] + + enum_list = [] + + for filepath in filepaths: + out = parse_file(filepath) + enum_list.extend(out) + + print("Parsing done") + + generate_enums(enum_list) + + +if __name__ == "__main__": + main() diff --git a/scripts/update_schemas.py b/scripts/update_schemas.py index 459d0457bd..f6eca42c78 100755 --- a/scripts/update_schemas.py +++ b/scripts/update_schemas.py @@ -8,6 +8,7 @@ from io import BytesIO import requests from packaging.version import parse +import generate_schema_enums VERSION = "DSP8010_2022.2" @@ -390,3 +391,5 @@ with open(os.path.join(cpp_path, "schemas.hpp"), "w") as hpp_file: hpp_file.write(" };\n}\n") zip_ref.close() + +generate_schema_enums.main() |