|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
25 namespace interface_cmds {
36 msg_t req(
con.ctx(), std::ref(*
this));
38 auto& payload = req.get_request().get_payload();
40 payload.user_instance = ~0;
70 msg_t req(
con.ctx(), std::ref(*
this));
100 msg_t req(
con.ctx(), std::ref(*
this));
102 auto& payload = req.get_request().get_payload();
104 payload.use_random_hw_addr = 1;
105 memset(payload.host_if_name, 0,
sizeof(payload.host_if_name));
106 memcpy(payload.host_if_name,
m_name.c_str(),
107 std::min(
m_name.length(),
sizeof(payload.host_if_name)));
122 std::ostringstream s;
139 msg_t req(
con.ctx(), std::ref(*
this));
141 auto& payload = req.get_request().get_payload();
142 memset(payload.sock_filename, 0,
sizeof(payload.sock_filename));
143 memcpy(payload.sock_filename,
m_name.c_str(),
144 std::min(
m_name.length(),
sizeof(payload.sock_filename)));
145 memset(payload.tag, 0,
sizeof(payload.tag));
148 memcpy(payload.tag, m_tag.c_str(),
149 std::min(m_tag.length(),
sizeof(payload.tag)));
151 payload.is_server = 0;
152 payload.use_custom_mac = 0;
153 payload.renumber = 0;
169 std::ostringstream s;
184 msg_t req(
con.ctx(), std::ref(*
this));
186 auto& payload = req.get_request().get_payload();
201 std::ostringstream s;
215 msg_t req(
con.ctx(), std::ref(*
this));
217 auto& payload = req.get_request().get_payload();
232 std::ostringstream s;
247 msg_t req(
con.ctx(), std::ref(*
this));
249 auto& payload = req.get_request().get_payload();
250 memset(payload.host_if_name, 0,
sizeof(payload.host_if_name));
251 memcpy(payload.host_if_name,
m_name.c_str(),
252 std::min(
m_name.length(),
sizeof(payload.host_if_name)));
265 std::ostringstream s;
280 msg_t req(
con.ctx(), std::ref(*
this));
282 auto& payload = req.get_request().get_payload();
295 std::ostringstream s;
317 msg_t req(
con.ctx(), std::ref(*
this));
319 auto& payload = req.get_request().get_payload();
320 payload.sw_if_index = m_hdl.
data().
value();
331 std::ostringstream s;
349 return ((m_hdl == other.m_hdl) && (m_proto == other.m_proto) &&
356 msg_t req(
con.ctx(), std::ref(*
this));
358 auto& payload = req.get_request().get_payload();
359 payload.sw_if_index = m_hdl.
data().
value();
360 payload.is_ipv6 = m_proto.
is_ipv6();
371 std::ostringstream s;
393 msg_t req(
con.ctx(), std::ref(*
this));
395 auto& payload = req.get_request().get_payload();
396 payload.sw_if_index = m_hdl.
data().
value();
398 sizeof(payload.mac_address));
408 std::ostringstream s;
428 (m_enable == other.m_enable));
434 msg_t req(
con.ctx(), std::ref(*
this));
436 auto& payload = req.get_request().get_payload();
437 payload.sw_if_index = m_hdl.
value();
438 payload.enable_disable = m_enable;
448 std::ostringstream s;
478 auto& payload = req.get_request().get_payload();
479 payload.enable_disable = 1;
480 payload.pid = getpid();
497 auto& payload = req.get_request().get_payload();
498 payload.enable_disable = 0;
499 payload.pid = getpid();
509 std::lock_guard<interface_cmds::events_cmd> lg(*
this);
510 std::vector<interface::event>
events;
512 for (
auto& msg : *
this) {
513 auto& payload = msg.get_payload();
515 handle_t handle(payload.sw_if_index);
526 events.push_back({ *sp, oper_state });
538 return (
"itf-events");
556 auto& payload =
m_dump->get_request().get_payload();
557 payload.name_filter_valid = 0;
597 return (
"vhost-itf-dump");
621 return (
"af-packet-itf-dump");
633 msg_t req(
con.ctx(), std::ref(*
this));
635 auto& payload = req.get_request().get_payload();
638 memset(payload.tag, 0,
sizeof(payload.tag));
639 memcpy(payload.tag, m_name.c_str(), m_name.length());
648 std::ostringstream s;
loopback_create_cmd(HW::item< handle_t > &item, const std::string &name)
Constructor taking the HW::item to update and the name of the interface to create.
rc_t issue(connection &con)
Issue the command to VPP/HW.
std::string to_string() const
convert to string format for debug purposes
A command class that binds an interface to an L3 table.
bvi_delete_cmd(HW::item< handle_t > &item)
Constructor taking the HW::item to update.
std::string to_string() const
convert to string format for debug purposes
vapi::Sw_interface_dump msg_t
mac_address_t to_mac() const
MAC address conversion.
rc_t wait()
Wait on the commands promise.
void set(const rc_t &rc)
Set the HW return code - should only be called from the family of Command objects.
A cmd class that Dumps all the Vpp interfaces.
static oper_state_t from_int(uint8_t val)
Convert VPP's numerical value to enum type.
bool operator==(const events_cmd &i) const
Comparison operator - only used for UT.
A command class to set tag on interfaces.
rc_t issue(connection &con)
Issue the command to VPP/HW.
The VPP Object Model (VOM) library.
@ IF_STATUS_API_FLAG_LINK_UP
vhost_create_cmd(HW::item< handle_t > &item, const std::string &name, const std::string &tag)
const static rc_t OK
The HW write was successfull.
rc_t issue(connection &con)
Issue the command to VPP/HW.
dump_cmd()
Default Constructor.
std::string to_string() const
convert to string format for debug purposes
A command class that enables detailed stats collection on an interface.
std::string to_string() const
convert to string format for debug purposes
rc_t issue(connection &con)
Issue the command to VPP/HW.
vapi::Event_registration< vapi::Sw_interface_event > reg_t
uint32_t value() const
get the value of the handle
std::string to_string() const
convert to string format for debug purposes
rc_t issue(connection &con)
Issue the command to VPP/HW.
loopback_delete_cmd(HW::item< handle_t > &item)
Constructor taking the HW::item to update.
A base class for all RPC commands to VPP.
rc_t issue(connection &con)
Issue the command to VPP/HW.
bool operator==(const set_table_cmd &i) const
Comparison operator - only used for UT.
bool operator==(const set_mac_cmd &i) const
Comparison operator - only used for UT.
A class that listens to interface Events.
vl_api_dhcp_client_state_t state
rc_t issue(connection &con)
Issue the command to VPP/HW.
rc_t issue(connection &con)
Issue the command to VPP/HW.
A cmd class that Dumps all the Vpp interfaces.
const std::string m_name
The name of the interface to be created.
std::string to_string() const
convert to string format for debug purposes
DEFINE_VAPI_MSG_IDS_INTERFACE_API_JSON
HW::item< handle_t > & m_hw_item
A reference to an object's HW::item that the command will update.
std::unique_ptr< vapi::Sw_interface_dump > m_dump
The VAPI event registration.
rc_t issue(connection &con)
Issue the command to VPP/HW.
vhost_dump_cmd()
Default Constructor.
void insert_interface()
add the created interface to the DB
A command class represents our desire to recieve interface events.
int value() const
Return the value of the enum - same as integer conversion.
#define VAPI_CALL(_stmt)
Convenince wrapper macro for error handling in VAPI sends.
std::string to_string() const
convert to string format for debug purposes
An Event command base class.
collect_detail_stats_change_cmd(HW::item< interface::stats_type_t > &item, const handle_t &h, bool enable)
Constructor taking the HW::item to update and the handle of the interface.
state_change_cmd(HW::item< interface::admin_state_t > &s, const HW::item< handle_t > &h)
Constructor taking the HW::item to update and the name handle of the interface whose state is to chan...
std::string to_string() const
convert to string format for debug purposes
A representation of the connection to VPP.
rc_t issue(connection &con)
Issue the command to VPP/HW.
bool operator==(const set_tag &i) const
Comparison operator - only used for UT.
void to_bytes(uint8_t *array, uint8_t len) const
Convert to byte array.
std::string to_string() const
convert to string format for debug purposes
set_tag(HW::item< handle_t > &item, const std::string &name)
Constructor taking the HW::item to update.
rc_t wait()
Wait for the issue of the command to complete.
void notify()
Called when it's time to poke the listeners.
void retire(connection &con)
Retires the command - unsubscribe from the events.
bvi_create_cmd(HW::item< handle_t > &item, const std::string &name)
Constructor taking the HW::item to update and the name of the interface to create.
set_mac_cmd(HW::item< l2_address_t > &item, const HW::item< handle_t > &h)
Constructor taking the HW::item to update and the handle of the interface.
const static rc_t NOOP
The HW write/update action was/has not been attempted.
set_table_cmd(HW::item< route::table_id_t > &item, const l3_proto_t &proto, const HW::item< handle_t > &h)
Constructor taking the HW::item to update and the name handle of the interface whose table is to chan...
static perfmon_event_t events[]
rc_t issue(connection &con)
Issue the command to VPP/HW.
A type declaration of an interface handle in VPP.
af_packet_delete_cmd(HW::item< handle_t > &item, const std::string &name)
Constructor taking the HW::item to update and the name of the interface to delete.
std::string to_string() const
convert to string format for debug purposes
std::string to_string() const
convert to string format for debug purposes
const static log_level_t DEBUG
bool operator==(const state_change_cmd &i) const
Comparison operator - only used for UT.
rc_t issue(connection &con)
Issue the command to VPP/HW.
DEFINE_VAPI_MSG_IDS_VPE_API_JSON
A command class that changes the MAC address on an interface.
std::unique_ptr< vapi::Event_registration< vapi::Sw_interface_event > > m_reg
The VAPI event registration.
bool operator==(const af_packet_dump_cmd &i) const
Comparison operator - only used for UT.
vapi::Bvi_create msg_t
convenient typedef
const std::string & to_string() const
convert to string format for debug purposes
std::string to_string() const
convert to string format for debug purposes
bool operator==(const collect_detail_stats_change_cmd &i) const
Comparison operator - only used for UT.
rc_t rc() const
Get the HW return code.
T & data()
Return the data read/written.
void remove_interface()
remove the deleted interface from the DB
An L3 protocol can be used to construct a prefix that is used to match packets are part of a route.
std::string to_string() const
convert to string format for debug purposes
std::string to_string() const
convert to string format for debug purposes
A cmd class that Dumps all the Vpp Interfaces.
std::string to_string() const
convert to string format for debug purposes
af_packet_create_cmd(HW::item< handle_t > &item, const std::string &name)
Constructor taking the HW::item to update and the name of the interface to create.
virtual void handle_interface_event(std::vector< event > es)=0
Virtual function called on the listener when the command has data ready to process.
DEFINE_VAPI_MSG_IDS_AF_PACKET_API_JSON
void flush()
flush/free all the events thus far reeived.
The oper state of the interface.
vhost_delete_cmd(HW::item< handle_t > &item, const std::string &name)
std::string to_string() const
convert to string format for debug purposes
DEFINE_VAPI_MSG_IDS_VHOST_USER_API_JSON
rc_t issue(connection &con)
Issue the command to VPP/HW.
rc_t issue(connection &con)
Issue the command to VPP/HW.
const std::string & m_name
The name of the interface to be created.
rc_t issue(connection &con)
Issue the command to VPP/HW.
A cmd class that changes the admin state.
rc_t issue(connection &con)
Issue the command to VPP/HW.
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
Error codes that VPP will return during a HW write.
rc_t issue(connection &con)
Issue the command to VPP/HW.
std::string to_string() const
convert to string format for debug purposes
bool operator==(const vhost_dump_cmd &i) const
Comparison operator - only used for UT.
std::string to_string() const
convert to string format for debug purposes
std::string to_string() const
convert to string format for debug purposes
events_cmd(interface::event_listener &el)
Constructor taking the listner to notify.
static std::shared_ptr< interface > find(const handle_t &h)
The the singular instance of the interface in the DB by handle.