Implement the Client create interface

This commit also implement the D-Bus service which would be
used for snmp client configuration and would add the
snmp manager/trap receiver D-Bus objects under
namespace /xyz/openbmc_project/network/snmp/manager/

It implements the delete interface for SNMP client D-Bus Object.

Resolves openbmc/openbmc#3057

Change-Id: I0df7b1475f81325b9ac497c1fb350c3f62329686
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/snmp_conf_manager.hpp b/snmp_conf_manager.hpp
new file mode 100644
index 0000000..0f1ee4b
--- /dev/null
+++ b/snmp_conf_manager.hpp
@@ -0,0 +1,81 @@
+#pragma once
+
+#include "snmp_client.hpp"
+
+#include <xyz/openbmc_project/Network/Client/Create/server.hpp>
+#include <sdbusplus/bus.hpp>
+
+#include <string>
+
+namespace phosphor
+{
+namespace network
+{
+namespace snmp
+{
+using IPAddress = std::string;
+using ClientList = std::map<IPAddress, std::unique_ptr<Client>>;
+
+namespace details
+{
+
+using CreateIface = sdbusplus::server::object::object<
+    sdbusplus::xyz::openbmc_project::Network::Client::server::Create>;
+
+} // namespace details
+
+class TestSNMPConfManager;
+/** @class Manager
+ *  @brief OpenBMC SNMP config  implementation.
+ */
+class ConfManager : public details::CreateIface
+{
+  public:
+    ConfManager() = delete;
+    ConfManager(const ConfManager&) = delete;
+    ConfManager& operator=(const ConfManager&) = delete;
+    ConfManager(ConfManager&&) = delete;
+    ConfManager& operator=(ConfManager&&) = delete;
+    virtual ~ConfManager() = default;
+
+    /** @brief Constructor to put object onto bus at a dbus path.
+     *  @param[in] bus - Bus to attach to.
+     *  @param[in] objPath - Path to attach at.
+     */
+    ConfManager(sdbusplus::bus::bus& bus, const char* objPath);
+
+    /** @brief Function to create snmp manager details D-Bus object.
+     *  @param[in] address- IP address/Hostname.
+     *  @param[in] port - network port.
+     */
+    void client(std::string address, uint16_t port) override;
+
+    /* @brief delete the dbus object of the given ipaddress.
+     * @param[in] address - IP address/Hostname.
+     */
+    void deleteSNMPClient(const std::string& address);
+
+  protected:
+    /** @brief generates the id by doing hash of ipaddress, port
+     *  @param[in] address - IP address/Hostname.
+     *  @param[in] port - network port.
+     *  @return hash string.
+     */
+    static std::string generateId(const std::string& address, uint16_t port);
+
+  private:
+    /** @brief sdbusplus DBus bus object. */
+    sdbusplus::bus::bus& bus;
+
+    /** @brief Path of Object. */
+    std::string objectPath;
+
+    /** @brief map of IPAddress dbus objects and their names */
+    ClientList clients;
+
+    friend class TestSNMPConfManager;
+};
+
+} // namespace snmp
+} // namespace network
+} // namespace phosphor