ip_route¶
-
namespace
eos
-
class
ip_route_iter_t
- #include <ip_route.h>
An IP route iterator.
Private Functions
-
ip_route_iter_t
(ip_route_iter_impl * const)
Friends
-
friend class
ip_route_iter_impl
-
-
class
ip_route_via_iter_t
- #include <ip_route.h>
A route via iterator.
Private Functions
-
ip_route_via_iter_t
(ip_route_via_iter_impl * const)
Friends
-
friend class
ip_route_via_iter_impl
-
-
class
ip_route_mgr
- #include <ip_route.h>
The manager for IP static route configuration.
Public Functions
-
virtual
~ip_route_mgr
()
-
virtual void
tag_is
(uint32_t) = 0 Set the manager to only interact with routes with the given tag.
If this tag is set to a non-zero number, then methods on this class will only affect or expose routes with the given tag.
-
virtual uint32_t
tag
() const = 0 Returns the current tag, or 0 if no tag is set.
-
virtual void
resync_init
() = 0 Resync provides a mechanism to set routes to a known state.
To start a resync, call resync_init() and then use ip_route_set() and ip_route_via_set() to populate the static routing table with the known entries. After all entries have been set, call resync_complete(), which will delete all existing routes and vias that were not added or modified during resync. If a tag is set, resync will only delete routes and vias corresponding to the current tag.
During resync, this manager will act like it is referencing a temporary table that starts off empty. Thus, methods like exist, del, and getters will act only on that temporary table, regardless of the real values in Sysdb. The one exception is iteration; they will traverse the table stored in Sysdb, regardless of whether or not the manager is in resync mode.
-
virtual void
resync_complete
() = 0 Completes any underway resync operation.
-
virtual ip_route_iter_t
ip_route_iter
() const = 0 Iterates across all configured static routes. If a tag is set, only return routes that have match the current tag.
-
virtual ip_route_via_iter_t
ip_route_via_iter
(ip_route_key_t const &) const = 0 Iterates across configured nexthops for a given route key, i.e., emit all ip_route_via_t’s for a given route key. If a tag is set, only return vias on routes that match the current tag.
-
virtual ip_route_via_iter_t
ip_route_via_iter
(ip_route_key_t const &, std::string vrfName) const = 0
-
virtual bool
exists
(ip_route_key_t const &) const = 0 Tests for existence of any routes matching the route key in the config. If a tag is set and the route belongs to a different tag, this function returns false.
-
virtual bool
exists
(ip_route_key_t const &, std::string vrfName) const = 0
-
virtual bool
exists
(ip_route_via_t const &) const = 0 Tests if the given via exists.
-
virtual bool
exists
(ip_route_via_t const &, std::string vrfName) const = 0
-
virtual ip_route_t
ip_route
(ip_route_key_t const &) = 0 Gets the IP route with the corresponding ip_route_key_t. Returns an empty ip_route_t() if no matching route is found.
-
virtual ip_route_t
ip_route
(ip_route_key_t const &, std::string vrfName) = 0
-
virtual void
ip_route_set
(ip_route_t const &) = 0 Inserts or updates a static route into the switch configuration.
-
virtual void
ip_route_set
(ip_route_t const &, ip_route_action_t expected_type) = 0 Performs the same operation as
ip_route_set
, but lets an agent hint what type of vias will be attached to this route. For example, if the agent knows it will be adding nexthop group vias to this route, it can passeos::IP_ROUTE_ACTION_NEXTHOP_GROUP
, which allows EOS to more efficiently program routes. Routes are created by ‘forward’ routes if no additional information is provided.
-
virtual void
ip_route_set
(ip_route_t const &, std::string vrfName) = 0 Inserts or updates a static route for a given vrf into the switch configuration.
-
virtual void
ip_route_del
(ip_route_key_t const &, std::string vrfName) = 0 Delete an existing static route for a given vrf from the switch configuration.
-
virtual void
ip_route_del
(ip_route_key_t const &) = 0 Removes all ECMP vias matching the route key, and the route itself.
-
virtual void
ip_route_via_set
(ip_route_via_t const &) = 0 Adds a via to an ip_route_t.
A via is associated with an ip_route_t by their
ip_route_key_t
attributes. If an agent adds multiple vias with a hop or intf set, EOS will ECMP across these “forward” routes. If it programs a ‘drop’ via (by setting the intf attribute to Null0), all other vias attached to this route will be removed, and all traffic on this route will be dropped. Similarly, if the nexthop_group attribute is set, all other vias with the sameip_route_key_t
will be removed, and the new nexthop group via will be programmed in their place. This function will call panic() if the route does not match the currently configured tag.- Exceptions
eos::invalid_argument_error
-If the passed via has no IP address, interface or nexthop group set.
-
virtual void
ip_route_via_set
(ip_route_via_t const &, std::string vrfName) = 0
-
virtual void
ip_route_via_del
(ip_route_via_t const &) = 0 Removes a via from an ip_route_t. When all vias are removed, the route still exists with no nexthop information.
-
virtual void
ip_route_via_del
(ip_route_via_t const &, std::string vrfName) = 0
Protected Functions
-
ip_route_mgr
()
Private Members
-
ip_route_mgr
-
virtual
-
class
Type definitions in ip_route¶
-
namespace
eos
Typedefs
-
typedef uint32_t
ip_route_tag_t
-
typedef uint8_t
ip_route_preference_t
-
typedef uint32_t
ip_route_metric_t
-
typedef uint32_t
vni_t
Valid range of 1 - (2^24)-1, set to 0 if unused.
-
typedef uint32_t
ip_via_metric_t
Enums
- ip_route_action_t enum
The type of the ip_route_t. This is determined by the ip_route_via_t’s attached to this route.
Values:
IP_ROUTE_ACTION_NULL
-IP_ROUTE_ACTION_FORWARD
-IP_ROUTE_ACTION_DROP
-IP_ROUTE_ACTION_NEXTHOP_GROUP
-
-
class
ip_route_key_t
- #include <ip_route.h>
An IP route key, consisting of a prefix and preference.
Public Functions
-
ip_route_key_t
()
-
ip_route_key_t
(ip_prefix_t const & prefix)
-
ip_route_key_t
(ip_prefix_t const & prefix, ip_route_preference_t preference)
-
ip_route_key_t
(const ip_route_key_t & other)
-
ip_route_key_t &
operator=
(ip_route_key_t const & other)
-
ip_prefix_t
prefix
() const Getter for ‘prefix’: the IP v4/v6 network prefix.
-
void
prefix_is
(ip_prefix_t const & prefix) Setter for ‘prefix’.
-
ip_route_preference_t
preference
() const Getter for ‘preference’: a value 0..255, defaults to 1.
-
void
preference_is
(ip_route_preference_t preference) Setter for ‘preference’.
-
bool
operator==
(ip_route_key_t const & other) const
-
bool
operator!=
(ip_route_key_t const & other) const
-
uint32_t
hash
() const The hash function for type ip_route_key_t.
-
void
mix_me
(hash_mix & h) const The hash mix function for type ip_route_key_t.
-
std::string
to_string
() const Returns a string representation of the current object’s values.
Private Members
-
std::shared_ptr< ip_route_key_impl_t >
pimpl
Friends
-
friend std::ostream &
operator<<
A utility stream operator that adds a string representation of ip_route_key_t to the ostream.
-
-
class
ip_route_t
- #include <ip_route.h>
An IP v4/v6 static route. “Via”, or nexthops, for this route are stored separately and are associated by route key.
Public Functions
-
ip_route_t
()
-
ip_route_t
(ip_route_key_t const & key) Creates an IP static route for the route key.
-
ip_route_t
(const ip_route_t & other)
-
ip_route_t &
operator=
(ip_route_t const & other)
-
ip_route_key_t
key
() const Getter for ‘key’: the route’s key.
-
void
key_is
(ip_route_key_t const & key) Setter for ‘key’.
-
ip_route_tag_t
tag
() const Getter for ‘tag’: a numbered tag, used for table segregation.
-
void
tag_is
(ip_route_tag_t tag) Setter for ‘tag’.
-
bool
operator==
(ip_route_t const & other) const
-
bool
operator!=
(ip_route_t const & other) const
-
uint32_t
hash
() const The hash function for type ip_route_t.
-
void
mix_me
(hash_mix & h) const The hash mix function for type ip_route_t.
-
std::string
to_string
() const Returns a string representation of the current object’s values.
Private Members
-
std::shared_ptr< ip_route_impl_t >
pimpl
Friends
-
friend std::ostream &
operator<<
A utility stream operator that adds a string representation of ip_route_t to the ostream.
-
-
class
ip_route_via_t
- #include <ip_route.h>
A Via describing a particular set of nexthop information. A Via can describe either a nexthop group name to either forward traffic to, or drop traffic if the interface is Null0.
Public Functions
-
ip_route_via_t
()
-
ip_route_via_t
(ip_route_key_t const & route_key) Creates a route via for a route key.
-
ip_route_via_t
(const ip_route_via_t & other)
-
ip_route_via_t &
operator=
(ip_route_via_t const & other)
-
ip_route_key_t
route_key
() const Getter for ‘route_key’: key for the route that this via is attached to.
-
void
route_key_is
(ip_route_key_t const & route_key) Setter for ‘route_key’.
-
ip_addr_t
hop
() const Getter for ‘hop’: IP v4/v6 nexthop address, or a default ip_addr_t if not set.
-
void
hop_is
(ip_addr_t const & hop) Setter for ‘hop’.
-
intf_id_t
intf
() const Getter for ‘intf’: use the named interface if not a default intf_id_t. Using intf Null0 installs a “drop” route for the given prefix and preference.
-
void
intf_is
(intf_id_t intf) Setter for ‘intf’.
-
std::string
nexthop_group
() const Getter for ‘nexthop_group’: name of the next-hop group to use. If this string is non-empty, the next-hop group of the given name will be used, and both “hop” and “intf” must be left to their default value otherwise we will panic(). Note this is currently only supported for IPv4 routes.
-
void
nexthop_group_is
(std::string const & nexthop_group) Setter for ‘nexthop_group’.
-
mpls_label_t
mpls_label
() const Getter for ‘mpls_label’: Push this MPLS label onto packets using this route.
-
void
mpls_label_is
(mpls_label_t mpls_label) Setter for ‘mpls_label’.
-
vni_t
vni
() const Getter for ‘vni’: the VNI to use in the underlay tunnel vxlan header.
-
void
vni_is
(vni_t vni) Setter for ‘vni’.
-
ip_addr_t
vtep_addr
() const Getter for ‘vtep_addr’: IP v4 destination address for the underlay IP header.
-
void
vtep_addr_is
(ip_addr_t vtep_addr) Setter for ‘vtep_addr’.
-
eth_addr_t
router_mac
() const Getter for ‘router_mac’: DMAC to use in the underlay ethernet header.
-
void
router_mac_is
(eth_addr_t router_mac) Setter for ‘router_mac’.
-
std::string
egress_vrf
() const Getter for ‘egress_vrf’: VRF name in which nexthop IP address is.
-
void
egress_vrf_is
(std::string const & egress_vrf) Setter for ‘egress_vrf’.
-
ip_via_metric_t
metric
() const Getter for ‘metric’: metric for the via.
-
void
metric_is
(ip_via_metric_t metric) Setter for ‘metric’.
-
bool
operator==
(ip_route_via_t const & other) const
-
bool
operator!=
(ip_route_via_t const & other) const
-
uint32_t
hash
() const The hash function for type ip_route_via_t.
-
void
mix_me
(hash_mix & h) const The hash mix function for type ip_route_via_t.
-
std::string
to_string
() const Returns a string representation of the current object’s values.
Private Members
-
std::shared_ptr< ip_route_via_impl_t >
pimpl
Friends
-
friend std::ostream &
operator<<
A utility stream operator that adds a string representation of ip_route_via_t to the ostream.
-
-
typedef uint32_t