summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/interface_cmds.cpp
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2017-11-20 10:23:47 +0100
committerNeale Ranns <nranns@cisco.com>2017-11-22 11:20:45 +0000
commit5a4f96a178b693ace8e736c30c949ced5928d824 (patch)
tree55109d1354c6fc3814282a9b9ba6e52fc19a43df /src/vpp-api/vom/interface_cmds.cpp
parent4878cbe276ec1131d0cf30ac5df18aa9ba699bc4 (diff)
VOM: stats: Associate stat obj to interface
Change-Id: Id8b159dd72b92798538a32fe570fb0038d742ef2 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vpp-api/vom/interface_cmds.cpp')
-rw-r--r--src/vpp-api/vom/interface_cmds.cpp43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/vpp-api/vom/interface_cmds.cpp b/src/vpp-api/vom/interface_cmds.cpp
index 4f6286f7bef..750ad1f8881 100644
--- a/src/vpp-api/vom/interface_cmds.cpp
+++ b/src/vpp-api/vom/interface_cmds.cpp
@@ -401,11 +401,10 @@ events_cmd::to_string() const
/**
* Interface statistics
*/
-stats_cmd::stats_cmd(interface::stat_listener& el,
- const std::vector<handle_t>& interfaces)
+stats_cmd::stats_cmd(interface::stat_listener& el, const handle_t& handle)
: event_cmd(el.status())
, m_listener(el)
- , m_swifindex(interfaces)
+ , m_swifindex(handle)
{
}
@@ -419,29 +418,21 @@ rc_t
stats_cmd::issue(connection& con)
{
/*
- * First set the clal back to handle the interface stats
- */
+ * First set the call back to handle the interface stats
+ */
m_reg.reset(new reg_t(con.ctx(), std::ref(*(static_cast<event_cmd*>(this)))));
- // m_reg->execute();
/*
- * then send the request to enable them
- */
- msg_t req(con.ctx(), m_swifindex.size(),
- std::ref(*(static_cast<rpc_cmd*>(this))));
+ * then send the request to enable them
+ */
+ msg_t req(con.ctx(), 1, std::ref(*(static_cast<rpc_cmd*>(this))));
auto& payload = req.get_request().get_payload();
payload.enable_disable = 1;
payload.pid = getpid();
- payload.num = m_swifindex.size();
-
- auto it = m_swifindex.cbegin();
- uint32_t ii = 0;
- while (it != m_swifindex.cend()) {
- payload.sw_ifs[ii] = it->value();
- ++it;
- ++ii;
- }
+ payload.num = 1;
+
+ payload.sw_ifs[0] = m_swifindex.value();
VAPI_CALL(req.execute());
@@ -453,6 +444,20 @@ stats_cmd::issue(connection& con)
void
stats_cmd::retire(connection& con)
{
+ /*
+ * disable interface stats.
+ */
+ msg_t req(con.ctx(), 1, std::ref(*(static_cast<rpc_cmd*>(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();
}
void