Build FRU table lazily

The FRU table is created when the PLDM daemon starts and depends on
BMC inventory collection to populate it completely. There is no D-Bus
signal or target that PLDM daemon can rely on to figure completion of
inventory. This can cause some of the inventory to not show up in the
FRU table if the inventory collection is not complete when the PLDM
daemon starts.

An easy solution to this problem is to do the FRU table creation
lazily. The FRU table will be created when the FRU commands or Get PDR
command is handled the first time. The entity association PDR's are
created when the FRU table is built. So Get PDR commands expects the
building of the FRU table as a pre condition.

Tested:

Ensured FRU table is created when the GetFRURecordTableMetadata,
GetFRURecordTable and GetPDR command is handled by the PLDM daemon the
first time. Next time already built table is returned for the FRU
commands.

Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Change-Id: I0deb723f30a30a667d0e80c9f9f6aced5ab23a67
diff --git a/test/libpldmresponder_pdr_effecter_test.cpp b/test/libpldmresponder_pdr_effecter_test.cpp
index 9d98c1f..6e36b3b 100644
--- a/test/libpldmresponder_pdr_effecter_test.cpp
+++ b/test/libpldmresponder_pdr_effecter_test.cpp
@@ -16,7 +16,7 @@
     auto outPDRRepo = pldm_pdr_init();
     Repo outRepo(outPDRRepo);
     Handler handler("./pdr_jsons/state_effecter/good", "./event_jsons/good",
-                    inPDRRepo, nullptr);
+                    inPDRRepo, nullptr, nullptr);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, outRepo, PLDM_STATE_EFFECTER_PDR);
 
@@ -109,7 +109,8 @@
     auto inPDRRepo = pldm_pdr_init();
     auto outPDRRepo = pldm_pdr_init();
     Repo outRepo(outPDRRepo);
-    Handler handler("./pdr_jsons/state_effecter/good", "", inPDRRepo, nullptr);
+    Handler handler("./pdr_jsons/state_effecter/good", "", inPDRRepo, nullptr,
+                    nullptr);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, outRepo, PLDM_NUMERIC_EFFECTER_PDR);
 
@@ -149,7 +150,7 @@
     auto pdrRepo = pldm_pdr_init();
 
     ASSERT_THROW(Handler("./pdr_jsons/not_there", "./event_jsons/not_there",
-                         pdrRepo, nullptr),
+                         pdrRepo, nullptr, nullptr),
                  std::exception);
 
     pldm_pdr_destroy(pdrRepo);
@@ -161,7 +162,7 @@
     auto outPDRRepo = pldm_pdr_init();
     Repo outRepo(outPDRRepo);
     Handler handler("./pdr_jsons/state_effecter/good", "./event_jsons/good",
-                    inPDRRepo, nullptr);
+                    inPDRRepo, nullptr, nullptr);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, outRepo, PLDM_STATE_EFFECTER_PDR);
 
@@ -176,7 +177,8 @@
 TEST(findStateEffecterId, goodJson)
 {
     auto inPDRRepo = pldm_pdr_init();
-    Handler handler("./pdr_jsons/state_effecter/good", "", inPDRRepo, nullptr);
+    Handler handler("./pdr_jsons/state_effecter/good", "", inPDRRepo, nullptr,
+                    nullptr);
     uint16_t entityType = 33;
     uint16_t entityInstance = 0;
     uint16_t containerId = 0;