16 #ifndef __VOM_INTERFACE_H__ 17 #define __VOM_INTERFACE_H__ 33 namespace interface_cmds {
115 static type_t from_string(
const std::string& str);
121 type_t(
int v,
const std::string& s);
182 const std::string& tag =
"");
191 const std::string& tag =
"");
208 std::shared_ptr<interface> singular()
const;
213 virtual std::string to_string(
void)
const;
223 const type_t& type()
const;
228 const std::string& name()
const;
233 const key_t& key()
const;
258 void set(
const std::string& tag);
263 virtual bool operator==(
const interface&
i)
const;
268 template <
typename MSG>
288 return (m_name == o.
m_name);
307 int sw_if_index = reply.get_response().get_payload().sw_if_index;
308 int retval = reply.get_response().get_payload().retval;
316 handle = sw_if_index;
336 template <
typename MSG>
426 virtual void handle_interface_stat(
444 static std::shared_ptr<interface> find(
const handle_t&
h);
449 static std::shared_ptr<interface> find(
const key_t& k);
454 static void dump(std::ostream& os);
478 virtual std::shared_ptr<interface> singular_i()
const;
489 virtual std::queue<cmd*>& mk_create_cmd(std::queue<cmd*>& cmds);
495 virtual std::queue<cmd*>& mk_delete_cmd(std::queue<cmd*>& cmds);
500 virtual void sweep(
void);
535 void handle_replay();
540 void show(std::ostream& os);
578 const std::string m_name;
590 std::shared_ptr<route_domain> m_rd;
595 std::shared_ptr<interface_cmds::stats_enable_cmd> m_stats;
630 static std::map<handle_t, std::weak_ptr<interface>> m_hdl_db;
635 virtual void replay(
void);
641 template <
typename MSG>
648 template <
typename MSG>
delete_cmd(HW::item< handle_t > &item, const std::string &name)
HWITEM & m_hw_item
A reference to an object's HW::item that the command will update.
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 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)
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.
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.
vhost_vring_state_t state
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 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