aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom
diff options
context:
space:
mode:
Diffstat (limited to 'src/vpp-api/vom')
-rw-r--r--src/vpp-api/vom/acl_binding.hpp3
-rw-r--r--src/vpp-api/vom/acl_ethertype.cpp5
-rw-r--r--src/vpp-api/vom/acl_list.cpp15
-rw-r--r--src/vpp-api/vom/acl_list.hpp2
-rw-r--r--src/vpp-api/vom/arp_proxy_binding.cpp5
-rw-r--r--src/vpp-api/vom/arp_proxy_config.cpp5
-rw-r--r--src/vpp-api/vom/bond_group_binding.cpp5
-rw-r--r--src/vpp-api/vom/bridge_domain.cpp5
-rw-r--r--src/vpp-api/vom/bridge_domain_arp_entry.cpp5
-rw-r--r--src/vpp-api/vom/bridge_domain_entry.cpp5
-rw-r--r--src/vpp-api/vom/dhcp_config.cpp5
-rw-r--r--src/vpp-api/vom/dhcp_config_cmds.cpp1
-rw-r--r--src/vpp-api/vom/gbp_contract.cpp5
-rw-r--r--src/vpp-api/vom/gbp_endpoint.cpp5
-rw-r--r--src/vpp-api/vom/gbp_endpoint.hpp2
-rw-r--r--src/vpp-api/vom/interface.cpp9
-rw-r--r--src/vpp-api/vom/interface_span.cpp5
-rw-r--r--src/vpp-api/vom/ip_unnumbered.cpp5
-rw-r--r--src/vpp-api/vom/l2_binding.cpp5
-rw-r--r--src/vpp-api/vom/l2_emulation.cpp5
-rw-r--r--src/vpp-api/vom/l3_binding.cpp13
-rw-r--r--src/vpp-api/vom/lldp_binding.cpp5
-rw-r--r--src/vpp-api/vom/lldp_global.cpp5
-rw-r--r--src/vpp-api/vom/nat_binding.cpp5
-rw-r--r--src/vpp-api/vom/nat_static.cpp5
-rw-r--r--src/vpp-api/vom/neighbour.cpp5
-rw-r--r--src/vpp-api/vom/route.cpp6
-rw-r--r--src/vpp-api/vom/route_domain.cpp5
-rw-r--r--src/vpp-api/vom/singular_db.hpp16
-rw-r--r--src/vpp-api/vom/singular_db_funcs.hpp52
-rw-r--r--src/vpp-api/vom/vxlan_tunnel.cpp3
31 files changed, 153 insertions, 69 deletions
diff --git a/src/vpp-api/vom/acl_binding.hpp b/src/vpp-api/vom/acl_binding.hpp
index 6e994e4d2a5..89db0eea219 100644
--- a/src/vpp-api/vom/acl_binding.hpp
+++ b/src/vpp-api/vom/acl_binding.hpp
@@ -26,6 +26,7 @@
#include "vom/object_base.hpp"
#include "vom/om.hpp"
#include "vom/singular_db.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
namespace ACL {
@@ -123,7 +124,7 @@ private:
/**
* Show the object in the Singular DB
*/
- void show(std::ostream& os) { m_db.dump(os); }
+ void show(std::ostream& os) { db_dump(m_db, os); }
/**
* Get the sortable Id of the listener
diff --git a/src/vpp-api/vom/acl_ethertype.cpp b/src/vpp-api/vom/acl_ethertype.cpp
index 530a0aee604..9092517194e 100644
--- a/src/vpp-api/vom/acl_ethertype.cpp
+++ b/src/vpp-api/vom/acl_ethertype.cpp
@@ -15,6 +15,7 @@
#include "vom/acl_ethertype.hpp"
#include "vom/acl_ethertype_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
namespace ACL {
@@ -122,7 +123,7 @@ acl_ethertype::find(const key_t& key)
void
acl_ethertype::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
@@ -237,7 +238,7 @@ acl_ethertype::event_handler::order() const
void
acl_ethertype::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
};
};
diff --git a/src/vpp-api/vom/acl_list.cpp b/src/vpp-api/vom/acl_list.cpp
index 5b03f5db021..651eb87a4a9 100644
--- a/src/vpp-api/vom/acl_list.cpp
+++ b/src/vpp-api/vom/acl_list.cpp
@@ -16,6 +16,7 @@
#include "vom/acl_list.hpp"
#include "vom/acl_list_cmds.hpp"
#include "vom/logger.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
namespace ACL {
@@ -70,6 +71,13 @@ l2_list::event_handler::handle_populate(const client_db::key_t& key)
}
template <>
+void
+l2_list::event_handler::show(std::ostream& os)
+{
+ db_dump(m_db, os);
+}
+
+template <>
l3_list::event_handler::event_handler()
{
OM::register_listener(this);
@@ -130,6 +138,13 @@ l3_list::event_handler::handle_populate(const client_db::key_t& key)
template <>
void
+l3_list::event_handler::show(std::ostream& os)
+{
+ db_dump(m_db, os);
+}
+
+template <>
+void
l3_list::update(const l3_list& obj)
{
/*
diff --git a/src/vpp-api/vom/acl_list.hpp b/src/vpp-api/vom/acl_list.hpp
index bd84ce1ea43..eff5e1c5a52 100644
--- a/src/vpp-api/vom/acl_list.hpp
+++ b/src/vpp-api/vom/acl_list.hpp
@@ -192,7 +192,7 @@ private:
/**
* Show the object in the Singular DB
*/
- void show(std::ostream& os) { m_db.dump(os); }
+ void show(std::ostream& os);
/**
* Get the sortable Id of the listener
diff --git a/src/vpp-api/vom/arp_proxy_binding.cpp b/src/vpp-api/vom/arp_proxy_binding.cpp
index 7053390b7c7..73d3d844f53 100644
--- a/src/vpp-api/vom/arp_proxy_binding.cpp
+++ b/src/vpp-api/vom/arp_proxy_binding.cpp
@@ -15,6 +15,7 @@
#include "vom/arp_proxy_binding.hpp"
#include "vom/arp_proxy_binding_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
@@ -61,7 +62,7 @@ arp_proxy_binding::sweep()
void
arp_proxy_binding::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
@@ -134,7 +135,7 @@ arp_proxy_binding::event_handler::order() const
void
arp_proxy_binding::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
/*
diff --git a/src/vpp-api/vom/arp_proxy_config.cpp b/src/vpp-api/vom/arp_proxy_config.cpp
index c72b5f2e8b0..3973eba55f9 100644
--- a/src/vpp-api/vom/arp_proxy_config.cpp
+++ b/src/vpp-api/vom/arp_proxy_config.cpp
@@ -15,6 +15,7 @@
#include "vom/arp_proxy_config.hpp"
#include "vom/arp_proxy_config_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
singular_db<arp_proxy_config::key_t, arp_proxy_config> arp_proxy_config::m_db;
@@ -57,7 +58,7 @@ arp_proxy_config::sweep()
void
arp_proxy_config::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
@@ -126,7 +127,7 @@ arp_proxy_config::event_handler::order() const
void
arp_proxy_config::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
diff --git a/src/vpp-api/vom/bond_group_binding.cpp b/src/vpp-api/vom/bond_group_binding.cpp
index 6958eb386ba..60721dd4265 100644
--- a/src/vpp-api/vom/bond_group_binding.cpp
+++ b/src/vpp-api/vom/bond_group_binding.cpp
@@ -15,6 +15,7 @@
#include "vom/bond_group_binding.hpp"
#include "vom/bond_group_binding_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
@@ -73,7 +74,7 @@ bond_group_binding::sweep()
void
bond_group_binding::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
@@ -166,7 +167,7 @@ bond_group_binding::event_handler::order() const
void
bond_group_binding::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
/*
diff --git a/src/vpp-api/vom/bridge_domain.cpp b/src/vpp-api/vom/bridge_domain.cpp
index 17144a67ca9..be520f5ee45 100644
--- a/src/vpp-api/vom/bridge_domain.cpp
+++ b/src/vpp-api/vom/bridge_domain.cpp
@@ -17,6 +17,7 @@
#include "vom/bridge_domain_cmds.hpp"
#include "vom/interface.hpp"
#include "vom/l2_binding.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
@@ -137,7 +138,7 @@ bridge_domain::singular() const
void
bridge_domain::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
@@ -199,7 +200,7 @@ bridge_domain::event_handler::order() const
void
bridge_domain::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
diff --git a/src/vpp-api/vom/bridge_domain_arp_entry.cpp b/src/vpp-api/vom/bridge_domain_arp_entry.cpp
index a3bfcddf00e..a203a76744e 100644
--- a/src/vpp-api/vom/bridge_domain_arp_entry.cpp
+++ b/src/vpp-api/vom/bridge_domain_arp_entry.cpp
@@ -15,6 +15,7 @@
#include "vom/bridge_domain_arp_entry.hpp"
#include "vom/bridge_domain_arp_entry_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
@@ -141,7 +142,7 @@ bridge_domain_arp_entry::singular() const
void
bridge_domain_arp_entry::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
bridge_domain_arp_entry::event_handler::event_handler()
@@ -172,7 +173,7 @@ bridge_domain_arp_entry::event_handler::order() const
void
bridge_domain_arp_entry::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
diff --git a/src/vpp-api/vom/bridge_domain_entry.cpp b/src/vpp-api/vom/bridge_domain_entry.cpp
index 9ac5ceae87c..241de953771 100644
--- a/src/vpp-api/vom/bridge_domain_entry.cpp
+++ b/src/vpp-api/vom/bridge_domain_entry.cpp
@@ -15,6 +15,7 @@
#include "vom/bridge_domain_entry.hpp"
#include "vom/bridge_domain_entry_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
singular_db<bridge_domain_entry::key_t, bridge_domain_entry>
@@ -138,7 +139,7 @@ bridge_domain_entry::singular() const
void
bridge_domain_entry::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
bridge_domain_entry::event_handler::event_handler()
@@ -202,7 +203,7 @@ bridge_domain_entry::event_handler::order() const
void
bridge_domain_entry::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
diff --git a/src/vpp-api/vom/dhcp_config.cpp b/src/vpp-api/vom/dhcp_config.cpp
index 8071fb15c57..7d97fa15d6e 100644
--- a/src/vpp-api/vom/dhcp_config.cpp
+++ b/src/vpp-api/vom/dhcp_config.cpp
@@ -15,6 +15,7 @@
#include "vom/dhcp_config.hpp"
#include "vom/dhcp_config_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
@@ -90,7 +91,7 @@ dhcp_config::sweep()
void
dhcp_config::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
@@ -180,7 +181,7 @@ dhcp_config::event_handler::order() const
void
dhcp_config::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
diff --git a/src/vpp-api/vom/dhcp_config_cmds.cpp b/src/vpp-api/vom/dhcp_config_cmds.cpp
index 9e803be7b8d..76ce58b6b92 100644
--- a/src/vpp-api/vom/dhcp_config_cmds.cpp
+++ b/src/vpp-api/vom/dhcp_config_cmds.cpp
@@ -49,6 +49,7 @@ bind_cmd::issue(connection& con)
payload.is_add = 1;
payload.pid = getpid();
payload.want_dhcp_event = 1;
+ payload.set_broadcast_flag = m_set_broadcast_flag;
memset(payload.hostname, 0, sizeof(payload.hostname));
memcpy(payload.hostname, m_hostname.c_str(),
diff --git a/src/vpp-api/vom/gbp_contract.cpp b/src/vpp-api/vom/gbp_contract.cpp
index d648fb3aeaa..8b27269249c 100644
--- a/src/vpp-api/vom/gbp_contract.cpp
+++ b/src/vpp-api/vom/gbp_contract.cpp
@@ -15,6 +15,7 @@
#include "vom/gbp_contract.hpp"
#include "vom/gbp_contract_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
@@ -122,7 +123,7 @@ gbp_contract::singular() const
void
gbp_contract::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
gbp_contract::event_handler::event_handler()
@@ -171,7 +172,7 @@ gbp_contract::event_handler::order() const
void
gbp_contract::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
diff --git a/src/vpp-api/vom/gbp_endpoint.cpp b/src/vpp-api/vom/gbp_endpoint.cpp
index 429183bd210..cd5d7e11ad6 100644
--- a/src/vpp-api/vom/gbp_endpoint.cpp
+++ b/src/vpp-api/vom/gbp_endpoint.cpp
@@ -15,6 +15,7 @@
#include "vom/gbp_endpoint.hpp"
#include "vom/gbp_endpoint_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
@@ -122,7 +123,7 @@ gbp_endpoint::singular() const
void
gbp_endpoint::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
gbp_endpoint::event_handler::event_handler()
@@ -174,7 +175,7 @@ gbp_endpoint::event_handler::order() const
void
gbp_endpoint::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
} // namespace VOM
diff --git a/src/vpp-api/vom/gbp_endpoint.hpp b/src/vpp-api/vom/gbp_endpoint.hpp
index 9118cb80eb1..6ece4fa5431 100644
--- a/src/vpp-api/vom/gbp_endpoint.hpp
+++ b/src/vpp-api/vom/gbp_endpoint.hpp
@@ -16,6 +16,8 @@
#ifndef __VOM_GBP_ENDPOINT_H__
#define __VOM_GBP_ENDPOINT_H__
+#include <ostream>
+
#include "vom/interface.hpp"
#include "vom/singular_db.hpp"
#include "vom/types.hpp"
diff --git a/src/vpp-api/vom/interface.cpp b/src/vpp-api/vom/interface.cpp
index 262d9eaf7b6..e9b7a1a1f9b 100644
--- a/src/vpp-api/vom/interface.cpp
+++ b/src/vpp-api/vom/interface.cpp
@@ -22,6 +22,7 @@
#include "vom/l3_binding_cmds.hpp"
#include "vom/logger.hpp"
#include "vom/prefix.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
@@ -148,13 +149,13 @@ interface::l2_address() const
interface::const_iterator_t
interface::cbegin()
{
- return m_db.cbegin();
+ return m_db.begin();
}
interface::const_iterator_t
interface::cend()
{
- return m_db.cend();
+ return m_db.end();
}
void
@@ -485,7 +486,7 @@ interface::remove(const HW::item<handle_t>& item)
void
interface::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
@@ -626,7 +627,7 @@ interface::event_handler::order() const
void
interface::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
} // namespace VOM
diff --git a/src/vpp-api/vom/interface_span.cpp b/src/vpp-api/vom/interface_span.cpp
index 9243f2dd755..283ea1ece54 100644
--- a/src/vpp-api/vom/interface_span.cpp
+++ b/src/vpp-api/vom/interface_span.cpp
@@ -15,6 +15,7 @@
#include "vom/interface_span.hpp"
#include "vom/interface_span_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
@@ -63,7 +64,7 @@ interface_span::sweep()
void
interface_span::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
@@ -170,7 +171,7 @@ interface_span::event_handler::order() const
void
interface_span::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
const interface_span::state_t interface_span::state_t::DISABLED(0, "disable");
diff --git a/src/vpp-api/vom/ip_unnumbered.cpp b/src/vpp-api/vom/ip_unnumbered.cpp
index ef693e9f140..caeeb419993 100644
--- a/src/vpp-api/vom/ip_unnumbered.cpp
+++ b/src/vpp-api/vom/ip_unnumbered.cpp
@@ -15,6 +15,7 @@
#include "vom/ip_unnumbered.hpp"
#include "vom/ip_unnumbered_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
@@ -58,7 +59,7 @@ ip_unnumbered::sweep()
void
ip_unnumbered::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
@@ -128,7 +129,7 @@ ip_unnumbered::event_handler::order() const
void
ip_unnumbered::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
diff --git a/src/vpp-api/vom/l2_binding.cpp b/src/vpp-api/vom/l2_binding.cpp
index 749557ce3cd..4118f74065a 100644
--- a/src/vpp-api/vom/l2_binding.cpp
+++ b/src/vpp-api/vom/l2_binding.cpp
@@ -15,6 +15,7 @@
#include "vom/l2_binding.hpp"
#include "vom/l2_binding_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
@@ -195,7 +196,7 @@ l2_binding::singular() const
void
l2_binding::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
l2_binding::event_handler::event_handler()
@@ -227,7 +228,7 @@ l2_binding::event_handler::order() const
void
l2_binding::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
diff --git a/src/vpp-api/vom/l2_emulation.cpp b/src/vpp-api/vom/l2_emulation.cpp
index 4eedd95e1fc..7bc7ed657d4 100644
--- a/src/vpp-api/vom/l2_emulation.cpp
+++ b/src/vpp-api/vom/l2_emulation.cpp
@@ -15,6 +15,7 @@
#include "vom/l2_emulation.hpp"
#include "vom/l2_emulation_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
@@ -122,7 +123,7 @@ l2_emulation::singular() const
void
l2_emulation::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
l2_emulation::event_handler::event_handler()
@@ -154,7 +155,7 @@ l2_emulation::event_handler::order() const
void
l2_emulation::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
diff --git a/src/vpp-api/vom/l3_binding.cpp b/src/vpp-api/vom/l3_binding.cpp
index 6ff824483ea..13bc1ffd575 100644
--- a/src/vpp-api/vom/l3_binding.cpp
+++ b/src/vpp-api/vom/l3_binding.cpp
@@ -15,6 +15,7 @@
#include "vom/l3_binding.hpp"
#include "vom/l3_binding_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
singular_db<l3_binding::key_t, l3_binding> l3_binding::m_db;
@@ -92,13 +93,13 @@ l3_binding::itf() const
l3_binding::const_iterator_t
l3_binding::cbegin()
{
- return m_db.cbegin();
+ return m_db.begin();
}
l3_binding::const_iterator_t
l3_binding::cend()
{
- return m_db.cend();
+ return m_db.end();
}
std::string
@@ -146,7 +147,7 @@ l3_binding::singular() const
void
l3_binding::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
@@ -167,9 +168,9 @@ l3_binding::find(const interface& i)
*/
std::deque<std::shared_ptr<l3_binding>> l3s;
- auto it = m_db.cbegin();
+ auto it = m_db.begin();
- while (it != m_db.cend()) {
+ while (it != m_db.end()) {
/*
* The key in the DB is a pair of the interface's name and prefix.
* If the keys match, save the L3-config
@@ -215,7 +216,7 @@ l3_binding::event_handler::order() const
void
l3_binding::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
diff --git a/src/vpp-api/vom/lldp_binding.cpp b/src/vpp-api/vom/lldp_binding.cpp
index a1d3d9f57ba..69b30c2ce94 100644
--- a/src/vpp-api/vom/lldp_binding.cpp
+++ b/src/vpp-api/vom/lldp_binding.cpp
@@ -15,6 +15,7 @@
#include "vom/lldp_binding.hpp"
#include "vom/lldp_binding_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
@@ -70,7 +71,7 @@ lldp_binding::sweep()
void
lldp_binding::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
@@ -149,7 +150,7 @@ lldp_binding::event_handler::order() const
void
lldp_binding::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
diff --git a/src/vpp-api/vom/lldp_global.cpp b/src/vpp-api/vom/lldp_global.cpp
index 7e701dc4c52..6bae7993651 100644
--- a/src/vpp-api/vom/lldp_global.cpp
+++ b/src/vpp-api/vom/lldp_global.cpp
@@ -15,6 +15,7 @@
#include "vom/lldp_global.hpp"
#include "vom/lldp_global_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
@@ -70,7 +71,7 @@ lldp_global::sweep()
void
lldp_global::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
@@ -148,7 +149,7 @@ lldp_global::event_handler::order() const
void
lldp_global::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
diff --git a/src/vpp-api/vom/nat_binding.cpp b/src/vpp-api/vom/nat_binding.cpp
index a3f71117eef..eca3f9041f0 100644
--- a/src/vpp-api/vom/nat_binding.cpp
+++ b/src/vpp-api/vom/nat_binding.cpp
@@ -16,6 +16,7 @@
#include "vom/nat_binding.hpp"
#include "vom/cmd.hpp"
#include "vom/nat_binding_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
singular_db<const nat_binding::key_t, nat_binding> nat_binding::m_db;
@@ -157,7 +158,7 @@ nat_binding::singular() const
void
nat_binding::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
@@ -224,7 +225,7 @@ nat_binding::event_handler::order() const
void
nat_binding::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
diff --git a/src/vpp-api/vom/nat_static.cpp b/src/vpp-api/vom/nat_static.cpp
index b507a5191d4..3185b56e228 100644
--- a/src/vpp-api/vom/nat_static.cpp
+++ b/src/vpp-api/vom/nat_static.cpp
@@ -15,6 +15,7 @@
#include "vom/nat_static.hpp"
#include "vom/nat_static_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
singular_db<nat_static::key_t, nat_static> nat_static::m_db;
@@ -136,7 +137,7 @@ nat_static::singular() const
void
nat_static::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
nat_static::event_handler::event_handler()
@@ -190,7 +191,7 @@ nat_static::event_handler::order() const
void
nat_static::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
diff --git a/src/vpp-api/vom/neighbour.cpp b/src/vpp-api/vom/neighbour.cpp
index 9b53cb2a6bb..44e2760a1ec 100644
--- a/src/vpp-api/vom/neighbour.cpp
+++ b/src/vpp-api/vom/neighbour.cpp
@@ -15,6 +15,7 @@
#include "vom/neighbour.hpp"
#include "vom/neighbour_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
singular_db<neighbour::key_t, neighbour> neighbour::m_db;
@@ -120,7 +121,7 @@ neighbour::singular() const
void
neighbour::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
@@ -203,7 +204,7 @@ neighbour::event_handler::order() const
void
neighbour::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
diff --git a/src/vpp-api/vom/route.cpp b/src/vpp-api/vom/route.cpp
index fa6e5d43b37..247afa008a7 100644
--- a/src/vpp-api/vom/route.cpp
+++ b/src/vpp-api/vom/route.cpp
@@ -15,7 +15,7 @@
#include "vom/route.hpp"
#include "vom/route_cmds.hpp"
-#include "vom/singular_db.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
namespace route {
@@ -367,7 +367,7 @@ ip_route::singular() const
void
ip_route::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
ip_route::event_handler::event_handler()
@@ -514,7 +514,7 @@ ip_route::event_handler::order() const
void
ip_route::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
diff --git a/src/vpp-api/vom/route_domain.cpp b/src/vpp-api/vom/route_domain.cpp
index 626a9cd29a9..b97faf6ae49 100644
--- a/src/vpp-api/vom/route_domain.cpp
+++ b/src/vpp-api/vom/route_domain.cpp
@@ -16,6 +16,7 @@
#include "vom/route_domain.hpp"
#include "vom/cmd.hpp"
#include "vom/route_domain_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
@@ -152,7 +153,7 @@ route_domain::singular() const
void
route_domain::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
@@ -181,7 +182,7 @@ route_domain::event_handler::order() const
void
route_domain::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}; // namespace VOPM
diff --git a/src/vpp-api/vom/singular_db.hpp b/src/vpp-api/vom/singular_db.hpp
index 07ea2cb4acf..afca9a3509e 100644
--- a/src/vpp-api/vom/singular_db.hpp
+++ b/src/vpp-api/vom/singular_db.hpp
@@ -16,6 +16,7 @@
#ifndef __VOM_INST_DB_H__
#define __VOM_INST_DB_H__
+#include <map>
#include <memory>
#include <ostream>
@@ -46,12 +47,12 @@ public:
/**
* Get iterator to the beginning of the DB
*/
- const_iterator cbegin() { return m_map.cbegin(); }
+ const_iterator begin() const { return m_map.cbegin(); }
/**
* Get iterator to the beginning of the DB
*/
- const_iterator cend() { return m_map.cend(); }
+ const_iterator end() const { return m_map.cend(); }
/**
* Find or add the object to the store.
@@ -119,17 +120,6 @@ public:
void add(const KEY& key, std::shared_ptr<OBJ> sp) { m_map[key] = sp; }
/**
- * Print each of the object in the DB into the stream provided
- */
- void dump(std::ostream& os)
- {
- for (auto entry : m_map) {
- os << "key: " << entry.first << std::endl;
- os << " " << entry.second.lock()->to_string() << std::endl;
- }
- }
-
- /**
* Populate VPP from current state, on VPP restart
*/
void replay()
diff --git a/src/vpp-api/vom/singular_db_funcs.hpp b/src/vpp-api/vom/singular_db_funcs.hpp
new file mode 100644
index 00000000000..dddc6e4c229
--- /dev/null
+++ b/src/vpp-api/vom/singular_db_funcs.hpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_INST_DB_FUNCS_H__
+#define __VOM_INST_DB_FUNCS_H__
+
+#include <ostream>
+
+#include "singular_db.hpp"
+
+/**
+ * A set of helper function to iterate over objects in the DB.
+ * These functions are delcared not as DB member functions so that
+ * the template instatiation of the DB does not require the definitions
+ * of the functions used to be declared.
+ */
+namespace VOM {
+/**
+ * Print each of the objects in the DB into the stream provided
+ */
+template <typename DB>
+void
+db_dump(const DB& db, std::ostream& os)
+{
+ for (const auto entry : db) {
+ os << "key: " << entry.first << std::endl;
+ os << " " << entry.second.lock()->to_string() << std::endl;
+ }
+}
+};
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
diff --git a/src/vpp-api/vom/vxlan_tunnel.cpp b/src/vpp-api/vom/vxlan_tunnel.cpp
index f6f3cf586e1..3d5ed64c5e0 100644
--- a/src/vpp-api/vom/vxlan_tunnel.cpp
+++ b/src/vpp-api/vom/vxlan_tunnel.cpp
@@ -15,6 +15,7 @@
#include "vom/vxlan_tunnel.hpp"
#include "vom/logger.hpp"
+#include "vom/singular_db_funcs.hpp"
#include "vom/vxlan_tunnel_cmds.hpp"
namespace VOM {
@@ -197,7 +198,7 @@ vxlan_tunnel::singular_i() const
void
vxlan_tunnel::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void