summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/interface_cmds.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_cmds.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_cmds.cpp')
-rw-r--r--src/vpp-api/vom/interface_cmds.cpp63
1 files changed, 54 insertions, 9 deletions
diff --git a/src/vpp-api/vom/interface_cmds.cpp b/src/vpp-api/vom/interface_cmds.cpp
index 750ad1f8881..031aaea7288 100644
--- a/src/vpp-api/vom/interface_cmds.cpp
+++ b/src/vpp-api/vom/interface_cmds.cpp
@@ -366,7 +366,7 @@ events_cmd::issue(connection& con)
wait();
- return (rc_t::INPROGRESS);
+ return (rc_t::OK);
}
void
@@ -401,7 +401,8 @@ events_cmd::to_string() const
/**
* Interface statistics
*/
-stats_cmd::stats_cmd(interface::stat_listener& el, const handle_t& handle)
+stats_enable_cmd::stats_enable_cmd(interface::stat_listener& el,
+ const handle_t& handle)
: event_cmd(el.status())
, m_listener(el)
, m_swifindex(handle)
@@ -409,13 +410,13 @@ stats_cmd::stats_cmd(interface::stat_listener& el, const handle_t& handle)
}
bool
-stats_cmd::operator==(const stats_cmd& other) const
+stats_enable_cmd::operator==(const stats_enable_cmd& other) const
{
return (true);
}
rc_t
-stats_cmd::issue(connection& con)
+stats_enable_cmd::issue(connection& con)
{
/*
* First set the call back to handle the interface stats
@@ -438,11 +439,11 @@ stats_cmd::issue(connection& con)
wait();
- return (rc_t::INPROGRESS);
+ return (rc_t::OK);
}
void
-stats_cmd::retire(connection& con)
+stats_enable_cmd::retire(connection& con)
{
/*
* disable interface stats.
@@ -461,21 +462,65 @@ stats_cmd::retire(connection& con)
}
void
-stats_cmd::notify()
+stats_enable_cmd::notify()
{
m_listener.handle_interface_stat(this);
}
std::string
-stats_cmd::to_string() const
+stats_enable_cmd::to_string() const
{
- return ("itf-stats");
+ std::ostringstream s;
+ s << "itf-stats-enable itf:" << m_swifindex.to_string();
+ return (s.str());
}
dump_cmd::dump_cmd()
{
}
+stats_disable_cmd::stats_disable_cmd(const handle_t& handle)
+ : rpc_cmd(m_res)
+ , m_swifindex(handle)
+{
+}
+
+bool
+stats_disable_cmd::operator==(const stats_disable_cmd& other) const
+{
+ return (true);
+}
+
+rc_t
+stats_disable_cmd::issue(connection& con)
+{
+ /*
+ * then send the request to enable them
+ */
+ msg_t req(con.ctx(), 1, std::ref(*this));
+
+ auto& payload = req.get_request().get_payload();
+ payload.enable_disable = 0;
+ payload.pid = getpid();
+ payload.num = 1;
+
+ payload.sw_ifs[0] = m_swifindex.value();
+
+ VAPI_CALL(req.execute());
+
+ wait();
+
+ return (rc_t::OK);
+}
+
+std::string
+stats_disable_cmd::to_string() const
+{
+ std::ostringstream s;
+ s << "itf-stats-disable itf:" << m_swifindex.to_string();
+ return (s.str());
+}
+
bool
dump_cmd::operator==(const dump_cmd& other) const
{