FD.io VPP  v20.05.1-6-gf53edbc3b
Vector Packet Processing
VOM::interface Class Reference

A representation of an interface in VPP. More...

+ Inheritance diagram for VOM::interface:
+ Collaboration diagram for VOM::interface:

Data Structures

struct  admin_state_t
 The admin state of the interface. More...
 
class  create_cmd
 A base class for interface Create commands. More...
 
class  delete_cmd
 Base class for intterface Delete commands. More...
 
struct  event
 
class  event_listener
 A class that listens to interface Events. More...
 
struct  oper_state_t
 The oper state of the interface. More...
 
class  stat_listener
 A class that listens to interface Stats. More...
 
struct  stats_t
 stats_t: More...
 
struct  stats_type_t
 
struct  type_t
 An interface type. More...
 

Public Types

typedef std::string key_t
 The key for interface's key. More...
 
typedef singular_db< const std::string, interface >::const_iterator const_iterator_t
 The iterator type. More...
 

Public Member Functions

 interface (const std::string &name, type_t type, admin_state_t state, const std::string &tag="")
 Construct a new object matching the desried state. More...
 
 interface (const std::string &name, type_t type, admin_state_t state, const route_domain &rd, const std::string &tag="")
 Construct a new object matching the desried state mapped to a specific route_domain. More...
 
virtual ~interface ()
 Destructor. More...
 
 interface (const interface &o)
 Copy Constructor. More...
 
std::shared_ptr< interfacesingular () const
 Return the matching'singular' of the interface. More...
 
virtual std::string to_string (void) const
 convert to string format for debug purposes More...
 
const handle_thandle () const
 Return VPP's handle to this object. More...
 
const type_ttype () const
 Return the interface type. More...
 
const std::string & name () const
 Return the interface type. More...
 
const key_tkey () const
 Return the interface type. More...
 
const l2_address_tl2_address () const
 Return the L2 Address. More...
 
const admin_state_tadmin_state () const
 Return the admin state. More...
 
void set (const admin_state_t &state)
 Set the admin state of the interface. More...
 
void set (const l2_address_t &addr)
 Set the L2 Address. More...
 
void set (const oper_state_t &state)
 Set the operational state of the interface, as reported by VPP. More...
 
void set (const std::string &tag)
 Set the tag to the interface. More...
 
const stats_tget_stats (void) const
 Get the interface stats. More...
 
virtual bool operator== (const interface &i) const
 Comparison operator - only used for UT. More...
 
void enable_stats (stat_listener *el, const stats_type_t &st=stats_type_t::NORMAL)
 Enable stats for this interface. More...
 
void disable_stats ()
 Disable stats for this interface. More...
 

Static Public Member Functions

static const_iterator_t cbegin ()
 
static const_iterator_t cend ()
 
static std::shared_ptr< interfacefind (const handle_t &h)
 The the singular instance of the interface in the DB by handle. More...
 
static std::shared_ptr< interfacefind (const key_t &k)
 The the singular instance of the interface in the DB by key. More...
 
static void dump (std::ostream &os)
 Dump all interfaces into the stream provided. More...
 
static void enable_events (interface::event_listener &el)
 Enable the reception of events of all interfaces. More...
 
static void disable_events ()
 disable the reception of events of all interfaces More...
 

Protected Member Functions

void set (const handle_t &handle)
 Set the handle of an interface object. More...
 
virtual std::shared_ptr< interfacesingular_i () const
 Return the matching 'singular' of the interface. More...
 
void release ()
 release/remove an interface form the singular store More...
 
virtual std::queue< cmd * > & mk_create_cmd (std::queue< cmd *> &cmds)
 Virtual functions to construct an interface create commands. More...
 
virtual std::queue< cmd * > & mk_delete_cmd (std::queue< cmd *> &cmds)
 Virtual functions to construct an interface delete commands. More...
 
virtual void sweep (void)
 Sweep/reap the object if still stale. More...
 
- Protected Member Functions inherited from VOM::object_base
 object_base ()=default
 Constructable by derived classes only. More...
 
virtual ~object_base ()=default
 Destructor. More...
 

Static Protected Member Functions

static void add (const key_t &name, const HW::item< handle_t > &item)
 Add an interface to the DB keyed on handle. More...
 
static void remove (const HW::item< handle_t > &item)
 remove an interface from the DB keyed on handle More...
 

Protected Attributes

HW::item< handle_tm_hdl
 The SW interface handle VPP has asigned to the interface. More...
 

Static Protected Attributes

static singular_db< key_t, interfacem_db
 A map of all interfaces key against the interface's name. More...
 

Friends

class interface_factory
 
class pipe
 
class OM
 
class singular_db< key_t, interface >
 It's the singular_db class that calls replay() More...
 
template<typename MSG >
class create_cmd
 Create commands are firends so they can add interfaces to the handle store. More...
 
template<typename MSG >
class delete_cmd
 Create commands are firends so they can remove interfaces from the handle store. More...
 

Detailed Description

A representation of an interface in VPP.

Definition at line 41 of file interface.hpp.

Member Typedef Documentation

◆ const_iterator_t

typedef singular_db<const std::string, interface>::const_iterator VOM::interface::const_iterator_t

The iterator type.

Definition at line 62 of file interface.hpp.

◆ key_t

typedef std::string VOM::interface::key_t

The key for interface's key.

Definition at line 56 of file interface.hpp.

Constructor & Destructor Documentation

◆ interface() [1/3]

VOM::interface::interface ( const std::string &  name,
interface::type_t  itf_type,
interface::admin_state_t  itf_state,
const std::string &  tag = "" 
)

Construct a new object matching the desried state.

Definition at line 51 of file interface.cpp.

+ Here is the caller graph for this function:

◆ interface() [2/3]

VOM::interface::interface ( const std::string &  name,
interface::type_t  itf_type,
interface::admin_state_t  itf_state,
const route_domain rd,
const std::string &  tag = "" 
)

Construct a new object matching the desried state mapped to a specific route_domain.

Definition at line 69 of file interface.cpp.

◆ ~interface()

VOM::interface::~interface ( )
virtual

Destructor.

Definition at line 233 of file interface.cpp.

+ Here is the call graph for this function:

◆ interface() [3/3]

VOM::interface::interface ( const interface o)

Copy Constructor.

Definition at line 89 of file interface.cpp.

Member Function Documentation

◆ add()

void VOM::interface::add ( const key_t name,
const HW::item< handle_t > &  item 
)
staticprotected

Add an interface to the DB keyed on handle.

Definition at line 544 of file interface.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ admin_state()

const interface::admin_state_t & VOM::interface::admin_state ( ) const

Return the admin state.

Definition at line 164 of file interface.cpp.

◆ cbegin()

interface::const_iterator_t VOM::interface::cbegin ( )
static

Definition at line 170 of file interface.cpp.

+ Here is the caller graph for this function:

◆ cend()

interface::const_iterator_t VOM::interface::cend ( )
static

Definition at line 176 of file interface.cpp.

+ Here is the caller graph for this function:

◆ disable_events()

void VOM::interface::disable_events ( )
static

disable the reception of events of all interfaces

Definition at line 574 of file interface.cpp.

+ Here is the call graph for this function:

◆ disable_stats()

void VOM::interface::disable_stats ( )

Disable stats for this interface.

Definition at line 514 of file interface.cpp.

+ Here is the call graph for this function:

◆ dump()

void VOM::interface::dump ( std::ostream &  os)
static

Dump all interfaces into the stream provided.

Definition at line 560 of file interface.cpp.

+ Here is the call graph for this function:

◆ enable_events()

void VOM::interface::enable_events ( interface::event_listener el)
static

Enable the reception of events of all interfaces.

Definition at line 566 of file interface.cpp.

+ Here is the call graph for this function:

◆ enable_stats()

void VOM::interface::enable_stats ( interface::stat_listener el,
const stats_type_t st = stats_type_t::NORMAL 
)

Enable stats for this interface.

Definition at line 495 of file interface.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find() [1/2]

std::shared_ptr< interface > VOM::interface::find ( const handle_t h)
static

The the singular instance of the interface in the DB by handle.

Definition at line 538 of file interface.cpp.

+ Here is the caller graph for this function:

◆ find() [2/2]

std::shared_ptr< interface > VOM::interface::find ( const key_t k)
static

The the singular instance of the interface in the DB by key.

Definition at line 532 of file interface.cpp.

◆ get_stats()

const interface::stats_t & VOM::interface::get_stats ( void  ) const

Get the interface stats.

Definition at line 455 of file interface.cpp.

+ Here is the caller graph for this function:

◆ handle()

const handle_t & VOM::interface::handle ( ) const

Return VPP's handle to this object.

Definition at line 146 of file interface.cpp.

+ Here is the call graph for this function:

◆ key()

const interface::key_t & VOM::interface::key ( ) const

Return the interface type.

Definition at line 277 of file interface.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ l2_address()

const l2_address_t & VOM::interface::l2_address ( ) const

Return the L2 Address.

Definition at line 158 of file interface.cpp.

◆ mk_create_cmd()

std::queue< cmd * > & VOM::interface::mk_create_cmd ( std::queue< cmd *> &  cmds)
protectedvirtual

Virtual functions to construct an interface create commands.

Overridden in derived classes like the sub_interface

Definition at line 283 of file interface.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mk_delete_cmd()

std::queue< cmd * > & VOM::interface::mk_delete_cmd ( std::queue< cmd *> &  cmds)
protectedvirtual

Virtual functions to construct an interface delete commands.

Overridden in derived classes like the sub_interface

Definition at line 313 of file interface.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ name()

const std::string & VOM::interface::name ( ) const

Return the interface type.

Definition at line 271 of file interface.cpp.

+ Here is the caller graph for this function:

◆ operator==()

bool VOM::interface::operator== ( const interface i) const
virtual

Comparison operator - only used for UT.

Definition at line 106 of file interface.cpp.

+ Here is the call graph for this function:

◆ release()

void VOM::interface::release ( )
protected

release/remove an interface form the singular store

Definition at line 240 of file interface.cpp.

+ Here is the caller graph for this function:

◆ remove()

void VOM::interface::remove ( const HW::item< handle_t > &  item)
staticprotected

remove an interface from the DB keyed on handle

Definition at line 554 of file interface.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set() [1/5]

void VOM::interface::set ( const admin_state_t state)

Set the admin state of the interface.

N.B. All set function change only the attibute of the object on whcih they act, they do not make changes in VPP

Definition at line 402 of file interface.cpp.

+ Here is the caller graph for this function:

◆ set() [2/5]

void VOM::interface::set ( const l2_address_t addr)

Set the L2 Address.

Definition at line 408 of file interface.cpp.

◆ set() [3/5]

void VOM::interface::set ( const oper_state_t state)

Set the operational state of the interface, as reported by VPP.

Definition at line 420 of file interface.cpp.

◆ set() [4/5]

void VOM::interface::set ( const std::string &  tag)

Set the tag to the interface.

Definition at line 426 of file interface.cpp.

+ Here is the call graph for this function:

◆ set() [5/5]

void VOM::interface::set ( const handle_t handle)
protected

Set the handle of an interface object.

Only called by the interface factory during the populate

Definition at line 414 of file interface.cpp.

◆ singular()

std::shared_ptr< interface > VOM::interface::singular ( ) const

Return the matching'singular' of the interface.

Definition at line 526 of file interface.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ singular_i()

std::shared_ptr< interface > VOM::interface::singular_i ( ) const
protectedvirtual

Return the matching 'singular' of the interface.

Definition at line 520 of file interface.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sweep()

void VOM::interface::sweep ( void  )
protectedvirtual

Sweep/reap the object if still stale.

Implements VOM::object_base.

Definition at line 182 of file interface.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ to_string()

std::string VOM::interface::to_string ( void  ) const
virtual

convert to string format for debug purposes

Implements VOM::object_base.

Reimplemented in VOM::bond_interface, VOM::vxlan_tunnel, VOM::pipe, and VOM::gbp_vxlan.

Definition at line 247 of file interface.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ type()

const interface::type_t & VOM::interface::type ( ) const

Return the interface type.

Definition at line 140 of file interface.cpp.

Friends And Related Function Documentation

◆ create_cmd

template<typename MSG >
friend class create_cmd
friend

Create commands are firends so they can add interfaces to the handle store.

Definition at line 734 of file interface.hpp.

◆ delete_cmd

template<typename MSG >
friend class delete_cmd
friend

Create commands are firends so they can remove interfaces from the handle store.

Definition at line 741 of file interface.hpp.

◆ interface_factory

friend class interface_factory
friend

Definition at line 535 of file interface.hpp.

◆ OM

friend class OM
friend

Definition at line 655 of file interface.hpp.

◆ pipe

friend class pipe
friend

Definition at line 536 of file interface.hpp.

◆ singular_db< key_t, interface >

friend class singular_db< key_t, interface >
friend

It's the singular_db class that calls replay()

Definition at line 660 of file interface.hpp.

Field Documentation

◆ m_db

singular_db< interface::key_t, interface > VOM::interface::m_db
staticprotected

A map of all interfaces key against the interface's name.

A DB of all the interfaces, key on the name.

Definition at line 572 of file interface.hpp.

◆ m_hdl

HW::item<handle_t> VOM::interface::m_hdl
protected

The SW interface handle VPP has asigned to the interface.

Definition at line 540 of file interface.hpp.


The documentation for this class was generated from the following files: