Aggregation: Generate collections from schema
In aggregation we need to account for when a satellite BMC supports a
resource collection that the aggregating BMC does not. We need to
add links in responses from upstream resources to indicate that these
satellite only resources exist. These top level collections do not
always have the location format of /redfish/v1/<collection_id>. We
determine all of those from the schema rather than hardcoding a few
choice exceptions that do not fit that format such as
/redfish/v1/UpdateService/FirmwareInventory.
This patch is the first step in accomplishing this. We parse all
xml schema files in order to determine what are the top level
collection URIs. For URIs that are upstream from top level collections
we'll be able to derive what URIs could appear in the response which
are also on the same path to a top level collection.
The xml files for resources that aren't currently supported by bmcweb
are ignored when creating the schema index and later deleted once the
above parsing completes.
Later patches will use this information to make sure that we are
properly handling all schema defined top level collections.
Tested:
Compiles with aggregation enabled
Signed-off-by: Carson Labrado <clabrado@google.com>
Change-Id: Icff825f4e4e9d84c96254561350f82839abdc074
diff --git a/redfish-core/include/aggregation_utils.hpp b/redfish-core/include/aggregation_utils.hpp
new file mode 100644
index 0000000..bb1782f
--- /dev/null
+++ b/redfish-core/include/aggregation_utils.hpp
@@ -0,0 +1,66 @@
+#pragma once
+/****************************************************************
+ * READ THIS WARNING FIRST
+ * This is an auto-generated header which contains definitions
+ * for Redfish DMTF defined schemas.
+ * DO NOT modify this registry outside of running the
+ * update_schemas.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.
+ ***************************************************************/
+// clang-format off
+#include <array>
+#include <string_view>
+
+namespace redfish
+{
+// Note that each URI actually begins with "/redfish/v1/"
+// They've been omitted to save space and reduce search time
+constexpr std::array<std::string_view, 44> topCollections{
+ "AggregationService/Aggregates",
+ "AggregationService/AggregationSources",
+ "AggregationService/ConnectionMethods",
+ "Cables",
+ "Chassis",
+ "ComponentIntegrity",
+ "CompositionService/ActivePool",
+ "CompositionService/CompositionReservations",
+ "CompositionService/FreePool",
+ "CompositionService/ResourceBlocks",
+ "CompositionService/ResourceZones",
+ "EventService/Subscriptions",
+ "Fabrics",
+ "Facilities",
+ "JobService/Jobs",
+ "JobService/Log/Entries",
+ "KeyService/NVMeoFKeyPolicies",
+ "KeyService/NVMeoFSecrets",
+ "LicenseService/Licenses",
+ "Managers",
+ "NVMeDomains",
+ "PowerEquipment/ElectricalBuses",
+ "PowerEquipment/FloorPDUs",
+ "PowerEquipment/PowerShelves",
+ "PowerEquipment/RackPDUs",
+ "PowerEquipment/Switchgear",
+ "PowerEquipment/TransferSwitches",
+ "RegisteredClients",
+ "Registries",
+ "ResourceBlocks",
+ "Storage",
+ "StorageServices",
+ "StorageSystems",
+ "Systems",
+ "TaskService/Tasks",
+ "TelemetryService/LogService/Entries",
+ "TelemetryService/MetricDefinitions",
+ "TelemetryService/MetricReportDefinitions",
+ "TelemetryService/MetricReports",
+ "TelemetryService/Triggers",
+ "UpdateService/ClientCertificates",
+ "UpdateService/FirmwareInventory",
+ "UpdateService/RemoteServerCertificates",
+ "UpdateService/SoftwareInventory",
+};
+} // namespace redfish
diff --git a/redfish-core/include/redfish_aggregator.hpp b/redfish-core/include/redfish_aggregator.hpp
index 7778482..293dad2 100644
--- a/redfish-core/include/redfish_aggregator.hpp
+++ b/redfish-core/include/redfish_aggregator.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <aggregation_utils.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <dbus_utility.hpp>
#include <error_messages.hpp>
@@ -163,6 +164,12 @@
RedfishAggregator()
{
+ // TODO: Remove in future patches, this is here to prevent compiler
+ // warnings and get an accurate idea of the increase in the size of the
+ // binary.
+ BMCWEB_LOG_DEBUG << "There are " << topCollections.size()
+ << " top level collections:";
+
getSatelliteConfigs(constructorCallback);
// Setup the retry policy to be used by Redfish Aggregation