16 #ifndef __VOM_INTERFACE_H__ 17 #define __VOM_INTERFACE_H__ 33 namespace interface_cmds {
130 static type_t from_string(
const std::string& str);
136 type_t(
int v,
const std::string& s);
197 const std::string& tag =
"");
206 const std::string& tag =
"");
223 std::shared_ptr<interface> singular()
const;
228 virtual std::string to_string(
void)
const;
238 const type_t& type()
const;
243 const std::string& name()
const;
248 const key_t& key()
const;
273 void set(
const std::string& tag);
278 virtual bool operator==(
const interface&
i)
const;
283 template <
typename MSG>
303 return (m_name == o.
m_name);
322 int sw_if_index = reply.get_response().get_payload().sw_if_index;
323 int retval = reply.get_response().get_payload().retval;
331 handle = sw_if_index;
349 template <
typename MSG>
439 virtual void handle_interface_stat(
457 static std::shared_ptr<interface> find(
const handle_t&
h);
462 static std::shared_ptr<interface> find(
const key_t& k);
467 static void dump(std::ostream& os);
492 virtual std::shared_ptr<interface> singular_i()
const;
503 virtual std::queue<cmd*>& mk_create_cmd(std::queue<cmd*>& cmds);
509 virtual std::queue<cmd*>& mk_delete_cmd(std::queue<cmd*>& cmds);
514 virtual void sweep(
void);
549 void handle_replay();
554 void show(std::ostream& os);
592 const std::string m_name;
604 std::shared_ptr<route_domain> m_rd;
609 std::shared_ptr<interface_cmds::stats_enable_cmd> m_stats;
644 static std::map<handle_t, std::weak_ptr<interface>> m_hdl_db;
649 virtual void replay(
void);
655 template <
typename MSG>
662 template <
typename MSG>
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 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.
A command class represents our desire to recieve interface stats.
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.
static const admin_state_t UP
Admin UP state.
A representation of a method call to VPP.
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.
static const type_t TAP
TAP interface type.
singular_db< const std::string, interface >::const_iterator const_iterator_t
The iterator type.
static const type_t TAPV2
TAPv2 interface type.
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.