Skip to content

Commit 0db2195

Browse files
authored
Merge pull request #565 from Lakshmi-y/fabric_adapters
Fabric adapters
2 parents e6ebbbd + 139fd23 commit 0db2195

16 files changed

+424
-39
lines changed

include/dbus_utility.hpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ inline void checkDbusPathExists(const std::string& path, Callback&& callback)
145145
}
146146

147147
inline void
148-
getSubTree(const std::string& path, std::span<std::string> interfaces,
148+
getSubTree(const std::string& path, int32_t depth,
149+
std::span<const std::string_view> interfaces,
149150
std::function<void(const boost::system::error_code&,
150151
const MapperGetSubTreeResponse&)>&& callback)
151152
{
@@ -155,11 +156,13 @@ inline void
155156
const MapperGetSubTreeResponse& subtree) { callback(ec, subtree); },
156157
"xyz.openbmc_project.ObjectMapper",
157158
"/xyz/openbmc_project/object_mapper",
158-
"xyz.openbmc_project.ObjectMapper", "GetSubTree", path, 0, interfaces);
159+
"xyz.openbmc_project.ObjectMapper", "GetSubTree", path, depth,
160+
interfaces);
159161
}
160162

161163
inline void getSubTreePaths(
162-
const std::string& path, std::span<std::string> interfaces,
164+
const std::string& path, int32_t depth,
165+
std::span<const std::string_view> interfaces,
163166
std::function<void(const boost::system::error_code&,
164167
const MapperGetSubTreePathsResponse&)>&& callback)
165168
{
@@ -171,7 +174,7 @@ inline void getSubTreePaths(
171174
},
172175
"xyz.openbmc_project.ObjectMapper",
173176
"/xyz/openbmc_project/object_mapper",
174-
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", path, 0,
177+
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", path, depth,
175178
interfaces);
176179
}
177180

include/google/google_service_root.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ inline void handleRootOfTrustCollectionGet(
3737
asyncResp->res.jsonValue["@odata.id"] = "/google/v1/RootOfTrustCollection";
3838
asyncResp->res.jsonValue["@odata.type"] =
3939
"#RootOfTrustCollection.RootOfTrustCollection";
40+
constexpr std::array<std::string_view, 1> interfaces{
41+
"xyz.openbmc_project.Control.Hoth"};
4042
redfish::collection_util::getCollectionMembers(
4143
asyncResp, boost::urls::url("/google/v1/RootOfTrustCollection"),
42-
{"xyz.openbmc_project.Control.Hoth"}, "/xyz/openbmc_project");
44+
interfaces);
4345
}
4446

4547
// Helper struct to identify a resolved D-Bus object interface

redfish-core/include/redfish.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "environment_metrics.hpp"
2525
#include "ethernet.hpp"
2626
#include "event_service.hpp"
27+
#include "fabric_adapters.hpp"
2728
#include "fan.hpp"
2829
#include "hypervisor_system.hpp"
2930
#include "license_service.hpp"
@@ -243,6 +244,8 @@ class RedfishService
243244
requestRoutesEventService(app);
244245
requestRoutesEventDestinationCollection(app);
245246
requestRoutesEventDestination(app);
247+
requestRoutesFabricAdapters(app);
248+
requestRoutesFabricAdapterCollection(app);
246249
requestRoutesSubmitTestEvent(app);
247250

248251
hypervisor::requestRoutesHypervisorSystems(app);

redfish-core/include/utils/collection.hpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
#pragma once
22

3-
#include <human_sort.hpp>
3+
#include "async_resp.hpp"
4+
#include "dbus_utility.hpp"
5+
#include "error_messages.hpp"
6+
#include "http/utility.hpp"
7+
#include "human_sort.hpp"
48

9+
#include <boost/url/url.hpp>
10+
#include <nlohmann/json.hpp>
11+
12+
#include <span>
513
#include <string>
14+
#include <string_view>
615
#include <vector>
716

817
namespace redfish
@@ -25,14 +34,15 @@ namespace collection_util
2534
inline void
2635
getCollectionMembers(std::shared_ptr<bmcweb::AsyncResp> aResp,
2736
const boost::urls::url& collectionPath,
28-
const std::vector<const char*>& interfaces,
37+
std::span<const std::string_view> interfaces,
2938
const char* subtree = "/xyz/openbmc_project/inventory")
3039
{
3140
BMCWEB_LOG_DEBUG << "Get collection members for: "
3241
<< collectionPath.buffer();
33-
crow::connections::systemBus->async_method_call(
42+
dbus::utility::getSubTreePaths(
43+
subtree, 0, interfaces,
3444
[collectionPath, aResp{std::move(aResp)}](
35-
const boost::system::error_code ec,
45+
const boost::system::error_code& ec,
3646
const dbus::utility::MapperGetSubTreePathsResponse& objects) {
3747
if (ec == boost::system::errc::io_error)
3848
{
@@ -73,11 +83,7 @@ inline void
7383
members.push_back(std::move(member));
7484
}
7585
aResp->res.jsonValue["[email protected]"] = members.size();
76-
},
77-
"xyz.openbmc_project.ObjectMapper",
78-
"/xyz/openbmc_project/object_mapper",
79-
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", subtree, 0,
80-
interfaces);
86+
});
8187
}
8288

8389
} // namespace collection_util

redfish-core/include/utils/systems_utils.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ void getValidSystemsPath(
6262
};
6363

6464
// Get the Systems Collection
65-
std::vector<std::string> interfaces = {
65+
constexpr std::array<std::string_view, 1> interfaces = {
6666
"xyz.openbmc_project.Inventory.Item.System"};
67-
dbus::utility::getSubTreePaths("/xyz/openbmc_project/inventory", interfaces,
68-
std::move(respHandler));
67+
dbus::utility::getSubTreePaths("/xyz/openbmc_project/inventory", 0,
68+
interfaces, std::move(respHandler));
6969
BMCWEB_LOG_DEBUG << "checkSystemsId exit";
7070
}
7171

redfish-core/lib/cable.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,10 @@ inline void requestRoutesCableCollection(App& app)
226226
asyncResp->res.jsonValue["Name"] = "Cable Collection";
227227
asyncResp->res.jsonValue["Description"] = "Collection of Cable Entries";
228228

229+
constexpr std::array<std::string_view, 1> interfaces{
230+
"xyz.openbmc_project.Inventory.Item.Cable"};
229231
collection_util::getCollectionMembers(
230-
asyncResp, boost::urls::url("/redfish/v1/Cables"),
231-
{"xyz.openbmc_project.Inventory.Item.Cable"});
232+
asyncResp, boost::urls::url("/redfish/v1/Cables"), interfaces);
232233
});
233234
}
234235

redfish-core/lib/chassis.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,10 @@ inline void handleChassisCollectionGet(
147147
asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Chassis";
148148
asyncResp->res.jsonValue["Name"] = "Chassis Collection";
149149

150+
constexpr std::array<std::string_view, 1> interfaces{
151+
"xyz.openbmc_project.Inventory.Item.Chassis"};
150152
collection_util::getCollectionMembers(
151-
asyncResp, boost::urls::url("/redfish/v1/Chassis"),
152-
{"xyz.openbmc_project.Inventory.Item.Chassis"});
153+
asyncResp, boost::urls::url("/redfish/v1/Chassis"), interfaces);
153154
}
154155

155156
/**

0 commit comments

Comments
 (0)