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