|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
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)
63 : m_itf(itf.singular())
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));
117 HW::enqueue(
new l2_binding_cmds::bind_cmd(m_binding, m_itf->handle(),
118 m_bd->id(), m_port_type));
123 new l2_vtr_cmds::set_cmd(m_vtr_op, m_itf->handle(), m_vtr_op_tag));
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)) {
167 HW::enqueue(
new l2_binding_cmds::unbind_cmd(m_binding, m_itf->handle(),
168 m_bd->id(), m_port_type));
170 HW::enqueue(
new l2_binding_cmds::bind_cmd(m_binding, m_itf->handle(),
171 m_bd->id(), m_port_type));
177 if (m_vtr_op.
update(desired.m_vtr_op)) {
179 new l2_vtr_cmds::set_cmd(m_vtr_op, m_itf->handle(), m_vtr_op_tag));
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
A base class for all object_base in the VPP object_base-Model.
A cmd class that Unbinds L2 configuration from an interface.
static rc_t write()
Write/Execute all commands hitherto enqueued.
const static type_t BVI
A brideged Virtual interface (aka SVI or IRB)
void set(const rc_t &rc)
Set the HW return code - should only be called from the family of Command objects.
l2_port_type_t(const l2_port_type_t &l)=default
The VPP Object Model (VOM) library.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
const static rc_t OK
The HW write was successfull.
const key_t & key() const
Return the binding's key.
const static rc_t UNSET
The value un-set.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
static bool register_listener(listener *listener)
Register a listener of events.
binding< l2_list > l2_binding
Typedef the L2 binding type.
interface::key_t key_t
Key type for an L2 binding in the singular DB.
A representation of an interface in VPP.
const static rc_t NOOP
The HW write/update action was/has not been attempted.
const typedef std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
static void enqueue(cmd *f)
Enqueue A command for execution.
std::string to_string() const
convert to string format for debug purposes
A functor class that binds L2 configuration to an interface.
const std::string & to_string() const
convert to string format for debug purposes
rc_t rc() const
Get the HW return code.
bool operator==(const l2_binding &l) const
Comparison operator - for UT.
static void dump(std::ostream &os)
Dump all l2_bindings into the stream provided.
const static l2_port_type_t L2_PORT_TYPE_NORMAL
l2_binding(const interface &itf, const bridge_domain &bd)
Construct a new object matching the desried state.
std::string to_string() const
convert to string format for debug purposes
const static handle_t INVALID
A value of an interface handle_t that means the itf does not exist.
static std::shared_ptr< l2_binding > find(const key_t &key)
Static function to find the bridge_domain in the model.
const static l2_port_type_t L2_PORT_TYPE_BVI
@ BINDING
Then L2/objects that bind to interfaces, BD, ACLS, etc.
bool update(const item &desired)
update the item to the desired state.
Error codes that VPP will return during a HW write.
void event_handler(void *tls_async)
const static 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.
void set(const l2_vtr::option_t &op, uint16_t tag)
Set the VTR operation on the binding/interface.
A Clas representing the binding of an L2 interface to a bridge-domain and the properties of that bind...