summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/lldp_binding.cpp
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.cpp
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.cpp')
-rw-r--r--src/vpp-api/vom/lldp_binding.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/vpp-api/vom/lldp_binding.cpp b/src/vpp-api/vom/lldp_binding.cpp
index 05d51bbf0b1..a1d3d9f57ba 100644
--- a/src/vpp-api/vom/lldp_binding.cpp
+++ b/src/vpp-api/vom/lldp_binding.cpp
@@ -20,7 +20,7 @@ namespace VOM {
/**
* A DB of all LLDP configs
*/
-singular_db<interface::key_type, lldp_binding> lldp_binding::m_db;
+singular_db<interface::key_t, lldp_binding> lldp_binding::m_db;
lldp_binding::event_handler lldp_binding::m_evh;
@@ -46,6 +46,18 @@ lldp_binding::~lldp_binding()
m_db.release(m_itf->key(), this);
}
+bool
+lldp_binding::operator==(const lldp_binding& l) const
+{
+ return ((key() == l.key()) && (m_port_desc == l.m_port_desc));
+}
+
+const lldp_binding::key_t&
+lldp_binding::key() const
+{
+ return (m_itf->key());
+}
+
void
lldp_binding::sweep()
{
@@ -99,6 +111,12 @@ lldp_binding::find_or_add(const lldp_binding& temp)
}
std::shared_ptr<lldp_binding>
+lldp_binding::find(const key_t& k)
+{
+ return (m_db.find(k));
+}
+
+std::shared_ptr<lldp_binding>
lldp_binding::singular() const
{
return find_or_add(*this);