FD.io VPP  v18.04-17-g3a0d853
Vector Packet Processing
interface_cmds.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "vom/interface_cmds.hpp"
17 #include "vom/cmd.hpp"
18 
25 
26 namespace VOM {
27 namespace interface_cmds {
29  const std::string& name)
30  : create_cmd(item, name)
31 {
32 }
33 
34 rc_t
36 {
37  msg_t req(con.ctx(), std::ref(*this));
38 
39  VAPI_CALL(req.execute());
40 
41  m_hw_item = wait();
42 
43  if (m_hw_item.rc() == rc_t::OK) {
45  }
46 
47  return rc_t::OK;
48 }
49 std::string
51 {
52  std::ostringstream s;
53  s << "loopback-itf-create: " << m_hw_item.to_string() << " name:" << m_name;
54 
55  return (s.str());
56 }
57 
59  const std::string& name)
60  : create_cmd(item, name)
61 {
62 }
63 
64 rc_t
66 {
67  msg_t req(con.ctx(), std::ref(*this));
68 
69  auto& payload = req.get_request().get_payload();
70 
71  payload.use_random_hw_addr = 1;
72  memset(payload.host_if_name, 0, sizeof(payload.host_if_name));
73  memcpy(payload.host_if_name, m_name.c_str(),
74  std::min(m_name.length(), sizeof(payload.host_if_name)));
75 
76  VAPI_CALL(req.execute());
77 
78  m_hw_item = wait();
79 
80  if (m_hw_item.rc() == rc_t::OK) {
82  }
83 
84  return rc_t::OK;
85 }
86 std::string
88 {
89  std::ostringstream s;
90  s << "af-packet-itf-create: " << m_hw_item.to_string() << " name:" << m_name;
91 
92  return (s.str());
93 }
94 
96  const std::string& name)
97  : create_cmd(item, name)
98 {
99 }
100 
101 rc_t
103 {
104  msg_t req(con.ctx(), std::ref(*this));
105 
106  auto& payload = req.get_request().get_payload();
107 
108  memset(payload.tap_name, 0, sizeof(payload.tap_name));
109  memcpy(payload.tap_name, m_name.c_str(),
110  std::min(m_name.length(), sizeof(payload.tap_name)));
111  payload.use_random_mac = 1;
112 
113  VAPI_CALL(req.execute());
114 
115  m_hw_item = wait();
116 
117  if (m_hw_item.rc() == rc_t::OK) {
119  }
120 
121  return rc_t::OK;
122 }
123 
124 std::string
126 {
127  std::ostringstream s;
128  s << "tap-intf-create: " << m_hw_item.to_string() << " name:" << m_name;
129 
130  return (s.str());
131 }
132 
134  const std::string& name,
135  const std::string& tag)
136  : create_cmd(item, name)
137  , m_tag(tag)
138 {
139 }
140 
141 rc_t
143 {
144  msg_t req(con.ctx(), std::ref(*this));
145 
146  auto& payload = req.get_request().get_payload();
147  memset(payload.sock_filename, 0, sizeof(payload.sock_filename));
148  memcpy(payload.sock_filename, m_name.c_str(),
149  std::min(m_name.length(), sizeof(payload.sock_filename)));
150  memset(payload.tag, 0, sizeof(payload.tag));
151 
152  if (!m_tag.empty())
153  memcpy(payload.tag, m_tag.c_str(),
154  std::min(m_tag.length(), sizeof(payload.tag)));
155 
156  payload.is_server = 0;
157  payload.use_custom_mac = 0;
158  payload.renumber = 0;
159 
160  VAPI_CALL(req.execute());
161 
162  m_hw_item = wait();
163 
164  if (m_hw_item.rc() == rc_t::OK) {
166  }
167 
168  return rc_t::OK;
169 }
170 
171 std::string
173 {
174  std::ostringstream s;
175  s << "vhost-intf-create: " << m_hw_item.to_string() << " name:" << m_name
176  << " tag:" << m_tag;
177 
178  return (s.str());
179 }
180 
182  : delete_cmd(item)
183 {
184 }
185 
186 rc_t
188 {
189  msg_t req(con.ctx(), std::ref(*this));
190 
191  auto& payload = req.get_request().get_payload();
192  payload.sw_if_index = m_hw_item.data().value();
193 
194  VAPI_CALL(req.execute());
195 
196  wait();
198 
200  return rc_t::OK;
201 }
202 
203 std::string
205 {
206  std::ostringstream s;
207  s << "loopback-itf-delete: " << m_hw_item.to_string();
208 
209  return (s.str());
210 }
211 
213  const std::string& name)
214  : delete_cmd(item, name)
215 {
216 }
217 
218 rc_t
220 {
221  msg_t req(con.ctx(), std::ref(*this));
222 
223  auto& payload = req.get_request().get_payload();
224  memset(payload.host_if_name, 0, sizeof(payload.host_if_name));
225  memcpy(payload.host_if_name, m_name.c_str(),
226  std::min(m_name.length(), sizeof(payload.host_if_name)));
227 
228  VAPI_CALL(req.execute());
229 
230  wait();
232 
234  return rc_t::OK;
235 }
236 std::string
238 {
239  std::ostringstream s;
240  s << "af_packet-itf-delete: " << m_hw_item.to_string();
241 
242  return (s.str());
243 }
244 
246  : delete_cmd(item)
247 {
248 }
249 
250 rc_t
252 {
253  // finally... call VPP
254 
256  return rc_t::OK;
257 }
258 std::string
260 {
261  std::ostringstream s;
262  s << "tap-itf-delete: " << m_hw_item.to_string();
263 
264  return (s.str());
265 }
266 
268  const std::string& name)
269  : delete_cmd(item, name)
270 {
271 }
272 
273 rc_t
275 {
276  msg_t req(con.ctx(), std::ref(*this));
277 
278  auto& payload = req.get_request().get_payload();
279  payload.sw_if_index = m_hw_item.data().value();
280 
281  VAPI_CALL(req.execute());
282 
283  wait();
285 
286  return rc_t::OK;
287 }
288 std::string
290 {
291  std::ostringstream s;
292  s << "vhost-itf-delete: " << m_hw_item.to_string() << " name:" << m_name;
293 
294  return (s.str());
295 }
296 
298  const HW::item<handle_t>& hdl)
299  : rpc_cmd(state)
300  , m_hdl(hdl)
301 {
302 }
303 
304 bool
306 {
307  return ((m_hdl == other.m_hdl) && (m_hw_item == other.m_hw_item));
308 }
309 
310 rc_t
312 {
313  msg_t req(con.ctx(), std::ref(*this));
314 
315  auto& payload = req.get_request().get_payload();
316  payload.sw_if_index = m_hdl.data().value();
317  payload.admin_up_down = m_hw_item.data().value();
318 
319  VAPI_CALL(req.execute());
320 
321  m_hw_item.set(wait());
322 
323  return rc_t::OK;
324 }
325 
326 std::string
328 {
329  std::ostringstream s;
330  s << "itf-state-change: " << m_hw_item.to_string()
331  << " hdl:" << m_hdl.to_string();
332  return (s.str());
333 }
334 
336  const l3_proto_t& proto,
337  const HW::item<handle_t>& hdl)
338  : rpc_cmd(table)
339  , m_hdl(hdl)
340  , m_proto(proto)
341 {
342 }
343 
344 bool
346 {
347  return ((m_hdl == other.m_hdl) && (m_proto == other.m_proto) &&
348  (m_hw_item == other.m_hw_item));
349 }
350 
351 rc_t
353 {
354  msg_t req(con.ctx(), std::ref(*this));
355 
356  auto& payload = req.get_request().get_payload();
357  payload.sw_if_index = m_hdl.data().value();
358  payload.is_ipv6 = m_proto.is_ipv6();
359  payload.vrf_id = m_hw_item.data();
360 
361  VAPI_CALL(req.execute());
362 
363  m_hw_item.set(wait());
364 
365  return (rc_t::OK);
366 }
367 
368 std::string
370 {
371  std::ostringstream s;
372  s << "itf-set-table: " << m_hw_item.to_string()
373  << " proto:" << m_proto.to_string() << " hdl:" << m_hdl.to_string();
374  return (s.str());
375 }
376 
378  const HW::item<handle_t>& hdl)
379  : rpc_cmd(mac)
380  , m_hdl(hdl)
381 {
382 }
383 
384 bool
386 {
387  return ((m_hdl == other.m_hdl) && (m_hw_item == other.m_hw_item));
388 }
389 
390 rc_t
392 {
393  msg_t req(con.ctx(), std::ref(*this));
394 
395  auto& payload = req.get_request().get_payload();
396  payload.sw_if_index = m_hdl.data().value();
397  m_hw_item.data().to_mac().to_bytes(payload.mac_address,
398  sizeof(payload.mac_address));
399 
400  VAPI_CALL(req.execute());
401 
402  m_hw_item.set(wait());
403 
404  return (rc_t::OK);
405 }
406 
407 std::string
409 {
410  std::ostringstream s;
411  s << "itf-set-mac: " << m_hw_item.to_string() << " hdl:" << m_hdl.to_string();
412  return (s.str());
413 }
414 
417  const handle_t& hdl,
418  bool enable)
419  : rpc_cmd(item)
420  , m_hdl(hdl)
421  , m_enable(enable)
422 {
423 }
424 
425 bool
427  const collect_detail_stats_change_cmd& other) const
428 {
429  return ((m_hdl == other.m_hdl) && (m_hw_item == other.m_hw_item) &&
430  (m_enable == other.m_enable));
431 }
432 
433 rc_t
435 {
436  msg_t req(con.ctx(), std::ref(*this));
437 
438  auto& payload = req.get_request().get_payload();
439  payload.sw_if_index = m_hdl.value();
440  payload.enable_disable = m_enable;
441 
442  VAPI_CALL(req.execute());
443 
444  m_hw_item.set(wait());
445 
446  return (rc_t::OK);
447 }
448 
449 std::string
451 {
452  std::ostringstream s;
453  s << "itf-stats: " << m_hw_item.to_string() << " hdl:" << m_hdl.to_string();
454  return (s.str());
455 }
456 
458  : event_cmd(el.status())
459  , m_listener(el)
460 {
461 }
462 
463 bool
465 {
466  return (true);
467 }
468 
469 rc_t
471 {
472  /*
473  * First set the call back to handle the interface events
474  */
475  m_reg.reset(new reg_t(con.ctx(), std::ref(*(static_cast<event_cmd*>(this)))));
476 
477  /*
478  * then send the request to enable them
479  */
480  msg_t req(con.ctx(), std::ref(*(static_cast<rpc_cmd*>(this))));
481 
482  auto& payload = req.get_request().get_payload();
483  payload.enable_disable = 1;
484  payload.pid = getpid();
485 
486  VAPI_CALL(req.execute());
487 
488  wait();
489 
490  return (rc_t::OK);
491 }
492 
493 void
495 {
496  /*
497  * disable interface events.
498  */
499  msg_t req(con.ctx(), std::ref(*(static_cast<rpc_cmd*>(this))));
500 
501  auto& payload = req.get_request().get_payload();
502  payload.enable_disable = 0;
503  payload.pid = getpid();
504 
505  VAPI_CALL(req.execute());
506 
507  wait();
508 }
509 
510 void
512 {
513  m_listener.handle_interface_event(this);
514 }
515 
516 std::string
518 {
519  return ("itf-events");
520 }
521 
522 /**
523  * Interface statistics
524  */
526  const handle_t& handle)
527  : event_cmd(el.status())
528  , m_listener(el)
529  , m_swifindex(handle)
530 {
531 }
532 
533 bool
535 {
536  return (true);
537 }
538 
539 rc_t
541 {
542  /*
543  * First set the call back to handle the interface stats
544  */
545  m_reg.reset(new reg_t(con.ctx(), std::ref(*(static_cast<event_cmd*>(this)))));
546 
547  /*
548  * then send the request to enable them
549  */
550  msg_t req(con.ctx(), 1, std::ref(*(static_cast<rpc_cmd*>(this))));
551 
552  auto& payload = req.get_request().get_payload();
553  payload.enable_disable = 1;
554  payload.pid = getpid();
555  payload.num = 1;
556 
557  payload.sw_ifs[0] = m_swifindex.value();
558 
559  VAPI_CALL(req.execute());
560 
561  wait();
562 
563  return (rc_t::OK);
564 }
565 
566 void
568 {
569  /*
570  * disable interface stats.
571  */
572  msg_t req(con.ctx(), 1, std::ref(*(static_cast<rpc_cmd*>(this))));
573 
574  auto& payload = req.get_request().get_payload();
575  payload.enable_disable = 0;
576  payload.pid = getpid();
577  payload.num = 1;
578  payload.sw_ifs[0] = m_swifindex.value();
579 
580  VAPI_CALL(req.execute());
581 
582  wait();
583 }
584 
587 {
588  return m_listener;
589 }
590 
591 void
593 {
594  m_listener.status().set(rc);
595 }
596 
597 void
599 {
600  m_listener.handle_interface_stat(this);
601 }
602 
603 std::string
605 {
606  std::ostringstream s;
607  s << "itf-stats-enable itf:" << m_swifindex.to_string();
608  return (s.str());
609 }
610 
612  : rpc_cmd(m_res)
613  , m_swifindex(handle)
614 {
615 }
616 
617 bool
619 {
620  return (true);
621 }
622 
623 rc_t
625 {
626  /*
627  * then send the request to enable them
628  */
629  msg_t req(con.ctx(), 1, std::ref(*this));
630 
631  auto& payload = req.get_request().get_payload();
632  payload.enable_disable = 0;
633  payload.pid = getpid();
634  payload.num = 1;
635 
636  payload.sw_ifs[0] = m_swifindex.value();
637 
638  VAPI_CALL(req.execute());
639 
640  wait();
641 
642  return (rc_t::OK);
643 }
644 
645 std::string
647 {
648  std::ostringstream s;
649  s << "itf-stats-disable itf:" << m_swifindex.to_string();
650  return (s.str());
651 }
652 
654 {
655 }
656 
657 bool
658 dump_cmd::operator==(const dump_cmd& other) const
659 {
660  return (true);
661 }
662 
663 rc_t
665 {
666  m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
667 
668  auto& payload = m_dump->get_request().get_payload();
669  payload.name_filter_valid = 0;
670 
671  VAPI_CALL(m_dump->execute());
672 
673  wait();
674 
675  return rc_t::OK;
676 }
677 
678 std::string
680 {
681  return ("itf-dump");
682 }
683 
685 {
686 }
687 
688 bool
690 {
691  return (true);
692 }
693 
694 rc_t
696 {
697  m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
698 
699  VAPI_CALL(m_dump->execute());
700 
701  wait();
702 
703  return rc_t::OK;
704 }
705 
706 std::string
708 {
709  return ("vhost-itf-dump");
710 }
711 
712 set_tag::set_tag(HW::item<handle_t>& item, const std::string& name)
713  : rpc_cmd(item)
714  , m_name(name)
715 {
716 }
717 
718 rc_t
720 {
721  msg_t req(con.ctx(), std::ref(*this));
722 
723  auto& payload = req.get_request().get_payload();
724  payload.is_add = 1;
725  payload.sw_if_index = m_hw_item.data().value();
726  memcpy(payload.tag, m_name.c_str(), m_name.length());
727 
728  VAPI_CALL(req.execute());
729 
730  wait();
731 
732  return rc_t::OK;
733 }
734 std::string
736 {
737  std::ostringstream s;
738  s << "itf-set-tag: " << m_hw_item.to_string() << " name:" << m_name;
739 
740  return (s.str());
741 }
742 
743 bool
745 {
746  return ((m_name == o.m_name) && (m_hw_item.data() == o.m_hw_item.data()));
747 }
748 }; // namespace interface_cmds
749 }; // namespace VOM
750 
751 /*
752  * fd.io coding-style-patch-verification: ON
753  *
754  * Local Variables:
755  * eval: (c-set-style "mozilla")
756  * End:
757  */
bool operator==(const set_tag &i) const
Comparison operator - only used for UT.
rc_t issue(connection &con)
Issue the command to VPP/HW.
std::string to_string() const
convert to string format for debug purposes
static const rc_t NOOP
The HW write/update action was/has not been attempted.
Definition: types.hpp:107
void retire(connection &con)
Retires the command - unsubscribe from the events.
delete_cmd(HW::item< handle_t > &item, const std::string &name)
Definition: interface.hpp:340
HW::item< handle_t > & m_hw_item
A reference to an object&#39;s HW::item that the command will update.
Definition: rpc_cmd.hpp:135
bool operator==(const set_mac_cmd &i) const
Comparison operator - only used for UT.
std::string to_string() const
convert to string format for debug purposes
A command class represents our desire to recieve interface stats.
vhost_create_cmd(HW::item< handle_t > &item, const std::string &name, const std::string &tag)
rc_t issue(connection &con)
Issue the command to VPP/HW.
DEFINE_VAPI_MSG_IDS_AF_PACKET_API_JSON
int value() const
Return the value of the enum - same as integer conversion.
Definition: enum_base.hpp:67
std::string to_string() const
convert to string format for debug purposes
void remove_interface()
remove the deleted interface from the DB
Definition: interface.hpp:373
uint32_t value() const
get the value of the handle
Definition: types.cpp:96
set_tag(HW::item< handle_t > &item, const std::string &name)
Constructor taking the HW::item to update.
rc_t issue(connection &con)
Issue the command to VPP/HW.
std::string to_string() const
convert to string format for debug purposes
collect_detail_stats_change_cmd(HW::item< interface::stats_type_t > &item, const handle_t &h, bool enable)
Constructor taking the HW::item to update and the handle of the interface.
bool operator==(const set_table_cmd &i) const
Comparison operator - only used for UT.
void notify()
Called when it&#39;s time to poke the listeners.
rc_t issue(connection &con)
Issue the command to VPP/HW.
stats_disable_cmd(const handle_t &handle)
Constructor taking the listner to notify.
A command class to set tag on interfaces.
Error codes that VPP will return during a HW write.
Definition: types.hpp:90
std::string to_string() const
convert to string format for debug purposes
std::string to_string() const
convert to string format for debug purposes
An L3 protocol can be used to construct a prefix that is used to match packets are part of a route...
Definition: prefix.hpp:53
set_mac_cmd(HW::item< l2_address_t > &item, const HW::item< handle_t > &h)
Constructor taking the HW::item to update and the handle of the interface.
create_cmd(HW::item< handle_t > &item, const std::string &name)
Definition: interface.hpp:272
virtual void handle_interface_event(interface_cmds::events_cmd *cmd)=0
Virtual function called on the listener when the command has data ready to process.
A command class that enables detailed stats collection on an interface.
std::string to_string() const
convert to string format for debug purposes
std::string to_string() const
convert to string format for debug purposes
std::string to_string() const
convert to string format for debug purposes
Definition: hw.hpp:160
T & data()
Return the data read/written.
Definition: hw.hpp:108
rc_t issue(connection &con)
Issue the command to VPP/HW.
DEFINE_VAPI_MSG_IDS_VPE_API_JSON
std::string to_string() const
convert to string format for debug purposes
Definition: types.cpp:72
rc_t issue(connection &con)
Issue the command to VPP/HW.
std::string to_string() const
convert to string format for debug purposes
rc_t issue(connection &con)
Issue the command to VPP/HW.
A command class that changes the MAC address on an interface.
const std::string & m_name
The name of the interface to be created.
Definition: interface.hpp:330
dump_cmd()
Default Constructor.
A representation of the connection to VPP.
Definition: connection.hpp:33
bool operator==(const events_cmd &i) const
Comparison operator - only used for UT.
set_table_cmd(HW::item< route::table_id_t > &item, const l3_proto_t &proto, const HW::item< handle_t > &h)
Constructor taking the HW::item to update and the name handle of the interface whose table is to chan...
A class that listens to interface Stats.
Definition: interface.hpp:414
DEFINE_VAPI_MSG_IDS_VHOST_USER_API_JSON
std::string to_string() const
convert to string format for debug purposes
std::string to_string() const
convert to string format for debug purposes
tap_create_cmd(HW::item< handle_t > &item, const std::string &name)
Constructor taking the HW::item to update and the name of the interface to create.
rc_t issue(connection &con)
Issue the command to VPP/HW.
std::string to_string() const
convert to string format for debug purposes
state_change_cmd(HW::item< interface::admin_state_t > &s, const HW::item< handle_t > &h)
Constructor taking the HW::item to update and the name handle of the interface whose state is to chan...
rc_t issue(connection &con)
Issue the command to VPP/HW.
rc_t issue(connection &con)
Issue the command to VPP/HW.
HW::item< handle_t > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:64
A class that listens to interface Events.
Definition: interface.hpp:385
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:38
af_packet_delete_cmd(HW::item< handle_t > &item, const std::string &name)
Constructor taking the HW::item to update and the name of the interface to delete.
bool operator==(const stats_enable_cmd &i) const
Comparison operator - only used for UT.
#define VAPI_CALL(_stmt)
Convenince wrapper macro for error handling in VAPI sends.
Definition: types.hpp:29
A cmd class that changes the admin state.
std::string to_string() const
convert to string format for debug purposes
vhost_dump_cmd()
Default Constructor.
std::string to_string() const
convert to string format for debug purposes
af_packet_create_cmd(HW::item< handle_t > &item, const std::string &name)
Constructor taking the HW::item to update and the name of the interface to create.
A command class that binds an interface to an L3 table.
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
A command class represents our desire to recieve interface events.
stats_enable_cmd(interface::stat_listener &el, const handle_t &handle)
Constructor taking the listner to notify.
DEFINE_VAPI_MSG_IDS_STATS_API_JSON
std::unique_ptr< vapi::Event_registration< vapi::Sw_interface_event > > m_reg
The VAPI event registration.
Definition: event_cmd.hpp:100
A cmd class that Dumps all the Vpp Interfaces.
HW::item< bool > & status()
Return the HW::item representing the status.
Definition: interface.cpp:117
rc_t issue(connection &con)
Issue the command to VPP/HW.
std::string to_string() const
convert to string format for debug purposes
A type declaration of an interface handle in VPP.
Definition: types.hpp:236
vapi::Event_registration< vapi::Sw_interface_event > reg_t
Definition: event_cmd.hpp:59
rc_t issue(connection &con)
Issue the command to VPP/HW.
bool operator==(const vhost_dump_cmd &i) const
Comparison operator - only used for UT.
rc_t issue(connection &con)
Issue the command to VPP/HW.
static const rc_t OK
The HW write was successfull.
Definition: types.hpp:112
bool operator==(const state_change_cmd &i) const
Comparison operator - only used for UT.
void notify()
Called when it&#39;s time to poke the listeners.
DEFINE_VAPI_MSG_IDS_TAP_API_JSON
vhost_vring_state_t state
Definition: vhost-user.h:82
std::string to_string() const
convert to string format for debug purposes
const std::string m_name
The name of the interface to be created.
Definition: interface.hpp:379
loopback_delete_cmd(HW::item< handle_t > &item)
Constructor taking the HW::item to update.
A command class represents our desire to recieve interface stats.
vapi::Connection & ctx()
Retrun the VAPI context the commands will use.
Definition: connection.cpp:49
void to_bytes(uint8_t *array, uint8_t len) const
Convert to byte array.
Definition: types.cpp:143
rc_t issue(connection &con)
Issue the command to VPP/HW.
void insert_interface()
add the created interface to the DB
Definition: interface.hpp:303
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
DEFINE_VAPI_MSG_IDS_INTERFACE_API_JSON
void set(const rc_t &rc)
(re)set status
rc_t issue(connection &con)
Issue the command to VPP/HW.
void set(const rc_t &rc)
Set the HW return code - should only be called from the family of Command objects.
Definition: hw.hpp:124
tap_delete_cmd(HW::item< handle_t > &item)
Constructor taking the HW::item to update.
vhost_delete_cmd(HW::item< handle_t > &item, const std::string &name)
virtual void handle_interface_stat(interface_cmds::stats_enable_cmd *cmd)=0
Virtual function called on the listener when the command has data ready to process.
interface::stat_listener & listener() const
get listener
An Event command base class.
Definition: event_cmd.hpp:39
rc_t issue(connection &con)
Issue the command to VPP/HW.
const std::string & to_string() const
convert to string format for debug purposes
Definition: enum_base.hpp:36
void retire(connection &con)
Retires the command - unsubscribe from the stats.
rc_t issue(connection &con)
Issue the command to VPP/HW.
events_cmd(interface::event_listener &el)
Constructor taking the listner to notify.
std::string to_string() const
convert to string format for debug purposes
A cmd class that Dumps all the Vpp interfaces.
std::string to_string() const
convert to string format for debug purposes
mac_address_t to_mac() const
MAC address conversion.
Definition: types.cpp:219
loopback_create_cmd(HW::item< handle_t > &item, const std::string &name)
Constructor taking the HW::item to update and the name of the interface to create.
bool operator==(const stats_disable_cmd &i) const
Comparison operator - only used for UT.
bool operator==(const collect_detail_stats_change_cmd &i) const
Comparison operator - only used for UT.
HW::item< handle_t > wait()
Wait on the commands promise.
Definition: rpc_cmd.hpp:89
bool is_ipv6()
Definition: prefix.cpp:35
rc_t issue(connection &con)
Issue the command to VPP/HW.