Add chassis and inventory associations to PSU Pwm
PSU pwm sensors are not associated with chassis base
board object path. This causes the PSU pwm sensors
not list under chassis redfish object. Added chassis
base board path and inventory object path associations
to PSU Pwm Sensors.
Tested:
Get on redfish chassis/<chassis id>/Thermal and
chassis/<chassis id>/sensors redfish URI shows
PSU Pwm sensors.
Change-Id: Ia862ecff058ca43fee38a6f71bdd57f8c135aae2
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
diff --git a/src/PwmSensor.cpp b/src/PwmSensor.cpp
index 5aa729e..eee29ef 100644
--- a/src/PwmSensor.cpp
+++ b/src/PwmSensor.cpp
@@ -27,8 +27,10 @@
static constexpr double defaultPwm = 30.0;
PwmSensor::PwmSensor(const std::string& name, const std::string& sysPath,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
sdbusplus::asio::object_server& objectServer,
- const std::string& sensorConfiguration) :
+ const std::string& sensorConfiguration,
+ const std::string& sensorType) :
sysPath(sysPath),
objectServer(objectServer), name(name)
{
@@ -118,12 +120,23 @@
association = objectServer.add_interface(
"/xyz/openbmc_project/sensors/fan_pwm/" + name, association::interface);
- createAssociation(association, sensorConfiguration);
+
+ // PowerSupply sensors should be associated with chassis board path
+ // and inventory along with psu object.
+ if (sensorType == "PSU")
+ {
+ createInventoryAssoc(conn, association, sensorConfiguration);
+ }
+ else
+ {
+ createAssociation(association, sensorConfiguration);
+ }
}
PwmSensor::~PwmSensor()
{
objectServer.remove_interface(sensorInterface);
objectServer.remove_interface(controlInterface);
+ objectServer.remove_interface(association);
}
void PwmSensor::setValue(uint32_t value)