fw_update: Introduce AggregateUpdateManager

Description:
This commit introduces the `AggregateUpdateManager` class for handling
multiple firmware update sessions simultaneously. The
`AggregateUpdateManager` acts as a reverse proxy for PLDM messages,
routing them to the appropriate `UpdateManager` instance based on the
`instanceId`. This allows for concurrent firmware updates, improving
the efficiency and flexibility of the firmware update process.

Motivation:
We have introduced the `FirmwareInventory`/`FirmwareInventoryManager`
classes to manage D-Bus interfaces for firmware update, After that, we
would like to implement the `StartUpdate` method for `FirmwareInventory`
properly for the update process implementation[1], which
`AggregateUpdateManager` will help route the command to the specific
update sessions.

Details of the PLDM message reverse proxy:
By the implementation, different update session would be handled with
different `instanceId`s, which can help `UpdateManager`s to identify
whether the message is for them or not.
Whenever a PLDM response message is received, the flow that
the `AggregateUpdateManager` do:
 1. Handle the message for existing update flow if the instance_id
    (the pldm instance numbers) matches the update task which using the
    existing update flow.
 2. Traverse forward the message to each `ItemUpdateManager`
    (implementation in the next patch) instances if there's no match in
    step 1.
 3. Return error message PLDM_FWUP_COMMAND_NOT_EXPECTED if no matches in
    step 2.

[1]: https://gerrit.openbmc.org/c/openbmc/pldm/+/74774

Change-Id: Icfdb8d238121f9f44a624396e00b378e491ce652
Signed-off-by: Unive Tien <unive.tien.wiwynn@gmail.com>
diff --git a/fw-update/test/firmware_inventory_manager_test.cpp b/fw-update/test/firmware_inventory_manager_test.cpp
index 4814838..c7effaa 100644
--- a/fw-update/test/firmware_inventory_manager_test.cpp
+++ b/fw-update/test/firmware_inventory_manager_test.cpp
@@ -1,6 +1,7 @@
 #include "common/test/mocked_utils.hpp"
 #include "fw-update/firmware_inventory.hpp"
 #include "fw-update/firmware_inventory_manager.hpp"
+#include "test/test_instance_id.hpp"
 
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
@@ -33,8 +34,9 @@
 {
   public:
     FirmwareInventoryManagerTest(const pldm::utils::DBusHandler* handler,
-                                 const Configurations& config) :
-        FirmwareInventoryManager(handler, config)
+                                 const Configurations& config,
+                                 AggregateUpdateManager& updateManager) :
+        FirmwareInventoryManager(handler, config, updateManager)
     {}
 
     SoftwareMap& getSoftwareMap()
@@ -64,7 +66,19 @@
         endpointId, endpointUuid, endpointMedium, endpointNetId, endpointName);
     configurations[boardInventoryPath] = endpointInfo;
 
-    FirmwareInventoryManagerTest inventoryManager(&mockHandler, configurations);
+    Event event(sdeventplus::Event::get_default());
+    TestInstanceIdDb instanceIdDb;
+    requester::Handler<requester::Request> handler(
+        nullptr, event, instanceIdDb, false, seconds(1), 2, milliseconds(100));
+
+    DescriptorMap descriptorMap{};
+    ComponentInfoMap componentInfoMap{};
+
+    AggregateUpdateManager updateManager(event, handler, instanceIdDb,
+                                         descriptorMap, componentInfoMap);
+
+    FirmwareInventoryManagerTest inventoryManager(&mockHandler, configurations,
+                                                  updateManager);
 
     SoftwareIdentifier softwareIdentifier{endpointId, 100};
     SoftwareName softwareName{"TestDevice"};
diff --git a/fw-update/test/firmware_inventory_test.cpp b/fw-update/test/firmware_inventory_test.cpp
index 46611bd..47d8396 100644
--- a/fw-update/test/firmware_inventory_test.cpp
+++ b/fw-update/test/firmware_inventory_test.cpp
@@ -36,10 +36,9 @@
     ComponentInfo firmwareComponentInfo;
     SoftwareVersionPurpose expectedPurpose = SoftwareVersionPurpose::Unknown;
 
-    FirmwareInventoryTest inventory(
-        softwareIdentifier, expectedSoftwarePath, expectedSoftwareVersion,
-        expectedEndpointPath, firmwareDescriptors, firmwareComponentInfo,
-        expectedPurpose);
+    FirmwareInventoryTest inventory(softwareIdentifier, expectedSoftwarePath,
+                                    expectedSoftwareVersion,
+                                    expectedEndpointPath, expectedPurpose);
 
     EXPECT_EQ(inventory.getSoftwarePath(), expectedSoftwarePath);
     auto associationTuples = inventory.getAssociation().associations();
diff --git a/fw-update/test/inventory_manager_test.cpp b/fw-update/test/inventory_manager_test.cpp
index f2fd789..5e76b46 100644
--- a/fw-update/test/inventory_manager_test.cpp
+++ b/fw-update/test/inventory_manager_test.cpp
@@ -1,4 +1,5 @@
 #include "common/utils.hpp"
+#include "fw-update/aggregate_update_manager.hpp"
 #include "fw-update/inventory_manager.hpp"
 #include "requester/test/mock_request.hpp"
 #include "test/test_instance_id.hpp"
@@ -18,9 +19,11 @@
         event(sdeventplus::Event::get_default()), instanceIdDb(),
         reqHandler(nullptr, event, instanceIdDb, false, seconds(1), 2,
                    milliseconds(100)),
+        updateManager(event, reqHandler, instanceIdDb, outDescriptorMap,
+                      outComponentInfoMap),
         inventoryManager(&dBusHandler, reqHandler, instanceIdDb,
                          outDescriptorMap, outDownstreamDescriptorMap,
-                         outComponentInfoMap, configurations)
+                         outComponentInfoMap, configurations, updateManager)
     {}
 
     int fd = -1;
@@ -28,6 +31,7 @@
     sdeventplus::Event event;
     TestInstanceIdDb instanceIdDb;
     requester::Handler<requester::Request> reqHandler;
+    AggregateUpdateManager updateManager;
     InventoryManager inventoryManager;
     DescriptorMap outDescriptorMap{};
     DownstreamDescriptorMap outDownstreamDescriptorMap{};
diff --git a/fw-update/test/meson.build b/fw-update/test/meson.build
index ba78fcd..7ea17cd 100644
--- a/fw-update/test/meson.build
+++ b/fw-update/test/meson.build
@@ -1,12 +1,14 @@
 fw_update_test_src = declare_dependency(
     sources: [
         '../activation.cpp',
+        '../aggregate_update_manager.cpp',
         '../inventory_manager.cpp',
         '../package_parser.cpp',
         '../device_updater.cpp',
         '../update_manager.cpp',
         '../firmware_inventory_manager.cpp',
         '../firmware_inventory.cpp',
+        '../update.cpp',
         '../../common/utils.cpp',
     ],
 )