Code Update: Host ApplyTime support

Get the requested image apply time value provided through the
UpdateService redfish schema. If the apply time value is Immediate, then
host reboot will be triggered just after the new pnor image activation. The
default apply time value is OnReset in which the new image remains at
Active state and user has to manualy reboot the host for applying the new
image.

Tested: Verified that host is getting rebooted while doing a pnor code update
if the apply time value is Immediate.  Tested this use case at server power Off
and Running scenarios. OnReset scenario was also tested in which new image
remained at Active state as pnor code update application did not trigger the
host reboot.

Note: This change is applicable to ubi based systems (Witherspoon)

Signed-off-by: Jayashankar Padath <jayashankar.padath@in.ibm.com>
Change-Id: I74f73172626919b225efef43d9baacd64eadbf60
diff --git a/activation.hpp b/activation.hpp
index a9fb347..e3cff64 100644
--- a/activation.hpp
+++ b/activation.hpp
@@ -3,6 +3,7 @@
 #include "config.h"
 
 #include "org/openbmc/Associations/server.hpp"
+#include "utils.hpp"
 #include "xyz/openbmc_project/Software/ActivationProgress/server.hpp"
 #include "xyz/openbmc_project/Software/ExtendedVersion/server.hpp"
 #include "xyz/openbmc_project/Software/RedundancyPriority/server.hpp"
@@ -32,6 +33,19 @@
 using ActivationProgressInherit = sdbusplus::server::object::object<
     sdbusplus::xyz::openbmc_project::Software::server::ActivationProgress>;
 
+constexpr auto applyTimeImmediate =
+    "xyz.openbmc_project.Software.ApplyTime.RequestedApplyTimes.Immediate";
+constexpr auto applyTimeIntf = "xyz.openbmc_project.Software.ApplyTime";
+constexpr auto dbusPropIntf = "org.freedesktop.DBus.Properties";
+constexpr auto applyTimeObjPath = "/xyz/openbmc_project/software/apply_time";
+constexpr auto applyTimeProp = "RequestedApplyTime";
+
+constexpr auto hostStateIntf = "xyz.openbmc_project.State.Host";
+constexpr auto hostStateObjPath = "/xyz/openbmc_project/state/host0";
+constexpr auto hostStateRebootProp = "RequestedHostTransition";
+constexpr auto hostStateRebootVal =
+    "xyz.openbmc_project.State.Host.Transition.Reboot";
+
 namespace sdbusRule = sdbusplus::bus::match::rules;
 
 class ItemUpdater;
@@ -268,6 +282,20 @@
      */
     using ActivationInherit::activation;
 
+    /**
+     * @brief Determine the configured image apply time value
+     *
+     * @return true if the image apply time value is immediate
+     **/
+    bool checkApplyTimeImmediate();
+
+    /**
+     * @brief Reboot the Host. Called when ApplyTime is immediate.
+     *
+     * @return none
+     **/
+    void rebootHost();
+
   protected:
     /** @brief Check if systemd state change is relevant to this object
      *