Map state effecter id to D-Bus object path

Add a way to map state effecter ids to D-Bus object paths (multiple
paths in case the effecter is composite).

The mapping is specified in the state effecter PDR JSON (because the
mapping is system specific), and is stored in a map in memory. This will
be used by the get/set state effecter commands to route effecter ids to
D-Bus.

Change-Id: Ic79fae2445fd257302dd1298830f58b91fed9a1f
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/test/libpldmresponder_pdr_state_effecter_test.cpp b/test/libpldmresponder_pdr_state_effecter_test.cpp
index fb8af01..24eea41 100644
--- a/test/libpldmresponder_pdr_state_effecter_test.cpp
+++ b/test/libpldmresponder_pdr_state_effecter_test.cpp
@@ -1,3 +1,4 @@
+#include "libpldmresponder/effecters.hpp"
 #include "libpldmresponder/pdr.hpp"
 
 #include "libpldm/platform.h"
@@ -9,6 +10,7 @@
 TEST(GeneratePDR, testGoodJson)
 {
     using namespace pdr;
+    using namespace effecter::dbus_mapping;
     Repo& pdrRepo = get("./pdr_jsons/good");
 
     // 2 entries
@@ -42,6 +44,9 @@
     bf1.byte = 2;
     ASSERT_EQ(states->states[0].byte, bf1.byte);
 
+    auto paths = get(pdr->effecter_id);
+    ASSERT_EQ(paths[0], "/foo/bar");
+
     // Check second PDR
     e = pdrRepo.at(2);
     pdr = reinterpret_cast<pldm_state_effecter_pdr*>(e.data());
@@ -76,6 +81,12 @@
     bf2[1].byte = 128;
     ASSERT_EQ(states->states[0].byte, bf2[0].byte);
     ASSERT_EQ(states->states[1].byte, bf2[1].byte);
+
+    paths = get(pdr->effecter_id);
+    ASSERT_EQ(paths[0], "/foo/bar");
+    ASSERT_EQ(paths[1], "/foo/bar/baz");
+
+    ASSERT_THROW(get(0xDEAD), std::exception);
 }
 
 TEST(GeneratePDR, testNoJson)