Generate update registry
Generate the update registry, needed to return correct error messages
from update service.
Change-Id: Ifaa699cad8531070aea47d2476c1834df7c61e08
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/meson.build b/meson.build
index 1e42e92..8fd6a50 100644
--- a/meson.build
+++ b/meson.build
@@ -396,6 +396,7 @@
'redfish-core/src/resource_messages.cpp',
'redfish-core/src/subscription.cpp',
'redfish-core/src/task_messages.cpp',
+ 'redfish-core/src/update_messages.cpp',
'redfish-core/src/utils/dbus_utils.cpp',
'redfish-core/src/utils/json_utils.cpp',
'redfish-core/src/utils/time_utils.cpp',
diff --git a/redfish-core/include/registries/update_message_registry.hpp b/redfish-core/include/registries/update_message_registry.hpp
index 578b77a..5f4043e 100644
--- a/redfish-core/include/registries/update_message_registry.hpp
+++ b/redfish-core/include/registries/update_message_registry.hpp
@@ -22,11 +22,11 @@
struct Update
{
static constexpr Header header = {
- "Copyright 2014-2023 DMTF. All rights reserved.",
+ "Copyright 2014-2025 DMTF. All rights reserved.",
"#MessageRegistry.v1_6_2.MessageRegistry",
1,
- 0,
2,
+ 0,
"Update Message Registry",
"en",
"This registry defines the update status and error messages.",
@@ -35,7 +35,7 @@
};
static constexpr const char* url =
- "https://redfish.dmtf.org/registries/Update.1.0.2.json";
+ "https://redfish.dmtf.org/registries/Update.1.2.0.json";
static constexpr std::array registry =
{
@@ -128,6 +128,18 @@
"None.",
}},
MessageEntry{
+ "NoTargetsDetermined",
+ {
+ "Indicates that no target resource or device for an image was determined for update.",
+ "No target device will be updated with image '%1'.",
+ "OK",
+ 1,
+ {
+ "string",
+ },
+ "None.",
+ }},
+ MessageEntry{
"OperationTransitionedToJob",
{
"Indicates that the update operation transitioned to a job for managing the progress of the operation.",
@@ -189,6 +201,45 @@
"None.",
}},
MessageEntry{
+ "UpdateNotApplicable",
+ {
+ "Indicates that the update was not applicable to the resource or device.",
+ "Image '%1' was not applicable to device '%2'.",
+ "Warning",
+ 2,
+ {
+ "string",
+ "string",
+ },
+ "None.",
+ }},
+ MessageEntry{
+ "UpdateSkipped",
+ {
+ "Indicates that an image was applicable to a resource or device, but the update was skipped due to policies in the service.",
+ "Device '%1' skipped the update with image '%2'.",
+ "OK",
+ 2,
+ {
+ "string",
+ "string",
+ },
+ "None.",
+ }},
+ MessageEntry{
+ "UpdateSkippedSameVersion",
+ {
+ "Indicates that a resource or device update was skipped because the same version is already installed.",
+ "Device '%1' skipped the update with image '%2' because the same version is already installed.",
+ "OK",
+ 2,
+ {
+ "string",
+ "string",
+ },
+ "None.",
+ }},
+ MessageEntry{
"UpdateSuccessful",
{
"Indicates that a resource or device was updated.",
@@ -204,7 +255,7 @@
MessageEntry{
"VerificationFailed",
{
- "Indicates that the component failed to verify an image.",
+ "Indicates that the service or component failed to verify an image.",
"Verification of image '%1' at '%2' failed.",
"Critical",
2,
@@ -239,14 +290,18 @@
awaitToActivate = 4,
awaitToUpdate = 5,
installingOnComponent = 6,
- operationTransitionedToJob = 7,
- targetDetermined = 8,
- transferFailed = 9,
- transferringToComponent = 10,
- updateInProgress = 11,
- updateSuccessful = 12,
- verificationFailed = 13,
- verifyingAtComponent = 14,
+ noTargetsDetermined = 7,
+ operationTransitionedToJob = 8,
+ targetDetermined = 9,
+ transferFailed = 10,
+ transferringToComponent = 11,
+ updateInProgress = 12,
+ updateNotApplicable = 13,
+ updateSkipped = 14,
+ updateSkippedSameVersion = 15,
+ updateSuccessful = 16,
+ verificationFailed = 17,
+ verifyingAtComponent = 18,
};
}; // struct update
diff --git a/redfish-core/include/update_messages.hpp b/redfish-core/include/update_messages.hpp
new file mode 100644
index 0000000..c79a208
--- /dev/null
+++ b/redfish-core/include/update_messages.hpp
@@ -0,0 +1,84 @@
+#pragma once
+/****************************************************************
+ * READ THIS WARNING FIRST
+ * This is an auto-generated header which contains definitions
+ * for Redfish DMTF defined messages.
+ * DO NOT modify this registry outside of running the
+ * parse_registries.py script. The definitions contained within
+ * this file are owned by DMTF. Any modifications to these files
+ * should be first pushed to the relevant registry in the DMTF
+ * github organization.
+ ***************************************************************/
+// These generated headers are a superset of what is needed.
+// clang sees them as an error, so ignore
+// NOLINTBEGIN(misc-include-cleaner)
+#include "http_response.hpp"
+
+#include <boost/url/url_view_base.hpp>
+#include <nlohmann/json.hpp>
+
+#include <cstdint>
+#include <source_location>
+#include <string_view>
+// NOLINTEND(misc-include-cleaner)
+
+namespace redfish
+{
+
+namespace messages
+{
+nlohmann::json::object_t targetDetermined(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t allTargetsDetermined();
+
+nlohmann::json::object_t noTargetsDetermined(std::string_view arg1);
+
+nlohmann::json::object_t updateInProgress();
+
+nlohmann::json::object_t transferringToComponent(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t verifyingAtComponent(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t installingOnComponent(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t applyingOnComponent(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t transferFailed(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t verificationFailed(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t applyFailed(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t activateFailed(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t awaitToUpdate(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t awaitToActivate(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t updateSuccessful(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t operationTransitionedToJob(std::string_view arg1);
+
+nlohmann::json::object_t updateSkipped(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t updateSkippedSameVersion(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t updateNotApplicable(std::string_view arg1,
+ std::string_view arg2);
+
+} // namespace messages
+} // namespace redfish
diff --git a/redfish-core/src/update_messages.cpp b/redfish-core/src/update_messages.cpp
new file mode 100644
index 0000000..a11cd6a
--- /dev/null
+++ b/redfish-core/src/update_messages.cpp
@@ -0,0 +1,311 @@
+/****************************************************************
+ * READ THIS WARNING FIRST
+ * This is an auto-generated header which contains definitions
+ * for Redfish DMTF defined messages.
+ * DO NOT modify this registry outside of running the
+ * parse_registries.py script. The definitions contained within
+ * this file are owned by DMTF. Any modifications to these files
+ * should be first pushed to the relevant registry in the DMTF
+ * github organization.
+ ***************************************************************/
+#include "update_messages.hpp"
+
+#include "registries.hpp"
+#include "registries/update_message_registry.hpp"
+
+#include <nlohmann/json.hpp>
+
+#include <array>
+#include <cstddef>
+#include <cstdint>
+#include <span>
+#include <string>
+#include <string_view>
+
+// Clang can't seem to decide whether this header needs to be included or not,
+// and is inconsistent. Include it for now
+// NOLINTNEXTLINE(misc-include-cleaner)
+#include <utility>
+
+namespace redfish
+{
+
+namespace messages
+{
+
+static nlohmann::json::object_t getLog(redfish::registries::Update::Index name,
+ std::span<const std::string_view> args)
+{
+ size_t index = static_cast<size_t>(name);
+ if (index >= redfish::registries::Update::registry.size())
+ {
+ return {};
+ }
+ return getLogFromRegistry(redfish::registries::Update::header,
+ redfish::registries::Update::registry, index,
+ args);
+}
+
+/**
+ * @internal
+ * @brief Formats TargetDetermined message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t targetDetermined(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::targetDetermined,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats AllTargetsDetermined message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t allTargetsDetermined()
+{
+ return getLog(redfish::registries::Update::Index::allTargetsDetermined, {});
+}
+
+/**
+ * @internal
+ * @brief Formats NoTargetsDetermined message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t noTargetsDetermined(std::string_view arg1)
+{
+ return getLog(redfish::registries::Update::Index::noTargetsDetermined,
+ std::to_array({arg1}));
+}
+
+/**
+ * @internal
+ * @brief Formats UpdateInProgress message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t updateInProgress()
+{
+ return getLog(redfish::registries::Update::Index::updateInProgress, {});
+}
+
+/**
+ * @internal
+ * @brief Formats TransferringToComponent message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t transferringToComponent(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::transferringToComponent,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats VerifyingAtComponent message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t verifyingAtComponent(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::verifyingAtComponent,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats InstallingOnComponent message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t installingOnComponent(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::installingOnComponent,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats ApplyingOnComponent message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t applyingOnComponent(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::applyingOnComponent,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats TransferFailed message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t transferFailed(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::transferFailed,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats VerificationFailed message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t verificationFailed(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::verificationFailed,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats ApplyFailed message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t applyFailed(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::applyFailed,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats ActivateFailed message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t activateFailed(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::activateFailed,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats AwaitToUpdate message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t awaitToUpdate(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::awaitToUpdate,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats AwaitToActivate message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t awaitToActivate(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::awaitToActivate,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats UpdateSuccessful message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t updateSuccessful(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::updateSuccessful,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats OperationTransitionedToJob message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t operationTransitionedToJob(std::string_view arg1)
+{
+ return getLog(
+ redfish::registries::Update::Index::operationTransitionedToJob,
+ std::to_array({arg1}));
+}
+
+/**
+ * @internal
+ * @brief Formats UpdateSkipped message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t updateSkipped(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::updateSkipped,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats UpdateSkippedSameVersion message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t updateSkippedSameVersion(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::updateSkippedSameVersion,
+ std::to_array({arg1, arg2}));
+}
+
+/**
+ * @internal
+ * @brief Formats UpdateNotApplicable message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json::object_t updateNotApplicable(std::string_view arg1,
+ std::string_view arg2)
+{
+ return getLog(redfish::registries::Update::Index::updateNotApplicable,
+ std::to_array({arg1, arg2}));
+}
+
+} // namespace messages
+} // namespace redfish
diff --git a/scripts/parse_registries.py b/scripts/parse_registries.py
index 747aac1..8ee9fc9 100755
--- a/scripts/parse_registries.py
+++ b/scripts/parse_registries.py
@@ -711,7 +711,7 @@
("storage_device", "1.2.1"),
("task_event", "1.0.3"),
("telemetry", "1.0.0"),
- ("update", "1.0.2"),
+ ("update", "1.2.0"),
]
)
@@ -770,6 +770,13 @@
"task_event",
"task",
)
+ if "update" in registries_map:
+ create_error_registry(
+ registries_map["update"],
+ "Update",
+ "update",
+ "update",
+ )
if "privilege" in registries:
make_privilege_registry()