BGPCEP-694: bgp-config-example
[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 When installing BGP an example will be provided and a default configuration loaded.
1088
1089 **PATH:** ``etc/opendaylight/bgp/protocols-config.xml``
1090
1091 .. code-block:: xml
1092
1093     <protocols xmlns="http://openconfig.net/yang/network-instance">
1094         <protocol>
1095             <name>example-bgp-rib</name>
1096             <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
1097             <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1098                 <global>
1099                     <config>
1100                         <router-id>192.0.2.2</router-id>
1101                         <as>64496</as>
1102                         <!-- if cluster-id is not present, it's value is the same as bgp-id -->
1103                         <!-- <route-reflector-cluster-id>192.0.2.3</route-reflector-cluster-id> -->
1104                         <!-- <read-only-limit>120</read-only-limit>-->
1105                     </config>
1106                     <afi-safis>
1107                         <afi-safi>
1108                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
1109                             <!--Advertise N Paths
1110                             <receive>true</receive>
1111                             <send-max>2</send-max>-->
1112                         </afi-safi>
1113                         <afi-safi>
1114                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
1115                         </afi-safi>
1116                         <afi-safi>
1117                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
1118                         </afi-safi>
1119                         <afi-safi>
1120                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-LABELLED-UNICAST</afi-safi-name>
1121                         </afi-safi>
1122                         <afi-safi>
1123                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
1124                         </afi-safi>
1125                         <afi-safi>
1126                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
1127                         </afi-safi>
1128                         <afi-safi>
1129                             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
1130                         </afi-safi>
1131                         <afi-safi>
1132                             <afi-safi-name>LINKSTATE</afi-safi-name>
1133                         </afi-safi>
1134                         <afi-safi>
1135                             <afi-safi-name>IPV4-FLOW</afi-safi-name>
1136                         </afi-safi>
1137                         <afi-safi>
1138                             <afi-safi-name>IPV6-FLOW</afi-safi-name>
1139                         </afi-safi>
1140                         <afi-safi>
1141                             <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
1142                         </afi-safi>
1143                         <afi-safi>
1144                             <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
1145                         </afi-safi>
1146                     </afi-safis>
1147                 </global>
1148                 <neighbors xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1149                     <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1150                         <neighbor-address>192.0.2.1</neighbor-address>
1151                         <config>
1152                             <peer-type>INTERNAL</peer-type>
1153                             <peer-as>64496</peer-as>
1154                         </config>
1155                         <transport>
1156                             <config>
1157                                 <remote-port>179</remote-port>
1158                                 <passive-mode>true</passive-mode>
1159                             </config>
1160                         </transport>
1161                         <timers>
1162                             <config>
1163                                 <hold-time>180</hold-time>
1164                                 <connect-retry>10</connect-retry>
1165                             </config>
1166                         </timers>
1167                         <route-reflector>
1168                             <config>
1169                                 <route-reflector-client>false</route-reflector-client>
1170                             </config>
1171                         </route-reflector>
1172                         <afi-safis>
1173                             <afi-safi>
1174                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
1175                                 <!--Advertise N Paths
1176                                 <receive>true</receive>
1177                                 <send-max>0</send-max>-->
1178                             </afi-safi>
1179                             <afi-safi>
1180                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
1181                             </afi-safi>
1182                             <afi-safi>
1183                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
1184                             </afi-safi>
1185                             <afi-safi>
1186                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-LABELLED-UNICAST</afi-safi-name>
1187                             </afi-safi>
1188                             <afi-safi>
1189                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
1190                             </afi-safi>
1191                             <afi-safi>
1192                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
1193                             </afi-safi>
1194                             <afi-safi>
1195                                 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
1196                             </afi-safi>
1197                             <afi-safi>
1198                                 <afi-safi-name>LINKSTATE</afi-safi-name>
1199                             </afi-safi>
1200                             <afi-safi>
1201                                 <afi-safi-name>IPV4-FLOW</afi-safi-name>
1202                             </afi-safi>
1203                             <afi-safi>
1204                                 <afi-safi-name>IPV6-FLOW</afi-safi-name>
1205                             </afi-safi>
1206                             <afi-safi>
1207                                 <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
1208                             </afi-safi>
1209                             <afi-safi>
1210                                 <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
1211                             </afi-safi>
1212                         </afi-safis>
1213                     </neighbor>
1214                     <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1215                         <neighbor-address>192.0.2.6</neighbor-address>
1216                         <config>
1217                             <peer-group>application-peers</peer-group>
1218                         </config>
1219                     </neighbor>
1220                 </neighbors>
1221             </bgp>
1222         </protocol>
1223     </protocols>
1224
1225 BGP Configuration Example
1226 '''''''''''''''''''''''''
1227
1228 BGP provides a feature providing a BGP Protocol and Network Topology configuration file example.
1229 Once feature is installed defined configuration will be loaded and setup.
1230
1231 .. code-block:: console
1232
1233    feature:install odl-bgpcep-bgp-config-example
1234
1235 BGP pipeline
1236 ^^^^^^^^^^^^
1237 .. figure:: ./images/bgpcep/bgp-pipeline.png
1238    :alt: BGP pipeline.
1239
1240    BGP pipeline - routes re-advertisement.
1241
1242 .. figure:: ./images/bgpcep/bgp-app-pipeline.png
1243    :alt: BGP Application Peer pipeline.
1244
1245    BGP applcaition peer pipeline - routes injection.
1246
1247 References
1248 ^^^^^^^^^^
1249 * `A Border Gateway Protocol 4 (BGP-4) <https://tools.ietf.org/html/rfc4271>`_
1250 * `BGP Route Reflection <https://tools.ietf.org/html/rfc4456>`_
1251 * `BGP Communities Attribute <https://tools.ietf.org/html/rfc1997>`_
1252 * `BGP Support for Four-Octet Autonomous System (AS) Number Space <https://tools.ietf.org/html/rfc6793>`_
1253 * `The Accumulated IGP Metric Attribute for BGP <https://tools.ietf.org/html/rfc7311>`_
1254 * `4-Octet AS Specific BGP Extended Community <https://tools.ietf.org/html/rfc5668>`_
1255 * `BGP Link Bandwidth Extended Community <https://tools.ietf.org/html/draft-ietf-idr-link-bandwidth-06>`_
1256 * `Use of BGP for Routing in Large-Scale Data Centers <https://tools.ietf.org/html/rfc7938>`_
1257
1258 IP Unicast Family
1259 -----------------
1260 The BGP-4 allows to carry IPv4 specific information only.
1261 The basic BGP Multiprotocol extension brings *Unicast* Subsequent Address Family (SAFI) - intended to be used for IP unicast forwarding.
1262 The combination of IPv4 and IPv6 Address Family (AF) and Unicast SAFI is essential for Internet routing.
1263 The IPv4 Unicast routes are interchangeable with BGP-4 routes, as they can carry the same type of routing information.
1264
1265 .. contents:: Contents
1266    :depth: 2
1267    :local:
1268
1269 Configuration
1270 ^^^^^^^^^^^^^
1271 This section shows a way to enable IPv4 and IPv6 Unicast family in BGP speaker and peer configuration.
1272
1273 BGP Speaker
1274 '''''''''''
1275 To enable IPv4 and IPv6 Unicast support in BGP plugin, first configure BGP speaker instance:
1276
1277 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
1278
1279 **Method:** ``POST``
1280
1281 **Content-Type:** ``application/xml``
1282
1283 **Request Body:**
1284
1285 .. code-block:: xml
1286
1287    <protocol xmlns="http://openconfig.net/yang/network-instance">
1288        <name>bgp-example</name>
1289        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
1290        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1291            <global>
1292                <config>
1293                    <router-id>192.0.2.2</router-id>
1294                    <as>65000</as>
1295                </config>
1296                <afi-safis>
1297                    <afi-safi>
1298                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
1299                    </afi-safi>
1300                    <afi-safi>
1301                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
1302                    </afi-safi>
1303                </afi-safis>
1304            </global>
1305        </bgp>
1306    </protocol>
1307
1308 BGP Peer
1309 ''''''''
1310 Here is an example for BGP peer configuration with enabled IPv4 and IPv6 Unicast family.
1311
1312 **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``
1313
1314 **Method:** ``POST``
1315
1316 **Content-Type:** ``application/xml``
1317
1318 **Request Body:**
1319
1320 .. code-block:: xml
1321
1322    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1323        <neighbor-address>192.0.2.1</neighbor-address>
1324        <afi-safis>
1325            <afi-safi>
1326                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
1327            </afi-safi>
1328            <afi-safi>
1329                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
1330            </afi-safi>
1331        </afi-safis>
1332    </neighbor>
1333
1334 IP Unicast API
1335 ^^^^^^^^^^^^^^
1336 Following trees illustrate the BGP IP Unicast routes structures.
1337
1338 IPv4 Unicast Route
1339 ''''''''''''''''''
1340 .. code-block:: console
1341
1342    :(ipv4-routes-case)
1343       +--ro ipv4-routes
1344         +--ro ipv4-route* [prefix path-id]
1345            +--ro prefix        inet:ipv4-prefix
1346            +--ro path-id       path-id
1347            +--ro attributes
1348               +--ro origin
1349               |  +--ro value    bgp-t:bgp-origin
1350               +--ro as-path
1351               |  +--ro segments*
1352               |     +--ro as-sequence*   inet:as-number
1353               |     +--ro as-set*        inet:as-number
1354               +--ro (c-next-hop)?
1355               |  +--:(ipv4-next-hop-case)
1356               |  |  +--ro ipv4-next-hop
1357               |  |     +--ro global?   inet:ipv4-address
1358               |  +--:(ipv6-next-hop-case)
1359               |  |  +--ro ipv6-next-hop
1360               |  |     +--ro global?       inet:ipv6-address
1361               |  |     +--ro link-local?   inet:ipv6-address
1362               |  +--:(empty-next-hop-case)
1363               |     +--ro empty-next-hop?            empty
1364               +--ro multi-exit-disc
1365               |  +--ro med?   uint32
1366               +--ro local-pref
1367               |  +--ro pref?   uint32
1368               +--ro atomic-aggregate!
1369               +--ro aggregator
1370               |  +--ro as-number?         inet:as-number
1371               |  +--ro network-address?   inet:ipv4-address
1372               +--ro communities*
1373               |  +--ro as-number?   inet:as-number
1374               |  +--ro semantics?   uint16
1375               +--ro extended-communities*
1376               |  +--ro transitive?                             boolean
1377               |  +--ro (extended-community)?
1378               |     +--:(as-specific-extended-community-case)
1379               |     |  +--ro as-specific-extended-community
1380               |     |     +--ro global-administrator?   short-as-number
1381               |     |     +--ro local-administrator?    binary
1382               |     +--:(inet4-specific-extended-community-case)
1383               |     |  +--ro inet4-specific-extended-community
1384               |     |     +--ro global-administrator?   inet:ipv4-address
1385               |     |     +--ro local-administrator?    binary
1386               |     +--:(opaque-extended-community-case)
1387               |     |  +--ro opaque-extended-community
1388               |     |     +--ro value?   binary
1389               |     +--:(route-target-extended-community-case)
1390               |     |  +--ro route-target-extended-community
1391               |     |     +--ro global-administrator?   short-as-number
1392               |     |     +--ro local-administrator?    binary
1393               |     +--:(route-origin-extended-community-case)
1394               |     |  +--ro route-origin-extended-community
1395               |     |     +--ro global-administrator?   short-as-number
1396               |     |     +--ro local-administrator?    binary
1397               |     +--:(route-target-ipv4-case)
1398               |     |  +--ro route-target-ipv4
1399               |     |     +--ro global-administrator?   inet:ipv4-address
1400               |     |     +--ro local-administrator?    uint16
1401               |     +--:(route-origin-ipv4-case)
1402               |     |  +--ro route-origin-ipv4
1403               |     |     +--ro global-administrator?   inet:ipv4-address
1404               |     |     +--ro local-administrator?    uint16
1405               |     +--:(link-bandwidth-case)
1406               |     |  +--ro link-bandwidth-extended-community
1407               |     |     +--ro bandwidth    netc:bandwidth
1408               |     +--:(as-4-generic-spec-extended-community-case)
1409               |     |  +--ro as-4-generic-spec-extended-community
1410               |     |     +--ro as-4-specific-common
1411               |     |        +--ro as-number              inet:as-number
1412               |     |        +--ro local-administrator    uint16
1413               |     +--:(as-4-route-target-extended-community-case)
1414               |     |  +--ro as-4-route-target-extended-community
1415               |     |     +--ro as-4-specific-common
1416               |     |        +--ro as-number              inet:as-number
1417               |     |        +--ro local-administrator    uint16
1418               |     +--:(as-4-route-origin-extended-community-case)
1419               |     |  +--ro as-4-route-origin-extended-community
1420               |     |     +--ro as-4-specific-common
1421               |     |        +--ro as-number              inet:as-number
1422               |     |        +--ro local-administrator    uint16
1423               |     +--:(encapsulation-case)
1424               |        +--ro encapsulation-extended-community
1425               |           +--ro tunnel-type    encapsulation-tunnel-type
1426               +--ro originator-id
1427               |  +--ro originator?   inet:ipv4-address
1428               +--ro cluster-id
1429               |  +--ro cluster*   bgp-t:cluster-identifier
1430               +--ro aigp
1431               |  +--ro aigp-tlv
1432               |     +--ro metric?   netc:accumulated-igp-metric
1433               +--ro unrecognized-attributes* [type]
1434                  +--ro partial       boolean
1435                  +--ro transitive    boolean
1436                  +--ro type          uint8
1437                  +--ro value         binary
1438
1439 IPv6 Unicast Route
1440 ''''''''''''''''''
1441 .. code-block:: console
1442
1443    :(ipv6-routes-case)
1444       +--ro ipv6-routes
1445          +--ro ipv6-route* [prefix path-id]
1446             +--ro prefix        inet:ipv6-prefix
1447             +--ro path-id       path-id
1448             +--ro attributes
1449             ...
1450
1451 Usage
1452 ^^^^^
1453 IPv4 Unicast
1454 ''''''''''''
1455 The IPv4 Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
1456
1457 **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``
1458
1459 **Method:** ``GET``
1460
1461 **Response Body:**
1462
1463 .. code-block:: xml
1464
1465    <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
1466        <ipv4-route>
1467            <path-id>0</path-id>
1468            <prefix>193.0.2.1/32</prefix>
1469            <attributes>
1470                <as-path></as-path>
1471                <origin>
1472                    <value>igp</value>
1473                </origin>
1474                <local-pref>
1475                    <pref>100</pref>
1476                </local-pref>
1477                <ipv4-next-hop>
1478                    <global>10.0.0.1</global>
1479                </ipv4-next-hop>
1480            </attributes>
1481        </ipv4-route>
1482    </ipv4-routes>
1483
1484 IPv6 Unicast
1485 ''''''''''''
1486 The IPv6 Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
1487
1488 **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``
1489
1490 **Method:** ``GET``
1491
1492 **Response Body:**
1493
1494 .. code-block:: xml
1495
1496    <ipv6-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
1497        <ipv6-route>
1498            <path-id>0</path-id>
1499            <prefix>2a02:b80:0:1::/64</prefix>
1500            <attributes>
1501                <as-path></as-path>
1502                <origin>
1503                    <value>igp</value>
1504                </origin>
1505                <local-pref>
1506                    <pref>200</pref>
1507                </local-pref>
1508                <ipv6-next-hop>
1509                    <global>2a02:b80:0:2::1</global>
1510                </ipv6-next-hop>
1511            </attributes>
1512        </ipv6-route>
1513    </ipv6-routes>
1514
1515 .. note:: IPv4/6 routes mapping to topology nodes is supported by BGP Topology Provider.
1516
1517 Programming
1518 ^^^^^^^^^^^
1519 IPv4 Unicast
1520 ''''''''''''
1521 This examples show how to originate and remove IPv4 route via programmable RIB.
1522 Make sure the *Application Peer* is configured first.
1523
1524 **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``
1525
1526 **Method:** ``POST``
1527
1528 **Content-Type:** ``application/xml``
1529
1530 **Request Body:**
1531
1532 .. code-block:: xml
1533
1534    <ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
1535        <path-id>0</path-id>
1536        <prefix>10.0.0.11/32</prefix>
1537        <attributes>
1538            <as-path></as-path>
1539            <origin>
1540                <value>igp</value>
1541            </origin>
1542            <local-pref>
1543                <pref>100</pref>
1544            </local-pref>
1545            <ipv4-next-hop>
1546                <global>10.11.1.1</global>
1547            </ipv4-next-hop>
1548        </attributes>
1549    </ipv4-route>
1550
1551 -----
1552
1553 To remove the route added above, following request can be used:
1554
1555 **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``
1556
1557 **Method:** ``DELETE``
1558
1559 IPv6 Unicast
1560 ''''''''''''
1561 This examples show how to originate and remove IPv6 route via programmable RIB:
1562
1563 **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``
1564
1565 **Method:** ``POST``
1566
1567 **Content-Type:** ``application/xml``
1568
1569 **Request Body:**
1570
1571 .. code-block:: xml
1572
1573    <ipv6-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
1574        <prefix>2001:db8:30::3/128</prefix>
1575        <path-id>0</path-id>
1576        <attributes>
1577            <ipv6-next-hop>
1578                <global>2001:db8:1::6</global>
1579            </ipv6-next-hop>
1580            <as-path/>
1581            <origin>
1582                <value>igp</value>
1583            </origin>
1584            <local-pref>
1585                <pref>100</pref>
1586            </local-pref>
1587        </attributes>
1588    </ipv6-route>
1589
1590 -----
1591
1592 To remove the route added above, following request can be used:
1593
1594 **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``
1595
1596 **Method:** ``DELETE``
1597
1598 References
1599 ^^^^^^^^^^
1600 * `Multiprotocol Extensions for BGP-4 <https://tools.ietf.org/html/rfc4760>`_
1601
1602 IP Labeled Unicast Family
1603 -------------------------
1604 The BGP Labeled Unicast (BGP-LU) Multiprotocol extension is used to distribute a MPLS label that is mapped to a particular route.
1605 It can be used to advertise a MPLS transport path between IGP regions and Autonomous Systems.
1606 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.
1607 In addition, IPv6 Labeled Unicast can be used to interconnect IPv6 islands over IPv4/MPLS networks using 6PE.
1608
1609 .. contents:: Contents
1610    :depth: 2
1611    :local:
1612
1613 Configuration
1614 ^^^^^^^^^^^^^
1615 This section shows a way to enable IPv4 and IPv6 Labeled Unicast family in BGP speaker and peer configuration.
1616
1617 BGP Speaker
1618 '''''''''''
1619 To enable IPv4 and IPv6 Labeled Unicast support in BGP plugin, first configure BGP speaker instance:
1620
1621 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
1622
1623 **Method:** ``POST``
1624
1625 **Content-Type:** ``application/xml``
1626
1627 **Request Body:**
1628
1629 .. code-block:: xml
1630
1631    <protocol xmlns="http://openconfig.net/yang/network-instance">
1632        <name>bgp-example</name>
1633        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
1634        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1635            <global>
1636                <config>
1637                    <router-id>192.0.2.2</router-id>
1638                    <as>65000</as>
1639                </config>
1640                <afi-safis>
1641                    <afi-safi>
1642                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
1643                    </afi-safi>
1644                    <afi-safi>
1645                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-LABELLED-UNICAST</afi-safi-name>
1646                    </afi-safi>
1647                </afi-safis>
1648            </global>
1649        </bgp>
1650    </protocol>
1651
1652 BGP Peer
1653 ''''''''
1654 Here is an example for BGP peer configuration with enabled IPv4 and IPv6 Labeled Unicast family.
1655
1656 **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``
1657
1658 **Method:** ``POST``
1659
1660 **Content-Type:** ``application/xml``
1661
1662 **Request Body:**
1663
1664 .. code-block:: xml
1665
1666    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1667        <neighbor-address>192.0.2.1</neighbor-address>
1668        <afi-safis>
1669            <afi-safi>
1670                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
1671            </afi-safi>
1672            <afi-safi>
1673                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-LABELLED-UNICAST</afi-safi-name>
1674            </afi-safi>
1675        </afi-safis>
1676    </neighbor>
1677
1678 IP Labeled Unicast API
1679 ^^^^^^^^^^^^^^^^^^^^^^
1680 Following trees illustrate the BGP IP Labeled Unicast routes structures.
1681
1682 IPv4 Labeled Unicast Route
1683 ''''''''''''''''''''''''''
1684 .. code-block:: console
1685
1686    :(labeled-unicast-routes-case)
1687      +--ro labeled-unicast-routes
1688         +--ro labeled-unicast-route* [route-key path-id]
1689            +--ro route-key      string
1690            +--ro label-stack*
1691            |  +--ro label-value?   netc:mpls-label
1692            +--ro prefix?        inet:ip-prefix
1693            +--ro path-id        path-id
1694            +--ro attributes
1695            ...
1696
1697
1698 IPv6 Labeled Unicast Route
1699 ''''''''''''''''''''''''''
1700 .. code-block:: console
1701
1702    :(labeled-unicast-ipv6-routes-case)
1703       +--ro labeled-unicast-ipv6-routes
1704          +--ro labeled-unicast-route* [route-key path-id]
1705             +--ro route-key      string
1706             +--ro label-stack*
1707             |  +--ro label-value?   netc:mpls-label
1708             +--ro prefix?        inet:ip-prefix
1709             +--ro path-id        path-id
1710             +--ro attributes
1711             ...
1712
1713 Usage
1714 ^^^^^
1715 The IPv4 Labeled Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
1716
1717 **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``
1718
1719 **Method:** ``GET``
1720
1721 **Response Body:**
1722
1723 .. code-block:: xml
1724
1725    <labeled-unicast-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">
1726        <labeled-unicast-route>
1727            <path-id>0</path-id>
1728            <route-key>MAA+gRQAAA==</route-key>
1729            <attributes>
1730                <local-pref>
1731                    <pref>100</pref>
1732                </local-pref>
1733                <ipv4-next-hop>
1734                    <global>200.10.0.101</global>
1735                </ipv4-next-hop>
1736                <as-path></as-path>
1737                <origin>
1738                    <value>igp</value>
1739                </origin>
1740            </attributes>
1741            <label-stack>
1742                <label-value>1000</label-value>
1743            </label-stack>
1744            <prefix>20.0.0.0/24</prefix>
1745        </labeled-unicast-route>
1746    </labeled-unicast-routes>
1747
1748 Programming
1749 ^^^^^^^^^^^
1750 IPv4 Labeled
1751 ''''''''''''
1752 This examples show how to originate and remove IPv4 labeled route via programmable RIB.
1753 Make sure the *Application Peer* is configured first.
1754
1755 **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``
1756
1757 **Method:** ``POST``
1758
1759 **Content-Type:** ``application/xml``
1760
1761 **Request Body:**
1762
1763 .. code-block:: xml
1764
1765    <labeled-unicast-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">
1766        <route-key>label1</route-key>
1767        <prefix>1.1.1.1/32</prefix>
1768        <path-id>0</path-id>
1769        <label-stack>
1770            <label-value>800322</label-value>
1771        </label-stack>
1772        <attributes>
1773            <ipv4-next-hop>
1774                <global>199.20.160.41</global>
1775            </ipv4-next-hop>
1776            <origin>
1777                <value>igp</value>
1778            </origin>
1779            <as-path/>
1780            <local-pref>
1781                <pref>100</pref>
1782            </local-pref>
1783        </attributes>
1784    </labeled-unicast-route>
1785
1786 -----
1787
1788 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.
1789
1790 .. code-block:: xml
1791
1792    <bgp-prefix-sid>
1793        <bgp-prefix-sid-tlvs>
1794            <label-index-tlv xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">322</label-index-tlv>
1795        </bgp-prefix-sid-tlvs>
1796        <bgp-prefix-sid-tlvs>
1797            <srgb-value xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">
1798                <base>800000</base>
1799                <range>4095</range>
1800            </srgb-value>
1801        </bgp-prefix-sid-tlvs>
1802    </bgp-prefix-sid>
1803
1804 -----
1805
1806 To remove the route added above, following request can be used:
1807
1808 **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``
1809
1810 **Method:** ``DELETE``
1811
1812 IPv6 Labeled
1813 ''''''''''''
1814 This examples show how to originate and remove IPv6 labeled route via programmable RIB.
1815
1816 **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``
1817
1818 **Method:** ``POST``
1819
1820 **Content-Type:** ``application/xml``
1821
1822 **Request Body:**
1823
1824 .. code-block:: xml
1825
1826    <labeled-unicast-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">
1827        <route-key>label1</route-key>
1828        <prefix>2001:db8:30::3/128</prefix>
1829        <path-id>0</path-id>
1830        <label-stack>
1831            <label-value>123</label-value>
1832        </label-stack>
1833        <attributes>
1834            <ipv6-next-hop>
1835                <global>2003:4:5:6::7</global>
1836            </ipv6-next-hop>
1837            <origin>
1838                <value>igp</value>
1839            </origin>
1840            <as-path/>
1841            <local-pref>
1842                <pref>100</pref>
1843            </local-pref>
1844        </attributes>
1845    </labeled-unicast-route>
1846
1847 -----
1848
1849 To remove the route added above, following request can be used:
1850
1851 **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``
1852
1853 **Method:** ``DELETE``
1854
1855 References
1856 ^^^^^^^^^^
1857 * `Carrying Label Information in BGP-4 <https://tools.ietf.org/html/rfc3107>`_
1858 * `Segment Routing Prefix SID extensions for BGP <https://tools.ietf.org/html/draft-ietf-idr-bgp-prefix-sid-03>`_
1859 * `Connecting IPv6 Islands over IPv4 MPLS Using IPv6 Provider Edge Routers (6PE) <https://tools.ietf.org/html/rfc4798>`_
1860 * `BGP-Prefix Segment in large-scale data centers <https://tools.ietf.org/html/draft-ietf-spring-segment-routing-msdc-01>`_
1861 * `Egress Peer Engineering using BGP-LU <https://tools.ietf.org/html/draft-gredler-idr-bgplu-epe-06>`_
1862
1863 IP L3VPN Family
1864 ---------------
1865 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.
1866 Also, routes are distributed to specific VPN remote sites.
1867
1868 .. contents:: Contents
1869    :depth: 2
1870    :local:
1871
1872 Configuration
1873 ^^^^^^^^^^^^^
1874 This section shows a way to enable IPv4 and IPv6 L3VPN family in BGP speaker and peer configuration.
1875
1876 BGP Speaker
1877 '''''''''''
1878 To enable IPv4 and IPv6 L3VPN support in BGP plugin, first configure BGP speaker instance:
1879
1880 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
1881
1882 **Method:** ``POST``
1883
1884 **Content-Type:** ``application/xml``
1885
1886 **Request Body:**
1887
1888 .. code-block:: xml
1889
1890    <protocol xmlns="http://openconfig.net/yang/network-instance">
1891        <name>bgp-example</name>
1892        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
1893        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1894            <global>
1895                <config>
1896                    <router-id>192.0.2.2</router-id>
1897                    <as>65000</as>
1898                </config>
1899                <afi-safis>
1900                    <afi-safi>
1901                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
1902                    </afi-safi>
1903                    <afi-safi>
1904                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
1905                    </afi-safi>
1906                </afi-safis>
1907            </global>
1908        </bgp>
1909    </protocol>
1910
1911 BGP Peer
1912 ''''''''
1913 Here is an example for BGP peer configuration with enabled IPv4 and IPv6 L3VPN family.
1914
1915 **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``
1916
1917 **Method:** ``POST``
1918
1919 **Content-Type:** ``application/xml``
1920
1921 **Request Body:**
1922
1923 .. code-block:: xml
1924
1925    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
1926        <neighbor-address>192.0.2.1</neighbor-address>
1927        <afi-safis>
1928            <afi-safi>
1929                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
1930            </afi-safi>
1931            <afi-safi>
1932                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
1933            </afi-safi>
1934        </afi-safis>
1935    </neighbor>
1936
1937 IP L3VPN API
1938 ^^^^^^^^^^^^
1939 Following trees illustrate the BGP IP L3VPN routes structures.
1940
1941 IPv4 L3VPN Route
1942 ''''''''''''''''
1943 .. code-block:: console
1944
1945    :(vpn-ipv4-routes-case)
1946       +--ro vpn-ipv4-routes
1947          +--ro vpn-route* [route-key]
1948             +--ro route-key              string
1949             +--ro label-stack*
1950             |  +--ro label-value?   netc:mpls-label
1951             +--ro prefix?                inet:ip-prefix
1952             +--ro path-id?               path-id
1953             +--ro route-distinguisher?   bgp-t:route-distinguisher
1954             +--ro attributes
1955             ...
1956
1957 IPv6 L3VPN Route
1958 ''''''''''''''''
1959 .. code-block:: console
1960
1961    :(vpn-ipv6-routes-case)
1962       +--ro vpn-ipv6-routes
1963          +--ro vpn-route* [route-key]
1964             +--ro route-key              string
1965             +--ro label-stack*
1966             |  +--ro label-value?   netc:mpls-label
1967             +--ro prefix?                inet:ip-prefix
1968             +--ro path-id?               path-id
1969             +--ro route-distinguisher?   bgp-t:route-distinguisher
1970             +--ro attributes
1971             ...
1972
1973 Usage
1974 ^^^^^
1975 IPv4 L3VPN
1976 ''''''''''
1977 The IPv4 L3VPN table in an instance of the speaker's Loc-RIB can be verified via REST:
1978
1979 **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``
1980
1981 **Method:** ``GET``
1982
1983 **Response Body:**
1984
1985 .. code-block:: xml
1986
1987    <vpn-ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv4">
1988        <vpn-route>
1989            <route-key>cAXdYQABrBAALABlCgIi</route-key>
1990            <label-stack>
1991                <label-value>24022</label-value>
1992            </label-stack>
1993            <attributes>
1994                <extended-communities>
1995                    <transitive>true</transitive>
1996                    <route-target-extended-community>
1997                        <global-administrator>65000</global-administrator>
1998                        <local-administrator>AAAAZQ==</local-administrator>
1999                    </route-target-extended-community>
2000                </extended-communities>
2001                <origin>
2002                    <value>igp</value>
2003                </origin>
2004                <as-path></as-path>
2005                <local-pref>
2006                    <pref>100</pref>
2007                </local-pref>
2008                <ipv4-next-hop>
2009                    <global>127.16.0.44</global>
2010                </ipv4-next-hop>
2011            </attributes>
2012            <route-distinguisher>172.16.0.44:101</route-distinguisher>
2013            <prefix>10.2.34.0/24</prefix>
2014        </vpn-route>
2015    </vpn-ipv4-routes>
2016
2017 IPv6 L3VPN
2018 ''''''''''
2019 The IPv6 L3VPN table in an instance of the speaker's Loc-RIB can be verified via REST:
2020
2021 **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``
2022
2023 **Method:** ``GET``
2024
2025 **Response Body:**
2026
2027 .. code-block:: xml
2028
2029    <vpn-ipv6-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv6">
2030        <vpn-route>
2031            <route-key>mAXdcQABrBAALABlKgILgAAAAAE=</route-key>
2032            <label-stack>
2033                <label-value>24023</label-value>
2034            </label-stack>
2035            <attributes>
2036                <local-pref>
2037                    <pref>100</pref>
2038                </local-pref>
2039                <extended-communities>
2040                    <route-target-extended-community>
2041                        <global-administrator>65000</global-administrator>
2042                        <local-administrator>AAAAZQ==</local-administrator>
2043                    </route-target-extended-community>
2044                    <transitive>true</transitive>
2045                </extended-communities>
2046                <ipv6-next-hop>
2047                    <global>2a02:b80:0:2::1</global>
2048                </ipv6-next-hop>
2049                <origin>
2050                    <value>igp</value>
2051                </origin>
2052                <as-path></as-path>
2053            </attributes>
2054            <route-distinguisher>172.16.0.44:101</route-distinguisher>
2055            <prefix>2a02:b80:0:1::/64</prefix>
2056        </vpn-route>
2057    </vpn-ipv6-routes>
2058
2059 Programming
2060 ^^^^^^^^^^^
2061 This examples show how to originate and remove IPv4 L3VPN route via programmable RIB.
2062 Make sure the *Application Peer* is configured first.
2063
2064 **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``
2065
2066 **Method:** ``POST``
2067
2068 **Content-Type:** ``application/xml``
2069
2070 **Request Body:**
2071
2072 .. code-block:: xml
2073
2074    <vpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv4">
2075        <route-key>vpn1</route-key>
2076        <label-stack>
2077            <label-value>123</label-value>
2078        </label-stack>
2079        <route-distinguisher>429496729:1</route-distinguisher>
2080        <prefix>2.2.2.2/32</prefix>
2081        <attributes>
2082            <ipv4-next-hop>
2083                <global>199.20.166.41</global>
2084            </ipv4-next-hop>
2085            <as-path/>
2086            <origin>
2087                <value>igp</value>
2088            </origin>
2089            <extended-communities>
2090                <route-target-extended-community>
2091                    <global-administrator>65000</global-administrator>
2092                    <local-administrator>AAAAZQ==</local-administrator>
2093                </route-target-extended-community>
2094                <transitive>true</transitive>
2095            </extended-communities>
2096        </attributes>
2097    </vpn-route>
2098
2099 -----
2100
2101 To remove the route added above, following request can be used:
2102
2103 **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``
2104
2105 **Method:** ``DELETE``
2106
2107 References
2108 ^^^^^^^^^^
2109 * `BGP/MPLS IP Virtual Private Networks (VPNs) <https://tools.ietf.org/html/rfc4364>`_
2110 * `BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN <https://tools.ietf.org/html/rfc4659>`_
2111 * `BGP/MPLS VPN Virtual PE <https://tools.ietf.org/html/draft-ietf-bess-virtual-pe-00>`_
2112
2113 Link-State Family
2114 -----------------
2115 The BGP Link-State (BGP-LS) Multiprotocol extension allows to distribute Link-State and Traffic Engineering (TE) information.
2116 This information is typically distributed by IGP routing protocols with in the network, limiting LSDB or TED visibility to the IGP area.
2117 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).
2118 The information is applicable in ALTO servers and PCEs, as both need to gather information about topologies.
2119 In addition, link-state information is extended to carry segment information (Spring).
2120
2121 .. contents:: Contents
2122    :depth: 2
2123    :local:
2124
2125 Configuration
2126 ^^^^^^^^^^^^^
2127 This section shows a way to enable IPv4 and IPv6 Labeled Unicast family in BGP speaker and peer configuration.
2128
2129 BGP Speaker
2130 '''''''''''
2131 To enable BGP-LS support in BGP plugin, first configure BGP speaker instance:
2132
2133 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
2134
2135 **Method:** ``POST``
2136
2137 **Content-Type:** ``application/xml``
2138
2139 **Request Body:**
2140
2141 .. code-block:: xml
2142
2143    <protocol xmlns="http://openconfig.net/yang/network-instance">
2144        <name>bgp-example</name>
2145        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
2146        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2147            <global>
2148                <config>
2149                    <router-id>192.0.2.2</router-id>
2150                    <as>65000</as>
2151                </config>
2152                <afi-safis>
2153                    <afi-safi>
2154                        <afi-safi-name>LINKSTATE</afi-safi-name>
2155                    </afi-safi>
2156                </afi-safis>
2157            </global>
2158        </bgp>
2159    </protocol>
2160
2161 Linkstate path attribute
2162 ''''''''''''''''''''''''
2163 IANA allocation for BGP-LS path attribute is TYPE 29.
2164 Some older BGP-LS implementations might still require earliest asigned allocation TYPE 99.
2165 To use TYPE = 99, you need to set value bellow to false.
2166
2167 **URL:** ``/restconf/config/bgp-linkstate-app-config:bgp-linkstate-app-config``
2168
2169 **Method:** ``PUT``
2170
2171 **Content-Type:** ``application/xml``
2172
2173 **Request Body:**
2174
2175 .. code-block:: xml
2176
2177    <bgp-linkstate-app-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:linkstate-app-config">
2178        <iana-linkstate-attribute-type>false</iana-linkstate-attribute-type>
2179    </bgp-linkstate-app-config>
2180
2181 BGP Peer
2182 ''''''''
2183 Here is an example for BGP peer configuration with enabled BGP-LS family.
2184
2185 **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``
2186
2187 **Method:** ``POST``
2188
2189 **Content-Type:** ``application/xml``
2190
2191 **Request Body:**
2192
2193 .. code-block:: xml
2194
2195    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2196        <neighbor-address>192.0.2.1</neighbor-address>
2197        <afi-safis>
2198            <afi-safi>
2199                <afi-safi-name>LINKSTATE</afi-safi-name>
2200            </afi-safi>
2201        </afi-safis>
2202    </neighbor>
2203
2204 Link-State Route API
2205 ^^^^^^^^^^^^^^^^^^^^
2206 Following tree illustrate the BGP Link-State route structure.
2207
2208 .. code-block:: console
2209
2210    :(linkstate-routes-case)
2211       +--ro linkstate-routes
2212          +--ro linkstate-route* [route-key]
2213             +--ro route-key                       binary
2214             +--ro protocol-id                     protocol-id
2215             +--ro identifier                      identifier
2216             +--ro (object-type)?
2217             |  +--:(node-case)
2218             |  |  +--ro node-descriptors
2219             |  |     +--ro as-number?         inet:as-number
2220             |  |     +--ro area-id?           area-identifier
2221             |  |     +--ro domain-id?         domain-identifier
2222             |  |     +--ro (c-router-identifier)?
2223             |  |        +--:(isis-node-case)
2224             |  |        |  +--ro isis-node
2225             |  |        |     +--ro iso-system-id    netc:iso-system-identifier
2226             |  |        +--:(isis-pseudonode-case)
2227             |  |        |  +--ro isis-pseudonode
2228             |  |        |     +--ro is-is-router-identifier
2229             |  |        |     |  +--ro iso-system-id    netc:iso-system-identifier
2230             |  |        |     +--ro psn                        uint8
2231             |  |        +--:(ospf-node-case)
2232             |  |        |  +--ro ospf-node
2233             |  |        |     +--ro ospf-router-id    uint32
2234             |  |        +--:(ospf-pseudonode-case)
2235             |  |           +--ro ospf-pseudonode
2236             |  |              +--ro ospf-router-id    uint32
2237             |  |              +--ro lan-interface     ospf-interface-identifier
2238             |  +--:(link-case)
2239             |  |  +--ro local-node-descriptors
2240             |  |  |  +--ro as-number?         inet:as-number
2241             |  |  |  +--ro area-id?           area-identifier
2242             |  |  |  +--ro domain-id?         domain-identifier
2243             |  |  |  +--ro (c-router-identifier)?
2244             |  |  |  |  +--:(isis-node-case)
2245             |  |  |  |  |  +--ro isis-node
2246             |  |  |  |  |     +--ro iso-system-id    netc:iso-system-identifier
2247             |  |  |  |  +--:(isis-pseudonode-case)
2248             |  |  |  |  |  +--ro isis-pseudonode
2249             |  |  |  |  |     +--ro is-is-router-identifier
2250             |  |  |  |  |     |  +--ro iso-system-id    netc:iso-system-identifier
2251             |  |  |  |  |     +--ro psn                        uint8
2252             |  |  |  |  +--:(ospf-node-case)
2253             |  |  |  |  |  +--ro ospf-node
2254             |  |  |  |  |     +--ro ospf-router-id    uint32
2255             |  |  |  |  +--:(ospf-pseudonode-case)
2256             |  |  |  |     +--ro ospf-pseudonode
2257             |  |  |  |        +--ro ospf-router-id    uint32
2258             |  |  |  |        +--ro lan-interface     ospf-interface-identifier
2259             |  |  |  +--ro bgp-router-id?     inet:ipv4-address
2260             |  |  |  +--ro member-asn?        inet:as-number
2261             |  |  +--ro remote-node-descriptors
2262             |  |  |  +--ro as-number?         inet:as-number
2263             |  |  |  +--ro area-id?           area-identifier
2264             |  |  |  +--ro domain-id?         domain-identifier
2265             |  |  |  +--ro (c-router-identifier)?
2266             |  |  |  |  +--:(isis-node-case)
2267             |  |  |  |  |  +--ro isis-node
2268             |  |  |  |  |     +--ro iso-system-id    netc:iso-system-identifier
2269             |  |  |  |  +--:(isis-pseudonode-case)
2270             |  |  |  |  |  +--ro isis-pseudonode
2271             |  |  |  |  |     +--ro is-is-router-identifier
2272             |  |  |  |  |     |  +--ro iso-system-id    netc:iso-system-identifier
2273             |  |  |  |  |     +--ro psn                        uint8
2274             |  |  |  |  +--:(ospf-node-case)
2275             |  |  |  |  |  +--ro ospf-node
2276             |  |  |  |  |     +--ro ospf-router-id    uint32
2277             |  |  |  |  +--:(ospf-pseudonode-case)
2278             |  |  |  |     +--ro ospf-pseudonode
2279             |  |  |  |        +--ro ospf-router-id    uint32
2280             |  |  |  |        +--ro lan-interface     ospf-interface-identifier
2281             |  |  |  +--ro bgp-router-id?     inet:ipv4-address
2282             |  |  |  +--ro member-asn?        inet:as-number
2283             |  |  +--ro link-descriptors
2284             |  |     +--ro link-local-identifier?    uint32
2285             |  |     +--ro link-remote-identifier?   uint32
2286             |  |     +--ro ipv4-interface-address?   ipv4-interface-identifier
2287             |  |     +--ro ipv6-interface-address?   ipv6-interface-identifier
2288             |  |     +--ro ipv4-neighbor-address?    ipv4-interface-identifier
2289             |  |     +--ro ipv6-neighbor-address?    ipv6-interface-identifier
2290             |  |     +--ro multi-topology-id?        topology-identifier
2291             |  +--:(prefix-case)
2292             |  |  +--ro advertising-node-descriptors
2293             |  |  |  +--ro as-number?         inet:as-number
2294             |  |  |  +--ro area-id?           area-identifier
2295             |  |  |  +--ro domain-id?         domain-identifier
2296             |  |  |  +--ro (c-router-identifier)?
2297             |  |  |     +--:(isis-node-case)
2298             |  |  |     |  +--ro isis-node
2299             |  |  |     |     +--ro iso-system-id    netc:iso-system-identifier
2300             |  |  |     +--:(isis-pseudonode-case)
2301             |  |  |     |  +--ro isis-pseudonode
2302             |  |  |     |     +--ro is-is-router-identifier
2303             |  |  |     |     |  +--ro iso-system-id    netc:iso-system-identifier
2304             |  |  |     |     +--ro psn                        uint8
2305             |  |  |     +--:(ospf-node-case)
2306             |  |  |     |  +--ro ospf-node
2307             |  |  |     |     +--ro ospf-router-id    uint32
2308             |  |  |     +--:(ospf-pseudonode-case)
2309             |  |  |        +--ro ospf-pseudonode
2310             |  |  |           +--ro ospf-router-id    uint32
2311             |  |  |           +--ro lan-interface     ospf-interface-identifier
2312             |  |  +--ro prefix-descriptors
2313             |  |     +--ro multi-topology-id?             topology-identifier
2314             |  |     +--ro ospf-route-type?               ospf-route-type
2315             |  |     +--ro ip-reachability-information?   inet:ip-prefix
2316             |  +--:(te-lsp-case)
2317             |     +--ro (address-family)?
2318             |     |  +--:(ipv4-case)
2319             |     |  |  +--ro ipv4-tunnel-sender-address      inet:ipv4-address
2320             |     |  |  +--ro ipv4-tunnel-endpoint-address    inet:ipv4-address
2321             |     |  +--:(ipv6-case)
2322             |     |     +--ro ipv6-tunnel-sender-address      inet:ipv6-address
2323             |     |     +--ro ipv6-tunnel-endpoint-address    inet:ipv6-address
2324             |     +--ro tunnel-id?                      rsvp:tunnel-id
2325             |     +--ro lsp-id?                         rsvp:lsp-id
2326             +--ro attributes
2327                +--ro (link-state-attribute)?
2328                   +--:(node-attributes-case)
2329                   |  +--ro node-attributes
2330                   |     +--ro topology-identifier*   topology-identifier
2331                   |     +--ro node-flags?            node-flag-bits
2332                   |     +--ro isis-area-id*          isis-area-identifier
2333                   |     +--ro dynamic-hostname?      string
2334                   |     +--ro ipv4-router-id?        ipv4-router-identifier
2335                   |     +--ro ipv6-router-id?        ipv6-router-identifier
2336                   |     +--ro sr-capabilities
2337                   |     |  +--ro mpls-ipv4?      boolean
2338                   |     |  +--ro mpls-ipv6?      boolean
2339                   |     |  +--ro sr-ipv6?        boolean
2340                   |     |  +--ro range-size?     uint32
2341                   |     |  +--ro (sid-label-index)?
2342                   |     |     +--:(local-label-case)
2343                   |     |     |  +--ro local-label?    netc:mpls-label
2344                   |     |     +--:(ipv6-address-case)
2345                   |     |     |  +--ro ipv6-address?   inet:ipv6-address
2346                   |     |     +--:(sid-case)
2347                   |     |        +--ro sid?            uint32
2348                   |     +--ro sr-algorithm
2349                   |        +--ro algorithms*   algorithm
2350                   +--:(link-attributes-case)
2351                   |  +--ro link-attributes
2352                   |     +--ro local-ipv4-router-id?       ipv4-router-identifier
2353                   |     +--ro local-ipv6-router-id?       ipv6-router-identifier
2354                   |     +--ro remote-ipv4-router-id?      ipv4-router-identifier
2355                   |     +--ro remote-ipv6-router-id?      ipv6-router-identifier
2356                   |     +--ro mpls-protocol?              mpls-protocol-mask
2357                   |     +--ro te-metric?                  netc:te-metric
2358                   |     +--ro metric?                     netc:metric
2359                   |     +--ro shared-risk-link-groups*    rsvp:srlg-id
2360                   |     +--ro link-name?                  string
2361                   |     +--ro max-link-bandwidth?         netc:bandwidth
2362                   |     +--ro max-reservable-bandwidth?   netc:bandwidth
2363                   |     +--ro unreserved-bandwidth* [priority]
2364                   |     |  +--ro priority     uint8
2365                   |     |  +--ro bandwidth?   netc:bandwidth
2366                   |     +--ro link-protection?            link-protection-type
2367                   |     +--ro admin-group?                administrative-group
2368                   |     +--ro sr-adj-ids*
2369                   |     |  +--ro (flags)?
2370                   |     |  |  +--:(ospf-adj-flags-case)
2371                   |     |  |  |  +--ro backup?           boolean
2372                   |     |  |  |  +--ro set?              boolean
2373                   |     |  |  +--:(isis-adj-flags-case)
2374                   |     |  |     +--ro backup?           boolean
2375                   |     |  |     +--ro set?              boolean
2376                   |     |  |     +--ro address-family?   boolean
2377                   |     |  +--ro weight?           weight
2378                   |     |  +--ro (sid-label-index)?
2379                   |     |     +--:(local-label-case)
2380                   |     |     |  +--ro local-label?      netc:mpls-label
2381                   |     |     +--:(ipv6-address-case)
2382                   |     |     |  +--ro ipv6-address?     inet:ipv6-address
2383                   |     |     +--:(sid-case)
2384                   |     |        +--ro sid?              uint32
2385                   |     +--ro sr-lan-adj-ids*
2386                   |     |  +--ro (flags)?
2387                   |     |  |  +--:(ospf-adj-flags-case)
2388                   |     |  |  |  +--ro backup?           boolean
2389                   |     |  |  |  +--ro set?              boolean
2390                   |     |  |  +--:(isis-adj-flags-case)
2391                   |     |  |     +--ro backup?           boolean
2392                   |     |  |     +--ro set?              boolean
2393                   |     |  |     +--ro address-family?   boolean
2394                   |     |  +--ro weight?           weight
2395                   |     |  +--ro iso-system-id?    netc:iso-system-identifier
2396                   |     |  +--ro neighbor-id?      inet:ipv4-address
2397                   |     |  +--ro (sid-label-index)?
2398                   |     |     +--:(local-label-case)
2399                   |     |     |  +--ro local-label?      netc:mpls-label
2400                   |     |     +--:(ipv6-address-case)
2401                   |     |     |  +--ro ipv6-address?     inet:ipv6-address
2402                   |     |     +--:(sid-case)
2403                   |     |        +--ro sid?              uint32
2404                   |     +--ro peer-node-sid
2405                   |     |  +--ro weight?         weight
2406                   |     |  +--ro (sid-label-index)?
2407                   |     |     +--:(local-label-case)
2408                   |     |     |  +--ro local-label?    netc:mpls-label
2409                   |     |     +--:(ipv6-address-case)
2410                   |     |     |  +--ro ipv6-address?   inet:ipv6-address
2411                   |     |     +--:(sid-case)
2412                   |     |        +--ro sid?            uint32
2413                   |     +--ro peer-adj-sid
2414                   |     |  +--ro weight?         weight
2415                   |     |  +--ro (sid-label-index)?
2416                   |     |     +--:(local-label-case)
2417                   |     |     |  +--ro local-label?    netc:mpls-label
2418                   |     |     +--:(ipv6-address-case)
2419                   |     |     |  +--ro ipv6-address?   inet:ipv6-address
2420                   |     |     +--:(sid-case)
2421                   |     |        +--ro sid?            uint32
2422                   |     +--ro peer-set-sids*
2423                   |        +--ro weight?         weight
2424                   |        +--ro (sid-label-index)?
2425                   |           +--:(local-label-case)
2426                   |           |  +--ro local-label?    netc:mpls-label
2427                   |           +--:(ipv6-address-case)
2428                   |           |  +--ro ipv6-address?   inet:ipv6-address
2429                   |           +--:(sid-case)
2430                   |              +--ro sid?            uint32
2431                   +--:(prefix-attributes-case)
2432                   |  +--ro prefix-attributes
2433                   |     +--ro igp-bits
2434                   |     |  x--ro up-down?               bits
2435                   |     |  +--ro is-is-up-down?         boolean
2436                   |     |  +--ro ospf-no-unicast?       boolean
2437                   |     |  +--ro ospf-local-address?    boolean
2438                   |     |  +--ro ospf-propagate-nssa?   boolean
2439                   |     +--ro route-tags*                route-tag
2440                   |     +--ro extended-tags*             extended-route-tag
2441                   |     +--ro prefix-metric?             netc:igp-metric
2442                   |     +--ro ospf-forwarding-address?   inet:ip-address
2443                   |     +--ro sr-prefix
2444                   |     |  +--ro (flags)?
2445                   |     |  |  +--:(isis-prefix-flags-case)
2446                   |     |  |  |  +--ro no-php?            boolean
2447                   |     |  |  |  +--ro explicit-null?     boolean
2448                   |     |  |  |  +--ro readvertisement?   boolean
2449                   |     |  |  |  +--ro node-sid?          boolean
2450                   |     |  |  +--:(ospf-prefix-flags-case)
2451                   |     |  |     +--ro no-php?            boolean
2452                   |     |  |     +--ro explicit-null?     boolean
2453                   |     |  |     +--ro mapping-server?    boolean
2454                   |     |  +--ro algorithm?         algorithm
2455                   |     |  +--ro (sid-label-index)?
2456                   |     |     +--:(local-label-case)
2457                   |     |     |  +--ro local-label?       netc:mpls-label
2458                   |     |     +--:(ipv6-address-case)
2459                   |     |     |  +--ro ipv6-address?      inet:ipv6-address
2460                   |     |     +--:(sid-case)
2461                   |     |        +--ro sid?               uint32
2462                   |     +--ro ipv6-sr-prefix
2463                   |     |  +--ro algorithm?   algorithm
2464                   |     +--ro sr-range
2465                   |     |  +--ro inter-area?   boolean
2466                   |     |  +--ro range-size?   uint16
2467                   |     |  +--ro sub-tlvs*
2468                   |     |     +--ro (range-sub-tlv)?
2469                   |     |        +--:(binding-sid-tlv-case)
2470                   |     |        |  +--ro weight?                weight
2471                   |     |        |  +--ro (flags)?
2472                   |     |        |  |  +--:(isis-binding-flags-case)
2473                   |     |        |  |  |  +--ro address-family?        boolean
2474                   |     |        |  |  |  +--ro mirror-context?        boolean
2475                   |     |        |  |  |  +--ro spread-tlv?            boolean
2476                   |     |        |  |  |  +--ro leaked-from-level-2?   boolean
2477                   |     |        |  |  |  +--ro attached-flag?         boolean
2478                   |     |        |  |  +--:(ospf-binding-flags-case)
2479                   |     |        |  |     +--ro mirroring?             boolean
2480                   |     |        |  +--ro binding-sub-tlvs*
2481                   |     |        |     +--ro (binding-sub-tlv)?
2482                   |     |        |        +--:(prefix-sid-case)
2483                   |     |        |        |  +--ro (flags)?
2484                   |     |        |        |  |  +--:(isis-prefix-flags-case)
2485                   |     |        |        |  |  |  +--ro no-php?            boolean
2486                   |     |        |        |  |  |  +--ro explicit-null?     boolean
2487                   |     |        |        |  |  |  +--ro readvertisement?   boolean
2488                   |     |        |        |  |  |  +--ro node-sid?          boolean
2489                   |     |        |        |  |  +--:(ospf-prefix-flags-case)
2490                   |     |        |        |  |     +--ro no-php?            boolean
2491                   |     |        |        |  |     +--ro explicit-null?     boolean
2492                   |     |        |        |  |     +--ro mapping-server?    boolean
2493                   |     |        |        |  +--ro algorithm?         algorithm
2494                   |     |        |        |  +--ro (sid-label-index)?
2495                   |     |        |        |     +--:(local-label-case)
2496                   |     |        |        |     |  +--ro local-label?       netc:mpls-label
2497                   |     |        |        |     +--:(ipv6-address-case)
2498                   |     |        |        |     |  +--ro ipv6-address?      inet:ipv6-address
2499                   |     |        |        |     +--:(sid-case)
2500                   |     |        |        |        +--ro sid?               uint32
2501                   |     |        |        +--:(ipv6-prefix-sid-case)
2502                   |     |        |        |  +--ro algorithm?         algorithm
2503                   |     |        |        +--:(sid-label-case)
2504                   |     |        |        |  +--ro (sid-label-index)?
2505                   |     |        |        |     +--:(local-label-case)
2506                   |     |        |        |     |  +--ro local-label?       netc:mpls-label
2507                   |     |        |        |     +--:(ipv6-address-case)
2508                   |     |        |        |     |  +--ro ipv6-address?      inet:ipv6-address
2509                   |     |        |        |     +--:(sid-case)
2510                   |     |        |        |        +--ro sid?               uint32
2511                   |     |        |        +--:(ero-metric-case)
2512                   |     |        |        |  +--ro ero-metric?        netc:te-metric
2513                   |     |        |        +--:(ipv4-ero-case)
2514                   |     |        |        |  +--ro loose?             boolean
2515                   |     |        |        |  +--ro address            inet:ipv4-address
2516                   |     |        |        +--:(ipv6-ero-case)
2517                   |     |        |        |  +--ro loose?             boolean
2518                   |     |        |        |  +--ro address            inet:ipv6-address
2519                   |     |        |        +--:(unnumbered-interface-id-ero-case)
2520                   |     |        |        |  +--ro loose?             boolean
2521                   |     |        |        |  +--ro router-id?         uint32
2522                   |     |        |        |  +--ro interface-id?      uint32
2523                   |     |        |        +--:(ipv4-ero-backup-case)
2524                   |     |        |        |  +--ro loose?             boolean
2525                   |     |        |        |  +--ro address            inet:ipv4-address
2526                   |     |        |        +--:(ipv6-ero-backup-case)
2527                   |     |        |        |  +--ro loose?             boolean
2528                   |     |        |        |  +--ro address            inet:ipv6-address
2529                   |     |        |        +--:(unnumbered-interface-id-backup-ero-case)
2530                   |     |        |           +--ro loose?             boolean
2531                   |     |        |           +--ro router-id?         uint32
2532                   |     |        |           +--ro interface-id?      uint32
2533                   |     |        +--:(prefix-sid-tlv-case)
2534                   |     |        |  +--ro (flags)?
2535                   |     |        |  |  +--:(isis-prefix-flags-case)
2536                   |     |        |  |  |  +--ro no-php?                boolean
2537                   |     |        |  |  |  +--ro explicit-null?         boolean
2538                   |     |        |  |  |  +--ro readvertisement?       boolean
2539                   |     |        |  |  |  +--ro node-sid?              boolean
2540                   |     |        |  |  +--:(ospf-prefix-flags-case)
2541                   |     |        |  |     +--ro no-php?                boolean
2542                   |     |        |  |     +--ro explicit-null?         boolean
2543                   |     |        |  |     +--ro mapping-server?        boolean
2544                   |     |        |  +--ro algorithm?             algorithm
2545                   |     |        |  +--ro (sid-label-index)?
2546                   |     |        |     +--:(local-label-case)
2547                   |     |        |     |  +--ro local-label?           netc:mpls-label
2548                   |     |        |     +--:(ipv6-address-case)
2549                   |     |        |     |  +--ro ipv6-address?          inet:ipv6-address
2550                   |     |        |     +--:(sid-case)
2551                   |     |        |        +--ro sid?                   uint32
2552                   |     |        +--:(ipv6-prefix-sid-tlv-case)
2553                   |     |        |  +--ro algorithm?             algorithm
2554                   |     |        +--:(sid-label-tlv-case)
2555                   |     |           +--ro (sid-label-index)?
2556                   |     |              +--:(local-label-case)
2557                   |     |              |  +--ro local-label?           netc:mpls-label
2558                   |     |              +--:(ipv6-address-case)
2559                   |     |              |  +--ro ipv6-address?          inet:ipv6-address
2560                   |     |              +--:(sid-case)
2561                   |     |                 +--ro sid?                   uint32
2562                   |     +--ro sr-binding-sid-labels*
2563                   |        +--ro weight?                weight
2564                   |        +--ro (flags)?
2565                   |        |  +--:(isis-binding-flags-case)
2566                   |        |  |  +--ro address-family?        boolean
2567                   |        |  |  +--ro mirror-context?        boolean
2568                   |        |  |  +--ro spread-tlv?            boolean
2569                   |        |  |  +--ro leaked-from-level-2?   boolean
2570                   |        |  |  +--ro attached-flag?         boolean
2571                   |        |  +--:(ospf-binding-flags-case)
2572                   |        |     +--ro mirroring?             boolean
2573                   |        +--ro binding-sub-tlvs*
2574                   |           +--ro (binding-sub-tlv)?
2575                   |              +--:(prefix-sid-case)
2576                   |              |  +--ro (flags)?
2577                   |              |  |  +--:(isis-prefix-flags-case)
2578                   |              |  |  |  +--ro no-php?            boolean
2579                   |              |  |  |  +--ro explicit-null?     boolean
2580                   |              |  |  |  +--ro readvertisement?   boolean
2581                   |              |  |  |  +--ro node-sid?          boolean
2582                   |              |  |  +--:(ospf-prefix-flags-case)
2583                   |              |  |     +--ro no-php?            boolean
2584                   |              |  |     +--ro explicit-null?     boolean
2585                   |              |  |     +--ro mapping-server?    boolean
2586                   |              |  +--ro algorithm?         algorithm
2587                   |              |  +--ro (sid-label-index)?
2588                   |              |     +--:(local-label-case)
2589                   |              |     |  +--ro local-label?       netc:mpls-label
2590                   |              |     +--:(ipv6-address-case)
2591                   |              |     |  +--ro ipv6-address?      inet:ipv6-address
2592                   |              |     +--:(sid-case)
2593                   |              |        +--ro sid?               uint32
2594                   |              +--:(ipv6-prefix-sid-case)
2595                   |              |  +--ro algorithm?         algorithm
2596                   |              +--:(sid-label-case)
2597                   |              |  +--ro (sid-label-index)?
2598                   |              |     +--:(local-label-case)
2599                   |              |     |  +--ro local-label?       netc:mpls-label
2600                   |              |     +--:(ipv6-address-case)
2601                   |              |     |  +--ro ipv6-address?      inet:ipv6-address
2602                   |              |     +--:(sid-case)
2603                   |              |        +--ro sid?               uint32
2604                   |              +--:(ero-metric-case)
2605                   |              |  +--ro ero-metric?        netc:te-metric
2606                   |              +--:(ipv4-ero-case)
2607                   |              |  +--ro loose?             boolean
2608                   |              |  +--ro address            inet:ipv4-address
2609                   |              +--:(ipv6-ero-case)
2610                   |              |  +--ro loose?             boolean
2611                   |              |  +--ro address            inet:ipv6-address
2612                   |              +--:(unnumbered-interface-id-ero-case)
2613                   |              |  +--ro loose?             boolean
2614                   |              |  +--ro router-id?         uint32
2615                   |              |  +--ro interface-id?      uint32
2616                   |              +--:(ipv4-ero-backup-case)
2617                   |              |  +--ro loose?             boolean
2618                   |              |  +--ro address            inet:ipv4-address
2619                   |              +--:(ipv6-ero-backup-case)
2620                   |              |  +--ro loose?             boolean
2621                   |              |  +--ro address            inet:ipv6-address
2622                   |              +--:(unnumbered-interface-id-backup-ero-case)
2623                   |                 +--ro loose?             boolean
2624                   |                 +--ro router-id?         uint32
2625                   |                 +--ro interface-id?      uint32
2626                   x--:(te-lsp-attributes-case)
2627                      +--ro te-lsp-attributes
2628
2629
2630 Usage
2631 ^^^^^
2632 The Link-State table in a instance of the speaker's Loc-RIB can be verified via REST:
2633
2634 **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``
2635
2636 **Method:** ``GET``
2637
2638 **Response Body:**
2639
2640 .. code-block:: xml
2641
2642    <linkstate-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-linkstate">
2643       ...
2644    </linkstate-routes>
2645
2646 .. note:: Link-State routes mapping to topology links/nodes/prefixes is supported by BGP Topology Provider.
2647
2648 References
2649 ^^^^^^^^^^
2650 * `North-Bound Distribution of Link-State and Traffic Engineering (TE) Information Using BGP <https://tools.ietf.org/html/rfc7752>`_
2651 * `BGP Link-State extensions for Segment Routing <https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-03>`_
2652 * `Segment Routing BGP Egress Peer Engineering BGP-LS Extensions <https://tools.ietf.org/html/draft-ietf-idr-bgpls-segment-routing-epe-05>`_
2653 * `BGP Link-State Information Distribution Implementation Report <https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-impl-04>`_
2654
2655 Flow Specification Family
2656 -------------------------
2657 The BGP Flow Specification (BGP-FS) Multiprotocol extension can be used to distribute traffic flow specifications.
2658 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).
2659
2660 .. contents:: Contents
2661    :depth: 2
2662    :local:
2663
2664 Configuration
2665 ^^^^^^^^^^^^^
2666 This section shows a way to enable BGP-FS family in BGP speaker and peer configuration.
2667
2668 BGP Speaker
2669 '''''''''''
2670 To enable BGP-FS support in BGP plugin, first configure BGP speaker instance:
2671
2672 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
2673
2674 **Method:** ``POST``
2675
2676 **Content-Type:** ``application/xml``
2677
2678 **Request Body:**
2679
2680 .. code-block:: xml
2681
2682    <protocol xmlns="http://openconfig.net/yang/network-instance">
2683        <name>bgp-example</name>
2684        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
2685        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2686            <global>
2687                <config>
2688                    <router-id>192.0.2.2</router-id>
2689                    <as>65000</as>
2690                </config>
2691                <afi-safis>
2692                    <afi-safi>
2693                        <afi-safi-name>IPV4-FLOW</afi-safi-name>
2694                    </afi-safi>
2695                    <afi-safi>
2696                        <afi-safi-name>IPV6-FLOW</afi-safi-name>
2697                    </afi-safi>
2698                    <afi-safi>
2699                        <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
2700                    </afi-safi>
2701                    <afi-safi>
2702                        <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
2703                    </afi-safi>
2704                </afi-safis>
2705            </global>
2706        </bgp>
2707    </protocol>
2708
2709 BGP Peer
2710 ''''''''
2711 Here is an example for BGP peer configuration with enabled BGP-FS family.
2712
2713 **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``
2714
2715 **Method:** ``POST``
2716
2717 **Content-Type:** ``application/xml``
2718
2719 **Request Body:**
2720
2721 .. code-block:: xml
2722
2723    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2724        <neighbor-address>192.0.2.1</neighbor-address>
2725        <afi-safis>
2726            <afi-safi>
2727                <afi-safi-name>IPV4-FLOW</afi-safi-name>
2728            </afi-safi>
2729            <afi-safi>
2730                <afi-safi-name>IPV6-FLOW</afi-safi-name>
2731            </afi-safi>
2732            <afi-safi>
2733                <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
2734            </afi-safi>
2735            <afi-safi>
2736                <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
2737            </afi-safi>
2738        </afi-safis>
2739    </neighbor>
2740
2741 Flow Specification API
2742 ^^^^^^^^^^^^^^^^^^^^^^
2743 Following trees illustrate the BGP Flow Specification routes structure.
2744
2745 IPv4 Flow Specification Route
2746 '''''''''''''''''''''''''''''
2747 .. code-block:: console
2748
2749    :(flowspec-routes-case)
2750      +--ro flowspec-routes
2751         +--ro flowspec-route* [route-key path-id]
2752            +--ro route-key     string
2753            +--ro flowspec*
2754            |  +--ro (flowspec-type)?
2755            |     +--:(port-case)
2756            |     |  +--ro ports*
2757            |     |     +--ro op?      numeric-operand
2758            |     |     +--ro value?   uint16
2759            |     +--:(destination-port-case)
2760            |     |  +--ro destination-ports*
2761            |     |     +--ro op?      numeric-operand
2762            |     |     +--ro value?   uint16
2763            |     +--:(source-port-case)
2764            |     |  +--ro source-ports*
2765            |     |     +--ro op?      numeric-operand
2766            |     |     +--ro value?   uint16
2767            |     +--:(icmp-type-case)
2768            |     |  +--ro types*
2769            |     |     +--ro op?      numeric-operand
2770            |     |     +--ro value?   uint8
2771            |     +--:(icmp-code-case)
2772            |     |  +--ro codes*
2773            |     |     +--ro op?      numeric-operand
2774            |     |     +--ro value?   uint8
2775            |     +--:(tcp-flags-case)
2776            |     |  +--ro tcp-flags*
2777            |     |     +--ro op?      bitmask-operand
2778            |     |     +--ro value?   uint16
2779            |     +--:(packet-length-case)
2780            |     |  +--ro packet-lengths*
2781            |     |     +--ro op?      numeric-operand
2782            |     |     +--ro value?   uint16
2783            |     +--:(dscp-case)
2784            |     |  +--ro dscps*
2785            |     |     +--ro op?      numeric-operand
2786            |     |     +--ro value?   dscp
2787            |     +--:(fragment-case)
2788            |     |  +--ro fragments*
2789            |     |     +--ro op?      bitmask-operand
2790            |     |     +--ro value?   fragment
2791            |     +--:(destination-prefix-case)
2792            |     |  +--ro destination-prefix?   inet:ipv4-prefix
2793            |     +--:(source-prefix-case)
2794            |     |  +--ro source-prefix?        inet:ipv4-prefix
2795            |     +--:(protocol-ip-case)
2796            |        +--ro protocol-ips*
2797            |           +--ro op?      numeric-operand
2798            |           +--ro value?   uint8
2799            +--ro path-id       path-id
2800            +--ro attributes
2801               +--ro extended-communities*
2802                  +--ro transitive?                             boolean
2803                  +--ro (extended-community)?
2804                     +--:(traffic-rate-extended-community-case)
2805                     |  +--ro traffic-rate-extended-community
2806                     |     +--ro informative-as?        bgp-t:short-as-number
2807                     |     +--ro local-administrator?   netc:bandwidth
2808                     +--:(traffic-action-extended-community-case)
2809                     |  +--ro traffic-action-extended-community
2810                     |     +--ro sample?            boolean
2811                     |     +--ro terminal-action?   boolean
2812                     +--:(redirect-extended-community-case)
2813                     |  +--ro redirect-extended-community
2814                     |     +--ro global-administrator?   bgp-t:short-as-number
2815                     |     +--ro local-administrator?    binary
2816                     +--:(traffic-marking-extended-community-case)
2817                     |  +--ro traffic-marking-extended-community
2818                     |     +--ro global-administrator?   dscp
2819                     +--:(redirect-ipv4-extended-community-case)
2820                     |  +--ro redirect-ipv4
2821                     |     +--ro global-administrator?   inet:ipv4-address
2822                     |     +--ro local-administrator?    uint16
2823                     +--:(redirect-as4-extended-community-case)
2824                     |  +--ro redirect-as4
2825                     |     +--ro global-administrator?   inet:as-number
2826                     |     +--ro local-administrator?    uint16
2827                     +--:(redirect-ip-nh-extended-community-case)
2828                       +--ro redirect-ip-nh-extended-community
2829                          +--ro next-hop-address?   inet:ip-address
2830                          +--ro copy?               boolean
2831
2832
2833 IPv6 Flow Specification Route
2834 '''''''''''''''''''''''''''''
2835 .. code-block:: console
2836
2837    :(flowspec-ipv6-routes-case)
2838      +--ro flowspec-ipv6-routes
2839         +--ro flowspec-route* [route-key path-id]
2840            +--ro flowspec*
2841            |  +--ro (flowspec-type)?
2842            |     +--:(port-case)
2843            |     |  +--ro ports*
2844            |     |     +--ro op?      numeric-operand
2845            |     |     +--ro value?   uint16
2846            |     +--:(destination-port-case)
2847            |     |  +--ro destination-ports*
2848            |     |     +--ro op?      numeric-operand
2849            |     |     +--ro value?   uint16
2850            |     +--:(source-port-case)
2851            |     |  +--ro source-ports*
2852            |     |     +--ro op?      numeric-operand
2853            |     |     +--ro value?   uint16
2854            |     +--:(icmp-type-case)
2855            |     |  +--ro types*
2856            |     |     +--ro op?      numeric-operand
2857            |     |     +--ro value?   uint8
2858            |     +--:(icmp-code-case)
2859            |     |  +--ro codes*
2860            |     |     +--ro op?      numeric-operand
2861            |     |     +--ro value?   uint8
2862            |     +--:(tcp-flags-case)
2863            |     |  +--ro tcp-flags*
2864            |     |     +--ro op?      bitmask-operand
2865            |     |     +--ro value?   uint16
2866            |     +--:(packet-length-case)
2867            |     |  +--ro packet-lengths*
2868            |     |     +--ro op?      numeric-operand
2869            |     |     +--ro value?   uint16
2870            |     +--:(dscp-case)
2871            |     |  +--ro dscps*
2872            |     |     +--ro op?      numeric-operand
2873            |     |     +--ro value?   dscp
2874            |     +--:(fragment-case)
2875            |     |  +--ro fragments*
2876            |     |     +--ro op?      bitmask-operand
2877            |     |     +--ro value?   fragment
2878            |     +--:(destination-ipv6-prefix-case)
2879            |     |  +--ro destination-prefix?   inet:ipv6-prefix
2880            |     +--:(source-ipv6-prefix-case)
2881            |     |  +--ro source-prefix?        inet:ipv6-prefix
2882            |     +--:(next-header-case)
2883            |     |  +--ro next-headers*
2884            |     |     +--ro op?      numeric-operand
2885            |     |     +--ro value?   uint8
2886            |     +--:(flow-label-case)
2887            |        +--ro flow-label*
2888            |           +--ro op?      numeric-operand
2889            |           +--ro value?   uint32
2890            +--ro path-id       path-id
2891            +--ro attributes
2892               +--ro extended-communities*
2893                  +--ro transitive?                             boolean
2894                  +--ro (extended-community)?
2895                     +--:(traffic-rate-extended-community-case)
2896                     |  +--ro traffic-rate-extended-community
2897                     |     +--ro informative-as?        bgp-t:short-as-number
2898                     |     +--ro local-administrator?   netc:bandwidth
2899                     +--:(traffic-action-extended-community-case)
2900                     |  +--ro traffic-action-extended-community
2901                     |     +--ro sample?            boolean
2902                     |     +--ro terminal-action?   boolean
2903                     +--:(redirect-extended-community-case)
2904                     |  +--ro redirect-extended-community
2905                     |     +--ro global-administrator?   bgp-t:short-as-number
2906                     |     +--ro local-administrator?    binary
2907                     +--:(traffic-marking-extended-community-case)
2908                     |  +--ro traffic-marking-extended-community
2909                     |     +--ro global-administrator?   dscp
2910                     +--:(redirect-ipv6-extended-community-case)
2911                     |  +--ro redirect-ipv6
2912                     |     +--ro global-administrator?   inet:ipv6-address
2913                     |     +--ro local-administrator?    uint16
2914                     +--:(redirect-as4-extended-community-case)
2915                     |  +--ro redirect-as4
2916                     |     +--ro global-administrator?   inet:as-number
2917                     |     +--ro local-administrator?    uint16
2918                     +--:(redirect-ip-nh-extended-community-case)
2919                        +--ro redirect-ip-nh-extended-community
2920                           +--ro next-hop-address?   inet:ip-address
2921                           +--ro copy?               boolean
2922
2923 Usage
2924 ^^^^^
2925 The flowspec route represents rules and an action, defined as an extended community.
2926
2927 IPv4 Flow Specification
2928 '''''''''''''''''''''''
2929 The IPv4 Flowspec table in an instance of the speaker's Loc-RIB can be verified via REST:
2930
2931 **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``
2932
2933 **Method:** ``GET``
2934
2935 **Response Body:**
2936
2937 .. code-block:: xml
2938
2939    <flowspec-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
2940        <flowspec-route>
2941            <path-id>0</path-id>
2942            <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>
2943            <attributes>
2944                <local-pref>
2945                    <pref>100</pref>
2946                </local-pref>
2947                <origin>
2948                    <value>igp</value>
2949                </origin>
2950                <as-path></as-path>
2951                <extended-communities>
2952                    <transitive>true</transitive>
2953                    <redirect-extended-community>
2954                        <local-administrator>AgMWLg==</local-administrator>
2955                        <global-administrator>258</global-administrator>
2956                    </redirect-extended-community>
2957                </extended-communities>
2958            </attributes>
2959            <flowspec>
2960                <destination-prefix>192.168.0.1/32</destination-prefix>
2961            </flowspec>
2962            <flowspec>
2963                <source-prefix>10.0.0.2/32</source-prefix>
2964            </flowspec>
2965            <flowspec>
2966                <protocol-ips>
2967                    <op>equals</op>
2968                    <value>17</value>
2969                </protocol-ips>
2970                <protocol-ips>
2971                    <op>equals end-of-list</op>
2972                    <value>6</value>
2973                </protocol-ips>
2974            </flowspec>
2975            <flowspec>
2976                <ports>
2977                    <op>equals</op>
2978                    <value>80</value>
2979                </ports>
2980                <ports>
2981                    <op>equals end-of-list</op>
2982                    <value>8080</value>
2983                </ports>
2984            </flowspec>
2985            <flowspec>
2986                <destination-ports>
2987                    <op>greater-than</op>
2988                    <value>8080</value>
2989                </destination-ports>
2990                <destination-ports>
2991                    <op>less-than and-bit</op>
2992                    <value>8088</value>
2993                </destination-ports>
2994                <destination-ports>
2995                    <op>equals end-of-list</op>
2996                    <value>3128</value>
2997                </destination-ports>
2998            </flowspec>
2999            <flowspec>
3000                <source-ports>
3001                    <op>end-of-list greater-than</op>
3002                    <value>1024</value>
3003                </source-ports>
3004            </flowspec>
3005        </flowspec-route>
3006    </flowspec-routes>
3007
3008 IPv6 Flows Specification
3009 ''''''''''''''''''''''''
3010 The IPv6 Flowspec table in an instance of the speaker's Loc-RIB can be verified via REST:
3011
3012 **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``
3013
3014 **Method:** ``GET``
3015
3016 **Response Body:**
3017
3018 .. code-block:: xml
3019
3020    <flowspec-ipv6-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3021        <flowspec-route>
3022            <path-id>0</path-id>
3023            <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>
3024            <attributes>
3025                <local-pref>
3026                    <pref>100</pref>
3027                </local-pref>
3028                <origin>
3029                    <value>igp</value>
3030                </origin>
3031                <as-path></as-path>
3032                <extended-communities>
3033                    <transitive>true</transitive>
3034                    <traffic-rate-extended-community>
3035                        <informative-as>0</informative-as>
3036                        <local-administrator>AAAAAA==</local-administrator>
3037                    </traffic-rate-extended-community>
3038                </extended-communities>
3039            </attributes>
3040            <flowspec>
3041                <destination-prefix>2001:db8:31::/64</destination-prefix>
3042            </flowspec>
3043            <flowspec>
3044                <source-prefix>2001:db8:30::/64</source-prefix>
3045            </flowspec>
3046            <flowspec>
3047                <next-headers>
3048                    <op>equals end-of-list</op>
3049                    <value>17</value>
3050                </next-headers>
3051            </flowspec>
3052            <flowspec>
3053                <dscps>
3054                    <op>equals end-of-list</op>
3055                    <value>50</value>
3056                </dscps>
3057            </flowspec>
3058            <flowspec>
3059                <flow-label>
3060                    <op>equals end-of-list</op>
3061                    <value>2013</value>
3062                </flow-label>
3063            </flowspec>
3064        </flowspec-route>
3065    </flowspec-ipv6-routes>
3066
3067 IPv4 L3VPN Flows Specification
3068 ''''''''''''''''''''''''''''''
3069 The IPv4 L3VPN Flowspec table in an instance of the speaker's Loc-RIB can be verified via REST:
3070
3071 **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``
3072
3073 **Method:** ``GET``
3074
3075 **Response Body:**
3076
3077 .. code-block:: xml
3078
3079    <flowspec-l3vpn-ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3080        <flowspec-l3vpn-route>
3081            <path-id>0</path-id>
3082            <route-key>[l3vpn with route-distinguisher 172.16.0.44:101] all packets from 10.0.0.3/32</route-key>
3083            <attributes>
3084                <local-pref>
3085                    <pref>100</pref>
3086                </local-pref>
3087                <ipv4-next-hop>
3088                    <global>5.6.7.8</global>
3089                </ipv4-next-hop>
3090                <origin>
3091                    <value>igp</value>
3092                </origin>
3093                <as-path></as-path>
3094                <extended-communities>
3095                    <transitive>true</transitive>
3096                    <redirect-ip-nh-extended-community>
3097                        <copy>false</copy>
3098                        <next-hop-address>0.0.0.0</next-hop-address>
3099                    </redirect-ip-nh-extended-community>
3100                </extended-communities>
3101            </attributes>
3102            <route-distinguisher>172.16.0.44:101</route-distinguisher>
3103            <flowspec>
3104                <source-prefix>10.0.0.3/32</source-prefix>
3105            </flowspec>
3106        </flowspec-l3vpn-route>
3107    </flowspec-l3vpn-ipv4-routes>
3108
3109 Programming
3110 ^^^^^^^^^^^
3111 IPv4 Flow Specification
3112 '''''''''''''''''''''''
3113 This examples show how to originate and remove IPv4 fowspec route via programmable RIB.
3114 Make sure the *Application Peer* is configured first.
3115
3116 **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``
3117
3118 **Method:** ``POST``
3119
3120 **Content-Type:** ``application/xml``
3121
3122 **Request Body:**
3123
3124 .. code-block:: xml
3125
3126    <flowspec-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3127        <route-key>flow1</route-key>
3128        <path-id>0</path-id>
3129        <flowspec>
3130            <destination-prefix>192.168.0.1/32</destination-prefix>
3131        </flowspec>
3132        <flowspec>
3133            <source-prefix>10.0.0.1/32</source-prefix>
3134        </flowspec>
3135        <flowspec>
3136            <protocol-ips>
3137                <op>equals end-of-list</op>
3138                <value>6</value>
3139            </protocol-ips>
3140        </flowspec>
3141        <flowspec>
3142            <ports>
3143                <op>equals end-of-list</op>
3144                <value>80</value>
3145            </ports>
3146        </flowspec>
3147        <flowspec>
3148            <destination-ports>
3149                <op>greater-than</op>
3150                <value>8080</value>
3151            </destination-ports>
3152            <destination-ports>
3153                <op>and-bit less-than end-of-list</op>
3154                <value>8088</value>
3155            </destination-ports>
3156        </flowspec>
3157        <flowspec>
3158            <source-ports>
3159                <op>greater-than end-of-list</op>
3160                <value>1024</value>
3161            </source-ports>
3162        </flowspec>
3163        <flowspec>
3164            <types>
3165                <op>equals end-of-list</op>
3166                <value>0</value>
3167            </types>
3168        </flowspec>
3169        <flowspec>
3170            <codes>
3171                <op>equals end-of-list</op>
3172                <value>0</value>
3173            </codes>
3174        </flowspec>
3175        <flowspec>
3176            <tcp-flags>
3177                <op>match end-of-list</op>
3178                <value>32</value>
3179            </tcp-flags>
3180        </flowspec>
3181        <flowspec>
3182            <packet-lengths>
3183                <op>greater-than</op>
3184                <value>400</value>
3185            </packet-lengths>
3186            <packet-lengths>
3187                <op>and-bit less-than end-of-list</op>
3188                <value>500</value>
3189            </packet-lengths>
3190        </flowspec>
3191        <flowspec>
3192            <dscps>
3193                <op>equals end-of-list</op>
3194                <value>20</value>
3195            </dscps>
3196        </flowspec>
3197        <flowspec>
3198            <fragments>
3199                <op>match end-of-list</op>
3200                <value>first</value>
3201            </fragments>
3202        </flowspec>
3203        <attributes>
3204            <origin>
3205                <value>igp</value>
3206            </origin>
3207            <as-path/>
3208            <local-pref>
3209                <pref>100</pref>
3210            </local-pref>
3211            <extended-communities>
3212                ....
3213            </extended-communities>
3214        </attributes>
3215    </flowspec-route>
3216
3217 -----
3218
3219 **Extended Communities**
3220
3221 * **Traffic Rate**
3222    .. code-block:: xml
3223       :linenos:
3224       :emphasize-lines: 5
3225
3226       <extended-communities>
3227           <transitive>true</transitive>
3228           <traffic-rate-extended-community>
3229               <informative-as>123</informative-as>
3230               <local-administrator>AAAAAA==</local-administrator>
3231           </traffic-rate-extended-community>
3232       </extended-communities>
3233
3234    @line 5: A rate in bytes per second, *AAAAAA==* (0) means traffic discard.
3235
3236 * **Traffic Action**
3237    .. code-block:: xml
3238
3239       <extended-communities>
3240           <transitive>true</transitive>
3241           <traffic-action-extended-community>
3242               <sample>true</sample>
3243               <terminal-action>false</terminal-action>
3244           </traffic-action-extended-community>
3245       </extended-communities>
3246
3247
3248 * **Redirect to VRF AS 2byte format**
3249    .. code-block:: xml
3250
3251       <extended-communities>
3252           <transitive>true</transitive>
3253           <redirect-extended-community>
3254               <global-administrator>123</global-administrator>
3255               <local-administrator>AAAAew==</local-administrator>
3256           </redirect-extended-community>
3257       </extended-communities>
3258
3259 * **Redirect to VRF IPv4 format**
3260    .. code-block:: xml
3261
3262       <extended-communities>
3263           <transitive>true</transitive>
3264           <redirect-ipv4>
3265               <global-administrator>192.168.0.1</global-administrator>
3266               <local-administrator>12345</local-administrator>
3267           </redirect-ipv4>
3268       </extended-communities>
3269
3270 * **Redirect to VRF AS 4byte format**
3271    .. code-block:: xml
3272
3273       <extended-communities>
3274           <transitive>true</transitive>
3275           <redirect-as4>
3276               <global-administrator>64495</global-administrator>
3277               <local-administrator>12345</local-administrator>
3278           </redirect-as4>
3279       </extended-communities>
3280
3281 * **Redirect to IP**
3282    .. code-block:: xml
3283
3284       <extended-communities>
3285           <transitive>true</transitive>
3286           <redirect-ip-nh-extended-community>
3287               <copy>false</false>
3288           </redirect-ip-nh-extended-community>
3289       </extended-communities>
3290
3291 * **Traffic Marking**
3292    .. code-block:: xml
3293
3294       <extended-communities>
3295           <transitive>true</transitive>
3296           <traffic-marking-extended-community>
3297               <global-administrator>20</global-administrator>
3298           </traffic-marking-extended-community>
3299       </extended-communities>
3300
3301 -----
3302
3303 To remove the route added above, following request can be used:
3304
3305 **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``
3306
3307 **Method:** ``DELETE``
3308
3309 IPv4 L3VPN Flow Specification
3310 '''''''''''''''''''''''''''''
3311 This examples show how to originate and remove IPv4 L3VPN fowspec route via programmable RIB.
3312
3313 **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``
3314
3315 **Method:** ``POST``
3316
3317 **Content-Type:** ``application/xml``
3318
3319 **Request Body:**
3320
3321 .. code-block:: xml
3322
3323     <flowspec-l3vpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3324         <path-id>0</path-id>
3325         <route-key>flow-l3vpn</route-key>
3326         <route-distinguisher>172.16.0.44:101</route-distinguisher>
3327         <flowspec>
3328             <source-prefix>10.0.0.3/32</source-prefix>
3329         </flowspec>
3330         <attributes>
3331             <local-pref>
3332                 <pref>100</pref>
3333             </local-pref>
3334             <origin>
3335                 <value>igp</value>
3336             </origin>
3337             <as-path></as-path>
3338                <extended-communities>
3339                    <transitive>true</transitive>
3340                    <redirect-ipv4>
3341                        <global-administrator>172.16.0.44</global-administrator>
3342                        <local-administrator>102</local-administrator>
3343                    </redirect-ipv4>
3344                </extended-communities>
3345         </attributes>
3346     </flowspec-l3vpn-route>
3347
3348 -----
3349
3350 To remove the route added above, following request can be used:
3351
3352 **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``
3353
3354 **Method:** ``DELETE``
3355
3356 IPv6 Flow Specification
3357 '''''''''''''''''''''''
3358 This examples show how to originate and remove IPv6 fowspec route via programmable RIB.
3359
3360 **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``
3361
3362 **Method:** ``POST``
3363
3364 **Content-Type:** ``application/xml``
3365
3366 **Request Body:**
3367
3368 .. code-block:: xml
3369
3370    <flowspec-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3371        <route-key>flow-v6</route-key>
3372        <path-id>0</path-id>
3373        <flowspec>
3374            <destination-prefix>2001:db8:30::3/128</destination-prefix>
3375        </flowspec>
3376        <flowspec>
3377            <source-prefix>2001:db8:31::3/128</source-prefix>
3378         </flowspec>
3379        <flowspec>
3380            <flow-label>
3381                <op>equals end-of-list</op>
3382                <value>1</value>
3383            </flow-label>
3384        </flowspec>
3385        <attributes>
3386            <extended-communities>
3387                <transitive>true</transitive>
3388                <redirect-ipv6>
3389                    <global-administrator>2001:db8:1::6</global-administrator>
3390                    <local-administrator>12345</local-administrator>
3391                </redirect-ipv6>
3392            </extended-communities>
3393            <origin>
3394                <value>igp</value>
3395            </origin>
3396            <as-path/>
3397            <local-pref>
3398                <pref>100</pref>
3399            </local-pref>
3400        </attributes>
3401    </flowspec-route>
3402
3403 -----
3404
3405 To remove the route added above, following request can be used:
3406
3407 **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``
3408
3409 **Method:** ``DELETE``
3410
3411 References
3412 ^^^^^^^^^^
3413 * `Dissemination of Flow Specification Rules <https://tools.ietf.org/html/rfc5575>`_
3414 * `Dissemination of Flow Specification Rules for IPv6 <https://tools.ietf.org/html/draft-ietf-idr-flow-spec-v6-07>`_
3415 * `BGP Flow-Spec Extended Community for Traffic Redirect to IP Next Hop <https://tools.ietf.org/html/draft-ietf-idr-flowspec-redirect-ip-00>`_
3416 * `Clarification of the Flowspec Redirect Extended Community <https://tools.ietf.org/html/rfc7674>`_
3417 * `Revised Validation Procedure for BGP Flow Specifications <https://tools.ietf.org/html/draft-ietf-idr-bgp-flowspec-oid-03>`_
3418
3419 EVPN Family
3420 -----------
3421 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.
3422 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.
3423 In addition to MPLS, IP tunnelling encapsulation techniques like VXLAN, NVGRE, MPLSoGRE and others can be used for packet transportation.
3424 Also, Provider Backbone Bridging (PBB) can be combined with EVPN in order to reduce a number of MAC Advertisement routes.
3425
3426 .. contents:: Contents
3427    :depth: 2
3428    :local:
3429
3430 Configuration
3431 ^^^^^^^^^^^^^
3432 This section shows a way to enable EVPN family in BGP speaker and peer configuration.
3433
3434 BGP Speaker
3435 '''''''''''
3436 To enable EVPN support in BGP plugin, first configure BGP speaker instance:
3437
3438 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
3439
3440 **Method:** ``POST``
3441
3442 **Content-Type:** ``application/xml``
3443
3444 **Request Body:**
3445
3446 .. code-block:: xml
3447
3448    <protocol xmlns="http://openconfig.net/yang/network-instance">
3449        <name>bgp-example</name>
3450        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
3451        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
3452            <global>
3453                <config>
3454                    <router-id>192.0.2.2</router-id>
3455                    <as>65000</as>
3456                </config>
3457                <afi-safis>
3458                    <afi-safi>
3459                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
3460                    </afi-safi>
3461                </afi-safis>
3462            </global>
3463        </bgp>
3464    </protocol>
3465
3466 BGP Peer
3467 ''''''''
3468 Here is an example for BGP peer configuration with enabled EVPN family.
3469
3470 **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``
3471
3472 **Method:** ``POST``
3473
3474 **Content-Type:** ``application/xml``
3475
3476 **Request Body:**
3477
3478 .. code-block:: xml
3479
3480    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
3481        <neighbor-address>192.0.2.1</neighbor-address>
3482        <afi-safis>
3483            <afi-safi>
3484                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
3485            </afi-safi>
3486        </afi-safis>
3487    </neighbor>
3488
3489 EVPN Route API
3490 ^^^^^^^^^^^^^^
3491 Following tree illustrate the BGP EVPN route structure.
3492
3493 .. code-block:: console
3494
3495    :(evpn-routes-case)
3496       +--ro evpn-routes
3497          +--ro evpn-route* [route-key]
3498             +--ro route-key                     string
3499             +--ro (evpn-choice)
3500             |  +--:(ethernet-a-d-route-case)
3501             |  |  +--ro ethernet-a-d-route
3502             |  |     +--ro (esi)
3503             |  |     |  +--:(arbitrary-case)
3504             |  |     |  |  +--ro arbitrary
3505             |  |     |  |     +--ro arbitrary    binary
3506             |  |     |  +--:(lacp-auto-generated-case)
3507             |  |     |  |  +--ro lacp-auto-generated
3508             |  |     |  |     +--ro ce-lacp-mac-address    yang:mac-address
3509             |  |     |  |     +--ro ce-lacp-port-key       uint16
3510             |  |     |  +--:(lan-auto-generated-case)
3511             |  |     |  |  +--ro lan-auto-generated
3512             |  |     |  |     +--ro root-bridge-mac-address    yang:mac-address
3513             |  |     |  |     +--ro root-bridge-priority       uint16
3514             |  |     |  +--:(mac-auto-generated-case)
3515             |  |     |  |  +--ro mac-auto-generated
3516             |  |     |  |     +--ro system-mac-address     yang:mac-address
3517             |  |     |  |     +--ro local-discriminator    uint24
3518             |  |     |  +--:(router-id-generated-case)
3519             |  |     |  |  +--ro router-id-generated
3520             |  |     |  |     +--ro router-id              inet:ipv4-address
3521             |  |     |  |     +--ro local-discriminator    uint32
3522             |  |     |  +--:(as-generated-case)
3523             |  |     |     +--ro as-generated
3524             |  |     |        +--ro as                     inet:as-number
3525             |  |     |        +--ro local-discriminator    uint32
3526             |  |     +--ro ethernet-tag-id
3527             |  |     |  +--ro vlan-id    uint32
3528             |  |     +--ro mpls-label             netc:mpls-label
3529             |  +--:(mac-ip-adv-route-case)
3530             |  |  +--ro mac-ip-adv-route
3531             |  |     +--ro (esi)
3532             |  |     |  +--:(arbitrary-case)
3533             |  |     |  |  +--ro arbitrary
3534             |  |     |  |     +--ro arbitrary    binary
3535             |  |     |  +--:(lacp-auto-generated-case)
3536             |  |     |  |  +--ro lacp-auto-generated
3537             |  |     |  |     +--ro ce-lacp-mac-address    yang:mac-address
3538             |  |     |  |     +--ro ce-lacp-port-key       uint16
3539             |  |     |  +--:(lan-auto-generated-case)
3540             |  |     |  |  +--ro lan-auto-generated
3541             |  |     |  |     +--ro root-bridge-mac-address    yang:mac-address
3542             |  |     |  |     +--ro root-bridge-priority       uint16
3543             |  |     |  +--:(mac-auto-generated-case)
3544             |  |     |  |  +--ro mac-auto-generated
3545             |  |     |  |     +--ro system-mac-address     yang:mac-address
3546             |  |     |  |     +--ro local-discriminator    uint24
3547             |  |     |  +--:(router-id-generated-case)
3548             |  |     |  |  +--ro router-id-generated
3549             |  |     |  |     +--ro router-id              inet:ipv4-address
3550             |  |     |  |     +--ro local-discriminator    uint32
3551             |  |     |  +--:(as-generated-case)
3552             |  |     |     +--ro as-generated
3553             |  |     |        +--ro as                     inet:as-number
3554             |  |     |        +--ro local-discriminator    uint32
3555             |  |     +--ro ethernet-tag-id
3556             |  |     |  +--ro vlan-id    uint32
3557             |  |     +--ro mac-address            yang:mac-address
3558             |  |     +--ro ip-address?            inet:ip-address
3559             |  |     +--ro mpls-label1            netc:mpls-label
3560             |  |     +--ro mpls-label2?           netc:mpls-label
3561             |  +--:(inc-multi-ethernet-tag-res-case)
3562             |  |  +--ro inc-multi-ethernet-tag-res
3563             |  |     +--ro ethernet-tag-id
3564             |  |     |  +--ro vlan-id    uint32
3565             |  |     +--ro orig-route-ip?     inet:ip-address
3566             |  +--:(es-route-case)
3567             |     +--ro es-route
3568             |        +--ro (esi)
3569             |        |  +--:(arbitrary-case)
3570             |        |  |  +--ro arbitrary
3571             |        |  |     +--ro arbitrary    binary
3572             |        |  +--:(lacp-auto-generated-case)
3573             |        |  |  +--ro lacp-auto-generated
3574             |        |  |     +--ro ce-lacp-mac-address    yang:mac-address
3575             |        |  |     +--ro ce-lacp-port-key       uint16
3576             |        |  +--:(lan-auto-generated-case)
3577             |        |  |  +--ro lan-auto-generated
3578             |        |  |     +--ro root-bridge-mac-address    yang:mac-address
3579             |        |  |     +--ro root-bridge-priority       uint16
3580             |        |  +--:(mac-auto-generated-case)
3581             |        |  |  +--ro mac-auto-generated
3582             |        |  |     +--ro system-mac-address     yang:mac-address
3583             |        |  |     +--ro local-discriminator    uint24
3584             |        |  +--:(router-id-generated-case)
3585             |        |  |  +--ro router-id-generated
3586             |        |  |     +--ro router-id              inet:ipv4-address
3587             |        |  |     +--ro local-discriminator    uint32
3588             |        |  +--:(as-generated-case)
3589             |        |     +--ro as-generated
3590             |        |        +--ro as                     inet:as-number
3591             |        |        +--ro local-discriminator    uint32
3592             |        +--ro orig-route-ip          inet:ip-address
3593             +--ro route-distinguisher           bgp-t:route-distinguisher
3594             +--ro attributes
3595                +--ro extended-communities*
3596                |  +--ro transitive?                              boolean
3597                |  +--ro (extended-community)?
3598                |     +--:(encapsulation-case)
3599                |     |  +--ro encapsulation-extended-community
3600                |     |     +--ro tunnel-type    encapsulation-tunnel-type
3601                |     +--:(esi-label-extended-community-case)
3602                |     |  +--ro esi-label-extended-community
3603                |     |     +--ro single-active-mode?   boolean
3604                |     |     +--ro esi-label             netc:mpls-label
3605                |     +--:(es-import-route-extended-community-case)
3606                |     |  +--ro es-import-route-extended-community
3607                |     |     +--ro es-import    yang:mac-address
3608                |     +--:(mac-mobility-extended-community-case)
3609                |     |  +--ro mac-mobility-extended-community
3610                |     |     +--ro static?       boolean
3611                |     |     +--ro seq-number    uint32
3612                |     +--:(default-gateway-extended-community-case)
3613                |     |  +--ro default-gateway-extended-community!
3614                |     +--:(layer-2-attributes-extended-community-case)
3615                |        +--ro layer-2-attributes-extended-community
3616                |           +--ro primary-pe?     boolean
3617                |           +--ro backup-pe?      boolean
3618                |           +--ro control-word?   boolean
3619                |           +--ro l2-mtu          uint16
3620                +--ro pmsi-tunnel!
3621                   +--ro leaf-information-required    boolean
3622                   +--ro mpls-label?                  netc:mpls-label
3623                   +--ro (tunnel-identifier)?
3624                      +--:(rsvp-te-p2mp-lsp)
3625                      |  +--ro rsvp-te-p2mp-lps
3626                      |     +--ro p2mp-id               uint32
3627                      |     +--ro tunnel-id             uint16
3628                      |     +--ro extended-tunnel-id    inet:ip-address
3629                      +--:(mldp-p2mp-lsp)
3630                      |  +--ro mldp-p2mp-lsp
3631                      |     +--ro address-family       identityref
3632                      |     +--ro root-node-address    inet:ip-address
3633                      |     +--ro opaque-value*
3634                      |        +--ro opaque-type             uint8
3635                      |        +--ro opaque-extended-type?   uint16
3636                      |        +--ro opaque                  yang:hex-string
3637                      +--:(pim-ssm-tree)
3638                      |  +--ro pim-ssm-tree
3639                      |     +--ro p-address            inet:ip-address
3640                      |     +--ro p-multicast-group    inet:ip-address
3641                      +--:(pim-sm-tree)
3642                      |  +--ro pim-sm-tree
3643                      |     +--ro p-address            inet:ip-address
3644                      |     +--ro p-multicast-group    inet:ip-address
3645                      +--:(bidir-pim-tree)
3646                      |  +--ro bidir-pim-tree
3647                      |     +--ro p-address            inet:ip-address
3648                      |     +--ro p-multicast-group    inet:ip-address
3649                      +--:(ingress-replication)
3650                      |  +--ro ingress-replication
3651                      |     +--ro receiving-endpoint-address?   inet:ip-address
3652                      +--:(mldp-mp2mp-lsp)
3653                         +--ro mldp-mp2mp-lsp
3654                            +--ro opaque-type             uint8
3655                            +--ro opaque-extended-type?   uint16
3656                            +--ro opaque
3657                      ...
3658
3659 Usage
3660 ^^^^^
3661 The L2VPN EVPN table in an instance of the speaker's Loc-RIB can be verified via REST:
3662
3663 **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``
3664
3665 **Method:** ``GET``
3666
3667 **Response Body:**
3668
3669 .. code-block:: xml
3670
3671    <evpn-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-evpn">
3672       <evpn-route>
3673          <route-key>AxEAAcCoZAED6AAAAQAgwKhkAQ==</route-key>
3674          <route-distinguisher>192.168.100.1:1000</route-distinguisher>
3675          <inc-multi-ethernet-tag-res>
3676             <ethernet-tag-id>
3677                <vlan-id>256</vlan-id>
3678             </ethernet-tag-id>
3679             <orig-route-ip>192.168.100.1</orig-route-ip>
3680          </inc-multi-ethernet-tag-res>
3681          <attributes>
3682             <ipv4-next-hop>
3683                <global>172.23.29.104</global>
3684             </ipv4-next-hop>
3685             <as-path/>
3686             <origin>
3687                <value>igp</value>
3688             </origin>
3689             <extended-communities>
3690                <extended-communities>
3691                    <transitive>true</transitive>
3692                    <route-target-extended-community>
3693                        <global-administrator>65504</global-administrator>
3694                        <local-administrator>AAAD6A==</local-administrator>
3695                    </route-target-extended-community>
3696                </extended-communities>
3697             </extended-communities>
3698             <pmsi-tunnel>
3699                 <leaf-information-required>true</leaf-information-required>
3700                 <mpls-label>20024</mpls-label>
3701                 <ingress-replication>
3702                     <receiving-endpoint-address>192.168.100.1</receiving-endpoint-address>
3703                 </ingress-replication>
3704             </pmsi-tunnel>
3705          </attributes>
3706       </evpn-route>
3707    </evpn-routes>
3708
3709 Programming
3710 ^^^^^^^^^^^
3711 This examples show how to originate and remove EVPN routes via programmable RIB.
3712 There are four different types of EVPN routes, and several extended communities.
3713 Routes can be used for variety of use-cases supported by BGP/MPLS EVPN, PBB EVPN and NVO EVPN.
3714 Make sure the *Application Peer* is configured first.
3715
3716 **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``
3717
3718 **Method:** ``POST``
3719
3720 **Content-Type:** ``application/xml``
3721
3722 **Request Body:**
3723
3724 .. code-block:: xml
3725    :linenos:
3726    :emphasize-lines: 3,4,14
3727
3728    <evpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-evpn">
3729        <route-key>evpn</route-key>
3730        <route-distinguisher>172.12.123.3:200</route-distinguisher>
3731        ....
3732        <attributes>
3733            <ipv4-next-hop>
3734                <global>199.20.166.41</global>
3735            </ipv4-next-hop>
3736            <as-path/>
3737            <origin>
3738                <value>igp</value>
3739            </origin>
3740            <extended-communities>
3741            ....
3742            </extended-communities>
3743        </attributes>
3744    </evpn-route>
3745
3746 @line 3: Route Distinguisher (RD) - set to RD of the MAC-VRF advertising the NLRI, recommended format *<IP>:<VLAN_ID>*
3747
3748 @line 4: One of the EVPN route must be set here.
3749
3750 @line 14: In some cases, specific extended community presence is required. The route may carry one or more Route Target attributes.
3751
3752 -----
3753
3754 **EVPN Routes:**
3755
3756 * **Ethernet AD per ESI**
3757    .. code-block:: xml
3758
3759       <ethernet-a-d-route>
3760           <mpls-label>0</mpls-label>
3761           <ethernet-tag-id>
3762               <vlan-id>4294967295</vlan-id>
3763           </ethernet-tag-id>
3764           <arbitrary>
3765               <arbitrary>AAAAAAAAAAAA</arbitrary>
3766           </arbitrary>
3767       </ethernet-a-d-route>
3768
3769 * **Ethernet AD per EVI**
3770    .. code-block:: xml
3771
3772       <ethernet-a-d-route>
3773           <mpls-label>24001</mpls-label>
3774           <ethernet-tag-id>
3775               <vlan-id>2200</vlan-id>
3776           </ethernet-tag-id>
3777           <arbitrary>
3778               <arbitrary>AAAAAAAAAAAA</arbitrary>
3779           </arbitrary>
3780       </ethernet-a-d-route>
3781
3782 * **MAC/IP Advertisement**
3783    .. code-block:: xml
3784
3785       <mac-ip-adv-route>
3786           <arbitrary>
3787               <arbitrary>AAAAAAAAAAAA</arbitrary>
3788           </arbitrary>
3789           <ethernet-tag-id>
3790               <vlan-id>2100</vlan-id>
3791           </ethernet-tag-id>
3792           <mac-address>f2:0c:dd:80:9f:f7</mac-address>
3793           <ip-address>10.0.1.12</ip-address>
3794           <mpls-label1>299776</mpls-label1>
3795       </mac-ip-adv-route>
3796
3797
3798 * **Inclusive Multicast Ethernet Tag**
3799    .. code-block:: xml
3800
3801       <inc-multi-ethernet-tag-res>
3802           <ethernet-tag-id>
3803               <vlan-id>2100</vlan-id>
3804           </ethernet-tag-id>
3805           <orig-route-ip>43.43.43.43</orig-route-ip>
3806       </inc-multi-ethernet-tag-res>
3807
3808 * **Ethernet Segment**
3809    .. code-block:: xml
3810
3811       <es-route>
3812           <orig-route-ip>43.43.43.43</orig-route-ip>
3813           <arbitrary>
3814               <arbitrary>AAAAAAAAAAAA</arbitrary>
3815           </arbitrary>
3816       </es-route>
3817
3818 **EVPN Ethernet Segment Identifier (ESI):**
3819
3820 * **Type 0**
3821    Indicates an arbitrary 9-octet ESI.
3822
3823    .. code-block:: xml
3824
3825       <arbitrary>
3826           <arbitrary>AAAAAAAAAAAA</arbitrary>
3827       </arbitrary>
3828
3829 * **Type 1**
3830    IEEE 802.1AX LACP is used.
3831
3832    .. code-block:: xml
3833
3834       <lacp-auto-generated>
3835           <ce-lacp-mac-address>f2:0c:dd:80:9f:f7</ce-lacp-mac-address>
3836           <ce-lacp-port-key>22</ce-lacp-port-key>
3837       </lacp-auto-generated>
3838
3839 * **Type 2**
3840    Indirectly connected hosts via a bridged LAN.
3841
3842    .. code-block:: xml
3843
3844       <lan-auto-generated>
3845           <root-bridge-mac-address>f2:0c:dd:80:9f:f7</root-bridge-mac-address>
3846           <root-bridge-priority>20</root-bridge-priority>
3847       </lan-auto-generated>
3848
3849 * **Type 3**
3850    MAC-based ESI.
3851
3852    .. code-block:: xml
3853
3854       <mac-auto-generated>
3855           <system-mac-address>f2:0c:dd:80:9f:f7</system-mac-address>
3856           <local-discriminator>2000</local-discriminator>
3857       </mac-auto-generated>
3858
3859 * **Type 4**
3860    Router-ID ESI
3861
3862    .. code-block:: xml
3863
3864       <router-id-generated>
3865           <router-id>43.43.43.43</router-id>
3866           <local-discriminator>2000</local-discriminator>
3867       </router-id-generated>
3868
3869 * **Type 5**
3870    AS-based ESI
3871
3872    .. code-block:: xml
3873
3874       <as-generated>
3875           <as>16843009</as>
3876           <local-discriminator>2000</local-discriminator>
3877       </as-generated>
3878
3879 **Extended Communities:**
3880
3881 * **ESI Label Extended Community**
3882    .. code-block:: xml
3883
3884       <extended-communities>
3885           <transitive>true</transitive>
3886           <esi-label-extended-community>
3887               <single-active-mode>false</single-active-mode>
3888               <esi-label>24001</esi-label>
3889           </esi-label-extended-community >
3890       </extended-communities>
3891
3892 * **ES-Import Route Target**
3893    .. code-block:: xml
3894
3895       <extended-communities>
3896           <transitive>true</transitive>
3897           <es-import-route-extended-community>
3898               <es-import>f2:0c:dd:80:9f:f7</es-import>
3899           </es-import-route-extended-community>
3900       </extended-communities>
3901
3902 * **MAC Mobility Extended Community**
3903    .. code-block:: xml
3904
3905       <extended-communities>
3906           <transitive>true</transitive>
3907           <mac-mobility-extended-community>
3908               <static>true</static>
3909               <seq-number>200</seq-number>
3910           </mac-mobility-extended-community>
3911       </extended-communities>
3912
3913 * **Default Gateway Extended Community**
3914    .. code-block:: xml
3915
3916       <extended-communities>
3917           <transitive>true</transitive>
3918           <default-gateway-extended-community>
3919           </default-gateway-extended-community>
3920       </extended-communities>
3921
3922 * **EVPN Layer 2 attributes extended community**
3923    .. code-block:: xml
3924
3925       <extended-communities>
3926           <transitive>false</transitive>
3927           <layer-2-attributes-extended-community>
3928               <primary-pe>true</primary-pe>
3929               <backup-pe>true</backup-pe>
3930               <control-word >true</control-word>
3931               <l2-mtu>200</l2-mtu>
3932           </layer-2-attributes-extended-community>
3933       </extended-communities>
3934
3935 * **BGP Encapsulation extended community**
3936    .. code-block:: xml
3937       :linenos:
3938       :emphasize-lines: 4
3939
3940       <extended-communities>
3941           <transitive>false</transitive>
3942           <encapsulation-extended-community>
3943               <tunnel-type>vxlan</tunnel-type>
3944           </encapsulation-extended-community>
3945       </extended-communities>
3946
3947    @line 4: `full list of tunnel types <http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#tunnel-types>`_
3948
3949 * **P-Multicast Service Interface Tunnel (PMSI) attribute**
3950    .. code-block:: xml
3951
3952       <pmsi-tunnel>
3953           <leaf-information-required>true</leaf-information-required>
3954           <mpls-label>20024</mpls-label>
3955           <ingress-replication>
3956               <receiving-endpoint-address>172.12.123.3</receiving-endpoint-address>
3957           </ingress-replication>
3958       </pmsi-tunnel>
3959
3960 -----
3961
3962 To remove the route added above, following request can be used:
3963
3964 **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``
3965
3966 **Method:** ``DELETE``
3967
3968 -----
3969
3970 .. table:: EVPN Routes Usage.
3971
3972    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3973    | EVN Route Type                       | Extended Communities                                | Usage                                     |
3974    +======================================+=====================================================+===========================================+
3975    | **Ethernet Auto-discovery**          | ESI Label, BGP EncapsulationEVPN Layer 2 attributes | Fast Convergence, Split Horizon, Aliasing |
3976    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3977    | **MAC/IP Advertisement**             | BGP Encapsulation, MAC Mobility, Default Gateway    | MAC address reachability                  |
3978    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3979    | **Inclusive Multicast Ethernet Tag** | PMSI Tunnel, BGP Encapsulation                      | Handling of Multi-destination traffic     |
3980    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3981    | **Ethernet Segment**                 | BGP Encapsulation, ES-Import Route Target           | Designated Forwarder Election             |
3982    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3983
3984 References
3985 ^^^^^^^^^^
3986 * `BGP MPLS-Based Ethernet VPN <https://tools.ietf.org/html/rfc7432>`_
3987 * `Provider Backbone Bridging Combined with Ethernet VPN <https://tools.ietf.org/html/rfc7623>`_
3988 * `VPWS support in EVPN <https://tools.ietf.org/html/draft-ietf-bess-evpn-vpws-07>`_
3989 * `A Network Virtualization Overlay Solution using EVPN <https://tools.ietf.org/html/draft-ietf-bess-evpn-overlay-04>`_
3990 * `Interconnect Solution for EVPN Overlay networks <https://tools.ietf.org/html/draft-ietf-bess-dci-evpn-overlay-04>`_
3991 * `Usage and applicability of BGP MPLS based Ethernet VPN <https://tools.ietf.org/html/draft-ietf-bess-evpn-usage-03>`_
3992
3993 Additional Path
3994 ---------------
3995 The ADD-PATH capability allows to advertise multiple paths for the same address prefix.
3996 It can help with optimal routing and routing convergence in a network by providing potential alternate or backup paths.
3997
3998 .. contents:: Contents
3999    :depth: 2
4000    :local:
4001
4002 Configuration
4003 ^^^^^^^^^^^^^
4004 This section shows a way to enable ADD-PATH capability in BGP speaker and peer configuration.
4005
4006 .. note:: The capability is applicable for IP Unicast, IP Labeled Unicast and Flow Specification address families.
4007
4008 BGP Speaker
4009 '''''''''''
4010 To enable ADD-PATH capability in BGP plugin, first configure BGP speaker instance:
4011
4012 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
4013
4014 **Method:** ``POST``
4015
4016 **Content-Type:** ``application/xml``
4017
4018 **Request Body:**
4019
4020 .. code-block:: xml
4021    :linenos:
4022    :emphasize-lines: 14
4023
4024    <protocol xmlns="http://openconfig.net/yang/network-instance">
4025        <name>bgp-example</name>
4026        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
4027        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4028            <global>
4029                <config>
4030                    <router-id>192.0.2.2</router-id>
4031                    <as>65000</as>
4032                </config>
4033                <afi-safis>
4034                    <afi-safi>
4035                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4036                        <receive>true</receive>
4037                        <send-max>2</send-max>
4038                    </afi-safi>
4039                </afi-safis>
4040            </global>
4041        </bgp>
4042    </protocol>
4043
4044 @line 14: Defines path selection strategy: *send-max* > 1 -> Advertise N Paths or *send-max* = 0 -> Advertise All Paths
4045
4046 Here is an example for update a specific family with enable ADD-PATH capability
4047
4048 **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``
4049
4050 **Method:** ``PUT``
4051
4052 **Content-Type:** ``application/xml``
4053
4054 **Request Body:**
4055
4056 .. code-block:: xml
4057
4058    <afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4059       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4060       <receive>true</receive>
4061       <send-max>0</send-max>
4062    </afi-safi>
4063
4064 BGP Peer
4065 ''''''''
4066 Here is an example for BGP peer configuration with enabled ADD-PATH capability.
4067
4068 **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``
4069
4070 **Method:** ``POST``
4071
4072 **Content-Type:** ``application/xml``
4073
4074 **Request Body:**
4075
4076 .. code-block:: xml
4077
4078    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4079        <neighbor-address>192.0.2.1</neighbor-address>
4080        <afi-safis>
4081            <afi-safi>
4082                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
4083            </afi-safi>
4084            <afi-safi>
4085                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4086                <receive>true</receive>
4087                <send-max>0</send-max>
4088            </afi-safi>
4089        </afi-safis>
4090    </neighbor>
4091
4092 .. 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.
4093
4094 Here is an example for update specific family BGP peer configuration with enabled ADD-PATH capability.
4095
4096 **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``
4097
4098 **Method:** ``PUT``
4099
4100 **Content-Type:** ``application/xml``
4101
4102 **Request Body:**
4103
4104 .. code-block:: xml
4105
4106    <afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4107       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4108       <receive>true</receive>
4109       <send-max>0</send-max>
4110    </afi-safi>
4111
4112 Usage
4113 ^^^^^
4114 The IPv4 Unicast table with enabled ADD-PATH capability in an instance of the speaker's Loc-RIB can be verified via REST:
4115
4116 **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``
4117
4118 **Method:** ``GET``
4119
4120 **Response Body:**
4121
4122 .. code-block:: xml
4123    :linenos:
4124    :emphasize-lines: 3
4125
4126    <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
4127        <ipv4-route>
4128            <path-id>1</path-id>
4129            <prefix>193.0.2.1/32</prefix>
4130            <attributes>
4131                <as-path></as-path>
4132                <origin>
4133                    <value>igp</value>
4134                </origin>
4135                <local-pref>
4136                    <pref>100</pref>
4137                </local-pref>
4138                <ipv4-next-hop>
4139                    <global>10.0.0.1</global>
4140                </ipv4-next-hop>
4141            </attributes>
4142        </ipv4-route>
4143        <ipv4-route>
4144            <path-id>2</path-id>
4145            <prefix>193.0.2.1/32</prefix>
4146            <attributes>
4147                <as-path></as-path>
4148                <origin>
4149                    <value>igp</value>
4150                </origin>
4151                <local-pref>
4152                    <pref>100</pref>
4153                </local-pref>
4154                <ipv4-next-hop>
4155                    <global>10.0.0.2</global>
4156                </ipv4-next-hop>
4157            </attributes>
4158        </ipv4-route>
4159    </ipv4-routes>
4160
4161 @line 3: The routes with the same destination are distinguished by *path-id* attribute.
4162
4163 References
4164 ^^^^^^^^^^
4165 * `Advertisement of Multiple Paths in BGP <https://tools.ietf.org/html/rfc7911>`_
4166 * `Best Practices for Advertisement of Multiple Paths in IBGP <https://tools.ietf.org/html/draft-ietf-idr-add-paths-guidelines-08>`_
4167
4168 Route Refresh
4169 -------------
4170 The Route Refresh Capability allows to dynamically request a re-advertisement of the Adj-RIB-Out from a BGP peer.
4171 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.
4172
4173 .. contents:: Contents
4174    :depth: 2
4175    :local:
4176
4177 Configuration
4178 ^^^^^^^^^^^^^
4179 The capability is enabled by default, no additional configuration is required.
4180
4181 Usage
4182 ^^^^^
4183 To send a Route Refresh request from OpenDaylight BGP speaker instance to its neighbor, invoke RPC:
4184
4185 **URL:** ``/restconf/operations/bgp-peer-rpc:route-refresh-request``
4186
4187 **Method:** ``POST``
4188
4189 **Content-Type:** ``application/xml``
4190
4191 **Request Body:**
4192
4193 .. code-block:: xml
4194
4195    <input xmlns="urn:opendaylight:params:xml:ns:yang:bgp-peer-rpc">
4196        <afi xmlns:types="urn:opendaylight:params:xml:ns:yang:bgp-types">types:ipv4-address-family</afi>
4197        <safi xmlns:types="urn:opendaylight:params:xml:ns:yang:bgp-types">types:unicast-subsequent-address-family</safi>
4198        <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>
4199    </input>
4200
4201 References
4202 ^^^^^^^^^^
4203 * `Route Refresh Capability for BGP-4 <https://tools.ietf.org/html/rfc2918>`_
4204
4205 Peer Session Release
4206 -------------
4207
4208 BGP provides a RPC feature to release a Neighbor session.
4209
4210 .. contents:: Contents
4211    :depth: 2
4212    :local:
4213
4214 Configuration
4215 ^^^^^^^^^^^^^
4216 The capability is enabled by default, no additional configuration is required.
4217
4218 Usage
4219 ^^^^^
4220 To release neighbor session, invoke RPC:
4221
4222 **URL:** ``/restconf/operations/bgp-peer-rpc:release-session``
4223
4224 **Method:** ``POST``
4225
4226 **Content-Type:** ``application/xml``
4227
4228 **Request Body:**
4229
4230 .. code-block:: xml
4231
4232    <input xmlns="urn:opendaylight:params:xml:ns:yang:bgp-peer-rpc">
4233        <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>
4234    </input>
4235
4236 Operational State
4237 -----------------
4238
4239 The OpenDaylight BGP implementation provides a set of APIs (described below), that give its operational state refreshed periodically, by default every 5 seconds.
4240 The following APIs describe what is available starting with how to change the default refresh rate.
4241
4242 .. contents:: Contents
4243    :depth: 2
4244    :local:
4245
4246 Operational State Configuration
4247 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4248
4249 **URL:** ``/restconf/config/bgp-state-config:bgp-state-config``
4250
4251 **Method:** ``PUT``
4252
4253 **Content-Type:** ``application/xml``
4254
4255 **Request Body:**
4256
4257 .. code-block:: xml
4258    :linenos:
4259    :emphasize-lines: 3
4260
4261    <bgp-state-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
4262        <config-name xmlns="urn:opendaylight:params:xml:ns:yang:bgp-state-config">operationalState</config-name>
4263        <timer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-state-config">1</timer>
4264    </bgp-state-config>
4265
4266 @line 3: Time in seconds between operational state update.
4267
4268 BGP RIB Operational State
4269 ^^^^^^^^^^^^^^^^^^^^^^^^^
4270
4271 **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``
4272
4273 **Method:** ``GET``
4274
4275 **Content-Type:** ``application/xml``
4276
4277 **Response Body:**
4278
4279 .. code-block:: xml
4280    :linenos:
4281
4282    <state xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4283        <as>65000</as>
4284        <router-id>192.0.2.2</router-id>
4285        <total-paths>0</total-paths>
4286        <total-prefixes>0</total-prefixes>
4287    </state>
4288
4289 @line 2: AS number of the remote peer.
4290
4291 @line 3: The unique protocol instance identifier.
4292
4293 @line 4: Total number of Paths installed on RIB (Loc-RIB)
4294
4295 @line 5: Total number of Prefixes installed on RIB (Loc-RIB)
4296
4297 BGP RIB Families Operational State
4298 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4299
4300 **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``
4301
4302 **Method:** ``GET``
4303
4304 **Content-Type:** ``application/xml``
4305
4306 **Response Body:**
4307
4308 .. code-block:: xml
4309    :linenos:
4310    :emphasize-lines: 3,5,6
4311
4312    <afi-safis xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4313        <afi-safi>
4314            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4315            <state>
4316                <total-paths>0</total-paths>
4317                <total-prefixes>0</total-prefixes>
4318            </state>
4319        </afi-safi>
4320        <afi-safi>
4321            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
4322            <state>
4323                <total-paths>0</total-paths>
4324                <total-prefixes>0</total-prefixes>
4325            </state>
4326        </afi-safi>
4327        ....
4328    </afi-safis>
4329
4330 @line 3: Family Identifier.
4331
4332 @line 5: Total number of Paths installed on RIB (Loc-RIB) per specific family.
4333
4334 @line 6: Total number of Prefixes installed on RIB (Loc-RIB) per specific family.
4335
4336 BGP Neighbors Operational State
4337 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4338
4339 **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``
4340
4341 **Method:** ``GET``
4342
4343 **Content-Type:** ``application/xml``
4344
4345 **Response Body:**
4346
4347 .. code-block:: xml
4348    :linenos:
4349    :emphasize-lines: 3
4350
4351    <neighbors xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4352        <neighbor>
4353            <neighbor-address>192.0.2.1</neighbor-address>
4354            .....
4355        </neighbor>
4356        <neighbor>
4357            <neighbor-address>192.0.2.2</neighbor-address>
4358            .....
4359        </neighbor>
4360    </neighbors>
4361
4362 @line 3: IP address of the remote BGP peer. Also serves as an unique identifier of a neighbor in a list of neighbors.
4363
4364 BGP Neighbor Operational State
4365 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4366
4367 .. note:: Supported Capabilities only provided when session has been established.
4368
4369 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbor/127.0.0.2/state``
4370
4371 **Method:** ``GET``
4372
4373 **Content-Type:** ``application/xml``
4374
4375 **Response Body:**
4376
4377 .. code-block:: xml
4378    :linenos:
4379    :emphasize-lines: 2,3,4,7,8,11,12
4380
4381    <state xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4382        <session-state>ESTABLISHED</session-state>
4383        <supported-capabilities xmlns:x="http://openconfig.net/yang/bgp-types">x:ASN32</supported-capabilities>
4384        <supported-capabilities xmlns:x="http://openconfig.net/yang/bgp-types">x:MPBGP</supported-capabilities>
4385        <messages>
4386            <sent>
4387                <UPDATE>0</UPDATE>
4388                <NOTIFICATION>0</NOTIFICATION>
4389            </sent>
4390            <received>
4391                <UPDATE>4</UPDATE>
4392                <NOTIFICATION>0</NOTIFICATION>
4393            </received>
4394        </messages>
4395    </state>
4396
4397 @line 2: Session status
4398
4399 @line 3-4: BGP capabilities supported ( ASN32 / MPBGP / ROUTE_REFRESH / GRACEFUL_RESTART / ADD_PATHS)
4400
4401 @line 7: Total count of Update Messages sent
4402
4403 @line 8: Total count of Notification Messages sent
4404
4405 @line 11: Total count of Update Messages received
4406
4407 @line 12: Total count of Notification Messages received
4408
4409 BGP Neighbor Families Operational State
4410 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4411
4412 .. note:: Graceful Restart not supported yet. Planned for Carbon.
4413
4414
4415 **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``
4416
4417 **Method:** ``GET``
4418
4419 **Content-Type:** ``application/xml``
4420
4421 **Response Body:**
4422
4423 .. code-block:: xml
4424    :linenos:
4425    :emphasize-lines: 3,5,7,9,10
4426
4427    <afi-safis xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4428         <afi-safi>
4429             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4430             <state>
4431                 <active>false</active>
4432             </state>
4433             <graceful-restart>
4434                 <state>
4435                     <received>false</received>
4436                     <advertised>false</advertised>
4437                 </state>
4438             </graceful-restart>
4439         </afi-safi>
4440         <afi-safi>
4441             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
4442             <state>
4443                 <active>false</active>
4444             </state>
4445             <graceful-restart>
4446                 <state>
4447                     <received>false</received>
4448                     <advertised>false</advertised>
4449                 </state>
4450             </graceful-restart>
4451         </afi-safi>
4452    </afi-safis>
4453
4454 @line 3: Family Identifier.
4455
4456 @line 5: True if family is advertized by peer.
4457
4458 @line 7: Graceful Restart Operational State per specific family.
4459
4460 @line 9: True if the peer supports graceful restart.
4461
4462 @line 10: True if we support graceful restart.
4463
4464 BGP Neighbor Family Operational State
4465 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4466
4467 .. note:: Prefixes state is only provided once session is established.
4468 .. note:: Graceful Restart not supported yet. Planned to be implemented in Carbon.
4469
4470 **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``
4471
4472 **Method:** ``GET``
4473
4474 **Content-Type:** ``application/xml``
4475
4476 **Response Body:**
4477
4478 .. code-block:: xml
4479    :linenos:
4480    :emphasize-lines: 2,4,6,7,8
4481
4482    <afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4483        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4484        <state>
4485            <active>true</active>
4486            <prefixes>
4487                <installed>3</installed>
4488                <sent>0</sent>
4489                <received>3</received>
4490            </prefixes>
4491        </state>
4492        <graceful-restart>
4493            <state>
4494                <received>false</received>
4495                <advertised>false</advertised>
4496            </state>
4497        </graceful-restart>
4498    </afi-safi>
4499
4500 @line 2: Family Identifier.
4501
4502 @line 4: True if family is advertized to and by peer.
4503
4504 @line 6: Total count of prefixes advertized by peer and installed (effective-rib-in).
4505
4506 @line 7: Total count of prefixes advertized to peer (adj-rib-out).
4507
4508 @line 8: Total count of prefixes advertized by peer (adj-rib-in).
4509
4510 BGP Neighbor Timers Operational State
4511 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4512
4513 .. note:: State is only provided once session is established.
4514
4515 **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``
4516
4517 **Method:** ``GET``
4518
4519 **Content-Type:** ``application/xml``
4520
4521 **Response Body:**
4522
4523 .. code-block:: xml
4524    :linenos:
4525    :emphasize-lines: 3,4
4526
4527    <timers xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4528        <state>
4529            <negotiated-hold-time>180</negotiated-hold-time>
4530            <uptime>1580676</uptime>
4531        </state>
4532    </timers>
4533
4534 @line 3: The negotiated hold-time for the BGP session in seconds.
4535
4536 @line 4: Session duration since establishment in milliseconds.
4537
4538 BGP Neighbor Transport Operational State
4539 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4540
4541 .. note:: State is only provided once session is established.
4542
4543 **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``
4544
4545 **Method:** ``GET``
4546
4547 **Content-Type:** ``application/xml``
4548
4549 **Response Body:**
4550
4551 .. code-block:: xml
4552    :linenos:
4553    :emphasize-lines: 3,4,5
4554
4555    <transport xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4556        <state>
4557            <remote-address>127.0.0.2</remote-address>
4558            <remote-port>44718</remote-port>
4559            <local-port>1790</local-port>
4560        </state>
4561    </transport>
4562
4563 @line 3: IP address of the remote BGP peer.
4564
4565 @line 4: Port of the remote BGP peer.
4566
4567 @line 5: Local port.
4568
4569 BGP Neighbor Error Handling Operational State
4570 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4571
4572 .. note:: State is only provided once session is established.
4573 .. note:: Error handling not supported yet. Planned for Carbon.
4574
4575 **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``
4576
4577 **Method:** ``GET``
4578
4579 **Content-Type:** ``application/xml``
4580
4581 **Response Body:**
4582
4583 .. code-block:: xml
4584    :linenos:
4585    :emphasize-lines: 3
4586
4587    <error-handling xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4588        <state>
4589            <erroneous-update-messages>0</erroneous-update-messages>
4590        </state>
4591    </error-handling>
4592
4593 @line 3: The number of BGP UPDATE messages for which the treat-as-withdraw mechanism has been applied based on
4594 erroneous message contents
4595
4596 BGP Neighbor Graceful Restart Operational State
4597 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4598
4599 .. note:: Graceful Restart not supported yet. Planned for Carbon.
4600
4601 **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``
4602
4603 **Method:** ``GET``
4604
4605 **Content-Type:** ``application/xml``
4606
4607 **Response Body:**
4608
4609 .. code-block:: xml
4610    :linenos:
4611    :emphasize-lines: 3,4,5
4612
4613    <graceful-restart xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4614        <state>
4615            <peer-restart-time>0</peer-restart-time>
4616            <peer-restarting>false</peer-restarting>
4617            <local-restarting>false</local-restarting>
4618        </state>
4619    </graceful-restart>
4620
4621 @line 3: The period of time (advertised by the peer) that the peer expects a restart of a BGP session to take.
4622
4623 @line 4: This flag indicates whether the remote neighbor is currently in the process of restarting, and hence
4624 received routes are currently stale.
4625
4626 @line 5: This flag indicates whether the local neighbor is currently restarting. The flag is unset after all NLRI
4627 have been advertised to the peer, and the End-of-RIB (EOR) marker has been unset.
4628
4629 BGP Peer Groups Operational State
4630 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4631
4632 **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``
4633
4634 **Method:** ``GET``
4635
4636 **Content-Type:** ``application/xml``
4637
4638 **Response Body:**
4639
4640 .. code-block:: xml
4641    :linenos:
4642    :emphasize-lines: 3,5,6
4643
4644    <peer-groups>
4645        <peer-group>
4646            <peer-group-name>application-peers</peer-group-name>
4647            <state>
4648                <total-paths>0</total-paths>
4649                <total-prefixes>0</total-prefixes>
4650            </state>
4651    </peer-group>
4652
4653 @line 3: Peer Group Identifier.
4654
4655 @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.
4656
4657 @line 6: Total Prefixes installed under by peers pertaining to this peer group (effective-rib-in).
4658 This count doesn't differentiate repeated prefixes.
4659
4660 CLI
4661 ---
4662
4663 BGP Karaf Console (odl-bgpcep-bgp-cli) provides a CLI feature to read operational state per RIB, Neighbor and Peer Group.
4664
4665 .. code-block:: bash
4666    :linenos:
4667
4668    opendaylight-user@root> bgp:operational-state -rib example-bgp-rib
4669
4670 .. code-block:: bash
4671    :linenos:
4672
4673    opendaylight-user@root> bgp:operational-state -rib example-bgp-rib -neighbor 192.0.2.1
4674
4675 .. code-block:: bash
4676    :linenos:
4677
4678    opendaylight-user@root> bgp:operational-state -rib -peer-group application-peers
4679
4680 High Availability
4681 -----------------
4682 Running OpenDaylight BGP in clustered environment brings an advantage of the plugin's high availability (HA).
4683 This section illustrates a basic scenario for HA, also presents a configuration for clustered OpenDaylight BGP.
4684
4685 .. contents:: Contents
4686    :depth: 2
4687    :local:
4688
4689 Configuration
4690 ^^^^^^^^^^^^^
4691 Following example shows a configuration for running BGP in clustered environment.
4692
4693 #. As the first step, configure (replicated *deafult* shard and *topology* shard if needed) and run OpenDaylight in clustered environment, install BGP and RESTCONF.
4694
4695 #. 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.
4696
4697 #. Remote peer should be configured to accept/initiate connection from/to all OpenDaylight cluster nodes with configured BGP plugin.
4698
4699 #. 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.
4700
4701 .. warning::
4702
4703    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`):
4704
4705    * In ``modules.conf`` add a new module:
4706       .. code-block:: console
4707
4708          {
4709              name = "bgp_rib"
4710              namespace = "urn:opendaylight:params:xml:ns:yang:bgp-rib"
4711              shard-strategy = "module"
4712          }
4713
4714    * In ``module-shards.conf`` define a new module shard:
4715       .. code-block:: console
4716
4717          {
4718              name = "bgp_rib"
4719              shards = [
4720                  {
4721                      name="bgp_rib"
4722                      replicas = [
4723                          "member-1"
4724                      ]
4725                  }
4726              ]
4727          }
4728
4729    **Note:** Use correct member name in module shard configuration.
4730
4731 Failover scenario
4732 ^^^^^^^^^^^^^^^^^
4733 Following section presents a basic BGP speaker failover scenario on 3-node OpenDaylight cluster setup.
4734
4735 .. figure:: ./images/bgpcep/BGP_HA.png
4736    :alt: BGP HA setup.
4737
4738    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.
4739    Routes advertised by remote peer are replicated, hence RIBs state on all nodes is the same.
4740
4741 -----
4742
4743 .. figure:: ./images/bgpcep/BGP_HA_failure.png
4744    :alt: Node went down.
4745
4746    In a case a cluster node, where BGP instance is running, goes down (unexpected failure, restart), active BGP session is dropped.
4747
4748 -----
4749
4750 .. figure:: ./images/bgpcep/BGP_HA_recovery.png
4751    :alt: BGP recovery.
4752
4753    Now, one of the stand-by BGP speaker instances become active. Remote peer establishes new connection and advertises routes again.
4754
4755 Topology Provider
4756 -----------------
4757 This section provides an overview of the BGP topology provider service.
4758 It shows how to configure and use all available BGP topology providers.
4759 Providers are building topology view of BGP routes stored in local BGP speaker's Loc-RIB.
4760 Output topologies are rendered in a form of standardised IETF network topology model.
4761
4762 .. contents:: Contents
4763    :depth: 2
4764    :local:
4765
4766 Inet Reachability Topology
4767 ^^^^^^^^^^^^^^^^^^^^^^^^^^
4768 Inet reachability topology exporter offers a mapping service from IPv4/6 routes to network topology nodes.
4769
4770 Configuration
4771 '''''''''''''
4772 Following example shows how to create a new instance of IPv4 BGP topology exporter:
4773
4774 **URL:** ``/restconf/config/network-topology:network-topology``
4775
4776 **Method:** ``POST``
4777
4778 **Content-Type:** ``application/xml``
4779
4780 **Request Body:**
4781
4782 .. code-block:: xml
4783    :linenos:
4784    :emphasize-lines: 2,4,6
4785
4786    <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4787        <topology-id>bgp-example-ipv4-topology</topology-id>
4788        <topology-types>
4789            <bgp-ipv4-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-ipv4-reachability-topology>
4790        </topology-types>
4791        <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">bgp-example</rib-id>
4792    </topology>
4793
4794 @line 2: An identifier for a topology.
4795
4796 @line 4: Used to identify type of the topology. In this case BGP IPv4 reachability topology.
4797
4798 @line 6: A name of the local BGP speaker instance.
4799
4800 -----
4801
4802 The topology exporter instance can be removed in a following way:
4803
4804 **URL:** ``/restconf/config/network-topology:network-topology/topology/bgp-example-ipv4-topology``
4805
4806 **Method:** ``DELETE``
4807
4808 -----
4809
4810 Following example shows how to create a new instance of IPv6 BGP topology exporter:
4811
4812 **URL:** ``/restconf/config/network-topology:network-topology``
4813
4814 **Method:** ``POST``
4815
4816 **Content-Type:** ``application/xml``
4817
4818 **Request Body:**
4819
4820 .. code-block:: xml
4821
4822    <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4823        <topology-id>bgp-example-ipv6-topology</topology-id>
4824        <topology-types>
4825            <bgp-ipv6-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-ipv6-reachability-topology>
4826        </topology-types>
4827        <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">bgp-example</rib-id>
4828    </topology>
4829
4830 Usage
4831 '''''
4832 Operational state of the topology can be verified via REST:
4833
4834 **URL:** ``/restconf/operational/network-topology:network-topology/topology/bgp-example-ipv4-topology``
4835
4836 **Method:** ``GET``
4837
4838 **Response Body:**
4839
4840 .. code-block:: xml
4841    :linenos:
4842    :emphasize-lines: 8,11
4843
4844    <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4845        <topology-id>bgp-example-ipv4-topology</topology-id>
4846        <server-provided>true</server-provided>
4847        <topology-types>
4848            <bgp-ipv4-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-ipv4-reachability-topology>
4849        </topology-types>
4850        <node>
4851            <node-id>10.10.1.1</node-id>
4852            <igp-node-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
4853                <prefix>
4854                    <prefix>10.0.0.10/32</prefix>
4855                </prefix>
4856            </igp-node-attributes>
4857        </node>
4858    </topology>
4859
4860 @line 8: The identifier of a node in a topology. Its value is mapped from route's NEXT_HOP attribute.
4861
4862 @line 11: The IP prefix attribute of the node. Its value is mapped from routes's destination IP prefix.
4863
4864 BGP Linkstate Topology
4865 ^^^^^^^^^^^^^^^^^^^^^^
4866 BGP linkstate topology exporter offers a mapping service from BGP-LS routes to network topology nodes and links.
4867
4868 Configuration
4869 '''''''''''''
4870 Following example shows how to create a new instance of linkstate BGP topology exporter:
4871
4872 **URL:** ``/restconf/config/network-topology:network-topology``
4873
4874 **Method:** ``POST``
4875
4876 **Content-Type:** ``application/xml``
4877
4878 **Request Body:**
4879
4880 .. code-block:: xml
4881
4882    <topology  xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4883        <topology-id>bgp-example-linkstate-topology</topology-id>
4884        <topology-types>
4885            <bgp-linkstate-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-linkstate-topology>
4886        </topology-types>
4887        <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">bgp-example</rib-id>
4888    </topology>
4889
4890 Usage
4891 '''''
4892 Operational state of the topology can be verified via REST.
4893 A sample output below represents a two node topology with two unidirectional links interconnecting those nodes.
4894
4895 **URL:** ``/restconf/operational/network-topology:network-topology/topology/bgp-example-linkstate-topology``
4896
4897 **Method:** ``GET``
4898
4899 **Response Body:**
4900
4901 .. code-block:: xml
4902
4903    <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4904        <topology-id>bgp-example-linkstate-topology</topology-id>
4905        <server-provided>true</server-provided>
4906        <topology-types>
4907            <bgp-linkstate-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-linkstate-topology>
4908        </topology-types>
4909        <node>
4910            <node-id>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0040</node-id>
4911            <termination-point>
4912                <tp-id>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.40</tp-id>
4913                <igp-termination-point-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology"/>
4914            </termination-point>
4915            <igp-node-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
4916                <prefix>
4917                    <prefix>40.40.40.40/32</prefix>
4918                    <metric>10</metric>
4919                </prefix>
4920                <prefix>
4921                    <prefix>203.20.160.0/24</prefix>
4922                    <metric>10</metric>
4923                </prefix>
4924                <name>node1</name>
4925                <router-id>40.40.40.40</router-id>
4926                <isis-node-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
4927                    <ted>
4928                        <te-router-id-ipv4>40.40.40.40</te-router-id-ipv4>
4929                    </ted>
4930                    <iso>
4931                        <iso-system-id>MDAwMDAwMDAwMDY0</iso-system-id>
4932                    </iso>
4933                </isis-node-attributes>
4934            </igp-node-attributes>
4935        </node>
4936        <node>
4937            <node-id>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0039</node-id>
4938            <termination-point>
4939                <tp-id>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.39</tp-id>
4940                <igp-termination-point-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology"/>
4941            </termination-point>
4942            <igp-node-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
4943                <prefix>
4944                    <prefix>39.39.39.39/32</prefix>
4945                    <metric>10</metric>
4946                </prefix>
4947                <prefix>
4948                    <prefix>203.20.160.0/24</prefix>
4949                    <metric>10</metric>
4950                </prefix>
4951                <name>node2</name>
4952                <router-id>39.39.39.39</router-id>
4953                <isis-node-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
4954                    <ted>
4955                        <te-router-id-ipv4>39.39.39.39</te-router-id-ipv4>
4956                    </ted>
4957                    <iso>
4958                        <iso-system-id>MDAwMDAwMDAwMDg3</iso-system-id>
4959                    </iso>
4960                </isis-node-attributes>
4961            </igp-node-attributes>
4962        </node>
4963        <link>
4964            <destination>
4965                <dest-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0039</dest-node>
4966                <dest-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.39</dest-tp>
4967            </destination>
4968            <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>
4969            <source>
4970                <source-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0040</source-node>
4971                <source-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.40</source-tp>
4972            </source>
4973            <igp-link-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
4974                <metric>10</metric>
4975                <isis-link-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
4976                    <ted>
4977                        <color>0</color>
4978                        <max-link-bandwidth>1250000.0</max-link-bandwidth>
4979                        <max-resv-link-bandwidth>12500.0</max-resv-link-bandwidth>
4980                        <te-default-metric>0</te-default-metric>
4981                        <unreserved-bandwidth>
4982                            <bandwidth>12500.0</bandwidth>
4983                            <priority>0</priority>
4984                        </unreserved-bandwidth>
4985                        <unreserved-bandwidth>
4986                            <bandwidth>12500.0</bandwidth>
4987                            <priority>1</priority>
4988                        </unreserved-bandwidth>
4989                        <unreserved-bandwidth>
4990                            <bandwidth>12500.0</bandwidth>
4991                            <priority>2</priority>
4992                        </unreserved-bandwidth>
4993                        <unreserved-bandwidth>
4994                            <bandwidth>12500.0</bandwidth>
4995                            <priority>3</priority>
4996                        </unreserved-bandwidth>
4997                        <unreserved-bandwidth>
4998                            <bandwidth>12500.0</bandwidth>
4999                            <priority>4</priority>
5000                        </unreserved-bandwidth>
5001                        <unreserved-bandwidth>
5002                            <bandwidth>12500.0</bandwidth>
5003                            <priority>5</priority>
5004                        </unreserved-bandwidth>
5005                        <unreserved-bandwidth>
5006                            <bandwidth>12500.0</bandwidth>
5007                            <priority>6</priority>
5008                        </unreserved-bandwidth>
5009                        <unreserved-bandwidth>
5010                            <bandwidth>12500.0</bandwidth>
5011                            <priority>7</priority>
5012                        </unreserved-bandwidth>
5013                    </ted>
5014                </isis-link-attributes>
5015            </igp-link-attributes>
5016        </link>
5017        <link>
5018            <destination>
5019                <dest-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0040</dest-node>
5020                <dest-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.40</dest-tp>
5021            </destination>
5022            <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>
5023            <source>
5024                <source-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0039</source-node>
5025                <source-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.39</source-tp>
5026            </source>
5027            <igp-link-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
5028                <metric>10</metric>
5029                <isis-link-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
5030                    <ted>
5031                        <color>0</color>
5032                        <max-link-bandwidth>1250000.0</max-link-bandwidth>
5033                        <max-resv-link-bandwidth>12500.0</max-resv-link-bandwidth>
5034                        <te-default-metric>0</te-default-metric>
5035                        <unreserved-bandwidth>
5036                            <bandwidth>12500.0</bandwidth>
5037                            <priority>0</priority>
5038                        </unreserved-bandwidth>
5039                        <unreserved-bandwidth>
5040                            <bandwidth>12500.0</bandwidth>
5041                            <priority>1</priority>
5042                        </unreserved-bandwidth>
5043                        <unreserved-bandwidth>
5044                            <bandwidth>12500.0</bandwidth>
5045                            <priority>2</priority>
5046                        </unreserved-bandwidth>
5047                        <unreserved-bandwidth>
5048                            <bandwidth>12500.0</bandwidth>
5049                            <priority>3</priority>
5050                        </unreserved-bandwidth>
5051                        <unreserved-bandwidth>
5052                            <bandwidth>12500.0</bandwidth>
5053                            <priority>4</priority>
5054                        </unreserved-bandwidth>
5055                        <unreserved-bandwidth>
5056                            <bandwidth>12500.0</bandwidth>
5057                            <priority>5</priority>
5058                        </unreserved-bandwidth>
5059                        <unreserved-bandwidth>
5060                            <bandwidth>12500.0</bandwidth>
5061                            <priority>6</priority>
5062                        </unreserved-bandwidth>
5063                        <unreserved-bandwidth>
5064                            <bandwidth>12500.0</bandwidth>
5065                            <priority>7</priority>
5066                        </unreserved-bandwidth>
5067                    </ted>
5068                </isis-link-attributes>
5069            </igp-link-attributes>
5070        </link>
5071    </topology>
5072
5073 BGP Network Topology Configuration Loader
5074 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5075
5076 BGP Network Topology Configuration Loader allows user to define static initial configuration for a BGP protocol instance.
5077 This service will detect the creation of new configuration files following the pattern "network-topology-*.xml" under the path "etc/opendaylight/bgpcep".
5078 Once the file is processed, the defined configuration will be available from the configuration Data Store.
5079
5080 .. note:: If the BGP topology instance is already present, no update or configuration will be applied.
5081
5082 When installing BGP an example will be provided and a default configuration loaded.
5083
5084 **PATH:** ``etc/opendaylight/bgp/network-topology-config.xml``
5085
5086 .. code-block:: xml
5087
5088     <network-topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
5089         <topology>
5090             <topology-id>example-ipv4-topology</topology-id>
5091             <topology-types>
5092                 <bgp-ipv4-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"/>
5093             </topology-types>
5094             <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">example-bgp-rib</rib-id>
5095         </topology>
5096         <topology>
5097             <topology-id>example-ipv6-topology</topology-id>
5098             <topology-types>
5099                 <bgp-ipv6-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"/>
5100             </topology-types>
5101             <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">example-bgp-rib</rib-id>
5102         </topology>
5103         <topology>
5104             <topology-id>example-linkstate-topology</topology-id>
5105             <topology-types>
5106                 <bgp-linkstate-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"/>
5107             </topology-types>
5108             <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">example-bgp-rib</rib-id>
5109         </topology>
5110     </network-topology>
5111
5112 Test Tools
5113 ----------
5114 BGP test tools serves to test basic BGP functionality, scalability and performance.
5115
5116 .. contents:: Contents
5117    :depth: 2
5118    :local:
5119
5120 BGP Test Tool
5121 ^^^^^^^^^^^^^
5122 The BGP Test Tool is a stand-alone Java application purposed to simulate remote BGP peers, that are capable to advertise sample routes.
5123 This application is not part of the OpenDaylight Karaf distribution, however it can be downloaded from OpenDaylight's Nexus (use latest release version):
5124
5125 ``https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/bgpcep/bgp-testtool``
5126
5127 Usage
5128 '''''
5129 The application can be run from command line:
5130
5131 .. code-block:: console
5132
5133    java -jar bgp-testtool-*-executable.jar
5134
5135
5136 with optional input parameters:
5137
5138 .. code-block:: console
5139
5140    -i <BOOLEAN>, --active <BOOLEAN>
5141       Active initialisation of the connection, by default false.
5142
5143    -ho <N>, --holdtimer <N>
5144       In seconds, value of the desired holdtimer, by default 90.
5145
5146    -sc <N>, --speakersCount <N>
5147       Number of simulated BGP speakers, when creating each speaker, uses incremented local-address for binding, by default 0.
5148
5149    -ra <IP_ADDRESS:PORT,...>, --remoteAddress <IP_ADDRESS:PORT,...>
5150       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.
5151
5152    -la <IP_ADDRESS:PORT>, --localAddress <IP_ADDRESS:PORT>
5153       IP address of BGP speakers which the tools simulates, by default 192.0.2.2:0.
5154
5155    -pr <N>, --prefixes <N>
5156       Number of prefixes to be advertised by each simulated speaker
5157
5158    -mp <BOOLEAN>, --multiPathSupport <BOOLEAN>
5159       Active ADD-PATH support, by default false.
5160
5161    -as <N>, --as <N>
5162       Local AS Number, by default 64496.
5163
5164    -ec <EXTENDED_COMMUNITIES>, --extended_communities <EXTENDED_COMMUNITIES>
5165       Extended communities to be send. Format: x,x,x  where  x  is  each  extended  community from bgp-types.yang, by default empty.
5166
5167    -ll <LOG_LEVEL>, --log_level <LOG_LEVEL>
5168       Log level for console output, by default INFO.
5169
5170 BGP Application Peer Benchmark
5171 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5172 It is a simple OpenDaylight application which is capable to inject and remove specific amount of IPv4 routes.
5173 This application is part of the OpenDaylight Karaf distribution.
5174
5175 Configuration
5176 '''''''''''''
5177 As a first step install BGP and RESTCONF, then configure *Application Peer*.
5178 Install ``odl-bgpcep-bgp-benchmark`` feature and reconfigure BGP Application Peer Benchmark application as per following:
5179
5180 **URL:** ``/restconf/config/odl-bgp-app-peer-benchmark-config:config``
5181
5182 **Method:** ``PUT``
5183
5184 **Content-Type:** ``application/xml``
5185
5186 **Request Body:**
5187
5188 .. code-block:: xml
5189    :linenos:
5190    :emphasize-lines: 2
5191
5192    <odl-bgp-app-peer-benchmark-config xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark-config">
5193       <app-peer-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark-config">10.25.1.9</app-peer-id>
5194    </odl-bgp-app-peer-benchmark-config>
5195
5196 @line 2: The *Application Peer* identifier.
5197
5198 Inject routes
5199 '''''''''''''
5200 Routes injection can be invoked via RPC:
5201
5202 **URL:** ``/restconf/operations/odl-bgp-app-peer-benchmark:add-prefix``
5203
5204 **Method:** ``POST``
5205
5206 **Content-Type:** ``application/xml``
5207
5208 **Request Body:**
5209
5210 .. code-block:: xml
5211    :linenos:
5212    :emphasize-lines: 2,3,4,5
5213
5214    <input xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
5215        <prefix>1.1.1.1/32</prefix>
5216        <count>100000</count>
5217        <batchsize>2000</batchsize>
5218        <nexthop>192.0.2.2</nexthop>
5219    </input>
5220
5221 @line 2: A initial IPv4 prefix carried in route. Value is incremented for following routes.
5222
5223 @line 3: An amount of routes to be added to *Application Peer's* programmable RIB.
5224
5225 @line 4: A size of the transaction batch.
5226
5227 @line 5: A NEXT_HOP attribute value used in all injected routes.
5228
5229 **Response Body:**
5230
5231 .. code-block:: xml
5232    :linenos:
5233    :emphasize-lines: 3,4,5
5234
5235    <output xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
5236        <result>
5237            <duration>4301</duration>
5238            <rate>25000</rate>
5239            <count>100000</count>
5240        </result>
5241    </output>
5242
5243 @line 3: Request duration in milliseconds.
5244
5245 @line 4: Writes per second rate.
5246
5247 @line 5: An amount of routes added to *Application Peer's* programmable RIB.
5248
5249 Remove routes
5250 '''''''''''''
5251 Routes deletion can be invoked via RPC:
5252
5253 **URL:** ``/restconf/operations/odl-bgp-app-peer-benchmark:delete-prefix``
5254
5255 **Method:** ``POST``
5256
5257 **Content-Type:** ``application/xml``
5258
5259 **Request Body:**
5260
5261 .. code-block:: xml
5262    :linenos:
5263    :emphasize-lines: 2,3,4
5264
5265    <input xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
5266        <prefix>1.1.1.1/32</prefix>
5267        <count>100000</count>
5268        <batchsize>2000</batchsize>
5269    </input>
5270
5271 @line 2: A initial IPv4 prefix carried in route to be removed. Value is incremented for following routes.
5272
5273 @line 3: An amount of routes to be removed from *Application Peer's* programmable RIB.
5274
5275 @line 4: A size of the transaction batch.
5276
5277 **Response Body:**
5278
5279 .. code-block:: xml
5280
5281    <output xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
5282        <result>
5283            <duration>1837</duration>
5284            <rate>54500</rate>
5285            <count>100000</count>
5286        </result>
5287    </output>
5288
5289 Troubleshooting
5290 ---------------
5291 This section offers advices in a case OpenDaylight BGP plugin is not working as expected.
5292
5293 .. contents:: Contents
5294    :depth: 2
5295    :local:
5296
5297 BGP is not working...
5298 ^^^^^^^^^^^^^^^^^^^^^
5299 * First of all, ensure that all required features are installed, local and remote BGP configuration is correct.
5300
5301 * Check OpenDaylight Karaf logs:
5302
5303 From Karaf console:
5304
5305 .. code-block:: console
5306
5307    log:tail
5308
5309 or open log file: ``data/log/karaf.log``
5310
5311 Possibly, a reason/hint for a cause of the problem can be found there.
5312
5313 * Try to minimise effect of other OpenDaylight features, when searching for a reason of the problem.
5314
5315 * Try to set DEBUG severity level for BGP logger via Karaf console commands, in order to collect more information:
5316
5317 .. code-block:: console
5318
5319    log:set DEBUG org.opendaylight.protocol.bgp
5320
5321 .. code-block:: console
5322
5323    log:set DEBUG org.opendaylight.bgpcep.bgp
5324
5325 Bug reporting
5326 ^^^^^^^^^^^^^
5327 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.
5328
5329 Write an e-mail to bgpcep-users@lists.opendaylight.org and provide following information:
5330
5331 #. State OpenDaylight version
5332
5333 #. Describe your use-case and provide as much details related to BGP as possible
5334
5335 #. Steps to reproduce
5336
5337 #. Attach Karaf log files, optionally packet captures, REST input/output