Add API to create fru records only for present frus.

This commit builds the fru records only for the present
frus. Any item which is a FRU should by default implement
the Inventory.Item Interface and host the present property.
So, if the present property is not hosted then FRU is absent.

Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
Change-Id: I5534d6cc1a9f7a1b329975cdd5de54110f456f39
diff --git a/libpldmresponder/fru.cpp b/libpldmresponder/fru.cpp
index afb5637..ef032b4 100644
--- a/libpldmresponder/fru.cpp
+++ b/libpldmresponder/fru.cpp
@@ -15,10 +15,8 @@
 
 namespace pldm
 {
-
 namespace responder
 {
-
 void FruImpl::buildFRUTable()
 {
     if (isBuilt)
@@ -52,7 +50,13 @@
     for (const auto& object : objects)
     {
         const auto& interfaces = object.second;
-
+        bool isPresent = pldm::utils::checkForFruPresence(object.first.str);
+        // Do not create fru record if fru is not present.
+        // Pick up the next available fru.
+        if (!isPresent)
+        {
+            continue;
+        }
         for (const auto& interface : interfaces)
         {
             if (itemIntfsLookup.find(interface.first) != itemIntfsLookup.end())
@@ -116,7 +120,7 @@
 
     if (table.size())
     {
-        padBytes = utils::getNumPadBytes(table.size());
+        padBytes = pldm::utils::getNumPadBytes(table.size());
         table.resize(table.size() + padBytes, 0);
 
         // Calculate the checksum
@@ -280,7 +284,7 @@
         return PLDM_FRU_DATA_STRUCTURE_TABLE_UNAVAILABLE;
     }
 
-    auto pads = utils::getNumPadBytes(recordTableSize);
+    auto pads = pldm::utils::getNumPadBytes(recordTableSize);
     crc32(fruData.data(), recordTableSize + pads);
 
     auto iter = fruData.begin() + recordTableSize + pads;
@@ -293,7 +297,6 @@
 
 namespace fru
 {
-
 Response Handler::getFRURecordTableMetadata(const pldm_msg* request,
                                             size_t /*payloadLength*/)
 {