Add SerialNumber and Model for cpu node in redfish

If CPUInfo interface is available, populate SerialNumber
and Model for processor/cpu.

Tested:
Verfied /redfish/v1/Systems/system/Processors/cpu0
{
    "@odata.id": "/redfish/v1/Systems/system/Processors/cpu0",
    "@odata.type": "#Processor.v1_7_0.Processor",
    "Id": "cpu0",
    "MaxSpeedMHz": 4000,
    "Model": "QQQQ",
    "Name": "Central Processor",
    "ProcessorType": "CPU",
    "SerialNumber": "6122cca2e8a2d5c",
...

Redfish Validator passed together with this patch
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31294/

Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Change-Id: I0e14d414e06c40062239a0673d2c55e706cc1b30
diff --git a/redfish-core/lib/cpudimm.hpp b/redfish-core/lib/cpudimm.hpp
index 2e49b99..ed5e641 100644
--- a/redfish-core/lib/cpudimm.hpp
+++ b/redfish-core/lib/cpudimm.hpp
@@ -262,6 +262,49 @@
         "org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
 }
 
+void getCpuAssetData(std::shared_ptr<AsyncResp> aResp,
+                     const std::string& service, const std::string& objPath)
+{
+    BMCWEB_LOG_DEBUG << "Get Cpu Asset Data";
+    crow::connections::systemBus->async_method_call(
+        [objPath, aResp{std::move(aResp)}](
+            const boost::system::error_code ec,
+            const boost::container::flat_map<
+                std::string, std::variant<std::string, uint32_t, uint16_t,
+                                          bool>>& properties) {
+            if (ec)
+            {
+                BMCWEB_LOG_DEBUG << "DBUS response error";
+                messages::internalError(aResp->res);
+                return;
+            }
+
+            for (const auto& property : properties)
+            {
+                if (property.first == "SerialNumber")
+                {
+                    const std::string* sn =
+                        std::get_if<std::string>(&property.second);
+                    if (sn != nullptr)
+                    {
+                        aResp->res.jsonValue["SerialNumber"] = *sn;
+                    }
+                }
+                else if (property.first == "Model")
+                {
+                    const std::string* model =
+                        std::get_if<std::string>(&property.second);
+                    if (model != nullptr)
+                    {
+                        aResp->res.jsonValue["Model"] = *model;
+                    }
+                }
+            }
+        },
+        service, objPath, "org.freedesktop.DBus.Properties", "GetAll",
+        "xyz.openbmc_project.Inventory.Decorator.Asset");
+}
+
 void getAcceleratorDataByService(std::shared_ptr<AsyncResp> aResp,
                                  const std::string& acclrtrId,
                                  const std::string& service,
@@ -351,8 +394,15 @@
                     for (const auto& service : object.second)
                     {
                         for (const auto& inventory : service.second)
-                            if (inventory ==
-                                "xyz.openbmc_project.Inventory.Item.Cpu")
+                        {
+                            if (inventory == "xyz.openbmc_project."
+                                             "Inventory.Decorator.Asset")
+                            {
+                                getCpuAssetData(aResp, service.first,
+                                                object.first);
+                            }
+                            else if (inventory ==
+                                     "xyz.openbmc_project.Inventory.Item.Cpu")
                             {
                                 getCpuDataByService(aResp, cpuId, service.first,
                                                     object.first);
@@ -363,8 +413,9 @@
                                 getAcceleratorDataByService(
                                     aResp, cpuId, service.first, object.first);
                             }
-                        return;
+                        }
                     }
+                    return;
                 }
             }
             // Object not found
@@ -584,6 +635,7 @@
 
         getCpuData(asyncResp, processorId,
                    {"xyz.openbmc_project.Inventory.Item.Cpu",
+                    "xyz.openbmc_project.Inventory.Decorator.Asset",
                     "xyz.openbmc_project.Inventory.Item.Accelerator"});
     }
 };