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>
diff --git a/src/vpp-api/vom/sub_interface.cpp b/src/vpp-api/vom/sub_interface.cpp
index ea7fa41..01f4a54 100644
--- a/src/vpp-api/vom/sub_interface.cpp
+++ b/src/vpp-api/vom/sub_interface.cpp
@@ -56,6 +56,13 @@
{
}
+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 @@
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
*