21 singular_db<l3_binding::key_t, l3_binding> l3_binding::m_db;
23 l3_binding::event_handler l3_binding::m_evh;
29 : m_itf(itf.singular())
31 , m_binding(true,
rc_t::NOOP)
38 , m_binding(o.m_binding)
47 m_db.release(
key(),
this);
53 return ((m_pfx == l.m_pfx) && (*m_itf == *l.m_itf));
59 return (make_pair(m_itf->key(), m_pfx));
108 std::ostringstream s;
109 s <<
"L3-binding:[" << m_itf->to_string() <<
" prefix:" << m_pfx.
to_string()
129 std::shared_ptr<l3_binding>
130 l3_binding::find_or_add(
const l3_binding& temp)
132 return (m_db.find_or_add(temp.
key(), temp));
135 std::shared_ptr<l3_binding>
138 return (m_db.find(k));
141 std::shared_ptr<l3_binding>
144 return find_or_add(*
this);
156 os <<
"[" << key.first <<
", " << key.second <<
"]";
161 std::deque<std::shared_ptr<l3_binding>>
169 std::deque<std::shared_ptr<l3_binding>> l3s;
171 auto it = m_db.begin();
173 while (it != m_db.end()) {
178 auto key = it->first;
180 if (i.
key() ==
key.first) {
181 l3s.push_back(it->second.lock());
190 l3_binding::event_handler::event_handler()
197 l3_binding::event_handler::handle_replay()
211 l3_binding::event_handler::order()
const A functor class that binds the L3 config to the interface.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
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.