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