Persist the snmp manager configuration

This commit persist the manager configuration D-Bus objects
and restores it once service starts.

This commit also deletes the associated persistent file whenever
snmp client D-Bus object gets deleted.

Change-Id: I1526b52870ee5dfea30e6527bad3fd12d1191a13
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/test/test_snmp_conf_manager.cpp b/test/test_snmp_conf_manager.cpp
index ab29215..ebf492f 100644
--- a/test/test_snmp_conf_manager.cpp
+++ b/test/test_snmp_conf_manager.cpp
@@ -18,11 +18,16 @@
     sdbusplus::bus::bus bus;
     ConfManager manager;
     std::string confDir;
-    TestSNMPConfManager() :
-        bus(sdbusplus::bus::new_default()), manager(bus, ""){};
+    TestSNMPConfManager() : bus(sdbusplus::bus::new_default()), manager(bus, "")
+    {
+        char tmp[] = "/tmp/snmpManager.XXXXXX";
+        std::string confDir = mkdtemp(tmp);
+        manager.dbusPersistentLocation = confDir;
+    }
 
     ~TestSNMPConfManager()
     {
+        fs::remove_all(manager.dbusPersistentLocation);
     }
 
     void createSNMPClient(std::string ipaddress, uint16_t port)
@@ -37,11 +42,8 @@
 
     void deleteSNMPClient(std::string ipaddress)
     {
-        if (manager.clients.find(ipaddress) != manager.clients.end())
-        {
-            auto &it = manager.clients[ipaddress];
-            it->delete_();
-        }
+        auto &it = manager.clients[ipaddress];
+        it->delete_();
     }
 };