25 singular_db<l2_binding::key_t, l2_binding> l2_binding::m_db;
29 const l2_binding::l2_port_type_t
34 const l2_binding::l2_port_type_t
46 : m_itf(itf.singular())
50 , m_vtr_op(l2_vtr::option_t::DISABLED,
rc_t::
UNSET)
65 , m_port_type(port_type)
67 , m_vtr_op(l2_vtr::option_t::DISABLED,
rc_t::
UNSET)
75 , m_port_type(o.m_port_type)
77 , m_vtr_op(o.m_vtr_op)
78 , m_vtr_op_tag(o.m_vtr_op_tag)
85 return (m_itf->key());
91 return ((*m_itf == *l.m_itf) && (*m_bd == *l.m_bd) &&
92 (m_port_type == l.m_port_type));
95 std::shared_ptr<l2_binding>
98 return (m_db.find(key));
106 m_bd->id(), m_port_type));
118 m_bd->id(), m_port_type));
132 m_db.release(m_itf->key(),
this);
138 std::ostringstream s;
139 s <<
"L2-binding:[" << m_itf->to_string() <<
" " << m_bd->to_string() <<
" " 162 m_bd->id(), m_port_type));
163 }
else if (!(*m_bd == *desired.m_bd)) {
168 m_bd->id(), m_port_type));
171 m_bd->id(), m_port_type));
177 if (m_vtr_op.
update(desired.m_vtr_op)) {
183 std::shared_ptr<l2_binding>
184 l2_binding::find_or_add(
const l2_binding& temp)
186 return (m_db.find_or_add(temp.m_itf->key(), temp));
189 std::shared_ptr<l2_binding>
192 return find_or_add(*
this);
208 l2_binding::event_handler::handle_replay()
222 l2_binding::event_handler::order()
const binding< l2_list > l2_binding
Typedef the L2 binding type.
bool operator==(const l2_binding &l) const
Comparison operator - for UT.
static const rc_t NOOP
The HW write/update action was/has not been attempted.
A Clas representing the binding of an L2 interface to a bridge-domain and the properties of that bind...
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.
bool update(const item &desired)
update the item to the desired state.
std::shared_ptr< l2_binding > singular() const
Return the 'singular instance' of the L2 config that matches this object.
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.
rc_t rc() const
Get the HW return code.
Error codes that VPP will return during a HW write.
static std::shared_ptr< l2_binding > find(const key_t &key)
Static function to find the bridge_domain in the model.
static const l2_port_type_t L2_PORT_TYPE_NORMAL
static const handle_t INVALID
A value of an interface handle_t that means the itf does not exist.
std::string to_string() const
convert to string format for debug purposes
const key_t & key() const
Return the binding's key.
A functor class that binds L2 configuration to an interface.
void set(const l2_vtr::option_t &op, uint16_t tag)
Set the VTR operation on the binding/interface.
std::string to_string() const
convert to string format for debug purposes
interface::key_t key_t
Key type for an L2 binding in the singular DB.
static const l2_port_type_t L2_PORT_TYPE_UU_FWD
A representation of an interface in VPP.
A base class for all object_base in the VPP object_base-Model.
const std::string & to_string() const
convert to string format for debug purposes
static const l2_port_type_t L2_PORT_TYPE_BVI
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 ...
A cmd class that Unbinds L2 configuration from an interface.
static const rc_t OK
The HW write was successfull.
static void enqueue(cmd *f)
Enqueue A command for execution.
l2_port_type_t(const l2_port_type_t &l)=default
A cmd class sets the VTR operation.
Then L2/objects that bind to interfaces, BD, ACLS, etc.
The VPP Object Model (VOM) library.
static const rc_t UNSET
The value un-set.
void set(const rc_t &rc)
Set the HW return code - should only be called from the family of Command objects.
static const type_t BVI
A brideged Virtual interface (aka SVI or IRB)
l2_binding(const interface &itf, const bridge_domain &bd)
Construct a new object matching the desried state.
static void dump(std::ostream &os)
Dump all l2_bindings into the stream provided.
static bool register_listener(listener *listener)
Register a listener of events.