16 #ifndef __VOM_INTERFACE_H__ 17 #define __VOM_INTERFACE_H__ 33 namespace interface_cmds {
126 static type_t from_string(
const std::string& str);
132 type_t(
int v,
const std::string& s);
209 const std::string& tag =
"");
218 const std::string& tag =
"");
235 std::shared_ptr<interface> singular()
const;
240 virtual std::string to_string(
void)
const;
250 const type_t& type()
const;
255 const std::string&
name()
const;
260 const key_t&
key()
const;
288 void set(
const std::string& tag);
293 const stats_t& get_stats(
void)
const;
298 virtual bool operator==(
const interface&
i)
const;
303 template <
typename MSG>
323 return (m_name == o.
m_name);
342 int sw_if_index = reply.get_response().get_payload().sw_if_index;
343 int retval = reply.get_response().get_payload().retval;
370 template <
typename MSG>
443 virtual void handle_interface_event(std::vector<event> es) = 0;
474 virtual void handle_interface_stat(
const interface&) = 0;
491 static std::shared_ptr<interface> find(
const handle_t&
h);
496 static std::shared_ptr<interface> find(
const key_t& k);
501 static void dump(std::ostream& os);
512 void disable_stats();
540 virtual std::shared_ptr<interface> singular_i()
const;
551 virtual std::queue<cmd*>& mk_create_cmd(std::queue<cmd*>& cmds);
557 virtual std::queue<cmd*>& mk_delete_cmd(std::queue<cmd*>& cmds);
562 virtual void sweep(
void);
597 void handle_replay();
602 void show(std::ostream& os);
620 void publish_stats();
635 void disable_stats_i();
660 const std::string m_name;
672 std::shared_ptr<route_domain> m_rd;
717 static std::map<handle_t, std::weak_ptr<interface>> m_hdl_db;
722 virtual void replay(
void);
728 template <
typename MSG>
735 template <
typename MSG>
738 static std::shared_ptr<interface_cmds::events_cmd> m_events_cmd;
delete_cmd(HW::item< handle_t > &item, const std::string &name)
static const rc_t & from_vpp_retval(int32_t rv)
Get the rc_t from the VPP API value.
void succeeded()
Indicate the succeeded, when the HW Q is disabled.
static const type_t AFPACKET
AF-Packet interface type.
A template base class for all enum types.
void remove_interface()
remove the deleted interface from the DB
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 type_t BOND
bond interface type
HW::item< handle_t > m_hdl
The SW interface handle VPP has asigned to the interface.
static const stats_type_t NORMAL
static void disable_events(perfmon_main_t *pm)
static const type_t PIPE
pipe-parent type
static const oper_state_t UP
Operational UP state.
virtual bool operator==(const delete_cmd &o) const
Comparison operator - only used for UT.
void succeeded()
Indicate the succeeded, when the HW Q is disabled.
virtual vapi_error_e operator()(MSG &reply)
call operator used as a callback by VAPI when the reply is available
Error codes that VPP will return during a HW write.
static const log_level_t DEBUG
static const stats_type_t DETAILED
create_cmd(HW::item< handle_t > &item, const std::string &name)
static const handle_t INVALID
A value of an interface handle_t that means the itf does not exist.
The oper state of the interface.
Type def of a L2 address as read from VPP.
static singular_db< key_t, interface > m_db
A map of all interfaces key against the interface's name.
static const type_t LOCAL
Local interface type (specific to VPP)
vhost_vring_state_t state
const std::string & m_name
The name of the interface to be created.
static const type_t ETHERNET
Ethernet interface type.
HW::item< bool > m_status
The status of the subscription.
static void remove(const HW::item< handle_t > &item)
remove an interface from the DB keyed on handle
static const oper_state_t DOWN
Operational DOWN state.
A class that listens to interface Stats.
A Database to store the unique 'singular' instances of a single object type.
A class that listens to interface Events.
A base class for all RPC commands to VPP.
static void add(const key_t &name, const HW::item< handle_t > &item)
Add an interface to the DB keyed on handle.
static const type_t PIPE_END
pipe-end type
virtual bool operator==(const create_cmd &o) const
Comparison operator - only used for UT.
A command class represents our desire to recieve interface events.
The admin state of the interface.
A representation of an interface in VPP.
Class definition for listeners to OM events.
inspect command handler Handler
std::map< KEY, std::weak_ptr< OBJ > >::const_iterator const_iterator
Iterator.
Base class for intterface Delete commands.
A type declaration of an interface handle in VPP.
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 ...
static const rc_t OK
The HW write was successfull.
The interface to writing objects into VPP OM.
A base class for all object_base in the VPP object_base-Model.
static const type_t UNKNOWN
Unknown type.
const std::string m_name
The name of the interface to be created.
std::ostream & operator<<(std::ostream &os, const std::pair< direction_t, interface::key_t > &key)
event(const interface &itf, const interface::oper_state_t &state)
static const type_t VXLAN
VXLAN interface.
A base class for interface Create commands.
void insert_interface()
add the created interface to the DB
The VPP Object Model (VOM) library.
Stat reader: single interface to get stats.
static const admin_state_t UP
Admin UP state.
static const type_t BVI
A brideged Virtual interface (aka SVI or IRB)
HW::item< bool > m_status
The status of the subscription.
static const admin_state_t DOWN
Admin DOWN state.
singular_db< const std::string, interface >::const_iterator const_iterator_t
The iterator type.
static const type_t TAPV2
TAPv2 interface type.
interface::oper_state_t state
static const type_t LOOPBACK
loopback interface type
std::string key_t
The key for interface's key.
delete_cmd(HW::item< handle_t > &item)
static const type_t VHOST
vhost-user interface type
HWITEM & m_hw_item
A reference to an object's HW::item that the command will update.