16 #ifndef __VOM_INTERFACE_H__ 17 #define __VOM_INTERFACE_H__ 33 namespace interface_cmds {
96 static type_t from_string(
const std::string& str);
102 type_t(
int v,
const std::string& s);
185 std::shared_ptr<interface> singular()
const;
190 virtual std::string to_string(
void)
const;
200 const type_t& type()
const;
205 const std::string& name()
const;
210 const key_t& key()
const;
230 virtual bool operator==(
const interface&
i)
const;
235 template <
typename MSG>
255 return (m_name == o.
m_name);
274 int sw_if_index = reply.get_response().get_payload().sw_if_index;
275 int retval = reply.get_response().get_payload().retval;
283 handle = sw_if_index;
303 template <
typename MSG>
393 virtual void handle_interface_stat(
411 static std::shared_ptr<interface> find(
const handle_t&
h);
416 static std::shared_ptr<interface> find(
const key_t& k);
421 static void dump(std::ostream& os);
444 virtual std::shared_ptr<interface> singular_i()
const;
455 virtual std::queue<cmd*>& mk_create_cmd(std::queue<cmd*>& cmds);
461 virtual std::queue<cmd*>& mk_delete_cmd(std::queue<cmd*>& cmds);
466 virtual void sweep(
void);
491 virtual ~event_handler() =
default;
501 void handle_replay();
506 void show(std::ostream& os);
514 static event_handler m_evh;
544 const std::string m_name;
556 std::shared_ptr<route_domain> m_rd;
561 std::shared_ptr<interface_cmds::stats_enable_cmd> m_stats;
586 static std::map<handle_t, std::weak_ptr<interface>> m_hdl_db;
591 virtual void replay(
void);
597 template <
typename MSG>
604 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.
sll srl srl sll sra u16x4 i
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()
add the created interface to 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.
HW::item< handle_t > m_hdl
The SW interface handle VPP has asigned to the interface.
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
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.
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
Unkown 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)