1 .. _bgp-user-guide-route-target-family:
3 Route Target Constrain Family
4 =============================
5 The BGP Multicast Route Target (RT) Constrain Multiprotocol extension can be used to restrict advertisement of VPN NLRI to peers that have advertised
6 their respective Route Targets, effectively building a route distribution graph.
14 This section shows a way to enable ROUTE-TARGET-CONSTRAIN family in BGP speaker and peer configuration.
18 To enable ROUTE-TARGET-CONSTRAIN support in BGP plugin, first configure BGP speaker instance:
20 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
28 **Content-Type:** ``application/xml``
34 <protocol xmlns="http://openconfig.net/yang/network-instance">
35 <name>bgp-example</name>
36 <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
37 <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
40 <router-id>192.0.2.2</router-id>
45 <afi-safi-name>ROUTE-TARGET-CONSTRAIN</afi-safi-name>
54 **Content-Type:** ``application/json``
63 "identifier": "openconfig-policy-types:BGP",
64 "name": "bgp-example",
65 "bgp-openconfig-extensions:bgp": {
68 "router-id": "192.0.2.2",
74 "afi-safi-name": "ROUTE-TARGET-CONSTRAIN"
86 Here is an example for BGP peer configuration with enabled ROUTE-TARGET-CONSTRAIN family.
88 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors``
96 **Content-Type:** ``application/xml``
102 <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
103 <neighbor-address>192.0.2.1</neighbor-address>
106 <afi-safi-name>ROUTE-TARGET-CONSTRAIN</afi-safi-name>
113 **Content-Type:** ``application/json``
122 "neighbor-address": "192.0.2.1",
126 "afi-safi-name": "ROUTE-TARGET-CONSTRAIN"
134 ROUTE-TARGET-CONSTRAIN Route API
135 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
136 Following tree illustrates the BGP ROUTE-TARGET-CONSTRAIN route structure.
138 .. code-block:: console
140 :(route-target-constrain-routes-case)
141 +--rw route-target-constrain-routes
142 +--rw route-target-constrain-route* [route-key path-id]
143 +--rw origin-as inet:as-number
144 +--rw (route-target-constrain-choice)
145 +--:(route-target-constrain-default-case)
146 | +--rw route-target-constrain-default-route!
147 +--:(route-target-constrain-route-case)
148 | +--rw route-target-extended-community
149 | +--rw global-administrator? short-as-number
150 | +--rw local-administrator? binary
151 +--:(route-target-constrain-ipv4-route-case)
152 | +--rw route-target-ipv4
153 | +--rw global-administrator? inet:ipv4-address
154 | +--rw local-administrator? uint16
155 +--:(route-target-constrain-as-4-extended-community-case)
156 +--rw as-4-route-target-extended-community
157 +--rw as-4-specific-common
158 +--rw as-number inet:as-number
159 +--rw local-administrator uint16
163 The ROUTE TARGET CONSTRAIN table in an instance of the speaker's Loc-RIB can be verified via REST:
165 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-route-target-constrain:route-target-constrain-subsequent-address-family/bgp-route-target-constrain:route-target-constrain-routes``
177 <route-target-constrain-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp:route:target:constrain">
178 <route-target-constrain-route>
179 <route-key>flow1</route-key>
181 <origin-as>64511</origin-as>
182 <route-target-extended-community>
183 <global-administrator>64511</global-administrator>
184 <local-administrator>AAAAZQ==</local-administrator>
185 </route-target-extended-community>
188 <global>199.20.166.41</global>
198 </route-target-constrain-route>
199 </route-target-constrain-routes>
208 "route-target-constrain-routes": {
209 "route-target-constrain-route": [
214 "route-target-extended-community": {
215 "global-administrator": 64511,
216 "local-administrator": "AAAAZQ=="
226 "global": "199.20.166.41"
244 <name>default-odl-export-policy</name>
248 <name>from-external-to-external-RTC</name>
250 <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
251 <afi-safi-in xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">x:ROUTE-TARGET-CONSTRAIN</afi-safi-in>
252 <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
254 <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
257 <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
263 <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
264 <client-attribute-prepend xmlns="urn:opendaylight:params:xml:ns:yang:bgp:route:target:constrain"/>
271 <name>from-internal-or-rr-client-to-route-reflector</name>
273 <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
274 <afi-safi-not-in xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions"
275 xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">x:ROUTE-TARGET-CONSTRAIN
277 <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
279 <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
282 <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
288 <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
289 <set-cluster-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
290 <set-originator-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
295 <name>from-internal-or-rr-client-to-route-RTC</name>
297 <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
298 <afi-safi-in xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">x:ROUTE-TARGET-CONSTRAIN</afi-safi-in>
299 <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
301 <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
304 <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
310 <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
311 <set-originator-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
312 <set-next-hop>SELF</set-next-hop>
317 <name>vpn-membership-RTC</name>
319 <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
320 <afi-safi-in xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-in>
321 <afi-safi-in xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-in>
322 <vpn-non-member xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
338 "policy-definition": [
340 "name": "default-odl-export-policy",
344 "name": "from-external-to-external-RTC",
347 "afi-safi-in": "x:ROUTE-TARGET-CONSTRAIN",
350 "role-set": "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name=\"only-ebgp\"]"
353 "role-set": "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name=\"only-ebgp\"]"
360 "client-attribute-prepend": null
366 "name": "from-internal-or-rr-client-to-route-reflector",
369 "afi-safi-not-in": "x:ROUTE-TARGET-CONSTRAIN",
372 "role-set": "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name=\"ibgp-rr-client\"]"
375 "role-set": "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name=\"only-rr-client\"]"
382 "set-cluster-id-prepend": null,
383 "set-originator-id-prepend": null
388 "name": "from-internal-or-rr-client-to-route-RTC",
391 "afi-safi-in": "x:ROUTE-TARGET-CONSTRAIN",
394 "role-set": "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name=\"ibgp-rr-client\"]"
397 "role-set": "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name=\"only-rr-client\"]"
404 "set-originator-id-prepend": null,
405 "set-next-hop": "SELF"
410 "name": "vpn-membership-RTC",
414 "x:L3VPN-IPV4-UNICAST",
415 "x:L3VPN-IPV6-UNICAST"
417 "vpn-non-member": null
433 * `Constrained Route Distribution for Border Gateway Protocol/MultiProtocol Label Switching (BGP/MPLS) Internet Protocol (IP) Virtual Private Networks (VPNs) <https://tools.ietf.org/html/rfc4684>`_