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>
diff --git a/src/vpp-api/vom/l2_binding.hpp b/src/vpp-api/vom/l2_binding.hpp
index 0e6f7fc..ba97cab 100644
--- a/src/vpp-api/vom/l2_binding.hpp
+++ b/src/vpp-api/vom/l2_binding.hpp
@@ -32,6 +32,11 @@
 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>
   {
     l2_vtr_op_t(const l2_vtr_op_t& l) = default;
@@ -67,6 +72,16 @@
   ~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 @@
    */
   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<l2_binding> find(const key_t& key);
+
 private:
   /**
    * Class definition for listeners to OM events
@@ -141,7 +161,7 @@
   /**
    * It's the singular_db class that calls replay()
    */
-  friend class singular_db<const handle_t, l2_binding>;
+  friend class singular_db<key_t, l2_binding>;
 
   /**
    * Sweep/reap the object if still stale
@@ -186,7 +206,7 @@
   /**
    * A map of all L2 interfaces key against the interface's handle_t
    */
-  static singular_db<const handle_t, l2_binding> m_db;
+  static singular_db<key_t, l2_binding> m_db;
 };
 };