20 singular_db<l3_binding::key_t, l3_binding> l3_binding::m_db;
22 l3_binding::event_handler l3_binding::m_evh;
28 : m_itf(itf.singular())
30 , m_binding(true,
rc_t::NOOP)
37 , m_binding(o.m_binding)
46 m_db.release(
key(),
this);
52 return ((m_pfx == l.m_pfx) && (*m_itf == *l.m_itf));
58 return (make_pair(m_itf->key(), m_pfx));
107 std::ostringstream s;
108 s <<
"L3-binding:[" << m_itf->to_string() <<
" prefix:" << m_pfx.
to_string()
128 std::shared_ptr<l3_binding>
129 l3_binding::find_or_add(
const l3_binding& temp)
131 return (m_db.find_or_add(temp.
key(), temp));
134 std::shared_ptr<l3_binding>
137 return (m_db.find(k));
140 std::shared_ptr<l3_binding>
143 return find_or_add(*
this);
155 os <<
"[" << key.first <<
", " << key.second <<
"]";
160 std::deque<std::shared_ptr<l3_binding>>
168 std::deque<std::shared_ptr<l3_binding>> l3s;
170 auto it = m_db.cbegin();
172 while (it != m_db.cend()) {
177 auto key = it->first;
179 if (i.
key() ==
key.first) {
180 l3s.push_back(it->second.lock());
189 l3_binding::event_handler::event_handler()
196 l3_binding::event_handler::handle_replay()
210 l3_binding::event_handler::order()
const sll srl srl sll sra u16x4 i
A functor class that binds the L3 config to the interface.
const interface & itf() const
Return the interface associated with this L3 binding.
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
static rc_t write()
Write/Execute all commands hitherto enqueued.
Error codes that VPP will return during a HW write.
static const_iterator_t cbegin()
std::string to_string() const
convert to string format for debug purposes
static const_iterator_t cend()
std::string to_string() const
convert to string format for debug purposes
const route::prefix_t & prefix() const
Return the prefix associated with this L3 binding.
static void dump(std::ostream &os)
Dump all l3_bindings into the stream provided.
std::string to_string() const
convert to string format for debug purposes
singular_db< key_t, l3_binding >::const_iterator const_iterator_t
The iterator type.
std::shared_ptr< l3_binding > singular() const
Return the 'singular instance' of the L3-Config that matches this object.
A representation of an interface in VPP.
bool operator==(const l3_binding &l) const
Comparison operator.
A cmd class that Unbinds L3 Config from an interface.
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
static void enqueue(cmd *f)
Enqueue A command for execution.
l3_binding(const interface &itf, const route::prefix_t &pfx)
Construct a new object matching the desried state.
const key_t key() const
Get the object's key.
std::ostream & operator<<(std::ostream &os, const std::pair< direction_t, interface::key_t > &key)
Then L2/objects that bind to interfaces, BD, ACLS, etc.
std::pair< interface::key_t, route::prefix_t > key_t
The key type for l3_bindings.
The VPP Object Model (VOM) library.
static std::deque< std::shared_ptr< l3_binding > > find(const interface &i)
Find all bindings in the DB for the interface passed.
A representation of L3 configuration on an interface.
static bool register_listener(listener *listener)
Register a listener of events.
const key_t & key() const
Return the interface type.