summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/dhcp_config.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/dhcp_config.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/dhcp_config.cpp')
-rw-r--r--src/vpp-api/vom/dhcp_config.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/vpp-api/vom/dhcp_config.cpp b/src/vpp-api/vom/dhcp_config.cpp
index a7299267334..0b6e2eff0de 100644
--- a/src/vpp-api/vom/dhcp_config.cpp
+++ b/src/vpp-api/vom/dhcp_config.cpp
@@ -20,7 +20,7 @@ namespace VOM {
/**
* A DB of all DHCP configs
*/
-singular_db<interface::key_type, dhcp_config> dhcp_config::m_db;
+singular_db<interface::key_t, dhcp_config> dhcp_config::m_db;
dhcp_config::event_handler dhcp_config::m_evh;
@@ -58,6 +58,19 @@ dhcp_config::~dhcp_config()
m_db.release(m_itf->key(), this);
}
+bool
+dhcp_config::operator==(const dhcp_config& l) const
+{
+ return ((key() == l.key()) && (m_hostname == l.m_hostname) &&
+ (m_client_id == l.m_client_id));
+}
+
+const dhcp_config::key_t&
+dhcp_config::key() const
+{
+ return (m_itf->key());
+}
+
void
dhcp_config::sweep()
{
@@ -112,6 +125,12 @@ dhcp_config::find_or_add(const dhcp_config& temp)
}
std::shared_ptr<dhcp_config>
+dhcp_config::find(const key_t& k)
+{
+ return (m_db.find(k));
+}
+
+std::shared_ptr<dhcp_config>
dhcp_config::singular() const
{
return find_or_add(*this);