summaryrefslogtreecommitdiff
path: root/redfish-core/lib/metric_report.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2021-06-10 03:05:54 +0300
committerEd Tanous <ed@tanous.net>2021-07-08 01:25:09 +0300
commited3982131dcef2b499da36e674d2d21b2289ef29 (patch)
treef6e83bfbf48b44d814b0b52514bb65c663ecea11 /redfish-core/lib/metric_report.hpp
parent3a2d042432168ad1b555e4fc9f13c2ae0d35e0c7 (diff)
downloadbmcweb-ed3982131dcef2b499da36e674d2d21b2289ef29.tar.xz
Automate PrivilegeRegistry to code
This commit attempts to automate the creation of our privileges structures from the redfish privilege registry. It accomplishes this by updating parse_registries.py to also pull down the privilege registry from DMTF. The script then generates privilege_registry.hpp, which include const defines for all the privilege registry entries in the same format that the Privileges struct accepts. This allows new clients to simply reference the variable to these privilege structures, instead of having to manually (ie error pronely) put the privileges in themselves. This commit updates all the routes. For the moment, override and OEM schemas are not considered. Today we don't have any OEM-specific Redfish routes, so the existing ones inherit their parents schema. Overrides have other issues, and are already incorrect as Redfish defines them. Binary size remains unchanged after this patchset. Tested: Ran redfish service validator Ran test case from f9a6708c4c6490257e2eb6a8c04458f500902476 to ensure that the new privileges constructor didn't cause us to regress the brace construction initializer. Checked binary size with: gzip -c $BBPATH/tmp/work/s7106-openbmc-linux-gnueabi/obmc-phosphor-image/1.0-r0/rootfs/usr/bin/bmcweb | wc -c 1244048 (tested on previous patchset) Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ideede3d5b39d50bffe7fe78a0848bdbc22ac387f
Diffstat (limited to 'redfish-core/lib/metric_report.hpp')
-rw-r--r--redfish-core/lib/metric_report.hpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
index 66f4f93744..63c8c19acb 100644
--- a/redfish-core/lib/metric_report.hpp
+++ b/redfish-core/lib/metric_report.hpp
@@ -3,6 +3,7 @@
#include "utils/telemetry_utils.hpp"
#include <app.hpp>
+#include <registries/privilege_registry.hpp>
namespace redfish
{
@@ -63,7 +64,7 @@ inline void fillReport(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
inline void requestRoutesMetricReportCollection(App& app)
{
BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/MetricReports/")
- .privileges({{"Login"}})
+ .privileges(redfish::privileges::getMetricReportCollection)
.methods(boost::beast::http::verb::get)(
[](const crow::Request&,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
@@ -81,7 +82,7 @@ inline void requestRoutesMetricReportCollection(App& app)
inline void requestRoutesMetricReport(App& app)
{
BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/MetricReports/<str>/")
- .privileges({{"Login"}})
+ .privileges(redfish::privileges::getMetricReport)
.methods(boost::beast::http::verb::get)(
[](const crow::Request&,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,