BUG-7364: BGP Peer Acceptor Rework
[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 BGP Peer
2151 ''''''''
2152 Here is an example for BGP peer configuration with enabled BGP-LS family.
2153
2154 **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``
2155
2156 **Method:** ``POST``
2157
2158 **Content-Type:** ``application/xml``
2159
2160 **Request Body:**
2161
2162 .. code-block:: xml
2163
2164    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2165        <neighbor-address>192.0.2.1</neighbor-address>
2166        <afi-safis>
2167            <afi-safi>
2168                <afi-safi-name>LINKSTATE</afi-safi-name>
2169            </afi-safi>
2170        </afi-safis>
2171    </neighbor>
2172
2173 Link-State Route API
2174 ^^^^^^^^^^^^^^^^^^^^
2175 Following tree illustrate the BGP Link-State route structure.
2176
2177 .. code-block:: console
2178
2179    :(linkstate-routes-case)
2180       +--ro linkstate-routes
2181          +--ro linkstate-route* [route-key]
2182             +--ro route-key                       binary
2183             +--ro protocol-id                     protocol-id
2184             +--ro identifier                      identifier
2185             +--ro (object-type)?
2186             |  +--:(node-case)
2187             |  |  +--ro node-descriptors
2188             |  |     +--ro as-number?         inet:as-number
2189             |  |     +--ro area-id?           area-identifier
2190             |  |     +--ro domain-id?         domain-identifier
2191             |  |     +--ro (c-router-identifier)?
2192             |  |        +--:(isis-node-case)
2193             |  |        |  +--ro isis-node
2194             |  |        |     +--ro iso-system-id    netc:iso-system-identifier
2195             |  |        +--:(isis-pseudonode-case)
2196             |  |        |  +--ro isis-pseudonode
2197             |  |        |     +--ro is-is-router-identifier
2198             |  |        |     |  +--ro iso-system-id    netc:iso-system-identifier
2199             |  |        |     +--ro psn                        uint8
2200             |  |        +--:(ospf-node-case)
2201             |  |        |  +--ro ospf-node
2202             |  |        |     +--ro ospf-router-id    uint32
2203             |  |        +--:(ospf-pseudonode-case)
2204             |  |           +--ro ospf-pseudonode
2205             |  |              +--ro ospf-router-id    uint32
2206             |  |              +--ro lan-interface     ospf-interface-identifier
2207             |  +--:(link-case)
2208             |  |  +--ro local-node-descriptors
2209             |  |  |  +--ro as-number?         inet:as-number
2210             |  |  |  +--ro area-id?           area-identifier
2211             |  |  |  +--ro domain-id?         domain-identifier
2212             |  |  |  +--ro (c-router-identifier)?
2213             |  |  |  |  +--:(isis-node-case)
2214             |  |  |  |  |  +--ro isis-node
2215             |  |  |  |  |     +--ro iso-system-id    netc:iso-system-identifier
2216             |  |  |  |  +--:(isis-pseudonode-case)
2217             |  |  |  |  |  +--ro isis-pseudonode
2218             |  |  |  |  |     +--ro is-is-router-identifier
2219             |  |  |  |  |     |  +--ro iso-system-id    netc:iso-system-identifier
2220             |  |  |  |  |     +--ro psn                        uint8
2221             |  |  |  |  +--:(ospf-node-case)
2222             |  |  |  |  |  +--ro ospf-node
2223             |  |  |  |  |     +--ro ospf-router-id    uint32
2224             |  |  |  |  +--:(ospf-pseudonode-case)
2225             |  |  |  |     +--ro ospf-pseudonode
2226             |  |  |  |        +--ro ospf-router-id    uint32
2227             |  |  |  |        +--ro lan-interface     ospf-interface-identifier
2228             |  |  |  +--ro bgp-router-id?     inet:ipv4-address
2229             |  |  |  +--ro member-asn?        inet:as-number
2230             |  |  +--ro remote-node-descriptors
2231             |  |  |  +--ro as-number?         inet:as-number
2232             |  |  |  +--ro area-id?           area-identifier
2233             |  |  |  +--ro domain-id?         domain-identifier
2234             |  |  |  +--ro (c-router-identifier)?
2235             |  |  |  |  +--:(isis-node-case)
2236             |  |  |  |  |  +--ro isis-node
2237             |  |  |  |  |     +--ro iso-system-id    netc:iso-system-identifier
2238             |  |  |  |  +--:(isis-pseudonode-case)
2239             |  |  |  |  |  +--ro isis-pseudonode
2240             |  |  |  |  |     +--ro is-is-router-identifier
2241             |  |  |  |  |     |  +--ro iso-system-id    netc:iso-system-identifier
2242             |  |  |  |  |     +--ro psn                        uint8
2243             |  |  |  |  +--:(ospf-node-case)
2244             |  |  |  |  |  +--ro ospf-node
2245             |  |  |  |  |     +--ro ospf-router-id    uint32
2246             |  |  |  |  +--:(ospf-pseudonode-case)
2247             |  |  |  |     +--ro ospf-pseudonode
2248             |  |  |  |        +--ro ospf-router-id    uint32
2249             |  |  |  |        +--ro lan-interface     ospf-interface-identifier
2250             |  |  |  +--ro bgp-router-id?     inet:ipv4-address
2251             |  |  |  +--ro member-asn?        inet:as-number
2252             |  |  +--ro link-descriptors
2253             |  |     +--ro link-local-identifier?    uint32
2254             |  |     +--ro link-remote-identifier?   uint32
2255             |  |     +--ro ipv4-interface-address?   ipv4-interface-identifier
2256             |  |     +--ro ipv6-interface-address?   ipv6-interface-identifier
2257             |  |     +--ro ipv4-neighbor-address?    ipv4-interface-identifier
2258             |  |     +--ro ipv6-neighbor-address?    ipv6-interface-identifier
2259             |  |     +--ro multi-topology-id?        topology-identifier
2260             |  +--:(prefix-case)
2261             |  |  +--ro advertising-node-descriptors
2262             |  |  |  +--ro as-number?         inet:as-number
2263             |  |  |  +--ro area-id?           area-identifier
2264             |  |  |  +--ro domain-id?         domain-identifier
2265             |  |  |  +--ro (c-router-identifier)?
2266             |  |  |     +--:(isis-node-case)
2267             |  |  |     |  +--ro isis-node
2268             |  |  |     |     +--ro iso-system-id    netc:iso-system-identifier
2269             |  |  |     +--:(isis-pseudonode-case)
2270             |  |  |     |  +--ro isis-pseudonode
2271             |  |  |     |     +--ro is-is-router-identifier
2272             |  |  |     |     |  +--ro iso-system-id    netc:iso-system-identifier
2273             |  |  |     |     +--ro psn                        uint8
2274             |  |  |     +--:(ospf-node-case)
2275             |  |  |     |  +--ro ospf-node
2276             |  |  |     |     +--ro ospf-router-id    uint32
2277             |  |  |     +--:(ospf-pseudonode-case)
2278             |  |  |        +--ro ospf-pseudonode
2279             |  |  |           +--ro ospf-router-id    uint32
2280             |  |  |           +--ro lan-interface     ospf-interface-identifier
2281             |  |  +--ro prefix-descriptors
2282             |  |     +--ro multi-topology-id?             topology-identifier
2283             |  |     +--ro ospf-route-type?               ospf-route-type
2284             |  |     +--ro ip-reachability-information?   inet:ip-prefix
2285             |  +--:(te-lsp-case)
2286             |     +--ro (address-family)?
2287             |     |  +--:(ipv4-case)
2288             |     |  |  +--ro ipv4-tunnel-sender-address      inet:ipv4-address
2289             |     |  |  +--ro ipv4-tunnel-endpoint-address    inet:ipv4-address
2290             |     |  +--:(ipv6-case)
2291             |     |     +--ro ipv6-tunnel-sender-address      inet:ipv6-address
2292             |     |     +--ro ipv6-tunnel-endpoint-address    inet:ipv6-address
2293             |     +--ro tunnel-id?                      rsvp:tunnel-id
2294             |     +--ro lsp-id?                         rsvp:lsp-id
2295             +--ro attributes
2296                +--ro (link-state-attribute)?
2297                   +--:(node-attributes-case)
2298                   |  +--ro node-attributes
2299                   |     +--ro topology-identifier*   topology-identifier
2300                   |     +--ro node-flags?            node-flag-bits
2301                   |     +--ro isis-area-id*          isis-area-identifier
2302                   |     +--ro dynamic-hostname?      string
2303                   |     +--ro ipv4-router-id?        ipv4-router-identifier
2304                   |     +--ro ipv6-router-id?        ipv6-router-identifier
2305                   |     +--ro sr-capabilities
2306                   |     |  +--ro mpls-ipv4?      boolean
2307                   |     |  +--ro mpls-ipv6?      boolean
2308                   |     |  +--ro sr-ipv6?        boolean
2309                   |     |  +--ro range-size?     uint32
2310                   |     |  +--ro (sid-label-index)?
2311                   |     |     +--:(local-label-case)
2312                   |     |     |  +--ro local-label?    netc:mpls-label
2313                   |     |     +--:(ipv6-address-case)
2314                   |     |     |  +--ro ipv6-address?   inet:ipv6-address
2315                   |     |     +--:(sid-case)
2316                   |     |        +--ro sid?            uint32
2317                   |     +--ro sr-algorithm
2318                   |        +--ro algorithms*   algorithm
2319                   +--:(link-attributes-case)
2320                   |  +--ro link-attributes
2321                   |     +--ro local-ipv4-router-id?       ipv4-router-identifier
2322                   |     +--ro local-ipv6-router-id?       ipv6-router-identifier
2323                   |     +--ro remote-ipv4-router-id?      ipv4-router-identifier
2324                   |     +--ro remote-ipv6-router-id?      ipv6-router-identifier
2325                   |     +--ro mpls-protocol?              mpls-protocol-mask
2326                   |     +--ro te-metric?                  netc:te-metric
2327                   |     +--ro metric?                     netc:metric
2328                   |     +--ro shared-risk-link-groups*    rsvp:srlg-id
2329                   |     +--ro link-name?                  string
2330                   |     +--ro max-link-bandwidth?         netc:bandwidth
2331                   |     +--ro max-reservable-bandwidth?   netc:bandwidth
2332                   |     +--ro unreserved-bandwidth* [priority]
2333                   |     |  +--ro priority     uint8
2334                   |     |  +--ro bandwidth?   netc:bandwidth
2335                   |     +--ro link-protection?            link-protection-type
2336                   |     +--ro admin-group?                administrative-group
2337                   |     +--ro sr-adj-ids*
2338                   |     |  +--ro (flags)?
2339                   |     |  |  +--:(ospf-adj-flags-case)
2340                   |     |  |  |  +--ro backup?           boolean
2341                   |     |  |  |  +--ro set?              boolean
2342                   |     |  |  +--:(isis-adj-flags-case)
2343                   |     |  |     +--ro backup?           boolean
2344                   |     |  |     +--ro set?              boolean
2345                   |     |  |     +--ro address-family?   boolean
2346                   |     |  +--ro weight?           weight
2347                   |     |  +--ro (sid-label-index)?
2348                   |     |     +--:(local-label-case)
2349                   |     |     |  +--ro local-label?      netc:mpls-label
2350                   |     |     +--:(ipv6-address-case)
2351                   |     |     |  +--ro ipv6-address?     inet:ipv6-address
2352                   |     |     +--:(sid-case)
2353                   |     |        +--ro sid?              uint32
2354                   |     +--ro sr-lan-adj-ids*
2355                   |     |  +--ro (flags)?
2356                   |     |  |  +--:(ospf-adj-flags-case)
2357                   |     |  |  |  +--ro backup?           boolean
2358                   |     |  |  |  +--ro set?              boolean
2359                   |     |  |  +--:(isis-adj-flags-case)
2360                   |     |  |     +--ro backup?           boolean
2361                   |     |  |     +--ro set?              boolean
2362                   |     |  |     +--ro address-family?   boolean
2363                   |     |  +--ro weight?           weight
2364                   |     |  +--ro iso-system-id?    netc:iso-system-identifier
2365                   |     |  +--ro neighbor-id?      inet:ipv4-address
2366                   |     |  +--ro (sid-label-index)?
2367                   |     |     +--:(local-label-case)
2368                   |     |     |  +--ro local-label?      netc:mpls-label
2369                   |     |     +--:(ipv6-address-case)
2370                   |     |     |  +--ro ipv6-address?     inet:ipv6-address
2371                   |     |     +--:(sid-case)
2372                   |     |        +--ro sid?              uint32
2373                   |     +--ro peer-node-sid
2374                   |     |  +--ro weight?         weight
2375                   |     |  +--ro (sid-label-index)?
2376                   |     |     +--:(local-label-case)
2377                   |     |     |  +--ro local-label?    netc:mpls-label
2378                   |     |     +--:(ipv6-address-case)
2379                   |     |     |  +--ro ipv6-address?   inet:ipv6-address
2380                   |     |     +--:(sid-case)
2381                   |     |        +--ro sid?            uint32
2382                   |     +--ro peer-adj-sid
2383                   |     |  +--ro weight?         weight
2384                   |     |  +--ro (sid-label-index)?
2385                   |     |     +--:(local-label-case)
2386                   |     |     |  +--ro local-label?    netc:mpls-label
2387                   |     |     +--:(ipv6-address-case)
2388                   |     |     |  +--ro ipv6-address?   inet:ipv6-address
2389                   |     |     +--:(sid-case)
2390                   |     |        +--ro sid?            uint32
2391                   |     +--ro peer-set-sids*
2392                   |        +--ro weight?         weight
2393                   |        +--ro (sid-label-index)?
2394                   |           +--:(local-label-case)
2395                   |           |  +--ro local-label?    netc:mpls-label
2396                   |           +--:(ipv6-address-case)
2397                   |           |  +--ro ipv6-address?   inet:ipv6-address
2398                   |           +--:(sid-case)
2399                   |              +--ro sid?            uint32
2400                   +--:(prefix-attributes-case)
2401                   |  +--ro prefix-attributes
2402                   |     +--ro igp-bits
2403                   |     |  x--ro up-down?               bits
2404                   |     |  +--ro is-is-up-down?         boolean
2405                   |     |  +--ro ospf-no-unicast?       boolean
2406                   |     |  +--ro ospf-local-address?    boolean
2407                   |     |  +--ro ospf-propagate-nssa?   boolean
2408                   |     +--ro route-tags*                route-tag
2409                   |     +--ro extended-tags*             extended-route-tag
2410                   |     +--ro prefix-metric?             netc:igp-metric
2411                   |     +--ro ospf-forwarding-address?   inet:ip-address
2412                   |     +--ro sr-prefix
2413                   |     |  +--ro (flags)?
2414                   |     |  |  +--:(isis-prefix-flags-case)
2415                   |     |  |  |  +--ro no-php?            boolean
2416                   |     |  |  |  +--ro explicit-null?     boolean
2417                   |     |  |  |  +--ro readvertisement?   boolean
2418                   |     |  |  |  +--ro node-sid?          boolean
2419                   |     |  |  +--:(ospf-prefix-flags-case)
2420                   |     |  |     +--ro no-php?            boolean
2421                   |     |  |     +--ro explicit-null?     boolean
2422                   |     |  |     +--ro mapping-server?    boolean
2423                   |     |  +--ro algorithm?         algorithm
2424                   |     |  +--ro (sid-label-index)?
2425                   |     |     +--:(local-label-case)
2426                   |     |     |  +--ro local-label?       netc:mpls-label
2427                   |     |     +--:(ipv6-address-case)
2428                   |     |     |  +--ro ipv6-address?      inet:ipv6-address
2429                   |     |     +--:(sid-case)
2430                   |     |        +--ro sid?               uint32
2431                   |     +--ro ipv6-sr-prefix
2432                   |     |  +--ro algorithm?   algorithm
2433                   |     +--ro sr-range
2434                   |     |  +--ro inter-area?   boolean
2435                   |     |  +--ro range-size?   uint16
2436                   |     |  +--ro sub-tlvs*
2437                   |     |     +--ro (range-sub-tlv)?
2438                   |     |        +--:(binding-sid-tlv-case)
2439                   |     |        |  +--ro weight?                weight
2440                   |     |        |  +--ro (flags)?
2441                   |     |        |  |  +--:(isis-binding-flags-case)
2442                   |     |        |  |  |  +--ro address-family?        boolean
2443                   |     |        |  |  |  +--ro mirror-context?        boolean
2444                   |     |        |  |  |  +--ro spread-tlv?            boolean
2445                   |     |        |  |  |  +--ro leaked-from-level-2?   boolean
2446                   |     |        |  |  |  +--ro attached-flag?         boolean
2447                   |     |        |  |  +--:(ospf-binding-flags-case)
2448                   |     |        |  |     +--ro mirroring?             boolean
2449                   |     |        |  +--ro binding-sub-tlvs*
2450                   |     |        |     +--ro (binding-sub-tlv)?
2451                   |     |        |        +--:(prefix-sid-case)
2452                   |     |        |        |  +--ro (flags)?
2453                   |     |        |        |  |  +--:(isis-prefix-flags-case)
2454                   |     |        |        |  |  |  +--ro no-php?            boolean
2455                   |     |        |        |  |  |  +--ro explicit-null?     boolean
2456                   |     |        |        |  |  |  +--ro readvertisement?   boolean
2457                   |     |        |        |  |  |  +--ro node-sid?          boolean
2458                   |     |        |        |  |  +--:(ospf-prefix-flags-case)
2459                   |     |        |        |  |     +--ro no-php?            boolean
2460                   |     |        |        |  |     +--ro explicit-null?     boolean
2461                   |     |        |        |  |     +--ro mapping-server?    boolean
2462                   |     |        |        |  +--ro algorithm?         algorithm
2463                   |     |        |        |  +--ro (sid-label-index)?
2464                   |     |        |        |     +--:(local-label-case)
2465                   |     |        |        |     |  +--ro local-label?       netc:mpls-label
2466                   |     |        |        |     +--:(ipv6-address-case)
2467                   |     |        |        |     |  +--ro ipv6-address?      inet:ipv6-address
2468                   |     |        |        |     +--:(sid-case)
2469                   |     |        |        |        +--ro sid?               uint32
2470                   |     |        |        +--:(ipv6-prefix-sid-case)
2471                   |     |        |        |  +--ro algorithm?         algorithm
2472                   |     |        |        +--:(sid-label-case)
2473                   |     |        |        |  +--ro (sid-label-index)?
2474                   |     |        |        |     +--:(local-label-case)
2475                   |     |        |        |     |  +--ro local-label?       netc:mpls-label
2476                   |     |        |        |     +--:(ipv6-address-case)
2477                   |     |        |        |     |  +--ro ipv6-address?      inet:ipv6-address
2478                   |     |        |        |     +--:(sid-case)
2479                   |     |        |        |        +--ro sid?               uint32
2480                   |     |        |        +--:(ero-metric-case)
2481                   |     |        |        |  +--ro ero-metric?        netc:te-metric
2482                   |     |        |        +--:(ipv4-ero-case)
2483                   |     |        |        |  +--ro loose?             boolean
2484                   |     |        |        |  +--ro address            inet:ipv4-address
2485                   |     |        |        +--:(ipv6-ero-case)
2486                   |     |        |        |  +--ro loose?             boolean
2487                   |     |        |        |  +--ro address            inet:ipv6-address
2488                   |     |        |        +--:(unnumbered-interface-id-ero-case)
2489                   |     |        |        |  +--ro loose?             boolean
2490                   |     |        |        |  +--ro router-id?         uint32
2491                   |     |        |        |  +--ro interface-id?      uint32
2492                   |     |        |        +--:(ipv4-ero-backup-case)
2493                   |     |        |        |  +--ro loose?             boolean
2494                   |     |        |        |  +--ro address            inet:ipv4-address
2495                   |     |        |        +--:(ipv6-ero-backup-case)
2496                   |     |        |        |  +--ro loose?             boolean
2497                   |     |        |        |  +--ro address            inet:ipv6-address
2498                   |     |        |        +--:(unnumbered-interface-id-backup-ero-case)
2499                   |     |        |           +--ro loose?             boolean
2500                   |     |        |           +--ro router-id?         uint32
2501                   |     |        |           +--ro interface-id?      uint32
2502                   |     |        +--:(prefix-sid-tlv-case)
2503                   |     |        |  +--ro (flags)?
2504                   |     |        |  |  +--:(isis-prefix-flags-case)
2505                   |     |        |  |  |  +--ro no-php?                boolean
2506                   |     |        |  |  |  +--ro explicit-null?         boolean
2507                   |     |        |  |  |  +--ro readvertisement?       boolean
2508                   |     |        |  |  |  +--ro node-sid?              boolean
2509                   |     |        |  |  +--:(ospf-prefix-flags-case)
2510                   |     |        |  |     +--ro no-php?                boolean
2511                   |     |        |  |     +--ro explicit-null?         boolean
2512                   |     |        |  |     +--ro mapping-server?        boolean
2513                   |     |        |  +--ro algorithm?             algorithm
2514                   |     |        |  +--ro (sid-label-index)?
2515                   |     |        |     +--:(local-label-case)
2516                   |     |        |     |  +--ro local-label?           netc:mpls-label
2517                   |     |        |     +--:(ipv6-address-case)
2518                   |     |        |     |  +--ro ipv6-address?          inet:ipv6-address
2519                   |     |        |     +--:(sid-case)
2520                   |     |        |        +--ro sid?                   uint32
2521                   |     |        +--:(ipv6-prefix-sid-tlv-case)
2522                   |     |        |  +--ro algorithm?             algorithm
2523                   |     |        +--:(sid-label-tlv-case)
2524                   |     |           +--ro (sid-label-index)?
2525                   |     |              +--:(local-label-case)
2526                   |     |              |  +--ro local-label?           netc:mpls-label
2527                   |     |              +--:(ipv6-address-case)
2528                   |     |              |  +--ro ipv6-address?          inet:ipv6-address
2529                   |     |              +--:(sid-case)
2530                   |     |                 +--ro sid?                   uint32
2531                   |     +--ro sr-binding-sid-labels*
2532                   |        +--ro weight?                weight
2533                   |        +--ro (flags)?
2534                   |        |  +--:(isis-binding-flags-case)
2535                   |        |  |  +--ro address-family?        boolean
2536                   |        |  |  +--ro mirror-context?        boolean
2537                   |        |  |  +--ro spread-tlv?            boolean
2538                   |        |  |  +--ro leaked-from-level-2?   boolean
2539                   |        |  |  +--ro attached-flag?         boolean
2540                   |        |  +--:(ospf-binding-flags-case)
2541                   |        |     +--ro mirroring?             boolean
2542                   |        +--ro binding-sub-tlvs*
2543                   |           +--ro (binding-sub-tlv)?
2544                   |              +--:(prefix-sid-case)
2545                   |              |  +--ro (flags)?
2546                   |              |  |  +--:(isis-prefix-flags-case)
2547                   |              |  |  |  +--ro no-php?            boolean
2548                   |              |  |  |  +--ro explicit-null?     boolean
2549                   |              |  |  |  +--ro readvertisement?   boolean
2550                   |              |  |  |  +--ro node-sid?          boolean
2551                   |              |  |  +--:(ospf-prefix-flags-case)
2552                   |              |  |     +--ro no-php?            boolean
2553                   |              |  |     +--ro explicit-null?     boolean
2554                   |              |  |     +--ro mapping-server?    boolean
2555                   |              |  +--ro algorithm?         algorithm
2556                   |              |  +--ro (sid-label-index)?
2557                   |              |     +--:(local-label-case)
2558                   |              |     |  +--ro local-label?       netc:mpls-label
2559                   |              |     +--:(ipv6-address-case)
2560                   |              |     |  +--ro ipv6-address?      inet:ipv6-address
2561                   |              |     +--:(sid-case)
2562                   |              |        +--ro sid?               uint32
2563                   |              +--:(ipv6-prefix-sid-case)
2564                   |              |  +--ro algorithm?         algorithm
2565                   |              +--:(sid-label-case)
2566                   |              |  +--ro (sid-label-index)?
2567                   |              |     +--:(local-label-case)
2568                   |              |     |  +--ro local-label?       netc:mpls-label
2569                   |              |     +--:(ipv6-address-case)
2570                   |              |     |  +--ro ipv6-address?      inet:ipv6-address
2571                   |              |     +--:(sid-case)
2572                   |              |        +--ro sid?               uint32
2573                   |              +--:(ero-metric-case)
2574                   |              |  +--ro ero-metric?        netc:te-metric
2575                   |              +--:(ipv4-ero-case)
2576                   |              |  +--ro loose?             boolean
2577                   |              |  +--ro address            inet:ipv4-address
2578                   |              +--:(ipv6-ero-case)
2579                   |              |  +--ro loose?             boolean
2580                   |              |  +--ro address            inet:ipv6-address
2581                   |              +--:(unnumbered-interface-id-ero-case)
2582                   |              |  +--ro loose?             boolean
2583                   |              |  +--ro router-id?         uint32
2584                   |              |  +--ro interface-id?      uint32
2585                   |              +--:(ipv4-ero-backup-case)
2586                   |              |  +--ro loose?             boolean
2587                   |              |  +--ro address            inet:ipv4-address
2588                   |              +--:(ipv6-ero-backup-case)
2589                   |              |  +--ro loose?             boolean
2590                   |              |  +--ro address            inet:ipv6-address
2591                   |              +--:(unnumbered-interface-id-backup-ero-case)
2592                   |                 +--ro loose?             boolean
2593                   |                 +--ro router-id?         uint32
2594                   |                 +--ro interface-id?      uint32
2595                   x--:(te-lsp-attributes-case)
2596                      +--ro te-lsp-attributes
2597
2598
2599 Usage
2600 ^^^^^
2601 The Link-State table in a instance of the speaker's Loc-RIB can be verified via REST:
2602
2603 **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``
2604
2605 **Method:** ``GET``
2606
2607 **Response Body:**
2608
2609 .. code-block:: xml
2610
2611    <linkstate-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-linkstate">
2612       ...
2613    </linkstate-routes>
2614
2615 .. note:: Link-State routes mapping to topology links/nodes/prefixes is supported by BGP Topology Provider.
2616
2617 References
2618 ^^^^^^^^^^
2619 * `North-Bound Distribution of Link-State and Traffic Engineering (TE) Information Using BGP <https://tools.ietf.org/html/rfc7752>`_
2620 * `BGP Link-State extensions for Segment Routing <https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-03>`_
2621 * `Segment Routing BGP Egress Peer Engineering BGP-LS Extensions <https://tools.ietf.org/html/draft-ietf-idr-bgpls-segment-routing-epe-05>`_
2622 * `BGP Link-State Information Distribution Implementation Report <https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-impl-04>`_
2623
2624 Flow Specification Family
2625 -------------------------
2626 The BGP Flow Specification (BGP-FS) Multiprotocol extension can be used to distribute traffic flow specifications.
2627 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).
2628
2629 .. contents:: Contents
2630    :depth: 2
2631    :local:
2632
2633 Configuration
2634 ^^^^^^^^^^^^^
2635 This section shows a way to enable BGP-FS family in BGP speaker and peer configuration.
2636
2637 BGP Speaker
2638 '''''''''''
2639 To enable BGP-FS support in BGP plugin, first configure BGP speaker instance:
2640
2641 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
2642
2643 **Method:** ``POST``
2644
2645 **Content-Type:** ``application/xml``
2646
2647 **Request Body:**
2648
2649 .. code-block:: xml
2650
2651    <protocol xmlns="http://openconfig.net/yang/network-instance">
2652        <name>bgp-example</name>
2653        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
2654        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2655            <global>
2656                <config>
2657                    <router-id>192.0.2.2</router-id>
2658                    <as>65000</as>
2659                </config>
2660                <afi-safis>
2661                    <afi-safi>
2662                        <afi-safi-name>IPV4-FLOW</afi-safi-name>
2663                    </afi-safi>
2664                    <afi-safi>
2665                        <afi-safi-name>IPV6-FLOW</afi-safi-name>
2666                    </afi-safi>
2667                    <afi-safi>
2668                        <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
2669                    </afi-safi>
2670                    <afi-safi>
2671                        <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
2672                    </afi-safi>
2673                </afi-safis>
2674            </global>
2675        </bgp>
2676    </protocol>
2677
2678 BGP Peer
2679 ''''''''
2680 Here is an example for BGP peer configuration with enabled BGP-FS family.
2681
2682 **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``
2683
2684 **Method:** ``POST``
2685
2686 **Content-Type:** ``application/xml``
2687
2688 **Request Body:**
2689
2690 .. code-block:: xml
2691
2692    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2693        <neighbor-address>192.0.2.1</neighbor-address>
2694        <afi-safis>
2695            <afi-safi>
2696                <afi-safi-name>IPV4-FLOW</afi-safi-name>
2697            </afi-safi>
2698            <afi-safi>
2699                <afi-safi-name>IPV6-FLOW</afi-safi-name>
2700            </afi-safi>
2701            <afi-safi>
2702                <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
2703            </afi-safi>
2704            <afi-safi>
2705                <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
2706            </afi-safi>
2707        </afi-safis>
2708    </neighbor>
2709
2710 Flow Specification API
2711 ^^^^^^^^^^^^^^^^^^^^^^
2712 Following trees illustrate the BGP Flow Specification routes structure.
2713
2714 IPv4 Flow Specification Route
2715 '''''''''''''''''''''''''''''
2716 .. code-block:: console
2717
2718    :(flowspec-routes-case)
2719      +--ro flowspec-routes
2720         +--ro flowspec-route* [route-key path-id]
2721            +--ro route-key     string
2722            +--ro flowspec*
2723            |  +--ro (flowspec-type)?
2724            |     +--:(port-case)
2725            |     |  +--ro ports*
2726            |     |     +--ro op?      numeric-operand
2727            |     |     +--ro value?   uint16
2728            |     +--:(destination-port-case)
2729            |     |  +--ro destination-ports*
2730            |     |     +--ro op?      numeric-operand
2731            |     |     +--ro value?   uint16
2732            |     +--:(source-port-case)
2733            |     |  +--ro source-ports*
2734            |     |     +--ro op?      numeric-operand
2735            |     |     +--ro value?   uint16
2736            |     +--:(icmp-type-case)
2737            |     |  +--ro types*
2738            |     |     +--ro op?      numeric-operand
2739            |     |     +--ro value?   uint8
2740            |     +--:(icmp-code-case)
2741            |     |  +--ro codes*
2742            |     |     +--ro op?      numeric-operand
2743            |     |     +--ro value?   uint8
2744            |     +--:(tcp-flags-case)
2745            |     |  +--ro tcp-flags*
2746            |     |     +--ro op?      bitmask-operand
2747            |     |     +--ro value?   uint16
2748            |     +--:(packet-length-case)
2749            |     |  +--ro packet-lengths*
2750            |     |     +--ro op?      numeric-operand
2751            |     |     +--ro value?   uint16
2752            |     +--:(dscp-case)
2753            |     |  +--ro dscps*
2754            |     |     +--ro op?      numeric-operand
2755            |     |     +--ro value?   dscp
2756            |     +--:(fragment-case)
2757            |     |  +--ro fragments*
2758            |     |     +--ro op?      bitmask-operand
2759            |     |     +--ro value?   fragment
2760            |     +--:(destination-prefix-case)
2761            |     |  +--ro destination-prefix?   inet:ipv4-prefix
2762            |     +--:(source-prefix-case)
2763            |     |  +--ro source-prefix?        inet:ipv4-prefix
2764            |     +--:(protocol-ip-case)
2765            |        +--ro protocol-ips*
2766            |           +--ro op?      numeric-operand
2767            |           +--ro value?   uint8
2768            +--ro path-id       path-id
2769            +--ro attributes
2770               +--ro extended-communities*
2771                  +--ro transitive?                             boolean
2772                  +--ro (extended-community)?
2773                     +--:(traffic-rate-extended-community-case)
2774                     |  +--ro traffic-rate-extended-community
2775                     |     +--ro informative-as?        bgp-t:short-as-number
2776                     |     +--ro local-administrator?   netc:bandwidth
2777                     +--:(traffic-action-extended-community-case)
2778                     |  +--ro traffic-action-extended-community
2779                     |     +--ro sample?            boolean
2780                     |     +--ro terminal-action?   boolean
2781                     +--:(redirect-extended-community-case)
2782                     |  +--ro redirect-extended-community
2783                     |     +--ro global-administrator?   bgp-t:short-as-number
2784                     |     +--ro local-administrator?    binary
2785                     +--:(traffic-marking-extended-community-case)
2786                     |  +--ro traffic-marking-extended-community
2787                     |     +--ro global-administrator?   dscp
2788                     +--:(redirect-ipv4-extended-community-case)
2789                     |  +--ro redirect-ipv4
2790                     |     +--ro global-administrator?   inet:ipv4-address
2791                     |     +--ro local-administrator?    uint16
2792                     +--:(redirect-as4-extended-community-case)
2793                     |  +--ro redirect-as4
2794                     |     +--ro global-administrator?   inet:as-number
2795                     |     +--ro local-administrator?    uint16
2796                     +--:(redirect-ip-nh-extended-community-case)
2797                       +--ro redirect-ip-nh-extended-community
2798                          +--ro next-hop-address?   inet:ip-address
2799                          +--ro copy?               boolean
2800
2801
2802 IPv6 Flow Specification Route
2803 '''''''''''''''''''''''''''''
2804 .. code-block:: console
2805
2806    :(flowspec-ipv6-routes-case)
2807      +--ro flowspec-ipv6-routes
2808         +--ro flowspec-route* [route-key path-id]
2809            +--ro flowspec*
2810            |  +--ro (flowspec-type)?
2811            |     +--:(port-case)
2812            |     |  +--ro ports*
2813            |     |     +--ro op?      numeric-operand
2814            |     |     +--ro value?   uint16
2815            |     +--:(destination-port-case)
2816            |     |  +--ro destination-ports*
2817            |     |     +--ro op?      numeric-operand
2818            |     |     +--ro value?   uint16
2819            |     +--:(source-port-case)
2820            |     |  +--ro source-ports*
2821            |     |     +--ro op?      numeric-operand
2822            |     |     +--ro value?   uint16
2823            |     +--:(icmp-type-case)
2824            |     |  +--ro types*
2825            |     |     +--ro op?      numeric-operand
2826            |     |     +--ro value?   uint8
2827            |     +--:(icmp-code-case)
2828            |     |  +--ro codes*
2829            |     |     +--ro op?      numeric-operand
2830            |     |     +--ro value?   uint8
2831            |     +--:(tcp-flags-case)
2832            |     |  +--ro tcp-flags*
2833            |     |     +--ro op?      bitmask-operand
2834            |     |     +--ro value?   uint16
2835            |     +--:(packet-length-case)
2836            |     |  +--ro packet-lengths*
2837            |     |     +--ro op?      numeric-operand
2838            |     |     +--ro value?   uint16
2839            |     +--:(dscp-case)
2840            |     |  +--ro dscps*
2841            |     |     +--ro op?      numeric-operand
2842            |     |     +--ro value?   dscp
2843            |     +--:(fragment-case)
2844            |     |  +--ro fragments*
2845            |     |     +--ro op?      bitmask-operand
2846            |     |     +--ro value?   fragment
2847            |     +--:(destination-ipv6-prefix-case)
2848            |     |  +--ro destination-prefix?   inet:ipv6-prefix
2849            |     +--:(source-ipv6-prefix-case)
2850            |     |  +--ro source-prefix?        inet:ipv6-prefix
2851            |     +--:(next-header-case)
2852            |     |  +--ro next-headers*
2853            |     |     +--ro op?      numeric-operand
2854            |     |     +--ro value?   uint8
2855            |     +--:(flow-label-case)
2856            |        +--ro flow-label*
2857            |           +--ro op?      numeric-operand
2858            |           +--ro value?   uint32
2859            +--ro path-id       path-id
2860            +--ro attributes
2861               +--ro extended-communities*
2862                  +--ro transitive?                             boolean
2863                  +--ro (extended-community)?
2864                     +--:(traffic-rate-extended-community-case)
2865                     |  +--ro traffic-rate-extended-community
2866                     |     +--ro informative-as?        bgp-t:short-as-number
2867                     |     +--ro local-administrator?   netc:bandwidth
2868                     +--:(traffic-action-extended-community-case)
2869                     |  +--ro traffic-action-extended-community
2870                     |     +--ro sample?            boolean
2871                     |     +--ro terminal-action?   boolean
2872                     +--:(redirect-extended-community-case)
2873                     |  +--ro redirect-extended-community
2874                     |     +--ro global-administrator?   bgp-t:short-as-number
2875                     |     +--ro local-administrator?    binary
2876                     +--:(traffic-marking-extended-community-case)
2877                     |  +--ro traffic-marking-extended-community
2878                     |     +--ro global-administrator?   dscp
2879                     +--:(redirect-ipv6-extended-community-case)
2880                     |  +--ro redirect-ipv6
2881                     |     +--ro global-administrator?   inet:ipv6-address
2882                     |     +--ro local-administrator?    uint16
2883                     +--:(redirect-as4-extended-community-case)
2884                     |  +--ro redirect-as4
2885                     |     +--ro global-administrator?   inet:as-number
2886                     |     +--ro local-administrator?    uint16
2887                     +--:(redirect-ip-nh-extended-community-case)
2888                        +--ro redirect-ip-nh-extended-community
2889                           +--ro next-hop-address?   inet:ip-address
2890                           +--ro copy?               boolean
2891
2892 Usage
2893 ^^^^^
2894 The flowspec route represents rules and an action, defined as an extended community.
2895
2896 IPv4 Flow Specification
2897 '''''''''''''''''''''''
2898 The IPv4 Flowspec table in an instance of the speaker's Loc-RIB can be verified via REST:
2899
2900 **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``
2901
2902 **Method:** ``GET``
2903
2904 **Response Body:**
2905
2906 .. code-block:: xml
2907
2908    <flowspec-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
2909        <flowspec-route>
2910            <path-id>0</path-id>
2911            <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>
2912            <attributes>
2913                <local-pref>
2914                    <pref>100</pref>
2915                </local-pref>
2916                <origin>
2917                    <value>igp</value>
2918                </origin>
2919                <as-path></as-path>
2920                <extended-communities>
2921                    <transitive>true</transitive>
2922                    <redirect-extended-community>
2923                        <local-administrator>AgMWLg==</local-administrator>
2924                        <global-administrator>258</global-administrator>
2925                    </redirect-extended-community>
2926                </extended-communities>
2927            </attributes>
2928            <flowspec>
2929                <destination-prefix>192.168.0.1/32</destination-prefix>
2930            </flowspec>
2931            <flowspec>
2932                <source-prefix>10.0.0.2/32</source-prefix>
2933            </flowspec>
2934            <flowspec>
2935                <protocol-ips>
2936                    <op>equals</op>
2937                    <value>17</value>
2938                </protocol-ips>
2939                <protocol-ips>
2940                    <op>equals end-of-list</op>
2941                    <value>6</value>
2942                </protocol-ips>
2943            </flowspec>
2944            <flowspec>
2945                <ports>
2946                    <op>equals</op>
2947                    <value>80</value>
2948                </ports>
2949                <ports>
2950                    <op>equals end-of-list</op>
2951                    <value>8080</value>
2952                </ports>
2953            </flowspec>
2954            <flowspec>
2955                <destination-ports>
2956                    <op>greater-than</op>
2957                    <value>8080</value>
2958                </destination-ports>
2959                <destination-ports>
2960                    <op>less-than and-bit</op>
2961                    <value>8088</value>
2962                </destination-ports>
2963                <destination-ports>
2964                    <op>equals end-of-list</op>
2965                    <value>3128</value>
2966                </destination-ports>
2967            </flowspec>
2968            <flowspec>
2969                <source-ports>
2970                    <op>end-of-list greater-than</op>
2971                    <value>1024</value>
2972                </source-ports>
2973            </flowspec>
2974        </flowspec-route>
2975    </flowspec-routes>
2976
2977 IPv6 Flows Specification
2978 ''''''''''''''''''''''''
2979 The IPv6 Flowspec table in an instance of the speaker's Loc-RIB can be verified via REST:
2980
2981 **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``
2982
2983 **Method:** ``GET``
2984
2985 **Response Body:**
2986
2987 .. code-block:: xml
2988
2989    <flowspec-ipv6-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
2990        <flowspec-route>
2991            <path-id>0</path-id>
2992            <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>
2993            <attributes>
2994                <local-pref>
2995                    <pref>100</pref>
2996                </local-pref>
2997                <origin>
2998                    <value>igp</value>
2999                </origin>
3000                <as-path></as-path>
3001                <extended-communities>
3002                    <transitive>true</transitive>
3003                    <traffic-rate-extended-community>
3004                        <informative-as>0</informative-as>
3005                        <local-administrator>AAAAAA==</local-administrator>
3006                    </traffic-rate-extended-community>
3007                </extended-communities>
3008            </attributes>
3009            <flowspec>
3010                <destination-prefix>2001:db8:31::/64</destination-prefix>
3011            </flowspec>
3012            <flowspec>
3013                <source-prefix>2001:db8:30::/64</source-prefix>
3014            </flowspec>
3015            <flowspec>
3016                <next-headers>
3017                    <op>equals end-of-list</op>
3018                    <value>17</value>
3019                </next-headers>
3020            </flowspec>
3021            <flowspec>
3022                <dscps>
3023                    <op>equals end-of-list</op>
3024                    <value>50</value>
3025                </dscps>
3026            </flowspec>
3027            <flowspec>
3028                <flow-label>
3029                    <op>equals end-of-list</op>
3030                    <value>2013</value>
3031                </flow-label>
3032            </flowspec>
3033        </flowspec-route>
3034    </flowspec-ipv6-routes>
3035
3036 IPv4 L3VPN Flows Specification
3037 ''''''''''''''''''''''''''''''
3038 The IPv4 L3VPN Flowspec table in an instance of the speaker's Loc-RIB can be verified via REST:
3039
3040 **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``
3041
3042 **Method:** ``GET``
3043
3044 **Response Body:**
3045
3046 .. code-block:: xml
3047
3048    <flowspec-l3vpn-ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3049        <flowspec-l3vpn-route>
3050            <path-id>0</path-id>
3051            <route-key>[l3vpn with route-distinguisher 172.16.0.44:101] all packets from 10.0.0.3/32</route-key>
3052            <attributes>
3053                <local-pref>
3054                    <pref>100</pref>
3055                </local-pref>
3056                <ipv4-next-hop>
3057                    <global>5.6.7.8</global>
3058                </ipv4-next-hop>
3059                <origin>
3060                    <value>igp</value>
3061                </origin>
3062                <as-path></as-path>
3063                <extended-communities>
3064                    <transitive>true</transitive>
3065                    <redirect-ip-nh-extended-community>
3066                        <copy>false</copy>
3067                        <next-hop-address>0.0.0.0</next-hop-address>
3068                    </redirect-ip-nh-extended-community>
3069                </extended-communities>
3070            </attributes>
3071            <route-distinguisher>172.16.0.44:101</route-distinguisher>
3072            <flowspec>
3073                <source-prefix>10.0.0.3/32</source-prefix>
3074            </flowspec>
3075        </flowspec-l3vpn-route>
3076    </flowspec-l3vpn-ipv4-routes>
3077
3078 Programming
3079 ^^^^^^^^^^^
3080 IPv4 Flow Specification
3081 '''''''''''''''''''''''
3082 This examples show how to originate and remove IPv4 fowspec route via programmable RIB.
3083 Make sure the *Application Peer* is configured first.
3084
3085 **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``
3086
3087 **Method:** ``POST``
3088
3089 **Content-Type:** ``application/xml``
3090
3091 **Request Body:**
3092
3093 .. code-block:: xml
3094
3095    <flowspec-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3096        <route-key>flow1</route-key>
3097        <path-id>0</path-id>
3098        <flowspec>
3099            <destination-prefix>192.168.0.1/32</destination-prefix>
3100        </flowspec>
3101        <flowspec>
3102            <source-prefix>10.0.0.1/32</source-prefix>
3103        </flowspec>
3104        <flowspec>
3105            <protocol-ips>
3106                <op>equals end-of-list</op>
3107                <value>6</value>
3108            </protocol-ips>
3109        </flowspec>
3110        <flowspec>
3111            <ports>
3112                <op>equals end-of-list</op>
3113                <value>80</value>
3114            </ports>
3115        </flowspec>
3116        <flowspec>
3117            <destination-ports>
3118                <op>greater-than</op>
3119                <value>8080</value>
3120            </destination-ports>
3121            <destination-ports>
3122                <op>and-bit less-than end-of-list</op>
3123                <value>8088</value>
3124            </destination-ports>
3125        </flowspec>
3126        <flowspec>
3127            <source-ports>
3128                <op>greater-than end-of-list</op>
3129                <value>1024</value>
3130            </source-ports>
3131        </flowspec>
3132        <flowspec>
3133            <types>
3134                <op>equals end-of-list</op>
3135                <value>0</value>
3136            </types>
3137        </flowspec>
3138        <flowspec>
3139            <codes>
3140                <op>equals end-of-list</op>
3141                <value>0</value>
3142            </codes>
3143        </flowspec>
3144        <flowspec>
3145            <tcp-flags>
3146                <op>match end-of-list</op>
3147                <value>32</value>
3148            </tcp-flags>
3149        </flowspec>
3150        <flowspec>
3151            <packet-lengths>
3152                <op>greater-than</op>
3153                <value>400</value>
3154            </packet-lengths>
3155            <packet-lengths>
3156                <op>and-bit less-than end-of-list</op>
3157                <value>500</value>
3158            </packet-lengths>
3159        </flowspec>
3160        <flowspec>
3161            <dscps>
3162                <op>equals end-of-list</op>
3163                <value>20</value>
3164            </dscps>
3165        </flowspec>
3166        <flowspec>
3167            <fragments>
3168                <op>match end-of-list</op>
3169                <value>first</value>
3170            </fragments>
3171        </flowspec>
3172        <attributes>
3173            <origin>
3174                <value>igp</value>
3175            </origin>
3176            <as-path/>
3177            <local-pref>
3178                <pref>100</pref>
3179            </local-pref>
3180            <extended-communities>
3181                ....
3182            </extended-communities>
3183        </attributes>
3184    </flowspec-route>
3185
3186 -----
3187
3188 **Extended Communities**
3189
3190 * **Traffic Rate**
3191    .. code-block:: xml
3192       :linenos:
3193       :emphasize-lines: 5
3194
3195       <extended-communities>
3196           <transitive>true</transitive>
3197           <traffic-rate-extended-community>
3198               <informative-as>123</informative-as>
3199               <local-administrator>AAAAAA==</local-administrator>
3200           </traffic-rate-extended-community>
3201       </extended-communities>
3202
3203    @line 5: A rate in bytes per second, *AAAAAA==* (0) means traffic discard.
3204
3205 * **Traffic Action**
3206    .. code-block:: xml
3207
3208       <extended-communities>
3209           <transitive>true</transitive>
3210           <traffic-action-extended-community>
3211               <sample>true</sample>
3212               <terminal-action>false</terminal-action>
3213           </traffic-action-extended-community>
3214       </extended-communities>
3215
3216
3217 * **Redirect to VRF AS 2byte format**
3218    .. code-block:: xml
3219
3220       <extended-communities>
3221           <transitive>true</transitive>
3222           <redirect-extended-community>
3223               <global-administrator>123</global-administrator>
3224               <local-administrator>AAAAew==</local-administrator>
3225           </redirect-extended-community>
3226       </extended-communities>
3227
3228 * **Redirect to VRF IPv4 format**
3229    .. code-block:: xml
3230
3231       <extended-communities>
3232           <transitive>true</transitive>
3233           <redirect-ipv4>
3234               <global-administrator>192.168.0.1</global-administrator>
3235               <local-administrator>12345</local-administrator>
3236           </redirect-ipv4>
3237       </extended-communities>
3238
3239 * **Redirect to VRF AS 4byte format**
3240    .. code-block:: xml
3241
3242       <extended-communities>
3243           <transitive>true</transitive>
3244           <redirect-as4>
3245               <global-administrator>64495</global-administrator>
3246               <local-administrator>12345</local-administrator>
3247           </redirect-as4>
3248       </extended-communities>
3249
3250 * **Redirect to IP**
3251    .. code-block:: xml
3252
3253       <extended-communities>
3254           <transitive>true</transitive>
3255           <redirect-ip-nh-extended-community>
3256               <copy>false</false>
3257           </redirect-ip-nh-extended-community>
3258       </extended-communities>
3259
3260 * **Traffic Marking**
3261    .. code-block:: xml
3262
3263       <extended-communities>
3264           <transitive>true</transitive>
3265           <traffic-marking-extended-community>
3266               <global-administrator>20</global-administrator>
3267           </traffic-marking-extended-community>
3268       </extended-communities>
3269
3270 -----
3271
3272 To remove the route added above, following request can be used:
3273
3274 **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``
3275
3276 **Method:** ``DELETE``
3277
3278 IPv4 L3VPN Flow Specification
3279 '''''''''''''''''''''''''''''
3280 This examples show how to originate and remove IPv4 L3VPN fowspec route via programmable RIB.
3281
3282 **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``
3283
3284 **Method:** ``POST``
3285
3286 **Content-Type:** ``application/xml``
3287
3288 **Request Body:**
3289
3290 .. code-block:: xml
3291
3292     <flowspec-l3vpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3293         <path-id>0</path-id>
3294         <route-key>flow-l3vpn</route-key>
3295         <route-distinguisher>172.16.0.44:101</route-distinguisher>
3296         <flowspec>
3297             <source-prefix>10.0.0.3/32</source-prefix>
3298         </flowspec>
3299         <attributes>
3300             <local-pref>
3301                 <pref>100</pref>
3302             </local-pref>
3303             <origin>
3304                 <value>igp</value>
3305             </origin>
3306             <as-path></as-path>
3307                <extended-communities>
3308                    <transitive>true</transitive>
3309                    <redirect-ipv4>
3310                        <global-administrator>172.16.0.44</global-administrator>
3311                        <local-administrator>102</local-administrator>
3312                    </redirect-ipv4>
3313                </extended-communities>
3314         </attributes>
3315     </flowspec-l3vpn-route>
3316
3317 -----
3318
3319 To remove the route added above, following request can be used:
3320
3321 **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``
3322
3323 **Method:** ``DELETE``
3324
3325 IPv6 Flow Specification
3326 '''''''''''''''''''''''
3327 This examples show how to originate and remove IPv6 fowspec route via programmable RIB.
3328
3329 **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``
3330
3331 **Method:** ``POST``
3332
3333 **Content-Type:** ``application/xml``
3334
3335 **Request Body:**
3336
3337 .. code-block:: xml
3338
3339    <flowspec-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
3340        <route-key>flow-v6</route-key>
3341        <path-id>0</path-id>
3342        <flowspec>
3343            <destination-prefix>2001:db8:30::3/128</destination-prefix>
3344        </flowspec>
3345        <flowspec>
3346            <source-prefix>2001:db8:31::3/128</source-prefix>
3347         </flowspec>
3348        <flowspec>
3349            <flow-label>
3350                <op>equals end-of-list</op>
3351                <value>1</value>
3352            </flow-label>
3353        </flowspec>
3354        <attributes>
3355            <extended-communities>
3356                <transitive>true</transitive>
3357                <redirect-ipv6>
3358                    <global-administrator>2001:db8:1::6</global-administrator>
3359                    <local-administrator>12345</local-administrator>
3360                </redirect-ipv6>
3361            </extended-communities>
3362            <origin>
3363                <value>igp</value>
3364            </origin>
3365            <as-path/>
3366            <local-pref>
3367                <pref>100</pref>
3368            </local-pref>
3369        </attributes>
3370    </flowspec-route>
3371
3372 -----
3373
3374 To remove the route added above, following request can be used:
3375
3376 **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``
3377
3378 **Method:** ``DELETE``
3379
3380 References
3381 ^^^^^^^^^^
3382 * `Dissemination of Flow Specification Rules <https://tools.ietf.org/html/rfc5575>`_
3383 * `Dissemination of Flow Specification Rules for IPv6 <https://tools.ietf.org/html/draft-ietf-idr-flow-spec-v6-07>`_
3384 * `BGP Flow-Spec Extended Community for Traffic Redirect to IP Next Hop <https://tools.ietf.org/html/draft-ietf-idr-flowspec-redirect-ip-00>`_
3385 * `Clarification of the Flowspec Redirect Extended Community <https://tools.ietf.org/html/rfc7674>`_
3386 * `Revised Validation Procedure for BGP Flow Specifications <https://tools.ietf.org/html/draft-ietf-idr-bgp-flowspec-oid-03>`_
3387
3388 EVPN Family
3389 -----------
3390 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.
3391 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.
3392 In addition to MPLS, IP tunnelling encapsulation techniques like VXLAN, NVGRE, MPLSoGRE and others can be used for packet transportation.
3393 Also, Provider Backbone Bridging (PBB) can be combined with EVPN in order to reduce a number of MAC Advertisement routes.
3394
3395 .. contents:: Contents
3396    :depth: 2
3397    :local:
3398
3399 Configuration
3400 ^^^^^^^^^^^^^
3401 This section shows a way to enable EVPN family in BGP speaker and peer configuration.
3402
3403 BGP Speaker
3404 '''''''''''
3405 To enable EVPN support in BGP plugin, first configure BGP speaker instance:
3406
3407 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
3408
3409 **Method:** ``POST``
3410
3411 **Content-Type:** ``application/xml``
3412
3413 **Request Body:**
3414
3415 .. code-block:: xml
3416
3417    <protocol xmlns="http://openconfig.net/yang/network-instance">
3418        <name>bgp-example</name>
3419        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
3420        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
3421            <global>
3422                <config>
3423                    <router-id>192.0.2.2</router-id>
3424                    <as>65000</as>
3425                </config>
3426                <afi-safis>
3427                    <afi-safi>
3428                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
3429                    </afi-safi>
3430                </afi-safis>
3431            </global>
3432        </bgp>
3433    </protocol>
3434
3435 BGP Peer
3436 ''''''''
3437 Here is an example for BGP peer configuration with enabled EVPN family.
3438
3439 **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``
3440
3441 **Method:** ``POST``
3442
3443 **Content-Type:** ``application/xml``
3444
3445 **Request Body:**
3446
3447 .. code-block:: xml
3448
3449    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
3450        <neighbor-address>192.0.2.1</neighbor-address>
3451        <afi-safis>
3452            <afi-safi>
3453                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
3454            </afi-safi>
3455        </afi-safis>
3456    </neighbor>
3457
3458 EVPN Route API
3459 ^^^^^^^^^^^^^^
3460 Following tree illustrate the BGP EVPN route structure.
3461
3462 .. code-block:: console
3463
3464    :(evpn-routes-case)
3465       +--ro evpn-routes
3466          +--ro evpn-route* [route-key]
3467             +--ro route-key                     string
3468             +--ro (evpn-choice)
3469             |  +--:(ethernet-a-d-route-case)
3470             |  |  +--ro ethernet-a-d-route
3471             |  |     +--ro (esi)
3472             |  |     |  +--:(arbitrary-case)
3473             |  |     |  |  +--ro arbitrary
3474             |  |     |  |     +--ro arbitrary    binary
3475             |  |     |  +--:(lacp-auto-generated-case)
3476             |  |     |  |  +--ro lacp-auto-generated
3477             |  |     |  |     +--ro ce-lacp-mac-address    yang:mac-address
3478             |  |     |  |     +--ro ce-lacp-port-key       uint16
3479             |  |     |  +--:(lan-auto-generated-case)
3480             |  |     |  |  +--ro lan-auto-generated
3481             |  |     |  |     +--ro root-bridge-mac-address    yang:mac-address
3482             |  |     |  |     +--ro root-bridge-priority       uint16
3483             |  |     |  +--:(mac-auto-generated-case)
3484             |  |     |  |  +--ro mac-auto-generated
3485             |  |     |  |     +--ro system-mac-address     yang:mac-address
3486             |  |     |  |     +--ro local-discriminator    uint24
3487             |  |     |  +--:(router-id-generated-case)
3488             |  |     |  |  +--ro router-id-generated
3489             |  |     |  |     +--ro router-id              inet:ipv4-address
3490             |  |     |  |     +--ro local-discriminator    uint32
3491             |  |     |  +--:(as-generated-case)
3492             |  |     |     +--ro as-generated
3493             |  |     |        +--ro as                     inet:as-number
3494             |  |     |        +--ro local-discriminator    uint32
3495             |  |     +--ro ethernet-tag-id
3496             |  |     |  +--ro vlan-id    uint32
3497             |  |     +--ro mpls-label             netc:mpls-label
3498             |  +--:(mac-ip-adv-route-case)
3499             |  |  +--ro mac-ip-adv-route
3500             |  |     +--ro (esi)
3501             |  |     |  +--:(arbitrary-case)
3502             |  |     |  |  +--ro arbitrary
3503             |  |     |  |     +--ro arbitrary    binary
3504             |  |     |  +--:(lacp-auto-generated-case)
3505             |  |     |  |  +--ro lacp-auto-generated
3506             |  |     |  |     +--ro ce-lacp-mac-address    yang:mac-address
3507             |  |     |  |     +--ro ce-lacp-port-key       uint16
3508             |  |     |  +--:(lan-auto-generated-case)
3509             |  |     |  |  +--ro lan-auto-generated
3510             |  |     |  |     +--ro root-bridge-mac-address    yang:mac-address
3511             |  |     |  |     +--ro root-bridge-priority       uint16
3512             |  |     |  +--:(mac-auto-generated-case)
3513             |  |     |  |  +--ro mac-auto-generated
3514             |  |     |  |     +--ro system-mac-address     yang:mac-address
3515             |  |     |  |     +--ro local-discriminator    uint24
3516             |  |     |  +--:(router-id-generated-case)
3517             |  |     |  |  +--ro router-id-generated
3518             |  |     |  |     +--ro router-id              inet:ipv4-address
3519             |  |     |  |     +--ro local-discriminator    uint32
3520             |  |     |  +--:(as-generated-case)
3521             |  |     |     +--ro as-generated
3522             |  |     |        +--ro as                     inet:as-number
3523             |  |     |        +--ro local-discriminator    uint32
3524             |  |     +--ro ethernet-tag-id
3525             |  |     |  +--ro vlan-id    uint32
3526             |  |     +--ro mac-address            yang:mac-address
3527             |  |     +--ro ip-address?            inet:ip-address
3528             |  |     +--ro mpls-label1            netc:mpls-label
3529             |  |     +--ro mpls-label2?           netc:mpls-label
3530             |  +--:(inc-multi-ethernet-tag-res-case)
3531             |  |  +--ro inc-multi-ethernet-tag-res
3532             |  |     +--ro ethernet-tag-id
3533             |  |     |  +--ro vlan-id    uint32
3534             |  |     +--ro orig-route-ip?     inet:ip-address
3535             |  +--:(es-route-case)
3536             |     +--ro es-route
3537             |        +--ro (esi)
3538             |        |  +--:(arbitrary-case)
3539             |        |  |  +--ro arbitrary
3540             |        |  |     +--ro arbitrary    binary
3541             |        |  +--:(lacp-auto-generated-case)
3542             |        |  |  +--ro lacp-auto-generated
3543             |        |  |     +--ro ce-lacp-mac-address    yang:mac-address
3544             |        |  |     +--ro ce-lacp-port-key       uint16
3545             |        |  +--:(lan-auto-generated-case)
3546             |        |  |  +--ro lan-auto-generated
3547             |        |  |     +--ro root-bridge-mac-address    yang:mac-address
3548             |        |  |     +--ro root-bridge-priority       uint16
3549             |        |  +--:(mac-auto-generated-case)
3550             |        |  |  +--ro mac-auto-generated
3551             |        |  |     +--ro system-mac-address     yang:mac-address
3552             |        |  |     +--ro local-discriminator    uint24
3553             |        |  +--:(router-id-generated-case)
3554             |        |  |  +--ro router-id-generated
3555             |        |  |     +--ro router-id              inet:ipv4-address
3556             |        |  |     +--ro local-discriminator    uint32
3557             |        |  +--:(as-generated-case)
3558             |        |     +--ro as-generated
3559             |        |        +--ro as                     inet:as-number
3560             |        |        +--ro local-discriminator    uint32
3561             |        +--ro orig-route-ip          inet:ip-address
3562             +--ro route-distinguisher           bgp-t:route-distinguisher
3563             +--ro attributes
3564                +--ro extended-communities*
3565                |  +--ro transitive?                              boolean
3566                |  +--ro (extended-community)?
3567                |     +--:(encapsulation-case)
3568                |     |  +--ro encapsulation-extended-community
3569                |     |     +--ro tunnel-type    encapsulation-tunnel-type
3570                |     +--:(esi-label-extended-community-case)
3571                |     |  +--ro esi-label-extended-community
3572                |     |     +--ro single-active-mode?   boolean
3573                |     |     +--ro esi-label             netc:mpls-label
3574                |     +--:(es-import-route-extended-community-case)
3575                |     |  +--ro es-import-route-extended-community
3576                |     |     +--ro es-import    yang:mac-address
3577                |     +--:(mac-mobility-extended-community-case)
3578                |     |  +--ro mac-mobility-extended-community
3579                |     |     +--ro static?       boolean
3580                |     |     +--ro seq-number    uint32
3581                |     +--:(default-gateway-extended-community-case)
3582                |     |  +--ro default-gateway-extended-community!
3583                |     +--:(layer-2-attributes-extended-community-case)
3584                |        +--ro layer-2-attributes-extended-community
3585                |           +--ro primary-pe?     boolean
3586                |           +--ro backup-pe?      boolean
3587                |           +--ro control-word?   boolean
3588                |           +--ro l2-mtu          uint16
3589                +--ro pmsi-tunnel!
3590                   +--ro leaf-information-required    boolean
3591                   +--ro mpls-label?                  netc:mpls-label
3592                   +--ro (tunnel-identifier)?
3593                      +--:(rsvp-te-p2mp-lsp)
3594                      |  +--ro rsvp-te-p2mp-lps
3595                      |     +--ro p2mp-id               uint32
3596                      |     +--ro tunnel-id             uint16
3597                      |     +--ro extended-tunnel-id    inet:ip-address
3598                      +--:(mldp-p2mp-lsp)
3599                      |  +--ro mldp-p2mp-lsp
3600                      |     +--ro address-family       identityref
3601                      |     +--ro root-node-address    inet:ip-address
3602                      |     +--ro opaque-value*
3603                      |        +--ro opaque-type             uint8
3604                      |        +--ro opaque-extended-type?   uint16
3605                      |        +--ro opaque                  yang:hex-string
3606                      +--:(pim-ssm-tree)
3607                      |  +--ro pim-ssm-tree
3608                      |     +--ro p-address            inet:ip-address
3609                      |     +--ro p-multicast-group    inet:ip-address
3610                      +--:(pim-sm-tree)
3611                      |  +--ro pim-sm-tree
3612                      |     +--ro p-address            inet:ip-address
3613                      |     +--ro p-multicast-group    inet:ip-address
3614                      +--:(bidir-pim-tree)
3615                      |  +--ro bidir-pim-tree
3616                      |     +--ro p-address            inet:ip-address
3617                      |     +--ro p-multicast-group    inet:ip-address
3618                      +--:(ingress-replication)
3619                      |  +--ro ingress-replication
3620                      |     +--ro receiving-endpoint-address?   inet:ip-address
3621                      +--:(mldp-mp2mp-lsp)
3622                         +--ro mldp-mp2mp-lsp
3623                            +--ro opaque-type             uint8
3624                            +--ro opaque-extended-type?   uint16
3625                            +--ro opaque
3626                      ...
3627
3628 Usage
3629 ^^^^^
3630 The L2VPN EVPN table in an instance of the speaker's Loc-RIB can be verified via REST:
3631
3632 **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``
3633
3634 **Method:** ``GET``
3635
3636 **Response Body:**
3637
3638 .. code-block:: xml
3639
3640    <evpn-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-evpn">
3641       <evpn-route>
3642          <route-key>AxEAAcCoZAED6AAAAQAgwKhkAQ==</route-key>
3643          <route-distinguisher>192.168.100.1:1000</route-distinguisher>
3644          <inc-multi-ethernet-tag-res>
3645             <ethernet-tag-id>
3646                <vlan-id>256</vlan-id>
3647             </ethernet-tag-id>
3648             <orig-route-ip>192.168.100.1</orig-route-ip>
3649          </inc-multi-ethernet-tag-res>
3650          <attributes>
3651             <ipv4-next-hop>
3652                <global>172.23.29.104</global>
3653             </ipv4-next-hop>
3654             <as-path/>
3655             <origin>
3656                <value>igp</value>
3657             </origin>
3658             <extended-communities>
3659                <extended-communities>
3660                    <transitive>true</transitive>
3661                    <route-target-extended-community>
3662                        <global-administrator>65504</global-administrator>
3663                        <local-administrator>AAAD6A==</local-administrator>
3664                    </route-target-extended-community>
3665                </extended-communities>
3666             </extended-communities>
3667             <pmsi-tunnel>
3668                 <leaf-information-required>true</leaf-information-required>
3669                 <mpls-label>20024</mpls-label>
3670                 <ingress-replication>
3671                     <receiving-endpoint-address>192.168.100.1</receiving-endpoint-address>
3672                 </ingress-replication>
3673             </pmsi-tunnel>
3674          </attributes>
3675       </evpn-route>
3676    </evpn-routes>
3677
3678 Programming
3679 ^^^^^^^^^^^
3680 This examples show how to originate and remove EVPN routes via programmable RIB.
3681 There are four different types of EVPN routes, and several extended communities.
3682 Routes can be used for variety of use-cases supported by BGP/MPLS EVPN, PBB EVPN and NVO EVPN.
3683 Make sure the *Application Peer* is configured first.
3684
3685 **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``
3686
3687 **Method:** ``POST``
3688
3689 **Content-Type:** ``application/xml``
3690
3691 **Request Body:**
3692
3693 .. code-block:: xml
3694    :linenos:
3695    :emphasize-lines: 3,4,14
3696
3697    <evpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-evpn">
3698        <route-key>evpn</route-key>
3699        <route-distinguisher>172.12.123.3:200</route-distinguisher>
3700        ....
3701        <attributes>
3702            <ipv4-next-hop>
3703                <global>199.20.166.41</global>
3704            </ipv4-next-hop>
3705            <as-path/>
3706            <origin>
3707                <value>igp</value>
3708            </origin>
3709            <extended-communities>
3710            ....
3711            </extended-communities>
3712        </attributes>
3713    </evpn-route>
3714
3715 @line 3: Route Distinguisher (RD) - set to RD of the MAC-VRF advertising the NLRI, recommended format *<IP>:<VLAN_ID>*
3716
3717 @line 4: One of the EVPN route must be set here.
3718
3719 @line 14: In some cases, specific extended community presence is required. The route may carry one or more Route Target attributes.
3720
3721 -----
3722
3723 **EVPN Routes:**
3724
3725 * **Ethernet AD per ESI**
3726    .. code-block:: xml
3727
3728       <ethernet-a-d-route>
3729           <mpls-label>0</mpls-label>
3730           <ethernet-tag-id>
3731               <vlan-id>4294967295</vlan-id>
3732           </ethernet-tag-id>
3733           <arbitrary>
3734               <arbitrary>AAAAAAAAAAAA</arbitrary>
3735           </arbitrary>
3736       </ethernet-a-d-route>
3737
3738 * **Ethernet AD per EVI**
3739    .. code-block:: xml
3740
3741       <ethernet-a-d-route>
3742           <mpls-label>24001</mpls-label>
3743           <ethernet-tag-id>
3744               <vlan-id>2200</vlan-id>
3745           </ethernet-tag-id>
3746           <arbitrary>
3747               <arbitrary>AAAAAAAAAAAA</arbitrary>
3748           </arbitrary>
3749       </ethernet-a-d-route>
3750
3751 * **MAC/IP Advertisement**
3752    .. code-block:: xml
3753
3754       <mac-ip-adv-route>
3755           <arbitrary>
3756               <arbitrary>AAAAAAAAAAAA</arbitrary>
3757           </arbitrary>
3758           <ethernet-tag-id>
3759               <vlan-id>2100</vlan-id>
3760           </ethernet-tag-id>
3761           <mac-address>f2:0c:dd:80:9f:f7</mac-address>
3762           <ip-address>10.0.1.12</ip-address>
3763           <mpls-label1>299776</mpls-label1>
3764       </mac-ip-adv-route>
3765
3766
3767 * **Inclusive Multicast Ethernet Tag**
3768    .. code-block:: xml
3769
3770       <inc-multi-ethernet-tag-res>
3771           <ethernet-tag-id>
3772               <vlan-id>2100</vlan-id>
3773           </ethernet-tag-id>
3774           <orig-route-ip>43.43.43.43</orig-route-ip>
3775       </inc-multi-ethernet-tag-res>
3776
3777 * **Ethernet Segment**
3778    .. code-block:: xml
3779
3780       <es-route>
3781           <orig-route-ip>43.43.43.43</orig-route-ip>
3782           <arbitrary>
3783               <arbitrary>AAAAAAAAAAAA</arbitrary>
3784           </arbitrary>
3785       </es-route>
3786
3787 **EVPN Ethernet Segment Identifier (ESI):**
3788
3789 * **Type 0**
3790    Indicates an arbitrary 9-octet ESI.
3791
3792    .. code-block:: xml
3793
3794       <arbitrary>
3795           <arbitrary>AAAAAAAAAAAA</arbitrary>
3796       </arbitrary>
3797
3798 * **Type 1**
3799    IEEE 802.1AX LACP is used.
3800
3801    .. code-block:: xml
3802
3803       <lacp-auto-generated>
3804           <ce-lacp-mac-address>f2:0c:dd:80:9f:f7</ce-lacp-mac-address>
3805           <ce-lacp-port-key>22</ce-lacp-port-key>
3806       </lacp-auto-generated>
3807
3808 * **Type 2**
3809    Indirectly connected hosts via a bridged LAN.
3810
3811    .. code-block:: xml
3812
3813       <lan-auto-generated>
3814           <root-bridge-mac-address>f2:0c:dd:80:9f:f7</root-bridge-mac-address>
3815           <root-bridge-priority>20</root-bridge-priority>
3816       </lan-auto-generated>
3817
3818 * **Type 3**
3819    MAC-based ESI.
3820
3821    .. code-block:: xml
3822
3823       <mac-auto-generated>
3824           <system-mac-address>f2:0c:dd:80:9f:f7</system-mac-address>
3825           <local-discriminator>2000</local-discriminator>
3826       </mac-auto-generated>
3827
3828 * **Type 4**
3829    Router-ID ESI
3830
3831    .. code-block:: xml
3832
3833       <router-id-generated>
3834           <router-id>43.43.43.43</router-id>
3835           <local-discriminator>2000</local-discriminator>
3836       </router-id-generated>
3837
3838 * **Type 5**
3839    AS-based ESI
3840
3841    .. code-block:: xml
3842
3843       <as-generated>
3844           <as>16843009</as>
3845           <local-discriminator>2000</local-discriminator>
3846       </as-generated>
3847
3848 **Extended Communities:**
3849
3850 * **ESI Label Extended Community**
3851    .. code-block:: xml
3852
3853       <extended-communities>
3854           <transitive>true</transitive>
3855           <esi-label-extended-community>
3856               <single-active-mode>false</single-active-mode>
3857               <esi-label>24001</esi-label>
3858           </esi-label-extended-community >
3859       </extended-communities>
3860
3861 * **ES-Import Route Target**
3862    .. code-block:: xml
3863
3864       <extended-communities>
3865           <transitive>true</transitive>
3866           <es-import-route-extended-community>
3867               <es-import>f2:0c:dd:80:9f:f7</es-import>
3868           </es-import-route-extended-community>
3869       </extended-communities>
3870
3871 * **MAC Mobility Extended Community**
3872    .. code-block:: xml
3873
3874       <extended-communities>
3875           <transitive>true</transitive>
3876           <mac-mobility-extended-community>
3877               <static>true</static>
3878               <seq-number>200</seq-number>
3879           </mac-mobility-extended-community>
3880       </extended-communities>
3881
3882 * **Default Gateway Extended Community**
3883    .. code-block:: xml
3884
3885       <extended-communities>
3886           <transitive>true</transitive>
3887           <default-gateway-extended-community>
3888           </default-gateway-extended-community>
3889       </extended-communities>
3890
3891 * **EVPN Layer 2 attributes extended community**
3892    .. code-block:: xml
3893
3894       <extended-communities>
3895           <transitive>false</transitive>
3896           <layer-2-attributes-extended-community>
3897               <primary-pe>true</primary-pe>
3898               <backup-pe>true</backup-pe>
3899               <control-word >true</control-word>
3900               <l2-mtu>200</l2-mtu>
3901           </layer-2-attributes-extended-community>
3902       </extended-communities>
3903
3904 * **BGP Encapsulation extended community**
3905    .. code-block:: xml
3906       :linenos:
3907       :emphasize-lines: 4
3908
3909       <extended-communities>
3910           <transitive>false</transitive>
3911           <encapsulation-extended-community>
3912               <tunnel-type>vxlan</tunnel-type>
3913           </encapsulation-extended-community>
3914       </extended-communities>
3915
3916    @line 4: `full list of tunnel types <http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#tunnel-types>`_
3917
3918 * **P-Multicast Service Interface Tunnel (PMSI) attribute**
3919    .. code-block:: xml
3920
3921       <pmsi-tunnel>
3922           <leaf-information-required>true</leaf-information-required>
3923           <mpls-label>20024</mpls-label>
3924           <ingress-replication>
3925               <receiving-endpoint-address>172.12.123.3</receiving-endpoint-address>
3926           </ingress-replication>
3927       </pmsi-tunnel>
3928
3929 -----
3930
3931 To remove the route added above, following request can be used:
3932
3933 **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``
3934
3935 **Method:** ``DELETE``
3936
3937 -----
3938
3939 .. table:: EVPN Routes Usage.
3940
3941    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3942    | EVN Route Type                       | Extended Communities                                | Usage                                     |
3943    +======================================+=====================================================+===========================================+
3944    | **Ethernet Auto-discovery**          | ESI Label, BGP EncapsulationEVPN Layer 2 attributes | Fast Convergence, Split Horizon, Aliasing |
3945    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3946    | **MAC/IP Advertisement**             | BGP Encapsulation, MAC Mobility, Default Gateway    | MAC address reachability                  |
3947    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3948    | **Inclusive Multicast Ethernet Tag** | PMSI Tunnel, BGP Encapsulation                      | Handling of Multi-destination traffic     |
3949    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3950    | **Ethernet Segment**                 | BGP Encapsulation, ES-Import Route Target           | Designated Forwarder Election             |
3951    +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
3952
3953 References
3954 ^^^^^^^^^^
3955 * `BGP MPLS-Based Ethernet VPN <https://tools.ietf.org/html/rfc7432>`_
3956 * `Provider Backbone Bridging Combined with Ethernet VPN <https://tools.ietf.org/html/rfc7623>`_
3957 * `VPWS support in EVPN <https://tools.ietf.org/html/draft-ietf-bess-evpn-vpws-07>`_
3958 * `A Network Virtualization Overlay Solution using EVPN <https://tools.ietf.org/html/draft-ietf-bess-evpn-overlay-04>`_
3959 * `Interconnect Solution for EVPN Overlay networks <https://tools.ietf.org/html/draft-ietf-bess-dci-evpn-overlay-04>`_
3960 * `Usage and applicability of BGP MPLS based Ethernet VPN <https://tools.ietf.org/html/draft-ietf-bess-evpn-usage-03>`_
3961
3962 Additional Path
3963 ---------------
3964 The ADD-PATH capability allows to advertise multiple paths for the same address prefix.
3965 It can help with optimal routing and routing convergence in a network by providing potential alternate or backup paths.
3966
3967 .. contents:: Contents
3968    :depth: 2
3969    :local:
3970
3971 Configuration
3972 ^^^^^^^^^^^^^
3973 This section shows a way to enable ADD-PATH capability in BGP speaker and peer configuration.
3974
3975 .. note:: The capability is applicable for IP Unicast, IP Labeled Unicast and Flow Specification address families.
3976
3977 BGP Speaker
3978 '''''''''''
3979 To enable ADD-PATH capability in BGP plugin, first configure BGP speaker instance:
3980
3981 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
3982
3983 **Method:** ``POST``
3984
3985 **Content-Type:** ``application/xml``
3986
3987 **Request Body:**
3988
3989 .. code-block:: xml
3990    :linenos:
3991    :emphasize-lines: 14
3992
3993    <protocol xmlns="http://openconfig.net/yang/network-instance">
3994        <name>bgp-example</name>
3995        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
3996        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
3997            <global>
3998                <config>
3999                    <router-id>192.0.2.2</router-id>
4000                    <as>65000</as>
4001                </config>
4002                <afi-safis>
4003                    <afi-safi>
4004                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4005                        <receive>true</receive>
4006                        <send-max>2</send-max>
4007                    </afi-safi>
4008                </afi-safis>
4009            </global>
4010        </bgp>
4011    </protocol>
4012
4013 @line 14: Defines path selection strategy: *send-max* > 1 -> Advertise N Paths or *send-max* = 0 -> Advertise All Paths
4014
4015 Here is an example for update a specific family with enable ADD-PATH capability
4016
4017 **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``
4018
4019 **Method:** ``PUT``
4020
4021 **Content-Type:** ``application/xml``
4022
4023 **Request Body:**
4024
4025 .. code-block:: xml
4026
4027    <afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4028       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4029       <receive>true</receive>
4030       <send-max>0</send-max>
4031    </afi-safi>
4032
4033 BGP Peer
4034 ''''''''
4035 Here is an example for BGP peer configuration with enabled 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/neighbors``
4038
4039 **Method:** ``POST``
4040
4041 **Content-Type:** ``application/xml``
4042
4043 **Request Body:**
4044
4045 .. code-block:: xml
4046
4047    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4048        <neighbor-address>192.0.2.1</neighbor-address>
4049        <afi-safis>
4050            <afi-safi>
4051                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
4052            </afi-safi>
4053            <afi-safi>
4054                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4055                <receive>true</receive>
4056                <send-max>0</send-max>
4057            </afi-safi>
4058        </afi-safis>
4059    </neighbor>
4060
4061 .. 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.
4062
4063 Here is an example for update specific family BGP peer configuration with enabled ADD-PATH capability.
4064
4065 **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``
4066
4067 **Method:** ``PUT``
4068
4069 **Content-Type:** ``application/xml``
4070
4071 **Request Body:**
4072
4073 .. code-block:: xml
4074
4075    <afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4076       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4077       <receive>true</receive>
4078       <send-max>0</send-max>
4079    </afi-safi>
4080
4081 Usage
4082 ^^^^^
4083 The IPv4 Unicast table with enabled ADD-PATH capability in an instance of the speaker's Loc-RIB can be verified via REST:
4084
4085 **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``
4086
4087 **Method:** ``GET``
4088
4089 **Response Body:**
4090
4091 .. code-block:: xml
4092    :linenos:
4093    :emphasize-lines: 3
4094
4095    <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
4096        <ipv4-route>
4097            <path-id>1</path-id>
4098            <prefix>193.0.2.1/32</prefix>
4099            <attributes>
4100                <as-path></as-path>
4101                <origin>
4102                    <value>igp</value>
4103                </origin>
4104                <local-pref>
4105                    <pref>100</pref>
4106                </local-pref>
4107                <ipv4-next-hop>
4108                    <global>10.0.0.1</global>
4109                </ipv4-next-hop>
4110            </attributes>
4111        </ipv4-route>
4112        <ipv4-route>
4113            <path-id>2</path-id>
4114            <prefix>193.0.2.1/32</prefix>
4115            <attributes>
4116                <as-path></as-path>
4117                <origin>
4118                    <value>igp</value>
4119                </origin>
4120                <local-pref>
4121                    <pref>100</pref>
4122                </local-pref>
4123                <ipv4-next-hop>
4124                    <global>10.0.0.2</global>
4125                </ipv4-next-hop>
4126            </attributes>
4127        </ipv4-route>
4128    </ipv4-routes>
4129
4130 @line 3: The routes with the same destination are distinguished by *path-id* attribute.
4131
4132 References
4133 ^^^^^^^^^^
4134 * `Advertisement of Multiple Paths in BGP <https://tools.ietf.org/html/rfc7911>`_
4135 * `Best Practices for Advertisement of Multiple Paths in IBGP <https://tools.ietf.org/html/draft-ietf-idr-add-paths-guidelines-08>`_
4136
4137 Route Refresh
4138 -------------
4139 The Route Refresh Capability allows to dynamically request a re-advertisement of the Adj-RIB-Out from a BGP peer.
4140 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.
4141
4142 .. contents:: Contents
4143    :depth: 2
4144    :local:
4145
4146 Configuration
4147 ^^^^^^^^^^^^^
4148 The capability is enabled by default, no additional configuration is required.
4149
4150 Usage
4151 ^^^^^
4152 To send a Route Refresh request from OpenDaylight BGP speaker instance to its neighbor, invoke RPC:
4153
4154 **URL:** ``/restconf/operations/bgp-peer-rpc:route-refresh-request``
4155
4156 **Method:** ``POST``
4157
4158 **Content-Type:** ``application/xml``
4159
4160 **Request Body:**
4161
4162 .. code-block:: xml
4163
4164    <input xmlns="urn:opendaylight:params:xml:ns:yang:bgp-peer-rpc">
4165        <afi xmlns:types="urn:opendaylight:params:xml:ns:yang:bgp-types">types:ipv4-address-family</afi>
4166        <safi xmlns:types="urn:opendaylight:params:xml:ns:yang:bgp-types">types:unicast-subsequent-address-family</safi>
4167        <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>
4168    </input>
4169
4170 References
4171 ^^^^^^^^^^
4172 * `Route Refresh Capability for BGP-4 <https://tools.ietf.org/html/rfc2918>`_
4173
4174 Operational State
4175 -----------------
4176
4177 The OpenDaylight BGP implementation provides a set of APIs (described below), that give its operational state refreshed periodically, by default every 5 seconds.
4178 The following APIs describe what is available starting with how to change the default refresh rate.
4179
4180 .. contents:: Contents
4181    :depth: 2
4182    :local:
4183
4184 Operational State Configuration
4185 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4186
4187 **URL:** ``/restconf/config/bgp-state-config:bgp-state-config``
4188
4189 **Method:** ``PUT``
4190
4191 **Content-Type:** ``application/xml``
4192
4193 **Request Body:**
4194
4195 .. code-block:: xml
4196    :linenos:
4197    :emphasize-lines: 3
4198
4199    <bgp-state-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
4200        <config-name xmlns="urn:opendaylight:params:xml:ns:yang:bgp-state-config">operationalState</config-name>
4201        <timer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-state-config">1</timer>
4202    </bgp-state-config>
4203
4204 @line 3: Time in seconds between operational state update.
4205
4206 BGP RIB Operational State
4207 ^^^^^^^^^^^^^^^^^^^^^^^^^
4208
4209 **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``
4210
4211 **Method:** ``GET``
4212
4213 **Content-Type:** ``application/xml``
4214
4215 **Response Body:**
4216
4217 .. code-block:: xml
4218    :linenos:
4219
4220    <state xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4221        <as>65000</as>
4222        <router-id>192.0.2.2</router-id>
4223        <total-paths>0</total-paths>
4224        <total-prefixes>0</total-prefixes>
4225    </state>
4226
4227 @line 2: AS number of the remote peer.
4228
4229 @line 3: The unique protocol instance identifier.
4230
4231 @line 4: Total number of Paths installed on RIB (Loc-RIB)
4232
4233 @line 5: Total number of Prefixes installed on RIB (Loc-RIB)
4234
4235 BGP RIB Families Operational State
4236 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4237
4238 **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``
4239
4240 **Method:** ``GET``
4241
4242 **Content-Type:** ``application/xml``
4243
4244 **Response Body:**
4245
4246 .. code-block:: xml
4247    :linenos:
4248    :emphasize-lines: 3,5,6
4249
4250    <afi-safis xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4251        <afi-safi>
4252            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4253            <state>
4254                <total-paths>0</total-paths>
4255                <total-prefixes>0</total-prefixes>
4256            </state>
4257        </afi-safi>
4258        <afi-safi>
4259            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
4260            <state>
4261                <total-paths>0</total-paths>
4262                <total-prefixes>0</total-prefixes>
4263            </state>
4264        </afi-safi>
4265        ....
4266    </afi-safis>
4267
4268 @line 3: Family Identifier.
4269
4270 @line 5: Total number of Paths installed on RIB (Loc-RIB) per specific family.
4271
4272 @line 6: Total number of Prefixes installed on RIB (Loc-RIB) per specific family.
4273
4274 BGP Neighbors Operational State
4275 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4276
4277 **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``
4278
4279 **Method:** ``GET``
4280
4281 **Content-Type:** ``application/xml``
4282
4283 **Response Body:**
4284
4285 .. code-block:: xml
4286    :linenos:
4287    :emphasize-lines: 3
4288
4289    <neighbors xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4290        <neighbor>
4291            <neighbor-address>192.0.2.1</neighbor-address>
4292            .....
4293        </neighbor>
4294        <neighbor>
4295            <neighbor-address>192.0.2.2</neighbor-address>
4296            .....
4297        </neighbor>
4298    </neighbors>
4299
4300 @line 3: IP address of the remote BGP peer. Also serves as an unique identifier of a neighbor in a list of neighbors.
4301
4302 BGP Neighbor Operational State
4303 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4304
4305 .. note:: Supported Capabilities only provided when session has been established.
4306
4307 **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``
4308
4309 **Method:** ``GET``
4310
4311 **Content-Type:** ``application/xml``
4312
4313 **Response Body:**
4314
4315 .. code-block:: xml
4316    :linenos:
4317    :emphasize-lines: 2,3,4,7,8,11,12
4318
4319    <state xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4320        <session-state>ESTABLISHED</session-state>
4321        <supported-capabilities xmlns:x="http://openconfig.net/yang/bgp-types">x:ASN32</supported-capabilities>
4322        <supported-capabilities xmlns:x="http://openconfig.net/yang/bgp-types">x:MPBGP</supported-capabilities>
4323        <messages>
4324            <sent>
4325                <UPDATE>0</UPDATE>
4326                <NOTIFICATION>0</NOTIFICATION>
4327            </sent>
4328            <received>
4329                <UPDATE>4</UPDATE>
4330                <NOTIFICATION>0</NOTIFICATION>
4331            </received>
4332        </messages>
4333    </state>
4334
4335 @line 2: Session status
4336
4337 @line 3-4: BGP capabilities supported ( ASN32 / MPBGP / ROUTE_REFRESH / GRACEFUL_RESTART / ADD_PATHS)
4338
4339 @line 7: Total count of Update Messages sent
4340
4341 @line 8: Total count of Notification Messages sent
4342
4343 @line 11: Total count of Update Messages received
4344
4345 @line 12: Total count of Notification Messages received
4346
4347 BGP Neighbor Families Operational State
4348 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4349
4350 .. note:: Graceful Restart not supported yet. Planned for Carbon.
4351
4352
4353 **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``
4354
4355 **Method:** ``GET``
4356
4357 **Content-Type:** ``application/xml``
4358
4359 **Response Body:**
4360
4361 .. code-block:: xml
4362    :linenos:
4363    :emphasize-lines: 3,5,7,9,10
4364
4365    <afi-safis xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4366         <afi-safi>
4367             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4368             <state>
4369                 <active>false</active>
4370             </state>
4371             <graceful-restart>
4372                 <state>
4373                     <received>false</received>
4374                     <advertised>false</advertised>
4375                 </state>
4376             </graceful-restart>
4377         </afi-safi>
4378         <afi-safi>
4379             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
4380             <state>
4381                 <active>false</active>
4382             </state>
4383             <graceful-restart>
4384                 <state>
4385                     <received>false</received>
4386                     <advertised>false</advertised>
4387                 </state>
4388             </graceful-restart>
4389         </afi-safi>
4390    </afi-safis>
4391
4392 @line 3: Family Identifier.
4393
4394 @line 5: True if family is advertized by peer.
4395
4396 @line 7: Graceful Restart Operational State per specific family.
4397
4398 @line 9: True if the peer supports graceful restart.
4399
4400 @line 10: True if we support graceful restart.
4401
4402 BGP Neighbor Family Operational State
4403 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4404
4405 .. note:: Prefixes state is only provided once session is established.
4406 .. note:: Graceful Restart not supported yet. Planned to be implemented in Carbon.
4407
4408 **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``
4409
4410 **Method:** ``GET``
4411
4412 **Content-Type:** ``application/xml``
4413
4414 **Response Body:**
4415
4416 .. code-block:: xml
4417    :linenos:
4418    :emphasize-lines: 2,4,6,7,8
4419
4420    <afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4421        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4422        <state>
4423            <active>true</active>
4424            <prefixes>
4425                <installed>3</installed>
4426                <sent>0</sent>
4427                <received>3</received>
4428            </prefixes>
4429        </state>
4430        <graceful-restart>
4431            <state>
4432                <received>false</received>
4433                <advertised>false</advertised>
4434            </state>
4435        </graceful-restart>
4436    </afi-safi>
4437
4438 @line 2: Family Identifier.
4439
4440 @line 4: True if family is advertized to and by peer.
4441
4442 @line 6: Total count of prefixes advertized by peer and installed (effective-rib-in).
4443
4444 @line 7: Total count of prefixes advertized to peer (adj-rib-out).
4445
4446 @line 8: Total count of prefixes advertized by peer (adj-rib-in).
4447
4448 BGP Neighbor Timers Operational State
4449 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4450
4451 .. note:: State is only provided once session is established.
4452
4453 **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``
4454
4455 **Method:** ``GET``
4456
4457 **Content-Type:** ``application/xml``
4458
4459 **Response Body:**
4460
4461 .. code-block:: xml
4462    :linenos:
4463    :emphasize-lines: 3,4
4464
4465    <timers xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4466        <state>
4467            <negotiated-hold-time>180</negotiated-hold-time>
4468            <uptime>1580676</uptime>
4469        </state>
4470    </timers>
4471
4472 @line 3: The negotiated hold-time for the BGP session in seconds.
4473
4474 @line 4: Session duration since establishment in milliseconds.
4475
4476 BGP Neighbor Transport Operational State
4477 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4478
4479 .. note:: State is only provided once session is established.
4480
4481 **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``
4482
4483 **Method:** ``GET``
4484
4485 **Content-Type:** ``application/xml``
4486
4487 **Response Body:**
4488
4489 .. code-block:: xml
4490    :linenos:
4491    :emphasize-lines: 3,4,5
4492
4493    <transport xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4494        <state>
4495            <remote-address>127.0.0.2</remote-address>
4496            <remote-port>44718</remote-port>
4497            <local-port>1790</local-port>
4498        </state>
4499    </transport>
4500
4501 @line 3: IP address of the remote BGP peer.
4502
4503 @line 4: Port of the remote BGP peer.
4504
4505 @line 5: Local port.
4506
4507 BGP Neighbor Error Handling Operational State
4508 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4509
4510 .. note:: State is only provided once session is established.
4511 .. note:: Error handling not supported yet. Planned for Carbon.
4512
4513 **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``
4514
4515 **Method:** ``GET``
4516
4517 **Content-Type:** ``application/xml``
4518
4519 **Response Body:**
4520
4521 .. code-block:: xml
4522    :linenos:
4523    :emphasize-lines: 3
4524
4525    <error-handling xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4526        <state>
4527            <erroneous-update-messages>0</erroneous-update-messages>
4528        </state>
4529    </error-handling>
4530
4531 @line 3: The number of BGP UPDATE messages for which the treat-as-withdraw mechanism has been applied based on
4532 erroneous message contents
4533
4534 BGP Neighbor Graceful Restart Operational State
4535 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4536
4537 .. note:: Graceful Restart not supported yet. Planned for Carbon.
4538
4539 **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``
4540
4541 **Method:** ``GET``
4542
4543 **Content-Type:** ``application/xml``
4544
4545 **Response Body:**
4546
4547 .. code-block:: xml
4548    :linenos:
4549    :emphasize-lines: 3,4,5
4550
4551    <graceful-restart xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
4552        <state>
4553            <peer-restart-time>0</peer-restart-time>
4554            <peer-restarting>false</peer-restarting>
4555            <local-restarting>false</local-restarting>
4556        </state>
4557    </graceful-restart>
4558
4559 @line 3: The period of time (advertised by the peer) that the peer expects a restart of a BGP session to take.
4560
4561 @line 4: This flag indicates whether the remote neighbor is currently in the process of restarting, and hence
4562 received routes are currently stale.
4563
4564 @line 5: This flag indicates whether the local neighbor is currently restarting. The flag is unset after all NLRI
4565 have been advertised to the peer, and the End-of-RIB (EOR) marker has been unset.
4566
4567 BGP Peer Groups Operational State
4568 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4569
4570 **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``
4571
4572 **Method:** ``GET``
4573
4574 **Content-Type:** ``application/xml``
4575
4576 **Response Body:**
4577
4578 .. code-block:: xml
4579    :linenos:
4580    :emphasize-lines: 3,5,6
4581
4582    <peer-groups>
4583        <peer-group>
4584            <peer-group-name>application-peers</peer-group-name>
4585            <state>
4586                <total-paths>0</total-paths>
4587                <total-prefixes>0</total-prefixes>
4588            </state>
4589    </peer-group>
4590
4591 @line 3: Peer Group Identifier.
4592
4593 @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.
4594
4595 @line 6: Total Prefixes installed under by peers pertaining to this peer group (effective-rib-in).
4596 This count doesn't differentiate repeated prefixes.
4597
4598 High Availability
4599 -----------------
4600 Running OpenDaylight BGP in clustered environment brings an advantage of the plugin's high availability (HA).
4601 This section illustrates a basic scenario for HA, also presents a configuration for clustered OpenDaylight BGP.
4602
4603 .. contents:: Contents
4604    :depth: 2
4605    :local:
4606
4607 Configuration
4608 ^^^^^^^^^^^^^
4609 Following example shows a configuration for running BGP in clustered environment.
4610
4611 #. As the first step, configure (replicated *deafult* shard and *topology* shard if needed) and run OpenDaylight in clustered environment, install BGP and RESTCONF.
4612
4613 #. 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.
4614
4615 #. Remote peer should be configured to accept/initiate connection from/to all OpenDaylight cluster nodes with configured BGP plugin.
4616
4617 #. 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.
4618
4619 .. warning::
4620
4621    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`):
4622
4623    * In ``modules.conf`` add a new module:
4624       .. code-block:: console
4625
4626          {
4627              name = "bgp_rib"
4628              namespace = "urn:opendaylight:params:xml:ns:yang:bgp-rib"
4629              shard-strategy = "module"
4630          }
4631
4632    * In ``module-shards.conf`` define a new module shard:
4633       .. code-block:: console
4634
4635          {
4636              name = "bgp_rib"
4637              shards = [
4638                  {
4639                      name="bgp_rib"
4640                      replicas = [
4641                          "member-1"
4642                      ]
4643                  }
4644              ]
4645          }
4646
4647    **Note:** Use correct member name in module shard configuration.
4648
4649 Failover scenario
4650 ^^^^^^^^^^^^^^^^^
4651 Following section presents a basic BGP speaker failover scenario on 3-node OpenDaylight cluster setup.
4652
4653 .. figure:: ./images/bgpcep/BGP_HA.png
4654    :alt: BGP HA setup.
4655
4656    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.
4657    Routes advertised by remote peer are replicated, hence RIBs state on all nodes is the same.
4658
4659 -----
4660
4661 .. figure:: ./images/bgpcep/BGP_HA_failure.png
4662    :alt: Node went down.
4663
4664    In a case a cluster node, where BGP instance is running, goes down (unexpected failure, restart), active BGP session is dropped.
4665
4666 -----
4667
4668 .. figure:: ./images/bgpcep/BGP_HA_recovery.png
4669    :alt: BGP recovery.
4670
4671    Now, one of the stand-by BGP speaker instances become active. Remote peer establishes new connection and advertises routes again.
4672
4673 Topology Provider
4674 -----------------
4675 This section provides an overview of the BGP topology provider service.
4676 It shows how to configure and use all available BGP topology providers.
4677 Providers are building topology view of BGP routes stored in local BGP speaker's Loc-RIB.
4678 Output topologies are rendered in a form of standardised IETF network topology model.
4679
4680 .. contents:: Contents
4681    :depth: 2
4682    :local:
4683
4684 Inet Reachability Topology
4685 ^^^^^^^^^^^^^^^^^^^^^^^^^^
4686 Inet reachability topology exporter offers a mapping service from IPv4/6 routes to network topology nodes.
4687
4688 Configuration
4689 '''''''''''''
4690 Following example shows how to create a new instance of IPv4 BGP topology exporter:
4691
4692 **URL:** ``/restconf/config/network-topology:network-topology``
4693
4694 **Method:** ``POST``
4695
4696 **Content-Type:** ``application/xml``
4697
4698 **Request Body:**
4699
4700 .. code-block:: xml
4701    :linenos:
4702    :emphasize-lines: 2,4,6
4703
4704    <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4705        <topology-id>bgp-example-ipv4-topology</topology-id>
4706        <topology-types>
4707            <bgp-ipv4-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-ipv4-reachability-topology>
4708        </topology-types>
4709        <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">bgp-example</rib-id>
4710    </topology>
4711
4712 @line 2: An identifier for a topology.
4713
4714 @line 4: Used to identify type of the topology. In this case BGP IPv4 reachability topology.
4715
4716 @line 6: A name of the local BGP speaker instance.
4717
4718 -----
4719
4720 The topology exporter instance can be removed in a following way:
4721
4722 **URL:** ``/restconf/config/network-topology:network-topology/topology/bgp-example-ipv4-topology``
4723
4724 **Method:** ``DELETE``
4725
4726 -----
4727
4728 Following example shows how to create a new instance of IPv6 BGP topology exporter:
4729
4730 **URL:** ``/restconf/config/network-topology:network-topology``
4731
4732 **Method:** ``POST``
4733
4734 **Content-Type:** ``application/xml``
4735
4736 **Request Body:**
4737
4738 .. code-block:: xml
4739
4740    <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4741        <topology-id>bgp-example-ipv6-topology</topology-id>
4742        <topology-types>
4743            <bgp-ipv6-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-ipv6-reachability-topology>
4744        </topology-types>
4745        <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">bgp-example</rib-id>
4746    </topology>
4747
4748 Usage
4749 '''''
4750 Operational state of the topology can be verified via REST:
4751
4752 **URL:** ``/restconf/operational/network-topology:network-topology/topology/bgp-example-ipv4-topology``
4753
4754 **Method:** ``GET``
4755
4756 **Response Body:**
4757
4758 .. code-block:: xml
4759    :linenos:
4760    :emphasize-lines: 8,11
4761
4762    <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4763        <topology-id>bgp-example-ipv4-topology</topology-id>
4764        <server-provided>true</server-provided>
4765        <topology-types>
4766            <bgp-ipv4-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-ipv4-reachability-topology>
4767        </topology-types>
4768        <node>
4769            <node-id>10.10.1.1</node-id>
4770            <igp-node-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
4771                <prefix>
4772                    <prefix>10.0.0.10/32</prefix>
4773                </prefix>
4774            </igp-node-attributes>
4775        </node>
4776    </topology>
4777
4778 @line 8: The identifier of a node in a topology. Its value is mapped from route's NEXT_HOP attribute.
4779
4780 @line 11: The IP prefix attribute of the node. Its value is mapped from routes's destination IP prefix.
4781
4782 BGP Linkstate Topology
4783 ^^^^^^^^^^^^^^^^^^^^^^
4784 BGP linkstate topology exporter offers a mapping service from BGP-LS routes to network topology nodes and links.
4785
4786 Configuration
4787 '''''''''''''
4788 Following example shows how to create a new instance of linkstate BGP topology exporter:
4789
4790 **URL:** ``/restconf/config/network-topology:network-topology``
4791
4792 **Method:** ``POST``
4793
4794 **Content-Type:** ``application/xml``
4795
4796 **Request Body:**
4797
4798 .. code-block:: xml
4799
4800    <topology  xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4801        <topology-id>bgp-example-linkstate-topology</topology-id>
4802        <topology-types>
4803            <bgp-linkstate-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-linkstate-topology>
4804        </topology-types>
4805        <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">bgp-example</rib-id>
4806    </topology>
4807
4808 Usage
4809 '''''
4810 Operational state of the topology can be verified via REST.
4811 A sample output below represents a two node topology with two unidirectional links interconnecting those nodes.
4812
4813 **URL:** ``/restconf/operational/network-topology:network-topology/topology/bgp-example-linkstate-topology``
4814
4815 **Method:** ``GET``
4816
4817 **Response Body:**
4818
4819 .. code-block:: xml
4820
4821    <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
4822        <topology-id>bgp-example-linkstate-topology</topology-id>
4823        <server-provided>true</server-provided>
4824        <topology-types>
4825            <bgp-linkstate-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-linkstate-topology>
4826        </topology-types>
4827        <node>
4828            <node-id>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0040</node-id>
4829            <termination-point>
4830                <tp-id>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.40</tp-id>
4831                <igp-termination-point-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology"/>
4832            </termination-point>
4833            <igp-node-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
4834                <prefix>
4835                    <prefix>40.40.40.40/32</prefix>
4836                    <metric>10</metric>
4837                </prefix>
4838                <prefix>
4839                    <prefix>203.20.160.0/24</prefix>
4840                    <metric>10</metric>
4841                </prefix>
4842                <name>node1</name>
4843                <router-id>40.40.40.40</router-id>
4844                <isis-node-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
4845                    <ted>
4846                        <te-router-id-ipv4>40.40.40.40</te-router-id-ipv4>
4847                    </ted>
4848                    <iso>
4849                        <iso-system-id>MDAwMDAwMDAwMDY0</iso-system-id>
4850                    </iso>
4851                </isis-node-attributes>
4852            </igp-node-attributes>
4853        </node>
4854        <node>
4855            <node-id>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0039</node-id>
4856            <termination-point>
4857                <tp-id>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.39</tp-id>
4858                <igp-termination-point-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology"/>
4859            </termination-point>
4860            <igp-node-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
4861                <prefix>
4862                    <prefix>39.39.39.39/32</prefix>
4863                    <metric>10</metric>
4864                </prefix>
4865                <prefix>
4866                    <prefix>203.20.160.0/24</prefix>
4867                    <metric>10</metric>
4868                </prefix>
4869                <name>node2</name>
4870                <router-id>39.39.39.39</router-id>
4871                <isis-node-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
4872                    <ted>
4873                        <te-router-id-ipv4>39.39.39.39</te-router-id-ipv4>
4874                    </ted>
4875                    <iso>
4876                        <iso-system-id>MDAwMDAwMDAwMDg3</iso-system-id>
4877                    </iso>
4878                </isis-node-attributes>
4879            </igp-node-attributes>
4880        </node>
4881        <link>
4882            <destination>
4883                <dest-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0039</dest-node>
4884                <dest-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.39</dest-tp>
4885            </destination>
4886            <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>
4887            <source>
4888                <source-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0040</source-node>
4889                <source-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.40</source-tp>
4890            </source>
4891            <igp-link-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
4892                <metric>10</metric>
4893                <isis-link-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
4894                    <ted>
4895                        <color>0</color>
4896                        <max-link-bandwidth>1250000.0</max-link-bandwidth>
4897                        <max-resv-link-bandwidth>12500.0</max-resv-link-bandwidth>
4898                        <te-default-metric>0</te-default-metric>
4899                        <unreserved-bandwidth>
4900                            <bandwidth>12500.0</bandwidth>
4901                            <priority>0</priority>
4902                        </unreserved-bandwidth>
4903                        <unreserved-bandwidth>
4904                            <bandwidth>12500.0</bandwidth>
4905                            <priority>1</priority>
4906                        </unreserved-bandwidth>
4907                        <unreserved-bandwidth>
4908                            <bandwidth>12500.0</bandwidth>
4909                            <priority>2</priority>
4910                        </unreserved-bandwidth>
4911                        <unreserved-bandwidth>
4912                            <bandwidth>12500.0</bandwidth>
4913                            <priority>3</priority>
4914                        </unreserved-bandwidth>
4915                        <unreserved-bandwidth>
4916                            <bandwidth>12500.0</bandwidth>
4917                            <priority>4</priority>
4918                        </unreserved-bandwidth>
4919                        <unreserved-bandwidth>
4920                            <bandwidth>12500.0</bandwidth>
4921                            <priority>5</priority>
4922                        </unreserved-bandwidth>
4923                        <unreserved-bandwidth>
4924                            <bandwidth>12500.0</bandwidth>
4925                            <priority>6</priority>
4926                        </unreserved-bandwidth>
4927                        <unreserved-bandwidth>
4928                            <bandwidth>12500.0</bandwidth>
4929                            <priority>7</priority>
4930                        </unreserved-bandwidth>
4931                    </ted>
4932                </isis-link-attributes>
4933            </igp-link-attributes>
4934        </link>
4935        <link>
4936            <destination>
4937                <dest-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0040</dest-node>
4938                <dest-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.40</dest-tp>
4939            </destination>
4940            <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>
4941            <source>
4942                <source-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0039</source-node>
4943                <source-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.39</source-tp>
4944            </source>
4945            <igp-link-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
4946                <metric>10</metric>
4947                <isis-link-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
4948                    <ted>
4949                        <color>0</color>
4950                        <max-link-bandwidth>1250000.0</max-link-bandwidth>
4951                        <max-resv-link-bandwidth>12500.0</max-resv-link-bandwidth>
4952                        <te-default-metric>0</te-default-metric>
4953                        <unreserved-bandwidth>
4954                            <bandwidth>12500.0</bandwidth>
4955                            <priority>0</priority>
4956                        </unreserved-bandwidth>
4957                        <unreserved-bandwidth>
4958                            <bandwidth>12500.0</bandwidth>
4959                            <priority>1</priority>
4960                        </unreserved-bandwidth>
4961                        <unreserved-bandwidth>
4962                            <bandwidth>12500.0</bandwidth>
4963                            <priority>2</priority>
4964                        </unreserved-bandwidth>
4965                        <unreserved-bandwidth>
4966                            <bandwidth>12500.0</bandwidth>
4967                            <priority>3</priority>
4968                        </unreserved-bandwidth>
4969                        <unreserved-bandwidth>
4970                            <bandwidth>12500.0</bandwidth>
4971                            <priority>4</priority>
4972                        </unreserved-bandwidth>
4973                        <unreserved-bandwidth>
4974                            <bandwidth>12500.0</bandwidth>
4975                            <priority>5</priority>
4976                        </unreserved-bandwidth>
4977                        <unreserved-bandwidth>
4978                            <bandwidth>12500.0</bandwidth>
4979                            <priority>6</priority>
4980                        </unreserved-bandwidth>
4981                        <unreserved-bandwidth>
4982                            <bandwidth>12500.0</bandwidth>
4983                            <priority>7</priority>
4984                        </unreserved-bandwidth>
4985                    </ted>
4986                </isis-link-attributes>
4987            </igp-link-attributes>
4988        </link>
4989    </topology>
4990
4991 BGP Network Topology Configuration Loader
4992 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4993
4994 BGP Network Topology Configuration Loader allows user to define static initial configuration for a BGP protocol instance.
4995 This service will detect the creation of new configuration files following the pattern "network-topology-*.xml" under the path "etc/opendaylight/bgp".
4996 Once the file is processed, the defined configuration will be available from the configuration Data Store.
4997
4998 .. note:: If the BGP topology instance is already present, no update or configuration will be applied.
4999
5000 When installing BGP an example will be provided and a default configuration loaded.
5001
5002 **PATH:** ``etc/opendaylight/bgp/network-topology-config.xml``
5003
5004 .. code-block:: xml
5005
5006     <network-topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
5007         <topology>
5008             <topology-id>example-ipv4-topology</topology-id>
5009             <topology-types>
5010                 <bgp-ipv4-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"/>
5011             </topology-types>
5012             <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">example-bgp-rib</rib-id>
5013         </topology>
5014         <topology>
5015             <topology-id>example-ipv6-topology</topology-id>
5016             <topology-types>
5017                 <bgp-ipv6-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"/>
5018             </topology-types>
5019             <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">example-bgp-rib</rib-id>
5020         </topology>
5021         <topology>
5022             <topology-id>example-linkstate-topology</topology-id>
5023             <topology-types>
5024                 <bgp-linkstate-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"/>
5025             </topology-types>
5026             <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">example-bgp-rib</rib-id>
5027         </topology>
5028     </network-topology>
5029
5030 Test Tools
5031 ----------
5032 BGP test tools serves to test basic BGP functionality, scalability and performance.
5033
5034 .. contents:: Contents
5035    :depth: 2
5036    :local:
5037
5038 BGP Test Tool
5039 ^^^^^^^^^^^^^
5040 The BGP Test Tool is a stand-alone Java application purposed to simulate remote BGP peers, that are capable to advertise sample routes.
5041 This application is not part of the OpenDaylight Karaf distribution, however it can be downloaded from OpenDaylight's Nexus (use latest release version):
5042
5043 ``https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/bgpcep/bgp-testtool``
5044
5045 Usage
5046 '''''
5047 The application can be run from command line:
5048
5049 .. code-block:: console
5050
5051    java -jar bgp-testtool-*-executable.jar
5052
5053
5054 with optional input parameters:
5055
5056 .. code-block:: console
5057
5058    -i <BOOLEAN>, --active <BOOLEAN>
5059       Active initialisation of the connection, by default false.
5060
5061    -ho <N>, --holdtimer <N>
5062       In seconds, value of the desired holdtimer, by default 90.
5063
5064    -sc <N>, --speakersCount <N>
5065       Number of simulated BGP speakers, when creating each speaker, uses incremented local-address for binding, by default 0.
5066
5067    -ra <IP_ADDRESS:PORT,...>, --remoteAddress <IP_ADDRESS:PORT,...>
5068       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.
5069
5070    -la <IP_ADDRESS:PORT>, --localAddress <IP_ADDRESS:PORT>
5071       IP address of BGP speakers which the tools simulates, by default 192.0.2.2:0.
5072
5073    -pr <N>, --prefixes <N>
5074       Number of prefixes to be advertised by each simulated speaker
5075
5076    -mp <BOOLEAN>, --multiPathSupport <BOOLEAN>
5077       Active ADD-PATH support, by default false.
5078
5079    -as <N>, --as <N>
5080       Local AS Number, by default 64496.
5081
5082    -ec <EXTENDED_COMMUNITIES>, --extended_communities <EXTENDED_COMMUNITIES>
5083       Extended communities to be send. Format: x,x,x  where  x  is  each  extended  community from bgp-types.yang, by default empty.
5084
5085    -ll <LOG_LEVEL>, --log_level <LOG_LEVEL>
5086       Log level for console output, by default INFO.
5087
5088 BGP Application Peer Benchmark
5089 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5090 It is a simple OpenDaylight application which is capable to inject and remove specific amount of IPv4 routes.
5091 This application is part of the OpenDaylight Karaf distribution.
5092
5093 Configuration
5094 '''''''''''''
5095 As a first step install BGP and RESTCONF, then configure *Application Peer*.
5096 Install ``odl-bgpcep-bgp-benchmark`` feature and reconfigure BGP Application Peer Benchmark application as per following:
5097
5098 **URL:** ``/restconf/config/odl-bgp-app-peer-benchmark-config:config``
5099
5100 **Method:** ``PUT``
5101
5102 **Content-Type:** ``application/xml``
5103
5104 **Request Body:**
5105
5106 .. code-block:: xml
5107    :linenos:
5108    :emphasize-lines: 2
5109
5110    <odl-bgp-app-peer-benchmark-config xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark-config">
5111       <app-peer-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark-config">10.25.1.9</app-peer-id>
5112    </odl-bgp-app-peer-benchmark-config>
5113
5114 @line 2: The *Application Peer* identifier.
5115
5116 Inject routes
5117 '''''''''''''
5118 Routes injection can be invoked via RPC:
5119
5120 **URL:** ``/restconf/operations/odl-bgp-app-peer-benchmark:add-prefix``
5121
5122 **Method:** ``POST``
5123
5124 **Content-Type:** ``application/xml``
5125
5126 **Request Body:**
5127
5128 .. code-block:: xml
5129    :linenos:
5130    :emphasize-lines: 2,3,4,5
5131
5132    <input xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
5133        <prefix>1.1.1.1/32</prefix>
5134        <count>100000</count>
5135        <batchsize>2000</batchsize>
5136        <nexthop>192.0.2.2</nexthop>
5137    </input>
5138
5139 @line 2: A initial IPv4 prefix carried in route. Value is incremented for following routes.
5140
5141 @line 3: An amount of routes to be added to *Application Peer's* programmable RIB.
5142
5143 @line 4: A size of the transaction batch.
5144
5145 @line 5: A NEXT_HOP attribute value used in all injected routes.
5146
5147 **Response Body:**
5148
5149 .. code-block:: xml
5150    :linenos:
5151    :emphasize-lines: 3,4,5
5152
5153    <output xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
5154        <result>
5155            <duration>4301</duration>
5156            <rate>25000</rate>
5157            <count>100000</count>
5158        </result>
5159    </output>
5160
5161 @line 3: Request duration in milliseconds.
5162
5163 @line 4: Writes per second rate.
5164
5165 @line 5: An amount of routes added to *Application Peer's* programmable RIB.
5166
5167 Remove routes
5168 '''''''''''''
5169 Routes deletion can be invoked via RPC:
5170
5171 **URL:** ``/restconf/operations/odl-bgp-app-peer-benchmark:delete-prefix``
5172
5173 **Method:** ``POST``
5174
5175 **Content-Type:** ``application/xml``
5176
5177 **Request Body:**
5178
5179 .. code-block:: xml
5180    :linenos:
5181    :emphasize-lines: 2,3,4
5182
5183    <input xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
5184        <prefix>1.1.1.1/32</prefix>
5185        <count>100000</count>
5186        <batchsize>2000</batchsize>
5187    </input>
5188
5189 @line 2: A initial IPv4 prefix carried in route to be removed. Value is incremented for following routes.
5190
5191 @line 3: An amount of routes to be removed from *Application Peer's* programmable RIB.
5192
5193 @line 4: A size of the transaction batch.
5194
5195 **Response Body:**
5196
5197 .. code-block:: xml
5198
5199    <output xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
5200        <result>
5201            <duration>1837</duration>
5202            <rate>54500</rate>
5203            <count>100000</count>
5204        </result>
5205    </output>
5206
5207 Troubleshooting
5208 ---------------
5209 This section offers advices in a case OpenDaylight BGP plugin is not working as expected.
5210
5211 .. contents:: Contents
5212    :depth: 2
5213    :local:
5214
5215 BGP is not working...
5216 ^^^^^^^^^^^^^^^^^^^^^
5217 * First of all, ensure that all required features are installed, local and remote BGP configuration is correct.
5218
5219 * Check OpenDaylight Karaf logs:
5220
5221 From Karaf console:
5222
5223 .. code-block:: console
5224
5225    log:tail
5226
5227 or open log file: ``data/log/karaf.log``
5228
5229 Possibly, a reason/hint for a cause of the problem can be found there.
5230
5231 * Try to minimise effect of other OpenDaylight features, when searching for a reason of the problem.
5232
5233 * Try to set DEBUG severity level for BGP logger via Karaf console commands, in order to collect more information:
5234
5235 .. code-block:: console
5236
5237    log:set DEBUG org.opendaylight.protocol.bgp
5238
5239 .. code-block:: console
5240
5241    log:set DEBUG org.opendaylight.bgpcep.bgp
5242
5243 Bug reporting
5244 ^^^^^^^^^^^^^
5245 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.
5246
5247 Write an e-mail to bgpcep-users@lists.opendaylight.org and provide following information:
5248
5249 #. State OpenDaylight version
5250
5251 #. Describe your use-case and provide as much details related to BGP as possible
5252
5253 #. Steps to reproduce
5254
5255 #. Attach Karaf log files, optionally packet captures, REST input/output