24 singular_db<l2_binding::key_t, l2_binding> l2_binding::m_db;
58 const l2_binding::l2_port_type_t
63 const l2_binding::l2_port_type_t
75 : m_itf(itf.singular())
94 , m_port_type(port_type)
104 , m_port_type(o.m_port_type)
106 , m_vtr_op(o.m_vtr_op)
107 , m_vtr_op_tag(o.m_vtr_op_tag)
114 return (m_itf->key());
120 return ((*m_itf == *l.m_itf) && (*m_bd == *l.m_bd) &&
121 (m_port_type == l.m_port_type));
124 std::shared_ptr<l2_binding>
127 return (m_db.find(key));
135 m_bd->id(), m_port_type));
147 m_bd->id(), m_port_type));
161 m_db.release(m_itf->key(),
this);
167 std::ostringstream s;
168 s <<
"L2-binding:[" << m_itf->to_string() <<
" " << m_bd->to_string() <<
" " 191 m_bd->id(), m_port_type));
192 }
else if (!(*m_bd == *desired.m_bd)) {
197 m_bd->id(), m_port_type));
200 m_bd->id(), m_port_type));
206 if (m_vtr_op.update(desired.m_vtr_op)) {
212 std::shared_ptr<l2_binding>
213 l2_binding::find_or_add(
const l2_binding& temp)
215 return (m_db.find_or_add(temp.m_itf->key(), temp));
218 std::shared_ptr<l2_binding>
221 return find_or_add(*
this);
237 l2_binding::event_handler::handle_replay()
251 l2_binding::event_handler::order()
const binding< l2_list > l2_binding
Typedef the L2 binding type.
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.
static const l2_vtr_op_t L2_VTR_PUSH_1
static const l2_vtr_op_t L2_VTR_POP_1
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
static const l2_vtr_op_t L2_VTR_DISABLED
static const l2_vtr_op_t L2_VTR_TRANSLATE_1_2
static rc_t write()
Write/Execute all commands hitherto enqueued.
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
bool operator==(const l2_binding &l) const
Comparison operator - for UT.
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
static const l2_vtr_op_t L2_VTR_PUSH_2
A functor class that binds L2 configuration to an interface.
rc_t rc() const
Get the HW return code.
std::string to_string() const
convert to string format for debug purposes
const key_t & key() const
Return the binding's key.
static const l2_vtr_op_t L2_VTR_TRANSLATE_2_1
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
std::shared_ptr< l2_binding > singular() const
Return the 'singular instance' of the L2 config that matches this object.
A representation of an interface in VPP.
A base class for all object_base in the VPP object_base-Model.
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
void set(const l2_vtr_op_t &op, uint16_t tag)
Set the VTR operation on the binding/interface.
Then L2/objects that bind to interfaces, BD, ACLS, etc.
static const l2_vtr_op_t L2_VTR_TRANSLATE_2_2
The VPP Object Model (VOM) library.
static const rc_t UNSET
The value un-set.
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.
l2_vtr_op_t(const l2_vtr_op_t &l)=default
static const l2_vtr_op_t L2_VTR_TRANSLATE_1_1
A cmd class sets the VTR operation.
const std::string & to_string() const
convert to string format for debug purposes
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.
static const l2_vtr_op_t L2_VTR_POP_2