Policy#
Routing Policies → PPolicies
The Policy resource in this app is an abstraction for a routing policy that controls the distribution of reachability information, both internally (local to the device) and externally to peers.
A Policy can be applied in two directions:
- An import
Policycontrols which received routes are installed in the routing table. - An export
Policycontrols which installed routes are advertised to a routing peer.
Routing Policies are also used to leak routes from one virtual Router to another.
Policy statements#
A routing Policy consists of an ordered list of policy statements. Each statement has a required name and may define match criteria and an action. The action may modify matching routes and may set a policy result that controls evaluation.
Match criteria, actions, and policy results are discussed below.
Match criteria#
The routing policy can look at several aspects of a route. Some examples are:
- The protocol type of the route (BGP, IS-IS, ...)
- The address family of the route (IPv4 unicast, EVPN, ...)
- Whether the route matches a certain
PrefixSet - Whether there is an internal routing tag associated with the route that belongs to a certain
TagSet
Specific to BGP routes:
- Whether the AS path of a route matches an
ASPathSet - Whether the BGP route has route attributes that match a certain
CommunitySet
If a route matches all match criteria, the action is taken (if specified), and the policy result of the statement is evaluated.
Actions#
When the route that is being evaluated matches all match criteria, the route can be modified. This may be useful to tag all routes that are received from a particular BGP peer, or to evaluate whether a route should be redistributed to other network elements. Some examples of route modifications are:
- Adding an internal routing
tagto the route - Modifying the route preference for the route
Specific to BGP routes:
- Modifying BGP attributes like the local preference and MED values
- Prepending to, removing, or replacing the AS path
- Adding, removing, or replacing BGP communities
- Rewriting the next-hop for the route
After the actions have been executed on the route, the policy result of the statement is evaluated.
Action and policy-result support is platform- and version-specific. On the current EOS and NX-OS implementations, NextPolicy and NextStatement do not retain the semantics described below.
Policy result#
When the route being evaluated matches all match criteria, and the appropriate actions have been taken to modify the route, the policy result of the statement determines what happens next:
Accept: accept the route and do not evaluate any other policy statements (including the default policy statement). Do not evaluate any otherPoliciesfor this route.Reject: reject the route and do not evaluate any other policy statements (including the default policy statement). Do not evaluate any otherPoliciesfor this route.NextPolicy: do not evaluate any other policy statements (including the default policy statement). Continue evaluation in the nextPolicy.NextStatement: continue evaluating the remaining statements of thePolicy.
Default policy statement#
If all Policy statements have been evaluated, and the route is neither rejected nor accepted, the default action determines what happens to the route.
Dependencies#
This resource does not have any depencies.
Referenced resources#
PrefixSet#
PrefixSets can be used in the match criteria of a policy statement to determine what actions are performed on matching routes.
ASPathSet#
ASPathSets can be used in the match criteria of a policy statement to determine what actions are performed on BGP routes that have a certain Autonomous System (AS) path.
CommunitySet#
CommunitySets can be used in the match criteria of a policy statement to determine what actions are performed based on whether a BGP route's community values match the set.
They can also be used to add, remove, or replace the BGP communities of a matching route with the communities in the set.
TagSet#
TagSets can be used in the match criteria of a policy statement to determine what actions are performed on routes that have none, one, or more associated internal routing tags in the set.
They can also be used to set the internal routing tag of a matching route.
Examples#
cat << 'EOF' | kubectl apply -f -
apiVersion: routingpolicies.eda.nokia.com/v1
kind: Policy
metadata:
name: process-tagged-routes
namespace: routingpolicies
spec:
defaultAction:
policyResult: Accept
statements:
- action:
policyResult: Reject
match:
tags:
tagSet: no-export
name: reject routes with no-export tag
EOF
Custom Resource Definition#
To browse the Custom Resource Definition go to crd.eda.dev.
Policy
SPEC
Policy defines a set of rules and actions to manage network traffic or routing behavior, with statements that include matching conditions and actions, such as accepting or rejecting routes, or modifying route attributes like BGP parameters.
-
The name of the policy to configure on the device.
-
The default action to apply if no other actions are defined.
-
Actions related to the BGP protocol.
-
Clear the AS path to make it empty.
-
Replace the existing AS path with a new AS_SEQUENCE containing the listed AS numbers.
-
Set a new LOCAL_PREF value for matching BGP routes.
format: int64range: >= 0 -
Set a new ORIGIN attribute for matching BGP routes.
enum: "egp", "igp", "incomplete"
-
Final disposition for the route.
enum: "Accept", "Reject", "NextPolicy", "NextStatement" -
Set the RTM route preference (administrative distance) value.
format: int32range: 1 to 255
-
-
List of policy statements.
-
-
Actions for routes that match the policy statement.
-
Actions related to the BGP protocol.
-
Clear the AS path to make it empty.
-
Replace the existing AS path with a new AS_SEQUENCE containing the listed AS numbers.
-
Set a new LOCAL_PREF value for matching BGP routes.
format: int64range: >= 0 -
Set a new ORIGIN attribute for matching BGP routes.
enum: "egp", "igp", "incomplete"
-
Final disposition for the route.
enum: "Accept", "Reject", "NextPolicy", "NextStatement" -
Set the RTM route preference (administrative distance) value.
format: int32range: 1 to 255
-
-
Match conditions of the policy statement.
-
Configuration for BGP-specific policy match criteria.
-
AS Path match criteria.
-
A singular regular expression string to match against AS_PATH objects. Mutually exclusive with the ASPathSet reference.
-
Reference to an ASPathSet resource. Mutually exclusive with the ASPathExpression.
-
The matching criteria that applies to the members in the referenced set.
enum: "Any", "All", "Invert"
-
-
Match conditions for BGP communities.
-
Match conditions for EVPN route types.
-
-
Address families that the route belongs to.
-
Reference to a PrefixSet resource.
-
The route protocol type to match.
enum: "Aggregate", "ARP_ND", "BGP", +12 more
-
-
Name of the policy statement.
-
-
STATUS
PolicyStatus defines the observed state of Policy.