From fd920609819a5b10d3d7c8d34fe4fa4214c7da22 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Thu, 23 Nov 2017 12:15:00 -0800 Subject: 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 --- src/vpp-api/vom/dhcp_config.hpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/vpp-api/vom/dhcp_config.hpp') 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 @@ -33,6 +33,11 @@ class events_cmd; 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 */ @@ -55,6 +60,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 */ @@ -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 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; + friend class singular_db; /** * 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 m_db; + static singular_db m_db; }; }; -- cgit 1.2.3-korg