FD.io VPP  v21.10.1-2-g0a485f517
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 
23 
24 namespace VOM {
25 namespace interface_cmds {
26 
28  const std::string& name)
29  : create_cmd(item, name)
30 {
31 }
32 
33 rc_t
35 {
36  msg_t req(con.ctx(), std::ref(*this));
37 
38  auto& payload = req.get_request().get_payload();
39 
40  payload.user_instance = ~0;
41 
42  VAPI_CALL(req.execute());
43 
44  wait();
45 
46  if (m_hw_item.rc() == rc_t::OK) {
48  }
49 
50  return rc_t::OK;
51 }
54 {
55  std::ostringstream s;
56  s << "bvi-itf-create: " << m_hw_item.to_string() << " name:" << m_name;
57 
58  return (s.str());
59 }
60 
62  const std::string& name)
63  : create_cmd(item, name)
64 {
65 }
66 
67 rc_t
69 {
70  msg_t req(con.ctx(), std::ref(*this));
71 
72  VAPI_CALL(req.execute());
73 
74  wait();
75 
76  if (m_hw_item.rc() == rc_t::OK) {
78  }
79 
80  return rc_t::OK;
81 }
84 {
85  std::ostringstream s;
86  s << "loopback-itf-create: " << m_hw_item.to_string() << " name:" << m_name;
87 
88  return (s.str());
89 }
90 
92  const std::string& name)
93  : create_cmd(item, name)
94 {
95 }
96 
97 rc_t
99 {
100  msg_t req(con.ctx(), std::ref(*this));
101 
102  auto& payload = req.get_request().get_payload();
103 
104  payload.use_random_hw_addr = 1;
105  memset(payload.host_if_name, 0, sizeof(payload.host_if_name));
106  memcpy(payload.host_if_name, m_name.c_str(),
107  std::min(m_name.length(), sizeof(payload.host_if_name)));
108 
109  VAPI_CALL(req.execute());
110 
111  wait();
112 
113  if (m_hw_item.rc() == rc_t::OK) {
115  }
116 
117  return rc_t::OK;
118 }
121 {
122  std::ostringstream s;
123  s << "af-packet-itf-create: " << m_hw_item.to_string() << " name:" << m_name;
124 
125  return (s.str());
126 }
127 
129  const std::string& name,
130  const std::string& tag)
131  : create_cmd(item, name)
132  , m_tag(tag)
133 {
134 }
135 
136 rc_t
138 {
139  msg_t req(con.ctx(), std::ref(*this));
140 
141  auto& payload = req.get_request().get_payload();
142  memset(payload.sock_filename, 0, sizeof(payload.sock_filename));
143  memcpy(payload.sock_filename, m_name.c_str(),
144  std::min(m_name.length(), sizeof(payload.sock_filename)));
145  memset(payload.tag, 0, sizeof(payload.tag));
146 
147  if (!m_tag.empty())
148  memcpy(payload.tag, m_tag.c_str(),
149  std::min(m_tag.length(), sizeof(payload.tag)));
150 
151  payload.is_server = 0;
152  payload.use_custom_mac = 0;
153  payload.renumber = 0;
154 
155  VAPI_CALL(req.execute());
156 
157  wait();
158 
159  if (m_hw_item.rc() == rc_t::OK) {
161  }
162 
163  return rc_t::OK;
164 }
165 
168 {
169  std::ostringstream s;
170  s << "vhost-intf-create: " << m_hw_item.to_string() << " name:" << m_name
171  << " tag:" << m_tag;
172 
173  return (s.str());
174 }
175 
177  : delete_cmd(item)
178 {
179 }
180 
181 rc_t
183 {
184  msg_t req(con.ctx(), std::ref(*this));
185 
186  auto& payload = req.get_request().get_payload();
187  payload.sw_if_index = m_hw_item.data().value();
188 
189  VAPI_CALL(req.execute());
190 
191  wait();
193 
195  return rc_t::OK;
196 }
197 
200 {
201  std::ostringstream s;
202  s << "bvi-itf-delete: " << m_hw_item.to_string();
203 
204  return (s.str());
205 }
206 
208  : delete_cmd(item)
209 {
210 }
211 
212 rc_t
214 {
215  msg_t req(con.ctx(), std::ref(*this));
216 
217  auto& payload = req.get_request().get_payload();
218  payload.sw_if_index = m_hw_item.data().value();
219 
220  VAPI_CALL(req.execute());
221 
222  wait();
224 
226  return rc_t::OK;
227 }
228 
231 {
232  std::ostringstream s;
233  s << "loopback-itf-delete: " << m_hw_item.to_string();
234 
235  return (s.str());
236 }
237 
239  const std::string& name)
240  : delete_cmd(item, name)
241 {
242 }
243 
244 rc_t
246 {
247  msg_t req(con.ctx(), std::ref(*this));
248 
249  auto& payload = req.get_request().get_payload();
250  memset(payload.host_if_name, 0, sizeof(payload.host_if_name));
251  memcpy(payload.host_if_name, m_name.c_str(),
252  std::min(m_name.length(), sizeof(payload.host_if_name)));
253 
254  VAPI_CALL(req.execute());
255 
256  wait();
258 
260  return rc_t::OK;
261 }
264 {
265  std::ostringstream s;
266  s << "af_packet-itf-delete: " << m_hw_item.to_string();
267 
268  return (s.str());
269 }
270 
272  const std::string& name)
273  : delete_cmd(item, name)
274 {
275 }
276 
277 rc_t
279 {
280  msg_t req(con.ctx(), std::ref(*this));
281 
282  auto& payload = req.get_request().get_payload();
283  payload.sw_if_index = m_hw_item.data().value();
284 
285  VAPI_CALL(req.execute());
286 
287  wait();
289 
290  return rc_t::OK;
291 }
294 {
295  std::ostringstream s;
296  s << "vhost-itf-delete: " << m_hw_item.to_string() << " name:" << m_name;
297 
298  return (s.str());
299 }
300 
302  const HW::item<handle_t>& hdl)
303  : rpc_cmd(state)
304  , m_hdl(hdl)
305 {
306 }
307 
308 bool
310 {
311  return ((m_hdl == other.m_hdl) && (m_hw_item == other.m_hw_item));
312 }
313 
314 rc_t
316 {
317  msg_t req(con.ctx(), std::ref(*this));
318 
319  auto& payload = req.get_request().get_payload();
320  payload.sw_if_index = m_hdl.data().value();
321  payload.flags = (vapi_enum_if_status_flags)m_hw_item.data().value();
322 
323  VAPI_CALL(req.execute());
324 
325  return (wait());
326 }
327 
330 {
331  std::ostringstream s;
332  s << "itf-state-change: " << m_hw_item.to_string()
333  << " hdl:" << m_hdl.to_string();
334  return (s.str());
335 }
336 
338  const l3_proto_t& proto,
339  const HW::item<handle_t>& hdl)
340  : rpc_cmd(table)
341  , m_hdl(hdl)
342  , m_proto(proto)
343 {
344 }
345 
346 bool
348 {
349  return ((m_hdl == other.m_hdl) && (m_proto == other.m_proto) &&
350  (m_hw_item == other.m_hw_item));
351 }
352 
353 rc_t
355 {
356  msg_t req(con.ctx(), std::ref(*this));
357 
358  auto& payload = req.get_request().get_payload();
359  payload.sw_if_index = m_hdl.data().value();
360  payload.is_ipv6 = m_proto.is_ipv6();
361  payload.vrf_id = m_hw_item.data();
362 
363  VAPI_CALL(req.execute());
364 
365  return (wait());
366 }
367 
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  return (wait());
403 }
404 
407 {
408  std::ostringstream s;
409  s << "itf-set-mac: " << m_hw_item.to_string() << " hdl:" << m_hdl.to_string();
410  return (s.str());
411 }
412 
415  const handle_t& hdl,
416  bool enable)
417  : rpc_cmd(item)
418  , m_hdl(hdl)
419  , m_enable(enable)
420 {
421 }
422 
423 bool
425  const collect_detail_stats_change_cmd& other) const
426 {
427  return ((m_hdl == other.m_hdl) && (m_hw_item == other.m_hw_item) &&
428  (m_enable == other.m_enable));
429 }
430 
431 rc_t
433 {
434  msg_t req(con.ctx(), std::ref(*this));
435 
436  auto& payload = req.get_request().get_payload();
437  payload.sw_if_index = m_hdl.value();
438  payload.enable_disable = m_enable;
439 
440  VAPI_CALL(req.execute());
441 
442  return (wait());
443 }
444 
447 {
448  std::ostringstream s;
449  s << "itf-stats: " << m_hw_item.to_string() << " hdl:" << m_hdl.to_string();
450  return (s.str());
451 }
452 
454  : event_cmd(el.status())
455  , m_listener(el)
456 {
457 }
458 
459 bool
461 {
462  return (true);
463 }
464 
465 rc_t
467 {
468  /*
469  * First set the call back to handle the interface events
470  */
471  m_reg.reset(new reg_t(con.ctx(), std::ref(*(static_cast<event_cmd*>(this)))));
472 
473  /*
474  * then send the request to enable them
475  */
476  msg_t req(con.ctx(), std::ref(*(static_cast<rpc_cmd*>(this))));
477 
478  auto& payload = req.get_request().get_payload();
479  payload.enable_disable = 1;
480  payload.pid = getpid();
481 
482  VAPI_CALL(req.execute());
483 
484  wait();
485 
486  return (rc_t::OK);
487 }
488 
489 void
491 {
492  /*
493  * disable interface events.
494  */
495  msg_t req(con.ctx(), std::ref(*(static_cast<rpc_cmd*>(this))));
496 
497  auto& payload = req.get_request().get_payload();
498  payload.enable_disable = 0;
499  payload.pid = getpid();
500 
501  VAPI_CALL(req.execute());
502 
503  wait();
504 }
505 
506 void
508 {
509  std::lock_guard<interface_cmds::events_cmd> lg(*this);
510  std::vector<interface::event> events;
511 
512  for (auto& msg : *this) {
513  auto& payload = msg.get_payload();
514 
515  handle_t handle(payload.sw_if_index);
516  std::shared_ptr<interface> sp = interface::find(handle);
517 
518  if (sp) {
521 
522  VOM_LOG(log_level_t::DEBUG) << "Interface Event: " << sp->to_string()
523  << " state: " << oper_state.to_string();
524 
525  sp->set(oper_state);
526  events.push_back({ *sp, oper_state });
527  }
528  }
529 
530  flush();
531 
532  m_listener.handle_interface_event(events);
533 }
534 
537 {
538  return ("itf-events");
539 }
540 
542 {
543 }
544 
545 bool
546 dump_cmd::operator==(const dump_cmd& other) const
547 {
548  return (true);
549 }
550 
551 rc_t
553 {
554  m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
555 
556  auto& payload = m_dump->get_request().get_payload();
557  payload.name_filter_valid = 0;
558 
559  VAPI_CALL(m_dump->execute());
560 
561  wait();
562 
563  return rc_t::OK;
564 }
565 
568 {
569  return ("itf-dump");
570 }
571 
573 {
574 }
575 
576 bool
578 {
579  return (true);
580 }
581 
582 rc_t
584 {
585  m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
586 
587  VAPI_CALL(m_dump->execute());
588 
589  wait();
590 
591  return rc_t::OK;
592 }
593 
596 {
597  return ("vhost-itf-dump");
598 }
599 
600 bool
602 {
603  return (true);
604 }
605 
606 rc_t
608 {
609  m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
610 
611  VAPI_CALL(m_dump->execute());
612 
613  wait();
614 
615  return rc_t::OK;
616 }
617 
620 {
621  return ("af-packet-itf-dump");
622 }
623 
625  : rpc_cmd(item)
626  , m_name(name)
627 {
628 }
629 
630 rc_t
632 {
633  msg_t req(con.ctx(), std::ref(*this));
634 
635  auto& payload = req.get_request().get_payload();
636  payload.is_add = 1;
637  payload.sw_if_index = m_hw_item.data().value();
638  memset(payload.tag, 0, sizeof(payload.tag));
639  memcpy(payload.tag, m_name.c_str(), m_name.length());
640 
641  VAPI_CALL(req.execute());
642 
643  return (wait());
644 }
647 {
648  std::ostringstream s;
649  s << "itf-set-tag: " << m_hw_item.to_string() << " name:" << m_name;
650 
651  return (s.str());
652 }
653 
654 bool
656 {
657  return ((m_name == o.m_name) && (m_hw_item.data() == o.m_hw_item.data()));
658 }
659 }; // namespace interface_cmds
660 }; // namespace VOM
661 
662 /*
663  * fd.io coding-style-patch-verification: OFF
664  *
665  * Local Variables:
666  * eval: (c-set-style "mozilla")
667  * End:
668  */
VOM::interface_cmds::loopback_create_cmd::loopback_create_cmd
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.
Definition: interface_cmds.cpp:61
VOM::interface_cmds::bvi_create_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:34
VOM::interface_cmds::af_packet_dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:619
VOM::HW::item< handle_t >
VOM::interface_cmds::set_table_cmd
A command class that binds an interface to an L3 table.
Definition: interface_cmds.hpp:292
VOM::interface_cmds::bvi_delete_cmd::bvi_delete_cmd
bvi_delete_cmd(HW::item< handle_t > &item)
Constructor taking the HW::item to update.
Definition: interface_cmds.cpp:176
VOM::interface_cmds::bvi_create_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:53
VOM::dump_cmd< vapi::Sw_interface_dump >::msg_t
vapi::Sw_interface_dump msg_t
Definition: dump_cmd.hpp:46
mac
vl_api_mac_address_t mac
Definition: l2.api:559
VOM::l2_address_t::to_mac
mac_address_t to_mac() const
MAC address conversion.
Definition: types.cpp:216
VOM::rpc_cmd< HW::item< handle_t >, vapi::Bvi_create >::wait
rc_t wait()
Wait on the commands promise.
Definition: rpc_cmd.hpp:82
VOM::HW::item::set
void set(const rc_t &rc)
Set the HW return code - should only be called from the family of Command objects.
Definition: hw.hpp:125
VOM::interface_cmds::dump_cmd
A cmd class that Dumps all the Vpp interfaces.
Definition: interface_cmds.hpp:456
VOM::interface::oper_state_t::from_int
static oper_state_t from_int(uint8_t val)
Convert VPP's numerical value to enum type.
Definition: interface_types.cpp:104
VOM::interface_cmds::events_cmd::operator==
bool operator==(const events_cmd &i) const
Comparison operator - only used for UT.
Definition: interface_cmds.cpp:460
VOM::interface_cmds::set_tag
A command class to set tag on interfaces.
Definition: interface_cmds.hpp:223
VOM::interface_cmds::vhost_create_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:137
VOM_LOG
#define VOM_LOG(lvl)
Definition: logger.hpp:181
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
IF_STATUS_API_FLAG_LINK_UP
@ IF_STATUS_API_FLAG_LINK_UP
Definition: interface_types.api:23
VOM::interface_cmds::vhost_create_cmd::vhost_create_cmd
vhost_create_cmd(HW::item< handle_t > &item, const std::string &name, const std::string &tag)
Definition: interface_cmds.cpp:128
VOM::rc_t::OK
const static rc_t OK
The HW write was successfull.
Definition: types.hpp:109
name
string name[64]
Definition: fib.api:25
VOM::interface_cmds::set_tag::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:631
VOM::interface_cmds::dump_cmd::dump_cmd
dump_cmd()
Default Constructor.
Definition: interface_cmds.cpp:541
VOM::interface_cmds::set_mac_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:406
VOM::interface_cmds::collect_detail_stats_change_cmd
A command class that enables detailed stats collection on an interface.
Definition: interface_cmds.hpp:369
VOM::interface_cmds::vhost_dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:595
VOM::interface_cmds::set_table_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:354
VOM::event_cmd< vapi::Want_interface_events, vapi::Sw_interface_event >::reg_t
vapi::Event_registration< vapi::Sw_interface_event > reg_t
Definition: event_cmd.hpp:59
VOM::handle_t::value
uint32_t value() const
get the value of the handle
Definition: types.cpp:93
VOM::interface_cmds::af_packet_create_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:120
VOM::interface_cmds::loopback_delete_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:213
VOM::interface_cmds::loopback_delete_cmd::loopback_delete_cmd
loopback_delete_cmd(HW::item< handle_t > &item)
Constructor taking the HW::item to update.
Definition: interface_cmds.cpp:207
VOM::rpc_cmd
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
VOM::interface_cmds::loopback_create_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:68
VOM::interface_cmds::set_table_cmd::operator==
bool operator==(const set_table_cmd &i) const
Comparison operator - only used for UT.
Definition: interface_cmds.cpp:347
VOM::interface_cmds::set_mac_cmd::operator==
bool operator==(const set_mac_cmd &i) const
Comparison operator - only used for UT.
Definition: interface_cmds.cpp:385
VOM::interface::event_listener
A class that listens to interface Events.
Definition: interface.hpp:436
state
vl_api_dhcp_client_state_t state
Definition: dhcp.api:201
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::interface_cmds::events_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:466
VOM::interface_cmds::vhost_dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:583
VOM::interface_cmds::af_packet_dump_cmd
A cmd class that Dumps all the Vpp interfaces.
Definition: interface_cmds.hpp:508
cmd.hpp
VOM::interface::delete_cmd< vapi::Af_packet_delete >::m_name
const std::string m_name
The name of the interface to be created.
Definition: interface.hpp:418
VOM::interface_cmds::af_packet_delete_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:263
interface_cmds.hpp
DEFINE_VAPI_MSG_IDS_INTERFACE_API_JSON
DEFINE_VAPI_MSG_IDS_INTERFACE_API_JSON
Definition: interface_cmds.cpp:20
VOM::rpc_cmd< HW::item< handle_t >, vapi::Bvi_create >::m_hw_item
HW::item< handle_t > & m_hw_item
A reference to an object's HW::item that the command will update.
Definition: rpc_cmd.hpp:134
VOM::dump_cmd< vapi::Sw_interface_dump >::m_dump
std::unique_ptr< vapi::Sw_interface_dump > m_dump
The VAPI event registration.
Definition: dump_cmd.hpp:143
VOM::interface_cmds::af_packet_dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:607
VOM::interface_cmds::vhost_dump_cmd::vhost_dump_cmd
vhost_dump_cmd()
Default Constructor.
Definition: interface_cmds.cpp:572
VOM::interface::create_cmd< vapi::Bvi_create >::insert_interface
void insert_interface()
add the created interface to the DB
Definition: interface.hpp:343
VOM::interface_cmds::events_cmd
A command class represents our desire to recieve interface events.
Definition: interface_cmds.hpp:412
VOM::enum_base::value
int value() const
Return the value of the enum - same as integer conversion.
Definition: enum_base.hpp:88
VAPI_CALL
#define VAPI_CALL(_stmt)
Convenince wrapper macro for error handling in VAPI sends.
Definition: types.hpp:29
VOM::interface_cmds::bvi_delete_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:199
VOM::event_cmd
An Event command base class.
Definition: event_cmd.hpp:39
VOM::interface_cmds::collect_detail_stats_change_cmd::collect_detail_stats_change_cmd
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.
Definition: interface_cmds.cpp:413
VOM::interface_cmds::state_change_cmd::state_change_cmd
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...
Definition: interface_cmds.cpp:301
VOM::interface_cmds::set_tag::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:646
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::interface_cmds::vhost_delete_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:278
VOM::interface_cmds::set_tag::operator==
bool operator==(const set_tag &i) const
Comparison operator - only used for UT.
Definition: interface_cmds.cpp:655
VOM::mac_address_t::to_bytes
void to_bytes(uint8_t *array, uint8_t len) const
Convert to byte array.
Definition: types.cpp:140
VOM::interface_cmds::state_change_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:329
VOM::interface_cmds::set_tag::set_tag
set_tag(HW::item< handle_t > &item, const std::string &name)
Constructor taking the HW::item to update.
Definition: interface_cmds.cpp:624
VOM::dump_cmd< vapi::Sw_interface_dump >::wait
rc_t wait()
Wait for the issue of the command to complete.
Definition: dump_cmd.hpp:93
VOM::interface_cmds::events_cmd::notify
void notify()
Called when it's time to poke the listeners.
Definition: interface_cmds.cpp:507
VOM::interface_cmds::events_cmd::retire
void retire(connection &con)
Retires the command - unsubscribe from the events.
Definition: interface_cmds.cpp:490
VOM::interface_cmds::bvi_create_cmd::bvi_create_cmd
bvi_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.
Definition: interface_cmds.cpp:27
VOM::interface_cmds::set_mac_cmd::set_mac_cmd
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.
Definition: interface_cmds.cpp:377
VOM::rc_t::NOOP
const static rc_t NOOP
The HW write/update action was/has not been attempted.
Definition: types.hpp:104
VOM::interface_cmds::set_table_cmd::set_table_cmd
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...
Definition: interface_cmds.cpp:337
events
static perfmon_event_t events[]
Definition: core.c:21
VOM::interface_cmds::set_mac_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:391
VOM::handle_t
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
VOM::interface_cmds::af_packet_delete_cmd::af_packet_delete_cmd
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.
Definition: interface_cmds.cpp:238
VOM::interface_cmds::collect_detail_stats_change_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:446
VOM::HW::item::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: hw.hpp:161
VOM::log_level_t::DEBUG
const static log_level_t DEBUG
Definition: logger.hpp:32
VOM::interface_cmds::state_change_cmd::operator==
bool operator==(const state_change_cmd &i) const
Comparison operator - only used for UT.
Definition: interface_cmds.cpp:309
VOM::interface_cmds::bvi_delete_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:182
DEFINE_VAPI_MSG_IDS_VPE_API_JSON
DEFINE_VAPI_MSG_IDS_VPE_API_JSON
Definition: interface_cmds.cpp:19
VOM::l3_proto_t::is_ipv6
bool is_ipv6() const
Definition: prefix.cpp:35
VOM::interface_cmds::set_mac_cmd
A command class that changes the MAC address on an interface.
Definition: interface_cmds.hpp:334
VOM::event_cmd< vapi::Want_interface_events, vapi::Sw_interface_event >::m_reg
std::unique_ptr< vapi::Event_registration< vapi::Sw_interface_event > > m_reg
The VAPI event registration.
Definition: event_cmd.hpp:100
VOM::interface_cmds::af_packet_dump_cmd::operator==
bool operator==(const af_packet_dump_cmd &i) const
Comparison operator - only used for UT.
Definition: interface_cmds.cpp:601
VOM::rpc_cmd< HW::item< handle_t >, vapi::Bvi_create >::msg_t
vapi::Bvi_create msg_t
convenient typedef
Definition: rpc_cmd.hpp:46
VOM::enum_base::to_string
const std::string & to_string() const
convert to string format for debug purposes
Definition: enum_base.hpp:36
VOM::interface_cmds::loopback_create_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:83
VOM::interface_cmds::collect_detail_stats_change_cmd::operator==
bool operator==(const collect_detail_stats_change_cmd &i) const
Comparison operator - only used for UT.
Definition: interface_cmds.cpp:424
VOM::HW::item::rc
rc_t rc() const
Get the HW return code.
Definition: hw.hpp:119
VOM::HW::item::data
T & data()
Return the data read/written.
Definition: hw.hpp:109
VOM::interface::delete_cmd< vapi::Bvi_delete >::remove_interface
void remove_interface()
remove the deleted interface from the DB
Definition: interface.hpp:412
VOM::l3_proto_t
An L3 protocol can be used to construct a prefix that is used to match packets are part of a route.
Definition: prefix.hpp:52
VOM::handle_t::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: types.cpp:69
VOM::interface_cmds::set_table_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:369
VOM::interface_cmds::vhost_dump_cmd
A cmd class that Dumps all the Vpp Interfaces.
Definition: interface_cmds.hpp:482
VOM::interface_cmds::vhost_create_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:167
VOM::interface_cmds::af_packet_create_cmd::af_packet_create_cmd
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.
Definition: interface_cmds.cpp:91
VOM::interface::event_listener::handle_interface_event
virtual void handle_interface_event(std::vector< event > es)=0
Virtual function called on the listener when the command has data ready to process.
DEFINE_VAPI_MSG_IDS_AF_PACKET_API_JSON
DEFINE_VAPI_MSG_IDS_AF_PACKET_API_JSON
Definition: interface_cmds.cpp:21
VOM::event_cmd< vapi::Want_interface_events, vapi::Sw_interface_event >::flush
void flush()
flush/free all the events thus far reeived.
Definition: event_cmd.hpp:75
VOM::interface::oper_state_t
The oper state of the interface.
Definition: interface.hpp:164
VOM::interface_cmds::vhost_delete_cmd::vhost_delete_cmd
vhost_delete_cmd(HW::item< handle_t > &item, const std::string &name)
Definition: interface_cmds.cpp:271
VOM::interface_cmds::dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:567
item
cJSON * item
Definition: cJSON.h:222
DEFINE_VAPI_MSG_IDS_VHOST_USER_API_JSON
DEFINE_VAPI_MSG_IDS_VHOST_USER_API_JSON
Definition: interface_cmds.cpp:22
VOM::interface_cmds::state_change_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:315
VOM::interface_cmds::af_packet_create_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:98
VOM::interface::create_cmd< vapi::Bvi_create >::m_name
const std::string & m_name
The name of the interface to be created.
Definition: interface.hpp:369
VOM::interface_cmds::af_packet_delete_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:245
VOM::interface_cmds::state_change_cmd
A cmd class that changes the admin state.
Definition: interface_cmds.hpp:257
VOM::interface_cmds::dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:552
VOM::interface_cmds::dump_cmd::operator==
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
Definition: interface_cmds.cpp:546
VOM::rc_t
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
VOM::interface_cmds::collect_detail_stats_change_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_cmds.cpp:432
VOM::interface_cmds::events_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:536
VOM::interface_cmds::vhost_dump_cmd::operator==
bool operator==(const vhost_dump_cmd &i) const
Comparison operator - only used for UT.
Definition: interface_cmds.cpp:577
VOM::interface_cmds::vhost_delete_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:293
VOM::interface_cmds::loopback_delete_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: interface_cmds.cpp:230
VOM::interface_cmds::events_cmd::events_cmd
events_cmd(interface::event_listener &el)
Constructor taking the listner to notify.
Definition: interface_cmds.cpp:453
VOM::interface::find
static std::shared_ptr< interface > find(const handle_t &h)
The the singular instance of the interface in the DB by handle.
Definition: interface.cpp:538
string
const char *const string
Definition: cJSON.h:172