From d41ddd78dd631dd2e8774457defa407d9bf03374 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Wed, 18 Dec 2019 01:37:02 +0530 Subject: PFR: Adding functional endpoints assosications Added functional endpoints assosications to all "Active" image objects like bmc_active, bios_active, cpld_active. This will make bmcweb happy while querying active component versions. Tested: Flashed PFR image and from redfish checked the BMC active version info by querying "/redfish/v1/Managers/bmc". Change-Id: Ief7b8f92be3a24c06ef172bf0d9d7a95bce32c15 Signed-off-by: AppaRao Puli --- intel-pfr-manager/service/src/pfr_mgr.cpp | 32 ++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/intel-pfr-manager/service/src/pfr_mgr.cpp b/intel-pfr-manager/service/src/pfr_mgr.cpp index b773916..c954f96 100644 --- a/intel-pfr-manager/service/src/pfr_mgr.cpp +++ b/intel-pfr-manager/service/src/pfr_mgr.cpp @@ -55,22 +55,28 @@ PfrVersion::PfrVersion(sdbusplus::asio::object_server &srv_, versionIface->initialize(); - /* Activation interface represents activation state for an associated - * xyz.openbmc_project.Software.Version. since these versions are already - * active, so we should set "activation" to Active and - * "RequestedActivation" to None. */ - std::string activation; - if (imgType == ImageType::bmcRecovery || - imgType == ImageType::biosRecovery || - imgType == ImageType::cpldRecovery) - { - activation = - "xyz.openbmc_project.Software.Activation.Activations.StandbySpare"; - } - else + std::string activation = + "xyz.openbmc_project.Software.Activation.Activations.StandbySpare"; + + if ((imgType == ImageType::bmcActive) || + (imgType == ImageType::biosActive) || + (imgType == ImageType::cpldActive)) { + // Running images so set Activations to "Active" activation = "xyz.openbmc_project.Software.Activation.Activations.Active"; + + /* For all Active images, functional endpoints must be added. This * + * will be used in bmcweb for showing active component versions. */ + using Association = std::tuple; + std::vector associations; + associations.push_back( + Association("functional", "software_version", objPath)); + auto associationsIface = + server.add_interface("/xyz/openbmc_project/software", + "xyz.openbmc_project.Association.Definitions"); + associationsIface->register_property("Associations", associations); + associationsIface->initialize(); } std::string reqActNone = -- cgit v1.2.3