diff options
author | Neale Ranns <neale.ranns@cisco.com> | 2017-11-23 12:15:00 -0800 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2017-11-24 14:04:48 +0000 |
commit | fd920609819a5b10d3d7c8d34fe4fa4214c7da22 (patch) | |
tree | fb0b5c3b5a9ba56308ef704ef922e959aafad17f /src/vpp-api/vom/bridge_domain_entry.cpp | |
parent | 227bf211ab65e7aed6862fc881cc949c342200fd (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/bridge_domain_entry.cpp')
-rw-r--r-- | src/vpp-api/vom/bridge_domain_entry.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/vpp-api/vom/bridge_domain_entry.cpp b/src/vpp-api/vom/bridge_domain_entry.cpp index 343d82d3ffa..79f36f7d947 100644 --- a/src/vpp-api/vom/bridge_domain_entry.cpp +++ b/src/vpp-api/vom/bridge_domain_entry.cpp @@ -55,12 +55,24 @@ bridge_domain_entry::bridge_domain_entry(const bridge_domain_entry& bde) { } +const bridge_domain_entry::key_t +bridge_domain_entry::key() const +{ + return (std::make_pair(m_bd->key(), m_mac)); +} + +bool +bridge_domain_entry::operator==(const bridge_domain_entry& bde) const +{ + return ((key() == bde.key()) && (m_tx_itf == bde.m_tx_itf)); +} + bridge_domain_entry::~bridge_domain_entry() { sweep(); // not in the DB anymore. - m_db.release(std::make_pair(m_bd->id(), m_mac), this); + m_db.release(key(), this); } void @@ -106,7 +118,13 @@ bridge_domain_entry::update(const bridge_domain_entry& r) std::shared_ptr<bridge_domain_entry> bridge_domain_entry::find_or_add(const bridge_domain_entry& temp) { - return (m_db.find_or_add(std::make_pair(temp.m_bd->id(), temp.m_mac), temp)); + return (m_db.find_or_add(temp.key(), temp)); +} + +std::shared_ptr<bridge_domain_entry> +bridge_domain_entry::find(const key_t& k) +{ + return (m_db.find(k)); } std::shared_ptr<bridge_domain_entry> |