21 singular_db<l3_binding::key_t, l3_binding> l3_binding::m_db;
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 <<
"]";
168 l3_binding::event_handler::handle_replay()
182 l3_binding::event_handler::order()
const bool operator==(const l3_binding &l) const
Comparison operator.
A functor class that binds the L3 config to the interface.
static std::shared_ptr< l3_binding > find(const key_t &k)
Find a binding from its key.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
std::string to_string() const
convert to string format for debug purposes
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
const interface & itf() const
Return the interface associated with this L3 binding.
static const_iterator_t cend()
const key_t key() const
Get the object's key.
static void dump(std::ostream &os)
Dump all l3_bindings into the stream provided.
singular_db< key_t, l3_binding >::const_iterator const_iterator_t
The iterator type.
A representation of an interface in VPP.
A cmd class that Unbinds L3 Config from an interface.
void event_handler(void *tls_async)
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.
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.
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.
A representation of L3 configuration on an interface.
std::shared_ptr< l3_binding > singular() const
Return the 'singular instance' of the L3-Config that matches this object.
static bool register_listener(listener *listener)
Register a listener of events.