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