Routing policy parameterization

Routing policy parameterization allows operators a powerful and flexible configuration approach to routing policies for policies are often reused across BGP peers of a common type (such as, transit, peer, customer).

In current modes of operation as shown in Figure: Route policy past mode of operation, an operator must create individual routing policies, prefix-lists, AS-Path lists, community lists, and so on for each peer despite many times the policy ultimately being the same. In this case, should an operator with 100 peers with a common policy behavior but unique policies have to make a change to entry 135 in the policy, they must do it on all policies – a significant amount of work that can result in incorrect/inconsistent policy behavior.

Figure: Route policy past mode of operation

Using a parameter based system allows an operator to have a single policy that is consistent across all peers of a type, while retaining the flexibility to reference different policy functions (such as, prefixes, prefix-lists, community lists) with unique names if required, by defining variables and the variable value. This feature is able to inherit some of these variables directly from the routing process (for example, ‟@peerAS@” would be the configured BGP peer-AS).

Additionally, instead of policies being fixed and requiring many statements, the use of parameters and variables may be passed to simplify policy configuration. This reduces the number of policies required on a peering edge router with large numbers of peers where only small amounts of configuration changes between peers, such as the ASN and prefix-list name.

The following two types of policy variables are supported.

Note: Local policy variables have precedence over global policy variables, if policy variables have the same name.
Figure: Route policy parameterization using sub-policies

Variables expansion can use two formats, with the variable name delimited by at-signs (@) at the beginning and the end:

Table: Route policy variable support in policy parameters lists route policy variables supported in policy parameters.

Table: Route policy variable support in policy parameters
Parameter name Variable in policy ‟from” statement Variable in policy ‟action” statement Variable format Standard format release Midstring format release

aigp-metric

No

Yes

Standard

13.0.R4

as-path

Yes

Yes

Midstring

12.0.R1

13.0.R1

as-path expression

Yes

No

Midstring

12.0.R4

13.0.R1

as-path-group

Yes

No

Midstring

12.0.R1

13.0.R1

as-path-group expression

Yes

No

Midstring

12.0.R4

13.0.R1

as-path-length

Yes

Standard

15.0.R1

as-path-prepend

Yes

Standard

13.0.R4

cluster-id

No

community

Yes

Yes

Midstring

12.0.R1

13.0.R1

community-count

Yes

Standard

15.0.R1

N/A

damping

No

Yes

Midstring

13.0.R4

13.0.R4

local-preference

Yes (15.0.R1)

Yes (13.0.R4)

Standard

13.0.R4

metric

Yes (15.0.R1)

Yes (13.0.R4)

Standard

13.0.R4

next-hop

No

Yes

Standard

13.0.R4

origin

No

Yes

Standard

13.0.R4

path-type

No

preference

No

Yes

Standard

13.0.R4

prefix-list

Yes

No

Midstring

12.0.R1

13.0.R1

tag

No

Yes

Standard

13.0.R4

type

No

Yes

Standard

13.0.R4

Note: Midstring variables are only supported in the object name. Standard variables are supported in policy parameters inside as-path or as-path-group expression objects; for example: as-path ‟as” expression ‟.{65001,@variable@}65022”.

For the definition of the variables, there are three different possible types:

Depending on the parameter referenced, specify the correct type as follows:

The logical flow of this is to configure a per-peer policy in which the variable names and values are defined. Using Figure: Route policy parameterization using sub-policies as the example, the following configuration would be applied:

prefix-list "pfx-as63535"
    prefix 6.3.5.0/24 through 32
exit
prefix-list "pfx-as64535"
    prefix 6.4.5.0/24 through 32
exit
prefix-list "pfx-as65535"
    prefix 6.5.5.0/24 through 32
exit

community "cm-as63535" members "7750:63535"
community "cm-as65535" members "7750:65535"
community "cm-as64535-rejects" members "64535:14"
community "cm-as65535-rejects" members "65535:14"
community "cm-as64535-highpref" members "7777:64535"

as-path "as63535" expression "^63535$"
as-path "as64535" expression "^64535$"
as-path "as65535" expression "^65535$"

policy-statement "peer1"
    entry 5
        from
            policy-variables
                name "@cm-reject@" value "cm-as65535-rejects"
            exit
            policy "std-peering-inbound-drop"
        exit
        action reject
    entry 10
        from
            policy-variables
                name "@localcm@" value "cm-as65535"
                name "@peer-as@" value "as65535"
                name "@cm-highpref@" value "cm-as65535-highpref"
                name "@peer-prefix@" value "pfx-as65535"
            exit
            policy "std-peering-inbound-main"
        exit
        action accept
        exit
    exit
exit

policy-statement "peer2"
    entry 5
        from
            policy-variables
                name "@cm-reject@" value "cm-as64535-rejects"
            exit
            policy "std-peering-inbound-drop"
        exit
        action reject
    entry 10
        from
            policy-variables
                name "@localcm@" value "cm-as64535"
                name "@peer-as@" value "as64535"
                name "@cm-highpref@" value "cm-as64535-highpref"
                name "@peer-prefix@" value "pfx-as64535"
            exit
            policy "std-peering-inbound-main"
        exit
        action accept
        exit
    exit
exit

policy-statement "peer3"
    entry 5
        from
            policy-variables
                name "@cm-reject@" value "cm-as63535-rejects"
            exit
            policy "std-peering-inbound-drop"
        exit
        action reject
    entry 10
        from
            policy-variables
                name "@localcm@" value "cm-as63535"
                name "@peer-as@" value "as63535"
                name "@cm-highpref@" value "cm-as63535-highpref"
                name "@peer-prefix@" value "pfx-as63535"
            exit
            policy "std-peering-inbound-main"
        exit
        action accept
        exit
    exit
exit

policy-statement "std-peering-inbound-drop"
    default-action reject
    entry 10
        from
            community "@cm-reject@"
        exit
        action accept

policy-statement "std-peering-inbound-main"
    default-action reject
    entry 10
        from
            prefix-list "@peer-prefix@"
            as-path "@peer-as@"
        exit
        action accept
            community add "@localcm@"
            local-preference 400
        exit
    exit
    entry 20
        from
            community "@cm-highpref@"
        exit
        action accept
            community add "@localcm@"
            local-preference 4000
        exit
    exit
exit

This configuration would take slightly different actions depending on the peer.

Peer 1

Peer 2

Peer 3