topology: Add powered_by topology
bmcweb already support the power supply command, refer to
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/57668
Use "PowerPort" to add the powered_by association for upstream port, so
that the PowerSupplyCollection in redfish can get the power supply
information.
Tested:
Add the following config in mobo.json:
```
{
"Name": "Mobo Upstream Port",
"Type": "Mobo Upstream Port"
},
```
Add the following config in PSU.json:
```
{
"ConnectsToType": "Mobo Upstream Port",
"Name": "PSU $BUS Downstream Port",
"Type": "DownstreamPort",
"PowerPort": true
},
```
Result for association:
```
{
"type" : "as",
"data" : [
[
"/xyz/openbmc_project/inventory/system/board/PSU_1"
]
]
}
```
Result in bmcweb:
```
$ curl -s -k -H "X-Auth-Token: $token" http://${bmc}/redfish/v1/Chassis/Mobo | jq .Links.Contains
[
{
"@odata.id": "/redfish/v1/Chassis/PSU_1"
}
]
$ curl -k -H "X-Auth-Token: $token" http://${bmc}/redfish/v1/Chassis/Mobo/PowerSubsystem/PowerSupplies/PSU_1
{
"@odata.id": "/redfish/v1/Chassis/Mobo/PowerSubsystem/PowerSupplies/PSU_1",
"@odata.type": "#PowerSupply.v1_5_0.PowerSupply",
...
}
```
Run unitest for test_topology is PASSED.
Change-Id: Iad10e61417437a41628cf311cdd7893725a5dcde
Signed-off-by: Jeff Lin <JeffLin2@quantatw.com>
diff --git a/src/topology.hpp b/src/topology.hpp
index 4ea5246..467a5ca 100644
--- a/src/topology.hpp
+++ b/src/topology.hpp
@@ -27,6 +27,7 @@
std::unordered_map<PortType, std::vector<Path>> upstreamPorts;
std::unordered_map<PortType, std::vector<Path>> downstreamPorts;
+ std::set<Path> powerPaths;
std::unordered_map<Path, BoardType> boardTypes;
std::unordered_map<BoardName, Path> boardNames;
};