.. _bgp-user-guide-rib-config-policies:
RIB Policy Configuration
========================
The OpenDaylight BGP implementation supports configurable RIB policies that allow the modification of import and export policies.
.. note:: Default ODL BGP RIB Config Policy is provided. Any config policy to be used by Protocol must be configured and present before than Protocol configuration is added. If policy is reconfigured, protocol must be re configured again.
**URL:** ``/restconf/config/openconfig-routing-policy:routing-policy``
**Method:** ``GET``
**Content-Type:** ``application/xml``
**Request Body:**
.. code-block:: xml
:linenos:
:emphasize-lines: 2,15
...
...
...
default-odl-export-policy
to-odl-internal
...
...
...
default-odl-import-policy
...
@line 2: BGP defined sets.
@line 15: Policy definitions.
Policy Configuration
--------------------
Conditions may include multiple match or comparison operations; similarly, actions may consist of a multitude of changes to route attributes or a final disposition regarding the acceptance or rejection of the route.
**URL:** ``/restconf/config/openconfig-routing-policy:routing-policy/openconfig-routing-policy:policy-definitions/``
**Method:** ``POST``
**Content-Type:** ``application/xml``
**Request Body:**
.. code-block:: xml
:linenos:
:emphasize-lines: 2,5,7,10
odl-policy-example
reject-all-incoming-routes
/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]
@line 2: The unique policy instance identifier.
@line 5: Policy Statement Identifier.
@line 7: Actions.
@line 10: BGP Conditions.
-----
The new instance presence can be verified via REST:
**URL:** ``/restconf/config/openconfig-routing-policy:routing-policy/openconfig-routing-policy:policy-definitions/policy-definition/odl-policy-example``
**Method:** ``GET``
**Response Body:**
.. code-block:: xml
:linenos:
:emphasize-lines: 2,5
odl-policy-example
reject-all-incoming-routes
/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]
ANY
@line 2: Policy definition Identifier.
@line 5: Policy Statement Identifier.
Actions
```````
ODL BGP by default provides support for a group of BGP Actions.
Accept
''''''
Default policy to accept the route.
.. code-block:: xml
:linenos:
:emphasize-lines: 2
Reject
''''''
Default policy to reject the route.
.. code-block:: xml
:linenos:
:emphasize-lines: 2
As-path prepend
'''''''''''''''
Action to prepend local AS number to the AS-path
.. code-block:: xml
:linenos:
:emphasize-lines: 3
Originator Id prepend
'''''''''''''''''''''''''
Action to prepend Originator Id. In case there is non Originator Id present, local Originator Id is prepend.
* Local
.. code-block:: xml
:linenos:
:emphasize-lines: 2
* By value
.. code-block:: xml
:linenos:
:emphasize-lines: 2
192.0.2.1
Cluster Id prepend
''''''''''''''''''
Action to prepend local Cluster Id to Cluster Id List.
.. code-block:: xml
:linenos:
:emphasize-lines: 3
Set Route Origin
''''''''''''''''
Set the origin attribute to the specified value.
.. code-block:: xml
:linenos:
:emphasize-lines: 3
IGP
Set Local Preference
''''''''''''''''''''
Set the local pref attribute on the route update.
.. code-block:: xml
:linenos:
:emphasize-lines: 3
100
Set NextHop
'''''''''''
Set the next-hop attribute in the route update.
* Local
.. code-block:: xml
:linenos:
:emphasize-lines: 3
SELF
* By value
.. code-block:: xml
:linenos:
:emphasize-lines: 3
4.5.6.7
Set MED
'''''''
Set the med metric attribute in the route update.
.. code-block:: xml
:linenos:
:emphasize-lines: 3
15
Community set prepend
'''''''''''''''''''''
Action to set the community attributes of the route, along with options to modify how the community is modified.
* Inline
.. code-block:: xml
:linenos:
:emphasize-lines: 3
65
10
66
11
ADD
@line 3: Set Community.
* By reference
.. code-block:: xml
:linenos:
:emphasize-lines: 3,5,7
/rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-example"]
ADD
@line 3: Set Community.
@line 5: Community set reference.
@line 7: Options are ADD, REMOVE, REPLACE.
-----
Defined set
.. code-block:: xml
:linenos:
:emphasize-lines: 3
community-set-name-test
65
10
66
11
@line 3: Community set.
Extended Community set action
''''''''''''''''''''''''''''''
Action to set the extended community attributes of the route, along with options to modify how the community is modified.
* Inline
.. code-block:: xml
:linenos:
:emphasize-lines: 3
vxlan
65000
123
ADD
@line 3: Set Extended Community.
* By reference
.. code-block:: xml
:linenos:
:emphasize-lines: 3
/rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-example"]
REMOVE
@line 3: Set Extended Community.
@line 5: Extended Community set reference.
@line 7: Options are ADD, REMOVE, REPLACE.
-----
Defined set
.. code-block:: xml
:linenos:
:emphasize-lines: 3
ext-community-set-name-test
vxlan
65000
123
@line 3: Extendend Community set.
@line 5: Extendend Community set name.
Filter Non transitive attributes
''''''''''''''''''''''''''''''''
Filters attributes, removing non transitive attributes.
.. code-block:: xml
:linenos:
:emphasize-lines: 3
Client Attribute Prepend
''''''''''''''''''''''''
Replace attributes per any VPN Route attributes from client Peer, if present.
.. code-block:: xml
:linenos:
:emphasize-lines: 3
Conditions
``````````
ODL BGP by default provides support for a group of BGP Conditions.
Match BGP Neighbor Set
''''''''''''''''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3,4,5,6
/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="bgp-neighbor-set-example"]
INVERT
@line 3: Match BGP Neighbor Condition set.
@line 4: Match BGP Neighbor from whom we receive the route.
@line 5: Match BGP Neighbor Set reference.
@line 6: Match Set Options (ANY, INVERT)
.. code-block:: xml
:linenos:
:emphasize-lines: 3,4,5,6
/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="bgp-neighbor-set-example"]
INVERT
@line 3: Match BGP Neighbor Condition set.
@line 4: Match BGP Neighbor to whom we send the route.
@line 5: Match BGP Neighbor Set reference.
@line 6: Match Set Options (ANY, INVERT)
.. code-block:: xml
:linenos:
:emphasize-lines: 3,4,5,7,8,9
/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="bgp-neighbor-set-example"]
/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="bgp-neighbor-set-example"]
INVERT
@line 3: Match BGP Neighbor Condition set.
@line 4: Match BGP Neighbor from whom we receive the route.
@line 5: Match BGP Neighbor Set reference.
@line 7: Match BGP Neighbor to whom we send the route.
@line 8: Match BGP Neighbor Set reference.
@line 9: Match Set Options (ANY, INVERT)
-----
Defined set
.. code-block:: xml
:linenos:
:emphasize-lines: 3,5
bgp-neighbor-set-example
127.0.0.1
127.0.0.2
@line 3: Originator Id Set.
@line 5: Originator Id Set name.
Match Originator Id Set
'''''''''''''''''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3,5,7
/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/originator-id-sets/originator-id-set[originator-set-name="local-originator-id"]
INVERT
@line 3: Match Originator Id Condition set.
@line 5: Match Originator Id Set reference.
@line 7: Match Set Options (ANY, INVERT)
-----
Defined set
.. code-block:: xml
:linenos:
:emphasize-lines: 3,5
local-originator-id
@line 3: Originator Id Set.
@line 5: Originator Id Set name.
Match Cluster Id Set
''''''''''''''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3,5
/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/cluster-id-sets/cluster-id-set[cluster-set-name="local-cluster-id"]
INVERT
@line 3: Match Cluster Id Condition set.
@line 5: Match Cluster Id Set reference.
-----
Defined set
.. code-block:: xml
:linenos:
:emphasize-lines: 3,5
local-cluster-id
@line 3: Cluster Id Set.
@line 5: Cluster Id Set name.
Match Peer Role Set
'''''''''''''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3,5,6
/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]
INVERT
/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]
@line 3: Match Role Set.
@line 5: Match Role Set reference.
@line 6: Match Set Options (ANY, INVERT)
-----
Defined set
.. code-block:: xml
:linenos:
:emphasize-lines: 3,4,10,11
all
ebgp
ibgp
rr-client
internal
only-ibgp
ibgp
@line 3: Role Set.
@line 4: Role Set name.
@line 10: Role Set.
@line 11: Role Id Set name.
Match AS Path Set
'''''''''''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3,5,7
/rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:as-path-sets/bgp-pol:as-path-set/[as-path-set-name="as-path-set-example"]
ANY
@line 3: Match AS Path Set.
@line 5: AS Path Set reference.
@line 7: Match Set Option(ANY, ALL, INVERT).
-----
Defined set
.. code-block:: xml
:linenos:
:emphasize-lines: 4,5,6
as-path-set-example
65
64
63
@line 4: AS Path Set.
@line 5: AS Path Set name.
@line 6: AS Path set member
Match Community Set
'''''''''''''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3,5
/rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-example"]
ANY
@line 3: Match Community Set.
@line 5: Match Community Set reference.
@line 7: Match Set Option(ANY, ALL, INVERT).
-----
Defined set
.. code-block:: xml
:linenos:
:emphasize-lines: 4,5,6,10
community-set-name-example
65
10
66
11
@line 4: Community Set.
@line 5: Community Set name.
@line 6: Communities.
@line 10: Communities.
Match Extended Community Set
''''''''''''''''''''''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3,5,7
/rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-test"]
ANY
@line 3: Match Extended Community Set.
@line 5: Match Extended Community Set reference.
@line 7: Match Set Option(ANY, ALL, INVERT).
-----
Defined set
.. code-block:: xml
:linenos:
:emphasize-lines: 4,5,6,11
ext-community-set-name-test
vxlan
65000
123
@line 4: Extended Community Set.
@line 5: Extended Community Set name.
@line 6: Extended Communities.
@line 11: Extended Communities.
Match in Afi Safi
'''''''''''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3
x:IPV4-UNICAST
@line 3: Afi Safi match.
Match not in Afi Safi
'''''''''''''''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3
x:IPV4-UNICAST
x:IPV6-UNICAST
@line 3: Afi Safi not in match.
Match As Path Length
''''''''''''''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3
x:attribute-eq
2
@line 3: As Path Length match.
Match Local Pref
''''''''''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3
100
@line 3: Local Preference match.
Match Origin
''''''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3
IGP
@line 3: Origin match.
Match MED
'''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3
100
@line 3: MED match.
Match Next Hop
''''''''''''''
.. code-block:: xml
:linenos:
:emphasize-lines: 3
192.168.2.2
42.42.42.42
@line 3: Next hop match.
Match VPN Non member
''''''''''''''''''''
True if Route Targets attributes does not match with any Route Target Contrain advertized per Advertized peer.
.. code-block:: xml
:linenos:
:emphasize-lines: 3
@line 3: VPN Non member match.