summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/l2_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/l2_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/l2_binding.cpp')
-rw-r--r--src/vpp-api/vom/l2_binding.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/vpp-api/vom/l2_binding.cpp b/src/vpp-api/vom/l2_binding.cpp
index e380760805c..dd49e570a8e 100644
--- a/src/vpp-api/vom/l2_binding.cpp
+++ b/src/vpp-api/vom/l2_binding.cpp
@@ -20,7 +20,7 @@ namespace VOM {
/**
* A DB of all the L2 Configs
*/
-singular_db<const handle_t, l2_binding> l2_binding::m_db;
+singular_db<l2_binding::key_t, l2_binding> l2_binding::m_db;
l2_binding::event_handler l2_binding::m_evh;
@@ -75,6 +75,24 @@ l2_binding::l2_binding(const l2_binding& o)
{
}
+const l2_binding::key_t&
+l2_binding::key() const
+{
+ return (m_itf->key());
+}
+
+bool
+l2_binding::operator==(const l2_binding& l) const
+{
+ return ((*m_itf == *l.m_itf) && (*m_bd == *l.m_bd));
+}
+
+std::shared_ptr<l2_binding>
+l2_binding::find(const key_t& key)
+{
+ return (m_db.find(key));
+}
+
void
l2_binding::sweep()
{
@@ -108,14 +126,14 @@ l2_binding::~l2_binding()
sweep();
// not in the DB anymore.
- m_db.release(m_itf->handle(), this);
+ m_db.release(m_itf->key(), this);
}
std::string
l2_binding::to_string() const
{
std::ostringstream s;
- s << "L2-config:[" << m_itf->to_string() << " " << m_bd->to_string() << " "
+ s << "L2-binding:[" << m_itf->to_string() << " " << m_bd->to_string() << " "
<< m_binding.to_string() << "]";
return (s.str());
@@ -154,7 +172,7 @@ l2_binding::update(const l2_binding& desired)
std::shared_ptr<l2_binding>
l2_binding::find_or_add(const l2_binding& temp)
{
- return (m_db.find_or_add(temp.m_itf->handle(), temp));
+ return (m_db.find_or_add(temp.m_itf->key(), temp));
}
std::shared_ptr<l2_binding>