Add Pcep statics doc
[docs.git] / docs / user-guide / bgp-user-guide.rst
1 .. _bgp-user-guide:
2 BGP User Guide
3 ==============
4 This guide contains information on how to use OpenDaylight Border Gateway Protocol (BGP) plugin.
5 The user should learn about BGP basic concepts, supported capabilities, configuration and usage.
6
7 .. contents:: Contents
8    :depth: 1
9    :local:
10
11 Overview
12 --------
13 This section provides high-level overview of the Border Gateway Protocol, OpenDaylight implementation and BGP usage in SDN era.
14
15 .. contents:: Contents
16    :depth: 2
17    :local:
18
19 Border Gateway Protocol
20 ^^^^^^^^^^^^^^^^^^^^^^^
21 The Border Gateway Protocol (BGP) is an inter-Autonomous System (AS) routing protocol.
22 The primary role of the BGP is an exchange of routes among other BGP systems.
23 The route is an unit of information which pairs destination (IP address prefix) with attributes to the path with the destination.
24 One of the most interesting attributes is a list of ASes that the route traversed - essential when avoiding loop routing.
25 Advertised routes are stored in the Routing Information Bases (RIBs). Routes are later used to forward packets, stored in Routing Table for this purpose.
26 The main advantage of the BGP over other routing protocols is its scalability, thus it has become the standardized Internet routing protocol (Internet is a set of ASes).
27
28 BGP in SDN
29 ^^^^^^^^^^
30 However BGP evolved long time before SDN was born, it plays a significant role in many SDN use-cases.
31 Also, continuous evolution of the protocol brings extensions that are very well suited for SDN.
32 Nowadays, BGP can carry various types of routing information - L3VPN, L2VPN, IP multicast, linkstate, etc.
33 Here is a brief list of software-based/legacy-network technologies where BGP-based SDN solution get into an action:
34
35 * SDN WAN - WAN orchestration and optimization
36 * SDN router - Turns switch into an Internet router
37 * Virtual Route Reflector - High-performance server-based BGP Route Reflector
38 * SDX - A Software Defined Internet Exchange controller
39 * Large-Scale Data Centers - BGP Data Center Routing, MPLS/SR in DCs, DC interconnection
40 * DDoS mitigation - Traffic Filtering distribution with BGP
41
42 OpenDaylight BGP plugin
43 ^^^^^^^^^^^^^^^^^^^^^^^
44 The OpenDaylight controller provides an implementation of BGP (RFC 4271) as a south-bound protocol plugin.
45 The implementation renders all basic *BGP speaker capabilities*:
46
47 * inter/intra-AS peering
48 * routes advertising
49 * routes originating
50 * routes storage
51
52 The plugin's **north-bound API** (``REST``/``Java``) provides to user:
53
54 * fully dynamic runtime standardized BGP configuration
55 * read-only access to all RIBs
56 * read-write programmable RIBs
57 * read-only reachability/linkstate topology view
58
59 .. note:: The BGP plugin is NOT a virtual router - does not construct Routing Tables, nor forward traffic.
60
61 List of supported capabilities
62 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63 In addition to the base protocol implementation, the plugin provides many extensions to BGP, all based on IETF standards.
64
65 * `RFC4271 <https://tools.ietf.org/html/rfc4271>`_ - A Border Gateway Protocol 4 (BGP-4)
66 * `RFC4456 <https://tools.ietf.org/html/rfc4456>`_ - BGP Route Reflection: An Alternative to Full Mesh Internal BGP (IBGP)
67 * `RFC1997 <https://tools.ietf.org/html/rfc1997>`_ - BGP Communities Attribute
68 * `RFC4360 <https://tools.ietf.org/html/rfc4360>`_ - BGP Extended Communities Attribute
69 * `RFC4486 <https://tools.ietf.org/html/rfc4486>`_ - Subcodes for BGP Cease Notification Message
70 * `RFC5492 <https://tools.ietf.org/html/rfc5492>`_ - Capabilities Advertisement with BGP-4
71 * `RFC5004 <https://tools.ietf.org/html/rfc5004>`_ - Avoid BGP Best Path Transitions from One External to Another
72 * `RFC6286 <https://tools.ietf.org/html/rfc6286>`_ - Autonomous-System-Wide Unique BGP Identifier for BGP-4
73 * `RFC6793 <https://tools.ietf.org/html/rfc6793>`_ - BGP Support for Four-Octet Autonomous System (AS) Number Space
74 * `RFC7311 <https://tools.ietf.org/html/rfc7311>`_ - The Accumulated IGP Metric Attribute for BGP
75 * `RFC5668 <https://tools.ietf.org/html/rfc5668>`_ - 4-Octet AS Specific BGP Extended Community
76 * `draft-ietf-idr-link-bandwidth <https://tools.ietf.org/html/draft-ietf-idr-link-bandwidth-06>`_ - BGP Link Bandwidth Extended Community
77 * `draft-ietf-idr-bgp-extended-messages <https://tools.ietf.org/html/draft-ietf-idr-bgp-extended-messages-13>`_ - Extended Message support for BGP
78 * `RFC4760 <https://tools.ietf.org/html/rfc4760>`_ - Multiprotocol Extensions for BGP-4
79    * `RFC7752 <https://tools.ietf.org/html/rfc7752>`_ - North-Bound Distribution of Link-State and TE Information using BGP
80       * `draft-gredler-idr-bgp-ls-segment-routing-ext <https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-03>`_  - BGP Link-State extensions for Segment Routing
81       * `draft-ietf-idr-bgpls-segment-routing-epe <https://tools.ietf.org/html/draft-ietf-idr-bgpls-segment-routing-epe-05>`_  - Segment Routing Egress Peer Engineering BGP-LS Extensions
82    * `RFC5575 <https://tools.ietf.org/html/rfc5575>`_ - Dissemination of Flow Specification Rules
83       * `RFC7674 <http://tools.ietf.org/html/rfc7674>`_  - Clarification of the Flowspec Redirect Extended Community
84       * `draft-ietf-idr-flow-spec-v6 <https://tools.ietf.org/html/draft-ietf-idr-flow-spec-v6-07>`_  - Dissemination of Flow Specification Rules for IPv6
85       * `draft-ietf-idr-flowspec-redirect-ip <https://tools.ietf.org/html/draft-ietf-idr-flowspec-redirect-ip-00>`_  - BGP Flow-Spec Redirect to IP Action
86    * `RFC3107 <https://tools.ietf.org/html/rfc3107>`_  - Carrying Label Information in BGP-4
87       * `draft-ietf-idr-bgp-prefix-sid <https://tools.ietf.org/html/draft-ietf-idr-bgp-prefix-sid-03>`_  - Segment Routing Prefix SID extensions for BGP
88    * `RFC4364 <https://tools.ietf.org/html/rfc4364>`_  - BGP/MPLS IP Virtual Private Networks (VPNs)
89       * `RFC4659 <https://tools.ietf.org/html/rfc4659>`_  - BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN
90    * `RFC7432 <https://tools.ietf.org/html/rfc7432>`_  - BGP MPLS-Based Ethernet VPN
91       * `draft-ietf-bess-evpn-overlay <https://tools.ietf.org/html/draft-ietf-bess-evpn-overlay-04>`_  - A Network Virtualization Overlay Solution using EVPN
92       * `draft-ietf-bess-evpn-vpws <https://tools.ietf.org/html/draft-ietf-bess-evpn-vpws-07>`_  - VPWS support in EVPN
93 * `RFC7911 <https://tools.ietf.org/html/rfc7911>`_  - Advertisement of Multiple Paths in BGP
94 * `RFC2918 <https://tools.ietf.org/html/rfc2918>`_  - Route Refresh Capability for BGP-4
95
96 Running BGP
97 -----------
98 This section explains how to install BGP plugin.
99
100 1. Install BGP feature - ``odl-bgpcep-bgp``.
101    Also, for sake of this sample, it is required to install RESTCONF.
102    In the Karaf console, type command:
103
104    .. code-block:: console
105
106       feature:install odl-restconf odl-bgpcep-bgp
107
108 2. The BGP plugin contains a default configuration, which is applied after the feature starts up.
109    One instance of BGP plugin is created (named *example-bgp-rib*), and its presence can be verified via REST:
110
111    **URL:** ``/restconf/operational/bgp-rib:bgp-rib``
112
113    **Method:** ``GET``
114
115    **Response Body:**
116
117    .. code-block:: xml
118
119       <bgp-rib xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
120          <rib>
121              <id>example-bgp-rib</id>
122              <loc-rib>
123              ....
124              </loc-rib>
125          </rib>
126       </bgp-rib>
127
128 Basic Configuration & Concepts
129 ------------------------------
130 The following section shows how to configure BGP basics, how to verify functionality and presents essential components of the plugin.
131 Next samples demonstrate the plugin's runtime configuration capability.
132 It shows the way to configure the plugin via REST, using standardized OpenConfig BGP APIs.
133
134 .. contents:: Contents
135    :depth: 2
136    :local:
137
138 BGP RIB API
139 ^^^^^^^^^^^
140 This tree illustrates the BGP RIBs organization in datastore.
141
142 .. code-block:: console
143
144     bgp-rib
145       +--ro rib* [id]
146          +--ro id         rib-id
147          +--ro peer* [peer-id]
148          |  +--ro peer-id                  peer-id
149          |  +--ro peer-role                peer-role
150          |  +--ro simple-routing-policy?   simple-routing-policy
151          |  +--ro supported-tables* [afi safi]
152          |  |  +--ro afi             identityref
153          |  |  +--ro safi            identityref
154          |  |  +--ro send-receive?   send-receive
155          |  +--ro adj-rib-in
156          |  |  +--ro tables* [afi safi]
157          |  |     +--ro afi           identityref
158          |  |     +--ro safi          identityref
159          |  |     +--ro attributes
160          |  |     |  +--ro uptodate?   boolean
161          |  |     +--ro (routes)?
162          |  +--ro effective-rib-in
163          |  |  +--ro tables* [afi safi]
164          |  |     +--ro afi           identityref
165          |  |     +--ro safi          identityref
166          |  |     +--ro attributes
167          |  |     |  +--ro uptodate?   boolean
168          |  |     +--ro (routes)?
169          |  +--ro adj-rib-out
170          |     +--ro tables* [afi safi]
171          |        +--ro afi           identityref
172          |        +--ro safi          identityref
173          |        +--ro attributes
174          |        |  +--ro uptodate?   boolean
175          |        +--ro (routes)?
176          +--ro loc-rib
177             +--ro tables* [afi safi]
178                +--ro afi           identityref
179                +--ro safi          identityref
180                +--ro attributes
181                |  +--ro uptodate?   boolean
182                +--ro (routes)?
183
184 Protocol Configuration
185 ^^^^^^^^^^^^^^^^^^^^^^
186 As a first step, a new protocol instance needs to be configured.
187 It is a very basic configuration conforming with RFC4271.
188
189 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
190
191 **Method:** ``POST``
192
193 **Content-Type:** ``application/xml``
194
195 **Request Body:**
196
197 .. code-block:: xml
198    :linenos:
199    :emphasize-lines: 2,7,8
200
201    <protocol xmlns="http://openconfig.net/yang/network-instance">
202        <name>bgp-example</name>
203        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
204        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
205            <global>
206                <config>
207                    <router-id>192.0.2.2</router-id>
208                    <as>65000</as>
209                </config>
210            </global>
211        </bgp>
212    </protocol>
213
214 @line 2: The unique protocol instance identifier.
215
216 @line 7: BGP Identifier of the speaker.
217
218 @line 8: Local autonomous system number of the speaker. Note that, OpenDaylight BGP implementation supports four-octet AS numbers only.
219
220 -----
221
222 The new instance presence can be verified via REST:
223
224 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example``
225
226 **Method:** ``GET``
227
228 **Response Body:**
229
230 .. code-block:: xml
231    :linenos:
232    :emphasize-lines: 3,4
233
234    <rib xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
235        <id>bgp-example</id>
236        <loc-rib>
237            <tables>
238                <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
239                <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
240                <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet"></ipv4-routes>
241                <attributes>
242                    <uptodate>true</uptodate>
243                </attributes>
244            </tables>
245        </loc-rib>
246    </rib>
247
248 @line 3: Loc-RIB - Per-protocol instance RIB, which contains the routes that have been selected by local BGP speaker's decision process.
249
250 @line 4: The BGP-4 supports carrying IPv4 prefixes, such routes are stored in *ipv4-address-family*/*unicast-subsequent-address-family* table.
251
252 BGP Server
253 ^^^^^^^^^^
254
255 BGP uses TCP as its transport protocol, by default listens on port 179. OpenDaylight BGP plugin is configured to listen on port *1790*, due to
256 privileged ports restriction for non-root users.
257 One of the workarounds is to use port redirection. In case other port is desired to be used instead, we can reconfigure it.
258
259 Here is a sample of bgp port listening re-configuration:
260
261 **URL:** ``/restconf/config/odl-bgp-peer-acceptor-config:bgp-peer-acceptor-config/default``
262
263 **Method:** ``PUT``
264
265 **Content-Type:** ``application/xml``
266
267 **Request Body:**
268
269 .. code-block:: xml
270    :linenos:
271    :emphasize-lines: 3,4
272
273    <bgp-peer-acceptor-config xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-peer-acceptor-config">
274        <config-name>default</config-name>
275        <binding-address>0.0.0.0</binding-address>
276        <binding-port>1791</binding-port>
277    </bgp-peer-acceptor-config>
278
279 @line 3: Binding address: By default is 0.0.0.0, so it is not a mandatory field.
280
281 @line 4: Binding Port: Port were BGP Server will listen.
282
283 BGP Peering
284 ^^^^^^^^^^^
285 To exchange routing information between two BGP systems (peers), it is required to configure a peering on both BGP speakers first.
286 This mean that each BGP speaker has a white list of neighbors, representing remote peers, with which the peering is allowed.
287 The TCP connection is established between two peers and they exchange messages to open and confirm the connection parameters followed by routes exchange.
288
289 Here is a sample basic neighbor configuration:
290
291 **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``
292
293 **Method:** ``POST``
294
295 **Content-Type:** ``application/xml``
296
297 **Request Body:**
298
299 .. code-block:: xml
300    :linenos:
301    :emphasize-lines: 3,4
302
303    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
304        <neighbor-address>192.0.2.1</neighbor-address>
305        <timers>
306            <config>
307                <hold-time>90</hold-time>
308                <connect-retry>10</connect-retry>
309            </config>
310        </timers>
311        <transport>
312            <config>
313                <remote-port>179</remote-port>
314                <passive-mode>false</passive-mode>
315            </config>
316        </transport>
317        <config>
318            <peer-type>INTERNAL</peer-type>
319        </config>
320    </neighbor>
321
322 @line 2: IP address of the remote BGP peer. Also serves as an unique identifier of a neighbor in a list of neighbors.
323
324 @line 5: Proposed number of seconds for value of the Hold Timer. Default value is **90**.
325
326 @line 6: Time interval in seconds between attempts to establish session with the peer. Effective in active mode only. Default value is **30**.
327
328 @line 11: Remote port number to which the local BGP is connecting. Effective in active mode only. Default value **179**.
329
330 @line 12: Wait for peers to issue requests to open a BGP session, rather than initiating sessions from the local router. Default value is **false**.
331
332 @line 16: Explicitly designate the peer as internal or external. Default value is **INTERNAL**.
333
334 -----
335
336 Once the remote peer is connected and it advertised routes to local BGP system, routes are stored in peer's RIBs.
337 The RIBs can be checked via REST:
338
339 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/peer/bgp:%2F%2F192.0.2.1``
340
341 **Method:** ``GET``
342
343 **Response Body:**
344
345 .. code-block:: xml
346    :linenos:
347    :emphasize-lines: 8,13,35,40,62,66
348
349    <peer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
350        <peer-id>bgp://192.0.2.1</peer-id>
351        <supported-tables>
352            <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
353            <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
354        </supported-tables>
355        <peer-role>ibgp</peer-role>
356        <adj-rib-in>
357            <tables>
358                <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
359                <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
360                <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
361                    <ipv4-route>
362                        <path-id>0</path-id>
363                        <prefix>10.0.0.10/32</prefix>
364                        <attributes>
365                            <as-path></as-path>
366                            <origin>
367                                <value>igp</value>
368                            </origin>
369                            <local-pref>
370                                <pref>100</pref>
371                            </local-pref>
372                            <ipv4-next-hop>
373                                <global>10.10.1.1</global>
374                            </ipv4-next-hop>
375                        </attributes>
376                    </ipv4-route>
377                </ipv4-routes>
378                <attributes>
379                    <uptodate>true</uptodate>
380                </attributes>
381            </tables>
382        </adj-rib-in>
383        <effective-rib-in>
384            <tables>
385                <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
386                <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
387                <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
388                    <ipv4-route>
389                        <path-id>0</path-id>
390                        <prefix>10.0.0.10/32</prefix>
391                        <attributes>
392                            <as-path></as-path>
393                            <origin>
394                                <value>igp</value>
395                            </origin>
396                            <local-pref>
397                                <pref>100</pref>
398                            </local-pref>
399                            <ipv4-next-hop>
400                                <global>10.10.1.1</global>
401                            </ipv4-next-hop>
402                        </attributes>
403                    </ipv4-route>
404                </ipv4-routes>
405                <attributes>
406                    <uptodate>true</uptodate>
407                </attributes>
408            </tables>
409        </effective-rib-in>
410        <adj-rib-out>
411            <tables>
412                <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
413                <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
414                <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet"></ipv4-routes>
415                <attributes></attributes>
416            </tables>
417        </adj-rib-out>
418    </peer>
419
420 @line 8: **Adj-RIB-In** - Per-peer RIB, which contains unprocessed routes that has been advertised to local BGP speaker by the remote peer.
421
422 @line 13: Here is the reported route with destination *10.0.0.10/32* in Adj-RIB-In.
423
424 @line 35: **Effective-RIB-In** - Per-peer RIB, which contains processed routes as a result of applying inbound policy to Adj-RIB-In routes.
425
426 @line 40: Here is the reported route with destination *10.0.0.10/32*, same as in Adj-RIB-In, as it was not touched by import policy.
427
428 @line 62: **Adj-RIB-Out** - Per-peer RIB, which contains routes for advertisement to the peer by means of the local speaker's UPDATE message.
429
430 @line 66: The peer's Adj-RIB-Out is empty as there are no routes to be advertise from local BGP speaker.
431
432 -----
433
434 Also the same route should appeared in Loc-RIB now:
435
436 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/ipv4-routes``
437
438 **Method:** ``GET``
439
440 **Response Body:**
441
442 .. code-block:: xml
443    :linenos:
444    :emphasize-lines: 4,6,8,11,14
445
446    <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
447        <ipv4-route>
448            <path-id>0</path-id>
449            <prefix>10.0.0.10/32</prefix>
450            <attributes>
451                <as-path></as-path>
452                <origin>
453                    <value>igp</value>
454                </origin>
455                <local-pref>
456                    <pref>100</pref>
457                </local-pref>
458                <ipv4-next-hop>
459                    <global>10.10.1.1</global>
460                </ipv4-next-hop>
461            </attributes>
462        </ipv4-route>
463    </ipv4-routes>
464
465 @line 4: **Destination** - IPv4 Prefix Address.
466
467 @line 6: **AS_PATH** - mandatory attribute, contains a list of the autonomous system numbers through that routing information has traversed.
468
469 @line 8: **ORIGIN** - mandatory attribute, indicates an origin of the route - **ibgp**, **egp**, **incomplete**.
470
471 @line 11: **LOCAL_PREF** - indicates a degree of preference for external routes, higher value is preferred.
472
473 @line 14: **NEXT_HOP** - mandatory attribute, defines IP address of the router that should be used as the next hop to the destination.
474
475 -----
476
477 There are much more attributes that may be carried along with the destination:
478
479 **BGP-4 Path Attributes**
480
481 * **MULTI_EXIT_DISC** (MED)
482    Optional attribute, to be used to discriminate among multiple exit/entry points on external links, lower number is preferred.
483
484    .. code-block:: xml
485
486       <multi-exit-disc>
487        <med>0</med>
488       </multi-exit-disc>
489
490
491 * **ATOMIC_AGGREGATE**
492    Indicates whether AS_SET was excluded from AS_PATH due to routes aggregation.
493
494    .. code-block:: xml
495
496       <atomic-aggregate/>
497
498 * **AGGREGATOR**
499    Optional attribute, contains AS number and IP address of a BGP speaker which performed routes aggregation.
500
501    .. code-block:: xml
502
503       <aggregator>
504           <as-number>65000</as-number>
505           <network-address>192.0.2.2</network-address>
506       </aggregator>
507
508 * **Unrecognised**
509    Optional attribute, used to store optional attributes, unrecognized by a local BGP speaker.
510
511    .. code-block:: xml
512
513       <unrecognized-attributes>
514           <partial>true</partial>
515           <transitive>true</transitive>
516           <type>101</type>
517           <value>0101010101010101</value>
518       </unrecognized-attributes>
519
520 **Route Reflector Attributes**
521
522 * **ORIGINATOR_ID**
523    Optional attribute, carries BGP Identifier of the originator of the route.
524
525    .. code-block:: xml
526
527       <originator-id>
528           <originator>41.41.41.41</originator>
529       </originator-id>
530
531 * **CLUSTER_LIST**
532    Optional attribute, contains a list of CLUSTER_ID values representing the path that the route has traversed.
533
534    .. code-block:: xml
535
536       <cluster-id>
537           <cluster>40.40.40.40</cluster>
538       </cluster-id>
539
540 * **Communities**
541    Optional attribute, may be used for policy routing.
542
543    .. code-block:: xml
544
545       <communities>
546           <as-number>65000</as-number>
547           <semantics>30740</semantics>
548       </communities>
549
550 **Extended Communities**
551
552 * **Route Target**
553    Identifies one or more routers that may receive a route.
554
555    .. code-block:: xml
556
557       <extended-communities>
558           <transitive>true</transitive>
559           <route-target-ipv4>
560               <global-administrator>192.0.2.2</global-administrator>
561               <local-administrator>123</local-administrator>
562           </route-target-ipv4>
563       </extended-communities>
564       <extended-communities>
565           <transitive>true</transitive>
566           <as-4-route-target-extended-community>
567                   <as-4-specific-common>
568                   <as-number>65000</as-number>
569                   <local-administrator>123</local-administrator>
570               </as-4-specific-common>
571           </as-4-route-target-extended-community>
572       </extended-communities>
573
574
575 * **Route Origin**
576    Identifies one or more routers that injected a route.
577
578    .. code-block:: xml
579
580       <extended-communities>
581           <transitive>true</transitive>
582           <route-origin-ipv4>
583               <global-administrator>192.0.2.2</global-administrator>
584               <local-administrator>123</local-administrator>
585           </route-origin-ipv4>
586       </extended-communities>
587       <extended-communities>
588           <transitive>true</transitive>
589           <as-4-route-origin-extended-community>
590               <as-4-specific-common>
591                   <as-number>65000</as-number>
592                   <local-administrator>123</local-administrator>
593               </as-4-origin-common>
594           </as-4-route-target-extended-community>
595       </extended-communities>
596
597
598 * **Link Bandwidth**
599    Carries the cost to reach external neighbor.
600
601    .. code-block:: xml
602
603       <extended-communities>
604           <transitive>true</transitive>
605           <link-bandwidth-extended-community>
606               <bandwidth>BH9CQAA=</bandwidth>
607           </link-bandwidth-extended-community>
608       </extended-communities>
609
610 * **AIGP**
611    Optional attribute, carries accumulated IGP metric.
612
613    .. code-block:: xml
614
615       <aigp>
616           <aigp-tlv>
617               <metric>120</metric>
618           </aigp-tlv>
619       </aigp>
620
621
622 .. note:: When the remote peer disconnects, it disappear from operational state of local speaker instance and advertised routes are removed too.
623
624 External peering configuration
625 ''''''''''''''''''''''''''''''
626 An example above provided configuration for internal peering only.
627 Following configuration sample is intended for external peering:
628
629 **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``
630
631 **Method:** ``POST``
632
633 **Content-Type:** ``application/xml``
634
635 **Request Body:**
636
637 .. code-block:: xml
638    :linenos:
639    :emphasize-lines: 5
640
641    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
642        <neighbor-address>192.0.2.3</neighbor-address>
643        <config>
644            <peer-type>EXTERNAL</peer-type>
645            <peer-as>64999</peer-as>
646        </config>
647    </neighbor>
648
649 @line 5: AS number of the remote peer.
650
651 Route reflector configuration
652 '''''''''''''''''''''''''''''
653 The local BGP speaker can be configured with a specific *cluster ID*.
654 Following example adds the cluster ID to the existing speaker instance:
655
656 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/global/config``
657
658 **Method:** ``PUT``
659
660 **Content-Type:** ``application/xml``
661
662 **Request Body:**
663
664 .. code-block:: xml
665    :linenos:
666    :emphasize-lines: 4
667
668    <config>
669        <router-id>192.0.2.2</router-id>
670        <as>65000</as>
671        <route-reflector-cluster-id>192.0.2.1</route-reflector-cluster-id>
672    </config>
673
674 @line 4: Route-reflector cluster id to use when local router is configured as a route reflector.
675    The *router-id* is used as a default value.
676
677 -----
678
679 Following configuration sample is intended for route reflector client peering:
680
681 **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``
682
683 **Method:** ``POST``
684
685 **Content-Type:** ``application/xml``
686
687 **Request Body:**
688
689 .. code-block:: xml
690    :linenos:
691    :emphasize-lines: 8
692
693    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
694        <neighbor-address>192.0.2.4</neighbor-address>
695        <config>
696            <peer-type>INTERNAL</peer-type>
697        </config>
698        <route-reflector>
699            <config>
700                <route-reflector-client>true</route-reflector-client>
701            </config>
702        </route-reflector>
703    </neighbor>
704
705 @line 8: Configure the neighbor as a route reflector client. Default value is *false*.
706
707 MD5 authentication configuration
708 ''''''''''''''''''''''''''''''''
709 The OpenDaylight BGP implementation is supporting TCP MD5 for authentication.
710 Sample configuration below shows how to set authentication password for a peer:
711
712 **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``
713
714 **Method:** ``POST``
715
716 **Content-Type:** ``application/xml``
717
718 **Request Body:**
719
720 .. code-block:: xml
721    :linenos:
722    :emphasize-lines: 4
723
724    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
725        <neighbor-address>192.0.2.5</neighbor-address>
726        <config>
727            <auth-password>topsecret</auth-password>
728        </config>
729    </neighbor>
730
731 @line 4: Configures an MD5 authentication password for use with neighboring devices.
732
733 Simple Routing Policy configuration
734 '''''''''''''''''''''''''''''''''''
735 The OpenDaylight BGP implementation is supporting *Simple Routing Policy*.
736 Sample configuration below shows how to set *Simple Routing Policy* for a peer:
737
738 **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``
739
740 **Method:** ``POST``
741
742 **Content-Type:** ``application/xml``
743
744 **Request Body:**
745
746 .. code-block:: xml
747    :linenos:
748    :emphasize-lines: 4
749
750    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
751        <neighbor-address>192.0.2.7</neighbor-address>
752        <config>
753            <simple-routing-policy>learn-none</simple-routing-policy>
754        </config>
755    </neighbor>
756
757 @line 4: *Simple Routing Policy*:
758
759    * ``learn-none`` - routes advertised by the peer are not propagated to Effective-RIB-In and Loc-RIB
760    * ``announce-none`` - routes from local Loc-RIB are not advertised to the peer
761
762 .. note:: Existing neighbor configuration can be reconfigured (change configuration parameters) anytime.
763    As a result, established connection is dropped, peer instance is recreated with a new configuration settings and connection re-established.
764
765 .. note:: The BGP configuration is persisted on OpendDaylight shutdown and restored after the re-start.
766
767 BGP Application Peer and programmable RIB
768 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
769 The OpenDaylight BGP implementation also supports routes injection via *Application Peer*.
770 Such peer has its own programmable RIB, which can be modified by user.
771 This concept allows user to originate new routes and advertise them to all connected peers.
772
773 Application Peer configuration
774 ''''''''''''''''''''''''''''''
775 Following configuration sample show a way to configure the *Application Peer*:
776
777 **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``
778
779 **Method:** ``POST``
780
781 **Content-Type:** ``application/xml``
782
783 **Request Body:**
784
785 .. code-block:: xml
786    :linenos:
787    :emphasize-lines: 2,4
788
789    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
790        <neighbor-address>10.25.1.9</neighbor-address>
791        <config>
792            <peer-group>application-peers</peer-group>
793        </config>
794    </neighbor>
795
796 @line 2: IP address is uniquely identifying *Application Peer* and its programmable RIB. Address is also used in local BGP speaker decision process.
797
798 @line 4: Indicates that peer is associated with *application-peers* group. It serves to distinguish *Application Peer's* from regular neighbors.
799
800 -----
801
802 The *Application Peer* presence can be verified via REST:
803
804 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/peer/bgp:%2F%2F10.25.1.9``
805
806 **Method:** ``GET``
807
808 **Response Body:**
809
810 .. code-block:: xml
811    :linenos:
812    :emphasize-lines: 3,8
813
814    <peer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
815        <peer-id>bgp://10.25.1.9</peer-id>
816        <peer-role>internal</peer-role>
817        <adj-rib-in>
818            <tables>
819                <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
820                <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
821                <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet"></ipv4-routes>
822                <attributes>
823                    <uptodate>false</uptodate>
824                </attributes>
825            </tables>
826        </adj-rib-in>
827        <effective-rib-in>
828            <tables>
829                <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
830                <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
831                <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet"></ipv4-routes>
832                <attributes></attributes>
833            </tables>
834        </effective-rib-in>
835    </peer>
836
837 @line 3: Peer role for *Application Peer* is *internal*.
838
839 @line 8: Adj-RIB-In is empty, as no routes were originated yet.
840
841 .. note:: There is no Adj-RIB-Out for *Application Peer*.
842
843 Programmable RIB
844 ''''''''''''''''
845 Next example shows how to inject a route into the programmable RIB.
846
847 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv4-routes``
848
849 **Method:** ``POST``
850
851 **Content-Type:** ``application/xml``
852
853 **Request Body:**
854
855 .. code-block:: xml
856
857    <ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
858        <path-id>0</path-id>
859        <prefix>10.0.0.11/32</prefix>
860        <attributes>
861            <as-path></as-path>
862            <origin>
863                <value>igp</value>
864            </origin>
865            <local-pref>
866                <pref>100</pref>
867            </local-pref>
868            <ipv4-next-hop>
869                <global>10.11.1.1</global>
870            </ipv4-next-hop>
871        </attributes>
872    </ipv4-route>
873
874 -----
875
876 Now the injected route appears in *Application Peer's* RIBs and in local speaker's Loc-RIB:
877
878 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/peer/bgp:%2F%2F10.25.1.9``
879
880 **Method:** ``GET``
881
882 **Response Body:**
883
884 .. code-block:: xml
885    :linenos:
886    :emphasize-lines: 9
887
888    <peer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
889        <peer-id>bgp://10.25.1.9</peer-id>
890        <peer-role>internal</peer-role>
891        <adj-rib-in>
892            <tables>
893                <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
894                <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
895                <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
896                    <ipv4-route>
897                        <path-id>0</path-id>
898                        <prefix>10.0.0.11/32</prefix>
899                        <attributes>
900                            <as-path></as-path>
901                            <origin>
902                                <value>igp</value>
903                            </origin>
904                            <local-pref>
905                                <pref>100</pref>
906                            </local-pref>
907                            <ipv4-next-hop>
908                                <global>10.11.1.1</global>
909                            </ipv4-next-hop>
910                        </attributes>
911                    </ipv4-route>
912                </ipv4-routes>
913                <attributes>
914                    <uptodate>false</uptodate>
915                </attributes>
916            </tables>
917        </adj-rib-in>
918        <effective-rib-in>
919            <tables>
920                <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
921                <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
922                <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
923                    <ipv4-route>
924                        <path-id>0</path-id>
925                        <prefix>10.0.0.11/32</prefix>
926                        <attributes>
927                            <as-path></as-path>
928                            <origin>
929                                <value>igp</value>
930                            </origin>
931                            <local-pref>
932                                <pref>100</pref>
933                            </local-pref>
934                            <ipv4-next-hop>
935                                <global>10.11.1.1</global>
936                            </ipv4-next-hop>
937                        </attributes>
938                    </ipv4-route>
939                </ipv4-routes>
940                <attributes></attributes>
941            </tables>
942        </effective-rib-in>
943    </peer>
944
945 @line 9: Injected route is present in *Application Peer's* Adj-RIB-In and Effective-RIB-In.
946
947 -----
948
949 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/ipv4-routes``
950
951 **Method:** ``GET``
952
953 **Response Body:**
954
955 .. code-block:: xml
956    :linenos:
957    :emphasize-lines: 2
958
959    <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
960        <ipv4-route>
961            <path-id>0</path-id>
962            <prefix>10.0.0.10/32</prefix>
963            <attributes>
964                <as-path></as-path>
965                <origin>
966                    <value>igp</value>
967                </origin>
968                <local-pref>
969                    <pref>100</pref>
970                </local-pref>
971                <ipv4-next-hop>
972                    <global>10.11.1.1</global>
973                </ipv4-next-hop>
974            </attributes>
975        </ipv4-route>
976        <ipv4-route>
977            <path-id>0</path-id>
978            <prefix>10.0.0.10/32</prefix>
979            <attributes>
980                <as-path></as-path>
981                <origin>
982                    <value>igp</value>
983                </origin>
984                <local-pref>
985                    <pref>100</pref>
986                </local-pref>
987                <ipv4-next-hop>
988                    <global>10.10.1.1</global>
989                </ipv4-next-hop>
990            </attributes>
991        </ipv4-route>
992    </ipv4-routes>
993
994 @line 2: The injected route is now present in Loc-RIB along with a route (destination *10.0.0.10/32*) advertised by remote peer.
995
996 -----
997
998 This route is also advertised to the remote peer (*192.0.2.1*), hence route appears in its Adj-RIB-Out:
999
1000 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/peer/bgp:%2F%2F192.0.2.1/adj-rib-out/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv4-routes``
1001
1002 **Method:** ``GET``
1003
1004 **Response Body:**
1005
1006 .. code-block:: xml
1007
1008    <ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
1009        <path-id>0</path-id>
1010        <prefix>10.0.0.11/32</prefix>
1011        <attributes>
1012            <as-path></as-path>
1013            <origin>
1014                <value>igp</value>
1015            </origin>
1016            <local-pref>
1017                <pref>100</pref>
1018            </local-pref>
1019            <ipv4-next-hop>
1020                <global>10.11.1.1</global>
1021            </ipv4-next-hop>
1022        </attributes>
1023    </ipv4-route>
1024
1025 -----
1026
1027 The injected route can be modified (i.e. different path attribute):
1028
1029 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv4-routes/ipv4-route/10.0.0.11%2F32/0``
1030
1031 **Method:** ``PUT``
1032
1033 **Content-Type:** ``application/xml``
1034
1035 **Request Body:**
1036
1037 .. code-block:: xml
1038
1039    <ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
1040        <path-id>0</path-id>
1041        <prefix>10.0.0.11/32</prefix>
1042        <attributes>
1043            <as-path></as-path>
1044            <origin>
1045                <value>igp</value>
1046            </origin>
1047            <local-pref>
1048                <pref>50</pref>
1049            </local-pref>
1050            <ipv4-next-hop>
1051                <global>10.11.1.2</global>
1052            </ipv4-next-hop>
1053        </attributes>
1054    </ipv4-route>
1055
1056 -----
1057
1058 The route can be removed from programmable RIB in a following way:
1059
1060 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv4-routes/ipv4-route/10.0.0.11%2F32/0``
1061
1062 **Method:** ``DELETE``
1063
1064 -----
1065
1066 Also it is possible to remove all routes from a particular table at once:
1067
1068 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv4-routes/``
1069
1070 **Method:** ``DELETE``
1071
1072 -----
1073
1074 Consequently, route disappears from programmable RIB, *Application Peer's* RIBs, Loc-RIB and peer's Adj-RIB-Out (UPDATE message with prefix withdrawal is send).
1075
1076 .. note:: Routes stored in programmable RIB are persisted on OpendDaylight shutdown and restored after the re-start.
1077
1078 BGP Protocol Configuration Loader
1079 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1080
1081 BGP Protocol Configuration Loader allows the user to define the static initial configuration for a BGP protocol instance.
1082 This service will detect the creation of new configuration files following the pattern "protocols-*.xml" under the path "etc/opendaylight/bgpcep".
1083 Once the file is processed, the defined configuration will be available from the configuration Data Store.
1084
1085 .. note:: If the BGP instance is already present, no update or configuration will be applied.
1086
1087 **PATH:** ``etc/opendaylight/bgpcep/protocols-config.xml``
1088
1089 .. code-block:: xml
1090
1091     <protocols xmlns="http://openconfig.net/yang/network-instance">
1092         <protocol>
1093             <name>example-bgp-rib</name>
1094             <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
1095             <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1096                 <global>
1097                     <config>
1098                         <router-id>192.0.2.2</router-id>
1099                         <as>64496</as>
1100                         <!-- if cluster-id is not present, it's value is the same as bgp-id -->
1101                         <!-- <route-reflector-cluster-id>192.0.2.3</route-reflector-cluster-id> -->
1102                         <!-- <read-only-limit>120</read-only-limit>-->
1103                     </config>
1104                     <afi-safis>
1105                         <afi-safi>
1106                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
1107                             <!--Advertise N Paths
1108                             <receive>true</receive>
1109                             <send-max>2</send-max>-->
1110                         </afi-safi>
1111                         <afi-safi>
1112                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
1113                         </afi-safi>
1114                         <afi-safi>
1115                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
1116                         </afi-safi>
1117                         <afi-safi>
1118                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-LABELLED-UNICAST</afi-safi-name>
1119                         </afi-safi>
1120                         <afi-safi>
1121                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
1122                         </afi-safi>
1123                         <afi-safi>
1124                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
1125                         </afi-safi>
1126                         <afi-safi>
1127                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
1128                         </afi-safi>
1129                         <afi-safi>
1130                             <afi-safi-name>LINKSTATE</afi-safi-name>
1131                         </afi-safi>
1132                         <afi-safi>
1133                             <afi-safi-name>IPV4-FLOW</afi-safi-name>
1134                         </afi-safi>
1135                         <afi-safi>
1136                             <afi-safi-name>IPV6-FLOW</afi-safi-name>
1137                         </afi-safi>
1138                         <afi-safi>
1139                             <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
1140                         </afi-safi>
1141                         <afi-safi>
1142                             <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
1143                         </afi-safi>
1144                     </afi-safis>
1145                 </global>
1146                 <neighbors xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1147                     <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1148                         <neighbor-address>192.0.2.1</neighbor-address>
1149                         <config>
1150                             <peer-type>INTERNAL</peer-type>
1151                             <peer-as>64496</peer-as>
1152                         </config>
1153                         <transport>
1154                             <config>
1155                                 <remote-port>179</remote-port>
1156                                 <passive-mode>true</passive-mode>
1157                             </config>
1158                         </transport>
1159                         <timers>
1160                             <config>
1161                                 <hold-time>180</hold-time>
1162                                 <connect-retry>10</connect-retry>
1163                             </config>
1164                         </timers>
1165                         <route-reflector>
1166                             <config>
1167                                 <route-reflector-client>false</route-reflector-client>
1168                             </config>
1169                         </route-reflector>
1170                         <afi-safis>
1171                             <afi-safi>
1172                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
1173                                 <!--Advertise N Paths
1174                                 <receive>true</receive>
1175                                 <send-max>0</send-max>-->
1176                             </afi-safi>
1177                             <afi-safi>
1178                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
1179                             </afi-safi>
1180                             <afi-safi>
1181                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
1182                             </afi-safi>
1183                             <afi-safi>
1184                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-LABELLED-UNICAST</afi-safi-name>
1185                             </afi-safi>
1186                             <afi-safi>
1187                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
1188                             </afi-safi>
1189                             <afi-safi>
1190                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
1191                             </afi-safi>
1192                             <afi-safi>
1193                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
1194                             </afi-safi>
1195                             <afi-safi>
1196                                 <afi-safi-name>LINKSTATE</afi-safi-name>
1197                             </afi-safi>
1198                             <afi-safi>
1199                                 <afi-safi-name>IPV4-FLOW</afi-safi-name>
1200                             </afi-safi>
1201                             <afi-safi>
1202                                 <afi-safi-name>IPV6-FLOW</afi-safi-name>
1203                             </afi-safi>
1204                             <afi-safi>
1205                                 <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
1206                             </afi-safi>
1207                             <afi-safi>
1208                                 <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
1209                             </afi-safi>
1210                         </afi-safis>
1211                     </neighbor>
1212                     <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1213                         <neighbor-address>192.0.2.6</neighbor-address>
1214                         <config>
1215                             <peer-group>application-peers</peer-group>
1216                         </config>
1217                     </neighbor>
1218                 </neighbors>
1219             </bgp>
1220         </protocol>
1221     </protocols>
1222
1223 BGP Configuration Example
1224 '''''''''''''''''''''''''
1225
1226 BGP provides a feature providing a BGP Protocol and Network Topology configuration file example.
1227 Once feature is installed defined configuration will be loaded and setup.
1228
1229 .. code-block:: console
1230
1231    feature:install odl-bgpcep-bgp-config-example
1232
1233 BGP pipeline
1234 ^^^^^^^^^^^^
1235 .. figure:: ./images/bgpcep/bgp-pipeline.png
1236    :alt: BGP pipeline.
1237
1238    BGP pipeline - routes re-advertisement.
1239
1240 .. figure:: ./images/bgpcep/bgp-app-pipeline.png
1241    :alt: BGP Application Peer pipeline.
1242
1243    BGP applcaition peer pipeline - routes injection.
1244
1245 References
1246 ^^^^^^^^^^
1247 * `A Border Gateway Protocol 4 (BGP-4) <https://tools.ietf.org/html/rfc4271>`_
1248 * `BGP Route Reflection <https://tools.ietf.org/html/rfc4456>`_
1249 * `BGP Communities Attribute <https://tools.ietf.org/html/rfc1997>`_
1250 * `BGP Support for Four-Octet Autonomous System (AS) Number Space <https://tools.ietf.org/html/rfc6793>`_
1251 * `The Accumulated IGP Metric Attribute for BGP <https://tools.ietf.org/html/rfc7311>`_
1252 * `4-Octet AS Specific BGP Extended Community <https://tools.ietf.org/html/rfc5668>`_
1253 * `BGP Link Bandwidth Extended Community <https://tools.ietf.org/html/draft-ietf-idr-link-bandwidth-06>`_
1254 * `Use of BGP for Routing in Large-Scale Data Centers <https://tools.ietf.org/html/rfc7938>`_
1255
1256 IP Unicast Family
1257 -----------------
1258 The BGP-4 allows to carry IPv4 specific information only.
1259 The basic BGP Multiprotocol extension brings *Unicast* Subsequent Address Family (SAFI) - intended to be used for IP unicast forwarding.
1260 The combination of IPv4 and IPv6 Address Family (AF) and Unicast SAFI is essential for Internet routing.
1261 The IPv4 Unicast routes are interchangeable with BGP-4 routes, as they can carry the same type of routing information.
1262
1263 .. contents:: Contents
1264    :depth: 2
1265    :local:
1266
1267 Configuration
1268 ^^^^^^^^^^^^^
1269 This section shows a way to enable IPv4 and IPv6 Unicast family in BGP speaker and peer configuration.
1270
1271 BGP Speaker
1272 '''''''''''
1273 To enable IPv4 and IPv6 Unicast support in BGP plugin, first configure BGP speaker instance:
1274
1275 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
1276
1277 **Method:** ``POST``
1278
1279 **Content-Type:** ``application/xml``
1280
1281 **Request Body:**
1282
1283 .. code-block:: xml
1284
1285    <protocol xmlns="http://openconfig.net/yang/network-instance">
1286        <name>bgp-example</name>
1287        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
1288        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1289            <global>
1290                <config>
1291                    <router-id>192.0.2.2</router-id>
1292                    <as>65000</as>
1293                </config>
1294                <afi-safis>
1295                    <afi-safi>
1296                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
1297                    </afi-safi>
1298                    <afi-safi>
1299                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
1300                    </afi-safi>
1301                </afi-safis>
1302            </global>
1303        </bgp>
1304    </protocol>
1305
1306 BGP Peer
1307 ''''''''
1308 Here is an example for BGP peer configuration with enabled IPv4 and IPv6 Unicast family.
1309
1310 **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``
1311
1312 **Method:** ``POST``
1313
1314 **Content-Type:** ``application/xml``
1315
1316 **Request Body:**
1317
1318 .. code-block:: xml
1319
1320    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1321        <neighbor-address>192.0.2.1</neighbor-address>
1322        <afi-safis>
1323            <afi-safi>
1324                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
1325            </afi-safi>
1326            <afi-safi>
1327                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
1328            </afi-safi>
1329        </afi-safis>
1330    </neighbor>
1331
1332 IP Unicast API
1333 ^^^^^^^^^^^^^^
1334 Following trees illustrate the BGP IP Unicast routes structures.
1335
1336 IPv4 Unicast Route
1337 ''''''''''''''''''
1338 .. code-block:: console
1339
1340    :(ipv4-routes-case)
1341       +--ro ipv4-routes
1342         +--ro ipv4-route* [prefix path-id]
1343            +--ro prefix        inet:ipv4-prefix
1344            +--ro path-id       path-id
1345            +--ro attributes
1346               +--ro origin
1347               |  +--ro value    bgp-t:bgp-origin
1348               +--ro as-path
1349               |  +--ro segments*
1350               |     +--ro as-sequence*   inet:as-number
1351               |     +--ro as-set*        inet:as-number
1352               +--ro (c-next-hop)?
1353               |  +--:(ipv4-next-hop-case)
1354               |  |  +--ro ipv4-next-hop
1355               |  |     +--ro global?   inet:ipv4-address
1356               |  +--:(ipv6-next-hop-case)
1357               |  |  +--ro ipv6-next-hop
1358               |  |     +--ro global?       inet:ipv6-address
1359               |  |     +--ro link-local?   inet:ipv6-address
1360               |  +--:(empty-next-hop-case)
1361               |     +--ro empty-next-hop?            empty
1362               +--ro multi-exit-disc
1363               |  +--ro med?   uint32
1364               +--ro local-pref
1365               |  +--ro pref?   uint32
1366               +--ro atomic-aggregate!
1367               +--ro aggregator
1368               |  +--ro as-number?         inet:as-number
1369               |  +--ro network-address?   inet:ipv4-address
1370               +--ro communities*
1371               |  +--ro as-number?   inet:as-number
1372               |  +--ro semantics?   uint16
1373               +--ro extended-communities*
1374               |  +--ro transitive?                             boolean
1375               |  +--ro (extended-community)?
1376               |     +--:(as-specific-extended-community-case)
1377               |     |  +--ro as-specific-extended-community
1378               |     |     +--ro global-administrator?   short-as-number
1379               |     |     +--ro local-administrator?    binary
1380               |     +--:(inet4-specific-extended-community-case)
1381               |     |  +--ro inet4-specific-extended-community
1382               |     |     +--ro global-administrator?   inet:ipv4-address
1383               |     |     +--ro local-administrator?    binary
1384               |     +--:(opaque-extended-community-case)
1385               |     |  +--ro opaque-extended-community
1386               |     |     +--ro value?   binary
1387               |     +--:(route-target-extended-community-case)
1388               |     |  +--ro route-target-extended-community
1389               |     |     +--ro global-administrator?   short-as-number
1390               |     |     +--ro local-administrator?    binary
1391               |     +--:(route-origin-extended-community-case)
1392               |     |  +--ro route-origin-extended-community
1393               |     |     +--ro global-administrator?   short-as-number
1394               |     |     +--ro local-administrator?    binary
1395               |     +--:(route-target-ipv4-case)
1396               |     |  +--ro route-target-ipv4
1397               |     |     +--ro global-administrator?   inet:ipv4-address
1398               |     |     +--ro local-administrator?    uint16
1399               |     +--:(route-origin-ipv4-case)
1400               |     |  +--ro route-origin-ipv4
1401               |     |     +--ro global-administrator?   inet:ipv4-address
1402               |     |     +--ro local-administrator?    uint16
1403               |     +--:(link-bandwidth-case)
1404               |     |  +--ro link-bandwidth-extended-community
1405               |     |     +--ro bandwidth    netc:bandwidth
1406               |     +--:(as-4-generic-spec-extended-community-case)
1407               |     |  +--ro as-4-generic-spec-extended-community
1408               |     |     +--ro as-4-specific-common
1409               |     |        +--ro as-number              inet:as-number
1410               |     |        +--ro local-administrator    uint16
1411               |     +--:(as-4-route-target-extended-community-case)
1412               |     |  +--ro as-4-route-target-extended-community
1413               |     |     +--ro as-4-specific-common
1414               |     |        +--ro as-number              inet:as-number
1415               |     |        +--ro local-administrator    uint16
1416               |     +--:(as-4-route-origin-extended-community-case)
1417               |     |  +--ro as-4-route-origin-extended-community
1418               |     |     +--ro as-4-specific-common
1419               |     |        +--ro as-number              inet:as-number
1420               |     |        +--ro local-administrator    uint16
1421               |     +--:(encapsulation-case)
1422               |        +--ro encapsulation-extended-community
1423               |           +--ro tunnel-type    encapsulation-tunnel-type
1424               +--ro originator-id
1425               |  +--ro originator?   inet:ipv4-address
1426               +--ro cluster-id
1427               |  +--ro cluster*   bgp-t:cluster-identifier
1428               +--ro aigp
1429               |  +--ro aigp-tlv
1430               |     +--ro metric?   netc:accumulated-igp-metric
1431               +--ro unrecognized-attributes* [type]
1432                  +--ro partial       boolean
1433                  +--ro transitive    boolean
1434                  +--ro type          uint8
1435                  +--ro value         binary
1436
1437 IPv6 Unicast Route
1438 ''''''''''''''''''
1439 .. code-block:: console
1440
1441    :(ipv6-routes-case)
1442       +--ro ipv6-routes
1443          +--ro ipv6-route* [prefix path-id]
1444             +--ro prefix        inet:ipv6-prefix
1445             +--ro path-id       path-id
1446             +--ro attributes
1447             ...
1448
1449 Usage
1450 ^^^^^
1451 IPv4 Unicast
1452 ''''''''''''
1453 The IPv4 Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
1454
1455 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/ipv4-routes``
1456
1457 **Method:** ``GET``
1458
1459 **Response Body:**
1460
1461 .. code-block:: xml
1462
1463    <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
1464        <ipv4-route>
1465            <path-id>0</path-id>
1466            <prefix>193.0.2.1/32</prefix>
1467            <attributes>
1468                <as-path></as-path>
1469                <origin>
1470                    <value>igp</value>
1471                </origin>
1472                <local-pref>
1473                    <pref>100</pref>
1474                </local-pref>
1475                <ipv4-next-hop>
1476                    <global>10.0.0.1</global>
1477                </ipv4-next-hop>
1478            </attributes>
1479        </ipv4-route>
1480    </ipv4-routes>
1481
1482 IPv6 Unicast
1483 ''''''''''''
1484 The IPv6 Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
1485
1486 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/ipv6-routes``
1487
1488 **Method:** ``GET``
1489
1490 **Response Body:**
1491
1492 .. code-block:: xml
1493
1494    <ipv6-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
1495        <ipv6-route>
1496            <path-id>0</path-id>
1497            <prefix>2a02:b80:0:1::/64</prefix>
1498            <attributes>
1499                <as-path></as-path>
1500                <origin>
1501                    <value>igp</value>
1502                </origin>
1503                <local-pref>
1504                    <pref>200</pref>
1505                </local-pref>
1506                <ipv6-next-hop>
1507                    <global>2a02:b80:0:2::1</global>
1508                </ipv6-next-hop>
1509            </attributes>
1510        </ipv6-route>
1511    </ipv6-routes>
1512
1513 .. note:: IPv4/6 routes mapping to topology nodes is supported by BGP Topology Provider.
1514
1515 Programming
1516 ^^^^^^^^^^^
1517 IPv4 Unicast
1518 ''''''''''''
1519 This examples show how to originate and remove IPv4 route via programmable RIB.
1520 Make sure the *Application Peer* is configured first.
1521
1522 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv4-routes``
1523
1524 **Method:** ``POST``
1525
1526 **Content-Type:** ``application/xml``
1527
1528 **Request Body:**
1529
1530 .. code-block:: xml
1531
1532    <ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
1533        <path-id>0</path-id>
1534        <prefix>10.0.0.11/32</prefix>
1535        <attributes>
1536            <as-path></as-path>
1537            <origin>
1538                <value>igp</value>
1539            </origin>
1540            <local-pref>
1541                <pref>100</pref>
1542            </local-pref>
1543            <ipv4-next-hop>
1544                <global>10.11.1.1</global>
1545            </ipv4-next-hop>
1546        </attributes>
1547    </ipv4-route>
1548
1549 -----
1550
1551 To remove the route added above, following request can be used:
1552
1553 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv4-routes/ipv4-route/10.0.0.11%2F32/0``
1554
1555 **Method:** ``DELETE``
1556
1557 IPv6 Unicast
1558 ''''''''''''
1559 This examples show how to originate and remove IPv6 route via programmable RIB:
1560
1561 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv6-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv6-routes``
1562
1563 **Method:** ``POST``
1564
1565 **Content-Type:** ``application/xml``
1566
1567 **Request Body:**
1568
1569 .. code-block:: xml
1570
1571    <ipv6-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
1572        <prefix>2001:db8:30::3/128</prefix>
1573        <path-id>0</path-id>
1574        <attributes>
1575            <ipv6-next-hop>
1576                <global>2001:db8:1::6</global>
1577            </ipv6-next-hop>
1578            <as-path/>
1579            <origin>
1580                <value>igp</value>
1581            </origin>
1582            <local-pref>
1583                <pref>100</pref>
1584            </local-pref>
1585        </attributes>
1586    </ipv6-route>
1587
1588 -----
1589
1590 To remove the route added above, following request can be used:
1591
1592 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv6-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv6-routes/ipv6-route/2001:db8:30::3%2F128/0``
1593
1594 **Method:** ``DELETE``
1595
1596 References
1597 ^^^^^^^^^^
1598 * `Multiprotocol Extensions for BGP-4 <https://tools.ietf.org/html/rfc4760>`_
1599
1600 IP Labeled Unicast Family
1601 -------------------------
1602 The BGP Labeled Unicast (BGP-LU) Multiprotocol extension is used to distribute a MPLS label that is mapped to a particular route.
1603 It can be used to advertise a MPLS transport path between IGP regions and Autonomous Systems.
1604 Also, BGP-LU can help to solve the Inter-domain traffic-engineering problem and can be deployed in large-scale data centers along with MPLS and Spring.
1605 In addition, IPv6 Labeled Unicast can be used to interconnect IPv6 islands over IPv4/MPLS networks using 6PE.
1606
1607 .. contents:: Contents
1608    :depth: 2
1609    :local:
1610
1611 Configuration
1612 ^^^^^^^^^^^^^
1613 This section shows a way to enable IPv4 and IPv6 Labeled Unicast family in BGP speaker and peer configuration.
1614
1615 BGP Speaker
1616 '''''''''''
1617 To enable IPv4 and IPv6 Labeled Unicast support in BGP plugin, first configure BGP speaker instance:
1618
1619 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
1620
1621 **Method:** ``POST``
1622
1623 **Content-Type:** ``application/xml``
1624
1625 **Request Body:**
1626
1627 .. code-block:: xml
1628
1629    <protocol xmlns="http://openconfig.net/yang/network-instance">
1630        <name>bgp-example</name>
1631        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
1632        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1633            <global>
1634                <config>
1635                    <router-id>192.0.2.2</router-id>
1636                    <as>65000</as>
1637                </config>
1638                <afi-safis>
1639                    <afi-safi>
1640                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
1641                    </afi-safi>
1642                    <afi-safi>
1643                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-LABELLED-UNICAST</afi-safi-name>
1644                    </afi-safi>
1645                </afi-safis>
1646            </global>
1647        </bgp>
1648    </protocol>
1649
1650 BGP Peer
1651 ''''''''
1652 Here is an example for BGP peer configuration with enabled IPv4 and IPv6 Labeled Unicast family.
1653
1654 **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``
1655
1656 **Method:** ``POST``
1657
1658 **Content-Type:** ``application/xml``
1659
1660 **Request Body:**
1661
1662 .. code-block:: xml
1663
1664    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1665        <neighbor-address>192.0.2.1</neighbor-address>
1666        <afi-safis>
1667            <afi-safi>
1668                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
1669            </afi-safi>
1670            <afi-safi>
1671                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-LABELLED-UNICAST</afi-safi-name>
1672            </afi-safi>
1673        </afi-safis>
1674    </neighbor>
1675
1676 IP Labeled Unicast API
1677 ^^^^^^^^^^^^^^^^^^^^^^
1678 Following trees illustrate the BGP IP Labeled Unicast routes structures.
1679
1680 IPv4 Labeled Unicast Route
1681 ''''''''''''''''''''''''''
1682 .. code-block:: console
1683
1684    :(labeled-unicast-routes-case)
1685      +--ro labeled-unicast-routes
1686         +--ro labeled-unicast-route* [route-key path-id]
1687            +--ro route-key      string
1688            +--ro label-stack*
1689            |  +--ro label-value?   netc:mpls-label
1690            +--ro prefix?        inet:ip-prefix
1691            +--ro path-id        path-id
1692            +--ro attributes
1693            ...
1694
1695
1696 IPv6 Labeled Unicast Route
1697 ''''''''''''''''''''''''''
1698 .. code-block:: console
1699
1700    :(labeled-unicast-ipv6-routes-case)
1701       +--ro labeled-unicast-ipv6-routes
1702          +--ro labeled-unicast-route* [route-key path-id]
1703             +--ro route-key      string
1704             +--ro label-stack*
1705             |  +--ro label-value?   netc:mpls-label
1706             +--ro prefix?        inet:ip-prefix
1707             +--ro path-id        path-id
1708             +--ro attributes
1709             ...
1710
1711 Usage
1712 ^^^^^
1713 The IPv4 Labeled Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
1714
1715 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-labeled-unicast:labeled-unicast-subsequent-address-family/bgp-labeled-unicast:labeled-unicast-routes``
1716
1717 **Method:** ``GET``
1718
1719 **Response Body:**
1720
1721 .. code-block:: xml
1722
1723    <labeled-unicast-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">
1724        <labeled-unicast-route>
1725            <path-id>0</path-id>
1726            <route-key>MAA+gRQAAA==</route-key>
1727            <attributes>
1728                <local-pref>
1729                    <pref>100</pref>
1730                </local-pref>
1731                <ipv4-next-hop>
1732                    <global>200.10.0.101</global>
1733                </ipv4-next-hop>
1734                <as-path></as-path>
1735                <origin>
1736                    <value>igp</value>
1737                </origin>
1738            </attributes>
1739            <label-stack>
1740                <label-value>1000</label-value>
1741            </label-stack>
1742            <prefix>20.0.0.0/24</prefix>
1743        </labeled-unicast-route>
1744    </labeled-unicast-routes>
1745
1746 Programming
1747 ^^^^^^^^^^^
1748 IPv4 Labeled
1749 ''''''''''''
1750 This examples show how to originate and remove IPv4 labeled route via programmable RIB.
1751 Make sure the *Application Peer* is configured first.
1752
1753 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-labeled-unicast:labeled-unicast-subsequent-address-family/bgp-labeled-unicast:labeled-unicast-routes``
1754
1755 **Method:** ``POST``
1756
1757 **Content-Type:** ``application/xml``
1758
1759 **Request Body:**
1760
1761 .. code-block:: xml
1762
1763    <labeled-unicast-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">
1764        <route-key>label1</route-key>
1765        <prefix>1.1.1.1/32</prefix>
1766        <path-id>0</path-id>
1767        <label-stack>
1768            <label-value>800322</label-value>
1769        </label-stack>
1770        <attributes>
1771            <ipv4-next-hop>
1772                <global>199.20.160.41</global>
1773            </ipv4-next-hop>
1774            <origin>
1775                <value>igp</value>
1776            </origin>
1777            <as-path/>
1778            <local-pref>
1779                <pref>100</pref>
1780            </local-pref>
1781        </attributes>
1782    </labeled-unicast-route>
1783
1784 -----
1785
1786 In addition, BGP-LU Spring extension allows to attach BGP Prefix SID attribute to the route, in order to signal the BGP-Prefix-SID, where the SR is applied to MPLS dataplane.
1787
1788 .. code-block:: xml
1789
1790    <bgp-prefix-sid>
1791        <bgp-prefix-sid-tlvs>
1792            <label-index-tlv xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">322</label-index-tlv>
1793        </bgp-prefix-sid-tlvs>
1794        <bgp-prefix-sid-tlvs>
1795            <srgb-value xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">
1796                <base>800000</base>
1797                <range>4095</range>
1798            </srgb-value>
1799        </bgp-prefix-sid-tlvs>
1800    </bgp-prefix-sid>
1801
1802 -----
1803
1804 To remove the route added above, following request can be used:
1805
1806 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-labeled-unicast:labeled-unicast-subsequent-address-family/bgp-labeled-unicast:labeled-unicast-routes/bgp-labeled-unicast:labeled-unicast-route/label1/0``
1807
1808 **Method:** ``DELETE``
1809
1810 IPv6 Labeled
1811 ''''''''''''
1812 This examples show how to originate and remove IPv6 labeled route via programmable RIB.
1813
1814 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-labeled-unicast:labeled-unicast-subsequent-address-family/bgp-labeled-unicast:labeled-unicast-ipv6-routes``
1815
1816 **Method:** ``POST``
1817
1818 **Content-Type:** ``application/xml``
1819
1820 **Request Body:**
1821
1822 .. code-block:: xml
1823
1824    <labeled-unicast-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">
1825        <route-key>label1</route-key>
1826        <prefix>2001:db8:30::3/128</prefix>
1827        <path-id>0</path-id>
1828        <label-stack>
1829            <label-value>123</label-value>
1830        </label-stack>
1831        <attributes>
1832            <ipv6-next-hop>
1833                <global>2003:4:5:6::7</global>
1834            </ipv6-next-hop>
1835            <origin>
1836                <value>igp</value>
1837            </origin>
1838            <as-path/>
1839            <local-pref>
1840                <pref>100</pref>
1841            </local-pref>
1842        </attributes>
1843    </labeled-unicast-route>
1844
1845 -----
1846
1847 To remove the route added above, following request can be used:
1848
1849 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-labeled-unicast:labeled-unicast-subsequent-address-family/bgp-labeled-unicast:labeled-unicast-ipv6-routes/bgp-labeled-unicast:labeled-unicast-route/label1/0``
1850
1851 **Method:** ``DELETE``
1852
1853 References
1854 ^^^^^^^^^^
1855 * `Carrying Label Information in BGP-4 <https://tools.ietf.org/html/rfc3107>`_
1856 * `Segment Routing Prefix SID extensions for BGP <https://tools.ietf.org/html/draft-ietf-idr-bgp-prefix-sid-03>`_
1857 * `Connecting IPv6 Islands over IPv4 MPLS Using IPv6 Provider Edge Routers (6PE) <https://tools.ietf.org/html/rfc4798>`_
1858 * `BGP-Prefix Segment in large-scale data centers <https://tools.ietf.org/html/draft-ietf-spring-segment-routing-msdc-01>`_
1859 * `Egress Peer Engineering using BGP-LU <https://tools.ietf.org/html/draft-gredler-idr-bgplu-epe-06>`_
1860
1861 IP L3VPN Family
1862 ---------------
1863 The BGP/MPLS IP Virtual Private Networks (BGP L3VPN) Multiprotocol extension can be used to exchange particular VPN (customer) routes among the provider's routers attached to that VPN.
1864 Also, routes are distributed to specific VPN remote sites.
1865
1866 .. contents:: Contents
1867    :depth: 2
1868    :local:
1869
1870 Configuration
1871 ^^^^^^^^^^^^^
1872 This section shows a way to enable IPv4 and IPv6 L3VPN family in BGP speaker and peer configuration.
1873
1874 BGP Speaker
1875 '''''''''''
1876 To enable IPv4 and IPv6 L3VPN support in BGP plugin, first configure BGP speaker instance:
1877
1878 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
1879
1880 **Method:** ``POST``
1881
1882 **Content-Type:** ``application/xml``
1883
1884 **Request Body:**
1885
1886 .. code-block:: xml
1887
1888    <protocol xmlns="http://openconfig.net/yang/network-instance">
1889        <name>bgp-example</name>
1890        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
1891        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1892            <global>
1893                <config>
1894                    <router-id>192.0.2.2</router-id>
1895                    <as>65000</as>
1896                </config>
1897                <afi-safis>
1898                    <afi-safi>
1899                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
1900                    </afi-safi>
1901                    <afi-safi>
1902                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
1903                    </afi-safi>
1904                </afi-safis>
1905            </global>
1906        </bgp>
1907    </protocol>
1908
1909 BGP Peer
1910 ''''''''
1911 Here is an example for BGP peer configuration with enabled IPv4 and IPv6 L3VPN family.
1912
1913 **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``
1914
1915 **Method:** ``POST``
1916
1917 **Content-Type:** ``application/xml``
1918
1919 **Request Body:**
1920
1921 .. code-block:: xml
1922
1923    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1924        <neighbor-address>192.0.2.1</neighbor-address>
1925        <afi-safis>
1926            <afi-safi>
1927                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
1928            </afi-safi>
1929            <afi-safi>
1930                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
1931            </afi-safi>
1932        </afi-safis>
1933    </neighbor>
1934
1935 IP L3VPN API
1936 ^^^^^^^^^^^^
1937 Following trees illustrate the BGP IP L3VPN routes structures.
1938
1939 IPv4 L3VPN Route
1940 ''''''''''''''''
1941 .. code-block:: console
1942
1943    :(vpn-ipv4-routes-case)
1944       +--ro vpn-ipv4-routes
1945          +--ro vpn-route* [route-key]
1946             +--ro route-key              string
1947             +--ro label-stack*
1948             |  +--ro label-value?   netc:mpls-label
1949             +--ro prefix?                inet:ip-prefix
1950             +--ro path-id?               path-id
1951             +--ro route-distinguisher?   bgp-t:route-distinguisher
1952             +--ro attributes
1953             ...
1954
1955 IPv6 L3VPN Route
1956 ''''''''''''''''
1957 .. code-block:: console
1958
1959    :(vpn-ipv6-routes-case)
1960       +--ro vpn-ipv6-routes
1961          +--ro vpn-route* [route-key]
1962             +--ro route-key              string
1963             +--ro label-stack*
1964             |  +--ro label-value?   netc:mpls-label
1965             +--ro prefix?                inet:ip-prefix
1966             +--ro path-id?               path-id
1967             +--ro route-distinguisher?   bgp-t:route-distinguisher
1968             +--ro attributes
1969             ...
1970
1971 Usage
1972 ^^^^^
1973 IPv4 L3VPN
1974 ''''''''''
1975 The IPv4 L3VPN table in an instance of the speaker's Loc-RIB can be verified via REST:
1976
1977 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-types:mpls-labeled-vpn-subsequent-address-family/bgp-vpn-ipv4:vpn-ipv4-routes``
1978
1979 **Method:** ``GET``
1980
1981 **Response Body:**
1982
1983 .. code-block:: xml
1984
1985    <vpn-ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv4">
1986        <vpn-route>
1987            <route-key>cAXdYQABrBAALABlCgIi</route-key>
1988            <label-stack>
1989                <label-value>24022</label-value>
1990            </label-stack>
1991            <attributes>
1992                <extended-communities>
1993                    <transitive>true</transitive>
1994                    <route-target-extended-community>
1995                        <global-administrator>65000</global-administrator>
1996                        <local-administrator>AAAAZQ==</local-administrator>
1997                    </route-target-extended-community>
1998                </extended-communities>
1999                <origin>
2000                    <value>igp</value>
2001                </origin>
2002                <as-path></as-path>
2003                <local-pref>
2004                    <pref>100</pref>
2005                </local-pref>
2006                <ipv4-next-hop>
2007                    <global>127.16.0.44</global>
2008                </ipv4-next-hop>
2009            </attributes>
2010            <route-distinguisher>172.16.0.44:101</route-distinguisher>
2011            <prefix>10.2.34.0/24</prefix>
2012        </vpn-route>
2013    </vpn-ipv4-routes>
2014
2015 IPv6 L3VPN
2016 ''''''''''
2017 The IPv6 L3VPN table in an instance of the speaker's Loc-RIB can be verified via REST:
2018
2019 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv6-address-family/bgp-types:mpls-labeled-vpn-subsequent-address-family/bgp-vpn-ipv6:vpn-ipv6-routes``
2020
2021 **Method:** ``GET``
2022
2023 **Response Body:**
2024
2025 .. code-block:: xml
2026
2027    <vpn-ipv6-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv6">
2028        <vpn-route>
2029            <route-key>mAXdcQABrBAALABlKgILgAAAAAE=</route-key>
2030            <label-stack>
2031                <label-value>24023</label-value>
2032            </label-stack>
2033            <attributes>
2034                <local-pref>
2035                    <pref>100</pref>
2036                </local-pref>
2037                <extended-communities>
2038                    <route-target-extended-community>
2039                        <global-administrator>65000</global-administrator>
2040                        <local-administrator>AAAAZQ==</local-administrator>
2041                    </route-target-extended-community>
2042                    <transitive>true</transitive>
2043                </extended-communities>
2044                <ipv6-next-hop>
2045                    <global>2a02:b80:0:2::1</global>
2046                </ipv6-next-hop>
2047                <origin>
2048                    <value>igp</value>
2049                </origin>
2050                <as-path></as-path>
2051            </attributes>
2052            <route-distinguisher>172.16.0.44:101</route-distinguisher>
2053            <prefix>2a02:b80:0:1::/64</prefix>
2054        </vpn-route>
2055    </vpn-ipv6-routes>
2056
2057 Programming
2058 ^^^^^^^^^^^
2059 This examples show how to originate and remove IPv4 L3VPN route via programmable RIB.
2060 Make sure the *Application Peer* is configured first.
2061
2062 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-types:mpls-labeled-vpn-subsequent-address-family/bgp-vpn-ipv4:vpn-ipv4-routes``
2063
2064 **Method:** ``POST``
2065
2066 **Content-Type:** ``application/xml``
2067
2068 **Request Body:**
2069
2070 .. code-block:: xml
2071
2072    <vpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv4">
2073        <route-key>vpn1</route-key>
2074        <label-stack>
2075            <label-value>123</label-value>
2076        </label-stack>
2077        <route-distinguisher>429496729:1</route-distinguisher>
2078        <prefix>2.2.2.2/32</prefix>
2079        <attributes>
2080            <ipv4-next-hop>
2081                <global>199.20.166.41</global>
2082            </ipv4-next-hop>
2083            <as-path/>
2084            <origin>
2085                <value>igp</value>
2086            </origin>
2087            <extended-communities>
2088                <route-target-extended-community>
2089                    <global-administrator>65000</global-administrator>
2090                    <local-administrator>AAAAZQ==</local-administrator>
2091                </route-target-extended-community>
2092                <transitive>true</transitive>
2093            </extended-communities>
2094        </attributes>
2095    </vpn-route>
2096
2097 -----
2098
2099 To remove the route added above, following request can be used:
2100
2101 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-types:mpls-labeled-vpn-subsequent-address-family/bgp-vpn-ipv4:vpn-ipv4-routes/vpn-route/vpn1``
2102
2103 **Method:** ``DELETE``
2104
2105 References
2106 ^^^^^^^^^^
2107 * `BGP/MPLS IP Virtual Private Networks (VPNs) <https://tools.ietf.org/html/rfc4364>`_
2108 * `BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN <https://tools.ietf.org/html/rfc4659>`_
2109 * `BGP/MPLS VPN Virtual PE <https://tools.ietf.org/html/draft-ietf-bess-virtual-pe-00>`_
2110
2111 Link-State Family
2112 -----------------
2113 The BGP Link-State (BGP-LS) Multiprotocol extension allows to distribute Link-State and Traffic Engineering (TE) information.
2114 This information is typically distributed by IGP routing protocols with in the network, limiting LSDB or TED visibility to the IGP area.
2115 The BGP-LS-enabled routers are capable to collect such information from networks (multiple IGP areas, inter-AS) and share with external components (i.e. OpenDaylight BGP).
2116 The information is applicable in ALTO servers and PCEs, as both need to gather information about topologies.
2117 In addition, link-state information is extended to carry segment information (Spring).
2118
2119 .. contents:: Contents
2120    :depth: 2
2121    :local:
2122
2123 Configuration
2124 ^^^^^^^^^^^^^
2125 This section shows a way to enable IPv4 and IPv6 Labeled Unicast family in BGP speaker and peer configuration.
2126
2127 BGP Speaker
2128 '''''''''''
2129 To enable BGP-LS support in BGP plugin, first configure BGP speaker instance:
2130
2131 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
2132
2133 **Method:** ``POST``
2134
2135 **Content-Type:** ``application/xml``
2136
2137 **Request Body:**
2138
2139 .. code-block:: xml
2140
2141    <protocol xmlns="http://openconfig.net/yang/network-instance">
2142        <name>bgp-example</name>
2143        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
2144        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2145            <global>
2146                <config>
2147                    <router-id>192.0.2.2</router-id>
2148                    <as>65000</as>
2149                </config>
2150                <afi-safis>
2151                    <afi-safi>
2152                        <afi-safi-name>LINKSTATE</afi-safi-name>
2153                    </afi-safi>
2154                </afi-safis>
2155            </global>
2156        </bgp>
2157    </protocol>
2158
2159 Linkstate path attribute
2160 ''''''''''''''''''''''''
2161 IANA allocation for BGP-LS path attribute is TYPE 29.
2162 Some older BGP-LS implementations might still require earliest asigned allocation TYPE 99.
2163 To use TYPE = 99, you need to set value bellow to false.
2164
2165 **URL:** ``/restconf/config/bgp-linkstate-app-config:bgp-linkstate-app-config``
2166
2167 **Method:** ``PUT``
2168
2169 **Content-Type:** ``application/xml``
2170
2171 **Request Body:**
2172
2173 .. code-block:: xml
2174
2175    <bgp-linkstate-app-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:linkstate-app-config">
2176        <iana-linkstate-attribute-type>false</iana-linkstate-attribute-type>
2177    </bgp-linkstate-app-config>
2178
2179 BGP Peer
2180 ''''''''
2181 Here is an example for BGP peer configuration with enabled BGP-LS family.
2182
2183 **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``
2184
2185 **Method:** ``POST``
2186
2187 **Content-Type:** ``application/xml``
2188
2189 **Request Body:**
2190
2191 .. code-block:: xml
2192
2193    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2194        <neighbor-address>192.0.2.1</neighbor-address>
2195        <afi-safis>
2196            <afi-safi>
2197                <afi-safi-name>LINKSTATE</afi-safi-name>
2198            </afi-safi>
2199        </afi-safis>
2200    </neighbor>
2201
2202 Link-State Route API
2203 ^^^^^^^^^^^^^^^^^^^^
2204 Following tree illustrate the BGP Link-State route structure.
2205
2206 .. code-block:: console
2207
2208    :(linkstate-routes-case)
2209       +--ro linkstate-routes
2210          +--ro linkstate-route* [route-key]
2211             +--ro route-key                       binary
2212             +--ro protocol-id                     protocol-id
2213             +--ro identifier                      identifier
2214             +--ro (object-type)?
2215             |  +--:(node-case)
2216             |  |  +--ro node-descriptors
2217             |  |     +--ro as-number?         inet:as-number
2218             |  |     +--ro area-id?           area-identifier
2219             |  |     +--ro domain-id?         domain-identifier
2220             |  |     +--ro (c-router-identifier)?
2221             |  |        +--:(isis-node-case)
2222             |  |        |  +--ro isis-node
2223             |  |        |     +--ro iso-system-id    netc:iso-system-identifier
2224             |  |        +--:(isis-pseudonode-case)
2225             |  |        |  +--ro isis-pseudonode
2226             |  |        |     +--ro is-is-router-identifier
2227             |  |        |     |  +--ro iso-system-id    netc:iso-system-identifier
2228             |  |        |     +--ro psn                        uint8
2229             |  |        +--:(ospf-node-case)
2230             |  |        |  +--ro ospf-node
2231             |  |        |     +--ro ospf-router-id    uint32
2232             |  |        +--:(ospf-pseudonode-case)
2233             |  |           +--ro ospf-pseudonode
2234             |  |              +--ro ospf-router-id    uint32
2235             |  |              +--ro lan-interface     ospf-interface-identifier
2236             |  +--:(link-case)
2237             |  |  +--ro local-node-descriptors
2238             |  |  |  +--ro as-number?         inet:as-number
2239             |  |  |  +--ro area-id?           area-identifier
2240             |  |  |  +--ro domain-id?         domain-identifier
2241             |  |  |  +--ro (c-router-identifier)?
2242             |  |  |  |  +--:(isis-node-case)
2243             |  |  |  |  |  +--ro isis-node
2244             |  |  |  |  |     +--ro iso-system-id    netc:iso-system-identifier
2245             |  |  |  |  +--:(isis-pseudonode-case)
2246             |  |  |  |  |  +--ro isis-pseudonode
2247             |  |  |  |  |     +--ro is-is-router-identifier
2248             |  |  |  |  |     |  +--ro iso-system-id    netc:iso-system-identifier
2249             |  |  |  |  |     +--ro psn                        uint8
2250             |  |  |  |  +--:(ospf-node-case)
2251             |  |  |  |  |  +--ro ospf-node
2252             |  |  |  |  |     +--ro ospf-router-id    uint32
2253             |  |  |  |  +--:(ospf-pseudonode-case)
2254             |  |  |  |     +--ro ospf-pseudonode
2255             |  |  |  |        +--ro ospf-router-id    uint32
2256             |  |  |  |        +--ro lan-interface     ospf-interface-identifier
2257             |  |  |  +--ro bgp-router-id?     inet:ipv4-address
2258             |  |  |  +--ro member-asn?        inet:as-number
2259             |  |  +--ro remote-node-descriptors
2260             |  |  |  +--ro as-number?         inet:as-number
2261             |  |  |  +--ro area-id?           area-identifier
2262             |  |  |  +--ro domain-id?         domain-identifier
2263             |  |  |  +--ro (c-router-identifier)?
2264             |  |  |  |  +--:(isis-node-case)
2265             |  |  |  |  |  +--ro isis-node
2266             |  |  |  |  |     +--ro iso-system-id    netc:iso-system-identifier
2267             |  |  |  |  +--:(isis-pseudonode-case)
2268             |  |  |  |  |  +--ro isis-pseudonode
2269             |  |  |  |  |     +--ro is-is-router-identifier
2270             |  |  |  |  |     |  +--ro iso-system-id    netc:iso-system-identifier
2271             |  |  |  |  |     +--ro psn                        uint8
2272             |  |  |  |  +--:(ospf-node-case)
2273             |  |  |  |  |  +--ro ospf-node
2274             |  |  |  |  |     +--ro ospf-router-id    uint32
2275             |  |  |  |  +--:(ospf-pseudonode-case)
2276             |  |  |  |     +--ro ospf-pseudonode
2277             |  |  |  |        +--ro ospf-router-id    uint32
2278             |  |  |  |        +--ro lan-interface     ospf-interface-identifier
2279             |  |  |  +--ro bgp-router-id?     inet:ipv4-address
2280             |  |  |  +--ro member-asn?        inet:as-number
2281             |  |  +--ro link-descriptors
2282             |  |     +--ro link-local-identifier?    uint32
2283             |  |     +--ro link-remote-identifier?   uint32
2284             |  |     +--ro ipv4-interface-address?   ipv4-interface-identifier
2285             |  |     +--ro ipv6-interface-address?   ipv6-interface-identifier
2286             |  |     +--ro ipv4-neighbor-address?    ipv4-interface-identifier
2287             |  |     +--ro ipv6-neighbor-address?    ipv6-interface-identifier
2288             |  |     +--ro multi-topology-id?        topology-identifier
2289             |  +--:(prefix-case)
2290             |  |  +--ro advertising-node-descriptors
2291             |  |  |  +--ro as-number?         inet:as-number
2292             |  |  |  +--ro area-id?           area-identifier
2293             |  |  |  +--ro domain-id?         domain-identifier
2294             |  |  |  +--ro (c-router-identifier)?
2295             |  |  |     +--:(isis-node-case)
2296             |  |  |     |  +--ro isis-node
2297             |  |  |     |     +--ro iso-system-id    netc:iso-system-identifier
2298             |  |  |     +--:(isis-pseudonode-case)
2299             |  |  |     |  +--ro isis-pseudonode
2300             |  |  |     |     +--ro is-is-router-identifier
2301             |  |  |     |     |  +--ro iso-system-id    netc:iso-system-identifier
2302             |  |  |     |     +--ro psn                        uint8
2303             |  |  |     +--:(ospf-node-case)
2304             |  |  |     |  +--ro ospf-node
2305             |  |  |     |     +--ro ospf-router-id    uint32
2306             |  |  |     +--:(ospf-pseudonode-case)
2307             |  |  |        +--ro ospf-pseudonode
2308             |  |  |           +--ro ospf-router-id    uint32
2309             |  |  |           +--ro lan-interface     ospf-interface-identifier
2310             |  |  +--ro prefix-descriptors
2311             |  |     +--ro multi-topology-id?             topology-identifier
2312             |  |     +--ro ospf-route-type?               ospf-route-type
2313             |  |     +--ro ip-reachability-information?   inet:ip-prefix
2314             |  +--:(te-lsp-case)
2315             |     +--ro (address-family)?
2316             |     |  +--:(ipv4-case)
2317             |     |  |  +--ro ipv4-tunnel-sender-address      inet:ipv4-address
2318             |     |  |  +--ro ipv4-tunnel-endpoint-address    inet:ipv4-address
2319             |     |  +--:(ipv6-case)
2320             |     |     +--ro ipv6-tunnel-sender-address      inet:ipv6-address
2321             |     |     +--ro ipv6-tunnel-endpoint-address    inet:ipv6-address
2322             |     +--ro tunnel-id?                      rsvp:tunnel-id
2323             |     +--ro lsp-id?                         rsvp:lsp-id
2324             +--ro attributes
2325                +--ro (link-state-attribute)?
2326                   +--:(node-attributes-case)
2327                   |  +--ro node-attributes
2328                   |     +--ro topology-identifier*   topology-identifier
2329                   |     +--ro node-flags?            node-flag-bits
2330                   |     +--ro isis-area-id*          isis-area-identifier
2331                   |     +--ro dynamic-hostname?      string
2332                   |     +--ro ipv4-router-id?        ipv4-router-identifier
2333                   |     +--ro ipv6-router-id?        ipv6-router-identifier
2334                   |     +--ro sr-capabilities
2335                   |     |  +--ro mpls-ipv4?      boolean
2336                   |     |  +--ro mpls-ipv6?      boolean
2337                   |     |  +--ro sr-ipv6?        boolean
2338                   |     |  +--ro range-size?     uint32
2339                   |     |  +--ro (sid-label-index)?
2340                   |     |     +--:(local-label-case)
2341                   |     |     |  +--ro local-label?    netc:mpls-label
2342                   |     |     +--:(ipv6-address-case)
2343                   |     |     |  +--ro ipv6-address?   inet:ipv6-address
2344                   |     |     +--:(sid-case)
2345                   |     |        +--ro sid?            uint32
2346                   |     +--ro sr-algorithm
2347                   |        +--ro algorithms*   algorithm
2348                   +--:(link-attributes-case)
2349                   |  +--ro link-attributes
2350                   |     +--ro local-ipv4-router-id?       ipv4-router-identifier
2351                   |     +--ro local-ipv6-router-id?       ipv6-router-identifier
2352                   |     +--ro remote-ipv4-router-id?      ipv4-router-identifier
2353                   |     +--ro remote-ipv6-router-id?      ipv6-router-identifier
2354                   |     +--ro mpls-protocol?              mpls-protocol-mask
2355                   |     +--ro te-metric?                  netc:te-metric
2356                   |     +--ro metric?                     netc:metric
2357                   |     +--ro shared-risk-link-groups*    rsvp:srlg-id
2358                   |     +--ro link-name?                  string
2359                   |     +--ro max-link-bandwidth?         netc:bandwidth
2360                   |     +--ro max-reservable-bandwidth?   netc:bandwidth
2361                   |     +--ro unreserved-bandwidth* [priority]
2362                   |     |  +--ro priority     uint8
2363                   |     |  +--ro bandwidth?   netc:bandwidth
2364                   |     +--ro link-protection?            link-protection-type
2365                   |     +--ro admin-group?                administrative-group
2366                   |     +--ro sr-adj-ids*
2367                   |     |  +--ro (flags)?
2368                   |     |  |  +--:(ospf-adj-flags-case)
2369                   |     |  |  |  +--ro backup?           boolean
2370                   |     |  |  |  +--ro set?              boolean
2371                   |     |  |  +--:(isis-adj-flags-case)
2372                   |     |  |     +--ro backup?           boolean
2373                   |     |  |     +--ro set?              boolean
2374                   |     |  |     +--ro address-family?   boolean
2375                   |     |  +--ro weight?           weight
2376                   |     |  +--ro (sid-label-index)?
2377                   |     |     +--:(local-label-case)
2378                   |     |     |  +--ro local-label?      netc:mpls-label
2379                   |     |     +--:(ipv6-address-case)
2380                   |     |     |  +--ro ipv6-address?     inet:ipv6-address
2381                   |     |     +--:(sid-case)
2382                   |     |        +--ro sid?              uint32
2383                   |     +--ro sr-lan-adj-ids*
2384                   |     |  +--ro (flags)?
2385                   |     |  |  +--:(ospf-adj-flags-case)
2386                   |     |  |  |  +--ro backup?           boolean
2387                   |     |  |  |  +--ro set?              boolean
2388                   |     |  |  +--:(isis-adj-flags-case)
2389                   |     |  |     +--ro backup?           boolean
2390                   |     |  |     +--ro set?              boolean
2391                   |     |  |     +--ro address-family?   boolean
2392                   |     |  +--ro weight?           weight
2393                   |     |  +--ro iso-system-id?    netc:iso-system-identifier
2394                   |     |  +--ro neighbor-id?      inet:ipv4-address
2395                   |     |  +--ro (sid-label-index)?
2396                   |     |     +--:(local-label-case)
2397                   |     |     |  +--ro local-label?      netc:mpls-label
2398                   |     |     +--:(ipv6-address-case)
2399                   |     |     |  +--ro ipv6-address?     inet:ipv6-address
2400                   |     |     +--:(sid-case)
2401                   |     |        +--ro sid?              uint32
2402                   |     +--ro peer-node-sid
2403                   |     |  +--ro weight?         weight
2404                   |     |  +--ro (sid-label-index)?
2405                   |     |     +--:(local-label-case)
2406                   |     |     |  +--ro local-label?    netc:mpls-label
2407                   |     |     +--:(ipv6-address-case)
2408                   |     |     |  +--ro ipv6-address?   inet:ipv6-address
2409                   |     |     +--:(sid-case)
2410                   |     |        +--ro sid?            uint32
2411                   |     +--ro peer-adj-sid
2412                   |     |  +--ro weight?         weight
2413                   |     |  +--ro (sid-label-index)?
2414                   |     |     +--:(local-label-case)
2415                   |     |     |  +--ro local-label?    netc:mpls-label
2416                   |     |     +--:(ipv6-address-case)
2417                   |     |     |  +--ro ipv6-address?   inet:ipv6-address
2418                   |     |     +--:(sid-case)
2419                   |     |        +--ro sid?            uint32
2420                   |     +--ro peer-set-sids*
2421                   |        +--ro weight?         weight
2422                   |        +--ro (sid-label-index)?
2423                   |           +--:(local-label-case)
2424                   |           |  +--ro local-label?    netc:mpls-label
2425                   |           +--:(ipv6-address-case)
2426                   |           |  +--ro ipv6-address?   inet:ipv6-address
2427                   |           +--:(sid-case)
2428                   |              +--ro sid?            uint32
2429                   +--:(prefix-attributes-case)
2430                   |  +--ro prefix-attributes
2431                   |     +--ro igp-bits
2432                   |     |  x--ro up-down?               bits
2433                   |     |  +--ro is-is-up-down?         boolean
2434                   |     |  +--ro ospf-no-unicast?       boolean
2435                   |     |  +--ro ospf-local-address?    boolean
2436                   |     |  +--ro ospf-propagate-nssa?   boolean
2437                   |     +--ro route-tags*                route-tag
2438                   |     +--ro extended-tags*             extended-route-tag
2439                   |     +--ro prefix-metric?             netc:igp-metric
2440                   |     +--ro ospf-forwarding-address?   inet:ip-address
2441                   |     +--ro sr-prefix
2442                   |     |  +--ro (flags)?
2443                   |     |  |  +--:(isis-prefix-flags-case)
2444                   |     |  |  |  +--ro no-php?            boolean
2445                   |     |  |  |  +--ro explicit-null?     boolean
2446                   |     |  |  |  +--ro readvertisement?   boolean
2447                   |     |  |  |  +--ro node-sid?          boolean
2448                   |     |  |  +--:(ospf-prefix-flags-case)
2449                   |     |  |     +--ro no-php?            boolean
2450                   |     |  |     +--ro explicit-null?     boolean
2451                   |     |  |     +--ro mapping-server?    boolean
2452                   |     |  +--ro algorithm?         algorithm
2453                   |     |  +--ro (sid-label-index)?
2454                   |     |     +--:(local-label-case)
2455                   |     |     |  +--ro local-label?       netc:mpls-label
2456                   |     |     +--:(ipv6-address-case)
2457                   |     |     |  +--ro ipv6-address?      inet:ipv6-address
2458                   |     |     +--:(sid-case)
2459                   |     |        +--ro sid?               uint32
2460                   |     +--ro ipv6-sr-prefix
2461                   |     |  +--ro algorithm?   algorithm
2462                   |     +--ro sr-range
2463                   |     |  +--ro inter-area?   boolean
2464                   |     |  +--ro range-size?   uint16
2465                   |     |  +--ro sub-tlvs*
2466                   |     |     +--ro (range-sub-tlv)?
2467                   |     |        +--:(binding-sid-tlv-case)
2468                   |     |        |  +--ro weight?                weight
2469                   |     |        |  +--ro (flags)?
2470                   |     |        |  |  +--:(isis-binding-flags-case)
2471                   |     |        |  |  |  +--ro address-family?        boolean
2472                   |     |        |  |  |  +--ro mirror-context?        boolean
2473                   |     |        |  |  |  +--ro spread-tlv?            boolean
2474                   |     |        |  |  |  +--ro leaked-from-level-2?   boolean
2475                   |     |        |  |  |  +--ro attached-flag?         boolean
2476                   |     |        |  |  +--:(ospf-binding-flags-case)
2477                   |     |        |  |     +--ro mirroring?             boolean
2478                   |     |        |  +--ro binding-sub-tlvs*
2479                   |     |        |     +--ro (binding-sub-tlv)?
2480                   |     |        |        +--:(prefix-sid-case)
2481                   |     |        |        |  +--ro (flags)?
2482                   |     |        |        |  |  +--:(isis-prefix-flags-case)
2483                   |     |        |        |  |  |  +--ro no-php?            boolean
2484                   |     |        |        |  |  |  +--ro explicit-null?     boolean
2485                   |     |        |        |  |  |  +--ro readvertisement?   boolean
2486                   |     |        |        |  |  |  +--ro node-sid?          boolean
2487                   |     |        |        |  |  +--:(ospf-prefix-flags-case)
2488                   |     |        |        |  |     +--ro no-php?            boolean
2489                   |     |        |        |  |     +--ro explicit-null?     boolean
2490                   |     |        |        |  |     +--ro mapping-server?    boolean
2491                   |     |        |        |  +--ro algorithm?         algorithm
2492                   |     |        |        |  +--ro (sid-label-index)?
2493                   |     |        |        |     +--:(local-label-case)
2494                   |     |        |        |     |  +--ro local-label?       netc:mpls-label
2495                   |     |        |        |     +--:(ipv6-address-case)
2496                   |     |        |        |     |  +--ro ipv6-address?      inet:ipv6-address
2497                   |     |        |        |     +--:(sid-case)
2498                   |     |        |        |        +--ro sid?               uint32
2499                   |     |        |        +--:(ipv6-prefix-sid-case)
2500                   |     |        |        |  +--ro algorithm?         algorithm
2501                   |     |        |        +--:(sid-label-case)
2502                   |     |        |        |  +--ro (sid-label-index)?
2503                   |     |        |        |     +--:(local-label-case)
2504                   |     |        |        |     |  +--ro local-label?       netc:mpls-label
2505                   |     |        |        |     +--:(ipv6-address-case)
2506                   |     |        |        |     |  +--ro ipv6-address?      inet:ipv6-address
2507                   |     |        |        |     +--:(sid-case)
2508                   |     |        |        |        +--ro sid?               uint32
2509                   |     |        |        +--:(ero-metric-case)
2510                   |     |        |        |  +--ro ero-metric?        netc:te-metric
2511                   |     |        |        +--:(ipv4-ero-case)
2512                   |     |        |        |  +--ro loose?             boolean
2513                   |     |        |        |  +--ro address            inet:ipv4-address
2514                   |     |        |        +--:(ipv6-ero-case)
2515                   |     |        |        |  +--ro loose?             boolean
2516                   |     |        |        |  +--ro address            inet:ipv6-address
2517                   |     |        |        +--:(unnumbered-interface-id-ero-case)
2518                   |     |        |        |  +--ro loose?             boolean
2519                   |     |        |        |  +--ro router-id?         uint32
2520                   |     |        |        |  +--ro interface-id?      uint32
2521                   |     |        |        +--:(ipv4-ero-backup-case)
2522                   |     |        |        |  +--ro loose?             boolean
2523                   |     |        |        |  +--ro address            inet:ipv4-address
2524                   |     |        |        +--:(ipv6-ero-backup-case)
2525                   |     |        |        |  +--ro loose?             boolean
2526                   |     |        |        |  +--ro address            inet:ipv6-address
2527                   |     |        |        +--:(unnumbered-interface-id-backup-ero-case)
2528                   |     |        |           +--ro loose?             boolean
2529                   |     |        |           +--ro router-id?         uint32
2530                   |     |        |           +--ro interface-id?      uint32
2531                   |     |        +--:(prefix-sid-tlv-case)
2532                   |     |        |  +--ro (flags)?
2533                   |     |        |  |  +--:(isis-prefix-flags-case)
2534                   |     |        |  |  |  +--ro no-php?                boolean
2535                   |     |        |  |  |  +--ro explicit-null?         boolean
2536                   |     |        |  |  |  +--ro readvertisement?       boolean
2537                   |     |        |  |  |  +--ro node-sid?              boolean
2538                   |     |        |  |  +--:(ospf-prefix-flags-case)
2539                   |     |        |  |     +--ro no-php?                boolean
2540                   |     |        |  |     +--ro explicit-null?         boolean
2541                   |     |        |  |     +--ro mapping-server?        boolean
2542                   |     |        |  +--ro algorithm?             algorithm
2543                   |     |        |  +--ro (sid-label-index)?
2544                   |     |        |     +--:(local-label-case)
2545                   |     |        |     |  +--ro local-label?           netc:mpls-label
2546                   |     |        |     +--:(ipv6-address-case)
2547                   |     |        |     |  +--ro ipv6-address?          inet:ipv6-address
2548                   |     |        |     +--:(sid-case)
2549                   |     |        |        +--ro sid?                   uint32
2550                   |     |        +--:(ipv6-prefix-sid-tlv-case)
2551                   |     |        |  +--ro algorithm?             algorithm
2552                   |     |        +--:(sid-label-tlv-case)
2553                   |     |           +--ro (sid-label-index)?
2554                   |     |              +--:(local-label-case)
2555                   |     |              |  +--ro local-label?           netc:mpls-label
2556                   |     |              +--:(ipv6-address-case)
2557                   |     |              |  +--ro ipv6-address?          inet:ipv6-address
2558                   |     |              +--:(sid-case)
2559                   |     |                 +--ro sid?                   uint32
2560                   |     +--ro sr-binding-sid-labels*
2561                   |        +--ro weight?                weight
2562                   |        +--ro (flags)?
2563                   |        |  +--:(isis-binding-flags-case)
2564                   |        |  |  +--ro address-family?        boolean
2565                   |        |  |  +--ro mirror-context?        boolean
2566                   |        |  |  +--ro spread-tlv?            boolean
2567                   |        |  |  +--ro leaked-from-level-2?   boolean
2568                   |        |  |  +--ro attached-flag?         boolean
2569                   |        |  +--:(ospf-binding-flags-case)
2570                   |        |     +--ro mirroring?             boolean
2571                   |        +--ro binding-sub-tlvs*
2572                   |           +--ro (binding-sub-tlv)?
2573                   |              +--:(prefix-sid-case)
2574                   |              |  +--ro (flags)?
2575                   |              |  |  +--:(isis-prefix-flags-case)
2576                   |              |  |  |  +--ro no-php?            boolean
2577                   |              |  |  |  +--ro explicit-null?     boolean
2578                   |              |  |  |  +--ro readvertisement?   boolean
2579                   |              |  |  |  +--ro node-sid?          boolean
2580                   |              |  |  +--:(ospf-prefix-flags-case)
2581                   |              |  |     +--ro no-php?            boolean
2582                   |              |  |     +--ro explicit-null?     boolean
2583                   |              |  |     +--ro mapping-server?    boolean
2584                   |              |  +--ro algorithm?         algorithm
2585                   |              |  +--ro (sid-label-index)?
2586                   |              |     +--:(local-label-case)
2587                   |              |     |  +--ro local-label?       netc:mpls-label
2588                   |              |     +--:(ipv6-address-case)
2589                   |              |     |  +--ro ipv6-address?      inet:ipv6-address
2590                   |              |     +--:(sid-case)
2591                   |              |        +--ro sid?               uint32
2592                   |              +--:(ipv6-prefix-sid-case)
2593                   |              |  +--ro algorithm?         algorithm
2594                   |              +--:(sid-label-case)
2595                   |              |  +--ro (sid-label-index)?
2596                   |              |     +--:(local-label-case)
2597                   |              |     |  +--ro local-label?       netc:mpls-label
2598                   |              |     +--:(ipv6-address-case)
2599                   |              |     |  +--ro ipv6-address?      inet:ipv6-address
2600                   |              |     +--:(sid-case)
2601                   |              |        +--ro sid?               uint32
2602                   |              +--:(ero-metric-case)
2603                   |              |  +--ro ero-metric?        netc:te-metric
2604                   |              +--:(ipv4-ero-case)
2605                   |              |  +--ro loose?             boolean
2606                   |              |  +--ro address            inet:ipv4-address
2607                   |              +--:(ipv6-ero-case)
2608                   |              |  +--ro loose?             boolean
2609                   |              |  +--ro address            inet:ipv6-address
2610                   |              +--:(unnumbered-interface-id-ero-case)
2611                   |              |  +--ro loose?             boolean
2612                   |              |  +--ro router-id?         uint32
2613                   |              |  +--ro interface-id?      uint32
2614                   |              +--:(ipv4-ero-backup-case)
2615                   |              |  +--ro loose?             boolean
2616                   |              |  +--ro address            inet:ipv4-address
2617                   |              +--:(ipv6-ero-backup-case)
2618                   |              |  +--ro loose?             boolean
2619                   |              |  +--ro address            inet:ipv6-address
2620                   |              +--:(unnumbered-interface-id-backup-ero-case)
2621                   |                 +--ro loose?             boolean
2622                   |                 +--ro router-id?         uint32
2623                   |                 +--ro interface-id?      uint32
2624                   x--:(te-lsp-attributes-case)
2625                      +--ro te-lsp-attributes
2626
2627
2628 Usage
2629 ^^^^^
2630 The Link-State table in a instance of the speaker's Loc-RIB can be verified via REST:
2631
2632 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-linkstate:linkstate-address-family/bgp-linkstate:linkstate-subsequent-address-family/linkstate-routes``
2633
2634 **Method:** ``GET``
2635
2636 **Response Body:**
2637
2638 .. code-block:: xml
2639
2640    <linkstate-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-linkstate">
2641       ...
2642    </linkstate-routes>
2643
2644 .. note:: Link-State routes mapping to topology links/nodes/prefixes is supported by BGP Topology Provider.
2645
2646 References
2647 ^^^^^^^^^^
2648 * `North-Bound Distribution of Link-State and Traffic Engineering (TE) Information Using BGP <https://tools.ietf.org/html/rfc7752>`_
2649 * `BGP Link-State extensions for Segment Routing <https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-03>`_
2650 * `Segment Routing BGP Egress Peer Engineering BGP-LS Extensions <https://tools.ietf.org/html/draft-ietf-idr-bgpls-segment-routing-epe-05>`_
2651 * `BGP Link-State Information Distribution Implementation Report <https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-impl-04>`_
2652
2653 Flow Specification Family
2654 -------------------------
2655 The BGP Flow Specification (BGP-FS) Multiprotocol extension can be used to distribute traffic flow specifications.
2656 For example, the BGP-FS can be used in a case of (distributed) denial-of-service (DDoS) attack mitigation procedures and traffic filtering (BGP/MPLS VPN service, DC).
2657
2658 .. contents:: Contents
2659    :depth: 2
2660    :local:
2661
2662 Configuration
2663 ^^^^^^^^^^^^^
2664 This section shows a way to enable BGP-FS family in BGP speaker and peer configuration.
2665
2666 BGP Speaker
2667 '''''''''''
2668 To enable BGP-FS support in BGP plugin, first configure BGP speaker instance:
2669
2670 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
2671
2672 **Method:** ``POST``
2673
2674 **Content-Type:** ``application/xml``
2675
2676 **Request Body:**
2677
2678 .. code-block:: xml
2679
2680    <protocol xmlns="http://openconfig.net/yang/network-instance">
2681        <name>bgp-example</name>
2682        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
2683        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2684            <global>
2685                <config>
2686                    <router-id>192.0.2.2</router-id>
2687                    <as>65000</as>
2688                </config>
2689                <afi-safis>
2690                    <afi-safi>
2691                        <afi-safi-name>IPV4-FLOW</afi-safi-name>
2692                    </afi-safi>
2693                    <afi-safi>
2694                        <afi-safi-name>IPV6-FLOW</afi-safi-name>
2695                    </afi-safi>
2696                    <afi-safi>
2697                        <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
2698                    </afi-safi>
2699                    <afi-safi>
2700                        <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
2701                    </afi-safi>
2702                </afi-safis>
2703            </global>
2704        </bgp>
2705    </protocol>
2706
2707 BGP Peer
2708 ''''''''
2709 Here is an example for BGP peer configuration with enabled BGP-FS family.
2710
2711 **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``
2712
2713 **Method:** ``POST``
2714
2715 **Content-Type:** ``application/xml``
2716
2717 **Request Body:**
2718
2719 .. code-block:: xml
2720
2721    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2722        <neighbor-address>192.0.2.1</neighbor-address>
2723        <afi-safis>
2724            <afi-safi>
2725                <afi-safi-name>IPV4-FLOW</afi-safi-name>
2726            </afi-safi>
2727            <afi-safi>
2728                <afi-safi-name>IPV6-FLOW</afi-safi-name>
2729            </afi-safi>
2730            <afi-safi>
2731                <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
2732            </afi-safi>
2733            <afi-safi>
2734                <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
2735            </afi-safi>
2736        </afi-safis>
2737    </neighbor>
2738
2739 Flow Specification API
2740 ^^^^^^^^^^^^^^^^^^^^^^
2741 Following trees illustrate the BGP Flow Specification routes structure.
2742
2743 IPv4 Flow Specification Route
2744 '''''''''''''''''''''''''''''
2745 .. code-block:: console
2746
2747    :(flowspec-routes-case)
2748      +--ro flowspec-routes
2749         +--ro flowspec-route* [route-key path-id]
2750            +--ro route-key     string
2751            +--ro flowspec*
2752            |  +--ro (flowspec-type)?
2753            |     +--:(port-case)
2754            |     |  +--ro ports*
2755            |     |     +--ro op?      numeric-operand
2756            |     |     +--ro value?   uint16
2757            |     +--:(destination-port-case)
2758            |     |  +--ro destination-ports*
2759            |     |     +--ro op?      numeric-operand
2760            |     |     +--ro value?   uint16
2761            |     +--:(source-port-case)
2762            |     |  +--ro source-ports*
2763            |     |     +--ro op?      numeric-operand
2764            |     |     +--ro value?   uint16
2765            |     +--:(icmp-type-case)
2766            |     |  +--ro types*
2767            |     |     +--ro op?      numeric-operand
2768            |     |     +--ro value?   uint8
2769            |     +--:(icmp-code-case)
2770            |     |  +--ro codes*
2771            |     |     +--ro op?      numeric-operand
2772            |     |     +--ro value?   uint8
2773            |     +--:(tcp-flags-case)
2774            |     |  +--ro tcp-flags*
2775            |     |     +--ro op?      bitmask-operand
2776            |     |     +--ro value?   uint16
2777            |     +--:(packet-length-case)
2778            |     |  +--ro packet-lengths*
2779            |     |     +--ro op?      numeric-operand
2780            |     |     +--ro value?   uint16
2781            |     +--:(dscp-case)
2782            |     |  +--ro dscps*
2783            |     |     +--ro op?      numeric-operand
2784            |     |     +--ro value?   dscp
2785            |     +--:(fragment-case)
2786            |     |  +--ro fragments*
2787            |     |     +--ro op?      bitmask-operand
2788            |     |     +--ro value?   fragment
2789            |     +--:(destination-prefix-case)
2790            |     |  +--ro destination-prefix?   inet:ipv4-prefix
2791            |     +--:(source-prefix-case)
2792            |     |  +--ro source-prefix?        inet:ipv4-prefix
2793            |     +--:(protocol-ip-case)
2794            |        +--ro protocol-ips*
2795            |           +--ro op?      numeric-operand
2796            |           +--ro value?   uint8
2797            +--ro path-id       path-id
2798            +--ro attributes
2799               +--ro extended-communities*
2800                  +--ro transitive?                             boolean
2801                  +--ro (extended-community)?
2802                     +--:(traffic-rate-extended-community-case)
2803                     |  +--ro traffic-rate-extended-community
2804                     |     +--ro informative-as?        bgp-t:short-as-number
2805                     |     +--ro local-administrator?   netc:bandwidth
2806                     +--:(traffic-action-extended-community-case)
2807                     |  +--ro traffic-action-extended-community
2808                     |     +--ro sample?            boolean
2809                     |     +--ro terminal-action?   boolean
2810                     +--:(redirect-extended-community-case)
2811                     |  +--ro redirect-extended-community
2812                     |     +--ro global-administrator?   bgp-t:short-as-number
2813                     |     +--ro local-administrator?    binary
2814                     +--:(traffic-marking-extended-community-case)
2815                     |  +--ro traffic-marking-extended-community
2816                     |     +--ro global-administrator?   dscp
2817                     +--:(redirect-ipv4-extended-community-case)
2818                     |  +--ro redirect-ipv4
2819                     |     +--ro global-administrator?   inet:ipv4-address
2820                     |     +--ro local-administrator?    uint16
2821                     +--:(redirect-as4-extended-community-case)
2822                     |  +--ro redirect-as4
2823                     |     +--ro global-administrator?   inet:as-number
2824                     |     +--ro local-administrator?    uint16
2825                     +--:(redirect-ip-nh-extended-community-case)
2826                       +--ro redirect-ip-nh-extended-community
2827                          +--ro next-hop-address?   inet:ip-address
2828                          +--ro copy?               boolean
2829
2830
2831 IPv6 Flow Specification Route
2832 '''''''''''''''''''''''''''''
2833 .. code-block:: console
2834
2835    :(flowspec-ipv6-routes-case)
2836      +--ro flowspec-ipv6-routes
2837         +--ro flowspec-route* [route-key path-id]
2838            +--ro flowspec*
2839            |  +--ro (flowspec-type)?
2840            |     +--:(port-case)
2841            |     |  +--ro ports*
2842            |     |     +--ro op?      numeric-operand
2843            |     |     +--ro value?   uint16
2844            |     +--:(destination-port-case)
2845            |     |  +--ro destination-ports*
2846            |     |     +--ro op?      numeric-operand
2847            |     |     +--ro value?   uint16
2848            |     +--:(source-port-case)
2849            |     |  +--ro source-ports*
2850            |     |     +--ro op?      numeric-operand
2851            |     |     +--ro value?   uint16
2852            |     +--:(icmp-type-case)
2853            |     |  +--ro types*
2854            |     |     +--ro op?      numeric-operand
2855            |     |     +--ro value?   uint8
2856            |     +--:(icmp-code-case)
2857            |     |  +--ro codes*
2858            |     |     +--ro op?      numeric-operand
2859            |     |     +--ro value?   uint8
2860            |     +--:(tcp-flags-case)
2861            |     |  +--ro tcp-flags*
2862            |     |     +--ro op?      bitmask-operand
2863            |     |     +--ro value?   uint16
2864            |     +--:(packet-length-case)
2865            |     |  +--ro packet-lengths*
2866            |     |     +--ro op?      numeric-operand
2867            |     |     +--ro value?   uint16
2868            |     +--:(dscp-case)
2869            |     |  +--ro dscps*
2870            |     |     +--ro op?      numeric-operand
2871            |     |     +--ro value?   dscp
2872            |     +--:(fragment-case)
2873            |     |  +--ro fragments*
2874            |     |     +--ro op?      bitmask-operand
2875            |     |     +--ro value?   fragment
2876            |     +--:(destination-ipv6-prefix-case)
2877            |     |  +--ro destination-prefix?   inet:ipv6-prefix
2878            |     +--:(source-ipv6-prefix-case)
2879            |     |  +--ro source-prefix?        inet:ipv6-prefix
2880            |     +--:(next-header-case)
2881            |     |  +--ro next-headers*
2882            |     |     +--ro op?      numeric-operand
2883            |     |     +--ro value?   uint8
2884            |     +--:(flow-label-case)
2885            |        +--ro flow-label*
2886            |           +--ro op?      numeric-operand
2887            |           +--ro value?   uint32
2888            +--ro path-id       path-id
2889            +--ro attributes
2890               +--ro extended-communities*
2891                  +--ro transitive?                             boolean
2892                  +--ro (extended-community)?
2893                     +--:(traffic-rate-extended-community-case)
2894                     |  +--ro traffic-rate-extended-community
2895                     |     +--ro informative-as?        bgp-t:short-as-number
2896                     |     +--ro local-administrator?   netc:bandwidth
2897                     +--:(traffic-action-extended-community-case)
2898                     |  +--ro traffic-action-extended-community
2899                     |     +--ro sample?            boolean
2900                     |     +--ro terminal-action?   boolean
2901                     +--:(redirect-extended-community-case)
2902                     |  +--ro redirect-extended-community
2903                     |     +--ro global-administrator?   bgp-t:short-as-number
2904                     |     +--ro local-administrator?    binary
2905                     +--:(traffic-marking-extended-community-case)
2906                     |  +--ro traffic-marking-extended-community
2907                     |     +--ro global-administrator?   dscp
2908                     +--:(redirect-ipv6-extended-community-case)
2909                     |  +--ro redirect-ipv6
2910                     |     +--ro global-administrator?   inet:ipv6-address
2911                     |     +--ro local-administrator?    uint16
2912                     +--:(redirect-as4-extended-community-case)
2913                     |  +--ro redirect-as4
2914                     |     +--ro global-administrator?   inet:as-number
2915                     |     +--ro local-administrator?    uint16
2916                     +--:(redirect-ip-nh-extended-community-case)
2917                        +--ro redirect-ip-nh-extended-community
2918                           +--ro next-hop-address?   inet:ip-address
2919                           +--ro copy?               boolean
2920
2921 Usage
2922 ^^^^^
2923 The flowspec route represents rules and an action, defined as an extended community.
2924
2925 IPv4 Flow Specification
2926 '''''''''''''''''''''''
2927 The IPv4 Flowspec table in an instance of the speaker's Loc-RIB can be verified via REST:
2928
2929 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-flowspec:flowspec-subsequent-address-family/bgp-flowspec:flowspec-routes``
2930
2931 **Method:** ``GET``
2932
2933 **Response Body:**
2934
2935 .. code-block:: xml
2936
2937    <flowspec-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
2938        <flowspec-route>
2939            <path-id>0</path-id>
2940            <route-key>all packets to 192.168.0.1/32 AND from 10.0.0.2/32 AND where IP protocol equals to 17 or equals to 6 AND where port equals to 80 or equals to 8080 AND where destination port is greater than 8080 and is less than 8088 or equals to 3128 AND where source port is greater than 1024 </route-key>
2941            <attributes>
2942                <local-pref>
2943                    <pref>100</pref>
2944                </local-pref>
2945                <origin>
2946                    <value>igp</value>
2947                </origin>
2948                <as-path></as-path>
2949                <extended-communities>
2950                    <transitive>true</transitive>
2951                    <redirect-extended-community>
2952                        <local-administrator>AgMWLg==</local-administrator>
2953                        <global-administrator>258</global-administrator>
2954                    </redirect-extended-community>
2955                </extended-communities>
2956            </attributes>
2957            <flowspec>
2958                <destination-prefix>192.168.0.1/32</destination-prefix>
2959            </flowspec>
2960            <flowspec>
2961                <source-prefix>10.0.0.2/32</source-prefix>
2962            </flowspec>
2963            <flowspec>
2964                <protocol-ips>
2965                    <op>equals</op>
2966                    <value>17</value>
2967                </protocol-ips>
2968                <protocol-ips>
2969                    <op>equals end-of-list</op>
2970                    <value>6</value>
2971                </protocol-ips>
2972            </flowspec>
2973            <flowspec>
2974                <ports>
2975                    <op>equals</op>
2976                    <value>80</value>
2977                </ports>
2978                <ports>
2979                    <op>equals end-of-list</op>
2980                    <value>8080</value>
2981                </ports>
2982            </flowspec>
2983            <flowspec>
2984                <destination-ports>
2985                    <op>greater-than</op>
2986                    <value>8080</value>
2987                </destination-ports>
2988                <destination-ports>
2989                    <op>less-than and-bit</op>
2990                    <value>8088</value>
2991                </destination-ports>
2992                <destination-ports>
2993                    <op>equals end-of-list</op>
2994                    <value>3128</value>
2995                </destination-ports>
2996            </flowspec>
2997            <flowspec>
2998                <source-ports>
2999                    <op>end-of-list greater-than</op>
3000                    <value>1024</value>
3001                </source-ports>
3002            </flowspec>
3003        </flowspec-route>
3004    </flowspec-routes>
3005
3006 IPv6 Flows Specification
3007 ''''''''''''''''''''''''
3008 The IPv6 Flowspec table in an instance of the speaker's Loc-RIB can be verified via REST:
3009
3010 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv6-address-family/bgp-flowspec:flowspec-subsequent-address-family/bgp-flowspec:flowspec-ipv6-routes``
3011
3012 **Method:** ``GET``
3013
3014 **Response Body:**
3015
3016 .. code-block:: xml
3017
3018    <flowspec-ipv6-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3019        <flowspec-route>
3020            <path-id>0</path-id>
3021            <route-key>all packets to 2001:db8:31::/64 AND from 2001:db8:30::/64 AND where next header equals to 17 AND where DSCP equals to 50 AND where flow label equals to 2013 </route-key>
3022            <attributes>
3023                <local-pref>
3024                    <pref>100</pref>
3025                </local-pref>
3026                <origin>
3027                    <value>igp</value>
3028                </origin>
3029                <as-path></as-path>
3030                <extended-communities>
3031                    <transitive>true</transitive>
3032                    <traffic-rate-extended-community>
3033                        <informative-as>0</informative-as>
3034                        <local-administrator>AAAAAA==</local-administrator>
3035                    </traffic-rate-extended-community>
3036                </extended-communities>
3037            </attributes>
3038            <flowspec>
3039                <destination-prefix>2001:db8:31::/64</destination-prefix>
3040            </flowspec>
3041            <flowspec>
3042                <source-prefix>2001:db8:30::/64</source-prefix>
3043            </flowspec>
3044            <flowspec>
3045                <next-headers>
3046                    <op>equals end-of-list</op>
3047                    <value>17</value>
3048                </next-headers>
3049            </flowspec>
3050            <flowspec>
3051                <dscps>
3052                    <op>equals end-of-list</op>
3053                    <value>50</value>
3054                </dscps>
3055            </flowspec>
3056            <flowspec>
3057                <flow-label>
3058                    <op>equals end-of-list</op>
3059                    <value>2013</value>
3060                </flow-label>
3061            </flowspec>
3062        </flowspec-route>
3063    </flowspec-ipv6-routes>
3064
3065 IPv4 L3VPN Flows Specification
3066 ''''''''''''''''''''''''''''''
3067 The IPv4 L3VPN Flowspec table in an instance of the speaker's Loc-RIB can be verified via REST:
3068
3069 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-flowspec:flowspec-l3vpn-subsequent-address-family/bgp-flowspec:flowspec-l3vpn-ipv4-routes``
3070
3071 **Method:** ``GET``
3072
3073 **Response Body:**
3074
3075 .. code-block:: xml
3076
3077    <flowspec-l3vpn-ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3078        <flowspec-l3vpn-route>
3079            <path-id>0</path-id>
3080            <route-key>[l3vpn with route-distinguisher 172.16.0.44:101] all packets from 10.0.0.3/32</route-key>
3081            <attributes>
3082                <local-pref>
3083                    <pref>100</pref>
3084                </local-pref>
3085                <ipv4-next-hop>
3086                    <global>5.6.7.8</global>
3087                </ipv4-next-hop>
3088                <origin>
3089                    <value>igp</value>
3090                </origin>
3091                <as-path></as-path>
3092                <extended-communities>
3093                    <transitive>true</transitive>
3094                    <redirect-ip-nh-extended-community>
3095                        <copy>false</copy>
3096                        <next-hop-address>0.0.0.0</next-hop-address>
3097                    </redirect-ip-nh-extended-community>
3098                </extended-communities>
3099            </attributes>
3100            <route-distinguisher>172.16.0.44:101</route-distinguisher>
3101            <flowspec>
3102                <source-prefix>10.0.0.3/32</source-prefix>
3103            </flowspec>
3104        </flowspec-l3vpn-route>
3105    </flowspec-l3vpn-ipv4-routes>
3106
3107 Programming
3108 ^^^^^^^^^^^
3109 IPv4 Flow Specification
3110 '''''''''''''''''''''''
3111 This examples show how to originate and remove IPv4 fowspec route via programmable RIB.
3112 Make sure the *Application Peer* is configured first.
3113
3114 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-flowspec:flowspec-subsequent-address-family/bgp-flowspec:flowspec-routes``
3115
3116 **Method:** ``POST``
3117
3118 **Content-Type:** ``application/xml``
3119
3120 **Request Body:**
3121
3122 .. code-block:: xml
3123
3124    <flowspec-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3125        <route-key>flow1</route-key>
3126        <path-id>0</path-id>
3127        <flowspec>
3128            <destination-prefix>192.168.0.1/32</destination-prefix>
3129        </flowspec>
3130        <flowspec>
3131            <source-prefix>10.0.0.1/32</source-prefix>
3132        </flowspec>
3133        <flowspec>
3134            <protocol-ips>
3135                <op>equals end-of-list</op>
3136                <value>6</value>
3137            </protocol-ips>
3138        </flowspec>
3139        <flowspec>
3140            <ports>
3141                <op>equals end-of-list</op>
3142                <value>80</value>
3143            </ports>
3144        </flowspec>
3145        <flowspec>
3146            <destination-ports>
3147                <op>greater-than</op>
3148                <value>8080</value>
3149            </destination-ports>
3150            <destination-ports>
3151                <op>and-bit less-than end-of-list</op>
3152                <value>8088</value>
3153            </destination-ports>
3154        </flowspec>
3155        <flowspec>
3156            <source-ports>
3157                <op>greater-than end-of-list</op>
3158                <value>1024</value>
3159            </source-ports>
3160        </flowspec>
3161        <flowspec>
3162            <types>
3163                <op>equals end-of-list</op>
3164                <value>0</value>
3165            </types>
3166        </flowspec>
3167        <flowspec>
3168            <codes>
3169                <op>equals end-of-list</op>
3170                <value>0</value>
3171            </codes>
3172        </flowspec>
3173        <flowspec>
3174            <tcp-flags>
3175                <op>match end-of-list</op>
3176                <value>32</value>
3177            </tcp-flags>
3178        </flowspec>
3179        <flowspec>
3180            <packet-lengths>
3181                <op>greater-than</op>
3182                <value>400</value>
3183            </packet-lengths>
3184            <packet-lengths>
3185                <op>and-bit less-than end-of-list</op>
3186                <value>500</value>
3187            </packet-lengths>
3188        </flowspec>
3189        <flowspec>
3190            <dscps>
3191                <op>equals end-of-list</op>
3192                <value>20</value>
3193            </dscps>
3194        </flowspec>
3195        <flowspec>
3196            <fragments>
3197                <op>match end-of-list</op>
3198                <value>first</value>
3199            </fragments>
3200        </flowspec>
3201        <attributes>
3202            <origin>
3203                <value>igp</value>
3204            </origin>
3205            <as-path/>
3206            <local-pref>
3207                <pref>100</pref>
3208            </local-pref>
3209            <extended-communities>
3210                ....
3211            </extended-communities>
3212        </attributes>
3213    </flowspec-route>
3214
3215 -----
3216
3217 **Extended Communities**
3218
3219 * **Traffic Rate**
3220    .. code-block:: xml
3221       :linenos:
3222       :emphasize-lines: 5
3223
3224       <extended-communities>
3225           <transitive>true</transitive>
3226           <traffic-rate-extended-community>
3227               <informative-as>123</informative-as>
3228               <local-administrator>AAAAAA==</local-administrator>
3229           </traffic-rate-extended-community>
3230       </extended-communities>
3231
3232    @line 5: A rate in bytes per second, *AAAAAA==* (0) means traffic discard.
3233
3234 * **Traffic Action**
3235    .. code-block:: xml
3236
3237       <extended-communities>
3238           <transitive>true</transitive>
3239           <traffic-action-extended-community>
3240               <sample>true</sample>
3241               <terminal-action>false</terminal-action>
3242           </traffic-action-extended-community>
3243       </extended-communities>
3244
3245
3246 * **Redirect to VRF AS 2byte format**
3247    .. code-block:: xml
3248
3249       <extended-communities>
3250           <transitive>true</transitive>
3251           <redirect-extended-community>
3252               <global-administrator>123</global-administrator>
3253               <local-administrator>AAAAew==</local-administrator>
3254           </redirect-extended-community>
3255       </extended-communities>
3256
3257 * **Redirect to VRF IPv4 format**
3258    .. code-block:: xml
3259
3260       <extended-communities>
3261           <transitive>true</transitive>
3262           <redirect-ipv4>
3263               <global-administrator>192.168.0.1</global-administrator>
3264               <local-administrator>12345</local-administrator>
3265           </redirect-ipv4>
3266       </extended-communities>
3267
3268 * **Redirect to VRF AS 4byte format**
3269    .. code-block:: xml
3270
3271       <extended-communities>
3272           <transitive>true</transitive>
3273           <redirect-as4>
3274               <global-administrator>64495</global-administrator>
3275               <local-administrator>12345</local-administrator>
3276           </redirect-as4>
3277       </extended-communities>
3278
3279 * **Redirect to IP**
3280    .. code-block:: xml
3281
3282       <extended-communities>
3283           <transitive>true</transitive>
3284           <redirect-ip-nh-extended-community>
3285               <copy>false</false>
3286           </redirect-ip-nh-extended-community>
3287       </extended-communities>
3288
3289 * **Traffic Marking**
3290    .. code-block:: xml
3291
3292       <extended-communities>
3293           <transitive>true</transitive>
3294           <traffic-marking-extended-community>
3295               <global-administrator>20</global-administrator>
3296           </traffic-marking-extended-community>
3297       </extended-communities>
3298
3299 -----
3300
3301 To remove the route added above, following request can be used:
3302
3303 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-flowspec:flowspec-subsequent-address-family/bgp-flowspec:flowspec-routes/bgp-flowspec:flowspec-route/flow1/0``
3304
3305 **Method:** ``DELETE``
3306
3307 IPv4 L3VPN Flow Specification
3308 '''''''''''''''''''''''''''''
3309 This examples show how to originate and remove IPv4 L3VPN fowspec route via programmable RIB.
3310
3311 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-flowspec:flowspec-l3vpn-subsequent-address-family/bgp-flowspec:flowspec-l3vpn-ipv4-routes``
3312
3313 **Method:** ``POST``
3314
3315 **Content-Type:** ``application/xml``
3316
3317 **Request Body:**
3318
3319 .. code-block:: xml
3320
3321     <flowspec-l3vpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3322         <path-id>0</path-id>
3323         <route-key>flow-l3vpn</route-key>
3324         <route-distinguisher>172.16.0.44:101</route-distinguisher>
3325         <flowspec>
3326             <source-prefix>10.0.0.3/32</source-prefix>
3327         </flowspec>
3328         <attributes>
3329             <local-pref>
3330                 <pref>100</pref>
3331             </local-pref>
3332             <origin>
3333                 <value>igp</value>
3334             </origin>
3335             <as-path></as-path>
3336                <extended-communities>
3337                    <transitive>true</transitive>
3338                    <redirect-ipv4>
3339                        <global-administrator>172.16.0.44</global-administrator>
3340                        <local-administrator>102</local-administrator>
3341                    </redirect-ipv4>
3342                </extended-communities>
3343         </attributes>
3344     </flowspec-l3vpn-route>
3345
3346 -----
3347
3348 To remove the route added above, following request can be used:
3349
3350 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-flowspec:flowspec-l3vpn-subsequent-address-family/bgp-flowspec:flowspec-l3vpn-ipv4-routes/flowspec-l3vpn-route/flow-l3vpn/0``
3351
3352 **Method:** ``DELETE``
3353
3354 IPv6 Flow Specification
3355 '''''''''''''''''''''''
3356 This examples show how to originate and remove IPv6 fowspec route via programmable RIB.
3357
3358 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv6-address-family/bgp-flowspec:flowspec-subsequent-address-family/bgp-flowspec:flowspec-ipv6-routes``
3359
3360 **Method:** ``POST``
3361
3362 **Content-Type:** ``application/xml``
3363
3364 **Request Body:**
3365
3366 .. code-block:: xml
3367
3368    <flowspec-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3369        <route-key>flow-v6</route-key>
3370        <path-id>0</path-id>
3371        <flowspec>
3372            <destination-prefix>2001:db8:30::3/128</destination-prefix>
3373        </flowspec>
3374        <flowspec>
3375            <source-prefix>2001:db8:31::3/128</source-prefix>
3376         </flowspec>
3377        <flowspec>
3378            <flow-label>
3379                <op>equals end-of-list</op>
3380                <value>1</value>
3381            </flow-label>
3382        </flowspec>
3383        <attributes>
3384            <extended-communities>
3385                <transitive>true</transitive>
3386                <redirect-ipv6>
3387                    <global-administrator>2001:db8:1::6</global-administrator>
3388                    <local-administrator>12345</local-administrator>
3389                </redirect-ipv6>
3390            </extended-communities>
3391            <origin>
3392                <value>igp</value>
3393            </origin>
3394            <as-path/>
3395            <local-pref>
3396                <pref>100</pref>
3397            </local-pref>
3398        </attributes>
3399    </flowspec-route>
3400
3401 -----
3402
3403 To remove the route added above, following request can be used:
3404
3405 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv6-address-family/bgp-flowspec:flowspec-subsequent-address-family/bgp-flowspec:flowspec-ipv6-routes/bgp-flowspec:flowspec-route/flow-v6/0``
3406
3407 **Method:** ``DELETE``
3408
3409 References
3410 ^^^^^^^^^^
3411 * `Dissemination of Flow Specification Rules <https://tools.ietf.org/html/rfc5575>`_
3412 * `Dissemination of Flow Specification Rules for IPv6 <https://tools.ietf.org/html/draft-ietf-idr-flow-spec-v6-07>`_
3413 * `BGP Flow-Spec Extended Community for Traffic Redirect to IP Next Hop <https://tools.ietf.org/html/draft-ietf-idr-flowspec-redirect-ip-00>`_
3414 * `Clarification of the Flowspec Redirect Extended Community <https://tools.ietf.org/html/rfc7674>`_
3415 * `Revised Validation Procedure for BGP Flow Specifications <https://tools.ietf.org/html/draft-ietf-idr-bgp-flowspec-oid-03>`_
3416
3417 EVPN Family
3418 -----------
3419 The BGP MPLS-Based Ethernet VPN (BGP EVPN) Multiprotocol extension can be used to distribute Ethernet L2VPN service related routes in order to support a concept of MAC routing.
3420 A major use-case for BGP EVPN is data-center interconnection (DCI), where advantage of BGP EVPN are MAC/IP address advertising across MPLS network, Multihoming functionality including Fast Convergence, Split Horizon and Aliasing support, VM (MAC) Mobility, support Multicast and Broadcast traffic.
3421 In addition to MPLS, IP tunnelling encapsulation techniques like VXLAN, NVGRE, MPLSoGRE and others can be used for packet transportation.
3422 Also, Provider Backbone Bridging (PBB) can be combined with EVPN in order to reduce a number of MAC Advertisement routes.
3423
3424 .. contents:: Contents
3425    :depth: 2
3426    :local:
3427
3428 Configuration
3429 ^^^^^^^^^^^^^
3430 This section shows a way to enable EVPN family in BGP speaker and peer configuration.
3431
3432 BGP Speaker
3433 '''''''''''
3434 To enable EVPN support in BGP plugin, first configure BGP speaker instance:
3435
3436 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
3437
3438 **Method:** ``POST``
3439
3440 **Content-Type:** ``application/xml``
3441
3442 **Request Body:**
3443
3444 .. code-block:: xml
3445
3446    <protocol xmlns="http://openconfig.net/yang/network-instance">
3447        <name>bgp-example</name>
3448        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
3449        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
3450            <global>
3451                <config>
3452                    <router-id>192.0.2.2</router-id>
3453                    <as>65000</as>
3454                </config>
3455                <afi-safis>
3456                    <afi-safi>
3457                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
3458                    </afi-safi>
3459                </afi-safis>
3460            </global>
3461        </bgp>
3462    </protocol>
3463
3464 BGP Peer
3465 ''''''''
3466 Here is an example for BGP peer configuration with enabled EVPN family.
3467
3468 **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``
3469
3470 **Method:** ``POST``
3471
3472 **Content-Type:** ``application/xml``
3473
3474 **Request Body:**
3475
3476 .. code-block:: xml
3477
3478    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
3479        <neighbor-address>192.0.2.1</neighbor-address>
3480        <afi-safis>
3481            <afi-safi>
3482                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
3483            </afi-safi>
3484        </afi-safis>
3485    </neighbor>
3486
3487 EVPN Route API
3488 ^^^^^^^^^^^^^^
3489 Following tree illustrate the BGP EVPN route structure.
3490
3491 .. code-block:: console
3492
3493    :(evpn-routes-case)
3494       +--ro evpn-routes
3495          +--ro evpn-route* [route-key]
3496             +--ro route-key                     string
3497             +--ro (evpn-choice)
3498             |  +--:(ethernet-a-d-route-case)
3499             |  |  +--ro ethernet-a-d-route
3500             |  |     +--ro (esi)
3501             |  |     |  +--:(arbitrary-case)
3502             |  |     |  |  +--ro arbitrary
3503             |  |     |  |     +--ro arbitrary    binary
3504             |  |     |  +--:(lacp-auto-generated-case)
3505             |  |     |  |  +--ro lacp-auto-generated
3506             |  |     |  |     +--ro ce-lacp-mac-address    yang:mac-address
3507             |  |     |  |     +--ro ce-lacp-port-key       uint16
3508             |  |     |  +--:(lan-auto-generated-case)
3509             |  |     |  |  +--ro lan-auto-generated
3510             |  |     |  |     +--ro root-bridge-mac-address    yang:mac-address
3511             |  |     |  |     +--ro root-bridge-priority       uint16
3512             |  |     |  +--:(mac-auto-generated-case)
3513             |  |     |  |  +--ro mac-auto-generated
3514             |  |     |  |     +--ro system-mac-address     yang:mac-address
3515             |  |     |  |     +--ro local-discriminator    uint24
3516             |  |     |  +--:(router-id-generated-case)
3517             |  |     |  |  +--ro router-id-generated
3518             |  |     |  |     +--ro router-id              inet:ipv4-address
3519             |  |     |  |     +--ro local-discriminator    uint32
3520             |  |     |  +--:(as-generated-case)
3521             |  |     |     +--ro as-generated
3522             |  |     |        +--ro as                     inet:as-number
3523             |  |     |        +--ro local-discriminator    uint32
3524             |  |     +--ro ethernet-tag-id
3525             |  |     |  +--ro vlan-id    uint32
3526             |  |     +--ro mpls-label             netc:mpls-label
3527             |  +--:(mac-ip-adv-route-case)
3528             |  |  +--ro mac-ip-adv-route
3529             |  |     +--ro (esi)
3530             |  |     |  +--:(arbitrary-case)
3531             |  |     |  |  +--ro arbitrary
3532             |  |     |  |     +--ro arbitrary    binary
3533             |  |     |  +--:(lacp-auto-generated-case)
3534             |  |     |  |  +--ro lacp-auto-generated
3535             |  |     |  |     +--ro ce-lacp-mac-address    yang:mac-address
3536             |  |     |  |     +--ro ce-lacp-port-key       uint16
3537             |  |     |  +--:(lan-auto-generated-case)
3538             |  |     |  |  +--ro lan-auto-generated
3539             |  |     |  |     +--ro root-bridge-mac-address    yang:mac-address
3540             |  |     |  |     +--ro root-bridge-priority       uint16
3541             |  |     |  +--:(mac-auto-generated-case)
3542             |  |     |  |  +--ro mac-auto-generated
3543             |  |     |  |     +--ro system-mac-address     yang:mac-address
3544             |  |     |  |     +--ro local-discriminator    uint24
3545             |  |     |  +--:(router-id-generated-case)
3546             |  |     |  |  +--ro router-id-generated
3547             |  |     |  |     +--ro router-id              inet:ipv4-address
3548             |  |     |  |     +--ro local-discriminator    uint32
3549             |  |     |  +--:(as-generated-case)
3550             |  |     |     +--ro as-generated
3551             |  |     |        +--ro as                     inet:as-number
3552             |  |     |        +--ro local-discriminator    uint32
3553             |  |     +--ro ethernet-tag-id
3554             |  |     |  +--ro vlan-id    uint32
3555             |  |     +--ro mac-address            yang:mac-address
3556             |  |     +--ro ip-address?            inet:ip-address
3557             |  |     +--ro mpls-label1            netc:mpls-label
3558             |  |     +--ro mpls-label2?           netc:mpls-label
3559             |  +--:(inc-multi-ethernet-tag-res-case)
3560             |  |  +--ro inc-multi-ethernet-tag-res
3561             |  |     +--ro ethernet-tag-id
3562             |  |     |  +--ro vlan-id    uint32
3563             |  |     +--ro orig-route-ip?     inet:ip-address
3564             |  +--:(es-route-case)
3565             |     +--ro es-route
3566             |        +--ro (esi)
3567             |        |  +--:(arbitrary-case)
3568             |        |  |  +--ro arbitrary
3569             |        |  |     +--ro arbitrary    binary
3570             |        |  +--:(lacp-auto-generated-case)
3571             |        |  |  +--ro lacp-auto-generated
3572             |        |  |     +--ro ce-lacp-mac-address    yang:mac-address
3573             |        |  |     +--ro ce-lacp-port-key       uint16
3574             |        |  +--:(lan-auto-generated-case)
3575             |        |  |  +--ro lan-auto-generated
3576             |        |  |     +--ro root-bridge-mac-address    yang:mac-address
3577             |        |  |     +--ro root-bridge-priority       uint16
3578             |        |  +--:(mac-auto-generated-case)
3579             |        |  |  +--ro mac-auto-generated
3580             |        |  |     +--ro system-mac-address     yang:mac-address
3581             |        |  |     +--ro local-discriminator    uint24
3582             |        |  +--:(router-id-generated-case)
3583             |        |  |  +--ro router-id-generated
3584             |        |  |     +--ro router-id              inet:ipv4-address
3585             |        |  |     +--ro local-discriminator    uint32
3586             |        |  +--:(as-generated-case)
3587             |        |     +--ro as-generated
3588             |        |        +--ro as                     inet:as-number
3589             |        |        +--ro local-discriminator    uint32
3590             |        +--ro orig-route-ip          inet:ip-address
3591             +--ro route-distinguisher           bgp-t:route-distinguisher
3592             +--ro attributes
3593                +--ro extended-communities*
3594                |  +--ro transitive?                              boolean
3595                |  +--ro (extended-community)?
3596                |     +--:(encapsulation-case)
3597                |     |  +--ro encapsulation-extended-community
3598                |     |     +--ro tunnel-type    encapsulation-tunnel-type
3599                |     +--:(esi-label-extended-community-case)
3600                |     |  +--ro esi-label-extended-community
3601                |     |     +--ro single-active-mode?   boolean
3602                |     |     +--ro esi-label             netc:mpls-label
3603                |     +--:(es-import-route-extended-community-case)
3604                |     |  +--ro es-import-route-extended-community
3605                |     |     +--ro es-import    yang:mac-address
3606                |     +--:(mac-mobility-extended-community-case)
3607                |     |  +--ro mac-mobility-extended-community
3608                |     |     +--ro static?       boolean
3609                |     |     +--ro seq-number    uint32
3610                |     +--:(default-gateway-extended-community-case)
3611                |     |  +--ro default-gateway-extended-community!
3612                |     +--:(layer-2-attributes-extended-community-case)
3613                |        +--ro layer-2-attributes-extended-community
3614                |           +--ro primary-pe?     boolean
3615                |           +--ro backup-pe?      boolean
3616                |           +--ro control-word?   boolean
3617                |           +--ro l2-mtu          uint16
3618                +--ro pmsi-tunnel!
3619                   +--ro leaf-information-required    boolean
3620                   +--ro mpls-label?                  netc:mpls-label
3621                   +--ro (tunnel-identifier)?
3622                      +--:(rsvp-te-p2mp-lsp)
3623                      |  +--ro rsvp-te-p2mp-lps
3624                      |     +--ro p2mp-id               uint32
3625                      |     +--ro tunnel-id             uint16
3626                      |     +--ro extended-tunnel-id    inet:ip-address
3627                      +--:(mldp-p2mp-lsp)
3628                      |  +--ro mldp-p2mp-lsp
3629                      |     +--ro address-family       identityref
3630                      |     +--ro root-node-address    inet:ip-address
3631                      |     +--ro opaque-value*
3632                      |        +--ro opaque-type             uint8
3633                      |        +--ro opaque-extended-type?   uint16
3634                      |        +--ro opaque                  yang:hex-string
3635                      +--:(pim-ssm-tree)
3636                      |  +--ro pim-ssm-tree
3637                      |     +--ro p-address            inet:ip-address
3638                      |     +--ro p-multicast-group    inet:ip-address
3639                      +--:(pim-sm-tree)
3640                      |  +--ro pim-sm-tree
3641                      |     +--ro p-address            inet:ip-address
3642                      |     +--ro p-multicast-group    inet:ip-address
3643                      +--:(bidir-pim-tree)
3644                      |  +--ro bidir-pim-tree
3645                      |     +--ro p-address            inet:ip-address
3646                      |     +--ro p-multicast-group    inet:ip-address
3647                      +--:(ingress-replication)
3648                      |  +--ro ingress-replication
3649                      |     +--ro receiving-endpoint-address?   inet:ip-address
3650                      +--:(mldp-mp2mp-lsp)
3651                         +--ro mldp-mp2mp-lsp
3652                            +--ro opaque-type             uint8
3653                            +--ro opaque-extended-type?   uint16
3654                            +--ro opaque
3655                      ...
3656
3657 Usage
3658 ^^^^^
3659 The L2VPN EVPN table in an instance of the speaker's Loc-RIB can be verified via REST:
3660
3661 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/odl-bgp-evpn:l2vpn-address-family/odl-bgp-evpn:evpn-subsequent-address-family/evpn-routes``
3662
3663 **Method:** ``GET``
3664
3665 **Response Body:**
3666
3667 .. code-block:: xml
3668
3669    <evpn-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-evpn">
3670       <evpn-route>
3671          <route-key>AxEAAcCoZAED6AAAAQAgwKhkAQ==</route-key>
3672          <route-distinguisher>192.168.100.1:1000</route-distinguisher>
3673          <inc-multi-ethernet-tag-res>
3674             <ethernet-tag-id>
3675                <vlan-id>256</vlan-id>
3676             </ethernet-tag-id>
3677             <orig-route-ip>192.168.100.1</orig-route-ip>
3678          </inc-multi-ethernet-tag-res>
3679          <attributes>
3680             <ipv4-next-hop>
3681                <global>172.23.29.104</global>
3682             </ipv4-next-hop>
3683             <as-path/>
3684             <origin>
3685                <value>igp</value>
3686             </origin>
3687             <extended-communities>
3688                <extended-communities>
3689                    <transitive>true</transitive>
3690                    <route-target-extended-community>
3691                        <global-administrator>65504</global-administrator>
3692                        <local-administrator>AAAD6A==</local-administrator>
3693                    </route-target-extended-community>
3694                </extended-communities>
3695             </extended-communities>
3696             <pmsi-tunnel>
3697                 <leaf-information-required>true</leaf-information-required>
3698                 <mpls-label>20024</mpls-label>
3699                 <ingress-replication>
3700                     <receiving-endpoint-address>192.168.100.1</receiving-endpoint-address>
3701                 </ingress-replication>
3702             </pmsi-tunnel>
3703          </attributes>
3704       </evpn-route>
3705    </evpn-routes>
3706
3707 Programming
3708 ^^^^^^^^^^^
3709 This examples show how to originate and remove EVPN routes via programmable RIB.
3710 There are four different types of EVPN routes, and several extended communities.
3711 Routes can be used for variety of use-cases supported by BGP/MPLS EVPN, PBB EVPN and NVO EVPN.
3712 Make sure the *Application Peer* is configured first.
3713
3714 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/odl-bgp-evpn:l2vpn-address-family/odl-bgp-evpn:evpn-subsequent-address-family/odl-bgp-evpn:evpn-routes``
3715
3716 **Method:** ``POST``
3717
3718 **Content-Type:** ``application/xml``
3719
3720 **Request Body:**
3721
3722 .. code-block:: xml
3723    :linenos:
3724    :emphasize-lines: 3,4,14
3725
3726    <evpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-evpn">
3727        <route-key>evpn</route-key>
3728        <route-distinguisher>172.12.123.3:200</route-distinguisher>
3729        ....
3730        <attributes>
3731            <ipv4-next-hop>
3732                <global>199.20.166.41</global>
3733            </ipv4-next-hop>
3734            <as-path/>
3735            <origin>
3736                <value>igp</value>
3737            </origin>
3738            <extended-communities>
3739            ....
3740            </extended-communities>
3741        </attributes>
3742    </evpn-route>
3743
3744 @line 3: Route Distinguisher (RD) - set to RD of the MAC-VRF advertising the NLRI, recommended format *<IP>:<VLAN_ID>*
3745
3746 @line 4: One of the EVPN route must be set here.
3747
3748 @line 14: In some cases, specific extended community presence is required. The route may carry one or more Route Target attributes.
3749
3750 -----
3751
3752 **EVPN Routes:**
3753
3754 * **Ethernet AD per ESI**
3755    .. code-block:: xml
3756
3757       <ethernet-a-d-route>
3758           <mpls-label>0</mpls-label>
3759           <ethernet-tag-id>
3760               <vlan-id>4294967295</vlan-id>
3761           </ethernet-tag-id>
3762           <arbitrary>
3763               <arbitrary>AAAAAAAAAAAA</arbitrary>
3764           </arbitrary>
3765       </ethernet-a-d-route>
3766
3767 * **Ethernet AD per EVI**
3768    .. code-block:: xml
3769
3770       <ethernet-a-d-route>
3771           <mpls-label>24001</mpls-label>
3772           <ethernet-tag-id>
3773               <vlan-id>2200</vlan-id>
3774           </ethernet-tag-id>
3775           <arbitrary>
3776               <arbitrary>AAAAAAAAAAAA</arbitrary>
3777           </arbitrary>
3778       </ethernet-a-d-route>
3779
3780 * **MAC/IP Advertisement**
3781    .. code-block:: xml
3782
3783       <mac-ip-adv-route>
3784           <arbitrary>
3785               <arbitrary>AAAAAAAAAAAA</arbitrary>
3786           </arbitrary>
3787           <ethernet-tag-id>
3788               <vlan-id>2100</vlan-id>
3789           </ethernet-tag-id>
3790           <mac-address>f2:0c:dd:80:9f:f7</mac-address>
3791           <ip-address>10.0.1.12</ip-address>
3792           <mpls-label1>299776</mpls-label1>
3793       </mac-ip-adv-route>
3794
3795
3796 * **Inclusive Multicast Ethernet Tag**
3797    .. code-block:: xml
3798
3799       <inc-multi-ethernet-tag-res>
3800           <ethernet-tag-id>
3801               <vlan-id>2100</vlan-id>
3802           </ethernet-tag-id>
3803           <orig-route-ip>43.43.43.43</orig-route-ip>
3804       </inc-multi-ethernet-tag-res>
3805
3806 * **Ethernet Segment**
3807    .. code-block:: xml
3808
3809       <es-route>
3810           <orig-route-ip>43.43.43.43</orig-route-ip>
3811           <arbitrary>
3812               <arbitrary>AAAAAAAAAAAA</arbitrary>
3813           </arbitrary>
3814       </es-route>
3815
3816 **EVPN Ethernet Segment Identifier (ESI):**
3817
3818 * **Type 0**
3819    Indicates an arbitrary 9-octet ESI.
3820
3821    .. code-block:: xml
3822
3823       <arbitrary>
3824           <arbitrary>AAAAAAAAAAAA</arbitrary>
3825       </arbitrary>
3826
3827 * **Type 1**
3828    IEEE 802.1AX LACP is used.
3829
3830    .. code-block:: xml
3831
3832       <lacp-auto-generated>
3833           <ce-lacp-mac-address>f2:0c:dd:80:9f:f7</ce-lacp-mac-address>
3834           <ce-lacp-port-key>22</ce-lacp-port-key>
3835       </lacp-auto-generated>
3836
3837 * **Type 2**
3838    Indirectly connected hosts via a bridged LAN.
3839
3840    .. code-block:: xml
3841
3842       <lan-auto-generated>
3843           <root-bridge-mac-address>f2:0c:dd:80:9f:f7</root-bridge-mac-address>
3844           <root-bridge-priority>20</root-bridge-priority>
3845       </lan-auto-generated>
3846
3847 * **Type 3**
3848    MAC-based ESI.
3849
3850    .. code-block:: xml
3851
3852       <mac-auto-generated>
3853           <system-mac-address>f2:0c:dd:80:9f:f7</system-mac-address>
3854           <local-discriminator>2000</local-discriminator>
3855       </mac-auto-generated>
3856
3857 * **Type 4**
3858    Router-ID ESI
3859
3860    .. code-block:: xml
3861
3862       <router-id-generated>
3863           <router-id>43.43.43.43</router-id>
3864           <local-discriminator>2000</local-discriminator>
3865       </router-id-generated>
3866
3867 * **Type 5**
3868    AS-based ESI
3869
3870    .. code-block:: xml
3871
3872       <as-generated>
3873           <as>16843009</as>
3874           <local-discriminator>2000</local-discriminator>
3875       </as-generated>
3876
3877 **Extended Communities:**
3878
3879 * **ESI Label Extended Community**
3880    .. code-block:: xml
3881
3882       <extended-communities>
3883           <transitive>true</transitive>
3884           <esi-label-extended-community>
3885               <single-active-mode>false</single-active-mode>
3886               <esi-label>24001</esi-label>
3887           </esi-label-extended-community >
3888       </extended-communities>
3889
3890 * **ES-Import Route Target**
3891    .. code-block:: xml
3892
3893       <extended-communities>
3894           <transitive>true</transitive>
3895           <es-import-route-extended-community>
3896               <es-import>f2:0c:dd:80:9f:f7</es-import>
3897           </es-import-route-extended-community>
3898       </extended-communities>
3899
3900 * **MAC Mobility Extended Community**
3901    .. code-block:: xml
3902
3903       <extended-communities>
3904           <transitive>true</transitive>
3905           <mac-mobility-extended-community>
3906               <static>true</static>
3907               <seq-number>200</seq-number>
3908           </mac-mobility-extended-community>
3909       </extended-communities>
3910
3911 * **Default Gateway Extended Community**
3912    .. code-block:: xml
3913
3914       <extended-communities>
3915           <transitive>true</transitive>
3916           <default-gateway-extended-community>
3917           </default-gateway-extended-community>
3918       </extended-communities>
3919
3920 * **EVPN Layer 2 attributes extended community**
3921    .. code-block:: xml
3922
3923       <extended-communities>
3924           <transitive>false</transitive>
3925           <layer-2-attributes-extended-community>
3926               <primary-pe>true</primary-pe>
3927               <backup-pe>true</backup-pe>
3928               <control-word >true</control-word>
3929               <l2-mtu>200</l2-mtu>
3930           </layer-2-attributes-extended-community>
3931       </extended-communities>
3932
3933 * **BGP Encapsulation extended community**
3934    .. code-block:: xml
3935       :linenos:
3936       :emphasize-lines: 4
3937
3938       <extended-communities>
3939           <transitive>false</transitive>
3940           <encapsulation-extended-community>
3941               <tunnel-type>vxlan</tunnel-type>
3942           </encapsulation-extended-community>
3943       </extended-communities>
3944
3945    @line 4: `full list of tunnel types <http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#tunnel-types>`_
3946
3947 * **P-Multicast Service Interface Tunnel (PMSI) attribute**
3948    .. code-block:: xml
3949
3950       <pmsi-tunnel>
3951           <leaf-information-required>true</leaf-information-required>
3952           <mpls-label>20024</mpls-label>
3953           <ingress-replication>
3954               <receiving-endpoint-address>172.12.123.3</receiving-endpoint-address>
3955           </ingress-replication>
3956       </pmsi-tunnel>
3957
3958 -----
3959
3960 To remove the route added above, following request can be used:
3961
3962 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/odl-bgp-evpn:l2vpn-address-family/odl-bgp-evpn:evpn-subsequent-address-family/odl-bgp-evpn:evpn-routes/evpn-route/evpn``
3963
3964 **Method:** ``DELETE``
3965
3966 -----
3967
3968 .. table:: EVPN Routes Usage.
3969
3970    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3971    | EVN Route Type                       | Extended Communities                                | Usage                                     |
3972    +======================================+=====================================================+===========================================+
3973    | **Ethernet Auto-discovery**          | ESI Label, BGP EncapsulationEVPN Layer 2 attributes | Fast Convergence, Split Horizon, Aliasing |
3974    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3975    | **MAC/IP Advertisement**             | BGP Encapsulation, MAC Mobility, Default Gateway    | MAC address reachability                  |
3976    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3977    | **Inclusive Multicast Ethernet Tag** | PMSI Tunnel, BGP Encapsulation                      | Handling of Multi-destination traffic     |
3978    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3979    | **Ethernet Segment**                 | BGP Encapsulation, ES-Import Route Target           | Designated Forwarder Election             |
3980    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3981
3982 References
3983 ^^^^^^^^^^
3984 * `BGP MPLS-Based Ethernet VPN <https://tools.ietf.org/html/rfc7432>`_
3985 * `Provider Backbone Bridging Combined with Ethernet VPN <https://tools.ietf.org/html/rfc7623>`_
3986 * `VPWS support in EVPN <https://tools.ietf.org/html/draft-ietf-bess-evpn-vpws-07>`_
3987 * `A Network Virtualization Overlay Solution using EVPN <https://tools.ietf.org/html/draft-ietf-bess-evpn-overlay-04>`_
3988 * `Interconnect Solution for EVPN Overlay networks <https://tools.ietf.org/html/draft-ietf-bess-dci-evpn-overlay-04>`_
3989 * `Usage and applicability of BGP MPLS based Ethernet VPN <https://tools.ietf.org/html/draft-ietf-bess-evpn-usage-03>`_
3990
3991 Additional Path
3992 ---------------
3993 The ADD-PATH capability allows to advertise multiple paths for the same address prefix.
3994 It can help with optimal routing and routing convergence in a network by providing potential alternate or backup paths.
3995
3996 .. contents:: Contents
3997    :depth: 2
3998    :local:
3999
4000 Configuration
4001 ^^^^^^^^^^^^^
4002 This section shows a way to enable ADD-PATH capability in BGP speaker and peer configuration.
4003
4004 .. note:: The capability is applicable for IP Unicast, IP Labeled Unicast and Flow Specification address families.
4005
4006 BGP Speaker
4007 '''''''''''
4008 To enable ADD-PATH capability in BGP plugin, first configure BGP speaker instance:
4009
4010 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
4011
4012 **Method:** ``POST``
4013
4014 **Content-Type:** ``application/xml``
4015
4016 **Request Body:**
4017
4018 .. code-block:: xml
4019    :linenos:
4020    :emphasize-lines: 14
4021
4022    <protocol xmlns="http://openconfig.net/yang/network-instance">
4023        <name>bgp-example</name>
4024        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
4025        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4026            <global>
4027                <config>
4028                    <router-id>192.0.2.2</router-id>
4029                    <as>65000</as>
4030                </config>
4031                <afi-safis>
4032                    <afi-safi>
4033                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4034                        <receive>true</receive>
4035                        <send-max>2</send-max>
4036                    </afi-safi>
4037                </afi-safis>
4038            </global>
4039        </bgp>
4040    </protocol>
4041
4042 @line 14: Defines path selection strategy: *send-max* > 1 -> Advertise N Paths or *send-max* = 0 -> Advertise All Paths
4043
4044 Here is an example for update a specific family with enable ADD-PATH capability
4045
4046 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/global/afi-safis/afi-safi/openconfig-bgp-types:IPV4%2DUNICAST``
4047
4048 **Method:** ``PUT``
4049
4050 **Content-Type:** ``application/xml``
4051
4052 **Request Body:**
4053
4054 .. code-block:: xml
4055
4056    <afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4057       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4058       <receive>true</receive>
4059       <send-max>0</send-max>
4060    </afi-safi>
4061
4062 BGP Peer
4063 ''''''''
4064 Here is an example for BGP peer configuration with enabled ADD-PATH capability.
4065
4066 **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``
4067
4068 **Method:** ``POST``
4069
4070 **Content-Type:** ``application/xml``
4071
4072 **Request Body:**
4073
4074 .. code-block:: xml
4075
4076    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4077        <neighbor-address>192.0.2.1</neighbor-address>
4078        <afi-safis>
4079            <afi-safi>
4080                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
4081            </afi-safi>
4082            <afi-safi>
4083                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4084                <receive>true</receive>
4085                <send-max>0</send-max>
4086            </afi-safi>
4087        </afi-safis>
4088    </neighbor>
4089
4090 .. note:: The path selection strategy is not configurable on per peer basis. The send-max presence indicates a willingness to send ADD-PATH NLRIs to the neighbor.
4091
4092 Here is an example for update specific family BGP peer configuration with enabled ADD-PATH capability.
4093
4094 **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/neighbor/192.0.2.1/afi-safis/afi-safi/openconfig-bgp-types:IPV4%2DUNICAST``
4095
4096 **Method:** ``PUT``
4097
4098 **Content-Type:** ``application/xml``
4099
4100 **Request Body:**
4101
4102 .. code-block:: xml
4103
4104    <afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4105       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4106       <receive>true</receive>
4107       <send-max>0</send-max>
4108    </afi-safi>
4109
4110 Usage
4111 ^^^^^
4112 The IPv4 Unicast table with enabled ADD-PATH capability in an instance of the speaker's Loc-RIB can be verified via REST:
4113
4114 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/ipv4-routes``
4115
4116 **Method:** ``GET``
4117
4118 **Response Body:**
4119
4120 .. code-block:: xml
4121    :linenos:
4122    :emphasize-lines: 3
4123
4124    <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
4125        <ipv4-route>
4126            <path-id>1</path-id>
4127            <prefix>193.0.2.1/32</prefix>
4128            <attributes>
4129                <as-path></as-path>
4130                <origin>
4131                    <value>igp</value>
4132                </origin>
4133                <local-pref>
4134                    <pref>100</pref>
4135                </local-pref>
4136                <ipv4-next-hop>
4137                    <global>10.0.0.1</global>
4138                </ipv4-next-hop>
4139            </attributes>
4140        </ipv4-route>
4141        <ipv4-route>
4142            <path-id>2</path-id>
4143            <prefix>193.0.2.1/32</prefix>
4144            <attributes>
4145                <as-path></as-path>
4146                <origin>
4147                    <value>igp</value>
4148                </origin>
4149                <local-pref>
4150                    <pref>100</pref>
4151                </local-pref>
4152                <ipv4-next-hop>
4153                    <global>10.0.0.2</global>
4154                </ipv4-next-hop>
4155            </attributes>
4156        </ipv4-route>
4157    </ipv4-routes>
4158
4159 @line 3: The routes with the same destination are distinguished by *path-id* attribute.
4160
4161 References
4162 ^^^^^^^^^^
4163 * `Advertisement of Multiple Paths in BGP <https://tools.ietf.org/html/rfc7911>`_
4164 * `Best Practices for Advertisement of Multiple Paths in IBGP <https://tools.ietf.org/html/draft-ietf-idr-add-paths-guidelines-08>`_
4165
4166 Route Refresh
4167 -------------
4168 The Route Refresh Capability allows to dynamically request a re-advertisement of the Adj-RIB-Out from a BGP peer.
4169 This is useful when the inbound routing policy for a peer changes and all prefixes from a peer must be reexamined against a new policy.
4170
4171 .. contents:: Contents
4172    :depth: 2
4173    :local:
4174
4175 Configuration
4176 ^^^^^^^^^^^^^
4177 The capability is enabled by default, no additional configuration is required.
4178
4179 Usage
4180 ^^^^^
4181 To send a Route Refresh request from OpenDaylight BGP speaker instance to its neighbor, invoke RPC:
4182
4183 **URL:** ``/restconf/operations/bgp-peer-rpc:route-refresh-request``
4184
4185 **Method:** ``POST``
4186
4187 **Content-Type:** ``application/xml``
4188
4189 **Request Body:**
4190
4191 .. code-block:: xml
4192
4193    <input xmlns="urn:opendaylight:params:xml:ns:yang:bgp-peer-rpc">
4194        <afi xmlns:types="urn:opendaylight:params:xml:ns:yang:bgp-types">types:ipv4-address-family</afi>
4195        <safi xmlns:types="urn:opendaylight:params:xml:ns:yang:bgp-types">types:unicast-subsequent-address-family</safi>
4196        <peer-ref xmlns:rib="urn:opendaylight:params:xml:ns:yang:bgp-rib">/rib:bgp-rib/rib:rib[rib:id="bgp-example"]/rib:peer[rib:peer-id="bgp://10.25.1.9"]</peer-ref>
4197    </input>
4198
4199 References
4200 ^^^^^^^^^^
4201 * `Route Refresh Capability for BGP-4 <https://tools.ietf.org/html/rfc2918>`_
4202
4203 Peer Session Release
4204 -------------
4205
4206 BGP provides a RPC feature to release a Neighbor session.
4207
4208 .. contents:: Contents
4209    :depth: 2
4210    :local:
4211
4212 Configuration
4213 ^^^^^^^^^^^^^
4214 The capability is enabled by default, no additional configuration is required.
4215
4216 Usage
4217 ^^^^^
4218 To release neighbor session, invoke RPC:
4219
4220 **URL:** ``/restconf/operations/bgp-peer-rpc:release-session``
4221
4222 **Method:** ``POST``
4223
4224 **Content-Type:** ``application/xml``
4225
4226 **Request Body:**
4227
4228 .. code-block:: xml
4229
4230    <input xmlns="urn:opendaylight:params:xml:ns:yang:bgp-peer-rpc">
4231        <peer-ref xmlns:rib="urn:opendaylight:params:xml:ns:yang:bgp-rib">/rib:bgp-rib/rib:rib[rib:id="bgp-example"]/rib:peer[rib:peer-id="bgp://10.25.1.9"]</peer-ref>
4232    </input>
4233
4234 Operational State
4235 -----------------
4236
4237 The OpenDaylight BGP implementation provides a set of APIs (described below), that give its operational state refreshed periodically, by default every 5 seconds.
4238 The following APIs describe what is available starting with how to change the default refresh rate.
4239
4240 .. contents:: Contents
4241    :depth: 2
4242    :local:
4243
4244 Operational State Configuration
4245 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4246
4247 **URL:** ``/restconf/config/bgp-state-config:bgp-state-config``
4248
4249 **Method:** ``PUT``
4250
4251 **Content-Type:** ``application/xml``
4252
4253 **Request Body:**
4254
4255 .. code-block:: xml
4256    :linenos:
4257    :emphasize-lines: 3
4258
4259    <bgp-state-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
4260        <config-name xmlns="urn:opendaylight:params:xml:ns:yang:bgp-state-config">operationalState</config-name>
4261        <timer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-state-config">1</timer>
4262    </bgp-state-config>
4263
4264 @line 3: Time in seconds between operational state update.
4265
4266 BGP RIB Operational State
4267 ^^^^^^^^^^^^^^^^^^^^^^^^^
4268
4269 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/global/state``
4270
4271 **Method:** ``GET``
4272
4273 **Content-Type:** ``application/xml``
4274
4275 **Response Body:**
4276
4277 .. code-block:: xml
4278    :linenos:
4279
4280    <state xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4281        <as>65000</as>
4282        <router-id>192.0.2.2</router-id>
4283        <total-paths>0</total-paths>
4284        <total-prefixes>0</total-prefixes>
4285    </state>
4286
4287 @line 2: AS number of the remote peer.
4288
4289 @line 3: The unique protocol instance identifier.
4290
4291 @line 4: Total number of Paths installed on RIB (Loc-RIB)
4292
4293 @line 5: Total number of Prefixes installed on RIB (Loc-RIB)
4294
4295 BGP RIB Families Operational State
4296 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4297
4298 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/global/afi-safis``
4299
4300 **Method:** ``GET``
4301
4302 **Content-Type:** ``application/xml``
4303
4304 **Response Body:**
4305
4306 .. code-block:: xml
4307    :linenos:
4308    :emphasize-lines: 3,5,6
4309
4310    <afi-safis xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4311        <afi-safi>
4312            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4313            <state>
4314                <total-paths>0</total-paths>
4315                <total-prefixes>0</total-prefixes>
4316            </state>
4317        </afi-safi>
4318        <afi-safi>
4319            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
4320            <state>
4321                <total-paths>0</total-paths>
4322                <total-prefixes>0</total-prefixes>
4323            </state>
4324        </afi-safi>
4325        ....
4326    </afi-safis>
4327
4328 @line 3: Family Identifier.
4329
4330 @line 5: Total number of Paths installed on RIB (Loc-RIB) per specific family.
4331
4332 @line 6: Total number of Prefixes installed on RIB (Loc-RIB) per specific family.
4333
4334 BGP Neighbors Operational State
4335 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4336
4337 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors``
4338
4339 **Method:** ``GET``
4340
4341 **Content-Type:** ``application/xml``
4342
4343 **Response Body:**
4344
4345 .. code-block:: xml
4346    :linenos:
4347    :emphasize-lines: 3
4348
4349    <neighbors xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4350        <neighbor>
4351            <neighbor-address>192.0.2.1</neighbor-address>
4352            .....
4353        </neighbor>
4354        <neighbor>
4355            <neighbor-address>192.0.2.2</neighbor-address>
4356            .....
4357        </neighbor>
4358    </neighbors>
4359
4360 @line 3: IP address of the remote BGP peer. Also serves as an unique identifier of a neighbor in a list of neighbors.
4361
4362 BGP Neighbor Operational State
4363 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4364
4365 .. note:: Supported Capabilities only provided when session has been established.
4366
4367 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors/neighbor/127.0.0.2/state``
4368
4369 **Method:** ``GET``
4370
4371 **Content-Type:** ``application/xml``
4372
4373 **Response Body:**
4374
4375 .. code-block:: xml
4376    :linenos:
4377    :emphasize-lines: 2,3,4,7,8,11,12
4378
4379    <state xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4380        <session-state>ESTABLISHED</session-state>
4381        <supported-capabilities xmlns:x="http://openconfig.net/yang/bgp-types">x:ASN32</supported-capabilities>
4382        <supported-capabilities xmlns:x="http://openconfig.net/yang/bgp-types">x:MPBGP</supported-capabilities>
4383        <messages>
4384            <sent>
4385                <UPDATE>0</UPDATE>
4386                <NOTIFICATION>0</NOTIFICATION>
4387            </sent>
4388            <received>
4389                <UPDATE>4</UPDATE>
4390                <NOTIFICATION>0</NOTIFICATION>
4391            </received>
4392        </messages>
4393    </state>
4394
4395 @line 2: Session status
4396
4397 @line 3-4: BGP capabilities supported ( ASN32 / MPBGP / ROUTE_REFRESH / GRACEFUL_RESTART / ADD_PATHS)
4398
4399 @line 7: Total count of Update Messages sent
4400
4401 @line 8: Total count of Notification Messages sent
4402
4403 @line 11: Total count of Update Messages received
4404
4405 @line 12: Total count of Notification Messages received
4406
4407 BGP Neighbor Families Operational State
4408 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4409
4410 .. note:: Graceful Restart not supported yet. Planned for Carbon.
4411
4412
4413 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors/neighbor/192.0.2.1/afi-safis``
4414
4415 **Method:** ``GET``
4416
4417 **Content-Type:** ``application/xml``
4418
4419 **Response Body:**
4420
4421 .. code-block:: xml
4422    :linenos:
4423    :emphasize-lines: 3,5,7,9,10
4424
4425    <afi-safis xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4426         <afi-safi>
4427             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4428             <state>
4429                 <active>false</active>
4430             </state>
4431             <graceful-restart>
4432                 <state>
4433                     <received>false</received>
4434                     <advertised>false</advertised>
4435                 </state>
4436             </graceful-restart>
4437         </afi-safi>
4438         <afi-safi>
4439             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
4440             <state>
4441                 <active>false</active>
4442             </state>
4443             <graceful-restart>
4444                 <state>
4445                     <received>false</received>
4446                     <advertised>false</advertised>
4447                 </state>
4448             </graceful-restart>
4449         </afi-safi>
4450    </afi-safis>
4451
4452 @line 3: Family Identifier.
4453
4454 @line 5: True if family is advertized by peer.
4455
4456 @line 7: Graceful Restart Operational State per specific family.
4457
4458 @line 9: True if the peer supports graceful restart.
4459
4460 @line 10: True if we support graceful restart.
4461
4462 BGP Neighbor Family Operational State
4463 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4464
4465 .. note:: Prefixes state is only provided once session is established.
4466 .. note:: Graceful Restart not supported yet. Planned to be implemented in Carbon.
4467
4468 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors/neighbor/192.0.2.1/afi-safis/afi-safi/openconfig-bgp-types:IPV4%2DUNICAST``
4469
4470 **Method:** ``GET``
4471
4472 **Content-Type:** ``application/xml``
4473
4474 **Response Body:**
4475
4476 .. code-block:: xml
4477    :linenos:
4478    :emphasize-lines: 2,4,6,7,8
4479
4480    <afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4481        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4482        <state>
4483            <active>true</active>
4484            <prefixes>
4485                <installed>3</installed>
4486                <sent>0</sent>
4487                <received>3</received>
4488            </prefixes>
4489        </state>
4490        <graceful-restart>
4491            <state>
4492                <received>false</received>
4493                <advertised>false</advertised>
4494            </state>
4495        </graceful-restart>
4496    </afi-safi>
4497
4498 @line 2: Family Identifier.
4499
4500 @line 4: True if family is advertized to and by peer.
4501
4502 @line 6: Total count of prefixes advertized by peer and installed (effective-rib-in).
4503
4504 @line 7: Total count of prefixes advertized to peer (adj-rib-out).
4505
4506 @line 8: Total count of prefixes advertized by peer (adj-rib-in).
4507
4508 BGP Neighbor Timers Operational State
4509 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4510
4511 .. note:: State is only provided once session is established.
4512
4513 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors/neighbor/192.0.2.1/timers``
4514
4515 **Method:** ``GET``
4516
4517 **Content-Type:** ``application/xml``
4518
4519 **Response Body:**
4520
4521 .. code-block:: xml
4522    :linenos:
4523    :emphasize-lines: 3,4
4524
4525    <timers xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4526        <state>
4527            <negotiated-hold-time>180</negotiated-hold-time>
4528            <uptime>1580676</uptime>
4529        </state>
4530    </timers>
4531
4532 @line 3: The negotiated hold-time for the BGP session in seconds.
4533
4534 @line 4: Session duration since establishment in milliseconds.
4535
4536 BGP Neighbor Transport Operational State
4537 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4538
4539 .. note:: State is only provided once session is established.
4540
4541 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors/neighbor/192.0.2.1/transport``
4542
4543 **Method:** ``GET``
4544
4545 **Content-Type:** ``application/xml``
4546
4547 **Response Body:**
4548
4549 .. code-block:: xml
4550    :linenos:
4551    :emphasize-lines: 3,4,5
4552
4553    <transport xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4554        <state>
4555            <remote-address>127.0.0.2</remote-address>
4556            <remote-port>44718</remote-port>
4557            <local-port>1790</local-port>
4558        </state>
4559    </transport>
4560
4561 @line 3: IP address of the remote BGP peer.
4562
4563 @line 4: Port of the remote BGP peer.
4564
4565 @line 5: Local port.
4566
4567 BGP Neighbor Error Handling Operational State
4568 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4569
4570 .. note:: State is only provided once session is established.
4571 .. note:: Error handling not supported yet. Planned for Carbon.
4572
4573 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors/neighbor/192.0.2.1/error-handling``
4574
4575 **Method:** ``GET``
4576
4577 **Content-Type:** ``application/xml``
4578
4579 **Response Body:**
4580
4581 .. code-block:: xml
4582    :linenos:
4583    :emphasize-lines: 3
4584
4585    <error-handling xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4586        <state>
4587            <erroneous-update-messages>0</erroneous-update-messages>
4588        </state>
4589    </error-handling>
4590
4591 @line 3: The number of BGP UPDATE messages for which the treat-as-withdraw mechanism has been applied based on
4592 erroneous message contents
4593
4594 BGP Neighbor Graceful Restart Operational State
4595 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4596
4597 .. note:: Graceful Restart not supported yet. Planned for Carbon.
4598
4599 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors/neighbor/192.0.2.1/graceful-restart``
4600
4601 **Method:** ``GET``
4602
4603 **Content-Type:** ``application/xml``
4604
4605 **Response Body:**
4606
4607 .. code-block:: xml
4608    :linenos:
4609    :emphasize-lines: 3,4,5
4610
4611    <graceful-restart xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4612        <state>
4613            <peer-restart-time>0</peer-restart-time>
4614            <peer-restarting>false</peer-restarting>
4615            <local-restarting>false</local-restarting>
4616        </state>
4617    </graceful-restart>
4618
4619 @line 3: The period of time (advertised by the peer) that the peer expects a restart of a BGP session to take.
4620
4621 @line 4: This flag indicates whether the remote neighbor is currently in the process of restarting, and hence
4622 received routes are currently stale.
4623
4624 @line 5: This flag indicates whether the local neighbor is currently restarting. The flag is unset after all NLRI
4625 have been advertised to the peer, and the End-of-RIB (EOR) marker has been unset.
4626
4627 BGP Peer Groups Operational State
4628 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4629
4630 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/peer-groups``
4631
4632 **Method:** ``GET``
4633
4634 **Content-Type:** ``application/xml``
4635
4636 **Response Body:**
4637
4638 .. code-block:: xml
4639    :linenos:
4640    :emphasize-lines: 3,5,6
4641
4642    <peer-groups>
4643        <peer-group>
4644            <peer-group-name>application-peers</peer-group-name>
4645            <state>
4646                <total-paths>0</total-paths>
4647                <total-prefixes>0</total-prefixes>
4648            </state>
4649    </peer-group>
4650
4651 @line 3: Peer Group Identifier.
4652
4653 @line 5: At this moment the cost for count path under effect-rib-in is to high. Therefore the value is the same as total prefixes.
4654
4655 @line 6: Total Prefixes installed under by peers pertaining to this peer group (effective-rib-in).
4656 This count doesn't differentiate repeated prefixes.
4657
4658 CLI
4659 ---
4660
4661 BGP Karaf Console (odl-bgpcep-bgp-cli) provides a CLI feature to read operational state per RIB, Neighbor and Peer Group.
4662
4663 .. code-block:: bash
4664    :linenos:
4665
4666    opendaylight-user@root> bgp:operational-state -rib example-bgp-rib
4667
4668 .. code-block:: bash
4669    :linenos:
4670
4671    opendaylight-user@root> bgp:operational-state -rib example-bgp-rib -neighbor 192.0.2.1
4672
4673 .. code-block:: bash
4674    :linenos:
4675
4676    opendaylight-user@root> bgp:operational-state -rib -peer-group application-peers
4677
4678 High Availability
4679 -----------------
4680 Running OpenDaylight BGP in clustered environment brings an advantage of the plugin's high availability (HA).
4681 This section illustrates a basic scenario for HA, also presents a configuration for clustered OpenDaylight BGP.
4682
4683 .. contents:: Contents
4684    :depth: 2
4685    :local:
4686
4687 Configuration
4688 ^^^^^^^^^^^^^
4689 Following example shows a configuration for running BGP in clustered environment.
4690
4691 #. As the first step, configure (replicated *deafult* shard and *topology* shard if needed) and run OpenDaylight in clustered environment, install BGP and RESTCONF.
4692
4693 #. On one node (OpenDaylight instance), configure BGP speaker instance and neighbor. In addition, configure BGP topology exporter if required. The configuration is shared across all interconnected cluster nodes, however BGP become active only on one node. Other nodes with configured BGP serves as stand-by backups.
4694
4695 #. Remote peer should be configured to accept/initiate connection from/to all OpenDaylight cluster nodes with configured BGP plugin.
4696
4697 #. Connect remote peer, let it advertise some routes. Verify routes presence in Loc-RIB and/or BGP topology exporter instance on all nodes of the OpenDaylight cluster.
4698
4699 .. warning::
4700
4701    Replicating RIBs across the cluster nodes is causing severe scalability issue and overall performance degradation. To avoid this problems, configure BGP RIB module as a separate shard without enabled replication. Change configuration on all nodes as following (`configuration/initial`):
4702
4703    * In ``modules.conf`` add a new module:
4704       .. code-block:: console
4705
4706          {
4707              name = "bgp_rib"
4708              namespace = "urn:opendaylight:params:xml:ns:yang:bgp-rib"
4709              shard-strategy = "module"
4710          }
4711
4712    * In ``module-shards.conf`` define a new module shard:
4713       .. code-block:: console
4714
4715          {
4716              name = "bgp_rib"
4717              shards = [
4718                  {
4719                      name="bgp_rib"
4720                      replicas = [
4721                          "member-1"
4722                      ]
4723                  }
4724              ]
4725          }
4726
4727    **Note:** Use correct member name in module shard configuration.
4728
4729 Failover scenario
4730 ^^^^^^^^^^^^^^^^^
4731 Following section presents a basic BGP speaker failover scenario on 3-node OpenDaylight cluster setup.
4732
4733 .. figure:: ./images/bgpcep/BGP_HA.png
4734    :alt: BGP HA setup.
4735
4736    Once the OpenDaylight BGP is configured, the speaker become active on one of the cluster nodes. Remote peer can establish connection with this BGP instance.
4737    Routes advertised by remote peer are replicated, hence RIBs state on all nodes is the same.
4738
4739 -----
4740
4741 .. figure:: ./images/bgpcep/BGP_HA_failure.png
4742    :alt: Node went down.
4743
4744    In a case a cluster node, where BGP instance is running, goes down (unexpected failure, restart), active BGP session is dropped.
4745
4746 -----
4747
4748 .. figure:: ./images/bgpcep/BGP_HA_recovery.png
4749    :alt: BGP recovery.
4750
4751    Now, one of the stand-by BGP speaker instances become active. Remote peer establishes new connection and advertises routes again.
4752
4753 Topology Provider
4754 -----------------
4755 This section provides an overview of the BGP topology provider service.
4756 It shows how to configure and use all available BGP topology providers.
4757 Providers are building topology view of BGP routes stored in local BGP speaker's Loc-RIB.
4758 Output topologies are rendered in a form of standardised IETF network topology model.
4759
4760 .. contents:: Contents
4761    :depth: 2
4762    :local:
4763
4764 Inet Reachability Topology
4765 ^^^^^^^^^^^^^^^^^^^^^^^^^^
4766 Inet reachability topology exporter offers a mapping service from IPv4/6 routes to network topology nodes.
4767
4768 Configuration
4769 '''''''''''''
4770 Following example shows how to create a new instance of IPv4 BGP topology exporter:
4771
4772 **URL:** ``/restconf/config/network-topology:network-topology``
4773
4774 **Method:** ``POST``
4775
4776 **Content-Type:** ``application/xml``
4777
4778 **Request Body:**
4779
4780 .. code-block:: xml
4781    :linenos:
4782    :emphasize-lines: 2,4,6
4783
4784    <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4785        <topology-id>bgp-example-ipv4-topology</topology-id>
4786        <topology-types>
4787            <bgp-ipv4-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-ipv4-reachability-topology>
4788        </topology-types>
4789        <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">bgp-example</rib-id>
4790    </topology>
4791
4792 @line 2: An identifier for a topology.
4793
4794 @line 4: Used to identify type of the topology. In this case BGP IPv4 reachability topology.
4795
4796 @line 6: A name of the local BGP speaker instance.
4797
4798 -----
4799
4800 The topology exporter instance can be removed in a following way:
4801
4802 **URL:** ``/restconf/config/network-topology:network-topology/topology/bgp-example-ipv4-topology``
4803
4804 **Method:** ``DELETE``
4805
4806 -----
4807
4808 Following example shows how to create a new instance of IPv6 BGP topology exporter:
4809
4810 **URL:** ``/restconf/config/network-topology:network-topology``
4811
4812 **Method:** ``POST``
4813
4814 **Content-Type:** ``application/xml``
4815
4816 **Request Body:**
4817
4818 .. code-block:: xml
4819
4820    <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4821        <topology-id>bgp-example-ipv6-topology</topology-id>
4822        <topology-types>
4823            <bgp-ipv6-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-ipv6-reachability-topology>
4824        </topology-types>
4825        <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">bgp-example</rib-id>
4826    </topology>
4827
4828 Usage
4829 '''''
4830 Operational state of the topology can be verified via REST:
4831
4832 **URL:** ``/restconf/operational/network-topology:network-topology/topology/bgp-example-ipv4-topology``
4833
4834 **Method:** ``GET``
4835
4836 **Response Body:**
4837
4838 .. code-block:: xml
4839    :linenos:
4840    :emphasize-lines: 8,11
4841
4842    <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4843        <topology-id>bgp-example-ipv4-topology</topology-id>
4844        <server-provided>true</server-provided>
4845        <topology-types>
4846            <bgp-ipv4-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-ipv4-reachability-topology>
4847        </topology-types>
4848        <node>
4849            <node-id>10.10.1.1</node-id>
4850            <igp-node-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
4851                <prefix>
4852                    <prefix>10.0.0.10/32</prefix>
4853                </prefix>
4854            </igp-node-attributes>
4855        </node>
4856    </topology>
4857
4858 @line 8: The identifier of a node in a topology. Its value is mapped from route's NEXT_HOP attribute.
4859
4860 @line 11: The IP prefix attribute of the node. Its value is mapped from routes's destination IP prefix.
4861
4862 BGP Linkstate Topology
4863 ^^^^^^^^^^^^^^^^^^^^^^
4864 BGP linkstate topology exporter offers a mapping service from BGP-LS routes to network topology nodes and links.
4865
4866 Configuration
4867 '''''''''''''
4868 Following example shows how to create a new instance of linkstate BGP topology exporter:
4869
4870 **URL:** ``/restconf/config/network-topology:network-topology``
4871
4872 **Method:** ``POST``
4873
4874 **Content-Type:** ``application/xml``
4875
4876 **Request Body:**
4877
4878 .. code-block:: xml
4879
4880    <topology  xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4881        <topology-id>bgp-example-linkstate-topology</topology-id>
4882        <topology-types>
4883            <bgp-linkstate-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-linkstate-topology>
4884        </topology-types>
4885        <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">bgp-example</rib-id>
4886    </topology>
4887
4888 Usage
4889 '''''
4890 Operational state of the topology can be verified via REST.
4891 A sample output below represents a two node topology with two unidirectional links interconnecting those nodes.
4892
4893 **URL:** ``/restconf/operational/network-topology:network-topology/topology/bgp-example-linkstate-topology``
4894
4895 **Method:** ``GET``
4896
4897 **Response Body:**
4898
4899 .. code-block:: xml
4900
4901    <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4902        <topology-id>bgp-example-linkstate-topology</topology-id>
4903        <server-provided>true</server-provided>
4904        <topology-types>
4905            <bgp-linkstate-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-linkstate-topology>
4906        </topology-types>
4907        <node>
4908            <node-id>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0040</node-id>
4909            <termination-point>
4910                <tp-id>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.40</tp-id>
4911                <igp-termination-point-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology"/>
4912            </termination-point>
4913            <igp-node-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
4914                <prefix>
4915                    <prefix>40.40.40.40/32</prefix>
4916                    <metric>10</metric>
4917                </prefix>
4918                <prefix>
4919                    <prefix>203.20.160.0/24</prefix>
4920                    <metric>10</metric>
4921                </prefix>
4922                <name>node1</name>
4923                <router-id>40.40.40.40</router-id>
4924                <isis-node-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
4925                    <ted>
4926                        <te-router-id-ipv4>40.40.40.40</te-router-id-ipv4>
4927                    </ted>
4928                    <iso>
4929                        <iso-system-id>MDAwMDAwMDAwMDY0</iso-system-id>
4930                    </iso>
4931                </isis-node-attributes>
4932            </igp-node-attributes>
4933        </node>
4934        <node>
4935            <node-id>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0039</node-id>
4936            <termination-point>
4937                <tp-id>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.39</tp-id>
4938                <igp-termination-point-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology"/>
4939            </termination-point>
4940            <igp-node-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
4941                <prefix>
4942                    <prefix>39.39.39.39/32</prefix>
4943                    <metric>10</metric>
4944                </prefix>
4945                <prefix>
4946                    <prefix>203.20.160.0/24</prefix>
4947                    <metric>10</metric>
4948                </prefix>
4949                <name>node2</name>
4950                <router-id>39.39.39.39</router-id>
4951                <isis-node-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
4952                    <ted>
4953                        <te-router-id-ipv4>39.39.39.39</te-router-id-ipv4>
4954                    </ted>
4955                    <iso>
4956                        <iso-system-id>MDAwMDAwMDAwMDg3</iso-system-id>
4957                    </iso>
4958                </isis-node-attributes>
4959            </igp-node-attributes>
4960        </node>
4961        <link>
4962            <destination>
4963                <dest-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0039</dest-node>
4964                <dest-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.39</dest-tp>
4965            </destination>
4966            <link-id>bgpls://IsisLevel2:1/type=link&amp;local-as=65000&amp;local-domain=673720360&amp;local-router=0000.0000.0040&amp;remote-as=65000&amp;remote-domain=673720360&amp;remote-router=0000.0000.0039&amp;ipv4-iface=203.20.160.40&amp;ipv4-neigh=203.20.160.39</link-id>
4967            <source>
4968                <source-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0040</source-node>
4969                <source-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.40</source-tp>
4970            </source>
4971            <igp-link-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
4972                <metric>10</metric>
4973                <isis-link-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
4974                    <ted>
4975                        <color>0</color>
4976                        <max-link-bandwidth>1250000.0</max-link-bandwidth>
4977                        <max-resv-link-bandwidth>12500.0</max-resv-link-bandwidth>
4978                        <te-default-metric>0</te-default-metric>
4979                        <unreserved-bandwidth>
4980                            <bandwidth>12500.0</bandwidth>
4981                            <priority>0</priority>
4982                        </unreserved-bandwidth>
4983                        <unreserved-bandwidth>
4984                            <bandwidth>12500.0</bandwidth>
4985                            <priority>1</priority>
4986                        </unreserved-bandwidth>
4987                        <unreserved-bandwidth>
4988                            <bandwidth>12500.0</bandwidth>
4989                            <priority>2</priority>
4990                        </unreserved-bandwidth>
4991                        <unreserved-bandwidth>
4992                            <bandwidth>12500.0</bandwidth>
4993                            <priority>3</priority>
4994                        </unreserved-bandwidth>
4995                        <unreserved-bandwidth>
4996                            <bandwidth>12500.0</bandwidth>
4997                            <priority>4</priority>
4998                        </unreserved-bandwidth>
4999                        <unreserved-bandwidth>
5000                            <bandwidth>12500.0</bandwidth>
5001                            <priority>5</priority>
5002                        </unreserved-bandwidth>
5003                        <unreserved-bandwidth>
5004                            <bandwidth>12500.0</bandwidth>
5005                            <priority>6</priority>
5006                        </unreserved-bandwidth>
5007                        <unreserved-bandwidth>
5008                            <bandwidth>12500.0</bandwidth>
5009                            <priority>7</priority>
5010                        </unreserved-bandwidth>
5011                    </ted>
5012                </isis-link-attributes>
5013            </igp-link-attributes>
5014        </link>
5015        <link>
5016            <destination>
5017                <dest-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0040</dest-node>
5018                <dest-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.40</dest-tp>
5019            </destination>
5020            <link-id>bgpls://IsisLevel2:1/type=link&amp;local-as=65000&amp;local-domain=673720360&amp;local-router=0000.0000.0039&amp;remote-as=65000&amp;remote-domain=673720360&amp;remote-router=0000.0000.0040&amp;ipv4-iface=203.20.160.39&amp;ipv4-neigh=203.20.160.40</link-id>
5021            <source>
5022                <source-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0039</source-node>
5023                <source-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.39</source-tp>
5024            </source>
5025            <igp-link-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
5026                <metric>10</metric>
5027                <isis-link-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
5028                    <ted>
5029                        <color>0</color>
5030                        <max-link-bandwidth>1250000.0</max-link-bandwidth>
5031                        <max-resv-link-bandwidth>12500.0</max-resv-link-bandwidth>
5032                        <te-default-metric>0</te-default-metric>
5033                        <unreserved-bandwidth>
5034                            <bandwidth>12500.0</bandwidth>
5035                            <priority>0</priority>
5036                        </unreserved-bandwidth>
5037                        <unreserved-bandwidth>
5038                            <bandwidth>12500.0</bandwidth>
5039                            <priority>1</priority>
5040                        </unreserved-bandwidth>
5041                        <unreserved-bandwidth>
5042                            <bandwidth>12500.0</bandwidth>
5043                            <priority>2</priority>
5044                        </unreserved-bandwidth>
5045                        <unreserved-bandwidth>
5046                            <bandwidth>12500.0</bandwidth>
5047                            <priority>3</priority>
5048                        </unreserved-bandwidth>
5049                        <unreserved-bandwidth>
5050                            <bandwidth>12500.0</bandwidth>
5051                            <priority>4</priority>
5052                        </unreserved-bandwidth>
5053                        <unreserved-bandwidth>
5054                            <bandwidth>12500.0</bandwidth>
5055                            <priority>5</priority>
5056                        </unreserved-bandwidth>
5057                        <unreserved-bandwidth>
5058                            <bandwidth>12500.0</bandwidth>
5059                            <priority>6</priority>
5060                        </unreserved-bandwidth>
5061                        <unreserved-bandwidth>
5062                            <bandwidth>12500.0</bandwidth>
5063                            <priority>7</priority>
5064                        </unreserved-bandwidth>
5065                    </ted>
5066                </isis-link-attributes>
5067            </igp-link-attributes>
5068        </link>
5069    </topology>
5070
5071 BGP Network Topology Configuration Loader
5072 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5073
5074 BGP Network Topology Configuration Loader allows user to define static initial configuration for a BGP protocol instance.
5075 This service will detect the creation of new configuration files following the pattern "network-topology-*.xml" under the path "etc/opendaylight/bgpcep".
5076 Once the file is processed, the defined configuration will be available from the configuration Data Store.
5077
5078 .. note:: If the BGP topology instance is already present, no update or configuration will be applied.
5079
5080 **PATH:** ``etc/opendaylight/bgpcep/network-topology-config.xml``
5081
5082 .. code-block:: xml
5083
5084     <network-topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
5085         <topology>
5086             <topology-id>example-ipv4-topology</topology-id>
5087             <topology-types>
5088                 <bgp-ipv4-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"/>
5089             </topology-types>
5090             <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">example-bgp-rib</rib-id>
5091         </topology>
5092         <topology>
5093             <topology-id>example-ipv6-topology</topology-id>
5094             <topology-types>
5095                 <bgp-ipv6-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"/>
5096             </topology-types>
5097             <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">example-bgp-rib</rib-id>
5098         </topology>
5099         <topology>
5100             <topology-id>example-linkstate-topology</topology-id>
5101             <topology-types>
5102                 <bgp-linkstate-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"/>
5103             </topology-types>
5104             <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">example-bgp-rib</rib-id>
5105         </topology>
5106     </network-topology>
5107
5108 Test Tools
5109 ----------
5110 BGP test tools serves to test basic BGP functionality, scalability and performance.
5111
5112 .. contents:: Contents
5113    :depth: 2
5114    :local:
5115
5116 BGP Test Tool
5117 ^^^^^^^^^^^^^
5118 The BGP Test Tool is a stand-alone Java application purposed to simulate remote BGP peers, that are capable to advertise sample routes.
5119 This application is not part of the OpenDaylight Karaf distribution, however it can be downloaded from OpenDaylight's Nexus (use latest release version):
5120
5121 ``https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/bgpcep/bgp-testtool``
5122
5123 Usage
5124 '''''
5125 The application can be run from command line:
5126
5127 .. code-block:: console
5128
5129    java -jar bgp-testtool-*-executable.jar
5130
5131
5132 with optional input parameters:
5133
5134 .. code-block:: console
5135
5136    -i <BOOLEAN>, --active <BOOLEAN>
5137       Active initialisation of the connection, by default false.
5138
5139    -ho <N>, --holdtimer <N>
5140       In seconds, value of the desired holdtimer, by default 90.
5141
5142    -sc <N>, --speakersCount <N>
5143       Number of simulated BGP speakers, when creating each speaker, uses incremented local-address for binding, by default 0.
5144
5145    -ra <IP_ADDRESS:PORT,...>, --remote-address <IP_ADDRESS:PORT,...>
5146       A list of IP addresses of remote BGP peers, that the tool can accept or initiate connect to that address (based on the mode), by default 192.0.2.2:1790.
5147
5148    -la <IP_ADDRESS:PORT>, --localAddress <IP_ADDRESS:PORT>
5149       IP address of BGP speakers which the tools simulates, by default 192.0.2.2:0.
5150
5151    -pr <N>, --prefixes <N>
5152       Number of prefixes to be advertised by each simulated speaker
5153
5154    -mp <BOOLEAN>, --multiPathSupport <BOOLEAN>
5155       Active ADD-PATH support, by default false.
5156
5157    -as <N>, --as <N>
5158       Local AS Number, by default 64496.
5159
5160    -ec <EXTENDED_COMMUNITIES>, --extended_communities <EXTENDED_COMMUNITIES>
5161       Extended communities to be send. Format: x,x,x  where  x  is  each  extended  community from bgp-types.yang, by default empty.
5162
5163    -ll <LOG_LEVEL>, --log_level <LOG_LEVEL>
5164       Log level for console output, by default INFO.
5165
5166 BGP Application Peer Benchmark
5167 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5168 It is a simple OpenDaylight application which is capable to inject and remove specific amount of IPv4 routes.
5169 This application is part of the OpenDaylight Karaf distribution.
5170
5171 Configuration
5172 '''''''''''''
5173 As a first step install BGP and RESTCONF, then configure *Application Peer*.
5174 Install ``odl-bgpcep-bgp-benchmark`` feature and reconfigure BGP Application Peer Benchmark application as per following:
5175
5176 **URL:** ``/restconf/config/odl-bgp-app-peer-benchmark-config:config``
5177
5178 **Method:** ``PUT``
5179
5180 **Content-Type:** ``application/xml``
5181
5182 **Request Body:**
5183
5184 .. code-block:: xml
5185    :linenos:
5186    :emphasize-lines: 2
5187
5188    <odl-bgp-app-peer-benchmark-config xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark-config">
5189       <app-peer-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark-config">10.25.1.9</app-peer-id>
5190    </odl-bgp-app-peer-benchmark-config>
5191
5192 @line 2: The *Application Peer* identifier.
5193
5194 Inject routes
5195 '''''''''''''
5196 Routes injection can be invoked via RPC:
5197
5198 **URL:** ``/restconf/operations/odl-bgp-app-peer-benchmark:add-prefix``
5199
5200 **Method:** ``POST``
5201
5202 **Content-Type:** ``application/xml``
5203
5204 **Request Body:**
5205
5206 .. code-block:: xml
5207    :linenos:
5208    :emphasize-lines: 2,3,4,5
5209
5210    <input xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
5211        <prefix>1.1.1.1/32</prefix>
5212        <count>100000</count>
5213        <batchsize>2000</batchsize>
5214        <nexthop>192.0.2.2</nexthop>
5215    </input>
5216
5217 @line 2: A initial IPv4 prefix carried in route. Value is incremented for following routes.
5218
5219 @line 3: An amount of routes to be added to *Application Peer's* programmable RIB.
5220
5221 @line 4: A size of the transaction batch.
5222
5223 @line 5: A NEXT_HOP attribute value used in all injected routes.
5224
5225 **Response Body:**
5226
5227 .. code-block:: xml
5228    :linenos:
5229    :emphasize-lines: 3,4,5
5230
5231    <output xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
5232        <result>
5233            <duration>4301</duration>
5234            <rate>25000</rate>
5235            <count>100000</count>
5236        </result>
5237    </output>
5238
5239 @line 3: Request duration in milliseconds.
5240
5241 @line 4: Writes per second rate.
5242
5243 @line 5: An amount of routes added to *Application Peer's* programmable RIB.
5244
5245 Remove routes
5246 '''''''''''''
5247 Routes deletion can be invoked via RPC:
5248
5249 **URL:** ``/restconf/operations/odl-bgp-app-peer-benchmark:delete-prefix``
5250
5251 **Method:** ``POST``
5252
5253 **Content-Type:** ``application/xml``
5254
5255 **Request Body:**
5256
5257 .. code-block:: xml
5258    :linenos:
5259    :emphasize-lines: 2,3,4
5260
5261    <input xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
5262        <prefix>1.1.1.1/32</prefix>
5263        <count>100000</count>
5264        <batchsize>2000</batchsize>
5265    </input>
5266
5267 @line 2: A initial IPv4 prefix carried in route to be removed. Value is incremented for following routes.
5268
5269 @line 3: An amount of routes to be removed from *Application Peer's* programmable RIB.
5270
5271 @line 4: A size of the transaction batch.
5272
5273 **Response Body:**
5274
5275 .. code-block:: xml
5276
5277    <output xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
5278        <result>
5279            <duration>1837</duration>
5280            <rate>54500</rate>
5281            <count>100000</count>
5282        </result>
5283    </output>
5284
5285 Troubleshooting
5286 ---------------
5287 This section offers advices in a case OpenDaylight BGP plugin is not working as expected.
5288
5289 .. contents:: Contents
5290    :depth: 2
5291    :local:
5292
5293 BGP is not working...
5294 ^^^^^^^^^^^^^^^^^^^^^
5295 * First of all, ensure that all required features are installed, local and remote BGP configuration is correct.
5296
5297 * Check OpenDaylight Karaf logs:
5298
5299 From Karaf console:
5300
5301 .. code-block:: console
5302
5303    log:tail
5304
5305 or open log file: ``data/log/karaf.log``
5306
5307 Possibly, a reason/hint for a cause of the problem can be found there.
5308
5309 * Try to minimise effect of other OpenDaylight features, when searching for a reason of the problem.
5310
5311 * Try to set DEBUG severity level for BGP logger via Karaf console commands, in order to collect more information:
5312
5313 .. code-block:: console
5314
5315    log:set DEBUG org.opendaylight.protocol.bgp
5316
5317 .. code-block:: console
5318
5319    log:set DEBUG org.opendaylight.bgpcep.bgp
5320
5321 Bug reporting
5322 ^^^^^^^^^^^^^
5323 Before you report a bug, check `BGPCEP Bugzilla <https://bugs.opendaylight.org/buglist.cgi?list_id=65849&product=bgpcep&resolution=--->`_ to ensure same/similar bug is not already filed there.
5324
5325 Write an e-mail to bgpcep-users@lists.opendaylight.org and provide following information:
5326
5327 #. State OpenDaylight version
5328
5329 #. Describe your use-case and provide as much details related to BGP as possible
5330
5331 #. Steps to reproduce
5332
5333 #. Attach Karaf log files, optionally packet captures, REST input/output