summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/sub_interface.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/sub_interface.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/sub_interface.cpp')
-rw-r--r--src/vpp-api/vom/sub_interface.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/vpp-api/vom/sub_interface.cpp b/src/vpp-api/vom/sub_interface.cpp
index ea7fa419f75..01f4a54a517 100644
--- a/src/vpp-api/vom/sub_interface.cpp
+++ b/src/vpp-api/vom/sub_interface.cpp
@@ -56,6 +56,13 @@ sub_interface::sub_interface(const sub_interface& o)
{
}
+bool
+sub_interface::operator==(const sub_interface& s) const
+{
+ return (interface::operator==(s) && (m_parent->key() == s.m_parent->key()) &&
+ (m_vlan == s.m_vlan));
+}
+
std::string
sub_interface::mk_name(const interface& parent, vlan_id_t vlan)
{
@@ -88,10 +95,17 @@ sub_interface::singular() const
std::shared_ptr<interface>
sub_interface::singular_i() const
{
- return m_db.find_or_add(name(), *this);
+ return m_db.find_or_add(key(), *this);
}
+
+std::shared_ptr<sub_interface>
+sub_interface::find(const key_t& k)
+{
+ return std::dynamic_pointer_cast<sub_interface>(m_db.find(k));
}
+}; // namespace VOM
+
/*
* fd.io coding-style-patch-verification: ON
*