summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/dhcp_config.hpp
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2017-11-23 12:15:00 -0800
committerNeale Ranns <nranns@cisco.com>2017-11-24 14:04:48 +0000
commitfd920609819a5b10d3d7c8d34fe4fa4214c7da22 (patch)
treefb0b5c3b5a9ba56308ef704ef922e959aafad17f /src/vpp-api/vom/dhcp_config.hpp
parent227bf211ab65e7aed6862fc881cc949c342200fd (diff)
VOM: Additions to allow uses to UT applications that use VOM
- find object by key - compare objects Change-Id: I36ec8612be9482bcef7ceced2a59f7403f77b3e8 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/vpp-api/vom/dhcp_config.hpp')
-rw-r--r--src/vpp-api/vom/dhcp_config.hpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/vpp-api/vom/dhcp_config.hpp b/src/vpp-api/vom/dhcp_config.hpp
index f64a3c8a2e2..db97af98c19 100644
--- a/src/vpp-api/vom/dhcp_config.hpp
+++ b/src/vpp-api/vom/dhcp_config.hpp
@@ -34,6 +34,11 @@ class dhcp_config : public object_base
{
public:
/**
+ * typedef for the DHCP config key type
+ */
+ typedef interface::key_t key_t;
+
+ /**
* Construct a new object matching the desried state
*/
dhcp_config(const interface& itf, const std::string& hostname);
@@ -56,6 +61,16 @@ public:
~dhcp_config();
/**
+ * Comparison operator - for UT
+ */
+ bool operator==(const dhcp_config& d) const;
+
+ /**
+ * Return the object's key
+ */
+ const key_t& key() const;
+
+ /**
* Return the 'singular' of the DHCP config that matches this object
*/
std::shared_ptr<dhcp_config> singular() const;
@@ -71,8 +86,13 @@ public:
static void dump(std::ostream& os);
/**
- * A class that listens to DHCP Events
+ * Find a DHCP config from its key
*/
+ static std::shared_ptr<dhcp_config> find(const key_t& k);
+
+ /**
+ * A class that listens to DHCP Events
+ */
class event_listener
{
public:
@@ -153,7 +173,7 @@ private:
/**
* It's the singular_db class that calls replay()
*/
- friend class singular_db<interface::key_type, dhcp_config>;
+ friend class singular_db<key_t, dhcp_config>;
/**
* Sweep/reap the object if still stale
@@ -191,7 +211,7 @@ private:
/**
* A map of all Dhcp configs keyed against the interface.
*/
- static singular_db<interface::key_type, dhcp_config> m_db;
+ static singular_db<key_t, dhcp_config> m_db;
};
};