Implement Fabric PortCollection and Port schemas
This implements 2 schemas for FabricAdapters [1][2].
The implementation uses `GetAssociatedSubTreePathsById` &
`GetAssociatedSubTreeById`.
- https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/69999
The association is defined via
- https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/62881.
The backend port examples are also committed via
- https://gerrit.openbmc.org/c/openbmc/openpower-vpd-parser/+/66540
- https://gerrit.openbmc.org/c/openbmc/openpower-vpd-parser/+/70888
- https://gerrit.openbmc.org/c/openbmc/openbmc/+/66541
The current submission only implements the basic properties of Port
(e.g. Id, Name etc) as a foundation of the future additional
properties.
- Location
- LocationIndicatorActive
- Status
One example of Ports is this cable card for the i/o expansion drawers
and modeling the 2 ports on the cable card [3]. These ports have an
identify led, a location code, and a status.
Tested:
- Redfish Validator passes
- perform GET methods like these:
```
curl -k -X GET https://${bmc}/redfish/v1/Systems/system/FabricAdapters/disk_backplane0
{
"@odata.id": "/redfish/v1/Systems/system/FabricAdapters/disk_backplane0",
"@odata.type": "#FabricAdapter.v1_4_0.FabricAdapter",
"Id": "disk_backplane0",
...
"Ports": {
"@odata.id": "/redfish/v1/Systems/system/FabricAdapters/disk_backplane0/Ports"
},
...
}
```
```
curl -k -X GET https://${bmc}/redfish/v1/Systems/system/FabricAdapters/disk_backplane0/Ports
{
"@odata.id": "/redfish/v1/Systems/system/FabricAdapters/disk_backplane0/Ports",
"@odata.type": "#PortCollection.PortCollection",
"Members": [
{
"@odata.id": "/redfish/v1/Systems/system/FabricAdapters/disk_backplane0/Ports/dp0_connector4"
},
{
"@odata.id": "/redfish/v1/Systems/system/FabricAdapters/disk_backplane0/Ports/dp0_connector5"
}
],
"Members@odata.count": 2,
"Name": "Port Collection"
}
```
```
curl -k -X GET https://${bmc}:18080/redfish/v1/Systems/system/FabricAdapters/disk_backplane0/Ports/dp0_connector4
{
"@odata.id": "/redfish/v1/Systems/system/FabricAdapters/disk_backplane0/Ports/dp0_connector4",
"@odata.type": "#Port.v1_7_0.Port",
"Id": "dp0_connector4",
"Name": "dp0_connector4"
}%
```
Also try the invalid port like
```
curl -k -X GET https://${bmc}:18080/redfish/v1/Systems/system/FabricAdapters/io_module1/Ports/INVALID
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The requested resource of type Port named 'INVALID' was not found.",
"MessageArgs": [
"Port",
"INVALID"
],
"MessageId": "Base.1.16.0.ResourceNotFound",
"MessageSeverity": "Critical",
"Resolution": "Provide a valid resource identifier and resubmit the request."
}
],
"code": "Base.1.16.0.ResourceNotFound",
"message": "The requested resource of type Port named 'INVALID' was not found."
}
}%
```
[1] https://redfish.dmtf.org/schemas/v1/PortCollection_v1.xml
[2] https://redfish.dmtf.org/schemas/v1/Port_v1.xml
[3] https://www.ibm.com/docs/en/power10?topic=details-pcie4-cable-adapter-fc-ej24-ccin-6b92
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I8c64c16764e85c0716e264263708b18f897a2c0c
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
diff --git a/redfish-core/src/redfish.cpp b/redfish-core/src/redfish.cpp
index 9162bff..c797251 100644
--- a/redfish-core/src/redfish.cpp
+++ b/redfish-core/src/redfish.cpp
@@ -16,6 +16,7 @@
#include "event_service.hpp"
#include "eventservice_sse.hpp"
#include "fabric_adapters.hpp"
+#include "fabric_ports.hpp"
#include "fan.hpp"
#include "hypervisor_system.hpp"
#include "log_services.hpp"
@@ -214,6 +215,7 @@
requestRoutesEventDestination(app);
requestRoutesFabricAdapters(app);
requestRoutesFabricAdapterCollection(app);
+ requestRoutesFabricPort(app);
requestRoutesSubmitTestEvent(app);
if constexpr (BMCWEB_HYPERVISOR_COMPUTER_SYSTEM)