Add TypeDefinition support for enumeration generation
TypeDefinition was not supported by generate_schema_enums.py, this
change is to support the 'TypeDefinition' generation from schema.
Tested:
'TypeDefinition' fields in schema can be generated in generated files
with the change
Change-Id: Ibe61f65b905f2089f9e17a26fbd27e3ff1753166
Signed-off-by: Chandramohan Harkude <chandramohan.harkude@gmail.com>
diff --git a/redfish-core/include/generated/enums/ethernet_interface.hpp b/redfish-core/include/generated/enums/ethernet_interface.hpp
index f70f129..bf64ca5 100644
--- a/redfish-core/include/generated/enums/ethernet_interface.hpp
+++ b/redfish-core/include/generated/enums/ethernet_interface.hpp
@@ -7,6 +7,10 @@
{
// clang-format off
+enum class MACAddress{
+ Invalid,
+};
+
enum class LinkStatus{
Invalid,
LinkUp,
@@ -55,6 +59,10 @@
Limited,
};
+NLOHMANN_JSON_SERIALIZE_ENUM(MACAddress, {
+ {MACAddress::Invalid, "Invalid"},
+});
+
NLOHMANN_JSON_SERIALIZE_ENUM(LinkStatus, {
{LinkStatus::Invalid, "Invalid"},
{LinkStatus::LinkUp, "LinkUp"},
diff --git a/redfish-core/include/generated/enums/ip_addresses.hpp b/redfish-core/include/generated/enums/ip_addresses.hpp
index e91ad91..be1d56f 100644
--- a/redfish-core/include/generated/enums/ip_addresses.hpp
+++ b/redfish-core/include/generated/enums/ip_addresses.hpp
@@ -23,6 +23,14 @@
SLAAC,
};
+enum class SubnetMask{
+ Invalid,
+};
+
+enum class PrefixLength{
+ Invalid,
+};
+
enum class AddressState{
Invalid,
Preferred,
@@ -47,6 +55,14 @@
{IPv6AddressOrigin::SLAAC, "SLAAC"},
});
+NLOHMANN_JSON_SERIALIZE_ENUM(SubnetMask, {
+ {SubnetMask::Invalid, "Invalid"},
+});
+
+NLOHMANN_JSON_SERIALIZE_ENUM(PrefixLength, {
+ {PrefixLength::Invalid, "Invalid"},
+});
+
NLOHMANN_JSON_SERIALIZE_ENUM(AddressState, {
{AddressState::Invalid, "Invalid"},
{AddressState::Preferred, "Preferred"},
diff --git a/redfish-core/include/generated/enums/log_entry.hpp b/redfish-core/include/generated/enums/log_entry.hpp
index ac7e9a8..e4dc34e 100644
--- a/redfish-core/include/generated/enums/log_entry.hpp
+++ b/redfish-core/include/generated/enums/log_entry.hpp
@@ -22,6 +22,118 @@
CXL,
};
+enum class LogEntryCode{
+ Invalid,
+ Assert,
+ Deassert,
+ LowerNoncriticalgoinglow,
+ LowerNoncriticalgoinghigh,
+ LowerCriticalgoinglow,
+ LowerCriticalgoinghigh,
+ LowerNonrecoverablegoinglow,
+ LowerNonrecoverablegoinghigh,
+ UpperNoncriticalgoinglow,
+ UpperNoncriticalgoinghigh,
+ UpperCriticalgoinglow,
+ UpperCriticalgoinghigh,
+ UpperNonrecoverablegoinglow,
+ UpperNonrecoverablegoinghigh,
+ TransitiontoIdle,
+ TransitiontoActive,
+ TransitiontoBusy,
+ StateDeasserted,
+ StateAsserted,
+ PredictiveFailuredeasserted,
+ PredictiveFailureasserted,
+ LimitNotExceeded,
+ LimitExceeded,
+ PerformanceMet,
+ PerformanceLags,
+ TransitiontoOK,
+ TransitiontoNonCriticalfromOK,
+ TransitiontoCriticalfromlesssevere,
+ TransitiontoNonrecoverablefromlesssevere,
+ TransitiontoNonCriticalfrommoresevere,
+ TransitiontoCriticalfromNonrecoverable,
+ TransitiontoNonrecoverable,
+ Monitor,
+ Informational,
+ DeviceRemovedDeviceAbsent,
+ DeviceInsertedDevicePresent,
+ DeviceDisabled,
+ DeviceEnabled,
+ TransitiontoRunning,
+ TransitiontoInTest,
+ TransitiontoPowerOff,
+ TransitiontoOnLine,
+ TransitiontoOffLine,
+ TransitiontoOffDuty,
+ TransitiontoDegraded,
+ TransitiontoPowerSave,
+ InstallError,
+ FullyRedundant,
+ RedundancyLost,
+ RedundancyDegraded,
+ NonredundantSufficientResourcesfromRedundant,
+ NonredundantSufficientResourcesfromInsufficientResources,
+ NonredundantInsufficientResources,
+ RedundancyDegradedfromFullyRedundant,
+ RedundancyDegradedfromNonredundant,
+ D0PowerState,
+ D1PowerState,
+ D2PowerState,
+ D3PowerState,
+ OEM,
+};
+
+enum class SensorType{
+ Invalid,
+ PlatformSecurityViolationAttempt,
+ Temperature,
+ Voltage,
+ Current,
+ Fan,
+ PhysicalChassisSecurity,
+ Processor,
+ PowerSupplyConverter,
+ PowerUnit,
+ CoolingDevice,
+ OtherUnitsbasedSensor,
+ Memory,
+ DriveSlotBay,
+ POSTMemoryResize,
+ SystemFirmwareProgress,
+ EventLoggingDisabled,
+ SystemEvent,
+ CriticalInterrupt,
+ ButtonSwitch,
+ ModuleBoard,
+ MicrocontrollerCoprocessor,
+ AddinCard,
+ Chassis,
+ ChipSet,
+ OtherFRU,
+ CableInterconnect,
+ Terminator,
+ SystemBootRestart,
+ BootError,
+ BaseOSBootInstallationStatus,
+ OSStopShutdown,
+ SlotConnector,
+ SystemACPIPowerState,
+ Watchdog,
+ PlatformAlert,
+ EntityPresence,
+ MonitorASICIC,
+ LAN,
+ ManagementSubsystemHealth,
+ Battery,
+ SessionAudit,
+ VersionChange,
+ FRUState,
+ OEM,
+};
+
enum class LogDiagnosticDataTypes{
Invalid,
Manager,
@@ -64,6 +176,118 @@
{LogEntryType::CXL, "CXL"},
});
+NLOHMANN_JSON_SERIALIZE_ENUM(LogEntryCode, {
+ {LogEntryCode::Invalid, "Invalid"},
+ {LogEntryCode::Assert, "Assert"},
+ {LogEntryCode::Deassert, "Deassert"},
+ {LogEntryCode::LowerNoncriticalgoinglow, "Lower Non-critical - going low"},
+ {LogEntryCode::LowerNoncriticalgoinghigh, "Lower Non-critical - going high"},
+ {LogEntryCode::LowerCriticalgoinglow, "Lower Critical - going low"},
+ {LogEntryCode::LowerCriticalgoinghigh, "Lower Critical - going high"},
+ {LogEntryCode::LowerNonrecoverablegoinglow, "Lower Non-recoverable - going low"},
+ {LogEntryCode::LowerNonrecoverablegoinghigh, "Lower Non-recoverable - going high"},
+ {LogEntryCode::UpperNoncriticalgoinglow, "Upper Non-critical - going low"},
+ {LogEntryCode::UpperNoncriticalgoinghigh, "Upper Non-critical - going high"},
+ {LogEntryCode::UpperCriticalgoinglow, "Upper Critical - going low"},
+ {LogEntryCode::UpperCriticalgoinghigh, "Upper Critical - going high"},
+ {LogEntryCode::UpperNonrecoverablegoinglow, "Upper Non-recoverable - going low"},
+ {LogEntryCode::UpperNonrecoverablegoinghigh, "Upper Non-recoverable - going high"},
+ {LogEntryCode::TransitiontoIdle, "Transition to Idle"},
+ {LogEntryCode::TransitiontoActive, "Transition to Active"},
+ {LogEntryCode::TransitiontoBusy, "Transition to Busy"},
+ {LogEntryCode::StateDeasserted, "State Deasserted"},
+ {LogEntryCode::StateAsserted, "State Asserted"},
+ {LogEntryCode::PredictiveFailuredeasserted, "Predictive Failure deasserted"},
+ {LogEntryCode::PredictiveFailureasserted, "Predictive Failure asserted"},
+ {LogEntryCode::LimitNotExceeded, "Limit Not Exceeded"},
+ {LogEntryCode::LimitExceeded, "Limit Exceeded"},
+ {LogEntryCode::PerformanceMet, "Performance Met"},
+ {LogEntryCode::PerformanceLags, "Performance Lags"},
+ {LogEntryCode::TransitiontoOK, "Transition to OK"},
+ {LogEntryCode::TransitiontoNonCriticalfromOK, "Transition to Non-Critical from OK"},
+ {LogEntryCode::TransitiontoCriticalfromlesssevere, "Transition to Critical from less severe"},
+ {LogEntryCode::TransitiontoNonrecoverablefromlesssevere, "Transition to Non-recoverable from less severe"},
+ {LogEntryCode::TransitiontoNonCriticalfrommoresevere, "Transition to Non-Critical from more severe"},
+ {LogEntryCode::TransitiontoCriticalfromNonrecoverable, "Transition to Critical from Non-recoverable"},
+ {LogEntryCode::TransitiontoNonrecoverable, "Transition to Non-recoverable"},
+ {LogEntryCode::Monitor, "Monitor"},
+ {LogEntryCode::Informational, "Informational"},
+ {LogEntryCode::DeviceRemovedDeviceAbsent, "Device Removed / Device Absent"},
+ {LogEntryCode::DeviceInsertedDevicePresent, "Device Inserted / Device Present"},
+ {LogEntryCode::DeviceDisabled, "Device Disabled"},
+ {LogEntryCode::DeviceEnabled, "Device Enabled"},
+ {LogEntryCode::TransitiontoRunning, "Transition to Running"},
+ {LogEntryCode::TransitiontoInTest, "Transition to In Test"},
+ {LogEntryCode::TransitiontoPowerOff, "Transition to Power Off"},
+ {LogEntryCode::TransitiontoOnLine, "Transition to On Line"},
+ {LogEntryCode::TransitiontoOffLine, "Transition to Off Line"},
+ {LogEntryCode::TransitiontoOffDuty, "Transition to Off Duty"},
+ {LogEntryCode::TransitiontoDegraded, "Transition to Degraded"},
+ {LogEntryCode::TransitiontoPowerSave, "Transition to Power Save"},
+ {LogEntryCode::InstallError, "Install Error"},
+ {LogEntryCode::FullyRedundant, "Fully Redundant"},
+ {LogEntryCode::RedundancyLost, "Redundancy Lost"},
+ {LogEntryCode::RedundancyDegraded, "Redundancy Degraded"},
+ {LogEntryCode::NonredundantSufficientResourcesfromRedundant, "Non-redundant:Sufficient Resources from Redundant"},
+ {LogEntryCode::NonredundantSufficientResourcesfromInsufficientResources, "Non-redundant:Sufficient Resources from Insufficient Resources"},
+ {LogEntryCode::NonredundantInsufficientResources, "Non-redundant:Insufficient Resources"},
+ {LogEntryCode::RedundancyDegradedfromFullyRedundant, "Redundancy Degraded from Fully Redundant"},
+ {LogEntryCode::RedundancyDegradedfromNonredundant, "Redundancy Degraded from Non-redundant"},
+ {LogEntryCode::D0PowerState, "D0 Power State"},
+ {LogEntryCode::D1PowerState, "D1 Power State"},
+ {LogEntryCode::D2PowerState, "D2 Power State"},
+ {LogEntryCode::D3PowerState, "D3 Power State"},
+ {LogEntryCode::OEM, "OEM"},
+});
+
+NLOHMANN_JSON_SERIALIZE_ENUM(SensorType, {
+ {SensorType::Invalid, "Invalid"},
+ {SensorType::PlatformSecurityViolationAttempt, "Platform Security Violation Attempt"},
+ {SensorType::Temperature, "Temperature"},
+ {SensorType::Voltage, "Voltage"},
+ {SensorType::Current, "Current"},
+ {SensorType::Fan, "Fan"},
+ {SensorType::PhysicalChassisSecurity, "Physical Chassis Security"},
+ {SensorType::Processor, "Processor"},
+ {SensorType::PowerSupplyConverter, "Power Supply / Converter"},
+ {SensorType::PowerUnit, "PowerUnit"},
+ {SensorType::CoolingDevice, "CoolingDevice"},
+ {SensorType::OtherUnitsbasedSensor, "Other Units-based Sensor"},
+ {SensorType::Memory, "Memory"},
+ {SensorType::DriveSlotBay, "Drive Slot/Bay"},
+ {SensorType::POSTMemoryResize, "POST Memory Resize"},
+ {SensorType::SystemFirmwareProgress, "System Firmware Progress"},
+ {SensorType::EventLoggingDisabled, "Event Logging Disabled"},
+ {SensorType::SystemEvent, "System Event"},
+ {SensorType::CriticalInterrupt, "Critical Interrupt"},
+ {SensorType::ButtonSwitch, "Button/Switch"},
+ {SensorType::ModuleBoard, "Module/Board"},
+ {SensorType::MicrocontrollerCoprocessor, "Microcontroller/Coprocessor"},
+ {SensorType::AddinCard, "Add-in Card"},
+ {SensorType::Chassis, "Chassis"},
+ {SensorType::ChipSet, "ChipSet"},
+ {SensorType::OtherFRU, "Other FRU"},
+ {SensorType::CableInterconnect, "Cable/Interconnect"},
+ {SensorType::Terminator, "Terminator"},
+ {SensorType::SystemBootRestart, "SystemBoot/Restart"},
+ {SensorType::BootError, "Boot Error"},
+ {SensorType::BaseOSBootInstallationStatus, "BaseOSBoot/InstallationStatus"},
+ {SensorType::OSStopShutdown, "OS Stop/Shutdown"},
+ {SensorType::SlotConnector, "Slot/Connector"},
+ {SensorType::SystemACPIPowerState, "System ACPI PowerState"},
+ {SensorType::Watchdog, "Watchdog"},
+ {SensorType::PlatformAlert, "Platform Alert"},
+ {SensorType::EntityPresence, "Entity Presence"},
+ {SensorType::MonitorASICIC, "Monitor ASIC/IC"},
+ {SensorType::LAN, "LAN"},
+ {SensorType::ManagementSubsystemHealth, "Management Subsystem Health"},
+ {SensorType::Battery, "Battery"},
+ {SensorType::SessionAudit, "Session Audit"},
+ {SensorType::VersionChange, "Version Change"},
+ {SensorType::FRUState, "FRUState"},
+ {SensorType::OEM, "OEM"},
+});
+
NLOHMANN_JSON_SERIALIZE_ENUM(LogDiagnosticDataTypes, {
{LogDiagnosticDataTypes::Invalid, "Invalid"},
{LogDiagnosticDataTypes::Manager, "Manager"},
diff --git a/redfish-core/include/generated/enums/processor.hpp b/redfish-core/include/generated/enums/processor.hpp
index 9be5214..60e2d5f4 100644
--- a/redfish-core/include/generated/enums/processor.hpp
+++ b/redfish-core/include/generated/enums/processor.hpp
@@ -20,6 +20,32 @@
OEM,
};
+enum class ProcessorArchitecture{
+ Invalid,
+ x86,
+ IA64,
+ ARM,
+ MIPS,
+ Power,
+ RISCV,
+ OEM,
+};
+
+enum class InstructionSet{
+ Invalid,
+ x86,
+ x8664,
+ IA64,
+ ARMA32,
+ ARMA64,
+ MIPS32,
+ MIPS64,
+ PowerISA,
+ RV32,
+ RV64,
+ OEM,
+};
+
enum class ProcessorMemoryType{
Invalid,
Cache,
@@ -106,6 +132,32 @@
{ProcessorType::OEM, "OEM"},
});
+NLOHMANN_JSON_SERIALIZE_ENUM(ProcessorArchitecture, {
+ {ProcessorArchitecture::Invalid, "Invalid"},
+ {ProcessorArchitecture::x86, "x86"},
+ {ProcessorArchitecture::IA64, "IA-64"},
+ {ProcessorArchitecture::ARM, "ARM"},
+ {ProcessorArchitecture::MIPS, "MIPS"},
+ {ProcessorArchitecture::Power, "Power"},
+ {ProcessorArchitecture::RISCV, "RISC-V"},
+ {ProcessorArchitecture::OEM, "OEM"},
+});
+
+NLOHMANN_JSON_SERIALIZE_ENUM(InstructionSet, {
+ {InstructionSet::Invalid, "Invalid"},
+ {InstructionSet::x86, "x86"},
+ {InstructionSet::x8664, "x86-64"},
+ {InstructionSet::IA64, "IA-64"},
+ {InstructionSet::ARMA32, "ARM-A32"},
+ {InstructionSet::ARMA64, "ARM-A64"},
+ {InstructionSet::MIPS32, "MIPS32"},
+ {InstructionSet::MIPS64, "MIPS64"},
+ {InstructionSet::PowerISA, "PowerISA"},
+ {InstructionSet::RV32, "RV32"},
+ {InstructionSet::RV64, "RV64"},
+ {InstructionSet::OEM, "OEM"},
+});
+
NLOHMANN_JSON_SERIALIZE_ENUM(ProcessorMemoryType, {
{ProcessorMemoryType::Invalid, "Invalid"},
{ProcessorMemoryType::Cache, "Cache"},
diff --git a/redfish-core/include/generated/enums/redundancy.hpp b/redfish-core/include/generated/enums/redundancy.hpp
index ed31f30..5dbf358 100644
--- a/redfish-core/include/generated/enums/redundancy.hpp
+++ b/redfish-core/include/generated/enums/redundancy.hpp
@@ -7,6 +7,15 @@
{
// clang-format off
+enum class RedundancyMode{
+ Invalid,
+ Failover,
+ Nm,
+ Sharing,
+ Sparing,
+ NotRedundant,
+};
+
enum class RedundancyType{
Invalid,
Failover,
@@ -16,6 +25,15 @@
NotRedundant,
};
+NLOHMANN_JSON_SERIALIZE_ENUM(RedundancyMode, {
+ {RedundancyMode::Invalid, "Invalid"},
+ {RedundancyMode::Failover, "Failover"},
+ {RedundancyMode::Nm, "N+m"},
+ {RedundancyMode::Sharing, "Sharing"},
+ {RedundancyMode::Sparing, "Sparing"},
+ {RedundancyMode::NotRedundant, "NotRedundant"},
+});
+
NLOHMANN_JSON_SERIALIZE_ENUM(RedundancyType, {
{RedundancyType::Invalid, "Invalid"},
{RedundancyType::Failover, "Failover"},
diff --git a/redfish-core/include/generated/enums/resource.hpp b/redfish-core/include/generated/enums/resource.hpp
index 45c1afa..f13da08 100644
--- a/redfish-core/include/generated/enums/resource.hpp
+++ b/redfish-core/include/generated/enums/resource.hpp
@@ -7,6 +7,22 @@
{
// clang-format off
+enum class Id{
+ Invalid,
+};
+
+enum class Description{
+ Invalid,
+};
+
+enum class Name{
+ Invalid,
+};
+
+enum class UUID{
+ Invalid,
+};
+
enum class State{
Invalid,
Enabled,
@@ -115,6 +131,22 @@
RightToLeft,
};
+NLOHMANN_JSON_SERIALIZE_ENUM(Id, {
+ {Id::Invalid, "Invalid"},
+});
+
+NLOHMANN_JSON_SERIALIZE_ENUM(Description, {
+ {Description::Invalid, "Invalid"},
+});
+
+NLOHMANN_JSON_SERIALIZE_ENUM(Name, {
+ {Name::Invalid, "Invalid"},
+});
+
+NLOHMANN_JSON_SERIALIZE_ENUM(UUID, {
+ {UUID::Invalid, "Invalid"},
+});
+
NLOHMANN_JSON_SERIALIZE_ENUM(State, {
{State::Invalid, "Invalid"},
{State::Enabled, "Enabled"},
diff --git a/redfish-core/include/generated/enums/serial_interface.hpp b/redfish-core/include/generated/enums/serial_interface.hpp
index 11b7bf2..7186b91 100644
--- a/redfish-core/include/generated/enums/serial_interface.hpp
+++ b/redfish-core/include/generated/enums/serial_interface.hpp
@@ -13,6 +13,19 @@
Rs485,
};
+enum class BitRate{
+ Invalid,
+ BitRate1200,
+ BitRate2400,
+ BitRate4800,
+ BitRate9600,
+ BitRate19200,
+ BitRate38400,
+ BitRate57600,
+ BitRate115200,
+ BitRate230400,
+};
+
enum class Parity{
Invalid,
None,
@@ -22,6 +35,20 @@
Space,
};
+enum class DataBits{
+ Invalid,
+ DataBits5,
+ DataBits6,
+ DataBits7,
+ DataBits8,
+};
+
+enum class StopBits{
+ Invalid,
+ StopBits1,
+ StopBits2,
+};
+
enum class FlowControl{
Invalid,
None,
@@ -36,12 +63,38 @@
Digi,
};
+enum class ConnectorType{
+ Invalid,
+ RJ45,
+ RJ11,
+ DB9Female,
+ DB9Male,
+ DB25Female,
+ DB25Male,
+ USB,
+ mUSB,
+ uUSB,
+};
+
NLOHMANN_JSON_SERIALIZE_ENUM(SignalType, {
{SignalType::Invalid, "Invalid"},
{SignalType::Rs232, "Rs232"},
{SignalType::Rs485, "Rs485"},
});
+NLOHMANN_JSON_SERIALIZE_ENUM(BitRate, {
+ {BitRate::Invalid, "Invalid"},
+ {BitRate::BitRate1200, "1200"},
+ {BitRate::BitRate2400, "2400"},
+ {BitRate::BitRate4800, "4800"},
+ {BitRate::BitRate9600, "9600"},
+ {BitRate::BitRate19200, "19200"},
+ {BitRate::BitRate38400, "38400"},
+ {BitRate::BitRate57600, "57600"},
+ {BitRate::BitRate115200, "115200"},
+ {BitRate::BitRate230400, "230400"},
+});
+
NLOHMANN_JSON_SERIALIZE_ENUM(Parity, {
{Parity::Invalid, "Invalid"},
{Parity::None, "None"},
@@ -51,6 +104,20 @@
{Parity::Space, "Space"},
});
+NLOHMANN_JSON_SERIALIZE_ENUM(DataBits, {
+ {DataBits::Invalid, "Invalid"},
+ {DataBits::DataBits5, "5"},
+ {DataBits::DataBits6, "6"},
+ {DataBits::DataBits7, "7"},
+ {DataBits::DataBits8, "8"},
+});
+
+NLOHMANN_JSON_SERIALIZE_ENUM(StopBits, {
+ {StopBits::Invalid, "Invalid"},
+ {StopBits::StopBits1, "1"},
+ {StopBits::StopBits2, "2"},
+});
+
NLOHMANN_JSON_SERIALIZE_ENUM(FlowControl, {
{FlowControl::Invalid, "Invalid"},
{FlowControl::None, "None"},
@@ -65,5 +132,18 @@
{PinOut::Digi, "Digi"},
});
+NLOHMANN_JSON_SERIALIZE_ENUM(ConnectorType, {
+ {ConnectorType::Invalid, "Invalid"},
+ {ConnectorType::RJ45, "RJ45"},
+ {ConnectorType::RJ11, "RJ11"},
+ {ConnectorType::DB9Female, "DB9 Female"},
+ {ConnectorType::DB9Male, "DB9 Male"},
+ {ConnectorType::DB25Female, "DB25 Female"},
+ {ConnectorType::DB25Male, "DB25 Male"},
+ {ConnectorType::USB, "USB"},
+ {ConnectorType::mUSB, "mUSB"},
+ {ConnectorType::uUSB, "uUSB"},
+});
+
}
// clang-format on
diff --git a/redfish-core/include/generated/enums/v_lan_network_interface.hpp b/redfish-core/include/generated/enums/v_lan_network_interface.hpp
new file mode 100644
index 0000000..07a178f
--- /dev/null
+++ b/redfish-core/include/generated/enums/v_lan_network_interface.hpp
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright OpenBMC Authors
+#pragma once
+#include <nlohmann/json.hpp>
+
+namespace v_lan_network_interface
+{
+// clang-format off
+
+enum class VLANId{
+ Invalid,
+};
+
+enum class VLANPriority{
+ Invalid,
+};
+
+NLOHMANN_JSON_SERIALIZE_ENUM(VLANId, {
+ {VLANId::Invalid, "Invalid"},
+});
+
+NLOHMANN_JSON_SERIALIZE_ENUM(VLANPriority, {
+ {VLANPriority::Invalid, "Invalid"},
+});
+
+}
+// clang-format on
diff --git a/scripts/generate_schema_enums.py b/scripts/generate_schema_enums.py
index 44dcde6..4f79f30 100755
--- a/scripts/generate_schema_enums.py
+++ b/scripts/generate_schema_enums.py
@@ -41,6 +41,14 @@
for member in schema_element.findall(EDM + "Member"):
enums.append(member.attrib["Name"])
EntityTypes.append(Enum(name, enums, namespace, filename))
+ if schema_element.tag == EDM + "TypeDefinition":
+ enums = []
+ for annotation in schema_element:
+ for collection in annotation:
+ for record in collection.findall(EDM + "Record"):
+ for member in record.findall(EDM + "PropertyValue"):
+ enums.append(member.attrib["String"])
+ EntityTypes.append(Enum(name, enums, namespace, filename))
return EntityTypes
@@ -86,8 +94,13 @@
values.insert(0, "Invalid")
for value in values:
- redfish_defs_file.write(" {},\n".format(value))
+ # If the value is numeric, prefix it with the enum name
+ if value.isdigit():
+ enum_value = f"{element.name}{value}"
+ else:
+ enum_value = re.sub(r"[^0-9_a-zA-Z]", "", value)
+ redfish_defs_file.write(" {},\n".format(enum_value))
redfish_defs_file.write("};\n\n")
for element in enum_list:
@@ -102,8 +115,15 @@
"NLOHMANN_JSON_SERIALIZE_ENUM({}, {{\n".format(element.name)
)
for value in values:
+ # If the value is numeric, prefix it with the enum name
+ if value.isdigit():
+ enum_value = f"{element.name}{value}"
+ else:
+ enum_value = re.sub(r"[^0-9_a-zA-Z]", "", value)
redfish_defs_file.write(
- ' {{{}::{}, "{}"}},\n'.format(element.name, value, value)
+ ' {{{}::{}, "{}"}},\n'.format(
+ element.name, enum_value, value
+ )
)
redfish_defs_file.write("});\n\n")