aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/interface.cpp
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2017-11-28 22:29:13 -0800
committerNeale Ranns <nranns@cisco.com>2017-11-29 07:42:52 +0000
commita2ee029d0772e894911c84fb8a0cab5f253e145b (patch)
tree167d07ee3b3a482ef494f420ceef13a9657d4274 /src/vpp-api/vom/interface.cpp
parente80ae9ea8ed04c82c151a548916926b5dbfe8ecb (diff)
VOM: logging, populate and stats fixes
logging: allow a client to register a callback handler to recieve log messages that way the client can maintain a correctly sequenced log populate: fix the creation of interface and the setting of the handle stats: the reset promise idea is not defined behaviour. Use an eanble/disable command pair Change-Id: I347720bb65df2874c7619e722d593bc863ee2bf1 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/vpp-api/vom/interface.cpp')
-rw-r--r--src/vpp-api/vom/interface.cpp31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/vpp-api/vom/interface.cpp b/src/vpp-api/vom/interface.cpp
index c7b7e436450..10728ceddc4 100644
--- a/src/vpp-api/vom/interface.cpp
+++ b/src/vpp-api/vom/interface.cpp
@@ -49,21 +49,6 @@ interface::interface(const std::string& name,
{
}
-interface::interface(const handle_t& handle,
- const l2_address_t& l2_address,
- const std::string& name,
- interface::type_t type,
- interface::admin_state_t state)
- : m_hdl(handle, rc_t::OK)
- , m_name(name)
- , m_type(type)
- , m_state(state, rc_t::OK)
- , m_table_id(route::DEFAULT_TABLE)
- , m_l2_address(l2_address)
- , m_oper(oper_state_t::DOWN)
-{
-}
-
interface::interface(const std::string& name,
interface::type_t itf_type,
interface::admin_state_t itf_state,
@@ -172,8 +157,10 @@ interface::sweep()
new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV6, m_hdl));
}
- if (m_stats)
- HW::dequeue(m_stats);
+ if (m_stats) {
+ HW::enqueue(new interface_cmds::stats_disable_cmd(m_hdl.data()));
+ m_stats.reset();
+ }
// If the interface is up, bring it down
if (m_state && interface::admin_state_t::UP == m_state.data()) {
@@ -364,6 +351,12 @@ interface::set(const l2_address_t& addr)
}
void
+interface::set(const handle_t& hdl)
+{
+ m_hdl = hdl;
+}
+
+void
interface::set(const oper_state_t& state)
{
m_oper = state;
@@ -372,7 +365,7 @@ interface::set(const oper_state_t& state)
void
interface::enable_stats_i(interface::stat_listener& el)
{
- m_stats.reset(new interface_cmds::stats_cmd(el, handle_i()));
+ m_stats.reset(new interface_cmds::stats_enable_cmd(el, handle_i()));
HW::enqueue(m_stats);
HW::write();
}
@@ -442,7 +435,7 @@ interface::event_handler::handle_populate(const client_db::key_t& key)
HW::write();
for (auto& itf_record : *cmd) {
- std::unique_ptr<interface> itf =
+ std::shared_ptr<interface> itf =
interface_factory::new_interface(itf_record.get_payload());
if (itf && interface::type_t::LOCAL != itf->type()) {