summaryrefslogtreecommitdiff
path: root/redfish-core/lib/managers.hpp
diff options
context:
space:
mode:
authorPotin Lai <potin.lai@quantatw.com>2022-11-22 08:27:16 +0300
committerEd Tanous <ed@tanous.net>2022-11-29 01:39:59 +0300
commit8be2b5b64adb5800c02e62bd484e40d38978e152 (patch)
tree0f1cde0348ff775c6a3e3dd8021dab9ad997041d /redfish-core/lib/managers.hpp
parent043360d02f5b5d8baaeb5e6b0caacc7521c0f93d (diff)
downloadbmcweb-8be2b5b64adb5800c02e62bd484e40d38978e152.tar.xz
managers: fix interface patch and delete of pid object
Only set createNewObject to true when corresponding interface not found in the object. Tested on Bletchley: - Add new StepwiseController called SWTest Body in JSON format ``` { "Oem": { "OpenBmc": { "Fan": { "StepwiseControllers": { "SWTest": { "Direction": "Floor", "Inputs": [ "MB_U402_THERM_LOCAL" ], "NegativeHysteresis": 1.0, "PositiveHysteresis": 2.0, "Steps": [ { "Output": 0.0, "Target": 48.0 }, { "Output": 15.0, "Target": 49.0 } ], "Zones": [ { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0" } ] } } } } } } ``` Checking object from dbus ``` root@bletchley:~# busctl introspect xyz.openbmc_project.EntityManager \ > /xyz/openbmc_project/inventory/system/chassis/Bletchley_Chassis/SWTest \ > xyz.openbmc_project.Configuration.Stepwise NAME TYPE SIGNATURE RESULT/VALUE FLAGS .Delete method - - - .Class property s "Floor" emits-change writable .Inputs property as 1 "MB U402 THERM LOCAL" emits-change writable .Name property s "SWTest" emits-change writable .NegativeHysteresis property d 1 emits-change writable .Output property ad 2 0 15 emits-change writable .PositiveHysteresis property d 2 emits-change writable .Reading property ad 2 48 49 emits-change writable .Type property s "Stepwise" emits-change writable .Zones property as 1 "Zone0" emits-change writable ``` - Patch SWTest properties Body in JSON format ``` { "Oem": { "OpenBmc": { "Fan": { "StepwiseControllers": { "SWTest": { "NegativeHysteresis": 3.0, "PositiveHysteresis": 4.0 } } } } } } ``` Checking object from dbus ``` root@bletchley:~# busctl introspect xyz.openbmc_project.EntityManager \ > /xyz/openbmc_project/inventory/system/chassis/Bletchley_Chassis/SWTest \ > xyz.openbmc_project.Configuration.Stepwise NAME TYPE SIGNATURE RESULT/VALUE FLAGS .Delete method - - - .Class property s "Floor" emits-change writable .Inputs property as 1 "MB U402 THERM LOCAL" emits-change writable .Name property s "SWTest" emits-change writable .NegativeHysteresis property d 3 emits-change writable .Output property ad 2 0 15 emits-change writable .PositiveHysteresis property d 4 emits-change writable .Reading property ad 2 48 49 emits-change writable .Type property s "Stepwise" emits-change writable .Zones property as 1 "Zone0" emits-change writable ``` - Delete SWTest object Body in JSON format ``` { "Oem": { "OpenBmc": { "Fan": { "StepwiseControllers": { "SWTest": null } } } } } ``` Object deleted from dbus ``` root@bletchley:~# busctl introspect xyz.openbmc_project.EntityManager \ > /xyz/openbmc_project/inventory/system/chassis/Bletchley_Chassis/SWTest \ > xyz.openbmc_project.Configuration.Stepwise Failed to introspect object /xyz/openbmc_project/inventory/system/chassis/Bletchley_Chassis/SWTest of service xyz.openbmc_project.EntityManager: Unknown object '/xyz/openbmc_project/inventory/system/chassis/Bletchley_Chassis/SWTest'. ``` Signed-off-by: Potin Lai <potin.lai@quantatw.com> Change-Id: I482e942ee3c76dca17af522765d8b3aa9dc8678b
Diffstat (limited to 'redfish-core/lib/managers.hpp')
-rw-r--r--redfish-core/lib/managers.hpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 19c43f1948..55c3949cae 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -1552,6 +1552,7 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues>
std::string iface;
if (!createNewObject)
{
+ bool findInterface = false;
for (const auto& interface : pathItr->second)
{
if (interface.first == pidConfigurationIface)
@@ -1560,7 +1561,8 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues>
type == "FanControllers")
{
iface = pidConfigurationIface;
- createNewObject = true;
+ findInterface = true;
+ break;
}
}
else if (interface.first == pidZoneConfigurationIface)
@@ -1568,7 +1570,8 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues>
if (type == "FanZones")
{
iface = pidConfigurationIface;
- createNewObject = true;
+ findInterface = true;
+ break;
}
}
else if (interface.first == stepwiseConfigurationIface)
@@ -1576,10 +1579,17 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues>
if (type == "StepwiseControllers")
{
iface = stepwiseConfigurationIface;
- createNewObject = true;
+ findInterface = true;
+ break;
}
}
}
+
+ // create new object if interface not found
+ if (!findInterface)
+ {
+ createNewObject = true;
+ }
}
if (createNewObject && it.value() == nullptr)