vrf

VRF management

This module manages Virtual Routing & Forwarding instances, known commonly as VRFs. VRFs let you partition your switch’s routing tables so you can have unique IP domains.

VRFs are keyed by a unique name across the system, and can be used in other modules to configure routes and nexthops in different domains. If a route is not programmed in a specific VRF, it belongs to the VRF named “default”.

namespace eos
class vrf_handler
#include <vrf.h>

The VRF handler.

This class provides handler APIs to react to a VRF’s operational state change.

Public Functions

vrf_handler(vrf_mgr * mgr)
vrf_mgr * get_vrf_mgr() const
void watch_all_vrfs(bool)

Register to receive notifications when any VRF on the system changes state.

void watch_vrf(std::string const & vrf_name, bool)

Register to receive notifications when the specified VRF on the system changes state.

virtual void on_vrf_state(std::string vrf_name, vrf_state_t vrf_state)

Called when a VRF’s operational state changes.

class vrf_iter_t
#include <vrf.h>

An iterator that yields a vrf_t for each VRF on the system.

Private Functions

vrf_iter_t(vrf_iter_impl * const)

Friends

friend class vrf_iter_impl
class vrf_mgr
#include <vrf.h>

The manager for VRF, this is the main entry point for applications to use EosSdk VRF APIs.

Public Functions

virtual ~vrf_mgr()
virtual vrf_iter_t vrf_iter() const = 0

Iterates through all configured VRFs on the system, yielding a vrf_t for each VRF.

virtual bool exists(std::string const & vrf_name) const = 0

Returns true if the VRF is currently configured.

virtual uint64_t rd(std::string const & vrf_name) const = 0

Returns the configured route distinguisher associated with this VRF.

If no VRF matches the given name, this returns 0.

virtual vrf_state_t state(std::string const & vrf_name) const = 0

Returns the operational status of this VRF.

If the given VRF name does not have a current status (e.g. a newly configured VRF), or if it does not match any VRFs on the system, this returns VRF_STATE_NULL.

virtual int socket_at(int domain, int type, int protocol, std::string const & vrf_name) = 0

Opens a socket inside a VRF specified by ‘vrf_name’.

Return
fd on success, -1 on error, and errno is set appropriately.
Parameters
  • domain -

    A communication domain, same as in socket().

  • type -

    The communication semantics, such as SOCK_STREAM, same as in socket().

  • protocol -

    The protocol to be used with the socket, same as in socket().

  • vrf_name -

    The name of the vrf_name in which the socket will be created.

virtual vrf_t vrf(std::string const & vrf_name) const = 0

Returns a composite `vrf_t` for the named VRF, or a default VRF object if it does not exist.

Protected Functions

vrf_mgr()

Private Members

vrf_mgr

Friends

friend class vrf_handler

Type definitions in vrf

Warning

doxygenfile: Found multiple matches for file “eos/types/vrf.h

Table Of Contents

Previous topic

version