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