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/l2_binding.hpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/vpp-api/vom/l2_binding.hpp') diff --git a/src/vpp-api/vom/l2_binding.hpp b/src/vpp-api/vom/l2_binding.hpp index 0e6f7fc0d68..ba97cab512c 100644 --- a/src/vpp-api/vom/l2_binding.hpp +++ b/src/vpp-api/vom/l2_binding.hpp @@ -32,6 +32,11 @@ namespace VOM { class l2_binding : public object_base { public: + /** + * Key type for an L2 binding in the singular DB + */ + typedef interface::key_t key_t; + struct l2_vtr_op_t : public enum_base { l2_vtr_op_t(const l2_vtr_op_t& l) = default; @@ -66,6 +71,16 @@ public: */ ~l2_binding(); + /** + * Return the binding's key + */ + const key_t& key() const; + + /** + * Comparison operator - for UT + */ + bool operator==(const l2_binding& l) const; + /** * Return the 'singular instance' of the L2 config that matches this * object @@ -87,6 +102,11 @@ public: */ void set(const l2_vtr_op_t& op, uint16_t tag); + /** + * Static function to find the bridge_domain in the model + */ + static std::shared_ptr find(const key_t& key); + private: /** * Class definition for listeners to OM events @@ -141,7 +161,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 @@ -186,7 +206,7 @@ private: /** * A map of all L2 interfaces key against the interface's handle_t */ - static singular_db m_db; + static singular_db m_db; }; }; -- cgit 1.2.3-korg