Move nested dbus calls in getComputerSystem

Dbus calls to dbus objects 'xyz.openbmc_project.Inventory.Item' and
and 'xyz.openbmc_project.State.Decorator.OperationalStatus' are nested
under a call for 'xyz.openbmc_project.Inventory.Item.Cpu' properties.
This change seperates these calls for clarity and to minimize variables

Testing:

1. Redfish Validator Testing passed
2. Curl testing:

curl -k -H "X-Auth-Token: $tok" https://$bmc/redfish/v1/Systems/system
...
  "ProcessorSummary": {
    "CoreCount": 0,
    "Count": 2,
    "Model": "",
    "Status": {
      "Health": "OK",
      "HealthRollup": "OK",
      "State": "Enabled"
    }
  },
...

Signed-off-by: Ali Ahmed <ama213000@gmail.com>
Change-Id: Id4657836607a2261a188db8d565aaa2b1a414c5a
Signed-off-by: Shantappa Teekappanavar <shantappa.teekappanavar@ibm.com>
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 230598b..76fcd59 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -126,46 +126,14 @@
     }
 }
 
-inline void
-    getProcessorProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
-                           const std::string& service, const std::string& path,
-                           const dbus::utility::DBusPropertiesMap& properties)
+inline void getProcessorProperties(
+    const std::shared_ptr<bmcweb::AsyncResp>& aResp,
+    const std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>&
+        properties)
 {
 
     BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Cpu properties.";
 
-    auto getCpuPresenceState = [aResp](const boost::system::error_code ec3,
-                                       const bool cpuPresenceCheck) {
-        if (ec3)
-        {
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
-            return;
-        }
-        modifyCpuPresenceState(aResp, cpuPresenceCheck);
-    };
-
-    auto getCpuFunctionalState = [aResp](const boost::system::error_code ec3,
-                                         const bool cpuFunctionalCheck) {
-        if (ec3)
-        {
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
-            return;
-        }
-        modifyCpuFunctionalState(aResp, cpuFunctionalCheck);
-    };
-
-    // Get the Presence of CPU
-    sdbusplus::asio::getProperty<bool>(
-        *crow::connections::systemBus, service, path,
-        "xyz.openbmc_project.Inventory.Item", "Present",
-        std::move(getCpuPresenceState));
-
-    // Get the Functional State
-    sdbusplus::asio::getProperty<bool>(
-        *crow::connections::systemBus, service, path,
-        "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional",
-        std::move(getCpuFunctionalState));
-
     // TODO: Get Model
 
     const uint16_t* coreCount = nullptr;
@@ -210,6 +178,38 @@
                                 const std::string& path)
 {
 
+    auto getCpuPresenceState = [aResp](const boost::system::error_code ec3,
+                                       const bool cpuPresenceCheck) {
+        if (ec3)
+        {
+            BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
+            return;
+        }
+        modifyCpuPresenceState(aResp, cpuPresenceCheck);
+    };
+
+    auto getCpuFunctionalState = [aResp](const boost::system::error_code ec3,
+                                         const bool cpuFunctionalCheck) {
+        if (ec3)
+        {
+            BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
+            return;
+        }
+        modifyCpuFunctionalState(aResp, cpuFunctionalCheck);
+    };
+
+    // Get the Presence of CPU
+    sdbusplus::asio::getProperty<bool>(
+        *crow::connections::systemBus, service, path,
+        "xyz.openbmc_project.Inventory.Item", "Present",
+        std::move(getCpuPresenceState));
+
+    // Get the Functional State
+    sdbusplus::asio::getProperty<bool>(
+        *crow::connections::systemBus, service, path,
+        "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional",
+        std::move(getCpuFunctionalState));
+
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, path,
         "xyz.openbmc_project.Inventory.Item.Cpu",
@@ -222,7 +222,7 @@
             messages::internalError(aResp->res);
             return;
         }
-        getProcessorProperties(aResp, service, path, properties);
+        getProcessorProperties(aResp, properties);
         });
 }