diff options
author | Lukasz Kazmierczak <lukasz.kazmierczak@intel.com> | 2021-08-02 12:08:53 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2021-12-17 20:52:17 +0300 |
commit | 07148cf2fcaf7c255fe6a21acd4e7b2134fb1d92 (patch) | |
tree | d21a0d232852f9c14d581b5bf963e004b2c8f228 | |
parent | f451bec02f7ec14b18c5df7065aff90e67637107 (diff) | |
download | bmcweb-07148cf2fcaf7c255fe6a21acd4e7b2134fb1d92.tar.xz |
Add GET method for TriggerCollection
Added GET method for retrieving list of Triggers from Telemetry service
Tested:
- Added single Trigger and requested result from bmcweb via
/redfish/v1/TelemetryService/Triggers
- Added multiple Triggers numeric and discrete, and requested results
from bmcweb via /redfish/v1/TelemetryService/Triggers
- Verified uri /redfish/v1/TelemetryService/Triggers by using
Redfish-Service-Validator with no Triggers/empty Collection (passed)
Signed-off-by: Lukasz Kazmierczak <lukasz.kazmierczak@intel.com>
Change-Id: Ide00eb44901ea1b97b80fc5c5ddfd97e393d4a04
-rw-r--r-- | Redfish.md | 6 | ||||
-rw-r--r-- | redfish-core/include/redfish.hpp | 2 | ||||
-rw-r--r-- | redfish-core/include/utils/telemetry_utils.hpp | 1 | ||||
-rw-r--r-- | redfish-core/lib/telemetry_service.hpp | 2 | ||||
-rw-r--r-- | redfish-core/lib/trigger.hpp | 39 | ||||
-rwxr-xr-x | scripts/update_schemas.py | 1 | ||||
-rw-r--r-- | static/redfish/v1/$metadata/index.xml | 3 | ||||
-rw-r--r-- | static/redfish/v1/schema/TriggersCollection_v1.xml | 70 |
8 files changed, 123 insertions, 1 deletions
diff --git a/Redfish.md b/Redfish.md index 4fc377651f..f96cbbf42f 100644 --- a/Redfish.md +++ b/Redfish.md @@ -689,6 +689,7 @@ the other. - MetricReports - MinCollectionInterval - Status +- Triggers #### /redfish/v1/TelemetryService/MetricReportDefinitions/ ##### MetricReportDefinitionCollection @@ -700,6 +701,11 @@ the other. - Members - Members@odata.count +#### /redfish/v1/TelemetryService/Triggers/ +##### TriggersCollection +- Members +- Members@odata.count + #### /redfish/v1/UpdateService/ ##### UpdateService - Actions diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp index 247933232e..e56996dad4 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp @@ -41,6 +41,7 @@ #include "../lib/task.hpp" #include "../lib/telemetry_service.hpp" #include "../lib/thermal.hpp" +#include "../lib/trigger.hpp" #include "../lib/update_service.hpp" #include "../lib/virtual_media.hpp" @@ -206,6 +207,7 @@ class RedfishService requestRoutesMetricReportDefinition(app); requestRoutesMetricReportCollection(app); requestRoutesMetricReport(app); + requestRoutesTriggerCollection(app); } }; diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp index 76ffe96046..c16cc89073 100644 --- a/redfish-core/include/utils/telemetry_utils.hpp +++ b/redfish-core/include/utils/telemetry_utils.hpp @@ -7,7 +7,6 @@ namespace redfish namespace telemetry { - constexpr const char* service = "xyz.openbmc_project.Telemetry"; constexpr const char* reportInterface = "xyz.openbmc_project.Telemetry.Report"; constexpr const char* metricReportDefinitionUri = diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp index 8ecc5916ca..b79a5cd291 100644 --- a/redfish-core/lib/telemetry_service.hpp +++ b/redfish-core/lib/telemetry_service.hpp @@ -23,6 +23,8 @@ inline void handleTelemetryServiceGet( "/redfish/v1/TelemetryService/MetricReportDefinitions"; asyncResp->res.jsonValue["MetricReports"]["@odata.id"] = "/redfish/v1/TelemetryService/MetricReports"; + asyncResp->res.jsonValue["Triggers"]["@odata.id"] = + "/redfish/v1/TelemetryService/Triggers"; crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code ec, diff --git a/redfish-core/lib/trigger.hpp b/redfish-core/lib/trigger.hpp new file mode 100644 index 0000000000..bbe0887049 --- /dev/null +++ b/redfish-core/lib/trigger.hpp @@ -0,0 +1,39 @@ +#pragma once + +#include "utils/collection.hpp" +#include "utils/telemetry_utils.hpp" + +#include <app.hpp> +#include <registries/privilege_registry.hpp> + +namespace redfish +{ +namespace telemetry +{ +constexpr const char* triggerInterface = + "xyz.openbmc_project.Telemetry.Trigger"; +constexpr const char* triggerUri = "/redfish/v1/TelemetryService/Triggers"; + +} // namespace telemetry + +inline void requestRoutesTriggerCollection(App& app) +{ + BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/Triggers/") + .privileges(redfish::privileges::getTriggersCollection) + .methods(boost::beast::http::verb::get)( + [](const crow::Request&, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { + asyncResp->res.jsonValue["@odata.type"] = + "#TriggersCollection.TriggersCollection"; + asyncResp->res.jsonValue["@odata.id"] = + "/redfish/v1/TelemetryService/Triggers"; + asyncResp->res.jsonValue["Name"] = "Triggers Collection"; + const std::vector<const char*> interfaces{ + telemetry::triggerInterface}; + collection_util::getCollectionMembers( + asyncResp, telemetry::triggerUri, interfaces, + "/xyz/openbmc_project/Telemetry/Triggers/TelemetryService"); + }); +} + +} // namespace redfish diff --git a/scripts/update_schemas.py b/scripts/update_schemas.py index 903afb7b5c..63b441eaa3 100755 --- a/scripts/update_schemas.py +++ b/scripts/update_schemas.py @@ -93,6 +93,7 @@ include_list = [ 'TaskService', 'TelemetryService', 'Thermal', + 'TriggersCollection', 'UpdateService', 'VLanNetworkInterfaceCollection', 'VLanNetworkInterface', diff --git a/static/redfish/v1/$metadata/index.xml b/static/redfish/v1/$metadata/index.xml index f9365911e6..4750602ca2 100644 --- a/static/redfish/v1/$metadata/index.xml +++ b/static/redfish/v1/$metadata/index.xml @@ -2344,6 +2344,9 @@ <edmx:Include Namespace="Thermal.v1_7_0"/> <edmx:Include Namespace="Thermal.v1_7_1"/> </edmx:Reference> + <edmx:Reference Uri="/redfish/v1/schema/TriggersCollection_v1.xml"> + <edmx:Include Namespace="TriggersCollection"/> + </edmx:Reference> <edmx:Reference Uri="/redfish/v1/schema/UpdateService_v1.xml"> <edmx:Include Namespace="UpdateService"/> <edmx:Include Namespace="UpdateService.v1_0_0"/> diff --git a/static/redfish/v1/schema/TriggersCollection_v1.xml b/static/redfish/v1/schema/TriggersCollection_v1.xml new file mode 100644 index 0000000000..399bebde52 --- /dev/null +++ b/static/redfish/v1/schema/TriggersCollection_v1.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!----> +<!--################################################################################ --> +<!--# Redfish Schema: TriggerSetCollection --> +<!--# --> +<!--# For a detailed change log, see the README file contained in the DSP8010 bundle, --> +<!--# available at http://www.dmtf.org/standards/redfish --> +<!--# Copyright 2014-2021 DMTF. --> +<!--# For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright --> +<!--################################################################################ --> +<!----> +<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0"> + + <edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/errata03/csd01/complete/vocabularies/Org.OData.Core.V1.xml"> + <edmx:Include Namespace="Org.OData.Core.V1" Alias="OData"/> + </edmx:Reference> + <edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/errata03/csd01/complete/vocabularies/Org.OData.Capabilities.V1.xml"> + <edmx:Include Namespace="Org.OData.Capabilities.V1" Alias="Capabilities"/> + </edmx:Reference> + <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Resource_v1.xml"> + <edmx:Include Namespace="Resource.v1_0_0"/> + </edmx:Reference> + <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/RedfishExtensions_v1.xml"> + <edmx:Include Namespace="RedfishExtensions.v1_0_0" Alias="Redfish"/> + </edmx:Reference> + <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Triggers_v1.xml"> + <edmx:Include Namespace="Triggers"/> + </edmx:Reference> + + <edmx:DataServices> + + <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="TriggersCollection"> + <Annotation Term="Redfish.OwningEntity" String="DMTF"/> + + <EntityType Name="TriggersCollection" BaseType="Resource.v1_0_0.ResourceCollection"> + <Annotation Term="OData.Description" String="The collection of Triggers resource instances."/> + <Annotation Term="OData.LongDescription" String="This resource shall represent a resource collection of Triggers instances for a Redfish implementation."/> + <Annotation Term="Capabilities.InsertRestrictions"> + <Record> + <PropertyValue Property="Insertable" Bool="true"/> + <Annotation Term="OData.Description" String="Create triggers through a POST to the trigger collection."/> + </Record> + </Annotation> + <Annotation Term="Capabilities.UpdateRestrictions"> + <Record> + <PropertyValue Property="Updatable" Bool="false"/> + </Record> + </Annotation> + <Annotation Term="Capabilities.DeleteRestrictions"> + <Record> + <PropertyValue Property="Deletable" Bool="false"/> + </Record> + </Annotation> + <Annotation Term="Redfish.Uris"> + <Collection> + <String>/redfish/v1/TelemetryService/Triggers</String> + </Collection> + </Annotation> + <NavigationProperty Name="Members" Type="Collection(Triggers.Triggers)"> + <Annotation Term="OData.Permissions" EnumMember="OData.Permission/Read"/> + <Annotation Term="OData.Description" String="The members of this collection."/> + <Annotation Term="OData.LongDescription" String="This property shall contain an array of links to the members of this collection."/> + <Annotation Term="OData.AutoExpandReferences"/> + <Annotation Term="Redfish.Required"/> + </NavigationProperty> + </EntityType> + + </Schema> + </edmx:DataServices> +</edmx:Edmx> |