|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
24 singular_db<interface_span::key_t, interface_span> interface_span::m_db;
31 : m_itf_from(itf_from.singular())
32 , m_itf_to(itf_to.singular())
39 : m_itf_from(o.m_itf_from)
40 , m_itf_to(o.m_itf_to)
42 , m_config(o.m_config)
51 m_db.release(make_pair(m_itf_from->key(), m_itf_to->key()),
this);
55 interface_span::sweep()
59 m_config, m_itf_from->handle(), m_itf_to->handle()));
71 interface_span::replay()
75 m_config, m_itf_from->handle(), m_itf_to->handle(), m_state));
83 s <<
"Itf Span-config:"
84 <<
" itf-from:" << m_itf_from->to_string()
85 <<
" itf-to:" << m_itf_to->to_string() <<
" state:" << m_state.
to_string();
95 m_config, m_itf_from->handle(), m_itf_to->handle(), m_state));
102 os <<
"[" <<
key.first <<
", " <<
key.second <<
"]";
107 std::shared_ptr<interface_span>
108 interface_span::find_or_add(
const interface_span& temp)
110 return (m_db.find_or_add(
111 make_pair(temp.m_itf_from->key(), temp.m_itf_to->key()), temp));
114 std::shared_ptr<interface_span>
117 return find_or_add(*
this);
128 interface_span::event_handler::handle_replay()
136 std::shared_ptr<interface_span_cmds::dump_cmd> cmd =
137 std::make_shared<interface_span_cmds::dump_cmd>();
142 for (
auto& record : *cmd) {
143 auto& payload = record.get_payload();
145 std::shared_ptr<interface> itf_from =
147 std::shared_ptr<interface> itf_to =
interface::find(payload.sw_if_index_to);
149 interface_span itf_span(*itf_from, *itf_to,
150 state_t::from_int(payload.state));
153 << itf_to->to_string()
154 << state_t::from_int(payload.state).to_string();
166 interface_span::event_handler::order()
const
186 interface_span::state_t::state_t(
int v,
const std::string& s)
187 : enum_base<interface_span::state_t>(v, s)
191 interface_span::state_t
const static state_t RX_ENABLED
RX enable state.
static rc_t write()
Write/Execute all commands hitherto enqueued.
A command class that configures the interface span.
static rc_t commit(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
interface_span(const interface &itf_from, const interface &itf_to, state_t state)
Construct a new object matching the desried state.
static state_t from_int(uint8_t val)
Convert VPP's numerical value to enum type.
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 state_t TX_ENABLED
TX enable state.
vl_api_dhcp_client_state_t state
A representation of interface span configuration.
A cmd class that Unconfigs interface span.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
The state of the interface - rx/tx or both to be mirrored.
const static state_t DISABLED
DISABLED state.
static bool register_listener(listener *listener)
Register a listener of events.
std::shared_ptr< interface_span > singular() const
Return the 'singular instance' of the interface_span that matches this object.
std::string to_string() const
convert to string format for debug purposes
A representation of an interface in VPP.
const typedef std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
sll srl srl sll sra u16x4 i
static void enqueue(cmd *f)
Enqueue A command for execution.
const static log_level_t DEBUG
std::ostream & operator<<(std::ostream &os, const std::pair< direction_t, interface::key_t > &key)
std::pair< interface::key_t, interface::key_t > key_t
The key type for interface_spans.
const std::string & to_string() const
convert to string format for debug purposes
static void dump(std::ostream &os)
Dump all interface_spans into the stream provided.
~interface_span()
Destructor.
@ BINDING
Then L2/objects that bind to interfaces, BD, ACLS, etc.
void event_handler(void *tls_async)
const static state_t TX_RX_ENABLED
TX and RX enable state.
static std::shared_ptr< interface > find(const handle_t &h)
The the singular instance of the interface in the DB by handle.