Nexthop groups are a forwarding/tunneling abstraction in EOS.
A nexthop group is comprised of a tunneling protocol (IP/GRE or MPLS, for example) and a collection of nexthop (aka destination) IP addresses and other forwarding information (such as MPLS stack operations to apply for traffic sent to that nexthop). The same IP address may be specified in more than one entry within the group, allowing for unequal cost load balancing. By using distinct addresses for each entry, equal cost load balancing can be achieved.
The nexthop or destination IP is the tunnel (outer) destination IP address for GRE and IP-in-IP. For MPLS, the nexthop address is used to find (via ARP/ND) a MAC address for the MPLS next hop.
Nexthop entries must be manually monitored and maintained by the agent. If a tunnel destination (aka nexthop) becomes unreachable, traffic hashed to that entry will be black-holed in the network until a working entry is set in that index of the nexthop group, or the entry is deleted.
Presently, all nexthop groups encapsulate traffic directed to them, either as an IP-in-IP (IP protocol 4) tunnel, a GRE (IP protocol 47) tunnel encapsulating either IPv4, IPv6 or MPLS traffic, or as pure MPLS frames. MPLS label switching operations are also supported, see the nexthop_group_entry_t class for more information.
Presently, MPLS switching actions are only only supported when used with PBR and cannot be used with IP routes.
The following example creates a nexthop group called “nhg1” which performs GRE encapsulation of traffic sent to it, sending traffic to two different nexthop IP addresses unequally (at a 2/3 to 1/3 ratio). For a usage of a nexthop group with policy routing, see the policy_map.h file.
eos::nexthop_group_t nhg("nhg1", eos::NEXTHOP_GROUP_GRE); // Specify two destinations (nexthop group entries) for the traffic eos::nexthop_group_entry_t nhe1(eos::ip_addr_t("172.12.1.1")); eos::nexthop_group_entry_t nhe2(eos::ip_addr_t("172.12.1.2")); // Set the nexthop group entries on the group with unequal cost load balancing // Balance traffic 2/3 to 172.12.1.1, 1/3 to 172.12.1.2. nhg.nexthop_entry_set(0, nhe1); nhg.nexthop_entry_set(1, nhe1); nhg.nexthop_entry_set(2, nhe2);
This class handles changes to a nexthop group’s status.
Public Functions
Registers this class to receive change updates on all nexthop groups.
Expects a boolean signifying whether notifications should be propagated to this instance or not.
Registers this class to receive change updates on the given nexthop group.
Expects the name of the corresponding nexthop group and a boolean signifying whether notifications should be propagated to this instance or not.
Handler called when the active status of a nexthop_group changes.
Private Functions
Friends
A manager of ‘nexthop-group’ configurations.
Create one of these via an sdk object prior to starting the agent main loop. When your eos::agent_handler::on_initialized virtual function is called, the manager is valid for use.
Public Functions
Iterates over all the nexthop groups currently configured.
Retrieves an existing nexthop_group_t by name, if it exists. Otherwise this returns an empty `nexthop_group_t()`
Returns the counter corresponding to the given nexthop group name and entry, if it exists. Otherwise this returns an empty ‘nexthop_group_entry_counter_t()’
Counters are reset whenever nexthop group entry configuration changes.
Returns true if a nexthop group with the given name has been configured.
Returns whether or not the given nexthop group is active.
Nexthop groups are active if the FIB has prefixes using this group. Deleting an active nexthop group will cause all prefixes that point to that nexthop group to blackhole their traffic.
In order to hitlessly delete a nexthop group, first delete all prefixes that point to it, wait for the nexthop group to no longer be active (using nexthop_group_handler::on_nexthop_group_active), and then delete the nexthop group.
Creates or updates a nexthop group.
Removes the named nexthop group from the configuration if it exists.
Protected Functions
Private Members
Friends
Enums
The type of encapsulation to use for this nexthop group.
The present nexthop group types are all tunnel encapsulations. Each causes a variety of packet headers for packets using the group to be changed to appropriately encapsulate the frame.
Values:
IP in IP encapsulation.
GRE encapsulation.
MPLS encapsulation.
How the GRE tunnel key is set for GRE nexthop groups.
Values:
Default value; do not set the GRE tunnel key.
Use the ingress interface as the tunnel key. Not supported in this release.
An MPLS nexthop group switching operation.
This structure combines a stack of labels and an MPLS switching operation using those labels, such as eos::MPLS_ACTION_PUSH.
Public Functions
Default constructor.
Constructs an MPLS action with a specific switching operation.
Constructs a populated MPLS label stack for some switching action.
Getter for ‘action_type’: The MPLS switching operation for this action.
Setter for ‘action_type’.
Getter for ‘label_stack’: The MPLS label stack.
The first element is the outermost label.
Setter for ‘label_stack’.
Prepend one label_stack to the list.
Remove all matching label_stack elements.
Returns a string representation of the current object’s values.
Friends
A utility stream operator that adds a string representation of nexthop_group_mpls_action_t to the ostream.
Defines counter for a nexthop entry.
Public Functions
Returns a string representation of the current object’s values.
Private Members
Friends
A utility stream operator that adds a string representation of nexthop_group_entry_counter_t to the ostream.
A nexthop group destination entry.
An entry consists of a nexthop IP address, and optionally an MPLS label switching operation.
Public Functions
Getter for ‘mpls_action’: MPLS label switching stack for this entry.
Setter for ‘mpls_action’.
Getter for ‘nexthop’: The next hop IP address for this entry.
Setter for ‘nexthop’.
Returns a string representation of the current object’s values.
Friends
A utility stream operator that adds a string representation of nexthop_group_entry_t to the ostream.
A nexthop group.
A nexthop group represents encapsulation and IP addressing information to be used with a policy routing application.
Public Functions
Getter for ‘name’: The unique name of the nexthop group.
Getter for ‘type’: The type of packet encapsulation used on the group.
Getter for ‘gre_key_type’: For GRE nexthop groups, how to set the GRE tunnel key.
Getter for ‘ttl’: The TTL set in frame headers of IP-in-IP or GRE tunnels.
Setter for ‘ttl’.
Getter for ‘source_ip’: The source IP used on frames sent on this group.
Setter for ‘source_ip’.
Getter for ‘source_intf’: The source interface to use.
Setter for ‘source_intf’.
The maximum size of the nexthop group in entries.
Getter for ‘nexthops’: Array index to nexthop group entry map.
Setter for ‘nexthops’.
inserts key/value pair to the map.
deletes the key/value pair from the map.
Getter for ‘destination_ips’: Array index to IP address map.
Setter for ‘destination_ips’.
inserts key/value pair to the map.
deletes the key/value pair from the map.
Getter for ‘persistent’: The source interface to use.
Setter for ‘persistent’.
Returns a string representation of the current object’s values.
Private Members
Friends
A utility stream operator that adds a string representation of nexthop_group_t to the ostream.