diff options
author | Ed Tanous <edtanous@google.com> | 2022-09-22 02:30:48 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-11-07 22:38:47 +0300 |
commit | e9f716722249d776b88e28bec0f2b2d9fa60c4fa (patch) | |
tree | 493bef4ddc081c1897a5aef0fe0629799b7540ef /redfish-core/lib | |
parent | 6c7d53a54ac436b4e9a18ec59b9e3833ad16c6a5 (diff) | |
download | bmcweb-e9f716722249d776b88e28bec0f2b2d9fa60c4fa.tar.xz |
Implement links and HEAD for NetworkProtocol
Along the lines of changes we've made elsewhere, add Links, and a HEAD
handler for bmc NetworkProcotol instances.
Tested:
```
curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/JsonSchemas/NetworkProtocol/NetworkProtocol.json
```
Returns a links header as part of the response.
Adding -X HEAD to the curl request results in the same header being
included.
Redfish service validator passes.
Redfish PROTOCOL VALIDATOR PASSES ! ! ! ! ! with zero failures.
Summary - PASS: 392, WARN: 0, FAIL: 0, NOT_TESTED: 32
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ib96f7c8d5d8d960000a1bb77065fc06d2829e4b8
Diffstat (limited to 'redfish-core/lib')
-rw-r--r-- | redfish-core/lib/network_protocol.hpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp index f99cfd3627..9d43bf4126 100644 --- a/redfish-core/lib/network_protocol.hpp +++ b/redfish-core/lib/network_protocol.hpp @@ -113,6 +113,9 @@ void getEthernetIfaceData(CallbackFunc&& callback) inline void getNetworkData(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const crow::Request& req) { + asyncResp->res.addHeader( + boost::beast::http::field::link, + "</redfish/v1/JsonSchemas/ManagerNetworkProtocol/NetworkProtocol.json>; rel=describedby"); asyncResp->res.jsonValue["@odata.type"] = "#ManagerNetworkProtocol.v1_5_0.ManagerNetworkProtocol"; asyncResp->res.jsonValue["@odata.id"] = @@ -465,6 +468,19 @@ inline std::string encodeServiceObjectPath(const std::string& serviceName) return objPath.str; } +void handleBmcNetworkProtocolHead( + crow::App& app, const crow::Request& req, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) +{ + if (!redfish::setUpRedfishRoute(app, req, asyncResp)) + { + return; + } + asyncResp->res.addHeader( + boost::beast::http::field::link, + "</redfish/v1/JsonSchemas/ManagerNetworkProtocol/ManagerNetworkProtocol.json>; rel=describedby"); +} + inline void requestRoutesNetworkProtocol(App& app) { BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/NetworkProtocol/") @@ -538,6 +554,11 @@ inline void requestRoutesNetworkProtocol(App& app) }); BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/NetworkProtocol/") + .privileges(redfish::privileges::headManagerNetworkProtocol) + .methods(boost::beast::http::verb::head)( + std::bind_front(handleBmcNetworkProtocolHead, std::ref(app))); + + BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/NetworkProtocol/") .privileges(redfish::privileges::getManagerNetworkProtocol) .methods(boost::beast::http::verb::get)( [&app](const crow::Request& req, |