fw_update: Introduce FirmwareInventory

Spec reference: [1]

Description:
FirmwareInventory is a class that manages all of the D-Bus
utilities for the firmware update functionality of each entry,
FirmwareInventoryManager is used to manage multiple FirmwareInventory
instances.

Flow of the routine when one or more firmware device is added:
1. When one or more firmware device is added, the InventoryManager
   instance will try to create a FirmwareInventory entry for the added
   device, to accomplish this, it will need to fetch the necessary
   information from various source (e.g. EM, device descriptors).

2. After the information is gathered, the InventoryManager will try to
   obtain a Name for each firmware devices, to fit the different
   platform condition, the name will be reference by the order below:
    1. From Entity Manager (EM), if the endpoint has a specific EM
       configuration with "Name" property listed.
    2. From device descriptors, if the device descriptor contains a
       vendor defined descriptor with "OpenBMC.Name" titled.
    3. Spawn a default one, named "Firmware_Device_<Endpoint ID>".

3. The InventoryManager will then invoke
   `FirmwareInventoryManager::createFirmwareInventory` to create a
   firmware inventory entry.

Properties managed by firmware Inventory:
1. Version
   Version object that represents the firmware version
2. Association
   Association object that represents the associations for the
   firmware

The object path pattern of the firmware inventory entry is:
`/xyz/openbmc_project/software/<BoardName>_<SoftwareName>_<SoftwareID>`

Where:
- `<BoardName>` represents the board the device is on.
- `<SoftwareName>` is the name of the firmware device obtained from the
  InventoryManager.
- `<SoftwareID>` is a 4-byte random number to help consumer
  distinguish from the new/old objects of a inventory item.
  For example:
  `server_board_slot_1_VR_2603`
  The new Activation object and its related interfaces needs to
  resides on a new objectPath, hence the softwareId is appended to
  the path.

Test results:
 - Build passed
 - Successfully create firmware inventory entries
   on Yosemite V4

[1]: https://github.com/openbmc/docs/blob/master/designs/code-update.md

Change-Id: Idebd7d013c82c60f08309a1860d5de1deeb3829a
Signed-off-by: Unive Tien <unive.tien.wiwynn@gmail.com>
Signed-off-by: Carter Chen <carter.chen.wiwynn@gmail.com>
diff --git a/common/test/mocked_utils.hpp b/common/test/mocked_utils.hpp
index 1cec506..4cce83e 100644
--- a/common/test/mocked_utils.hpp
+++ b/common/test/mocked_utils.hpp
@@ -81,4 +81,8 @@
 
     MOCK_METHOD(pldm::utils::PropertyMap, getDbusPropertiesVariant,
                 (const char*, const char*, const char*), (const override));
+
+    MOCK_METHOD(pldm::utils::GetAncestorsResponse, getAncestors,
+                (const std::string&, const std::vector<std::string>&),
+                (const, override));
 };
diff --git a/common/types.hpp b/common/types.hpp
index 18542d9..7bbe22f 100644
--- a/common/types.hpp
+++ b/common/types.hpp
@@ -5,6 +5,7 @@
 #include <bitset>
 #include <cstdint>
 #include <map>
+#include <memory>
 #include <set>
 #include <string>
 #include <unordered_map>
@@ -100,6 +101,8 @@
 
 namespace fw_update
 {
+using InventoryPath = std::string;
+using SoftwareName = std::string;
 
 // Descriptor definition
 using DescriptorType = uint16_t;
@@ -121,6 +124,7 @@
 // Component information
 using CompClassification = uint16_t;
 using CompIdentifier = uint16_t;
+using SoftwareIdentifier = std::pair<eid, CompIdentifier>;
 using CompKey = std::pair<CompClassification, CompIdentifier>;
 using CompClassificationIndex = uint8_t;
 using ComponentInfo = std::map<CompKey, CompClassificationIndex>;
diff --git a/common/utils.cpp b/common/utils.cpp
index 7406e1f..e2cbd50 100644
--- a/common/utils.cpp
+++ b/common/utils.cpp
@@ -953,5 +953,11 @@
         }
     }
 }
+
+long int generateSwId()
+{
+    return random() % 10000;
+}
+
 } // namespace utils
 } // namespace pldm
diff --git a/common/utils.hpp b/common/utils.hpp
index c031af1..867e064 100644
--- a/common/utils.hpp
+++ b/common/utils.hpp
@@ -699,6 +699,12 @@
 std::optional<uint32_t> fruFieldParserU32(const uint8_t* value,
                                           const uint8_t& length);
 
+/**
+ * @brief Get a random ID for firmware inventory entry
+ * @return Random ID as long integer
+ */
+long int generateSwId();
+
 /** @brief Method to get the value from a bios attribute
  *
  *  @param[in] dbusAttrName - the bios attribute name from