summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/lldp_binding.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/lldp_binding.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/lldp_binding.hpp')
-rw-r--r--src/vpp-api/vom/lldp_binding.hpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/vpp-api/vom/lldp_binding.hpp b/src/vpp-api/vom/lldp_binding.hpp
index 896708f699a..0c5610013ac 100644
--- a/src/vpp-api/vom/lldp_binding.hpp
+++ b/src/vpp-api/vom/lldp_binding.hpp
@@ -31,6 +31,11 @@ class lldp_binding : public object_base
{
public:
/**
+ * Typedef for the key of a LLDP binding
+ */
+ typedef interface::key_t key_t;
+
+ /**
* Construct a new object matching the desried state
*/
lldp_binding(const interface& itf, const std::string& hostname);
@@ -39,12 +44,23 @@ public:
* Copy Constructor
*/
lldp_binding(const lldp_binding& o);
+
/**
* Destructor
*/
~lldp_binding();
/**
+ * Comparison operator
+ */
+ bool operator==(const lldp_binding& b) const;
+
+ /**
+ * Return this object's key
+ */
+ const key_t& key() const;
+
+ /**
* Return the 'singular' of the LLDP binding that matches this object
*/
std::shared_ptr<lldp_binding> singular() const;
@@ -59,6 +75,11 @@ public:
*/
static void dump(std::ostream& os);
+ /**
+ * Find or add LLDP binding based on its key
+ */
+ static std::shared_ptr<lldp_binding> find(const key_t& k);
+
private:
/**
* Class definition for listeners to OM events
@@ -113,7 +134,7 @@ private:
/**
* It's the singular_db class that calls replay()
*/
- friend class singular_db<interface::key_type, lldp_binding>;
+ friend class singular_db<key_t, lldp_binding>;
/**
* Sweep/reap the object if still stale
@@ -146,7 +167,7 @@ private:
/**
* A map of all Lldp bindings keyed against the interface.
*/
- static singular_db<interface::key_type, lldp_binding> m_db;
+ static singular_db<key_t, lldp_binding> m_db;
};
};