FD.io VPP  v18.10-32-g1161dda
Vector Packet Processing
interface.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.hpp"
20 #include "vom/interface_cmds.hpp"
22 #include "vom/l3_binding_cmds.hpp"
23 #include "vom/logger.hpp"
24 #include "vom/prefix.hpp"
27 
28 namespace VOM {
29 /**
30  * A DB of all the interfaces, key on the name
31  */
32 singular_db<interface::key_t, interface> interface::m_db;
33 
34 /**
35  * A DB of all the interfaces, key on VPP's handle
36  */
37 std::map<handle_t, std::weak_ptr<interface>> interface::m_hdl_db;
38 
39 interface::event_handler interface::m_evh;
40 
41 /**
42  * Construct a new object matching the desried state
43  */
44 interface::interface(const std::string& name,
45  interface::type_t itf_type,
46  interface::admin_state_t itf_state,
47  const std::string& tag)
48  : m_hdl(handle_t::INVALID)
49  , m_name(name)
50  , m_type(itf_type)
51  , m_state(itf_state)
52  , m_table_id(route::DEFAULT_TABLE)
53  , m_l2_address(l2_address_t::ZERO, rc_t::UNSET)
54  , m_stats_type(stats_type_t::NORMAL)
55  , m_oper(oper_state_t::DOWN)
56  , m_tag(tag)
57 {
58 }
59 
60 interface::interface(const std::string& name,
61  interface::type_t itf_type,
62  interface::admin_state_t itf_state,
63  const route_domain& rd,
64  const std::string& tag)
65  : m_hdl(handle_t::INVALID)
66  , m_name(name)
67  , m_type(itf_type)
68  , m_rd(rd.singular())
69  , m_state(itf_state)
70  , m_table_id(m_rd->table_id())
71  , m_l2_address(l2_address_t::ZERO, rc_t::UNSET)
72  , m_stats_type(stats_type_t::NORMAL)
73  , m_oper(oper_state_t::DOWN)
74  , m_tag(tag)
75 {
76 }
77 
79  : m_hdl(o.m_hdl)
80  , m_name(o.m_name)
81  , m_type(o.m_type)
82  , m_rd(o.m_rd)
83  , m_state(o.m_state)
84  , m_table_id(o.m_table_id)
85  , m_l2_address(o.m_l2_address)
86  , m_stats_type(o.m_stats_type)
87  , m_oper(o.m_oper)
88  , m_tag(o.m_tag)
89 {
90 }
91 
92 bool
94 {
95  return ((key() == i.key()) &&
96  (m_l2_address.data() == i.m_l2_address.data()) &&
97  (m_state == i.m_state) && (m_rd == i.m_rd) && (m_type == i.m_type) &&
98  (m_oper == i.m_oper));
99 }
100 
102  : m_status(rc_t::NOOP)
103 {
104 }
105 
108 {
109  return (m_status);
110 }
111 
113  : m_status(rc_t::NOOP)
114 {
115 }
116 
119 {
120  return (m_status);
121 }
122 
123 /**
124  * Return the interface type
125  */
126 const interface::type_t&
128 {
129  return (m_type);
130 }
131 
132 const handle_t&
134 {
135  return (singular()->handle_i());
136 }
137 
138 const handle_t&
139 interface::handle_i() const
140 {
141  return (m_hdl.data());
142 }
143 
144 const l2_address_t&
146 {
147  return (m_l2_address.data());
148 }
149 
152 {
153  return m_db.begin();
154 }
155 
158 {
159  return m_db.end();
160 }
161 
162 void
164 {
165  if (m_table_id && (m_table_id.data() != route::DEFAULT_TABLE)) {
166  m_table_id.data() = route::DEFAULT_TABLE;
167  HW::enqueue(
169  HW::enqueue(
171  }
172 
173  if (m_stats) {
174  if (stats_type_t::DETAILED == m_stats_type) {
176  m_stats_type, handle_i(), false));
177  }
179  m_stats.reset();
180  }
181 
182  // If the interface is up, bring it down
183  if (m_state && interface::admin_state_t::UP == m_state.data()) {
184  m_state.data() = interface::admin_state_t::DOWN;
186  }
187 
188  if (m_hdl) {
189  std::queue<cmd*> cmds;
190  HW::enqueue(mk_delete_cmd(cmds));
191  }
192  HW::write();
193 }
194 
195 void
196 interface::replay()
197 {
198  if (m_hdl) {
199  std::queue<cmd*> cmds;
200  HW::enqueue(mk_create_cmd(cmds));
201  }
202 
203  if (m_state && interface::admin_state_t::UP == m_state.data()) {
205  }
206 
207  if (m_stats) {
208  if (stats_type_t::DETAILED == m_stats_type) {
209  m_stats_type.set(rc_t::NOOP);
211  m_stats_type, handle_i(), true));
212  }
213  stat_listener& listener = m_stats->listener();
214  listener.status().set(rc_t::NOOP);
215  m_stats.reset(new interface_cmds::stats_enable_cmd(listener, handle_i()));
216  HW::enqueue(m_stats);
217  }
218 
219  if (m_table_id && (m_table_id.data() != route::DEFAULT_TABLE)) {
220  HW::enqueue(
222  HW::enqueue(
224  }
225 }
226 
228 {
229  sweep();
230  release();
231 }
232 
233 void
235 {
236  // not in the DB anymore.
237  m_db.release(m_name, this);
238 }
239 
240 std::string
242 {
243  std::ostringstream s;
244  s << "interface:[" << m_name << " type:" << m_type.to_string()
245  << " hdl:" << m_hdl.to_string() << " l2-address:["
246  << m_l2_address.to_string() << "]";
247 
248  if (m_rd) {
249  s << " rd:" << m_rd->to_string();
250  }
251 
252  s << " admin-state:" << m_state.to_string()
253  << " oper-state:" << m_oper.to_string();
254 
255  if (!m_tag.empty()) {
256  s << " tag:[" << m_tag << "]";
257  }
258 
259  s << "]";
260 
261  return (s.str());
262 }
263 
264 const std::string&
266 {
267  return (m_name);
268 }
269 
270 const interface::key_t&
272 {
273  return (name());
274 }
275 
276 std::queue<cmd*>&
277 interface::mk_create_cmd(std::queue<cmd*>& q)
278 {
279  if ((type_t::LOOPBACK == m_type) || (type_t::BVI == m_type)) {
280  q.push(new interface_cmds::loopback_create_cmd(m_hdl, m_name));
281  q.push(new interface_cmds::set_tag(m_hdl, m_name));
282  /*
283  * set the m_tag for pretty-print
284  */
285  m_tag = m_name;
286  } else if (type_t::AFPACKET == m_type) {
287  q.push(new interface_cmds::af_packet_create_cmd(m_hdl, m_name));
288  if (!m_tag.empty())
289  q.push(new interface_cmds::set_tag(m_hdl, m_tag));
290  } else if (type_t::TAP == m_type || type_t::TAPV2 == m_type) {
291  if (!m_tag.empty())
292  q.push(new interface_cmds::set_tag(m_hdl, m_tag));
293  } else if (type_t::VHOST == m_type) {
294  q.push(new interface_cmds::vhost_create_cmd(m_hdl, m_name, m_tag));
295  } else {
296  m_hdl.set(rc_t::OK);
297  }
298 
299  return (q);
300 }
301 
302 std::queue<cmd*>&
303 interface::mk_delete_cmd(std::queue<cmd*>& q)
304 {
305  if ((type_t::LOOPBACK == m_type) || (type_t::BVI == m_type)) {
307  } else if (type_t::AFPACKET == m_type) {
308  q.push(new interface_cmds::af_packet_delete_cmd(m_hdl, m_name));
309  } else if (type_t::VHOST == m_type) {
310  q.push(new interface_cmds::vhost_delete_cmd(m_hdl, m_name));
311  }
312 
313  return (q);
314 }
315 
316 void
317 interface::update(const interface& desired)
318 {
319  /*
320  * the desired state is always that the interface should be created
321  */
322  if (rc_t::OK != m_hdl.rc()) {
323  std::queue<cmd*> cmds;
324  HW::enqueue(mk_create_cmd(cmds));
325  /*
326  * interface create now, so we can barf early if it fails
327  */
328  HW::write();
329  }
330 
331  /*
332  * If the interface is not created do other commands should be issued
333  */
334  if (rc_t::OK != m_hdl.rc())
335  return;
336 
337  /*
338  * change the interface state to that which is deisred
339  */
340  if (m_state.update(desired.m_state)) {
342  }
343 
344  /*
345  * change the interface state to that which is deisred
346  */
347  if (m_l2_address.update(desired.m_l2_address)) {
348  HW::enqueue(new interface_cmds::set_mac_cmd(m_l2_address, m_hdl));
349  }
350 
351  /*
352  * If the interface is mapped into a route domain, set VPP's
353  * table ID
354  */
355  if (m_rd != desired.m_rd) {
356  /*
357  * changing route domains. need to remove all L3 bindings, swap the table
358  * then reapply the bindings.
359  */
360  auto it = l3_binding::cbegin();
361 
362  while (it != l3_binding::cend()) {
363  if (it->second.lock()->itf().key() == key())
364  it->second.lock()->sweep();
365  ++it;
366  }
367  m_rd = desired.m_rd;
368  m_table_id.update(m_rd ? m_rd->table_id() : route::DEFAULT_TABLE);
369  HW::enqueue(
371  HW::enqueue(
373  HW::write();
374 
375  it = l3_binding::cbegin();
376  while (it != l3_binding::cend()) {
377  if (it->second.lock()->itf().key() == key())
378  it->second.lock()->replay(); //(*it->second.lock());
379  ++it;
380  }
381  } else if (!m_table_id && m_rd) {
382  HW::enqueue(
384  HW::enqueue(
386  }
387 }
388 
389 void
391 {
392  m_state = state;
393 }
394 
395 void
397 {
398  assert(rc_t::UNSET == m_l2_address.rc());
399  m_l2_address.set(rc_t::NOOP);
400  m_l2_address.update(addr);
401 }
402 
403 void
405 {
406  m_hdl = hdl;
407 }
408 
409 void
411 {
412  m_oper = state;
413 }
414 
415 void
416 interface::set(const std::string& tag)
417 {
418  m_tag = tag;
419 }
420 
421 void
422 interface::enable_stats_i(interface::stat_listener& el, const stats_type_t& st)
423 {
424  if (!m_stats) {
425  if (stats_type_t::DETAILED == st) {
426  m_stats_type = st;
428  m_stats_type, handle_i(), true));
429  }
430  m_stats.reset(new interface_cmds::stats_enable_cmd(el, handle_i()));
431  HW::enqueue(m_stats);
432  HW::write();
433  }
434 }
435 
436 void
438 {
439  singular()->enable_stats_i(el, st);
440 }
441 
442 std::shared_ptr<interface>
444 {
445  return (m_db.find_or_add(key(), *this));
446 }
447 
448 std::shared_ptr<interface>
450 {
451  return singular_i();
452 }
453 
454 std::shared_ptr<interface>
456 {
457  return (m_db.find(k));
458 }
459 
460 std::shared_ptr<interface>
462 {
463  return (m_hdl_db[handle].lock());
464 }
465 
466 void
468 {
469  std::shared_ptr<interface> sp = find(key);
470 
471  if (sp && item) {
472  m_hdl_db[item.data()] = sp;
473  }
474 }
475 
476 void
478 {
479  m_hdl_db.erase(item.data());
480 }
481 
482 void
483 interface::dump(std::ostream& os)
484 {
485  db_dump(m_db, os);
486 }
487 
488 void
489 interface::event_handler::handle_populate(const client_db::key_t& key)
490 {
491  /*
492  * dump VPP vhost-user interfaces
493  */
494  std::shared_ptr<interface_cmds::vhost_dump_cmd> vcmd =
495  std::make_shared<interface_cmds::vhost_dump_cmd>();
496 
497  HW::enqueue(vcmd);
498  HW::write();
499 
500  for (auto& vhost_itf_record : *vcmd) {
501  std::shared_ptr<interface> vitf =
503  vhost_itf_record.get_payload());
504  VOM_LOG(log_level_t::DEBUG) << " vhost-dump: " << vitf->to_string();
505  OM::commit(key, *vitf);
506  }
507 
508  /*
509  * dump VPP af-packet interfaces
510  */
511  std::shared_ptr<interface_cmds::af_packet_dump_cmd> afcmd =
512  std::make_shared<interface_cmds::af_packet_dump_cmd>();
513 
514  HW::enqueue(afcmd);
515  HW::write();
516 
517  for (auto& af_packet_itf_record : *afcmd) {
518  std::shared_ptr<interface> afitf =
520  af_packet_itf_record.get_payload());
521  VOM_LOG(log_level_t::DEBUG) << " af_packet-dump: " << afitf->to_string();
522  OM::commit(key, *afitf);
523  }
524 
525  /*
526  * dump VPP tap interfaces
527  */
528  std::shared_ptr<tap_interface_cmds::tap_dump_cmd> tapcmd =
529  std::make_shared<tap_interface_cmds::tap_dump_cmd>();
530 
531  HW::enqueue(tapcmd);
532  HW::write();
533 
534  for (auto& tap_record : *tapcmd) {
535  std::shared_ptr<tap_interface> tapitf =
536  interface_factory::new_tap_interface(tap_record.get_payload());
537  VOM_LOG(log_level_t::DEBUG) << "tap-dump: " << tapitf->to_string();
538 
539  /*
540  * Write each of the discovered interfaces into the OM,
541  * but disable the HW Command q whilst we do, so that no
542  * commands are sent to VPP
543  */
544  OM::commit(key, *tapitf);
545  }
546 
547  /*
548  * dump VPP tapv2 interfaces
549  */
550  std::shared_ptr<tap_interface_cmds::tapv2_dump_cmd> tapv2cmd =
551  std::make_shared<tap_interface_cmds::tapv2_dump_cmd>();
552 
553  HW::enqueue(tapv2cmd);
554  HW::write();
555 
556  for (auto& tapv2_record : *tapv2cmd) {
557  std::shared_ptr<tap_interface> tapv2itf =
558  interface_factory::new_tap_v2_interface(tapv2_record.get_payload());
559  VOM_LOG(log_level_t::DEBUG) << "tapv2-dump: " << tapv2itf->to_string();
560 
561  /*
562  * Write each of the discovered interfaces into the OM,
563  * but disable the HW Command q whilst we do, so that no
564  * commands are sent to VPP
565  */
566  OM::commit(key, *tapv2itf);
567  }
568 
569  /*
570  * dump VPP interfaces
571  */
572  std::shared_ptr<interface_cmds::dump_cmd> cmd =
573  std::make_shared<interface_cmds::dump_cmd>();
574 
575  HW::enqueue(cmd);
576  HW::write();
577 
578  for (auto& itf_record : *cmd) {
579  auto payload = itf_record.get_payload();
580  VOM_LOG(log_level_t::DEBUG) << "dump: [" << payload.sw_if_index
581  << " name:" << (char*)payload.interface_name
582  << " tag:" << (char*)payload.tag << "]";
583 
584  std::shared_ptr<interface> itf = interface_factory::new_interface(payload);
585 
586  if (itf && interface::type_t::LOCAL != itf->type()) {
587  VOM_LOG(log_level_t::DEBUG) << "dump: " << itf->to_string();
588  /*
589  * Write each of the discovered interfaces into the OM,
590  * but disable the HW Command q whilst we do, so that no
591  * commands are sent to VPP
592  */
593  OM::commit(key, *itf);
594 
595  /**
596  * Get the address configured on the interface
597  */
598  std::shared_ptr<l3_binding_cmds::dump_v4_cmd> dcmd =
599  std::make_shared<l3_binding_cmds::dump_v4_cmd>(
600  l3_binding_cmds::dump_v4_cmd(itf->handle()));
601 
602  HW::enqueue(dcmd);
603  HW::write();
604 
605  for (auto& l3_record : *dcmd) {
606  auto& payload = l3_record.get_payload();
607  const route::prefix_t pfx(payload.is_ipv6, payload.ip,
608  payload.prefix_length);
609 
610  VOM_LOG(log_level_t::DEBUG) << "dump: " << pfx.to_string();
611 
612  l3_binding l3(*itf, pfx);
613  OM::commit(key, l3);
614  }
615  }
616  }
617 
618  /*
619  * dump VPP bond interfaces
620  */
621  std::shared_ptr<bond_interface_cmds::dump_cmd> bcmd =
622  std::make_shared<bond_interface_cmds::dump_cmd>();
623 
624  HW::enqueue(bcmd);
625  HW::write();
626 
627  for (auto& bond_itf_record : *bcmd) {
628  std::shared_ptr<bond_interface> bond_itf =
629  interface_factory::new_bond_interface(bond_itf_record.get_payload());
630 
631  VOM_LOG(log_level_t::DEBUG) << " bond-dump:" << bond_itf->to_string();
632 
633  /*
634  * Write each of the discovered interfaces into the OM,
635  * but disable the HW Command q whilst we do, so that no
636  * commands are sent to VPP
637  */
638  OM::commit(key, *bond_itf);
639 
640  std::shared_ptr<bond_group_binding_cmds::dump_cmd> scmd =
641  std::make_shared<bond_group_binding_cmds::dump_cmd>(
642  bond_group_binding_cmds::dump_cmd(bond_itf->handle()));
643 
644  HW::enqueue(scmd);
645  HW::write();
646 
648 
649  for (auto& slave_itf_record : *scmd) {
651  slave_itf_record.get_payload());
652 
653  VOM_LOG(log_level_t::DEBUG) << " slave-dump:" << slave_itf.to_string();
654 
655  /*
656  * Write each of the discovered interfaces into the OM,
657  * but disable the HW Command q whilst we do, so that no
658  * commands are sent to VPP
659  */
660  // OM::commit(slave_itf->key(), *slave_itf);
661  enslaved_itfs.insert(slave_itf);
662  }
663 
664  if (!enslaved_itfs.empty()) {
665  bond_group_binding bid(*bond_itf, enslaved_itfs);
666  /*
667  * Write each of the discovered interfaces into the OM,
668  * but disable the HW Command q whilst we do, so that no
669  * commands are sent to VPP
670  */
671  OM::commit(key, bid);
672  }
673  }
674 }
675 
677 {
678  OM::register_listener(this);
679  inspect::register_handler({ "interface", "intf" }, "interfaces", this);
680 }
681 
682 void
683 interface::event_handler::handle_replay()
684 {
685  m_db.replay();
686 }
687 
689 interface::event_handler::order() const
690 {
691  return (dependency_t::INTERFACE);
692 }
693 
694 void
695 interface::event_handler::show(std::ostream& os)
696 {
697  db_dump(m_db, os);
698 }
699 
700 } // namespace VOM
701 
702 /*
703  * fd.io coding-style-patch-verification: ON
704  *
705  * Local Variables:
706  * eval: (c-set-style "mozilla")
707  * End:
708  */
static const rc_t NOOP
The HW write/update action was/has not been attempted.
Definition: types.hpp:99
void release()
release/remove an interface form the singular store
Definition: interface.cpp:234
A command class represents our desire to recieve interface stats.
virtual ~interface()
Destructor.
Definition: interface.cpp:227
static void dump(std::ostream &os)
Dump all interfaces into the stream provided.
Definition: interface.cpp:483
interface(const std::string &name, type_t type, admin_state_t state, const std::string &tag="")
Construct a new object matching the desried state.
Definition: interface.cpp:44
#define VOM_LOG(lvl)
Definition: logger.hpp:181
static const type_t AFPACKET
AF-Packet interface type.
Definition: interface.hpp:88
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
Definition: client_db.hpp:51
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:461
HW::item< handle_t > m_hdl
The SW interface handle VPP has asigned to the interface.
Definition: interface.hpp:487
virtual void sweep(void)
Sweep/reap the object if still stale.
Definition: interface.cpp:163
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
Definition: inspect.cpp:85
int i
void set(const admin_state_t &state)
Set the admin state of the interface.
Definition: interface.cpp:390
static rc_t write()
Write/Execute all commands hitherto enqueued.
Definition: hw.cpp:236
HW::item< bool > & status()
Return the HW::item representing the status.
Definition: interface.cpp:107
A command class to set tag on interfaces.
Error codes that VPP will return during a HW write.
Definition: types.hpp:84
static const log_level_t DEBUG
Definition: logger.hpp:32
static const_iterator_t cbegin()
Definition: l3_binding.cpp:94
static const stats_type_t DETAILED
Definition: interface.hpp:46
A representation of bond interface binding.
A cmd class that Dumps slave itfs.
vhost_vring_addr_t addr
Definition: vhost_user.h:121
A bond-member.
Definition: bond_member.hpp:26
A command class that enables detailed stats collection on an interface.
#define assert(x)
Definition: dlmalloc.c:30
std::string to_string() const
convert to string format for debug purposes
Definition: hw.hpp:160
const handle_t & handle() const
Return VPP&#39;s handle to this object.
Definition: interface.cpp:133
The oper state of the interface.
Definition: interface.hpp:168
Type def of a L2 address as read from VPP.
Definition: types.hpp:334
A route-domain is a VRF.
T & data()
Return the data read/written.
Definition: hw.hpp:108
static const_iterator_t cbegin()
Definition: interface.cpp:151
static singular_db< key_t, interface > m_db
A map of all interfaces key against the interface&#39;s name.
Definition: interface.hpp:519
static std::shared_ptr< interface > new_af_packet_interface(const vapi_payload_af_packet_details &vd)
static const type_t LOCAL
Local interface type (specific to VPP)
Definition: interface.hpp:96
vhost_vring_state_t state
Definition: vhost_user.h:120
A command class that changes the MAC address on an interface.
rc_t rc() const
Get the HW return code.
Definition: hw.hpp:118
static const l3_proto_t IPV4
Definition: prefix.hpp:55
static const_iterator_t cend()
Definition: l3_binding.cpp:100
static const l3_proto_t IPV6
Definition: prefix.hpp:56
HW::item< bool > m_status
The status of the subscription.
Definition: interface.hpp:421
static const table_id_t DEFAULT_TABLE
The table-id for the default table.
Definition: prefix.hpp:87
virtual std::queue< cmd * > & mk_create_cmd(std::queue< cmd * > &cmds)
Virtual functions to construct an interface create commands.
Definition: interface.cpp:277
std::string to_string() const
convert to string format for debug purposes
Definition: prefix.cpp:183
static void remove(const HW::item< handle_t > &item)
remove an interface from the DB keyed on handle
Definition: interface.cpp:477
event_listener()
Default Constructor.
Definition: interface.cpp:101
const l2_address_t & l2_address() const
Return the L2 Address.
Definition: interface.cpp:145
A class that listens to interface Stats.
Definition: interface.hpp:427
stat_listener()
Default Constructor.
Definition: interface.cpp:112
virtual bool operator==(const interface &i) const
Comparison operator - only used for UT.
Definition: interface.cpp:93
static std::shared_ptr< interface > new_interface(const vapi_payload_sw_interface_details &vd)
Factory method to construct a new interface from the VPP record.
u8 name[64]
Definition: memclnt.api:151
void enable_stats(stat_listener &el, const stats_type_t &st=stats_type_t::NORMAL)
Enable stats for this interface.
Definition: interface.cpp:437
A command class to create Loopback interfaces in VPP.
static std::shared_ptr< interface > new_vhost_user_interface(const vapi_payload_sw_interface_vhost_user_details &vd)
A cmd class that changes the admin state.
static void add(const key_t &name, const HW::item< handle_t > &item)
Add an interface to the DB keyed on handle.
Definition: interface.cpp:467
std::set< bond_member > enslaved_itf_t
The container type for enslaved itfs.
A command class that binds an interface to an L3 table.
static bond_member new_bond_member_interface(const vapi_payload_sw_interface_slave_details &vd)
The admin state of the interface.
Definition: interface.hpp:142
static std::shared_ptr< tap_interface > new_tap_v2_interface(const vapi_payload_sw_interface_tap_v2_details &vd)
A representation of an interface in VPP.
Definition: interface.hpp:41
HW::item< bool > & status()
Return the HW::item representing the status.
Definition: interface.cpp:118
A command class to create af_packet interfaces in VPP.
A type declaration of an interface handle in VPP.
Definition: types.hpp:228
A functor class that deletes a Vhost interface.
std::shared_ptr< interface > singular() const
Return the matching&#39;singular&#39; of the interface.
Definition: interface.cpp:449
static rc_t commit(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
Definition: om.hpp:202
void event_handler(void *tls_async)
Definition: tls_async.c:339
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
Definition: types.hpp:43
static const rc_t OK
The HW write was successfull.
Definition: types.hpp:104
const std::string & name() const
Return the interface type.
Definition: interface.cpp:265
static void enqueue(cmd *f)
Enqueue A command for execution.
Definition: hw.cpp:194
virtual std::shared_ptr< interface > singular_i() const
Return the matching &#39;singular&#39; of the interface.
Definition: interface.cpp:443
A cmd class that Dumps all the IPv4 L3 configs.
A command class represents our desire to recieve interface stats.
An interface type.
Definition: interface.hpp:67
virtual std::queue< cmd * > & mk_delete_cmd(std::queue< cmd * > &cmds)
Virtual functions to construct an interface delete commands.
Definition: interface.cpp:303
A command class to delete af-packet interfaces in VPP.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
A command class to delete loopback interfaces in VPP.
static const admin_state_t UP
Admin UP state.
Definition: interface.hpp:151
A representation of a method call to VPP.
Definition: cmd.hpp:32
static const rc_t UNSET
The value un-set.
Definition: types.hpp:94
Definition: hash.c:490
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
static const type_t BVI
A brideged Virtual interface (aka SVI or IRB)
Definition: interface.hpp:76
HW::item< bool > m_status
The status of the subscription.
Definition: interface.hpp:451
A functor class that creates an interface.
void show(char *chroot_path, int verbose)
Definition: svmtool.c:105
static const admin_state_t DOWN
Admin DOWN state.
Definition: interface.hpp:147
A representation of L3 configuration on an interface.
Definition: l3_binding.hpp:30
static const type_t TAP
TAP interface type.
Definition: interface.hpp:100
static const_iterator_t cend()
Definition: interface.cpp:157
std::string to_string(void) const
convert to string
Definition: bond_member.cpp:49
singular_db< const std::string, interface >::const_iterator const_iterator_t
The iterator type.
Definition: interface.hpp:62
static const type_t TAPV2
TAPv2 interface type.
Definition: interface.hpp:105
virtual std::string to_string(void) const
convert to string format for debug purposes
Definition: interface.cpp:241
static const type_t LOOPBACK
loopback interface type
Definition: interface.hpp:92
std::string key_t
The key for interface&#39;s key.
Definition: interface.hpp:56
static std::shared_ptr< tap_interface > new_tap_interface(const vapi_payload_sw_interface_tap_details &vd)
static const type_t VHOST
vhost-user interface type
Definition: interface.hpp:110
const type_t & type() const
Return the interface type.
Definition: interface.cpp:127
static bool register_listener(listener *listener)
Register a listener of events.
Definition: om.cpp:127
A prefix defintion.
Definition: prefix.hpp:92
const key_t & key() const
Return the interface type.
Definition: interface.cpp:271
static std::shared_ptr< bond_interface > new_bond_interface(const vapi_payload_sw_interface_bond_details &vd)
interfaces are the root of the dependency graph