Migrate bgpcep docs to the bgpcep project 69/75869/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Sun, 9 Sep 2018 00:36:10 +0000 (20:36 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Sun, 9 Sep 2018 00:39:51 +0000 (20:39 -0400)
Issue: DOCS-69
Change-Id: I855bbc445316b0b0fef428666cd31eb56f7bac12
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
74 files changed:
docs/bgp-developer-guide.rst [new file with mode: 0644]
docs/bgp-monitoring-protocol-developer-guide.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-additional-path-capability.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-bgp-application-peer.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-bgp-peering.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-bgp-server.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-config-concepts.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-evpn-family.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-flowspec-family.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-high-availability.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-ip-unicast-family.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-l3vpn-family.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-labeled-family.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-linkstate-family.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-mvpn-family.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-operational-state.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-overview.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-pmsi-attribute.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-protocol-configuration-loader.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-protocol-configuration.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-rib-config-policies.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-route-refresh-capability.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-route-target-family.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-running-bgp.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-supported-capabilities.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-test-tools.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-topology-provider.rst [new file with mode: 0644]
docs/bgp/bgp-user-guide-troubleshooting.rst [new file with mode: 0644]
docs/bgp/images/BGP_HA.png [new file with mode: 0644]
docs/bgp/images/BGP_HA_failure.png [new file with mode: 0644]
docs/bgp/images/BGP_HA_recovery.png [new file with mode: 0644]
docs/bgp/images/MultipleClustersIds.png [new file with mode: 0755]
docs/bgp/images/bgp-app-pipeline.png [new file with mode: 0644]
docs/bgp/images/bgp-pipeline.png [new file with mode: 0644]
docs/bgp/images/local-as.png [new file with mode: 0755]
docs/bgp/index.rst [new file with mode: 0644]
docs/bmp/bgp-monitoring-protocol-user-guide-config-concepts.rst [new file with mode: 0644]
docs/bmp/bgp-monitoring-protocol-user-guide-overview.rst [new file with mode: 0644]
docs/bmp/bgp-monitoring-protocol-user-guide-running-bmp.rst [new file with mode: 0644]
docs/bmp/bgp-monitoring-protocol-user-guide-supported-capabilities.rst [new file with mode: 0644]
docs/bmp/bgp-monitoring-protocol-user-guide-test-tools.rst [new file with mode: 0644]
docs/bmp/bgp-monitoring-protocol-user-guide-troubleshooting.rst [new file with mode: 0644]
docs/bmp/images/bmp-plugin.png [new file with mode: 0644]
docs/bmp/images/bmp.png [new file with mode: 0644]
docs/bmp/index.rst [new file with mode: 0644]
docs/images/bgpcep/PathAttributesSerialization.png [new file with mode: 0644]
docs/images/bgpcep/RIB.png [new file with mode: 0644]
docs/images/bgpcep/bgp-dependency-tree.png [new file with mode: 0644]
docs/images/bgpcep/pcep-dependency-tree.png [new file with mode: 0644]
docs/images/bgpcep/pcep-parsing.png [new file with mode: 0644]
docs/images/bgpcep/validation.png [new file with mode: 0644]
docs/index.rst
docs/pcep-developer-guide.rst [new file with mode: 0644]
docs/pcep/images/pcep-delegation-return.png [new file with mode: 0644]
docs/pcep/images/pcep-deletion.png [new file with mode: 0644]
docs/pcep/images/pcep-initiate.png [new file with mode: 0644]
docs/pcep/images/pcep-plugin.png [new file with mode: 0644]
docs/pcep/images/pcep-re-sync.png [new file with mode: 0644]
docs/pcep/images/pcep-revoke-delegation.png [new file with mode: 0644]
docs/pcep/images/pcep-sync-incremental.png [new file with mode: 0644]
docs/pcep/images/pcep-sync-initial.png [new file with mode: 0644]
docs/pcep/images/pcep-sync-skipped.png [new file with mode: 0644]
docs/pcep/images/pcep-sync.png [new file with mode: 0644]
docs/pcep/images/pcep-update.png [new file with mode: 0644]
docs/pcep/images/pcep.png [new file with mode: 0644]
docs/pcep/index.rst [new file with mode: 0644]
docs/pcep/pcep-user-guide-active-stateful-pce.rst [new file with mode: 0644]
docs/pcep/pcep-user-guide-cli.rst [new file with mode: 0644]
docs/pcep/pcep-user-guide-overview.rst [new file with mode: 0644]
docs/pcep/pcep-user-guide-running-pcep.rst [new file with mode: 0644]
docs/pcep/pcep-user-guide-session-statistics.rst [new file with mode: 0644]
docs/pcep/pcep-user-guide-supported-capabilities.rst [new file with mode: 0644]
docs/pcep/pcep-user-guide-test-tools.rst [new file with mode: 0644]
docs/pcep/pcep-user-guide-troubleshooting.rst [new file with mode: 0644]

diff --git a/docs/bgp-developer-guide.rst b/docs/bgp-developer-guide.rst
new file mode 100644 (file)
index 0000000..108ae3f
--- /dev/null
@@ -0,0 +1,334 @@
+.. _bgp-developer-guide:
+
+BGP Developer Guide
+===================
+
+Overview
+--------
+
+This section provides an overview of the ``odl-bgpcep-bgp-all`` Karaf
+feature. This feature will install everything needed for BGP (Border
+Gateway Protocol) from establishing the connection, storing the data in
+RIBs (Route Information Base) and displaying data in network-topology
+overview.
+
+BGP Architecture
+----------------
+
+Each feature represents a module in the BGPCEP codebase. The following
+diagram illustrates how the features are related.
+
+.. figure:: ./images/bgpcep/bgp-dependency-tree.png
+   :alt: BGP Dependency Tree
+
+   BGP Dependency Tree
+
+Key APIs and Interfaces
+-----------------------
+
+BGP concepts
+~~~~~~~~~~~~
+
+This module contains the base BGP concepts contained in `RFC
+4271 <http://tools.ietf.org/html/rfc4271>`__, `RFC
+4760 <http://tools.ietf.org/html/rfc4760>`__, `RFC
+4456 <http://tools.ietf.org/html/rfc4456>`__, `RFC
+1997 <http://tools.ietf.org/html/rfc1997>`__ and `RFC
+4360 <http://tools.ietf.org/html/rfc4360>`__.
+
+All the concepts are described in one yang model:
+`bgp-types.yang <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/concepts/src/main/yang/bgp-types.yang;hb=refs/heads/stable/boron>`__.
+
+Outside generated classes, there is just one class
+`NextHopUtil <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/concepts/src/main/java/org/opendaylight/bgp/concepts/NextHopUtil.java;hb=refs/heads/stable/boron>`__
+that contains methods for serializing and parsing NextHop.
+
+BGP parser
+~~~~~~~~~~
+
+Base BGP parser includes messages and attributes from `RFC
+4271 <http://tools.ietf.org/html/rfc4271>`__, `RFC
+4760 <http://tools.ietf.org/html/rfc4760>`__, `RFC
+1997 <http://tools.ietf.org/html/rfc1997>`__ and `RFC
+4360 <http://tools.ietf.org/html/rfc4360>`__.
+
+*API* module defines BGP messages in YANG.
+
+*IMPL* module contains actual parsers and serializers for BGP messages
+and
+`Activator <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/BGPActivator.java;hb=refs/heads/stable/boron>`__
+class
+
+*SPI* module contains helper classes needed for registering parsers into
+activators
+
+Registration
+^^^^^^^^^^^^
+
+All parsers and serializers need to be registered into the *Extension
+provider*. This *Extension provider* is configured in initial
+configuration of the parser-spi module (``31-bgp.xml``).
+
+.. code:: xml
+
+     <module>
+      <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:parser:spi">prefix:bgp-extensions-impl</type>
+      <name>global-bgp-extensions</name>
+      <extension>
+       <type xmlns:bgpspi="urn:opendaylight:params:xml:ns:yang:controller:bgp:parser:spi">bgpspi:extension</type>
+       <name>base-bgp-parser</name>
+      </extension>
+      <extension>
+       <type xmlns:bgpspi="urn:opendaylight:params:xml:ns:yang:controller:bgp:parser:spi">bgpspi:extension</type>
+       <name>bgp-linkstate</name>
+      </extension>
+     </module>
+
+-  *base-bgp-parser* - will register parsers and serializers implemented
+   in the bgp-parser-impl module
+
+-  *bgp-linkstate* - will register parsers and serializers implemented
+   in the bgp-linkstate module
+
+The bgp-linkstate module is a good example of a BGP parser extension.
+
+The configuration of bgp-parser-spi specifies one implementation of
+*Extension provider* that will take care of registering mentioned parser
+extensions:
+`SimpleBGPExtensionProviderContext <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/pojo/SimpleBGPExtensionProviderContext.java;hb=refs/heads/stable/boron>`__.
+All registries are implemented in package
+`bgp-parser-spi <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=tree;f=bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi;hb=refs/heads/stable/boron>`__.
+
+Serializing
+^^^^^^^^^^^
+
+The serializing of BGP elements is mostly done in the same way as in
+`PCEP <#_pcep_developer_guide>`__, the only exception is the
+serialization of path attributes, which is described here. Path
+attributes are different from any other BGP element, as path attributes
+don’t implement one common interface, but this interface contains
+getters for individual path attributes (this structure is because update
+message can contain exactly one instance of each path attribute). This
+means, that a given *PathAttributes* object, you can only get to the
+specific type of the path attribute through checking its presence.
+Therefore method *serialize()* in *AttributeRegistry*, won’t look up the
+registered class, instead it will go through the registrations and offer
+this object to the each registered parser. This way the object will be
+passed also to serializers unknown to module bgp-parser, for example to
+LinkstateAttributeParser. RFC 4271 recommends ordering path attributes,
+hence the serializers are ordered in a list as they are registered in
+the *Activator*. In other words, this is the only case, where
+registration ordering matters.
+
+.. figure:: ./images/bgpcep/PathAttributesSerialization.png
+   :alt: PathAttributesSerialization
+
+   PathAttributesSerialization
+
+*serialize()* method in each Path Attribute parser contains check for
+presence of its attribute in the PathAttributes object, which simply
+returns, if the attribute is not there:
+
+.. code:: java
+
+     if (pathAttributes.getAtomicAggregate() == null) {
+         return;
+     }
+     //continue with serialization of Atomic Aggregate
+
+BGP RIB
+-------
+
+The BGP RIB module can be divided into two parts:
+
+-  BGP listener and speaker session handling
+
+-  RIB handling.
+
+Session handling
+~~~~~~~~~~~~~~~~
+
+``31-bgp.xml`` defines only bgp-dispatcher and the parser it should be
+using (global-bgp-extensions).
+
+.. code:: xml
+
+    <module>
+     <type>prefix:bgp-dispatcher-impl</type>
+     <name>global-bgp-dispatcher</name>
+     <bgp-extensions>
+      <type>bgpspi:extensions</type>
+      <name>global-bgp-extensions</name>
+     </bgp-extensions>
+     <boss-group>
+      <type>netty:netty-threadgroup</type>
+      <name>global-boss-group</name>
+     </boss-group>
+     <worker-group>
+      <type>netty:netty-threadgroup</type>
+      <name>global-worker-group</name>
+     </worker-group>
+    </module>
+
+For user configuration of BGP, check User Guide.
+
+Synchronization
+~~~~~~~~~~~~~~~
+
+Synchronization is a phase, where upon connection, a BGP speaker sends
+all available data about topology to its new client. After the whole
+topology has been advertised, the synchronization is over. For the
+listener, the synchronization is over when the RIB receives End-of-RIB
+(EOR) messages. There is a special EOR message for each AFI (Address
+Family Identifier).
+
+-  IPv4 EOR is an empty Update message.
+
+-  Ipv6 EOR is an Update message with empty MP\_UNREACH attribute where
+   AFI and SAFI (Subsequent Address Family Identifier) are set to Ipv6.
+   OpenDaylight also supports EOR for IPv4 in this format.
+
+-  Linkstate EOR is an Update message with empty MP\_UNREACH attribute
+   where AFI and SAFI are set to Linkstate.
+
+For BGP connections, where both peers support graceful restart, the EORs
+are sent by the BGP speaker and are redirected to RIB, where the
+specific AFI/SAFI table is set to *true*. Without graceful restart, the
+messages are generated by OpenDaylight itself and sent after second
+keepalive for each AFI/SAFI. This is done in
+`BGPSynchronization <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSynchronization.java;hb=refs/heads/stable/boron>`__.
+
+**Peers**
+
+`BGPPeer <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java;hb=refs/heads/stable/boron>`__
+has various meanings. If you configure BGP listener, *BGPPeer*
+represents the BGP listener itself. If you are configuring BGP speaker,
+you need to provide a list of peers, that are allowed to connect to this
+speaker. Unknown peer represents, in this case, a peer that is allowed
+to be refused. *BGPPeer* represents in this case peer, that is supposed
+to connect to your speaker. *BGPPeer* is stored in
+`BGPPeerRegistry <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/StrictBGPPeerRegistry.java;hb=refs/heads/stable/boron>`__.
+This registry controls the number of sessions. Our strict implementation
+limits sessions to one per peer.
+
+`ApplicationPeer <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ApplicationPeer.java;hb=refs/heads/stable/boron>`__
+is a special case of peer, that has it’s own RIB. This RIB is populated
+from RESTCONF. The RIB is synchronized with default BGP RIB. Incoming
+routes to the default RIB are treated in the same way as they were from
+a BGP peer (speaker or listener) in the network.
+
+RIB handling
+~~~~~~~~~~~~
+
+RIB (Route Information Base) is defined as a concept in `RFC
+4271 <http://tools.ietf.org/html/rfc4271#section-3.2>`__. RFC does not
+define how it should be implemented. In our implementation, the routes
+are stored in the MD-SAL datastore. There are four supported routes -
+*Ipv4Routes*, *Ipv6Routes*, *LinkstateRoutes* and *FlowspecRoutes*.
+
+Each route type needs to provide a
+`RIBSupport.java <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/RIBSupport.java;hb=refs/heads/stable/boron>`__
+implementation. *RIBSupport* tells RIB how to parse binding-aware data
+(BGP Update message) to binding-independent (datastore format).
+
+Following picture describes the data flow from BGP message that is sent
+to *BGPPeer* to datastore and various types of RIB.
+
+.. figure:: ./images/bgpcep/RIB.png
+   :alt: RIB
+
+   RIB
+
+`AdjRibInWriter <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AdjRibInWriter.java;hb=refs/heads/stable/boron>`__
+- represents the first step in putting data to datastore. This writer is
+notified whenever a peer receives an Update message. The message is
+transformed into binding-independent format and pushed into datastore to
+*adj-rib-in*. This RIB is associated with a peer.
+
+`EffectiveRibInWriter <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java;hb=refs/heads/stable/boron>`__
+- this writer is notified whenever *adj-rib-in* is updated. It applies
+all configured import policies to the routes and stores them in
+*effective-rib-in*. This RIB is also associated with a peer.
+
+`LocRibWriter <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/LocRibWriter.java;hb=refs/heads/stable/boron>`__
+- this writer is notified whenever **any** *effective-rib-in* is updated
+(in any peer). Performs best path selection filtering and stores the
+routes in *loc-rib*. It also determines which routes need to be
+advertised and fills in *adj-rib-out* that is per peer as well.
+
+`AdjRibOutListener <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AdjRibOutListener.java;h=a14fd54a29ea613b381a36248f67491d968963b8;hb=refs/heads/stable/boron>`__
+- listens for changes in *adj-rib-out*, transforms the routes into
+BGPUpdate messages and sends them to its associated peer.
+
+BGP inet
+--------
+
+This module contains only one YANG model
+`bgp-inet.yang <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/inet/src/main/yang/bgp-inet.yang;hb=refs/heads/stable/boron>`__
+that summarizes the ipv4 and ipv6 extensions to RIB routes and BGP
+messages.
+
+BGP flowspec
+------------
+
+BGP flowspec is a module that implements `RFC
+5575 <http://tools.ietf.org/html/rfc5575>`__ for IPv4 AFI and
+`draft-ietf-idr-flow-spec-v6-06 <https://tools.ietf.org/html/draft-ietf-idr-flow-spec-v6-06>`__
+for IPv6 AFI. The RFC defines an extension to BGP in form of a new
+subsequent address family, NLRI and extended communities. All of those
+are defined in the
+`bgp-flowspec.yang <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/flowspec/src/main/yang/bgp-flowspec.yang;hb=refs/heads/stable/boron>`__
+model. In addition to generated sources, the module contains parsers for
+newly defined elements and RIBSupport for flowspec-routes. The route key
+of flowspec routes is a string representing human-readable flowspec
+request.
+
+BGP linkstate
+-------------
+
+BGP linkstate is a module that implements
+`draft-ietf-idr-ls-distribution <http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-04>`__
+version 04. The draft defines an extension to BGP in form of a new
+address family, subsequent address family, NLRI and path attribute. All
+of those are defined in the
+`bgp-linkstate.yang <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/linkstate/src/main/yang/bgp-linkstate.yang;hb=refs/heads/stable/boron>`__
+model. In addition to generated sources, the module contains
+`LinkstateAttributeParser <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/attribute/LinkstateAttributeParser.java;hb=refs/heads/stable/boron>`__,
+`LinkstateNlriParser <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/nlri/LinkstateNlriParser.java;hb=refs/heads/stable/boron>`__,
+activators for both, parser and RIB, and RIBSupport handler for
+linkstate address family. As each route needs a key, in case of
+linkstate, the route key is defined as a binary string, containing all
+the NLRI serialized to byte format. The BGP linkstate extension also
+supports distribution of MPLS TE state as defined in
+`draft-ietf-idr-te-lsp-distribution-03 <https://tools.ietf.org/html/draft-ietf-idr-te-lsp-distribution-03>`__,
+extension for Segment Routing
+`draft-gredler-idr-bgp-ls-segment-routing-ext-00 <https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-00>`__
+and Segment Routing Egress Peer Engineering
+`draft-ietf-idr-bgpls-segment-routing-epe-02 <https://tools.ietf.org/html/draft-ietf-idr-bgpls-segment-routing-epe-02>`__.
+
+BGP labeled-unicast
+-------------------
+
+BGP labeled unicast is a module that implements `RFC
+3107 <https://tools.ietf.org/html/rfc3107>`__. The RFC defines an
+extension to the BGP MP to carry Label Mapping Information as a part of
+the NLRI. The AFI indicates, as usual, the address family of the
+associated route. The fact that the NLRI contains a label is indicated
+by using SAFI value 4. All of those are defined in
+`bgp-labeled-unicast.yang <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob_plain;f=bgp/labeled-unicast/src/main/yang/bgp-labeled-unicast.yang;hb=refs/heads/stable/boron>`__
+model. In addition to the generated sources, the module contains new
+NLRI codec and RIBSupport. The route key is defined as a binary, where
+whole NLRI information is encoded.
+
+BGP topology provider
+---------------------
+
+BGP data besides RIB, is stored in network-topology view. The format of
+how the data is displayed there conforms to
+`draft-clemm-netmod-yang-network-topo <https://tools.ietf.org/html/draft-clemm-netmod-yang-network-topo-01>`__.
+
+API Reference Documentation
+---------------------------
+
+Javadocs are generated while creating mvn:site and they are located in
+target/ directory in each module.
diff --git a/docs/bgp-monitoring-protocol-developer-guide.rst b/docs/bgp-monitoring-protocol-developer-guide.rst
new file mode 100644 (file)
index 0000000..e1246d4
--- /dev/null
@@ -0,0 +1,162 @@
+.. _bgp-monitoring-protocol-developer-guide:
+
+BGP Monitoring Protocol Developer Guide
+=======================================
+
+Overview
+--------
+
+This section provides an overview of **feature odl-bgpcep-bmp**. This
+feature will install everything needed for BMP (BGP Monitoring Protocol)
+including establishing the connection, processing messages, storing
+information about monitored routers, peers and their Adj-RIB-In
+(unprocessed routing information) and Post-Policy Adj-RIB-In and
+displaying data in BGP RIBs overview. The OpenDaylight BMP plugin plays
+the role of a monitoring station.
+
+Key APIs and Interfaces
+-----------------------
+
+Session handling
+~~~~~~~~~~~~~~~~
+
+*32-bmp.xml* defines only bmp-dispatcher the parser should be using
+(global-bmp-extensions).
+
+.. code:: xml
+
+     <module>
+      <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bmp:impl">prefix:bmp-dispatcher-impl</type>
+      <name>global-bmp-dispatcher</name>
+       <bmp-extensions>
+        <type xmlns:bmp-spi="urn:opendaylight:params:xml:ns:yang:controller:bmp:spi">bmp-spi:extensions</type>
+        <name>global-bmp-extensions</name>
+       </bmp-extensions>
+       <boss-group>
+        <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-threadgroup</type>
+        <name>global-boss-group</name>
+       </boss-group>
+       <worker-group>
+        <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-threadgroup</type>
+        <name>global-worker-group</name>
+      </worker-group>
+     </module>
+
+For user configuration of BMP, check User Guide.
+
+Parser
+~~~~~~
+
+The base BMP parser includes messages and attributes from
+https://tools.ietf.org/html/draft-ietf-grow-bmp-15
+
+Registration
+~~~~~~~~~~~~
+
+All parsers and serializers need to be registered into *Extension
+provider*. This *Extension provider* is configured in initial
+configuration of the parser (*32-bmp.xml*).
+
+.. code:: xml
+
+     <module>
+      <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bmp:spi">prefix:bmp-extensions-impl</type>
+      <name>global-bmp-extensions</name>
+      <extension>
+       <type xmlns:bmp-spi="urn:opendaylight:params:xml:ns:yang:controller:bmp:spi">bmp-spi:extension</type>
+       <name>bmp-parser-base</name>
+      </extension>
+     </module>
+
+-  *bmp-parser-base* - will register parsers and serializers implemented
+   in bmp-impl module
+
+Parsing
+~~~~~~~
+
+Parsing of BMP elements is mostly done equally to BGP. Some of the BMP
+messages includes wrapped BGP messages.
+
+BMP Monitoring Station
+~~~~~~~~~~~~~~~~~~~~~~
+
+The BMP application (Monitoring Station) serves as message processor
+incoming from monitored routers. The processed message is transformed
+and relevant information is stored. Route information is stored in a BGP
+RIB data structure.
+
+BMP data is displayed only through one URL that is accessible from the
+base BMP URL:
+
+*`http://<controllerIP>:8181/restconf/operational/bmp-monitor:bmp-monitor <http://<controllerIP>:8181/restconf/operational/bmp-monitor:bmp-monitor>`__*
+
+Each Monitor station will be displayed and it may contains multiple
+monitored routers and peers within:
+
+.. code:: xml
+
+    <bmp-monitor xmlns="urn:opendaylight:params:xml:ns:yang:bmp-monitor">
+     <monitor>
+     <monitor-id>example-bmp-monitor</monitor-id>
+      <router>
+      <router-id>127.0.0.11</router-id>
+       <status>up</status>
+       <peer>
+        <peer-id>20.20.20.20</peer-id>
+        <as>72</as>
+        <type>global</type>
+        <peer-session>
+         <remote-port>5000</remote-port>
+         <timestamp-sec>5</timestamp-sec>
+         <status>up</status>
+         <local-address>10.10.10.10</local-address>
+         <local-port>220</local-port>
+        </peer-session>
+        <pre-policy-rib>
+         <tables>
+          <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
+          <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
+          <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+           <ipv4-route>
+            <prefix>10.10.10.0/24</prefix>
+             <attributes>
+              ...
+             </attributes>
+           </ipv4-route>
+          </ipv4-routes>
+          <attributes>
+           <uptodate>true</uptodate>
+          </attributes>
+         </tables>
+        </pre-policy-rib>
+        <address>10.10.10.10</address>
+        <post-policy-rib>
+         ...
+        </post-policy-rib>
+        <bgp-id>20.20.20.20</bgp-id>
+        <stats>
+         <timestamp-sec>5</timestamp-sec>
+         <invalidated-cluster-list-loop>53</invalidated-cluster-list-loop>
+         <duplicate-prefix-advertisements>16</duplicate-prefix-advertisements>
+         <loc-rib-routes>100</loc-rib-routes>
+         <duplicate-withdraws>11</duplicate-withdraws>
+         <invalidated-as-confed-loop>55</invalidated-as-confed-loop>
+         <adj-ribs-in-routes>10</adj-ribs-in-routes>
+         <invalidated-as-path-loop>66</invalidated-as-path-loop>
+         <invalidated-originator-id>70</invalidated-originator-id>
+         <rejected-prefixes>8</rejected-prefixes>
+        </stats>
+       </peer>
+       <name>name</name>
+       <description>description</description>
+       <info>some info;</info>
+      </router>
+     </monitor>
+    </bmp-monitor>
+    </source>
+
+API Reference Documentation
+---------------------------
+
+Javadocs are generated while creating mvn:site and they are located in
+target/ directory in each module.
diff --git a/docs/bgp/bgp-user-guide-additional-path-capability.rst b/docs/bgp/bgp-user-guide-additional-path-capability.rst
new file mode 100644 (file)
index 0000000..202c5c6
--- /dev/null
@@ -0,0 +1,176 @@
+.. _bgp-user-guide-additional-path-capability:
+
+Additional Path Capability
+==========================
+The ADD-PATH capability allows to advertise multiple paths for the same address prefix.
+It can help with optimal routing and routing convergence in a network by providing potential alternate or backup paths.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+This section shows a way to enable ADD-PATH capability in BGP speaker and peer configuration.
+
+.. note:: The capability is applicable for IP Unicast, IP Labeled Unicast and Flow Specification address families.
+
+BGP Speaker
+'''''''''''
+To enable ADD-PATH capability in BGP plugin, first configure BGP speaker instance:
+
+**URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 14
+
+   <protocol xmlns="http://openconfig.net/yang/network-instance">
+       <name>bgp-example</name>
+       <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
+       <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+           <global>
+               <config>
+                   <router-id>192.0.2.2</router-id>
+                   <as>65000</as>
+               </config>
+               <afi-safis>
+                   <afi-safi>
+                       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
+                       <receive>true</receive>
+                       <send-max>2</send-max>
+                   </afi-safi>
+               </afi-safis>
+           </global>
+       </bgp>
+   </protocol>
+
+@line 14: Defines path selection strategy: *send-max* > 1 -> Advertise N Paths or *send-max* = 0 -> Advertise All Paths
+
+Here is an example for update a specific family with enable ADD-PATH capability
+
+**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``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+      <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
+      <receive>true</receive>
+      <send-max>0</send-max>
+   </afi-safi>
+
+BGP Peer
+''''''''
+Here is an example for BGP peer configuration with enabled ADD-PATH capability.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.1</neighbor-address>
+       <afi-safis>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
+               <receive>true</receive>
+               <send-max>0</send-max>
+           </afi-safi>
+       </afi-safis>
+   </neighbor>
+
+.. 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.
+
+Here is an example for update specific family BGP peer configuration with enabled ADD-PATH capability.
+
+**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``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+      <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
+      <receive>true</receive>
+      <send-max>0</send-max>
+   </afi-safi>
+
+Usage
+^^^^^
+The IPv4 Unicast table with enabled ADD-PATH capability in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+   <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+       <ipv4-route>
+           <path-id>1</path-id>
+           <prefix>193.0.2.1/32</prefix>
+           <attributes>
+               <as-path></as-path>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <ipv4-next-hop>
+                   <global>10.0.0.1</global>
+               </ipv4-next-hop>
+           </attributes>
+       </ipv4-route>
+       <ipv4-route>
+           <path-id>2</path-id>
+           <prefix>193.0.2.1/32</prefix>
+           <attributes>
+               <as-path></as-path>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <ipv4-next-hop>
+                   <global>10.0.0.2</global>
+               </ipv4-next-hop>
+           </attributes>
+       </ipv4-route>
+   </ipv4-routes>
+
+@line 3: The routes with the same destination are distinguished by *path-id* attribute.
+
+References
+^^^^^^^^^^
+* `Advertisement of Multiple Paths in BGP <https://tools.ietf.org/html/rfc7911>`_
+* `Best Practices for Advertisement of Multiple Paths in IBGP <https://tools.ietf.org/html/draft-ietf-idr-add-paths-guidelines-08>`_
diff --git a/docs/bgp/bgp-user-guide-bgp-application-peer.rst b/docs/bgp/bgp-user-guide-bgp-application-peer.rst
new file mode 100644 (file)
index 0000000..bd5dcfe
--- /dev/null
@@ -0,0 +1,312 @@
+.. _bgp-user-guide-bgp-application-peer:
+
+BGP Application Peer and programmable RIB
+=========================================
+The OpenDaylight BGP implementation also supports routes injection via *Application Peer*.
+Such peer has its own programmable RIB, which can be modified by user.
+This concept allows user to originate new routes and advertise them to all connected peers.
+
+Application Peer configuration
+''''''''''''''''''''''''''''''
+Following configuration sample show a way to configure the *Application Peer*:
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,4
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>10.25.1.9</neighbor-address>
+       <config>
+           <peer-group>application-peers</peer-group>
+       </config>
+   </neighbor>
+
+@line 2: IP address is uniquely identifying *Application Peer* and its programmable RIB. Address is also used in local BGP speaker decision process.
+
+@line 4: Indicates that peer is associated with *application-peers* group. It serves to distinguish *Application Peer's* from regular neighbors.
+
+-----
+
+The *Application Peer* presence can be verified via REST:
+
+**URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/peer/bgp:%2F%2F10.25.1.9``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,8
+
+   <peer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
+       <peer-id>bgp://10.25.1.9</peer-id>
+       <peer-role>internal</peer-role>
+       <adj-rib-in>
+           <tables>
+               <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
+               <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
+               <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet"></ipv4-routes>
+               <attributes>
+                   <uptodate>false</uptodate>
+               </attributes>
+           </tables>
+       </adj-rib-in>
+       <effective-rib-in>
+           <tables>
+               <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
+               <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
+               <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet"></ipv4-routes>
+               <attributes></attributes>
+           </tables>
+       </effective-rib-in>
+   </peer>
+
+@line 3: Peer role for *Application Peer* is *internal*.
+
+@line 8: Adj-RIB-In is empty, as no routes were originated yet.
+
+.. note:: There is no Adj-RIB-Out for *Application Peer*.
+
+Programmable RIB
+''''''''''''''''
+Next example shows how to inject a route into the programmable RIB.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+       <path-id>0</path-id>
+       <prefix>10.0.0.11/32</prefix>
+       <attributes>
+           <as-path></as-path>
+           <origin>
+               <value>igp</value>
+           </origin>
+           <local-pref>
+               <pref>100</pref>
+           </local-pref>
+           <ipv4-next-hop>
+               <global>10.11.1.1</global>
+           </ipv4-next-hop>
+       </attributes>
+   </ipv4-route>
+
+-----
+
+Now the injected route appears in *Application Peer's* RIBs and in local speaker's Loc-RIB:
+
+**URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/peer/bgp:%2F%2F10.25.1.9``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 9
+
+   <peer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
+       <peer-id>bgp://10.25.1.9</peer-id>
+       <peer-role>internal</peer-role>
+       <adj-rib-in>
+           <tables>
+               <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
+               <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
+               <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+                   <ipv4-route>
+                       <path-id>0</path-id>
+                       <prefix>10.0.0.11/32</prefix>
+                       <attributes>
+                           <as-path></as-path>
+                           <origin>
+                               <value>igp</value>
+                           </origin>
+                           <local-pref>
+                               <pref>100</pref>
+                           </local-pref>
+                           <ipv4-next-hop>
+                               <global>10.11.1.1</global>
+                           </ipv4-next-hop>
+                       </attributes>
+                   </ipv4-route>
+               </ipv4-routes>
+               <attributes>
+                   <uptodate>false</uptodate>
+               </attributes>
+           </tables>
+       </adj-rib-in>
+       <effective-rib-in>
+           <tables>
+               <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
+               <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
+               <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+                   <ipv4-route>
+                       <path-id>0</path-id>
+                       <prefix>10.0.0.11/32</prefix>
+                       <attributes>
+                           <as-path></as-path>
+                           <origin>
+                               <value>igp</value>
+                           </origin>
+                           <local-pref>
+                               <pref>100</pref>
+                           </local-pref>
+                           <ipv4-next-hop>
+                               <global>10.11.1.1</global>
+                           </ipv4-next-hop>
+                       </attributes>
+                   </ipv4-route>
+               </ipv4-routes>
+               <attributes></attributes>
+           </tables>
+       </effective-rib-in>
+   </peer>
+
+@line 9: Injected route is present in *Application Peer's* Adj-RIB-In and Effective-RIB-In.
+
+-----
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2
+
+   <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+       <ipv4-route>
+           <path-id>0</path-id>
+           <prefix>10.0.0.10/32</prefix>
+           <attributes>
+               <as-path></as-path>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <ipv4-next-hop>
+                   <global>10.11.1.1</global>
+               </ipv4-next-hop>
+           </attributes>
+       </ipv4-route>
+       <ipv4-route>
+           <path-id>0</path-id>
+           <prefix>10.0.0.10/32</prefix>
+           <attributes>
+               <as-path></as-path>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <ipv4-next-hop>
+                   <global>10.10.1.1</global>
+               </ipv4-next-hop>
+           </attributes>
+       </ipv4-route>
+   </ipv4-routes>
+
+@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.
+
+-----
+
+This route is also advertised to the remote peer (*192.0.2.1*), hence route appears in its Adj-RIB-Out:
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+       <path-id>0</path-id>
+       <prefix>10.0.0.11/32</prefix>
+       <attributes>
+           <as-path></as-path>
+           <origin>
+               <value>igp</value>
+           </origin>
+           <local-pref>
+               <pref>100</pref>
+           </local-pref>
+           <ipv4-next-hop>
+               <global>10.11.1.1</global>
+           </ipv4-next-hop>
+       </attributes>
+   </ipv4-route>
+
+-----
+
+The injected route can be modified (i.e. different path attribute):
+
+**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``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+       <path-id>0</path-id>
+       <prefix>10.0.0.11/32</prefix>
+       <attributes>
+           <as-path></as-path>
+           <origin>
+               <value>igp</value>
+           </origin>
+           <local-pref>
+               <pref>50</pref>
+           </local-pref>
+           <ipv4-next-hop>
+               <global>10.11.1.2</global>
+           </ipv4-next-hop>
+       </attributes>
+   </ipv4-route>
+
+-----
+
+The route can be removed from programmable RIB in a following way:
+
+**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``
+
+**Method:** ``DELETE``
+
+-----
+
+Also it is possible to remove all routes from a particular table at once:
+
+**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/``
+
+**Method:** ``DELETE``
+
+-----
+
+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).
+
+.. note:: Routes stored in programmable RIB are persisted on OpendDaylight shutdown and restored after the re-start.
diff --git a/docs/bgp/bgp-user-guide-bgp-peering.rst b/docs/bgp/bgp-user-guide-bgp-peering.rst
new file mode 100644 (file)
index 0000000..2a0427d
--- /dev/null
@@ -0,0 +1,659 @@
+.. _bgp-user-guide-bgp-peering:
+
+BGP Peering
+===========
+To exchange routing information between two BGP systems (peers), it is required to configure a peering on both BGP speakers first.
+This mean that each BGP speaker has a white list of neighbors, representing remote peers, with which the peering is allowed.
+The TCP connection is established between two peers and they exchange messages to open and confirm the connection parameters followed by routes exchange.
+
+Here is a sample basic neighbor configuration:
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,5,6,11,12,17,19
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.1</neighbor-address>
+       <timers>
+           <config>
+               <hold-time>90</hold-time>
+               <connect-retry>10</connect-retry>
+           </config>
+       </timers>
+       <transport>
+           <config>
+               <remote-port>179</remote-port>
+               <passive-mode>false</passive-mode>
+               <!--<local-address>192.0.2.5</local-address>-->
+           </config>
+       </transport>
+       <config>
+           <peer-type>INTERNAL</peer-type>
+       </config>
+       <afi-safis>
+           ...
+       </afi-safis>
+   </neighbor>
+
+@line 2: IP address of the remote BGP peer. Also serves as an unique identifier of a neighbor in a list of neighbors.
+
+@line 5: Proposed number of seconds for value of the Hold Timer. Default value is **90**.
+
+@line 6: Time interval in seconds between attempts to establish session with the peer. Effective in active mode only. Default value is **30**.
+
+@line 11: Remote port number to which the local BGP is connecting. Effective in active mode only. Default value **179**.
+
+@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**.
+
+@line 13: Optional Local IP (either IPv4 or IPv6) address used to establish connections to the remote peer. Effective in active mode only.
+
+@line 17: Explicitly designate the peer as internal or external. Default value is **INTERNAL**.
+
+@line 19: Enable families.
+
+-----
+
+Once the remote peer is connected and it advertised routes to local BGP system, routes are stored in peer's RIBs.
+The RIBs can be checked via REST:
+
+**URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/peer/bgp:%2F%2F192.0.2.1``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 8,13,35,40,62,66
+
+   <peer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
+       <peer-id>bgp://192.0.2.1</peer-id>
+       <supported-tables>
+           <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
+           <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
+       </supported-tables>
+       <peer-role>ibgp</peer-role>
+       <adj-rib-in>
+           <tables>
+               <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
+               <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
+               <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+                   <ipv4-route>
+                       <path-id>0</path-id>
+                       <prefix>10.0.0.10/32</prefix>
+                       <attributes>
+                           <as-path></as-path>
+                           <origin>
+                               <value>igp</value>
+                           </origin>
+                           <local-pref>
+                               <pref>100</pref>
+                           </local-pref>
+                           <ipv4-next-hop>
+                               <global>10.10.1.1</global>
+                           </ipv4-next-hop>
+                       </attributes>
+                   </ipv4-route>
+               </ipv4-routes>
+               <attributes>
+                   <uptodate>true</uptodate>
+               </attributes>
+           </tables>
+       </adj-rib-in>
+       <effective-rib-in>
+           <tables>
+               <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
+               <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
+               <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+                   <ipv4-route>
+                       <path-id>0</path-id>
+                       <prefix>10.0.0.10/32</prefix>
+                       <attributes>
+                           <as-path></as-path>
+                           <origin>
+                               <value>igp</value>
+                           </origin>
+                           <local-pref>
+                               <pref>100</pref>
+                           </local-pref>
+                           <ipv4-next-hop>
+                               <global>10.10.1.1</global>
+                           </ipv4-next-hop>
+                       </attributes>
+                   </ipv4-route>
+               </ipv4-routes>
+               <attributes>
+                   <uptodate>true</uptodate>
+               </attributes>
+           </tables>
+       </effective-rib-in>
+       <adj-rib-out>
+           <tables>
+               <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
+               <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
+               <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet"></ipv4-routes>
+               <attributes></attributes>
+           </tables>
+       </adj-rib-out>
+   </peer>
+
+@line 8: **Adj-RIB-In** - Per-peer RIB, which contains unprocessed routes that has been advertised to local BGP speaker by the remote peer.
+
+@line 13: Here is the reported route with destination *10.0.0.10/32* in Adj-RIB-In.
+
+@line 35: **Effective-RIB-In** - Per-peer RIB, which contains processed routes as a result of applying inbound policy to Adj-RIB-In routes.
+
+@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.
+
+@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.
+
+@line 66: The peer's Adj-RIB-Out is empty as there are no routes to be advertise from local BGP speaker.
+
+-----
+
+Also the same route should appeared in Loc-RIB now:
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 4,6,8,11,14
+
+   <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+       <ipv4-route>
+           <path-id>0</path-id>
+           <prefix>10.0.0.10/32</prefix>
+           <attributes>
+               <as-path></as-path>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <ipv4-next-hop>
+                   <global>10.10.1.1</global>
+               </ipv4-next-hop>
+           </attributes>
+       </ipv4-route>
+   </ipv4-routes>
+
+@line 4: **Destination** - IPv4 Prefix Address.
+
+@line 6: **AS_PATH** - mandatory attribute, contains a list of the autonomous system numbers through that routing information has traversed.
+
+@line 8: **ORIGIN** - mandatory attribute, indicates an origin of the route - **ibgp**, **egp**, **incomplete**.
+
+@line 11: **LOCAL_PREF** - indicates a degree of preference for external routes, higher value is preferred.
+
+@line 14: **NEXT_HOP** - mandatory attribute, defines IP address of the router that should be used as the next hop to the destination.
+
+-----
+
+There are much more attributes that may be carried along with the destination:
+
+**BGP-4 Path Attributes**
+
+* **MULTI_EXIT_DISC** (MED)
+   Optional attribute, to be used to discriminate among multiple exit/entry points on external links, lower number is preferred.
+
+   .. code-block:: xml
+
+      <multi-exit-disc>
+       <med>0</med>
+      </multi-exit-disc>
+
+
+* **ATOMIC_AGGREGATE**
+   Indicates whether AS_SET was excluded from AS_PATH due to routes aggregation.
+
+   .. code-block:: xml
+
+      <atomic-aggregate/>
+
+* **AGGREGATOR**
+   Optional attribute, contains AS number and IP address of a BGP speaker which performed routes aggregation.
+
+   .. code-block:: xml
+
+      <aggregator>
+          <as-number>65000</as-number>
+          <network-address>192.0.2.2</network-address>
+      </aggregator>
+
+* **Unrecognised**
+   Optional attribute, used to store optional attributes, unrecognized by a local BGP speaker.
+
+   .. code-block:: xml
+
+      <unrecognized-attributes>
+          <partial>true</partial>
+          <transitive>true</transitive>
+          <type>101</type>
+          <value>0101010101010101</value>
+      </unrecognized-attributes>
+
+**Route Reflector Attributes**
+
+* **ORIGINATOR_ID**
+   Optional attribute, carries BGP Identifier of the originator of the route.
+
+   .. code-block:: xml
+
+      <originator-id>
+          <originator>41.41.41.41</originator>
+      </originator-id>
+
+* **CLUSTER_LIST**
+   Optional attribute, contains a list of CLUSTER_ID values representing the path that the route has traversed.
+
+   .. code-block:: xml
+
+      <cluster-id>
+          <cluster>40.40.40.40</cluster>
+      </cluster-id>
+
+* **Communities**
+   Optional attribute, may be used for policy routing.
+
+   .. code-block:: xml
+
+      <communities>
+          <as-number>65000</as-number>
+          <semantics>30740</semantics>
+      </communities>
+
+**Extended Communities**
+
+* **Route Target**
+   Identifies one or more routers that may receive a route.
+
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <route-target-ipv4>
+              <global-administrator>192.0.2.2</global-administrator>
+              <local-administrator>123</local-administrator>
+          </route-target-ipv4>
+      </extended-communities>
+      <extended-communities>
+          <transitive>true</transitive>
+          <as-4-route-target-extended-community>
+                  <as-4-specific-common>
+                  <as-number>65000</as-number>
+                  <local-administrator>123</local-administrator>
+              </as-4-specific-common>
+          </as-4-route-target-extended-community>
+      </extended-communities>
+
+
+* **Route Origin**
+   Identifies one or more routers that injected a route.
+
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <route-origin-ipv4>
+              <global-administrator>192.0.2.2</global-administrator>
+              <local-administrator>123</local-administrator>
+          </route-origin-ipv4>
+      </extended-communities>
+      <extended-communities>
+          <transitive>true</transitive>
+          <as-4-route-origin-extended-community>
+              <as-4-specific-common>
+                  <as-number>65000</as-number>
+                  <local-administrator>123</local-administrator>
+              </as-4-origin-common>
+          </as-4-route-target-extended-community>
+      </extended-communities>
+
+
+* **Link Bandwidth**
+   Carries the cost to reach external neighbor.
+
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <link-bandwidth-extended-community>
+              <bandwidth>BH9CQAA=</bandwidth>
+          </link-bandwidth-extended-community>
+      </extended-communities>
+
+* **AIGP**
+   Optional attribute, carries accumulated IGP metric.
+
+   .. code-block:: xml
+
+      <aigp>
+          <aigp-tlv>
+              <metric>120</metric>
+          </aigp-tlv>
+      </aigp>
+
+
+.. note:: When the remote peer disconnects, it disappear from operational state of local speaker instance and advertised routes are removed too.
+
+External peering configuration
+''''''''''''''''''''''''''''''
+An example above provided configuration for internal peering only.
+Following configuration sample is intended for external peering:
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 5
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.3</neighbor-address>
+       <config>
+           <peer-type>EXTERNAL</peer-type>
+           <peer-as>64999</peer-as>
+       </config>
+   </neighbor>
+
+@line 5: AS number of the remote peer.
+
+Local AS
+''''''''
+
+.. figure:: ./images/local-as.png
+   :alt: BGP eBGP with Local AS setup.
+
+The local-AS feature allows a router(eBGP) to appear to be a member of a second autonomous system (AS), in addition to its real AS.
+
+In above figure, R3 is eBGP router with configured local-as of 62, and peer-as of 63.
+
+In updates sent from R3 to R2, the AS_SEQUENCE in the AS_PATH attribute contains "62 63". And updates sent from R2 to R3, the AS_SEQUENCE in the AS_PATH attribute contains "62 65".
+
+AS 62 will be prepended to updates that are sent to and received from R3.
+
+Following configuration sample is intended for external peering with Local AS:
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 5,6
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.3</neighbor-address>
+       <config>
+           <peer-type>EXTERNAL</peer-type>
+           <peer-as>63</peer-as>
+           <local-as>62</local-as>
+       </config>
+   </neighbor>
+
+@line 5: AS number of the remote peer.
+
+@line 6: Local AS number of the remote peer.
+
+Route reflector configuration
+'''''''''''''''''''''''''''''
+The local BGP speaker can be configured with a specific *cluster ID*.
+Following example adds the cluster ID to the existing speaker instance:
+
+**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``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 4
+
+   <config>
+       <router-id>192.0.2.2</router-id>
+       <as>65000</as>
+       <route-reflector-cluster-id>192.0.2.1</route-reflector-cluster-id>
+   </config>
+
+@line 4: Route-reflector cluster id to use when local router is configured as a route reflector.
+   The *router-id* is used as a default value.
+
+-----
+
+Following configuration sample is intended for route reflector client peering:
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 8
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.4</neighbor-address>
+       <config>
+           <peer-type>INTERNAL</peer-type>
+       </config>
+       <route-reflector>
+           <config>
+               <route-reflector-client>true</route-reflector-client>
+           </config>
+       </route-reflector>
+   </neighbor>
+
+@line 8: Configure the neighbor as a route reflector client. Default value is *false*.
+
+Route reflector and Multiple Cluster IDs
+''''''''''''''''''''''''''''''''''''''''
+
+An optional non-transitive attribute called CLUSTER_LIST is modified when a route reflector reflects a prefix. 
+For loop prevention the route reflector adds its own cluster ID to, and discards any update containing router's own cluster ID. 
+Using multiple cluster IDs allows updates to propagate to nodes that reside in a different cluster.
+
+
+.. figure:: ./images/MultipleClustersIds.png
+   :alt: BGP RR Multiple Cluster IDs setup.
+
+Following configuration sample is intended for route reflector client peering using specific cluster id:
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 8,9
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.4</neighbor-address>
+       <config>
+           <peer-type>INTERNAL</peer-type>
+       </config>
+       <route-reflector>
+           <config>
+               <route-reflector-client>true</route-reflector-client>
+               <route-reflector-cluster-id>192.0.2.4</route-reflector-cluster-id>
+           </config>
+       </route-reflector>
+   </neighbor>
+
+@line 8: Configure the neighbor as a route reflector client. Default value is *false*.
+
+@line 9: Route-reflector cluster id to use for this specific neighbor when local router is configured as a route reflector.
+
+MD5 authentication configuration
+''''''''''''''''''''''''''''''''
+The OpenDaylight BGP implementation is supporting TCP MD5 for authentication.
+Sample configuration below shows how to set authentication password for a peer:
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 4
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.5</neighbor-address>
+       <config>
+           <auth-password>topsecret</auth-password>
+       </config>
+   </neighbor>
+
+@line 4: Configures an MD5 authentication password for use with neighboring devices.
+
+BGP Peer Group
+''''''''''''''
+
+Allows the creation of a peer group configuration that applies to all peers configured as part of the group.
+
+A sample peer group configuration follows:
+
+**URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/peer-groups``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2
+
+   <peer-group xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <peer-group-name>internal-neighbor</peer-group-name>
+       <config>
+           <peer-type>INTERNAL</peer-type>
+           <peer-as>64496</peer-as>
+       </config>
+       <transport>
+           <config>
+               <remote-port>179</remote-port>
+               <passive-mode>true</passive-mode>
+           </config>
+       </transport>
+       <timers>
+           <config>
+               <hold-time>180</hold-time>
+               <connect-retry>10</connect-retry>
+           </config>
+       </timers>
+       <route-reflector>
+           <config>
+               <route-reflector-client>false</route-reflector-client>
+           </config>
+       </route-reflector>
+       <afi-safis>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
+               <!--Advertise N Paths
+               <receive>true</receive>
+               <send-max>0</send-max>-->
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-LABELLED-UNICAST</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name>LINKSTATE</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name>IPV4-FLOW</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name>IPV6-FLOW</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
+           </afi-safi>
+       </afi-safis>
+   </peer-group>
+
+@line 2: Peer Group Identifier.
+
+-----
+
+A sample basic neighbor configuration using a peer group follows:
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 4
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+      <neighbor-address>192.0.2.1</neighbor-address>
+      <config>
+         <peer-group>/bgp/neighbors/neighbor/bgp/peer-groups/peer-group[peer-group-name="internal-neighbor"]</peer-group>
+      </config>
+   </neighbor>
+
+@line 4: Peer group identifier.
+
+.. note:: Existing neighbor configuration can be reconfigured (change configuration parameters) anytime.
+   As a result, established connection is dropped, peer instance is recreated with a new configuration settings and connection re-established.
+
+.. note:: The BGP configuration is persisted on OpendDaylight shutdown and restored after the re-start.
diff --git a/docs/bgp/bgp-user-guide-bgp-server.rst b/docs/bgp/bgp-user-guide-bgp-server.rst
new file mode 100644 (file)
index 0000000..4807741
--- /dev/null
@@ -0,0 +1,32 @@
+.. _bgp-user-guide-bgp-server:
+
+BGP Server
+==========
+
+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
+privileged ports restriction for non-root users.
+One of the workarounds is to use port redirection. In case other port is desired to be used instead, we can reconfigure it.
+
+Here is a sample of bgp port listening re-configuration:
+
+**URL:** ``/restconf/config/odl-bgp-peer-acceptor-config:bgp-peer-acceptor-config/default``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,4
+
+   <bgp-peer-acceptor-config xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-peer-acceptor-config">
+       <config-name>default</config-name>
+       <binding-address>0.0.0.0</binding-address>
+       <binding-port>1791</binding-port>
+   </bgp-peer-acceptor-config>
+
+@line 3: Binding address: By default is 0.0.0.0, so it is not a mandatory field.
+
+@line 4: Binding Port: Port were BGP Server will listen.
diff --git a/docs/bgp/bgp-user-guide-config-concepts.rst b/docs/bgp/bgp-user-guide-config-concepts.rst
new file mode 100644 (file)
index 0000000..785af43
--- /dev/null
@@ -0,0 +1,92 @@
+.. _bgp-user-guide-config-concepts:
+
+Basic Configuration & Concepts
+==============================
+The following section shows how to configure BGP basics, how to verify functionality and presents essential components of the plugin.
+Next samples demonstrate the plugin's runtime configuration capability.
+It shows the way to configure the plugin via REST, using standardized OpenConfig BGP APIs.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+.. toctree::
+   :maxdepth: 2
+
+   bgp-user-guide-protocol-configuration
+   bgp-user-guide-rib-config-policies
+   bgp-user-guide-bgp-server
+   bgp-user-guide-bgp-peering
+   bgp-user-guide-bgp-application-peer
+   bgp-user-guide-protocol-configuration-loader
+
+BGP RIB API
+^^^^^^^^^^^
+This tree illustrates the BGP RIBs organization in datastore.
+
+.. code-block:: console
+
+    bgp-rib
+      +--ro rib* [id]
+         +--ro id         rib-id
+         +--ro peer* [peer-id]
+         |  +--ro peer-id                  peer-id
+         |  +--ro peer-role                peer-role
+         |  +--ro simple-routing-policy?   simple-routing-policy
+         |  +--ro supported-tables* [afi safi]
+         |  |  +--ro afi             identityref
+         |  |  +--ro safi            identityref
+         |  |  +--ro send-receive?   send-receive
+         |  +--ro adj-rib-in
+         |  |  +--ro tables* [afi safi]
+         |  |     +--ro afi           identityref
+         |  |     +--ro safi          identityref
+         |  |     +--ro attributes
+         |  |     |  +--ro uptodate?   boolean
+         |  |     +--ro (routes)?
+         |  +--ro effective-rib-in
+         |  |  +--ro tables* [afi safi]
+         |  |     +--ro afi           identityref
+         |  |     +--ro safi          identityref
+         |  |     +--ro attributes
+         |  |     |  +--ro uptodate?   boolean
+         |  |     +--ro (routes)?
+         |  +--ro adj-rib-out
+         |     +--ro tables* [afi safi]
+         |        +--ro afi           identityref
+         |        +--ro safi          identityref
+         |        +--ro attributes
+         |        |  +--ro uptodate?   boolean
+         |        +--ro (routes)?
+         +--ro loc-rib
+            +--ro tables* [afi safi]
+               +--ro afi           identityref
+               +--ro safi          identityref
+               +--ro attributes
+               |  +--ro uptodate?   boolean
+               +--ro (routes)?
+
+BGP pipeline
+^^^^^^^^^^^^
+.. figure:: ./images/bgp-pipeline.png
+   :alt: BGP pipeline.
+
+   BGP pipeline - routes re-advertisement.
+
+.. figure:: ./images/bgp-app-pipeline.png
+   :alt: BGP Application Peer pipeline.
+
+   BGP applcaition peer pipeline - routes injection.
+
+References
+^^^^^^^^^^
+* `A Border Gateway Protocol 4 (BGP-4) <https://tools.ietf.org/html/rfc4271>`_
+* `BGP Route Reflection <https://tools.ietf.org/html/rfc4456>`_
+* `BGP Communities Attribute <https://tools.ietf.org/html/rfc1997>`_
+* `BGP Support for Four-Octet Autonomous System (AS) Number Space <https://tools.ietf.org/html/rfc6793>`_
+* `The Accumulated IGP Metric Attribute for BGP <https://tools.ietf.org/html/rfc7311>`_
+* `4-Octet AS Specific BGP Extended Community <https://tools.ietf.org/html/rfc5668>`_
+* `BGP Link Bandwidth Extended Community <https://tools.ietf.org/html/draft-ietf-idr-link-bandwidth-06>`_
+* `Use of BGP for Routing in Large-Scale Data Centers <https://tools.ietf.org/html/rfc7938>`_
diff --git a/docs/bgp/bgp-user-guide-evpn-family.rst b/docs/bgp/bgp-user-guide-evpn-family.rst
new file mode 100644 (file)
index 0000000..6886137
--- /dev/null
@@ -0,0 +1,572 @@
+.. _bgp-user-guide-evpn-family:
+
+EVPN Family
+===========
+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.
+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.
+In addition to MPLS, IP tunnelling encapsulation techniques like VXLAN, NVGRE, MPLSoGRE and others can be used for packet transportation.
+Also, Provider Backbone Bridging (PBB) can be combined with EVPN in order to reduce a number of MAC Advertisement routes.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+This section shows a way to enable EVPN family in BGP speaker and peer configuration.
+
+BGP Speaker
+'''''''''''
+To enable EVPN support in BGP plugin, first configure BGP speaker instance:
+
+**URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <protocol xmlns="http://openconfig.net/yang/network-instance">
+       <name>bgp-example</name>
+       <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
+       <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+           <global>
+               <config>
+                   <router-id>192.0.2.2</router-id>
+                   <as>65000</as>
+               </config>
+               <afi-safis>
+                   <afi-safi>
+                       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
+                   </afi-safi>
+               </afi-safis>
+           </global>
+       </bgp>
+   </protocol>
+
+BGP Peer
+''''''''
+Here is an example for BGP peer configuration with enabled EVPN family.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.1</neighbor-address>
+       <afi-safis>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
+           </afi-safi>
+       </afi-safis>
+   </neighbor>
+
+EVPN Route API
+^^^^^^^^^^^^^^
+Following tree illustrate the BGP EVPN route structure.
+
+.. code-block:: console
+
+   :(evpn-routes-case)
+      +--ro evpn-routes
+         +--ro evpn-route* [route-key path-id]
+            +--ro route-key                     string
+            +--ro path-id                       path-id
+            +--ro (evpn-choice)
+            |  +--:(ethernet-a-d-route-case)
+            |  |  +--ro ethernet-a-d-route
+            |  |     +--ro (esi)
+            |  |     |  +--:(arbitrary-case)
+            |  |     |  |  +--ro arbitrary
+            |  |     |  |     +--ro arbitrary    binary
+            |  |     |  +--:(lacp-auto-generated-case)
+            |  |     |  |  +--ro lacp-auto-generated
+            |  |     |  |     +--ro ce-lacp-mac-address    yang:mac-address
+            |  |     |  |     +--ro ce-lacp-port-key       uint16
+            |  |     |  +--:(lan-auto-generated-case)
+            |  |     |  |  +--ro lan-auto-generated
+            |  |     |  |     +--ro root-bridge-mac-address    yang:mac-address
+            |  |     |  |     +--ro root-bridge-priority       uint16
+            |  |     |  +--:(mac-auto-generated-case)
+            |  |     |  |  +--ro mac-auto-generated
+            |  |     |  |     +--ro system-mac-address     yang:mac-address
+            |  |     |  |     +--ro local-discriminator    uint24
+            |  |     |  +--:(router-id-generated-case)
+            |  |     |  |  +--ro router-id-generated
+            |  |     |  |     +--ro router-id              inet:ipv4-address
+            |  |     |  |     +--ro local-discriminator    uint32
+            |  |     |  +--:(as-generated-case)
+            |  |     |     +--ro as-generated
+            |  |     |        +--ro as                     inet:as-number
+            |  |     |        +--ro local-discriminator    uint32
+            |  |     +--ro ethernet-tag-id
+            |  |     |  +--ro vlan-id    uint32
+            |  |     +--ro mpls-label             netc:mpls-label
+            |  +--:(mac-ip-adv-route-case)
+            |  |  +--ro mac-ip-adv-route
+            |  |     +--ro (esi)
+            |  |     |  +--:(arbitrary-case)
+            |  |     |  |  +--ro arbitrary
+            |  |     |  |     +--ro arbitrary    binary
+            |  |     |  +--:(lacp-auto-generated-case)
+            |  |     |  |  +--ro lacp-auto-generated
+            |  |     |  |     +--ro ce-lacp-mac-address    yang:mac-address
+            |  |     |  |     +--ro ce-lacp-port-key       uint16
+            |  |     |  +--:(lan-auto-generated-case)
+            |  |     |  |  +--ro lan-auto-generated
+            |  |     |  |     +--ro root-bridge-mac-address    yang:mac-address
+            |  |     |  |     +--ro root-bridge-priority       uint16
+            |  |     |  +--:(mac-auto-generated-case)
+            |  |     |  |  +--ro mac-auto-generated
+            |  |     |  |     +--ro system-mac-address     yang:mac-address
+            |  |     |  |     +--ro local-discriminator    uint24
+            |  |     |  +--:(router-id-generated-case)
+            |  |     |  |  +--ro router-id-generated
+            |  |     |  |     +--ro router-id              inet:ipv4-address
+            |  |     |  |     +--ro local-discriminator    uint32
+            |  |     |  +--:(as-generated-case)
+            |  |     |     +--ro as-generated
+            |  |     |        +--ro as                     inet:as-number
+            |  |     |        +--ro local-discriminator    uint32
+            |  |     +--ro ethernet-tag-id
+            |  |     |  +--ro vlan-id    uint32
+            |  |     +--ro mac-address            yang:mac-address
+            |  |     +--ro ip-address?            inet:ip-address
+            |  |     +--ro mpls-label1            netc:mpls-label
+            |  |     +--ro mpls-label2?           netc:mpls-label
+            |  +--:(inc-multi-ethernet-tag-res-case)
+            |  |  +--ro inc-multi-ethernet-tag-res
+            |  |     +--ro ethernet-tag-id
+            |  |     |  +--ro vlan-id    uint32
+            |  |     +--ro orig-route-ip?     inet:ip-address
+            |  +--:(es-route-case)
+            |     +--ro es-route
+            |        +--ro (esi)
+            |        |  +--:(arbitrary-case)
+            |        |  |  +--ro arbitrary
+            |        |  |     +--ro arbitrary    binary
+            |        |  +--:(lacp-auto-generated-case)
+            |        |  |  +--ro lacp-auto-generated
+            |        |  |     +--ro ce-lacp-mac-address    yang:mac-address
+            |        |  |     +--ro ce-lacp-port-key       uint16
+            |        |  +--:(lan-auto-generated-case)
+            |        |  |  +--ro lan-auto-generated
+            |        |  |     +--ro root-bridge-mac-address    yang:mac-address
+            |        |  |     +--ro root-bridge-priority       uint16
+            |        |  +--:(mac-auto-generated-case)
+            |        |  |  +--ro mac-auto-generated
+            |        |  |     +--ro system-mac-address     yang:mac-address
+            |        |  |     +--ro local-discriminator    uint24
+            |        |  +--:(router-id-generated-case)
+            |        |  |  +--ro router-id-generated
+            |        |  |     +--ro router-id              inet:ipv4-address
+            |        |  |     +--ro local-discriminator    uint32
+            |        |  +--:(as-generated-case)
+            |        |     +--ro as-generated
+            |        |        +--ro as                     inet:as-number
+            |        |        +--ro local-discriminator    uint32
+            |        +--ro orig-route-ip          inet:ip-address
+            +--ro route-distinguisher           bgp-t:route-distinguisher
+            +--ro attributes
+               +--ro extended-communities*
+               |  +--ro transitive?                              boolean
+               |  +--ro (extended-community)?
+               |     +--:(encapsulation-case)
+               |     |  +--ro encapsulation-extended-community
+               |     |     +--ro tunnel-type    encapsulation-tunnel-type
+               |     +--:(esi-label-extended-community-case)
+               |     |  +--ro esi-label-extended-community
+               |     |     +--ro single-active-mode?   boolean
+               |     |     +--ro esi-label             netc:mpls-label
+               |     +--:(es-import-route-extended-community-case)
+               |     |  +--ro es-import-route-extended-community
+               |     |     +--ro es-import    yang:mac-address
+               |     +--:(mac-mobility-extended-community-case)
+               |     |  +--ro mac-mobility-extended-community
+               |     |     +--ro static?       boolean
+               |     |     +--ro seq-number    uint32
+               |     +--:(default-gateway-extended-community-case)
+               |     |  +--ro default-gateway-extended-community!
+               |     +--:(layer-2-attributes-extended-community-case)
+               |        +--ro layer-2-attributes-extended-community
+               |           +--ro primary-pe?     boolean
+               |           +--ro backup-pe?      boolean
+               |           +--ro control-word?   boolean
+               |           +--ro l2-mtu          uint16
+               +--ro pmsi-tunnel!
+                  +--ro leaf-information-required    boolean
+                  +--ro mpls-label?                  netc:mpls-label
+                  +--ro (tunnel-identifier)?
+                     +--:(rsvp-te-p2mp-lsp)
+                     |  +--ro rsvp-te-p2mp-lps
+                     |     +--ro p2mp-id               uint32
+                     |     +--ro tunnel-id             uint16
+                     |     +--ro extended-tunnel-id    inet:ip-address
+                     +--:(mldp-p2mp-lsp)
+                     |  +--ro mldp-p2mp-lsp
+                     |     +--ro address-family       identityref
+                     |     +--ro root-node-address    inet:ip-address
+                     |     +--ro opaque-value*
+                     |        +--ro opaque-type             uint8
+                     |        +--ro opaque-extended-type?   uint16
+                     |        +--ro opaque                  yang:hex-string
+                     +--:(pim-ssm-tree)
+                     |  +--ro pim-ssm-tree
+                     |     +--ro p-address            inet:ip-address
+                     |     +--ro p-multicast-group    inet:ip-address
+                     +--:(pim-sm-tree)
+                     |  +--ro pim-sm-tree
+                     |     +--ro p-address            inet:ip-address
+                     |     +--ro p-multicast-group    inet:ip-address
+                     +--:(bidir-pim-tree)
+                     |  +--ro bidir-pim-tree
+                     |     +--ro p-address            inet:ip-address
+                     |     +--ro p-multicast-group    inet:ip-address
+                     +--:(ingress-replication)
+                     |  +--ro ingress-replication
+                     |     +--ro receiving-endpoint-address?   inet:ip-address
+                     +--:(mldp-mp2mp-lsp)
+                        +--ro mldp-mp2mp-lsp
+                           +--ro opaque-type             uint8
+                           +--ro opaque-extended-type?   uint16
+                           +--ro opaque
+                     ...
+
+Usage
+^^^^^
+The L2VPN EVPN table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <evpn-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-evpn">
+      <evpn-route>
+         <route-key>AxEAAcCoZAED6AAAAQAgwKhkAQ==</route-key>
+         <path-id>0</path-id>
+         <route-distinguisher>192.168.100.1:1000</route-distinguisher>
+         <inc-multi-ethernet-tag-res>
+            <ethernet-tag-id>
+               <vlan-id>256</vlan-id>
+            </ethernet-tag-id>
+            <orig-route-ip>192.168.100.1</orig-route-ip>
+         </inc-multi-ethernet-tag-res>
+         <attributes>
+            <ipv4-next-hop>
+               <global>172.23.29.104</global>
+            </ipv4-next-hop>
+            <as-path/>
+            <origin>
+               <value>igp</value>
+            </origin>
+            <extended-communities>
+               <extended-communities>
+                   <transitive>true</transitive>
+                   <route-target-extended-community>
+                       <global-administrator>65504</global-administrator>
+                       <local-administrator>AAAD6A==</local-administrator>
+                   </route-target-extended-community>
+               </extended-communities>
+            </extended-communities>
+            <pmsi-tunnel>
+                <leaf-information-required>true</leaf-information-required>
+                <mpls-label>20024</mpls-label>
+                <ingress-replication>
+                    <receiving-endpoint-address>192.168.100.1</receiving-endpoint-address>
+                </ingress-replication>
+            </pmsi-tunnel>
+         </attributes>
+      </evpn-route>
+   </evpn-routes>
+
+Programming
+^^^^^^^^^^^
+This examples show how to originate and remove EVPN routes via programmable RIB.
+There are four different types of EVPN routes, and several extended communities.
+Routes can be used for variety of use-cases supported by BGP/MPLS EVPN, PBB EVPN and NVO EVPN.
+Make sure the *Application Peer* is configured first.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 4,5,15
+
+   <evpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-evpn">
+       <route-key>evpn</route-key>
+       <path-id>0</path-id>
+       <route-distinguisher>172.12.123.3:200</route-distinguisher>
+       ....
+       <attributes>
+           <ipv4-next-hop>
+               <global>199.20.166.41</global>
+           </ipv4-next-hop>
+           <as-path/>
+           <origin>
+               <value>igp</value>
+           </origin>
+           <extended-communities>
+           ....
+           </extended-communities>
+       </attributes>
+   </evpn-route>
+
+@line 4: Route Distinguisher (RD) - set to RD of the MAC-VRF advertising the NLRI, recommended format *<IP>:<VLAN_ID>*
+
+@line 5: One of the EVPN route must be set here.
+
+@line 15: In some cases, specific extended community presence is required. The route may carry one or more Route Target attributes.
+
+-----
+
+EVPN Routes
+^^^^^^^^^^^
+
+* **Ethernet AD per ESI**
+   .. code-block:: xml
+
+      <ethernet-a-d-route>
+          <mpls-label>0</mpls-label>
+          <ethernet-tag-id>
+              <vlan-id>4294967295</vlan-id>
+          </ethernet-tag-id>
+          <arbitrary>
+              <arbitrary>AAAAAAAAAAAA</arbitrary>
+          </arbitrary>
+      </ethernet-a-d-route>
+
+* **Ethernet AD per EVI**
+   .. code-block:: xml
+
+      <ethernet-a-d-route>
+          <mpls-label>24001</mpls-label>
+          <ethernet-tag-id>
+              <vlan-id>2200</vlan-id>
+          </ethernet-tag-id>
+          <arbitrary>
+              <arbitrary>AAAAAAAAAAAA</arbitrary>
+          </arbitrary>
+      </ethernet-a-d-route>
+
+* **MAC/IP Advertisement**
+   .. code-block:: xml
+
+      <mac-ip-adv-route>
+          <arbitrary>
+              <arbitrary>AAAAAAAAAAAA</arbitrary>
+          </arbitrary>
+          <ethernet-tag-id>
+              <vlan-id>2100</vlan-id>
+          </ethernet-tag-id>
+          <mac-address>f2:0c:dd:80:9f:f7</mac-address>
+          <ip-address>10.0.1.12</ip-address>
+          <mpls-label1>299776</mpls-label1>
+      </mac-ip-adv-route>
+
+
+* **Inclusive Multicast Ethernet Tag**
+   .. code-block:: xml
+
+      <inc-multi-ethernet-tag-res>
+          <ethernet-tag-id>
+              <vlan-id>2100</vlan-id>
+          </ethernet-tag-id>
+          <orig-route-ip>43.43.43.43</orig-route-ip>
+      </inc-multi-ethernet-tag-res>
+
+* **Ethernet Segment**
+   .. code-block:: xml
+
+      <es-route>
+          <orig-route-ip>43.43.43.43</orig-route-ip>
+          <arbitrary>
+              <arbitrary>AAAAAAAAAAAA</arbitrary>
+          </arbitrary>
+      </es-route>
+
+**EVPN Ethernet Segment Identifier (ESI):**
+
+* **Type 0**
+   Indicates an arbitrary 9-octet ESI.
+
+   .. code-block:: xml
+
+      <arbitrary>
+          <arbitrary>AAAAAAAAAAAA</arbitrary>
+      </arbitrary>
+
+* **Type 1**
+   IEEE 802.1AX LACP is used.
+
+   .. code-block:: xml
+
+      <lacp-auto-generated>
+          <ce-lacp-mac-address>f2:0c:dd:80:9f:f7</ce-lacp-mac-address>
+          <ce-lacp-port-key>22</ce-lacp-port-key>
+      </lacp-auto-generated>
+
+* **Type 2**
+   Indirectly connected hosts via a bridged LAN.
+
+   .. code-block:: xml
+
+      <lan-auto-generated>
+          <root-bridge-mac-address>f2:0c:dd:80:9f:f7</root-bridge-mac-address>
+          <root-bridge-priority>20</root-bridge-priority>
+      </lan-auto-generated>
+
+* **Type 3**
+   MAC-based ESI.
+
+   .. code-block:: xml
+
+      <mac-auto-generated>
+          <system-mac-address>f2:0c:dd:80:9f:f7</system-mac-address>
+          <local-discriminator>2000</local-discriminator>
+      </mac-auto-generated>
+
+* **Type 4**
+   Router-ID ESI
+
+   .. code-block:: xml
+
+      <router-id-generated>
+          <router-id>43.43.43.43</router-id>
+          <local-discriminator>2000</local-discriminator>
+      </router-id-generated>
+
+* **Type 5**
+   AS-based ESI
+
+   .. code-block:: xml
+
+      <as-generated>
+          <as>16843009</as>
+          <local-discriminator>2000</local-discriminator>
+      </as-generated>
+
+**Attributes:**
+
+.. include:: bgp-user-guide-pmsi-attribute.rst
+
+**Extended Communities:**
+
+* **ESI Label Extended Community**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <esi-label-extended-community>
+              <single-active-mode>false</single-active-mode>
+              <esi-label>24001</esi-label>
+          </esi-label-extended-community>
+      </extended-communities>
+
+* **ES-Import Route Target**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <es-import-route-extended-community>
+              <es-import>f2:0c:dd:80:9f:f7</es-import>
+          </es-import-route-extended-community>
+      </extended-communities>
+
+* **MAC Mobility Extended Community**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <mac-mobility-extended-community>
+              <static>true</static>
+              <seq-number>200</seq-number>
+          </mac-mobility-extended-community>
+      </extended-communities>
+
+* **Default Gateway Extended Community**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <default-gateway-extended-community>
+          </default-gateway-extended-community>
+      </extended-communities>
+
+* **EVPN Layer 2 attributes extended community**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>false</transitive>
+          <layer-2-attributes-extended-community>
+              <primary-pe>true</primary-pe>
+              <backup-pe>true</backup-pe>
+              <control-word >true</control-word>
+              <l2-mtu>200</l2-mtu>
+          </layer-2-attributes-extended-community>
+      </extended-communities>
+
+* **BGP Encapsulation extended community**
+   .. code-block:: xml
+      :linenos:
+      :emphasize-lines: 4
+
+      <extended-communities>
+          <transitive>false</transitive>
+          <encapsulation-extended-community>
+              <tunnel-type>vxlan</tunnel-type>
+          </encapsulation-extended-community>
+      </extended-communities>
+
+   @line 4: `full list of tunnel types <http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#tunnel-types>`_
+
+-----
+
+To remove the route added above, following request can be used:
+
+**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/0``
+
+**Method:** ``DELETE``
+
+-----
+
+.. table:: EVPN Routes Usage.
+
+   +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
+   | EVN Route Type                       | Extended Communities                                | Usage                                     |
+   +======================================+=====================================================+===========================================+
+   | **Ethernet Auto-discovery**          | ESI Label, BGP EncapsulationEVPN Layer 2 attributes | Fast Convergence, Split Horizon, Aliasing |
+   +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
+   | **MAC/IP Advertisement**             | BGP Encapsulation, MAC Mobility, Default Gateway    | MAC address reachability                  |
+   +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
+   | **Inclusive Multicast Ethernet Tag** | PMSI Tunnel, BGP Encapsulation                      | Handling of Multi-destination traffic     |
+   +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
+   | **Ethernet Segment**                 | BGP Encapsulation, ES-Import Route Target           | Designated Forwarder Election             |
+   +--------------------------------------+-----------------------------------------------------+-------------------------------------------+
+
+References
+^^^^^^^^^^
+* `BGP MPLS-Based Ethernet VPN <https://tools.ietf.org/html/rfc7432>`_
+* `Provider Backbone Bridging Combined with Ethernet VPN <https://tools.ietf.org/html/rfc7623>`_
+* `VPWS support in EVPN <https://tools.ietf.org/html/draft-ietf-bess-evpn-vpws-07>`_
+* `A Network Virtualization Overlay Solution using EVPN <https://tools.ietf.org/html/draft-ietf-bess-evpn-overlay-04>`_
+* `Interconnect Solution for EVPN Overlay networks <https://tools.ietf.org/html/draft-ietf-bess-dci-evpn-overlay-04>`_
+* `Usage and applicability of BGP MPLS based Ethernet VPN <https://tools.ietf.org/html/draft-ietf-bess-evpn-usage-03>`_
diff --git a/docs/bgp/bgp-user-guide-flowspec-family.rst b/docs/bgp/bgp-user-guide-flowspec-family.rst
new file mode 100644 (file)
index 0000000..cc0d674
--- /dev/null
@@ -0,0 +1,765 @@
+.. _bgp-user-guide-flowspec-family:
+
+Flow Specification Family
+=========================
+The BGP Flow Specification (BGP-FS) Multiprotocol extension can be used to distribute traffic flow specifications.
+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).
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+This section shows a way to enable BGP-FS family in BGP speaker and peer configuration.
+
+BGP Speaker
+'''''''''''
+To enable BGP-FS support in BGP plugin, first configure BGP speaker instance:
+
+**URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <protocol xmlns="http://openconfig.net/yang/network-instance">
+       <name>bgp-example</name>
+       <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
+       <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+           <global>
+               <config>
+                   <router-id>192.0.2.2</router-id>
+                   <as>65000</as>
+               </config>
+               <afi-safis>
+                   <afi-safi>
+                       <afi-safi-name>IPV4-FLOW</afi-safi-name>
+                   </afi-safi>
+                   <afi-safi>
+                       <afi-safi-name>IPV6-FLOW</afi-safi-name>
+                   </afi-safi>
+                   <afi-safi>
+                       <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
+                   </afi-safi>
+                   <afi-safi>
+                       <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
+                   </afi-safi>
+               </afi-safis>
+           </global>
+       </bgp>
+   </protocol>
+
+BGP Peer
+''''''''
+Here is an example for BGP peer configuration with enabled BGP-FS family.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.1</neighbor-address>
+       <afi-safis>
+           <afi-safi>
+               <afi-safi-name>IPV4-FLOW</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name>IPV6-FLOW</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
+           </afi-safi>
+       </afi-safis>
+   </neighbor>
+
+Flow Specification API
+^^^^^^^^^^^^^^^^^^^^^^
+Following trees illustrate the BGP Flow Specification routes structure.
+
+IPv4 Flow Specification Route
+'''''''''''''''''''''''''''''
+.. code-block:: console
+
+   :(flowspec-routes-case)
+     +--ro flowspec-routes
+        +--ro flowspec-route* [route-key path-id]
+           +--ro route-key     string
+           +--ro flowspec*
+           |  +--ro (flowspec-type)?
+           |     +--:(port-case)
+           |     |  +--ro ports*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   uint16
+           |     +--:(destination-port-case)
+           |     |  +--ro destination-ports*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   uint16
+           |     +--:(source-port-case)
+           |     |  +--ro source-ports*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   uint16
+           |     +--:(icmp-type-case)
+           |     |  +--ro types*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   uint8
+           |     +--:(icmp-code-case)
+           |     |  +--ro codes*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   uint8
+           |     +--:(tcp-flags-case)
+           |     |  +--ro tcp-flags*
+           |     |     +--ro op?      bitmask-operand
+           |     |     +--ro value?   uint16
+           |     +--:(packet-length-case)
+           |     |  +--ro packet-lengths*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   uint16
+           |     +--:(dscp-case)
+           |     |  +--ro dscps*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   dscp
+           |     +--:(fragment-case)
+           |     |  +--ro fragments*
+           |     |     +--ro op?      bitmask-operand
+           |     |     +--ro value?   fragment
+           |     +--:(destination-prefix-case)
+           |     |  +--ro destination-prefix?   inet:ipv4-prefix
+           |     +--:(source-prefix-case)
+           |     |  +--ro source-prefix?        inet:ipv4-prefix
+           |     +--:(protocol-ip-case)
+           |        +--ro protocol-ips*
+           |           +--ro op?      numeric-operand
+           |           +--ro value?   uint8
+           +--ro path-id       path-id
+           +--ro attributes
+              +--ro extended-communities*
+                 +--ro transitive?                             boolean
+                 +--ro (extended-community)?
+                    +--:(traffic-rate-extended-community-case)
+                    |  +--ro traffic-rate-extended-community
+                    |     +--ro informative-as?        bgp-t:short-as-number
+                    |     +--ro local-administrator?   netc:bandwidth
+                    +--:(traffic-action-extended-community-case)
+                    |  +--ro traffic-action-extended-community
+                    |     +--ro sample?            boolean
+                    |     +--ro terminal-action?   boolean
+                    +--:(redirect-extended-community-case)
+                    |  +--ro redirect-extended-community
+                    |     +--ro global-administrator?   bgp-t:short-as-number
+                    |     +--ro local-administrator?    binary
+                    +--:(traffic-marking-extended-community-case)
+                    |  +--ro traffic-marking-extended-community
+                    |     +--ro global-administrator?   dscp
+                    +--:(redirect-ipv4-extended-community-case)
+                    |  +--ro redirect-ipv4
+                    |     +--ro global-administrator?   inet:ipv4-address
+                    |     +--ro local-administrator?    uint16
+                    +--:(redirect-as4-extended-community-case)
+                    |  +--ro redirect-as4
+                    |     +--ro global-administrator?   inet:as-number
+                    |     +--ro local-administrator?    uint16
+                    +--:(redirect-ip-nh-extended-community-case)
+                      +--ro redirect-ip-nh-extended-community
+                         +--ro next-hop-address?   inet:ip-address
+                         +--ro copy?               boolean
+
+
+IPv6 Flow Specification Route
+'''''''''''''''''''''''''''''
+.. code-block:: console
+
+   :(flowspec-ipv6-routes-case)
+     +--ro flowspec-ipv6-routes
+        +--ro flowspec-route* [route-key path-id]
+           +--ro flowspec*
+           |  +--ro (flowspec-type)?
+           |     +--:(port-case)
+           |     |  +--ro ports*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   uint16
+           |     +--:(destination-port-case)
+           |     |  +--ro destination-ports*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   uint16
+           |     +--:(source-port-case)
+           |     |  +--ro source-ports*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   uint16
+           |     +--:(icmp-type-case)
+           |     |  +--ro types*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   uint8
+           |     +--:(icmp-code-case)
+           |     |  +--ro codes*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   uint8
+           |     +--:(tcp-flags-case)
+           |     |  +--ro tcp-flags*
+           |     |     +--ro op?      bitmask-operand
+           |     |     +--ro value?   uint16
+           |     +--:(packet-length-case)
+           |     |  +--ro packet-lengths*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   uint16
+           |     +--:(dscp-case)
+           |     |  +--ro dscps*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   dscp
+           |     +--:(fragment-case)
+           |     |  +--ro fragments*
+           |     |     +--ro op?      bitmask-operand
+           |     |     +--ro value?   fragment
+           |     +--:(destination-ipv6-prefix-case)
+           |     |  +--ro destination-prefix?   inet:ipv6-prefix
+           |     +--:(source-ipv6-prefix-case)
+           |     |  +--ro source-prefix?        inet:ipv6-prefix
+           |     +--:(next-header-case)
+           |     |  +--ro next-headers*
+           |     |     +--ro op?      numeric-operand
+           |     |     +--ro value?   uint8
+           |     +--:(flow-label-case)
+           |        +--ro flow-label*
+           |           +--ro op?      numeric-operand
+           |           +--ro value?   uint32
+           +--ro path-id       path-id
+           +--ro attributes
+              +--ro extended-communities*
+                 +--ro transitive?                             boolean
+                 +--ro (extended-community)?
+                    +--:(traffic-rate-extended-community-case)
+                    |  +--ro traffic-rate-extended-community
+                    |     +--ro informative-as?        bgp-t:short-as-number
+                    |     +--ro local-administrator?   netc:bandwidth
+                    +--:(traffic-action-extended-community-case)
+                    |  +--ro traffic-action-extended-community
+                    |     +--ro sample?            boolean
+                    |     +--ro terminal-action?   boolean
+                    +--:(redirect-extended-community-case)
+                    |  +--ro redirect-extended-community
+                    |     +--ro global-administrator?   bgp-t:short-as-number
+                    |     +--ro local-administrator?    binary
+                    +--:(traffic-marking-extended-community-case)
+                    |  +--ro traffic-marking-extended-community
+                    |     +--ro global-administrator?   dscp
+                    +--:(redirect-ipv6-extended-community-case)
+                    |  +--ro redirect-ipv6
+                    |     +--ro global-administrator?   inet:ipv6-address
+                    |     +--ro local-administrator?    uint16
+                    +--:(redirect-as4-extended-community-case)
+                    |  +--ro redirect-as4
+                    |     +--ro global-administrator?   inet:as-number
+                    |     +--ro local-administrator?    uint16
+                    +--:(redirect-ip-nh-extended-community-case)
+                       +--ro redirect-ip-nh-extended-community
+                          +--ro next-hop-address?   inet:ip-address
+                          +--ro copy?               boolean
+
+Usage
+^^^^^
+The flowspec route represents rules and an action, defined as an extended community.
+
+IPv4 Flow Specification
+'''''''''''''''''''''''
+The IPv4 Flowspec table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <flowspec-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
+       <flowspec-route>
+           <path-id>0</path-id>
+           <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>
+           <attributes>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <as-path></as-path>
+               <extended-communities>
+                   <transitive>true</transitive>
+                   <redirect-extended-community>
+                       <local-administrator>AgMWLg==</local-administrator>
+                       <global-administrator>258</global-administrator>
+                   </redirect-extended-community>
+               </extended-communities>
+           </attributes>
+           <flowspec>
+               <destination-prefix>192.168.0.1/32</destination-prefix>
+           </flowspec>
+           <flowspec>
+               <source-prefix>10.0.0.2/32</source-prefix>
+           </flowspec>
+           <flowspec>
+               <protocol-ips>
+                   <op>equals</op>
+                   <value>17</value>
+               </protocol-ips>
+               <protocol-ips>
+                   <op>equals end-of-list</op>
+                   <value>6</value>
+               </protocol-ips>
+           </flowspec>
+           <flowspec>
+               <ports>
+                   <op>equals</op>
+                   <value>80</value>
+               </ports>
+               <ports>
+                   <op>equals end-of-list</op>
+                   <value>8080</value>
+               </ports>
+           </flowspec>
+           <flowspec>
+               <destination-ports>
+                   <op>greater-than</op>
+                   <value>8080</value>
+               </destination-ports>
+               <destination-ports>
+                   <op>less-than and-bit</op>
+                   <value>8088</value>
+               </destination-ports>
+               <destination-ports>
+                   <op>equals end-of-list</op>
+                   <value>3128</value>
+               </destination-ports>
+           </flowspec>
+           <flowspec>
+               <source-ports>
+                   <op>end-of-list greater-than</op>
+                   <value>1024</value>
+               </source-ports>
+           </flowspec>
+       </flowspec-route>
+   </flowspec-routes>
+
+IPv6 Flows Specification
+''''''''''''''''''''''''
+The IPv6 Flowspec table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <flowspec-ipv6-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
+       <flowspec-route>
+           <path-id>0</path-id>
+           <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>
+           <attributes>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <as-path></as-path>
+               <extended-communities>
+                   <transitive>true</transitive>
+                   <traffic-rate-extended-community>
+                       <informative-as>0</informative-as>
+                       <local-administrator>AAAAAA==</local-administrator>
+                   </traffic-rate-extended-community>
+               </extended-communities>
+           </attributes>
+           <flowspec>
+               <destination-prefix>2001:db8:31::/64</destination-prefix>
+           </flowspec>
+           <flowspec>
+               <source-prefix>2001:db8:30::/64</source-prefix>
+           </flowspec>
+           <flowspec>
+               <next-headers>
+                   <op>equals end-of-list</op>
+                   <value>17</value>
+               </next-headers>
+           </flowspec>
+           <flowspec>
+               <dscps>
+                   <op>equals end-of-list</op>
+                   <value>50</value>
+               </dscps>
+           </flowspec>
+           <flowspec>
+               <flow-label>
+                   <op>equals end-of-list</op>
+                   <value>2013</value>
+               </flow-label>
+           </flowspec>
+       </flowspec-route>
+   </flowspec-ipv6-routes>
+
+IPv4 L3VPN Flows Specification
+''''''''''''''''''''''''''''''
+The IPv4 L3VPN Flowspec table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <flowspec-l3vpn-ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
+       <flowspec-l3vpn-route>
+           <path-id>0</path-id>
+           <route-key>[l3vpn with route-distinguisher 172.16.0.44:101] all packets from 10.0.0.3/32</route-key>
+           <attributes>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <ipv4-next-hop>
+                   <global>5.6.7.8</global>
+               </ipv4-next-hop>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <as-path></as-path>
+               <extended-communities>
+                   <transitive>true</transitive>
+                   <redirect-ip-nh-extended-community>
+                       <copy>false</copy>
+                       <next-hop-address>0.0.0.0</next-hop-address>
+                   </redirect-ip-nh-extended-community>
+               </extended-communities>
+           </attributes>
+           <route-distinguisher>172.16.0.44:101</route-distinguisher>
+           <flowspec>
+               <source-prefix>10.0.0.3/32</source-prefix>
+           </flowspec>
+       </flowspec-l3vpn-route>
+   </flowspec-l3vpn-ipv4-routes>
+
+Programming
+^^^^^^^^^^^
+IPv4 Flow Specification
+'''''''''''''''''''''''
+This examples show how to originate and remove IPv4 fowspec route via programmable RIB.
+Make sure the *Application Peer* is configured first.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <flowspec-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
+       <route-key>flow1</route-key>
+       <path-id>0</path-id>
+       <flowspec>
+           <destination-prefix>192.168.0.1/32</destination-prefix>
+       </flowspec>
+       <flowspec>
+           <source-prefix>10.0.0.1/32</source-prefix>
+       </flowspec>
+       <flowspec>
+           <protocol-ips>
+               <op>equals end-of-list</op>
+               <value>6</value>
+           </protocol-ips>
+       </flowspec>
+       <flowspec>
+           <ports>
+               <op>equals end-of-list</op>
+               <value>80</value>
+           </ports>
+       </flowspec>
+       <flowspec>
+           <destination-ports>
+               <op>greater-than</op>
+               <value>8080</value>
+           </destination-ports>
+           <destination-ports>
+               <op>and-bit less-than end-of-list</op>
+               <value>8088</value>
+           </destination-ports>
+       </flowspec>
+       <flowspec>
+           <source-ports>
+               <op>greater-than end-of-list</op>
+               <value>1024</value>
+           </source-ports>
+       </flowspec>
+       <flowspec>
+           <types>
+               <op>equals end-of-list</op>
+               <value>0</value>
+           </types>
+       </flowspec>
+       <flowspec>
+           <codes>
+               <op>equals end-of-list</op>
+               <value>0</value>
+           </codes>
+       </flowspec>
+       <flowspec>
+           <tcp-flags>
+               <op>match end-of-list</op>
+               <value>32</value>
+           </tcp-flags>
+       </flowspec>
+       <flowspec>
+           <packet-lengths>
+               <op>greater-than</op>
+               <value>400</value>
+           </packet-lengths>
+           <packet-lengths>
+               <op>and-bit less-than end-of-list</op>
+               <value>500</value>
+           </packet-lengths>
+       </flowspec>
+       <flowspec>
+           <dscps>
+               <op>equals end-of-list</op>
+               <value>20</value>
+           </dscps>
+       </flowspec>
+       <flowspec>
+           <fragments>
+               <op>match end-of-list</op>
+               <value>first</value>
+           </fragments>
+       </flowspec>
+       <attributes>
+           <origin>
+               <value>igp</value>
+           </origin>
+           <as-path/>
+           <local-pref>
+               <pref>100</pref>
+           </local-pref>
+           <extended-communities>
+               ....
+           </extended-communities>
+       </attributes>
+   </flowspec-route>
+
+-----
+
+**Extended Communities**
+
+* **Traffic Rate**
+   .. code-block:: xml
+      :linenos:
+      :emphasize-lines: 5
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <traffic-rate-extended-community>
+              <informative-as>123</informative-as>
+              <local-administrator>AAAAAA==</local-administrator>
+          </traffic-rate-extended-community>
+      </extended-communities>
+
+   @line 5: A rate in bytes per second, *AAAAAA==* (0) means traffic discard.
+
+* **Traffic Action**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <traffic-action-extended-community>
+              <sample>true</sample>
+              <terminal-action>false</terminal-action>
+          </traffic-action-extended-community>
+      </extended-communities>
+
+
+* **Redirect to VRF AS 2byte format**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <redirect-extended-community>
+              <global-administrator>123</global-administrator>
+              <local-administrator>AAAAew==</local-administrator>
+          </redirect-extended-community>
+      </extended-communities>
+
+* **Redirect to VRF IPv4 format**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <redirect-ipv4>
+              <global-administrator>192.168.0.1</global-administrator>
+              <local-administrator>12345</local-administrator>
+          </redirect-ipv4>
+      </extended-communities>
+
+* **Redirect to VRF AS 4byte format**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <redirect-as4>
+              <global-administrator>64495</global-administrator>
+              <local-administrator>12345</local-administrator>
+          </redirect-as4>
+      </extended-communities>
+
+* **Redirect to IP**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <redirect-ip-nh-extended-community>
+              <copy>false</false>
+          </redirect-ip-nh-extended-community>
+      </extended-communities>
+
+* **Traffic Marking**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <traffic-marking-extended-community>
+              <global-administrator>20</global-administrator>
+          </traffic-marking-extended-community>
+      </extended-communities>
+
+-----
+
+To remove the route added above, following request can be used:
+
+**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``
+
+**Method:** ``DELETE``
+
+IPv4 L3VPN Flow Specification
+'''''''''''''''''''''''''''''
+This examples show how to originate and remove IPv4 L3VPN fowspec route via programmable RIB.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+    <flowspec-l3vpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
+        <path-id>0</path-id>
+        <route-key>flow-l3vpn</route-key>
+        <route-distinguisher>172.16.0.44:101</route-distinguisher>
+        <flowspec>
+            <source-prefix>10.0.0.3/32</source-prefix>
+        </flowspec>
+        <attributes>
+            <local-pref>
+                <pref>100</pref>
+            </local-pref>
+            <origin>
+                <value>igp</value>
+            </origin>
+            <as-path></as-path>
+               <extended-communities>
+                   <transitive>true</transitive>
+                   <redirect-ipv4>
+                       <global-administrator>172.16.0.44</global-administrator>
+                       <local-administrator>102</local-administrator>
+                   </redirect-ipv4>
+               </extended-communities>
+        </attributes>
+    </flowspec-l3vpn-route>
+
+-----
+
+To remove the route added above, following request can be used:
+
+**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``
+
+**Method:** ``DELETE``
+
+IPv6 Flow Specification
+'''''''''''''''''''''''
+This examples show how to originate and remove IPv6 fowspec route via programmable RIB.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <flowspec-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">
+       <route-key>flow-v6</route-key>
+       <path-id>0</path-id>
+       <flowspec>
+           <destination-prefix>2001:db8:30::3/128</destination-prefix>
+       </flowspec>
+       <flowspec>
+           <source-prefix>2001:db8:31::3/128</source-prefix>
+        </flowspec>
+       <flowspec>
+           <flow-label>
+               <op>equals end-of-list</op>
+               <value>1</value>
+           </flow-label>
+       </flowspec>
+       <attributes>
+           <extended-communities>
+               <transitive>true</transitive>
+               <redirect-ipv6>
+                   <global-administrator>2001:db8:1::6</global-administrator>
+                   <local-administrator>12345</local-administrator>
+               </redirect-ipv6>
+           </extended-communities>
+           <origin>
+               <value>igp</value>
+           </origin>
+           <as-path/>
+           <local-pref>
+               <pref>100</pref>
+           </local-pref>
+       </attributes>
+   </flowspec-route>
+
+-----
+
+To remove the route added above, following request can be used:
+
+**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``
+
+**Method:** ``DELETE``
+
+References
+^^^^^^^^^^
+* `Dissemination of Flow Specification Rules <https://tools.ietf.org/html/rfc5575>`_
+* `Dissemination of Flow Specification Rules for IPv6 <https://tools.ietf.org/html/draft-ietf-idr-flow-spec-v6-07>`_
+* `BGP Flow-Spec Extended Community for Traffic Redirect to IP Next Hop <https://tools.ietf.org/html/draft-ietf-idr-flowspec-redirect-ip-00>`_
+* `Clarification of the Flowspec Redirect Extended Community <https://tools.ietf.org/html/rfc7674>`_
+* `Revised Validation Procedure for BGP Flow Specifications <https://tools.ietf.org/html/draft-ietf-idr-bgp-flowspec-oid-03>`_
diff --git a/docs/bgp/bgp-user-guide-high-availability.rst b/docs/bgp/bgp-user-guide-high-availability.rst
new file mode 100644 (file)
index 0000000..7ef77c8
--- /dev/null
@@ -0,0 +1,76 @@
+.. _bgp-user-guide-high-availability:
+
+High Availability
+=================
+Running OpenDaylight BGP in clustered environment brings an advantage of the plugin's high availability (HA).
+This section illustrates a basic scenario for HA, also presents a configuration for clustered OpenDaylight BGP.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+Following example shows a configuration for running BGP in clustered environment.
+
+#. As the first step, configure (replicated *deafult* shard and *topology* shard if needed) and run OpenDaylight in clustered environment, install BGP and RESTCONF.
+
+#. 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.
+
+#. Remote peer should be configured to accept/initiate connection from/to all OpenDaylight cluster nodes with configured BGP plugin.
+
+#. 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.
+
+.. warning::
+
+   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`):
+
+   * In ``modules.conf`` add a new module:
+      .. code-block:: console
+
+         {
+             name = "bgp_rib"
+             namespace = "urn:opendaylight:params:xml:ns:yang:bgp-rib"
+             shard-strategy = "module"
+         }
+
+   * In ``module-shards.conf`` define a new module shard:
+      .. code-block:: console
+
+         {
+             name = "bgp_rib"
+             shards = [
+                 {
+                     name="bgp_rib"
+                     replicas = [
+                         "member-1"
+                     ]
+                 }
+             ]
+         }
+
+   **Note:** Use correct member name in module shard configuration.
+
+Failover scenario
+^^^^^^^^^^^^^^^^^
+Following section presents a basic BGP speaker failover scenario on 3-node OpenDaylight cluster setup.
+
+.. figure:: ./images/BGP_HA.png
+   :alt: BGP HA setup.
+
+   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.
+   Routes advertised by remote peer are replicated, hence RIBs state on all nodes is the same.
+
+-----
+
+.. figure:: ./images/BGP_HA_failure.png
+   :alt: Node went down.
+
+   In a case a cluster node, where BGP instance is running, goes down (unexpected failure, restart), active BGP session is dropped.
+
+-----
+
+.. figure:: ./images/BGP_HA_recovery.png
+   :alt: BGP recovery.
+
+   Now, one of the stand-by BGP speaker instances become active. Remote peer establishes new connection and advertises routes again.
diff --git a/docs/bgp/bgp-user-guide-ip-unicast-family.rst b/docs/bgp/bgp-user-guide-ip-unicast-family.rst
new file mode 100644 (file)
index 0000000..c8cbc09
--- /dev/null
@@ -0,0 +1,355 @@
+.. _bgp-user-guide-ip-unicast-family:
+
+IP Unicast Family
+=================
+The BGP-4 allows to carry IPv4 specific information only.
+The basic BGP Multiprotocol extension brings *Unicast* Subsequent Address Family (SAFI) - intended to be used for IP unicast forwarding.
+The combination of IPv4 and IPv6 Address Family (AF) and Unicast SAFI is essential for Internet routing.
+The IPv4 Unicast routes are interchangeable with BGP-4 routes, as they can carry the same type of routing information.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+This section shows a way to enable IPv4 and IPv6 Unicast family in BGP speaker and peer configuration.
+
+BGP Speaker
+'''''''''''
+To enable IPv4 and IPv6 Unicast support in BGP plugin, first configure BGP speaker instance:
+
+**URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <protocol xmlns="http://openconfig.net/yang/network-instance">
+       <name>bgp-example</name>
+       <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
+       <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+           <global>
+               <config>
+                   <router-id>192.0.2.2</router-id>
+                   <as>65000</as>
+               </config>
+               <afi-safis>
+                   <afi-safi>
+                       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
+                   </afi-safi>
+                   <afi-safi>
+                       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
+                   </afi-safi>
+               </afi-safis>
+           </global>
+       </bgp>
+   </protocol>
+
+BGP Peer
+''''''''
+Here is an example for BGP peer configuration with enabled IPv4 and IPv6 Unicast family.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.1</neighbor-address>
+       <afi-safis>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
+           </afi-safi>
+       </afi-safis>
+   </neighbor>
+
+IP Unicast API
+^^^^^^^^^^^^^^
+Following trees illustrate the BGP IP Unicast routes structures.
+
+IPv4 Unicast Route
+''''''''''''''''''
+.. code-block:: console
+
+   :(ipv4-routes-case)
+      +--ro ipv4-routes
+        +--ro ipv4-route* [route-key path-id]
+           +--ro route-key     string
+           +--ro prefix        inet:ipv4-prefix
+           +--ro path-id       path-id
+           +--ro attributes
+              +--ro origin
+              |  +--ro value    bgp-t:bgp-origin
+              +--ro as-path
+              |  +--ro segments*
+              |     +--ro as-sequence*   inet:as-number
+              |     +--ro as-set*        inet:as-number
+              +--ro (c-next-hop)?
+              |  +--:(ipv4-next-hop-case)
+              |  |  +--ro ipv4-next-hop
+              |  |     +--ro global?   inet:ipv4-address
+              |  +--:(ipv6-next-hop-case)
+              |  |  +--ro ipv6-next-hop
+              |  |     +--ro global?       inet:ipv6-address
+              |  |     +--ro link-local?   inet:ipv6-address
+              |  +--:(empty-next-hop-case)
+              |     +--ro empty-next-hop?            empty
+              +--ro multi-exit-disc
+              |  +--ro med?   uint32
+              +--ro local-pref
+              |  +--ro pref?   uint32
+              +--ro atomic-aggregate!
+              +--ro aggregator
+              |  +--ro as-number?         inet:as-number
+              |  +--ro network-address?   inet:ipv4-address
+              +--ro communities*
+              |  +--ro as-number?   inet:as-number
+              |  +--ro semantics?   uint16
+              +--ro extended-communities*
+              |  +--ro transitive?                             boolean
+              |  +--ro (extended-community)?
+              |     +--:(as-specific-extended-community-case)
+              |     |  +--ro as-specific-extended-community
+              |     |     +--ro global-administrator?   short-as-number
+              |     |     +--ro local-administrator?    binary
+              |     +--:(inet4-specific-extended-community-case)
+              |     |  +--ro inet4-specific-extended-community
+              |     |     +--ro global-administrator?   inet:ipv4-address
+              |     |     +--ro local-administrator?    binary
+              |     +--:(opaque-extended-community-case)
+              |     |  +--ro opaque-extended-community
+              |     |     +--ro value?   binary
+              |     +--:(route-target-extended-community-case)
+              |     |  +--ro route-target-extended-community
+              |     |     +--ro global-administrator?   short-as-number
+              |     |     +--ro local-administrator?    binary
+              |     +--:(route-origin-extended-community-case)
+              |     |  +--ro route-origin-extended-community
+              |     |     +--ro global-administrator?   short-as-number
+              |     |     +--ro local-administrator?    binary
+              |     +--:(route-target-ipv4-case)
+              |     |  +--ro route-target-ipv4
+              |     |     +--ro global-administrator?   inet:ipv4-address
+              |     |     +--ro local-administrator?    uint16
+              |     +--:(route-origin-ipv4-case)
+              |     |  +--ro route-origin-ipv4
+              |     |     +--ro global-administrator?   inet:ipv4-address
+              |     |     +--ro local-administrator?    uint16
+              |     +--:(link-bandwidth-case)
+              |     |  +--ro link-bandwidth-extended-community
+              |     |     +--ro bandwidth    netc:bandwidth
+              |     +--:(as-4-generic-spec-extended-community-case)
+              |     |  +--ro as-4-generic-spec-extended-community
+              |     |     +--ro as-4-specific-common
+              |     |        +--ro as-number              inet:as-number
+              |     |        +--ro local-administrator    uint16
+              |     +--:(as-4-route-target-extended-community-case)
+              |     |  +--ro as-4-route-target-extended-community
+              |     |     +--ro as-4-specific-common
+              |     |        +--ro as-number              inet:as-number
+              |     |        +--ro local-administrator    uint16
+              |     +--:(as-4-route-origin-extended-community-case)
+              |     |  +--ro as-4-route-origin-extended-community
+              |     |     +--ro as-4-specific-common
+              |     |        +--ro as-number              inet:as-number
+              |     |        +--ro local-administrator    uint16
+              |     +--:(encapsulation-case)
+              |        +--ro encapsulation-extended-community
+              |           +--ro tunnel-type    encapsulation-tunnel-type
+              +--ro originator-id
+              |  +--ro originator?   inet:ipv4-address
+              +--ro cluster-id
+              |  +--ro cluster*   bgp-t:cluster-identifier
+              +--ro aigp
+              |  +--ro aigp-tlv
+              |     +--ro metric?   netc:accumulated-igp-metric
+              +--ro unrecognized-attributes* [type]
+                 +--ro partial       boolean
+                 +--ro transitive    boolean
+                 +--ro type          uint8
+                 +--ro value         binary
+
+IPv6 Unicast Route
+''''''''''''''''''
+.. code-block:: console
+
+   :(ipv6-routes-case)
+      +--ro ipv6-routes
+         +--ro ipv6-route* [route-key path-id]
+            +--ro route-key     string
+            +--ro prefix        inet:ipv6-prefix
+            +--ro path-id       path-id
+            +--ro attributes
+            ...
+
+Usage
+^^^^^
+IPv4 Unicast
+''''''''''''
+The IPv4 Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+       <ipv4-route>
+           <route-key>193.0.2.1/32</route-key>
+           <path-id>0</path-id>
+           <prefix>193.0.2.1/32</prefix>
+           <attributes>
+               <as-path></as-path>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <ipv4-next-hop>
+                   <global>10.0.0.1</global>
+               </ipv4-next-hop>
+           </attributes>
+       </ipv4-route>
+   </ipv4-routes>
+
+IPv6 Unicast
+''''''''''''
+The IPv6 Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <ipv6-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+       <ipv6-route>
+           <route-key>2a02:b80:0:1::/64</route-key>
+           <path-id>0</path-id>
+           <prefix>2a02:b80:0:1::/64</prefix>
+           <attributes>
+               <as-path></as-path>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <local-pref>
+                   <pref>200</pref>
+               </local-pref>
+               <ipv6-next-hop>
+                   <global>2a02:b80:0:2::1</global>
+               </ipv6-next-hop>
+           </attributes>
+       </ipv6-route>
+   </ipv6-routes>
+
+.. note:: IPv4/6 routes mapping to topology nodes is supported by BGP Topology Provider.
+
+Programming
+^^^^^^^^^^^
+IPv4 Unicast
+''''''''''''
+This examples show how to originate and remove IPv4 route via programmable RIB.
+Make sure the *Application Peer* is configured first.
+
+.. note:: IPv4 Route Key must be equal to prefix.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+       <route-key>10.0.0.11/32</route-key>
+       <prefix>10.0.0.11/32</prefix>
+       <path-id>0</path-id>
+       <attributes>
+           <as-path></as-path>
+           <origin>
+               <value>igp</value>
+           </origin>
+           <local-pref>
+               <pref>100</pref>
+           </local-pref>
+           <ipv4-next-hop>
+               <global>10.11.1.1</global>
+           </ipv4-next-hop>
+       </attributes>
+   </ipv4-route>
+
+-----
+
+To remove the route added above, following request can be used:
+
+**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``
+
+**Method:** ``DELETE``
+
+IPv6 Unicast
+''''''''''''
+This examples show how to originate and remove IPv6 route via programmable RIB:
+
+.. note:: IPv6 Route Key must be equal to prefix.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <ipv6-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+       <route-key>2001:db8:30::3/128</route-key>
+       <prefix>2001:db8:30::3/128</prefix>
+       <path-id>0</path-id>
+       <attributes>
+           <ipv6-next-hop>
+               <global>2001:db8:1::6</global>
+           </ipv6-next-hop>
+           <as-path/>
+           <origin>
+               <value>igp</value>
+           </origin>
+           <local-pref>
+               <pref>100</pref>
+           </local-pref>
+       </attributes>
+   </ipv6-route>
+
+-----
+
+To remove the route added above, following request can be used:
+
+**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``
+
+**Method:** ``DELETE``
+
+References
+^^^^^^^^^^
+* `Multiprotocol Extensions for BGP-4 <https://tools.ietf.org/html/rfc4760>`_
diff --git a/docs/bgp/bgp-user-guide-l3vpn-family.rst b/docs/bgp/bgp-user-guide-l3vpn-family.rst
new file mode 100644 (file)
index 0000000..0d32f6a
--- /dev/null
@@ -0,0 +1,367 @@
+.. _ip-l3vpn-family:
+
+IP L3VPN Family
+===============
+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.
+Also, routes are distributed to specific VPN remote sites.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+This section shows a way to enable IPv4 and IPv6 L3VPN family in BGP speaker and peer configuration.
+
+BGP Speaker
+'''''''''''
+To enable IPv4 and IPv6 L3VPN support in BGP plugin, first configure BGP speaker instance:
+
+**URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <protocol xmlns="http://openconfig.net/yang/network-instance">
+       <name>bgp-example</name>
+       <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
+       <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+           <global>
+               <config>
+                   <router-id>192.0.2.2</router-id>
+                   <as>65000</as>
+               </config>
+               <afi-safis>
+                   <afi-safi>
+                       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
+                   </afi-safi>
+                   <afi-safi>
+                       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
+                   </afi-safi>
+                   <afi-safi>
+                       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-MULTICAST</afi-safi-name>
+                   </afi-safi>
+                   <afi-safi>
+                       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-MULTICAST</afi-safi-name>
+                   </afi-safi>
+               </afi-safis>
+           </global>
+       </bgp>
+   </protocol>
+
+BGP Peer
+''''''''
+Here is an example for BGP peer configuration with enabled IPv4 and IPv6 L3VPN family.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.1</neighbor-address>
+       <afi-safis>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
+           </afi-safi>
+       </afi-safis>
+   </neighbor>
+
+IP L3VPN API
+^^^^^^^^^^^^
+Following trees illustrate the BGP IP L3VPN routes structures.
+
+IPv4 L3VPN Unicast Route
+''''''''''''''''''''''''
+.. code-block:: console
+
+   :(vpn-ipv4-routes-case)
+      +--ro vpn-ipv4-routes
+         +--ro vpn-route* [route-key path-id]
+            +--ro route-key              string
+            +--ro path-id                path-id
+            +--ro label-stack*
+            |  +--ro label-value?   netc:mpls-label
+            +--ro prefix?                inet:ip-prefix
+            +--ro path-id?               path-id
+            +--ro route-distinguisher?   bgp-t:route-distinguisher
+            +--ro attributes
+            ...
+
+IPv6 L3VPN Unicast Route
+''''''''''''''''''''''''
+.. code-block:: console
+
+   :(vpn-ipv6-routes-case)
+      +--ro vpn-ipv6-routes
+         +--ro vpn-route* [route-key path-id]
+            +--ro route-key              string
+            +--ro path-id                path-id
+            +--ro label-stack*
+            |  +--ro label-value?   netc:mpls-label
+            +--ro prefix?                inet:ip-prefix
+            +--ro path-id?               path-id
+            +--ro route-distinguisher?   bgp-t:route-distinguisher
+            +--ro attributes
+            ...
+
+IPv4 L3VPN Multicast Route
+''''''''''''''''''''''''''
+.. code-block:: console
+
+   :(l3vpn-mcast-routes-ipv4-case)
+      +--ro l3vpn-mcast-routes-ipv4
+           +--ro l3vpn-mcast-route* [route-key path-id]
+              +--ro prefix?                inet:ip-prefix
+              +--ro route-distinguisher?   bgp-t:route-distinguisher
+
+IPv6 L3VPN Multicast Route
+''''''''''''''''''''''''''
+.. code-block:: console
+
+   :(l3vpn-mcast-routes-ipv6-case)
+      +--ro l3vpn-mcast-routes-ipv6
+           +--ro l3vpn-mcast-route* [route-key path-id]
+              +--ro prefix?                inet:ip-prefix
+              +--ro route-distinguisher?   bgp-t:route-distinguisher
+
+
+Usage
+^^^^^
+IPv4 L3VPN Unicast
+''''''''''''''''''
+The IPv4 L3VPN Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <vpn-ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv4">
+       <vpn-route>
+           <path-id>0</path-id>
+           <route-key>cAXdYQABrBAALABlCgIi</route-key>
+           <label-stack>
+               <label-value>24022</label-value>
+           </label-stack>
+           <attributes>
+               <extended-communities>
+                   <transitive>true</transitive>
+                   <route-target-extended-community>
+                       <global-administrator>65000</global-administrator>
+                       <local-administrator>AAAAZQ==</local-administrator>
+                   </route-target-extended-community>
+               </extended-communities>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <as-path></as-path>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <ipv4-next-hop>
+                   <global>127.16.0.44</global>
+               </ipv4-next-hop>
+           </attributes>
+           <route-distinguisher>172.16.0.44:101</route-distinguisher>
+           <prefix>10.2.34.0/24</prefix>
+       </vpn-route>
+   </vpn-ipv4-routes>
+
+IPv6 L3VPN Unicast
+''''''''''''''''''
+The IPv6 L3VPN Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <vpn-ipv6-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv6">
+       <vpn-route>
+           <path-id>0</path-id>
+           <route-key>mAXdcQABrBAALABlKgILgAAAAAE=</route-key>
+           <label-stack>
+               <label-value>24023</label-value>
+           </label-stack>
+           <attributes>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <extended-communities>
+                   <route-target-extended-community>
+                       <global-administrator>65000</global-administrator>
+                       <local-administrator>AAAAZQ==</local-administrator>
+                   </route-target-extended-community>
+                   <transitive>true</transitive>
+               </extended-communities>
+               <ipv6-next-hop>
+                   <global>2a02:b80:0:2::1</global>
+               </ipv6-next-hop>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <as-path></as-path>
+           </attributes>
+           <route-distinguisher>172.16.0.44:101</route-distinguisher>
+           <prefix>2a02:b80:0:1::/64</prefix>
+       </vpn-route>
+   </vpn-ipv6-routes>
+
+IPv4 L3VPN Multicast
+''''''''''''''''''''
+The IPv4 L3VPN Multicast table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-types:mcast-mpls-labeled-vpn-subsequent-address-family/bgp-l3vpn-mcast:l3vpn-mcast-routes``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <l3vpn-mcast-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp:l3vpn:mcast">
+       <l3vpn-mcast-route>
+           <path-id>0</path-id>
+           <route-key>mAXdcQABrBAALABlKgILgAAAAAE=</route-key>
+           <route-distinguisher>172.16.0.44:101</route-distinguisher>
+           <prefix>10.2.34.0/24</prefix>
+           <attributes>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <extended-communities>
+                   <transitive>true</transitive>
+                   <vrf-route-import-extended-community>
+                       <inet4-specific-extended-community-common>
+                           <global-administrator>10.0.0.1</global-administrator>
+                           <local-administrator>123=</local-administrator>
+                        </inet4-specific-extended-community-common>
+                    </vrf-route-import-extended-community>
+               </extended-communities>
+               <ipv4-next-hop>
+                   <global>127.16.0.44</global>
+               </ipv4-next-hop>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <as-path></as-path>
+           </attributes>
+       </l3vpn-mcast-route>
+   </l3vpn-mcast-routes>
+
+IPv6 L3VPN Multicast
+''''''''''''''''''''
+The IPv4 L3VPN Multicast table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv6-address-family/bgp-types:mcast-mpls-labeled-vpn-subsequent-address-family/bgp-l3vpn-mcast:l3vpn-mcast-routes``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <l3vpn-mcast-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp:l3vpn:mcast">
+       <l3vpn-mcast-route>
+           <path-id>0</path-id>
+           <route-key>mAXdcQABrBAALABlKgILgAAAAAE=</route-key>
+           <route-distinguisher>172.16.0.44:101</route-distinguisher>
+           <prefix>2a02:b80:0:1::/64</prefix>
+           <attributes>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <extended-communities>
+                   <transitive>true</transitive>
+                   <vrf-route-import-extended-community>
+                       <inet4-specific-extended-community-common>
+                           <global-administrator>10.0.0.1</global-administrator>
+                           <local-administrator>123=</local-administrator>
+                        </inet4-specific-extended-community-common>
+                    </vrf-route-import-extended-community>
+               </extended-communities>
+               <ipv6-next-hop>
+                   <global>2a02:b80:0:2::1</global>
+               </ipv6-next-hop>
+               <origin>
+                   <value>igp</value>
+               </origin>
+               <as-path></as-path>
+           </attributes>
+       </l3vpn-mcast-route>
+   </l3vpn-mcast-routes>
+
+Programming
+^^^^^^^^^^^
+This examples show how to originate and remove IPv4 L3VPN Unicast route via programmable RIB.
+Make sure the *Application Peer* is configured first.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <vpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv4">
+       <path-id>0</path-id>
+       <route-key>vpn1</route-key>
+       <label-stack>
+           <label-value>123</label-value>
+       </label-stack>
+       <route-distinguisher>429496729:1</route-distinguisher>
+       <prefix>2.2.2.2/32</prefix>
+       <attributes>
+           <ipv4-next-hop>
+               <global>199.20.166.41</global>
+           </ipv4-next-hop>
+           <as-path/>
+           <origin>
+               <value>igp</value>
+           </origin>
+           <extended-communities>
+               <route-target-extended-community>
+                   <global-administrator>65000</global-administrator>
+                   <local-administrator>AAAAZQ==</local-administrator>
+               </route-target-extended-community>
+               <transitive>true</transitive>
+           </extended-communities>
+       </attributes>
+   </vpn-route>
+
+-----
+
+To remove the route added above, following request can be used:
+
+**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/0``
+
+**Method:** ``DELETE``
+
+References
+^^^^^^^^^^
+* `BGP/MPLS IP Virtual Private Networks (VPNs) <https://tools.ietf.org/html/rfc4364>`_
+* `BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN <https://tools.ietf.org/html/rfc4659>`_
+* `BGP/MPLS VPN Virtual PE <https://tools.ietf.org/html/draft-ietf-bess-virtual-pe-00>`_
diff --git a/docs/bgp/bgp-user-guide-labeled-family.rst b/docs/bgp/bgp-user-guide-labeled-family.rst
new file mode 100644 (file)
index 0000000..307f93c
--- /dev/null
@@ -0,0 +1,262 @@
+.. _bgp-user-guide-labeled-family:
+
+IP Labeled Unicast Family
+=========================
+The BGP Labeled Unicast (BGP-LU) Multiprotocol extension is used to distribute a MPLS label that is mapped to a particular route.
+It can be used to advertise a MPLS transport path between IGP regions and Autonomous Systems.
+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.
+In addition, IPv6 Labeled Unicast can be used to interconnect IPv6 islands over IPv4/MPLS networks using 6PE.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+This section shows a way to enable IPv4 and IPv6 Labeled Unicast family in BGP speaker and peer configuration.
+
+BGP Speaker
+'''''''''''
+To enable IPv4 and IPv6 Labeled Unicast support in BGP plugin, first configure BGP speaker instance:
+
+**URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <protocol xmlns="http://openconfig.net/yang/network-instance">
+       <name>bgp-example</name>
+       <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
+       <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+           <global>
+               <config>
+                   <router-id>192.0.2.2</router-id>
+                   <as>65000</as>
+               </config>
+               <afi-safis>
+                   <afi-safi>
+                       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
+                   </afi-safi>
+                   <afi-safi>
+                       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-LABELLED-UNICAST</afi-safi-name>
+                   </afi-safi>
+               </afi-safis>
+           </global>
+       </bgp>
+   </protocol>
+
+BGP Peer
+''''''''
+Here is an example for BGP peer configuration with enabled IPv4 and IPv6 Labeled Unicast family.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.1</neighbor-address>
+       <afi-safis>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
+           </afi-safi>
+           <afi-safi>
+               <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-LABELLED-UNICAST</afi-safi-name>
+           </afi-safi>
+       </afi-safis>
+   </neighbor>
+
+IP Labeled Unicast API
+^^^^^^^^^^^^^^^^^^^^^^
+Following trees illustrate the BGP IP Labeled Unicast routes structures.
+
+IPv4 Labeled Unicast Route
+''''''''''''''''''''''''''
+.. code-block:: console
+
+   :(labeled-unicast-routes-case)
+     +--ro labeled-unicast-routes
+        +--ro labeled-unicast-route* [route-key path-id]
+           +--ro route-key      string
+           +--ro label-stack*
+           |  +--ro label-value?   netc:mpls-label
+           +--ro prefix?        inet:ip-prefix
+           +--ro path-id        path-id
+           +--ro attributes
+           ...
+
+
+IPv6 Labeled Unicast Route
+''''''''''''''''''''''''''
+.. code-block:: console
+
+   :(labeled-unicast-ipv6-routes-case)
+      +--ro labeled-unicast-ipv6-routes
+         +--ro labeled-unicast-route* [route-key path-id]
+            +--ro route-key      string
+            +--ro label-stack*
+            |  +--ro label-value?   netc:mpls-label
+            +--ro prefix?        inet:ip-prefix
+            +--ro path-id        path-id
+            +--ro attributes
+            ...
+
+Usage
+^^^^^
+The IPv4 Labeled Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <labeled-unicast-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">
+       <labeled-unicast-route>
+           <path-id>0</path-id>
+           <route-key>MAA+gRQAAA==</route-key>
+           <attributes>
+               <local-pref>
+                   <pref>100</pref>
+               </local-pref>
+               <ipv4-next-hop>
+                   <global>200.10.0.101</global>
+               </ipv4-next-hop>
+               <as-path></as-path>
+               <origin>
+                   <value>igp</value>
+               </origin>
+           </attributes>
+           <label-stack>
+               <label-value>1000</label-value>
+           </label-stack>
+           <prefix>20.0.0.0/24</prefix>
+       </labeled-unicast-route>
+   </labeled-unicast-routes>
+
+Programming
+^^^^^^^^^^^
+IPv4 Labeled
+''''''''''''
+This examples show how to originate and remove IPv4 labeled route via programmable RIB.
+Make sure the *Application Peer* is configured first.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <labeled-unicast-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">
+       <route-key>label1</route-key>
+       <prefix>1.1.1.1/32</prefix>
+       <path-id>0</path-id>
+       <label-stack>
+           <label-value>800322</label-value>
+       </label-stack>
+       <attributes>
+           <ipv4-next-hop>
+               <global>199.20.160.41</global>
+           </ipv4-next-hop>
+           <origin>
+               <value>igp</value>
+           </origin>
+           <as-path/>
+           <local-pref>
+               <pref>100</pref>
+           </local-pref>
+       </attributes>
+   </labeled-unicast-route>
+
+-----
+
+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.
+
+.. code-block:: xml
+
+   <bgp-prefix-sid>
+       <bgp-prefix-sid-tlvs>
+           <label-index-tlv xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">322</label-index-tlv>
+       </bgp-prefix-sid-tlvs>
+       <bgp-prefix-sid-tlvs>
+           <srgb-value xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">
+               <base>800000</base>
+               <range>4095</range>
+           </srgb-value>
+       </bgp-prefix-sid-tlvs>
+   </bgp-prefix-sid>
+
+-----
+
+To remove the route added above, following request can be used:
+
+**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``
+
+**Method:** ``DELETE``
+
+IPv6 Labeled
+''''''''''''
+This examples show how to originate and remove IPv6 labeled route via programmable RIB.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <labeled-unicast-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast">
+       <route-key>label1</route-key>
+       <prefix>2001:db8:30::3/128</prefix>
+       <path-id>0</path-id>
+       <label-stack>
+           <label-value>123</label-value>
+       </label-stack>
+       <attributes>
+           <ipv6-next-hop>
+               <global>2003:4:5:6::7</global>
+           </ipv6-next-hop>
+           <origin>
+               <value>igp</value>
+           </origin>
+           <as-path/>
+           <local-pref>
+               <pref>100</pref>
+           </local-pref>
+       </attributes>
+   </labeled-unicast-route>
+
+-----
+
+To remove the route added above, following request can be used:
+
+**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``
+
+**Method:** ``DELETE``
+
+References
+^^^^^^^^^^
+* `Carrying Label Information in BGP-4 <https://tools.ietf.org/html/rfc3107>`_
+* `Segment Routing Prefix SID extensions for BGP <https://tools.ietf.org/html/draft-ietf-idr-bgp-prefix-sid-03>`_
+* `Connecting IPv6 Islands over IPv4 MPLS Using IPv6 Provider Edge Routers (6PE) <https://tools.ietf.org/html/rfc4798>`_
+* `BGP-Prefix Segment in large-scale data centers <https://tools.ietf.org/html/draft-ietf-spring-segment-routing-msdc-01>`_
+* `Egress Peer Engineering using BGP-LU <https://tools.ietf.org/html/draft-gredler-idr-bgplu-epe-06>`_
diff --git a/docs/bgp/bgp-user-guide-linkstate-family.rst b/docs/bgp/bgp-user-guide-linkstate-family.rst
new file mode 100644 (file)
index 0000000..607b58c
--- /dev/null
@@ -0,0 +1,544 @@
+.. _bgp-user-guide-linkstate-family:
+
+Link-State Family
+=================
+The BGP Link-State (BGP-LS) Multiprotocol extension allows to distribute Link-State and Traffic Engineering (TE) information.
+This information is typically distributed by IGP routing protocols with in the network, limiting LSDB or TED visibility to the IGP area.
+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).
+The information is applicable in ALTO servers and PCEs, as both need to gather information about topologies.
+In addition, link-state information is extended to carry segment information (Spring).
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+This section shows a way to enable IPv4 and IPv6 Labeled Unicast family in BGP speaker and peer configuration.
+
+BGP Speaker
+'''''''''''
+To enable BGP-LS support in BGP plugin, first configure BGP speaker instance:
+
+**URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <protocol xmlns="http://openconfig.net/yang/network-instance">
+       <name>bgp-example</name>
+       <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
+       <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+           <global>
+               <config>
+                   <router-id>192.0.2.2</router-id>
+                   <as>65000</as>
+               </config>
+               <afi-safis>
+                   <afi-safi>
+                       <afi-safi-name>LINKSTATE</afi-safi-name>
+                   </afi-safi>
+               </afi-safis>
+           </global>
+       </bgp>
+   </protocol>
+
+Linkstate path attribute
+''''''''''''''''''''''''
+IANA allocation for BGP-LS path attribute is TYPE 29.
+Some older BGP-LS implementations might still require earliest asigned allocation TYPE 99.
+To use TYPE = 99, you need to set value bellow to false.
+
+**URL:** ``/restconf/config/bgp-linkstate-app-config:bgp-linkstate-app-config``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <bgp-linkstate-app-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:linkstate-app-config">
+       <iana-linkstate-attribute-type>false</iana-linkstate-attribute-type>
+   </bgp-linkstate-app-config>
+
+BGP Peer
+''''''''
+Here is an example for BGP peer configuration with enabled BGP-LS family.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.1</neighbor-address>
+       <afi-safis>
+           <afi-safi>
+               <afi-safi-name>LINKSTATE</afi-safi-name>
+           </afi-safi>
+       </afi-safis>
+   </neighbor>
+
+Link-State Route API
+^^^^^^^^^^^^^^^^^^^^
+Following tree illustrate the BGP Link-State route structure.
+
+.. code-block:: console
+
+   :(linkstate-routes-case)
+      +--ro linkstate-routes
+         +--ro linkstate-route* [route-key path-id]
+            +--ro route-key                       string
+            +--ro path-id                         path-id
+            +--ro protocol-id                     protocol-id
+            +--ro identifier                      identifier
+            +--ro (object-type)?
+            |  +--:(node-case)
+            |  |  +--ro node-descriptors
+            |  |     +--ro as-number?         inet:as-number
+            |  |     +--ro area-id?           area-identifier
+            |  |     +--ro domain-id?         domain-identifier
+            |  |     +--ro (c-router-identifier)?
+            |  |        +--:(isis-node-case)
+            |  |        |  +--ro isis-node
+            |  |        |     +--ro iso-system-id    netc:iso-system-identifier
+            |  |        +--:(isis-pseudonode-case)
+            |  |        |  +--ro isis-pseudonode
+            |  |        |     +--ro is-is-router-identifier
+            |  |        |     |  +--ro iso-system-id    netc:iso-system-identifier
+            |  |        |     +--ro psn                        uint8
+            |  |        +--:(ospf-node-case)
+            |  |        |  +--ro ospf-node
+            |  |        |     +--ro ospf-router-id    uint32
+            |  |        +--:(ospf-pseudonode-case)
+            |  |           +--ro ospf-pseudonode
+            |  |              +--ro ospf-router-id    uint32
+            |  |              +--ro lan-interface     ospf-interface-identifier
+            |  +--:(link-case)
+            |  |  +--ro local-node-descriptors
+            |  |  |  +--ro as-number?         inet:as-number
+            |  |  |  +--ro area-id?           area-identifier
+            |  |  |  +--ro domain-id?         domain-identifier
+            |  |  |  +--ro (c-router-identifier)?
+            |  |  |  |  +--:(isis-node-case)
+            |  |  |  |  |  +--ro isis-node
+            |  |  |  |  |     +--ro iso-system-id    netc:iso-system-identifier
+            |  |  |  |  +--:(isis-pseudonode-case)
+            |  |  |  |  |  +--ro isis-pseudonode
+            |  |  |  |  |     +--ro is-is-router-identifier
+            |  |  |  |  |     |  +--ro iso-system-id    netc:iso-system-identifier
+            |  |  |  |  |     +--ro psn                        uint8
+            |  |  |  |  +--:(ospf-node-case)
+            |  |  |  |  |  +--ro ospf-node
+            |  |  |  |  |     +--ro ospf-router-id    uint32
+            |  |  |  |  +--:(ospf-pseudonode-case)
+            |  |  |  |     +--ro ospf-pseudonode
+            |  |  |  |        +--ro ospf-router-id    uint32
+            |  |  |  |        +--ro lan-interface     ospf-interface-identifier
+            |  |  |  +--ro bgp-router-id?     inet:ipv4-address
+            |  |  |  +--ro member-asn?        inet:as-number
+            |  |  +--ro remote-node-descriptors
+            |  |  |  +--ro as-number?         inet:as-number
+            |  |  |  +--ro area-id?           area-identifier
+            |  |  |  +--ro domain-id?         domain-identifier
+            |  |  |  +--ro (c-router-identifier)?
+            |  |  |  |  +--:(isis-node-case)
+            |  |  |  |  |  +--ro isis-node
+            |  |  |  |  |     +--ro iso-system-id    netc:iso-system-identifier
+            |  |  |  |  +--:(isis-pseudonode-case)
+            |  |  |  |  |  +--ro isis-pseudonode
+            |  |  |  |  |     +--ro is-is-router-identifier
+            |  |  |  |  |     |  +--ro iso-system-id    netc:iso-system-identifier
+            |  |  |  |  |     +--ro psn                        uint8
+            |  |  |  |  +--:(ospf-node-case)
+            |  |  |  |  |  +--ro ospf-node
+            |  |  |  |  |     +--ro ospf-router-id    uint32
+            |  |  |  |  +--:(ospf-pseudonode-case)
+            |  |  |  |     +--ro ospf-pseudonode
+            |  |  |  |        +--ro ospf-router-id    uint32
+            |  |  |  |        +--ro lan-interface     ospf-interface-identifier
+            |  |  |  +--ro bgp-router-id?     inet:ipv4-address
+            |  |  |  +--ro member-asn?        inet:as-number
+            |  |  +--ro link-descriptors
+            |  |     +--ro link-local-identifier?    uint32
+            |  |     +--ro link-remote-identifier?   uint32
+            |  |     +--ro ipv4-interface-address?   ipv4-interface-identifier
+            |  |     +--ro ipv6-interface-address?   ipv6-interface-identifier
+            |  |     +--ro ipv4-neighbor-address?    ipv4-interface-identifier
+            |  |     +--ro ipv6-neighbor-address?    ipv6-interface-identifier
+            |  |     +--ro multi-topology-id?        topology-identifier
+            |  +--:(prefix-case)
+            |  |  +--ro advertising-node-descriptors
+            |  |  |  +--ro as-number?         inet:as-number
+            |  |  |  +--ro area-id?           area-identifier
+            |  |  |  +--ro domain-id?         domain-identifier
+            |  |  |  +--ro (c-router-identifier)?
+            |  |  |     +--:(isis-node-case)
+            |  |  |     |  +--ro isis-node
+            |  |  |     |     +--ro iso-system-id    netc:iso-system-identifier
+            |  |  |     +--:(isis-pseudonode-case)
+            |  |  |     |  +--ro isis-pseudonode
+            |  |  |     |     +--ro is-is-router-identifier
+            |  |  |     |     |  +--ro iso-system-id    netc:iso-system-identifier
+            |  |  |     |     +--ro psn                        uint8
+            |  |  |     +--:(ospf-node-case)
+            |  |  |     |  +--ro ospf-node
+            |  |  |     |     +--ro ospf-router-id    uint32
+            |  |  |     +--:(ospf-pseudonode-case)
+            |  |  |        +--ro ospf-pseudonode
+            |  |  |           +--ro ospf-router-id    uint32
+            |  |  |           +--ro lan-interface     ospf-interface-identifier
+            |  |  +--ro prefix-descriptors
+            |  |     +--ro multi-topology-id?             topology-identifier
+            |  |     +--ro ospf-route-type?               ospf-route-type
+            |  |     +--ro ip-reachability-information?   inet:ip-prefix
+            |  +--:(te-lsp-case)
+            |     +--ro (address-family)?
+            |     |  +--:(ipv4-case)
+            |     |  |  +--ro ipv4-tunnel-sender-address      inet:ipv4-address
+            |     |  |  +--ro ipv4-tunnel-endpoint-address    inet:ipv4-address
+            |     |  +--:(ipv6-case)
+            |     |     +--ro ipv6-tunnel-sender-address      inet:ipv6-address
+            |     |     +--ro ipv6-tunnel-endpoint-address    inet:ipv6-address
+            |     +--ro tunnel-id?                      rsvp:tunnel-id
+            |     +--ro lsp-id?                         rsvp:lsp-id
+            +--ro attributes
+               +--ro (link-state-attribute)?
+                  +--:(node-attributes-case)
+                  |  +--ro node-attributes
+                  |     +--ro topology-identifier*   topology-identifier
+                  |     +--ro node-flags?            node-flag-bits
+                  |     +--ro isis-area-id*          isis-area-identifier
+                  |     +--ro dynamic-hostname?      string
+                  |     +--ro ipv4-router-id?        ipv4-router-identifier
+                  |     +--ro ipv6-router-id?        ipv6-router-identifier
+                  |     +--ro sr-capabilities
+                  |     |  +--ro mpls-ipv4?      boolean
+                  |     |  +--ro mpls-ipv6?      boolean
+                  |     |  +--ro sr-ipv6?        boolean
+                  |     |  +--ro range-size?     uint32
+                  |     |  +--ro (sid-label-index)?
+                  |     |     +--:(local-label-case)
+                  |     |     |  +--ro local-label?    netc:mpls-label
+                  |     |     +--:(ipv6-address-case)
+                  |     |     |  +--ro ipv6-address?   inet:ipv6-address
+                  |     |     +--:(sid-case)
+                  |     |        +--ro sid?            uint32
+                  |     +--ro sr-algorithm
+                  |        +--ro algorithms*   algorithm
+                  +--:(link-attributes-case)
+                  |  +--ro link-attributes
+                  |     +--ro local-ipv4-router-id?       ipv4-router-identifier
+                  |     +--ro local-ipv6-router-id?       ipv6-router-identifier
+                  |     +--ro remote-ipv4-router-id?      ipv4-router-identifier
+                  |     +--ro remote-ipv6-router-id?      ipv6-router-identifier
+                  |     +--ro mpls-protocol?              mpls-protocol-mask
+                  |     +--ro te-metric?                  netc:te-metric
+                  |     +--ro metric?                     netc:metric
+                  |     +--ro shared-risk-link-groups*    rsvp:srlg-id
+                  |     +--ro link-name?                  string
+                  |     +--ro max-link-bandwidth?         netc:bandwidth
+                  |     +--ro max-reservable-bandwidth?   netc:bandwidth
+                  |     +--ro unreserved-bandwidth* [priority]
+                  |     |  +--ro priority     uint8
+                  |     |  +--ro bandwidth?   netc:bandwidth
+                  |     +--ro link-protection?            link-protection-type
+                  |     +--ro admin-group?                administrative-group
+                  |     +--ro sr-adj-ids*
+                  |     |  +--ro (flags)?
+                  |     |  |  +--:(ospf-adj-flags-case)
+                  |     |  |  |  +--ro backup?           boolean
+                  |     |  |  |  +--ro set?              boolean
+                  |     |  |  +--:(isis-adj-flags-case)
+                  |     |  |     +--ro backup?           boolean
+                  |     |  |     +--ro set?              boolean
+                  |     |  |     +--ro address-family?   boolean
+                  |     |  +--ro weight?           weight
+                  |     |  +--ro (sid-label-index)?
+                  |     |     +--:(local-label-case)
+                  |     |     |  +--ro local-label?      netc:mpls-label
+                  |     |     +--:(ipv6-address-case)
+                  |     |     |  +--ro ipv6-address?     inet:ipv6-address
+                  |     |     +--:(sid-case)
+                  |     |        +--ro sid?              uint32
+                  |     +--ro sr-lan-adj-ids*
+                  |     |  +--ro (flags)?
+                  |     |  |  +--:(ospf-adj-flags-case)
+                  |     |  |  |  +--ro backup?           boolean
+                  |     |  |  |  +--ro set?              boolean
+                  |     |  |  +--:(isis-adj-flags-case)
+                  |     |  |     +--ro backup?           boolean
+                  |     |  |     +--ro set?              boolean
+                  |     |  |     +--ro address-family?   boolean
+                  |     |  +--ro weight?           weight
+                  |     |  +--ro iso-system-id?    netc:iso-system-identifier
+                  |     |  +--ro neighbor-id?      inet:ipv4-address
+                  |     |  +--ro (sid-label-index)?
+                  |     |     +--:(local-label-case)
+                  |     |     |  +--ro local-label?      netc:mpls-label
+                  |     |     +--:(ipv6-address-case)
+                  |     |     |  +--ro ipv6-address?     inet:ipv6-address
+                  |     |     +--:(sid-case)
+                  |     |        +--ro sid?              uint32
+                  |     +--ro peer-node-sid
+                  |     |  +--ro weight?         weight
+                  |     |  +--ro (sid-label-index)?
+                  |     |     +--:(local-label-case)
+                  |     |     |  +--ro local-label?    netc:mpls-label
+                  |     |     +--:(ipv6-address-case)
+                  |     |     |  +--ro ipv6-address?   inet:ipv6-address
+                  |     |     +--:(sid-case)
+                  |     |        +--ro sid?            uint32
+                  |     +--ro peer-adj-sid
+                  |     |  +--ro weight?         weight
+                  |     |  +--ro (sid-label-index)?
+                  |     |     +--:(local-label-case)
+                  |     |     |  +--ro local-label?    netc:mpls-label
+                  |     |     +--:(ipv6-address-case)
+                  |     |     |  +--ro ipv6-address?   inet:ipv6-address
+                  |     |     +--:(sid-case)
+                  |     |        +--ro sid?            uint32
+                  |     +--ro peer-set-sids*
+                  |        +--ro weight?         weight
+                  |        +--ro (sid-label-index)?
+                  |           +--:(local-label-case)
+                  |           |  +--ro local-label?    netc:mpls-label
+                  |           +--:(ipv6-address-case)
+                  |           |  +--ro ipv6-address?   inet:ipv6-address
+                  |           +--:(sid-case)
+                  |              +--ro sid?            uint32
+                  +--:(prefix-attributes-case)
+                  |  +--ro prefix-attributes
+                  |     +--ro igp-bits
+                  |     |  x--ro up-down?               bits
+                  |     |  +--ro is-is-up-down?         boolean
+                  |     |  +--ro ospf-no-unicast?       boolean
+                  |     |  +--ro ospf-local-address?    boolean
+                  |     |  +--ro ospf-propagate-nssa?   boolean
+                  |     +--ro route-tags*                route-tag
+                  |     +--ro extended-tags*             extended-route-tag
+                  |     +--ro prefix-metric?             netc:igp-metric
+                  |     +--ro ospf-forwarding-address?   inet:ip-address
+                  |     +--ro sr-prefix
+                  |     |  +--ro (flags)?
+                  |     |  |  +--:(isis-prefix-flags-case)
+                  |     |  |  |  +--ro no-php?            boolean
+                  |     |  |  |  +--ro explicit-null?     boolean
+                  |     |  |  |  +--ro readvertisement?   boolean
+                  |     |  |  |  +--ro node-sid?          boolean
+                  |     |  |  +--:(ospf-prefix-flags-case)
+                  |     |  |     +--ro no-php?            boolean
+                  |     |  |     +--ro explicit-null?     boolean
+                  |     |  |     +--ro mapping-server?    boolean
+                  |     |  +--ro algorithm?         algorithm
+                  |     |  +--ro (sid-label-index)?
+                  |     |     +--:(local-label-case)
+                  |     |     |  +--ro local-label?       netc:mpls-label
+                  |     |     +--:(ipv6-address-case)
+                  |     |     |  +--ro ipv6-address?      inet:ipv6-address
+                  |     |     +--:(sid-case)
+                  |     |        +--ro sid?               uint32
+                  |     +--ro ipv6-sr-prefix
+                  |     |  +--ro algorithm?   algorithm
+                  |     +--ro sr-range
+                  |     |  +--ro inter-area?   boolean
+                  |     |  +--ro range-size?   uint16
+                  |     |  +--ro sub-tlvs*
+                  |     |     +--ro (range-sub-tlv)?
+                  |     |        +--:(binding-sid-tlv-case)
+                  |     |        |  +--ro weight?                weight
+                  |     |        |  +--ro (flags)?
+                  |     |        |  |  +--:(isis-binding-flags-case)
+                  |     |        |  |  |  +--ro address-family?        boolean
+                  |     |        |  |  |  +--ro mirror-context?        boolean
+                  |     |        |  |  |  +--ro spread-tlv?            boolean
+                  |     |        |  |  |  +--ro leaked-from-level-2?   boolean
+                  |     |        |  |  |  +--ro attached-flag?         boolean
+                  |     |        |  |  +--:(ospf-binding-flags-case)
+                  |     |        |  |     +--ro mirroring?             boolean
+                  |     |        |  +--ro binding-sub-tlvs*
+                  |     |        |     +--ro (binding-sub-tlv)?
+                  |     |        |        +--:(prefix-sid-case)
+                  |     |        |        |  +--ro (flags)?
+                  |     |        |        |  |  +--:(isis-prefix-flags-case)
+                  |     |        |        |  |  |  +--ro no-php?            boolean
+                  |     |        |        |  |  |  +--ro explicit-null?     boolean
+                  |     |        |        |  |  |  +--ro readvertisement?   boolean
+                  |     |        |        |  |  |  +--ro node-sid?          boolean
+                  |     |        |        |  |  +--:(ospf-prefix-flags-case)
+                  |     |        |        |  |     +--ro no-php?            boolean
+                  |     |        |        |  |     +--ro explicit-null?     boolean
+                  |     |        |        |  |     +--ro mapping-server?    boolean
+                  |     |        |        |  +--ro algorithm?         algorithm
+                  |     |        |        |  +--ro (sid-label-index)?
+                  |     |        |        |     +--:(local-label-case)
+                  |     |        |        |     |  +--ro local-label?       netc:mpls-label
+                  |     |        |        |     +--:(ipv6-address-case)
+                  |     |        |        |     |  +--ro ipv6-address?      inet:ipv6-address
+                  |     |        |        |     +--:(sid-case)
+                  |     |        |        |        +--ro sid?               uint32
+                  |     |        |        +--:(ipv6-prefix-sid-case)
+                  |     |        |        |  +--ro algorithm?         algorithm
+                  |     |        |        +--:(sid-label-case)
+                  |     |        |        |  +--ro (sid-label-index)?
+                  |     |        |        |     +--:(local-label-case)
+                  |     |        |        |     |  +--ro local-label?       netc:mpls-label
+                  |     |        |        |     +--:(ipv6-address-case)
+                  |     |        |        |     |  +--ro ipv6-address?      inet:ipv6-address
+                  |     |        |        |     +--:(sid-case)
+                  |     |        |        |        +--ro sid?               uint32
+                  |     |        |        +--:(ero-metric-case)
+                  |     |        |        |  +--ro ero-metric?        netc:te-metric
+                  |     |        |        +--:(ipv4-ero-case)
+                  |     |        |        |  +--ro loose?             boolean
+                  |     |        |        |  +--ro address            inet:ipv4-address
+                  |     |        |        +--:(ipv6-ero-case)
+                  |     |        |        |  +--ro loose?             boolean
+                  |     |        |        |  +--ro address            inet:ipv6-address
+                  |     |        |        +--:(unnumbered-interface-id-ero-case)
+                  |     |        |        |  +--ro loose?             boolean
+                  |     |        |        |  +--ro router-id?         uint32
+                  |     |        |        |  +--ro interface-id?      uint32
+                  |     |        |        +--:(ipv4-ero-backup-case)
+                  |     |        |        |  +--ro loose?             boolean
+                  |     |        |        |  +--ro address            inet:ipv4-address
+                  |     |        |        +--:(ipv6-ero-backup-case)
+                  |     |        |        |  +--ro loose?             boolean
+                  |     |        |        |  +--ro address            inet:ipv6-address
+                  |     |        |        +--:(unnumbered-interface-id-backup-ero-case)
+                  |     |        |           +--ro loose?             boolean
+                  |     |        |           +--ro router-id?         uint32
+                  |     |        |           +--ro interface-id?      uint32
+                  |     |        +--:(prefix-sid-tlv-case)
+                  |     |        |  +--ro (flags)?
+                  |     |        |  |  +--:(isis-prefix-flags-case)
+                  |     |        |  |  |  +--ro no-php?                boolean
+                  |     |        |  |  |  +--ro explicit-null?         boolean
+                  |     |        |  |  |  +--ro readvertisement?       boolean
+                  |     |        |  |  |  +--ro node-sid?              boolean
+                  |     |        |  |  +--:(ospf-prefix-flags-case)
+                  |     |        |  |     +--ro no-php?                boolean
+                  |     |        |  |     +--ro explicit-null?         boolean
+                  |     |        |  |     +--ro mapping-server?        boolean
+                  |     |        |  +--ro algorithm?             algorithm
+                  |     |        |  +--ro (sid-label-index)?
+                  |     |        |     +--:(local-label-case)
+                  |     |        |     |  +--ro local-label?           netc:mpls-label
+                  |     |        |     +--:(ipv6-address-case)
+                  |     |        |     |  +--ro ipv6-address?          inet:ipv6-address
+                  |     |        |     +--:(sid-case)
+                  |     |        |        +--ro sid?                   uint32
+                  |     |        +--:(ipv6-prefix-sid-tlv-case)
+                  |     |        |  +--ro algorithm?             algorithm
+                  |     |        +--:(sid-label-tlv-case)
+                  |     |           +--ro (sid-label-index)?
+                  |     |              +--:(local-label-case)
+                  |     |              |  +--ro local-label?           netc:mpls-label
+                  |     |              +--:(ipv6-address-case)
+                  |     |              |  +--ro ipv6-address?          inet:ipv6-address
+                  |     |              +--:(sid-case)
+                  |     |                 +--ro sid?                   uint32
+                  |     +--ro sr-binding-sid-labels*
+                  |        +--ro weight?                weight
+                  |        +--ro (flags)?
+                  |        |  +--:(isis-binding-flags-case)
+                  |        |  |  +--ro address-family?        boolean
+                  |        |  |  +--ro mirror-context?        boolean
+                  |        |  |  +--ro spread-tlv?            boolean
+                  |        |  |  +--ro leaked-from-level-2?   boolean
+                  |        |  |  +--ro attached-flag?         boolean
+                  |        |  +--:(ospf-binding-flags-case)
+                  |        |     +--ro mirroring?             boolean
+                  |        +--ro binding-sub-tlvs*
+                  |           +--ro (binding-sub-tlv)?
+                  |              +--:(prefix-sid-case)
+                  |              |  +--ro (flags)?
+                  |              |  |  +--:(isis-prefix-flags-case)
+                  |              |  |  |  +--ro no-php?            boolean
+                  |              |  |  |  +--ro explicit-null?     boolean
+                  |              |  |  |  +--ro readvertisement?   boolean
+                  |              |  |  |  +--ro node-sid?          boolean
+                  |              |  |  +--:(ospf-prefix-flags-case)
+                  |              |  |     +--ro no-php?            boolean
+                  |              |  |     +--ro explicit-null?     boolean
+                  |              |  |     +--ro mapping-server?    boolean
+                  |              |  +--ro algorithm?         algorithm
+                  |              |  +--ro (sid-label-index)?
+                  |              |     +--:(local-label-case)
+                  |              |     |  +--ro local-label?       netc:mpls-label
+                  |              |     +--:(ipv6-address-case)
+                  |              |     |  +--ro ipv6-address?      inet:ipv6-address
+                  |              |     +--:(sid-case)
+                  |              |        +--ro sid?               uint32
+                  |              +--:(ipv6-prefix-sid-case)
+                  |              |  +--ro algorithm?         algorithm
+                  |              +--:(sid-label-case)
+                  |              |  +--ro (sid-label-index)?
+                  |              |     +--:(local-label-case)
+                  |              |     |  +--ro local-label?       netc:mpls-label
+                  |              |     +--:(ipv6-address-case)
+                  |              |     |  +--ro ipv6-address?      inet:ipv6-address
+                  |              |     +--:(sid-case)
+                  |              |        +--ro sid?               uint32
+                  |              +--:(ero-metric-case)
+                  |              |  +--ro ero-metric?        netc:te-metric
+                  |              +--:(ipv4-ero-case)
+                  |              |  +--ro loose?             boolean
+                  |              |  +--ro address            inet:ipv4-address
+                  |              +--:(ipv6-ero-case)
+                  |              |  +--ro loose?             boolean
+                  |              |  +--ro address            inet:ipv6-address
+                  |              +--:(unnumbered-interface-id-ero-case)
+                  |              |  +--ro loose?             boolean
+                  |              |  +--ro router-id?         uint32
+                  |              |  +--ro interface-id?      uint32
+                  |              +--:(ipv4-ero-backup-case)
+                  |              |  +--ro loose?             boolean
+                  |              |  +--ro address            inet:ipv4-address
+                  |              +--:(ipv6-ero-backup-case)
+                  |              |  +--ro loose?             boolean
+                  |              |  +--ro address            inet:ipv6-address
+                  |              +--:(unnumbered-interface-id-backup-ero-case)
+                  |                 +--ro loose?             boolean
+                  |                 +--ro router-id?         uint32
+                  |                 +--ro interface-id?      uint32
+                  x--:(te-lsp-attributes-case)
+                     +--ro te-lsp-attributes
+
+
+Usage
+^^^^^
+The Link-State table in a instance of the speaker's Loc-RIB can be verified via REST:
+
+**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``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <linkstate-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-linkstate">
+      ...
+   </linkstate-routes>
+
+.. note:: Link-State routes mapping to topology links/nodes/prefixes is supported by BGP Topology Provider.
+
+References
+^^^^^^^^^^
+* `North-Bound Distribution of Link-State and Traffic Engineering (TE) Information Using BGP <https://tools.ietf.org/html/rfc7752>`_
+* `BGP Link-State extensions for Segment Routing <https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-03>`_
+* `Segment Routing BGP Egress Peer Engineering BGP-LS Extensions <https://tools.ietf.org/html/draft-ietf-idr-bgpls-segment-routing-epe-05>`_
+* `BGP Link-State Information Distribution Implementation Report <https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-impl-04>`_
diff --git a/docs/bgp/bgp-user-guide-mvpn-family.rst b/docs/bgp/bgp-user-guide-mvpn-family.rst
new file mode 100644 (file)
index 0000000..1daa850
--- /dev/null
@@ -0,0 +1,532 @@
+.. _bgp-user-guide-mvpn-family:
+
+MCAST-VPN Family
+================
+The BGP Multicast VPN(BGP MCAST-VPN) Multiprotocol extension can be used for MVPN auto-discovery, advertising MVPN to Inclusive P-Multicast Service
+Interface (I-PMSI) tunnel binding, advertising (C-S,C-G) to Selective PMSI (S-PMSI) tunnel binding, VPN customer multicast routing
+information exchange among Provider Edge routers (PEs), choosing a single forwarder PE, and for procedures in support of co-locating a
+Customer Rendezvous Point (C-RP) on a PE.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+This section shows a way to enable MCAST-VPN family in BGP speaker and peer configuration.
+
+BGP Speaker
+'''''''''''
+To enable MCAST-VPN support in BGP plugin, first configure BGP speaker instance:
+
+**URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <protocol xmlns="http://openconfig.net/yang/network-instance">
+       <name>bgp-example</name>
+       <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
+       <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+           <global>
+               <config>
+                   <router-id>192.0.2.2</router-id>
+                   <as>65000</as>
+               </config>
+               <afi-safis>
+                   <afi-safi>
+                       <afi-safi-name>IPV4-MCAST-VPN</afi-safi-name>
+                   </afi-safi>
+                   <afi-safi>
+                       <afi-safi-name>IPV6-MCAST-VPN</afi-safi-name>
+                   </afi-safi>
+               </afi-safis>
+           </global>
+       </bgp>
+   </protocol>
+
+BGP Peer
+''''''''
+Here is an example for BGP peer configuration with enabled IPV4 MCAST-VPN family.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.1</neighbor-address>
+       <afi-safis>
+           <afi-safi>
+               <afi-safi-name>IPV4-MCAST-VPN</afi-safi-name>
+           </afi-safi>
+       </afi-safis>
+   </neighbor>
+
+Ipv4 MCAST-VPN Route API
+^^^^^^^^^^^^^^^^^^^^^^^^
+Following tree illustrates the BGP MCAST-VPN route structure.
+
+.. code-block:: console
+
+   :(mvpn-routes-ipv4-case)
+      +--ro mvpn-routes-ipv4
+         +--ro mvpn-route* [route-key path-id]
+            +--ro (mvpn-choice)
+               +--:(intra-as-i-pmsi-a-d-case)
+               |  +--ro intra-as-i-pmsi-a-d
+               +--:(inter-as-i-pmsi-a-d-case)
+               |  +--ro inter-as-i-pmsi-a-d
+               |     +--ro source-as    inet:as-number
+               +--:(s-pmsi-a-d-case)
+               |  +--ro s-pmsi-a-d
+               |     +--ro multicast-source             inet:ip-address
+               |     +--ro (multicast-group)?
+               |        +--:(c-g-address-case)
+               |        |  +--ro c-g-address?           inet:ip-address
+               |        +--:(ldp-mp-opaque-value-case)
+               |           +--ro ldp-mp-opaque-value
+               |              +--ro opaque-type             uint8
+               |              +--ro opaque-extended-type?   uint16
+               |              +--ro opaque                  yang:hex-string
+               +--:(leaf-a-d-case)
+               |  +--ro leaf-a-d
+               |     +--ro (leaf-a-d-route-key)
+               |        +--:(inter-as-i-pmsi-a-d-case)
+               |        |  +--ro inter-as-i-pmsi-a-d
+               |        |     +--ro source-as    inet:as-number
+               |        +--:(s-pmsi-a-d-case)
+               |           +--ro s-pmsi-a-d
+               |              +--ro multicast-source             inet:ip-address
+               |              +--ro (multicast-group)?
+               |                 +--:(c-g-address-case)
+               |                 |  +--ro c-g-address?           inet:ip-address
+               |                 +--:(ldp-mp-opaque-value-case)
+               |                    +--ro ldp-mp-opaque-value
+               |                       +--ro opaque-type             uint8
+               |                       +--ro opaque-extended-type?   uint16
+               |                       +--ro opaque                  yang:hex-string
+               +--:(source-active-a-d-case)
+               |  +--ro source-active-a-d
+               |     +--ro multicast-source    inet:ip-address
+               |     +--ro multicast-group     inet:ip-address
+               +--:(shared-tree-join-case)
+               |  +--ro shared-tree-join
+               |     +--ro c-multicast
+               |        +--ro multicast-source             inet:ip-address
+               |        +--ro source-as                    inet:as-number
+               |        +--ro (multicast-group)?
+               |           +--:(c-g-address-case)
+               |           |  +--ro c-g-address?           inet:ip-address
+               |           +--:(ldp-mp-opaque-value-case)
+               |              +--ro ldp-mp-opaque-value
+               |                 +--ro opaque-type             uint8
+               |                 +--ro opaque-extended-type?   uint16
+               |                 +--ro opaque                  yang:hex-string
+               +--:(source-tree-join-case)
+                  +--ro source-tree-join
+                     +--ro c-multicast
+                        +--ro multicast-source             inet:ip-address
+                        +--ro source-as                    inet:as-number
+                        +--ro (multicast-group)?
+                           +--:(c-g-address-case)
+                           |  +--ro c-g-address?           inet:ip-address
+                           +--:(ldp-mp-opaque-value-case)
+                              +--ro ldp-mp-opaque-value
+                                 +--ro opaque-type             uint8
+                                 +--ro opaque-extended-type?   uint16
+                                 +--ro opaque                  yang:hex-string
+                     ...
+
+Ipv6 MCAST-VPN Route API
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Following tree illustrates the BGP MCAST-VPN route structure.
+
+.. code-block:: console
+
+   :(mvpn-routes-ipv6-case)
+      +--ro mvpn-routes-ipv6
+         +--ro mvpn-route* [route-key path-id]
+            +--ro (mvpn-choice)
+               +--:(intra-as-i-pmsi-a-d-case)
+               |  +--ro intra-as-i-pmsi-a-d
+               +--:(inter-as-i-pmsi-a-d-case)
+               |  +--ro inter-as-i-pmsi-a-d
+               |     +--ro source-as    inet:as-number
+               +--:(s-pmsi-a-d-case)
+               |  +--ro s-pmsi-a-d
+               |     +--ro multicast-source             inet:ip-address
+               |     +--ro (multicast-group)?
+               |        +--:(c-g-address-case)
+               |        |  +--ro c-g-address?           inet:ip-address
+               |        +--:(ldp-mp-opaque-value-case)
+               |           +--ro ldp-mp-opaque-value
+               |              +--ro opaque-type             uint8
+               |              +--ro opaque-extended-type?   uint16
+               |              +--ro opaque                  yang:hex-string
+               +--:(leaf-a-d-case)
+               |  +--ro leaf-a-d
+               |     +--ro (leaf-a-d-route-key)
+               |        +--:(inter-as-i-pmsi-a-d-case)
+               |        |  +--ro inter-as-i-pmsi-a-d
+               |        |     +--ro source-as    inet:as-number
+               |        +--:(s-pmsi-a-d-case)
+               |           +--ro s-pmsi-a-d
+               |              +--ro multicast-source             inet:ip-address
+               |              +--ro (multicast-group)?
+               |                 +--:(c-g-address-case)
+               |                 |  +--ro c-g-address?           inet:ip-address
+               |                 +--:(ldp-mp-opaque-value-case)
+               |                    +--ro ldp-mp-opaque-value
+               |                       +--ro opaque-type             uint8
+               |                       +--ro opaque-extended-type?   uint16
+               |                       +--ro opaque                  yang:hex-string
+               +--:(source-active-a-d-case)
+               |  +--ro source-active-a-d
+               |     +--ro multicast-source    inet:ip-address
+               |     +--ro multicast-group     inet:ip-address
+               +--:(shared-tree-join-case)
+               |  +--ro shared-tree-join
+               |     +--ro c-multicast
+               |        +--ro multicast-source             inet:ip-address
+               |        +--ro source-as                    inet:as-number
+               |        +--ro (multicast-group)?
+               |           +--:(c-g-address-case)
+               |           |  +--ro c-g-address?           inet:ip-address
+               |           +--:(ldp-mp-opaque-value-case)
+               |              +--ro ldp-mp-opaque-value
+               |                 +--ro opaque-type             uint8
+               |                 +--ro opaque-extended-type?   uint16
+               |                 +--ro opaque                  yang:hex-string
+               +--:(source-tree-join-case)
+                  +--ro source-tree-join
+                     +--ro c-multicast
+                        +--ro multicast-source             inet:ip-address
+                        +--ro source-as                    inet:as-number
+                        +--ro (multicast-group)?
+                           +--:(c-g-address-case)
+                           |  +--ro c-g-address?           inet:ip-address
+                           +--:(ldp-mp-opaque-value-case)
+                              +--ro ldp-mp-opaque-value
+                                 +--ro opaque-type             uint8
+                                 +--ro opaque-extended-type?   uint16
+                                 +--ro opaque                  yang:hex-string
+                     ...
+
+Usage
+^^^^^
+The Ipv4 Multicast VPN table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-mvpn:mcast-vpn-subsequent-address-family/bgp-mvpn-ipv4:mvpn-routes``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <mvpn-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp:mvpn:ipv4">
+      <mvpn-route>
+         <route-key>flow1</route-key>
+         <path-id>0</path-id>
+         <intra-as-i-pmsi-a-d>
+            <route-distinguisher>172.16.0.44:101</route-distinguisher>
+            <orig-route-ip>192.168.100.1</orig-route-ip>
+         </intra-as-i-pmsi-a-d>
+         <attributes>
+            <ipv4-next-hop>
+               <global>199.20.166.41</global>
+            </ipv4-next-hop>
+            <as-path/>
+            <origin>
+               <value>igp</value>
+            </origin>
+         </attributes>
+      </mvpn-route>
+   </mvpn-routes>
+
+The Ipv6 Multicast VPN table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-mvpn:mcast-vpn-subsequent-address-family/bgp-mvpn-ipv6:mvpn-routes``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <mvpn-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp:mvpn:ipv6">
+      <mvpn-route>
+         <route-key>flow1</route-key>
+         <path-id>0</path-id>
+         <intra-as-i-pmsi-a-d>
+            <route-distinguisher>172.16.0.44:101</route-distinguisher>
+            <orig-route-ip>192.168.100.1</orig-route-ip>
+         </intra-as-i-pmsi-a-d>
+         <attributes>
+            <ipv6-next-hop>
+               <global>2001:db8:1::6</global>
+            </ipv6-next-hop>
+            <as-path/>
+            <origin>
+               <value>igp</value>
+            </origin>
+         </attributes>
+      </mvpn-route>
+   </mvpn-routes>
+
+Programming
+^^^^^^^^^^^
+These examples show how to originate and remove MCAST-VPN routes via programmable RIB.
+There are seven different types of MCAST-VPN routes, and multiples extended communities.
+Routes can be used for variety of use-cases supported by BGP/MPLS MCAST-VPN.
+Make sure the *Application Peer* is configured first.
+
+**URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-mvpn:mcast-vpn-subsequent-address-family/bgp-mvpn-ipv4:mvpn-routes``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 4,17
+
+   <mvpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp:mvpn:ipv4">
+      <route-key>mvpn</route-key>
+      <path-id>0</path-id>
+      <intra-as-i-pmsi-a-d>
+         <route-distinguisher>172.16.0.44:101</route-distinguisher>
+         <orig-route-ip>192.168.100.1</orig-route-ip>
+      </intra-as-i-pmsi-a-d>
+       ....
+       <attributes>
+           <ipv4-next-hop>
+               <global>199.20.166.41</global>
+           </ipv4-next-hop>
+           <as-path/>
+           <origin>
+               <value>igp</value>
+           </origin>
+           <extended-communities>
+           ....
+           </extended-communities>
+       </attributes>
+   </mvpn-route>
+
+@line 4: One of the MCAST-VPN route must be set here.
+
+@line 15: In some cases, specific extended community presence is required.
+
+-----
+
+**MVPN Routes:**
+
+* **Intra-AS I-PMSI A-D**
+   .. code-block:: xml
+
+    <intra-as-i-pmsi-a-d>
+        <route-distinguisher>0:5:3</route-distinguisher>
+        <orig-route-ip>10.10.10.10</orig-route-ip>
+    </intra-as-i-pmsi-a-d>
+
+* **Inter-AS I-PMSI A-D**
+   .. code-block:: xml
+
+    <inter-as-i-pmsi-a-d>
+        <route-distinguisher>1.2.3.4:258</route-distinguisher>
+        <source-as>64496</source-as>
+    </inter-as-i-pmsi-a-d>
+
+* **S-PMSI A-D**
+   .. code-block:: xml
+
+    <s-pmsi-a-d>
+        <route-distinguisher>1.2.3.4:258</route-distinguisher>
+        <multicast-source>10.0.0.10</multicast-source>
+        <c-g-address>12.0.0.12</c-g-address>
+        <orig-route-ip>1.0.0.1</orig-route-ip>
+    </s-pmsi-a-d>
+
+   .. code-block:: xml
+
+    <s-pmsi-a-d>
+        <route-distinguisher>1.2.3.4:258</route-distinguisher>
+        <multicast-source>10.0.0.10</multicast-source>
+        <ldp-mp-opaque-value>
+            <opaque-type>1</opaque-type>
+            <opaque-extended-type>0</opaque-extended-type>
+            <opaque>das75das48bvxc</opaque>
+        </ldp-mp-opaque-value>
+        <orig-route-ip>1.0.0.1</orig-route-ip>
+    </s-pmsi-a-d>
+
+* **Leaf A-D**
+   .. code-block:: xml
+
+    <leaf-a-d>
+        <inter-as-i-pmsi-a-d>
+            <route-distinguisher>1.2.3.4:258</route-distinguisher>
+            <source-as>1</source-as>
+        </inter-as-i-pmsi-a-d>
+        <orig-route-ip>1.0.0.1</orig-route-ip>
+    </leaf-a-d>
+
+   .. code-block:: xml
+
+    <leaf-a-d>
+        <s-pmsi-a-d>
+            <route-distinguisher>1.2.3.4:258</route-distinguisher>
+            <multicast-source>10.0.0.10</multicast-source>
+            <ldp-mp-opaque-value>
+                <opaque-type>1</opaque-type>
+                <opaque-extended-type>0</opaque-extended-type>
+                <opaque>das75das48bvxc</opaque>
+            </ldp-mp-opaque-value>
+            <orig-route-ip>1.0.0.1</orig-route-ip>
+        </s-pmsi-a-d>
+        <orig-route-ip>1.0.0.1</orig-route-ip>
+    </leaf-a-d>
+
+* **Source Active A-D**
+   .. code-block:: xml
+
+    <source-active-a-d>
+        <route-distinguisher>1.2.3.4:258</route-distinguisher>
+        <multicast-source>1.0.0.1</multicast-source>
+        <multicast-group>2.0.0.2</multicast-group>
+    </source-active-a-d>
+
+* **Shared Tree Join**
+   .. code-block:: xml
+
+    <shared-tree-join>
+        <c-multicast>
+            <route-distinguisher>1.2.3.4:258</route-distinguisher>
+            <source-as>64415</source-as>
+            <multicast-source>1.0.0.1</multicast-source>
+            <c-g-address>2.0.0.2</c-g-address>
+        </c-multicast>
+    </shared-tree-join>
+
+   .. code-block:: xml
+
+    <shared-tree-join>
+        <c-multicast>
+            <route-distinguisher>1.2.3.4:258</route-distinguisher>
+            <source-as>64415</source-as>
+            <multicast-source>1.0.0.1</multicast-source>
+            <ldp-mp-opaque-value>
+                <opaque-type>1</opaque-type>
+                <opaque-extended-type>0</opaque-extended-type>
+                <opaque>das75das48bvxc</opaque>
+            </ldp-mp-opaque-value>
+        </c-multicast>
+    </shared-tree-join>
+
+* **Source Tree Join**
+   .. code-block:: xml
+
+    <source-tree-join>
+        <c-multicast>
+            <route-distinguisher>1.2.3.4:258</route-distinguisher>
+            <source-as>64415</source-as>
+            <multicast-source>1.0.0.1</multicast-source>
+            <c-g-address>2.0.0.2</c-g-address>
+        </c-multicast>
+    </source-tree-join>
+
+   .. code-block:: xml
+
+    <source-tree-join>
+        <c-multicast>
+            <route-distinguisher>1.2.3.4:258</route-distinguisher>
+            <source-as>64415</source-as>
+            <multicast-source>1.0.0.1</multicast-source>
+            <ldp-mp-opaque-value>
+                <opaque-type>1</opaque-type>
+                <opaque-extended-type>0</opaque-extended-type>
+                <opaque>das75das48bvxc</opaque>
+            </ldp-mp-opaque-value>
+        </c-multicast>
+    </source-tree-join>
+
+**Attributes:**
+
+.. include:: bgp-user-guide-pmsi-attribute.rst
+
+* **PE Distinguisher Labels Attribute**
+   .. code-block:: xml
+
+      <pe-distinguisher-labels-attribute>
+          <pe-distinguisher-label-attribute>
+              <pe-address>10.10.10.1</pe-address>
+              <mpls-label>20024</mpls-label>
+          </pe-distinguisher-label-attribute>
+          <pe-distinguisher-label-attribute>
+              <pe-address>10.10.20.2</pe-address>
+              <mpls-label>20028</mpls-label>
+          </pe-distinguisher-label-attribute>
+      </pe-distinguisher-labels-attribute>
+
+**Extended Communities:**
+
+* **Source AS Extended Community**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <source-as-extended-community>
+              <global-administrator>65</global-administrator>
+          </source-as-extended-community>
+      </extended-communities>
+
+* **Source AS 4 Octets Extended Community**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <source-as-4-extended-community>
+              <global-administrator>65555</global-administrator>
+          </source-as-4-extended-community>
+      </extended-communities>
+
+* **ES-Import Route Target**
+   .. code-block:: xml
+
+      <extended-communities>
+          <transitive>true</transitive>
+          <vrf-route-import-extended-community>
+              <inet4-specific-extended-community-common>
+                  <global-administrator>10.0.0.1</global-administrator>
+                  <local-administrator>123=</local-administrator>
+               </inet4-specific-extended-community-common>
+           </vrf-route-import-extended-community>
+      </extended-communities>
+
+-----
+
+To remove the route added above, following request can be used:
+
+**URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-mvpn:mcast-vpn-subsequent-address-family/bgp-mvpn-ipv4:mvpn-routes/mvpn-route/mvpn/0``
+
+**Method:** ``DELETE``
+
+References
+^^^^^^^^^^
+* `Multicast in MPLS/BGP IP VPNs <https://tools.ietf.org/html/rfc6513>`_
+* `BGP Encodings and Procedures for Multicast in MPLS/BGP IP VPNs <https://tools.ietf.org/html/rfc6514>`_
+* `IPv4 and IPv6 Infrastructure Addresses in BGP Updates for Multicast VPN <https://tools.ietf.org/html/rfc6515>`_
diff --git a/docs/bgp/bgp-user-guide-operational-state.rst b/docs/bgp/bgp-user-guide-operational-state.rst
new file mode 100644 (file)
index 0000000..2c0d96d
--- /dev/null
@@ -0,0 +1,446 @@
+.. _bgp-user-guide-operational-state:
+
+Operational State
+=================
+
+The OpenDaylight BGP implementation provides a set of APIs (described below), that give its operational state refreshed periodically, by default every 5 seconds.
+The following APIs describe what is available starting with how to change the default refresh rate.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Operational State Configuration
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+**URL:** ``/restconf/config/bgp-state-config:bgp-state-config``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+   <bgp-state-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+       <config-name xmlns="urn:opendaylight:params:xml:ns:yang:bgp-state-config">operationalState</config-name>
+       <timer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-state-config">1</timer>
+   </bgp-state-config>
+
+@line 3: Time in seconds between operational state update.
+
+BGP RIB Operational State
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+**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``
+
+**Method:** ``GET``
+
+**Content-Type:** ``application/xml``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+
+   <state xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <as>65000</as>
+       <router-id>192.0.2.2</router-id>
+       <total-paths>0</total-paths>
+       <total-prefixes>0</total-prefixes>
+   </state>
+
+@line 2: AS number of the remote peer.
+
+@line 3: The unique protocol instance identifier.
+
+@line 4: Total number of Paths installed on RIB (Loc-RIB)
+
+@line 5: Total number of Prefixes installed on RIB (Loc-RIB)
+
+BGP RIB Families Operational State
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+**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``
+
+**Method:** ``GET``
+
+**Content-Type:** ``application/xml``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5,6
+
+   <afi-safis xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <afi-safi>
+           <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
+           <state>
+               <total-paths>0</total-paths>
+               <total-prefixes>0</total-prefixes>
+           </state>
+       </afi-safi>
+       <afi-safi>
+           <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
+           <state>
+               <total-paths>0</total-paths>
+               <total-prefixes>0</total-prefixes>
+           </state>
+       </afi-safi>
+       ....
+   </afi-safis>
+
+@line 3: Family Identifier.
+
+@line 5: Total number of Paths installed on RIB (Loc-RIB) per specific family.
+
+@line 6: Total number of Prefixes installed on RIB (Loc-RIB) per specific family.
+
+BGP Neighbors Operational State
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+**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``
+
+**Method:** ``GET``
+
+**Content-Type:** ``application/xml``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+   <neighbors xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor>
+           <neighbor-address>192.0.2.1</neighbor-address>
+           .....
+       </neighbor>
+       <neighbor>
+           <neighbor-address>192.0.2.2</neighbor-address>
+           .....
+       </neighbor>
+   </neighbors>
+
+@line 3: IP address of the remote BGP peer. Also serves as an unique identifier of a neighbor in a list of neighbors.
+
+BGP Neighbor Operational State
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. note:: Supported Capabilities only provided when session has been established.
+
+**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/127.0.0.2/state``
+
+**Method:** ``GET``
+
+**Content-Type:** ``application/xml``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,3,4,7,8,11,12
+
+   <state xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <session-state>ESTABLISHED</session-state>
+       <supported-capabilities xmlns:x="http://openconfig.net/yang/bgp-types">x:ASN32</supported-capabilities>
+       <supported-capabilities xmlns:x="http://openconfig.net/yang/bgp-types">x:MPBGP</supported-capabilities>
+       <messages>
+           <sent>
+               <UPDATE>0</UPDATE>
+               <NOTIFICATION>0</NOTIFICATION>
+           </sent>
+           <received>
+               <UPDATE>4</UPDATE>
+               <NOTIFICATION>0</NOTIFICATION>
+           </received>
+       </messages>
+   </state>
+
+@line 2: Session status
+
+@line 3-4: BGP capabilities supported ( ASN32 / MPBGP / ROUTE_REFRESH / GRACEFUL_RESTART / ADD_PATHS)
+
+@line 7: Total count of Update Messages sent
+
+@line 8: Total count of Notification Messages sent
+
+@line 11: Total count of Update Messages received
+
+@line 12: Total count of Notification Messages received
+
+BGP Neighbor Families Operational State
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. note:: Graceful Restart not supported yet. Planned for Carbon.
+
+
+**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``
+
+**Method:** ``GET``
+
+**Content-Type:** ``application/xml``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5,7,9,10
+
+   <afi-safis xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+        <afi-safi>
+            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
+            <state>
+                <active>false</active>
+            </state>
+            <graceful-restart>
+                <state>
+                    <received>false</received>
+                    <advertised>false</advertised>
+                </state>
+            </graceful-restart>
+        </afi-safi>
+        <afi-safi>
+            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
+            <state>
+                <active>false</active>
+            </state>
+            <graceful-restart>
+                <state>
+                    <received>false</received>
+                    <advertised>false</advertised>
+                </state>
+            </graceful-restart>
+        </afi-safi>
+   </afi-safis>
+
+@line 3: Family Identifier.
+
+@line 5: True if family is advertized by peer.
+
+@line 7: Graceful Restart Operational State per specific family.
+
+@line 9: True if the peer supports graceful restart.
+
+@line 10: True if we support graceful restart.
+
+BGP Neighbor Family Operational State
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. note:: Prefixes state is only provided once session is established.
+.. note:: Graceful Restart not supported yet. Planned to be implemented in Carbon.
+
+**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``
+
+**Method:** ``GET``
+
+**Content-Type:** ``application/xml``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,4,6,7,8
+
+   <afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
+       <state>
+           <active>true</active>
+           <prefixes>
+               <installed>3</installed>
+               <sent>0</sent>
+               <received>3</received>
+           </prefixes>
+       </state>
+       <graceful-restart>
+           <state>
+               <received>false</received>
+               <advertised>false</advertised>
+           </state>
+       </graceful-restart>
+   </afi-safi>
+
+@line 2: Family Identifier.
+
+@line 4: True if family is advertized to and by peer.
+
+@line 6: Total count of prefixes advertized by peer and installed (effective-rib-in).
+
+@line 7: Total count of prefixes advertized to peer (adj-rib-out).
+
+@line 8: Total count of prefixes advertized by peer (adj-rib-in).
+
+BGP Neighbor Timers Operational State
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. note:: State is only provided once session is established.
+
+**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``
+
+**Method:** ``GET``
+
+**Content-Type:** ``application/xml``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,4
+
+   <timers xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <state>
+           <negotiated-hold-time>180</negotiated-hold-time>
+           <uptime>1580676</uptime>
+       </state>
+   </timers>
+
+@line 3: The negotiated hold-time for the BGP session in seconds.
+
+@line 4: Session duration since establishment in milliseconds.
+
+BGP Neighbor Transport Operational State
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. note:: State is only provided once session is established.
+
+**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``
+
+**Method:** ``GET``
+
+**Content-Type:** ``application/xml``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,4,5
+
+   <transport xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <state>
+           <remote-address>127.0.0.2</remote-address>
+           <remote-port>44718</remote-port>
+           <local-port>1790</local-port>
+       </state>
+   </transport>
+
+@line 3: IP address of the remote BGP peer.
+
+@line 4: Port of the remote BGP peer.
+
+@line 5: Local port.
+
+BGP Neighbor Error Handling Operational State
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. note:: State is only provided once session is established.
+.. note:: Error handling not supported yet. Planned for Carbon.
+
+**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``
+
+**Method:** ``GET``
+
+**Content-Type:** ``application/xml``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+   <error-handling xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <state>
+           <erroneous-update-messages>0</erroneous-update-messages>
+       </state>
+   </error-handling>
+
+@line 3: The number of BGP UPDATE messages for which the treat-as-withdraw mechanism has been applied based on
+erroneous message contents
+
+BGP Neighbor Graceful Restart Operational State
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. note:: Graceful Restart not supported yet. Planned for Carbon.
+
+**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``
+
+**Method:** ``GET``
+
+**Content-Type:** ``application/xml``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,4,5
+
+   <graceful-restart xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <state>
+           <peer-restart-time>0</peer-restart-time>
+           <peer-restarting>false</peer-restarting>
+           <local-restarting>false</local-restarting>
+       </state>
+   </graceful-restart>
+
+@line 3: The period of time (advertised by the peer) that the peer expects a restart of a BGP session to take.
+
+@line 4: This flag indicates whether the remote neighbor is currently in the process of restarting, and hence
+received routes are currently stale.
+
+@line 5: This flag indicates whether the local neighbor is currently restarting. The flag is unset after all NLRI
+have been advertised to the peer, and the End-of-RIB (EOR) marker has been unset.
+
+BGP Peer Groups Operational State
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+**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``
+
+**Method:** ``GET``
+
+**Content-Type:** ``application/xml``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5,6
+
+   <peer-groups>
+       <peer-group>
+           <peer-group-name>application-peers</peer-group-name>
+           <state>
+               <total-paths>0</total-paths>
+               <total-prefixes>0</total-prefixes>
+           </state>
+       </peer-group>
+   </peer-groups>
+
+@line 3: Peer Group Identifier.
+
+@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.
+
+@line 6: Total Prefixes installed under by peers pertaining to this peer group (effective-rib-in).
+This count doesn't differentiate repeated prefixes.
+
+CLI
+---
+
+BGP Karaf Console (odl-bgpcep-bgp-cli) provides a CLI feature to read operational state per RIB, Neighbor and Peer Group.
+
+.. code-block:: bash
+   :linenos:
+
+   opendaylight-user@root> bgp:operational-state -rib example-bgp-rib
+
+.. code-block:: bash
+   :linenos:
+
+   opendaylight-user@root> bgp:operational-state -rib example-bgp-rib -neighbor 192.0.2.1
+
+.. code-block:: bash
+   :linenos:
+
+   opendaylight-user@root> bgp:operational-state -rib -peer-group application-peers
diff --git a/docs/bgp/bgp-user-guide-overview.rst b/docs/bgp/bgp-user-guide-overview.rst
new file mode 100644 (file)
index 0000000..32021e0
--- /dev/null
@@ -0,0 +1,51 @@
+.. _bgp-user-guide-overview:
+
+Overview
+========
+This section provides high-level overview of the Border Gateway Protocol, OpenDaylight implementation and BGP usage in SDN era.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Border Gateway Protocol
+^^^^^^^^^^^^^^^^^^^^^^^
+The Border Gateway Protocol (BGP) is an inter-Autonomous System (AS) routing protocol.
+The primary role of the BGP is an exchange of routes among other BGP systems.
+The route is an unit of information which pairs destination (IP address prefix) with attributes to the path with the destination.
+One of the most interesting attributes is a list of ASes that the route traversed - essential when avoiding loop routing.
+Advertised routes are stored in the Routing Information Bases (RIBs). Routes are later used to forward packets, stored in Routing Table for this purpose.
+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).
+
+BGP in SDN
+^^^^^^^^^^
+However BGP evolved long time before SDN was born, it plays a significant role in many SDN use-cases.
+Also, continuous evolution of the protocol brings extensions that are very well suited for SDN.
+Nowadays, BGP can carry various types of routing information - L3VPN, L2VPN, IP multicast, linkstate, etc.
+Here is a brief list of software-based/legacy-network technologies where BGP-based SDN solution get into an action:
+
+* SDN WAN - WAN orchestration and optimization
+* SDN router - Turns switch into an Internet router
+* Virtual Route Reflector - High-performance server-based BGP Route Reflector
+* SDX - A Software Defined Internet Exchange controller
+* Large-Scale Data Centers - BGP Data Center Routing, MPLS/SR in DCs, DC interconnection
+* DDoS mitigation - Traffic Filtering distribution with BGP
+
+OpenDaylight BGP plugin
+^^^^^^^^^^^^^^^^^^^^^^^
+The OpenDaylight controller provides an implementation of BGP (RFC 4271) as a south-bound protocol plugin.
+The implementation renders all basic *BGP speaker capabilities*:
+
+* inter/intra-AS peering
+* routes advertising
+* routes originating
+* routes storage
+
+The plugin's **north-bound API** (``REST``/``Java``) provides to user:
+
+* fully dynamic runtime standardized BGP configuration
+* read-only access to all RIBs
+* read-write programmable RIBs
+* read-only reachability/linkstate topology view
+
+.. note:: The BGP plugin is NOT a virtual router - does not construct Routing Tables, nor forward traffic.
diff --git a/docs/bgp/bgp-user-guide-pmsi-attribute.rst b/docs/bgp/bgp-user-guide-pmsi-attribute.rst
new file mode 100644 (file)
index 0000000..ec4f55c
--- /dev/null
@@ -0,0 +1,101 @@
+PSMI Attribute
+==============
+
+* **P-Multicast Service Interface Tunnel (PMSI) attribute:**
+
+  - **RSVP-TE P2MP LSP**
+
+    .. code-block:: xml
+
+      <pmsi-tunnel>
+          <leaf-information-required>true</leaf-information-required>
+          <mpls-label>20024</mpls-label>
+          <rsvp-te-p2mp-lsp>
+              <p2mp-id>1111111111</p2mp-id>
+              <tunnel-id>11111</tunnel-id>
+              <extended-tunnel-id>10.10.10.10</extended-tunnel-id>
+          </rsvp-te-p2mp-lsp>
+      </pmsi-tunnel>
+
+  - **mLDP P2MP LSP**
+
+    .. code-block:: xml
+
+      <pmsi-tunnel>
+          <leaf-information-required>true</leaf-information-required>
+          <mpls-label>20024</mpls-label>
+          <mldp-p2mp-lsp>
+              <address-family xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</address-family>
+              <root-node-address>10.10.10.10</root-node-address>
+              <opaque-value>
+                  <opaque-type>255</opaque-type>
+                  <opaque-extended-type>11111</opaque-extended-type>
+                  <opaque>aa:aa:aa</opaque>
+              </opaque-value>
+          </mldp-p2mp-lsp>
+      </pmsi-tunnel>
+
+  - **PIM-SSM Tree**
+
+    .. code-block:: xml
+
+      <pmsi-tunnel>
+          <leaf-information-required>true</leaf-information-required>
+          <mpls-label>20024</mpls-label>
+          <pim-ssm-tree>
+              <p-address>11.12.13.14</p-address>
+              <p-multicast-group>10.10.10.10</p-multicast-group>
+          </pim-ssm-tree>
+      </pmsi-tunnel>
+
+  - **PIM-SM Tree**
+
+    .. code-block:: xml
+
+      <pmsi-tunnel>
+          <leaf-information-required>true</leaf-information-required>
+          <mpls-label>20024</mpls-label>
+          <pim-sm-tree>
+              <p-address>1.0.0.1</p-address>
+              <p-multicast-group>10.10.10.10</p-multicast-group>
+          </pim-sm-tree>
+      </pmsi-tunnel>
+
+  - **BIDIR-PIM Tree**
+
+    .. code-block:: xml
+
+      <pmsi-tunnel>
+          <leaf-information-required>true</leaf-information-required>
+          <mpls-label>20024</mpls-label>
+          <bidir-pim-tree>
+              <p-address>1.0.0.1</p-address>
+              <p-multicast-group>10.10.10.10</p-multicast-group>
+          </bidir-pim-tree>
+      </pmsi-tunnel>
+
+  - **Ingress Replication**
+
+    .. code-block:: xml
+
+      <pmsi-tunnel>
+          <leaf-information-required>true</leaf-information-required>
+          <mpls-label>20024</mpls-label>
+          <ingress-replication>
+              <receiving-endpoint-address>172.12.123.3</receiving-endpoint-address>
+          </ingress-replication>
+      </pmsi-tunnel>
+
+  - **mLDP MP2MP LSP**
+
+    .. code-block:: xml
+
+      <pmsi-tunnel>
+          <leaf-information-required>true</leaf-information-required>
+          <mpls-label>20024</mpls-label>
+          <mldp-mp2mp-lsp>
+              <opaque-type>255</opaque-type>
+              <opaque-extended-type>11111</opaque-extended-type>
+              <opaque>aa:aa</opaque>
+          </mldp-mp2mp-lsp>
+      </pmsi-tunnel>
diff --git a/docs/bgp/bgp-user-guide-protocol-configuration-loader.rst b/docs/bgp/bgp-user-guide-protocol-configuration-loader.rst
new file mode 100644 (file)
index 0000000..1275c9e
--- /dev/null
@@ -0,0 +1,159 @@
+.. _bgp-user-guide-protocol-configuration-loader:
+
+BGP Protocol Configuration Loader
+=================================
+
+BGP Protocol Configuration Loader allows the user to define the static initial
+configuration for a BGP protocol instance.
+This service will detect the creation of new configuration files following the
+pattern ``protocols-*.xml`` under the path "etc/opendaylight/bgpcep".
+Once the file is processed, the defined configuration will be available from
+the configuration Data Store.
+
+.. note:: If the BGP instance is already present, no update or configuration will be applied.
+
+**PATH:** ``etc/opendaylight/bgpcep/protocols-config.xml``
+
+.. code-block:: xml
+
+    <protocols xmlns="http://openconfig.net/yang/network-instance">
+        <protocol>
+            <name>example-bgp-rib</name>
+            <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
+            <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+                <global>
+                    <config>
+                        <router-id>192.0.2.2</router-id>
+                        <as>64496</as>
+                        <!-- if cluster-id is not present, it's value is the same as bgp-id -->
+                        <!-- <route-reflector-cluster-id>192.0.2.3</route-reflector-cluster-id> -->
+                        <!-- <read-only-limit>120</read-only-limit>-->
+                    </config>
+                    <afi-safis>
+                        <afi-safi>
+                            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
+                            <!--Advertise N Paths
+                            <receive>true</receive>
+                            <send-max>2</send-max>-->
+                        </afi-safi>
+                        <afi-safi>
+                            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
+                        </afi-safi>
+                        <afi-safi>
+                            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
+                        </afi-safi>
+                        <afi-safi>
+                            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-LABELLED-UNICAST</afi-safi-name>
+                        </afi-safi>
+                        <afi-safi>
+                            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
+                        </afi-safi>
+                        <afi-safi>
+                            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
+                        </afi-safi>
+                        <afi-safi>
+                            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
+                        </afi-safi>
+                        <afi-safi>
+                            <afi-safi-name>LINKSTATE</afi-safi-name>
+                        </afi-safi>
+                        <afi-safi>
+                            <afi-safi-name>IPV4-FLOW</afi-safi-name>
+                        </afi-safi>
+                        <afi-safi>
+                            <afi-safi-name>IPV6-FLOW</afi-safi-name>
+                        </afi-safi>
+                        <afi-safi>
+                            <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
+                        </afi-safi>
+                        <afi-safi>
+                            <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
+                        </afi-safi>
+                    </afi-safis>
+                </global>
+                <neighbors xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+                    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+                        <neighbor-address>192.0.2.1</neighbor-address>
+                        <config>
+                            <peer-type>INTERNAL</peer-type>
+                            <peer-as>64496</peer-as>
+                        </config>
+                        <transport>
+                            <config>
+                                <remote-port>179</remote-port>
+                                <passive-mode>true</passive-mode>
+                            </config>
+                        </transport>
+                        <timers>
+                            <config>
+                                <hold-time>180</hold-time>
+                                <connect-retry>10</connect-retry>
+                            </config>
+                        </timers>
+                        <route-reflector>
+                            <config>
+                                <route-reflector-client>false</route-reflector-client>
+                            </config>
+                        </route-reflector>
+                        <afi-safis>
+                            <afi-safi>
+                                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
+                                <!--Advertise N Paths
+                                <receive>true</receive>
+                                <send-max>0</send-max>-->
+                            </afi-safi>
+                            <afi-safi>
+                                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
+                            </afi-safi>
+                            <afi-safi>
+                                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-LABELLED-UNICAST</afi-safi-name>
+                            </afi-safi>
+                            <afi-safi>
+                                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-LABELLED-UNICAST</afi-safi-name>
+                            </afi-safi>
+                            <afi-safi>
+                                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
+                            </afi-safi>
+                            <afi-safi>
+                                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
+                            </afi-safi>
+                            <afi-safi>
+                                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
+                            </afi-safi>
+                            <afi-safi>
+                                <afi-safi-name>LINKSTATE</afi-safi-name>
+                            </afi-safi>
+                            <afi-safi>
+                                <afi-safi-name>IPV4-FLOW</afi-safi-name>
+                            </afi-safi>
+                            <afi-safi>
+                                <afi-safi-name>IPV6-FLOW</afi-safi-name>
+                            </afi-safi>
+                            <afi-safi>
+                                <afi-safi-name>IPV4-L3VPN-FLOW</afi-safi-name>
+                            </afi-safi>
+                            <afi-safi>
+                                <afi-safi-name>IPV6-L3VPN-FLOW</afi-safi-name>
+                            </afi-safi>
+                        </afi-safis>
+                    </neighbor>
+                    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+                        <neighbor-address>192.0.2.6</neighbor-address>
+                        <config>
+                            <peer-group>application-peers</peer-group>
+                        </config>
+                    </neighbor>
+                </neighbors>
+            </bgp>
+        </protocol>
+    </protocols>
+
+BGP Configuration Example
+'''''''''''''''''''''''''
+
+BGP provides a feature providing a BGP Protocol and Network Topology configuration file example.
+Once feature is installed defined configuration will be loaded and setup.
+
+.. code-block:: console
+
+   feature:install odl-bgpcep-bgp-config-example
diff --git a/docs/bgp/bgp-user-guide-protocol-configuration.rst b/docs/bgp/bgp-user-guide-protocol-configuration.rst
new file mode 100644 (file)
index 0000000..d0d7c23
--- /dev/null
@@ -0,0 +1,83 @@
+.. _bgp-user-guide-protocol-configuration:
+
+Protocol Configuration
+======================
+As a first step, a new protocol instance needs to be configured.
+It is a very basic configuration conforming with RFC4271.
+
+.. note:: RIB policy must already be configured and present before configuring the protocol.
+
+**URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,7,8
+
+   <protocol xmlns="http://openconfig.net/yang/network-instance">
+       <name>bgp-example</name>
+       <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
+       <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+           <global>
+               <config>
+                   <router-id>192.0.2.2</router-id>
+                   <as>65000</as>
+               </config>
+                <apply-policy>
+                    <config>
+                        <default-export-policy>REJECT-ROUTE</default-export-policy>
+                        <default-import-policy>REJECT-ROUTE</default-import-policy>
+                        <import-policy>default-odl-import-policy</import-policy>
+                        <export-policy>default-odl-export-policy</export-policy>
+                    </config>
+                </apply-policy>
+           </global>
+       </bgp>
+   </protocol>
+
+@line 2: The unique protocol instance identifier.
+
+@line 7: BGP Identifier of the speaker.
+
+@line 8: Local autonomous system number of the speaker. Note that, OpenDaylight BGP implementation supports four-octet AS numbers only.
+
+@line 14: Default ODL Import Policy.
+
+@line 15: Default ODL Export Policy.
+
+-----
+
+The new instance presence can be verified via REST:
+
+**URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,4
+
+   <rib xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
+       <id>bgp-example</id>
+       <loc-rib>
+           <tables>
+               <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
+               <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
+               <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet"></ipv4-routes>
+               <attributes>
+                   <uptodate>true</uptodate>
+               </attributes>
+           </tables>
+       </loc-rib>
+   </rib>
+
+@line 3: Loc-RIB - Per-protocol instance RIB, which contains the routes that have been selected by local BGP speaker's decision process.
+
+@line 4: The BGP-4 supports carrying IPv4 prefixes, such routes are stored in *ipv4-address-family*/*unicast-subsequent-address-family* table.
diff --git a/docs/bgp/bgp-user-guide-rib-config-policies.rst b/docs/bgp/bgp-user-guide-rib-config-policies.rst
new file mode 100644 (file)
index 0000000..ed272e1
--- /dev/null
@@ -0,0 +1,1058 @@
+.. _bgp-user-guide-rib-config-policies:
+
+RIB Policy Configuration
+========================
+
+The OpenDaylight BGP implementation supports configurable RIB policies that allow the modification of import and export policies.
+
+.. note:: Default ODL BGP RIB Config Policy is provided. Any config policy to be used by Protocol must be configured and present before than Protocol configuration is added. If policy is reconfigured, protocol must be re configured again.
+
+
+**URL:** ``/restconf/config/openconfig-routing-policy:routing-policy``
+
+**Method:** ``GET``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,15
+
+    <routing-policy xmlns="http://openconfig.net/yang/routing-policy">
+        <defined-sets>
+            <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
+                <cluster-id-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                    ...
+                </cluster-id-sets>
+                <role-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                    ...
+                </role-sets>
+                <originator-id-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                    ...
+                </originator-id-sets>
+            </bgp-defined-sets>
+        </defined-sets>
+        <policy-definitions>
+            <policy-definition>
+                <name>default-odl-export-policy</name>
+                <statements>
+                    <statement>
+                        <name>to-odl-internal</name>
+                        <actions>
+                            <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+                                ...
+                            </bgp-actions>
+                        </actions>
+                        <conditions>
+                            <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+                                ...
+                            </bgp-conditions>
+                        </conditions>
+                    </statement>
+                    ...
+                </statements>
+            </policy-definition>
+            <policy-definition>
+                <name>default-odl-import-policy</name>
+                ...
+            </policy-definition>
+        </policy-definitions>
+    </routing-policy>
+
+@line 2: BGP defined sets.
+
+@line 15: Policy definitions.
+
+
+Policy Configuration
+--------------------
+
+Conditions may include multiple match or comparison operations; similarly, actions may consist of a multitude of changes to route attributes or a final disposition regarding the acceptance or rejection of the route.
+
+**URL:** ``/restconf/config/openconfig-routing-policy:routing-policy/openconfig-routing-policy:policy-definitions/``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,5,7,10
+
+    <policy-definition xmlns="http://openconfig.net/yang/routing-policy">
+        <name>odl-policy-example</name>
+        <statements>
+            <statement>
+                <name>reject-all-incoming-routes</name>
+                <actions>
+                    <reject-route/>
+                </actions>
+                <conditions>
+                    <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+                        <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                            <from-role>
+                               <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                            </from-role>
+                        </match-role-set>
+                    </bgp-conditions>
+                </conditions>
+            </statement>
+        </statements>
+    </policy-definition>
+
+@line 2: The unique policy instance identifier.
+
+@line 5: Policy Statement Identifier.
+
+@line 7: Actions.
+
+@line 10: BGP Conditions.
+
+-----
+
+The new instance presence can be verified via REST:
+
+**URL:** ``/restconf/config/openconfig-routing-policy:routing-policy/openconfig-routing-policy:policy-definitions/policy-definition/odl-policy-example``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,5
+
+    <policy-definition xmlns="http://openconfig.net/yang/routing-policy">
+        <name>odl-policy-example</name>
+        <statements>
+            <statement>
+                <name>reject-all-incoming-routes</name>
+                <actions>
+                    <reject-route></reject-route>
+                </actions>
+                <conditions>
+                    <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+                        <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                            <from-role>
+                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                <match-set-options>ANY</match-set-options>
+                            </from-role>
+                        </match-role-set>
+                    </bgp-conditions>
+                </conditions>
+            </statement>
+        </statements>
+    </policy-definition>
+
+@line 2: Policy definition Identifier.
+
+@line 5: Policy Statement Identifier.
+
+Actions
+```````
+ODL BGP by default provides support for a group of BGP Actions.
+
+Accept
+''''''
+Default policy to accept the route.
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2
+
+    <actions>
+        <accept-route/>
+    </actions>
+
+Reject
+''''''
+Default policy to reject the route.
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2
+
+    <actions>
+        <reject-route/>
+    </actions>
+
+As-path prepend
+'''''''''''''''
+Action to prepend local AS number to the AS-path
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <actions>
+        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+            <set-as-path-prepend/>
+        </bgp-actions>
+    </actions>
+
+Originator Id prepend
+'''''''''''''''''''''''''
+Action to prepend Originator Id. In case there is non Originator Id present, local Originator Id is prepend.
+
+* Local
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2
+
+    <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+        <set-originator-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
+    </bgp-actions>
+
+* By value
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2
+
+    <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+        <set-originator-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+            <originator-id>192.0.2.1</originator-id>
+        </set-originator-id-prepend>
+    </bgp-actions>
+
+Cluster Id prepend
+''''''''''''''''''
+Action to prepend local Cluster Id to Cluster Id List.
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <actions>
+        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+            <set-cluster-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
+        </bgp-actions>
+    </actions>
+
+Set Route Origin
+''''''''''''''''
+Set the origin attribute to the specified value.
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <actions>
+        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+            <set-route-origin>IGP</set-route-origin>
+        </bgp-actions>
+    </actions>
+
+Set Local Preference
+''''''''''''''''''''
+Set the local pref attribute on the route update.
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <actions>
+        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+            <set-local-pref>100</set-local-pref>
+        </bgp-actions>
+    </actions>
+
+Set NextHop
+'''''''''''
+Set the next-hop attribute in the route update.
+
+* Local
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <actions>
+        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+            <set-next-hop>SELF</set-next-hop>
+        </bgp-actions>
+    </actions>
+
+
+* By value
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <actions>
+        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+            <set-next-hop>4.5.6.7</set-next-hop>
+        </bgp-actions>
+    </actions>
+
+Set MED
+'''''''
+Set the med metric attribute in the route update.
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <actions>
+        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+            <set-med>15</set-med>
+        </bgp-actions>
+    </actions>
+
+Community set prepend
+'''''''''''''''''''''
+Action to set the community attributes of the route, along with options to modify how the community is modified.
+
+* Inline
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <actions>
+        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+            <set-community>
+                <communities>
+                    <as-number>65</as-number>
+                    <semantics>10</semantics>
+                </communities>
+                <communities>
+                    <as-number>66</as-number>
+                    <semantics>11</semantics>
+                </communities>
+                <options>ADD</options>
+            </set-community>
+        </bgp-actions>
+    </actions>
+
+@line 3: Set Community.
+
+* By reference
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5,7
+
+    <actions>
+        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+            <set-community>
+                <community-set-ref>
+                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-example"]
+                </community-set-ref>
+                <options>ADD</options>
+            </set-community>
+        </bgp-actions>
+    </actions>
+
+@line 3: Set Community.
+
+@line 5: Community set reference.
+
+@line 7: Options are ADD, REMOVE, REPLACE.
+
+-----
+
+Defined set
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <defined-sets>
+        <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
+            <community-sets>
+                <community-set>
+                    <community-set-name>community-set-name-test</community-set-name>
+                    <communities>
+                        <as-number>65</as-number>
+                        <semantics>10</semantics>
+                    </communities>
+                    <communities>
+                        <as-number>66</as-number>
+                        <semantics>11</semantics>
+                    </communities>
+                </community-set>
+            </community-sets>
+        </bgp-defined-sets>
+    </defined-sets>
+
+@line 3: Community set.
+
+Extended Community set action
+''''''''''''''''''''''''''''''
+Action to set the extended community attributes of the route, along with options to modify how the community is modified.
+
+* Inline
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <actions>
+        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+            <set-ext-community>
+                <ext-community-member>
+                    <encapsulation-extended-community>
+                        <tunnel-type>vxlan</tunnel-type>
+                    </encapsulation-extended-community>
+                </ext-community-member>
+                <ext-community-member>
+                    <as-4-route-origin-extended-community>
+                        <as-4-specific-common>
+                            <as-number>65000</as-number>
+                            <local-administrator>123</local-administrator>
+                        </as-4-specific-common>
+                    </as-4-route-origin-extended-community>
+                </ext-community-member>
+                <options>ADD</options>
+            </set-ext-community>
+        </bgp-actions>
+    </actions>
+
+@line 3: Set Extended Community.
+
+* By reference
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <actions>
+        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+            <set-ext-community>
+                <ext-community-set-ref>
+                    /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-example"]
+                </ext-community-set-ref>
+                <options>REMOVE</options>
+            </set-ext-community>
+        </bgp-actions>
+    </actions>
+
+@line 3: Set Extended Community.
+
+@line 5: Extended Community set reference.
+
+@line 7: Options are ADD, REMOVE, REPLACE.
+
+-----
+
+Defined set
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <defined-sets>
+        <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
+            <ext-community-sets>
+                <ext-community-set>
+                    <ext-community-set-name>ext-community-set-name-test</ext-community-set-name>
+                    <ext-community-member>
+                        <encapsulation-extended-community>
+                            <tunnel-type>vxlan</tunnel-type>
+                        </encapsulation-extended-community>
+                    </ext-community-member>
+                    <ext-community-member>
+                        <as-4-route-origin-extended-community>
+                            <as-4-specific-common>
+                                <as-number>65000</as-number>
+                                <local-administrator>123</local-administrator>
+                            </as-4-specific-common>
+                        </as-4-route-origin-extended-community>
+                    </ext-community-member>
+                </ext-community-set>
+            </ext-community-sets>
+        </bgp-defined-sets>
+    </defined-sets>
+
+@line 3: Extendend Community set.
+
+@line 5: Extendend Community set name.
+
+
+Filter Non transitive attributes
+''''''''''''''''''''''''''''''''
+Filters attributes, removing non transitive attributes.
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <actions>
+        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+            <non-transitive-attributes-filter xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
+        </bgp-actions>
+    </actions>
+
+Client Attribute Prepend
+''''''''''''''''''''''''
+Replace attributes per any VPN Route attributes from client Peer, if present.
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <actions>
+        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+            <client-attribute-prepend xmlns="urn:opendaylight:params:xml:ns:yang:bgp:route:target:constrain"/>
+        </bgp-actions>
+    </actions>
+
+Conditions
+``````````
+ODL BGP by default provides support for a group of BGP Conditions.
+
+Match BGP Neighbor Set
+''''''''''''''''''''''
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,4,5,6
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <match-bgp-neighbor-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                <from-neighbor>
+                    <neighbor-set>/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="bgp-neighbor-set-example"]</neighbor-set>
+                    <match-set-options>INVERT</match-set-options>
+                </from-neighbor>
+            </match-bgp-neighbor-set>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Match BGP Neighbor Condition set.
+
+@line 4: Match BGP Neighbor from whom we receive the route.
+
+@line 5: Match BGP Neighbor Set reference.
+
+@line 6: Match Set Options (ANY, INVERT)
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,4,5,6
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <match-bgp-neighbor-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                <to-neighbor>
+                    <neighbor-set>/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="bgp-neighbor-set-example"]</neighbor-set>
+                    <match-set-options>INVERT</match-set-options>
+                </to-neighbor>
+            </match-bgp-neighbor-set>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Match BGP Neighbor Condition set.
+
+@line 4: Match BGP Neighbor to whom we send the route.
+
+@line 5: Match BGP Neighbor Set reference.
+
+@line 6: Match Set Options (ANY, INVERT)
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,4,5,7,8,9
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <match-bgp-neighbor-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                <from-neighbor>
+                    <neighbor-set>/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="bgp-neighbor-set-example"]</neighbor-set>
+                </from-neighbor>
+                <to-neighbor>
+                    <neighbor-set>/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="bgp-neighbor-set-example"]</neighbor-set>
+                    <match-set-options>INVERT</match-set-options>
+                </to-neighbor>
+            </match-bgp-neighbor-set>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Match BGP Neighbor Condition set.
+
+@line 4: Match BGP Neighbor from whom we receive the route.
+
+@line 5: Match BGP Neighbor Set reference.
+
+@line 7: Match BGP Neighbor to whom we send the route.
+
+@line 8: Match BGP Neighbor Set reference.
+
+@line 9: Match Set Options (ANY, INVERT)
+
+-----
+
+Defined set
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5
+
+    <defined-sets>
+        <neighbor-sets>
+            <neighbor-set>
+                <neighbor-set-name>bgp-neighbor-set-example</neighbor-set-name>
+                <neighbor>
+                    <address>127.0.0.1</address>
+                </neighbor>
+                <neighbor>
+                    <address>127.0.0.2</address>
+                </neighbor>
+            </neighbor-set>
+        </neighbor-sets>
+    </defined-sets>
+
+@line 3: Originator Id Set.
+
+@line 5: Originator Id Set name.
+
+Match Originator Id Set
+'''''''''''''''''''''''
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5,7
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <match-originator-id-set-condition xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                <originator-id-set>
+                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/originator-id-sets/originator-id-set[originator-set-name="local-originator-id"]
+                </originator-id-set>
+                <match-set-options>INVERT</match-set-options>
+            </match-originator-id-set-condition>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Match Originator Id Condition set.
+
+@line 5: Match Originator Id Set reference.
+
+@line 7: Match Set Options (ANY, INVERT)
+
+-----
+
+Defined set
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5
+
+    <defined-sets>
+        <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
+            <originator-id-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                <originator-id-set>
+                    <originator-id-set-name>local-originator-id</originator-id-set-name>
+                    <local/>
+                </originator-id-set>
+            </originator-id-sets>
+        </bgp-defined-sets>
+    </defined-sets>
+
+@line 3: Originator Id Set.
+
+@line 5: Originator Id Set name.
+
+Match Cluster Id Set
+''''''''''''''''''''
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <match-cluster-id-set-condition xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                <cluster-id-set>
+                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/cluster-id-sets/cluster-id-set[cluster-set-name="local-cluster-id"]
+                </cluster-id-set>
+                <match-set-options>INVERT</match-set-options>
+            </match-cluster-id-set-condition>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Match Cluster Id Condition set.
+
+@line 5: Match Cluster Id Set reference.
+
+-----
+
+Defined set
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5
+
+    <defined-sets>
+        <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
+            <cluster-id-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                <cluster-id-set>
+                    <cluster-id-set-name>local-cluster-id</cluster-id-set-name>
+                    <local/>
+                </cluster-id-set>
+            </cluster-id-sets>
+        </bgp-defined-sets>
+    </defined-sets>
+
+@line 3: Cluster Id Set.
+
+@line 5: Cluster Id Set name.
+
+Match Peer Role Set
+'''''''''''''''''''
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5,6
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                <from-role>
+                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
+                    <match-set-options>INVERT</match-set-options>
+                </from-role>
+                <to-role>
+                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                <to-role>
+            </match-role-set>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Match Role Set.
+
+@line 5: Match Role Set reference.
+
+@line 6: Match Set Options (ANY, INVERT)
+
+-----
+
+Defined set
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,4,10,11
+
+    <defined-sets>
+        <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
+            <role-set>
+                <role-set-name>all</role-set-name>
+                <role>ebgp</role>
+                <role>ibgp</role>
+                <role>rr-client</role>
+                <role>internal</role>
+            </role-set>
+            <role-set>
+                <role-set-name>only-ibgp</role-set-name>
+                <role>ibgp</role>
+            </role-set>
+        </bgp-defined-sets>
+    </defined-sets>
+
+@line 3: Role Set.
+
+@line 4: Role Set name.
+
+@line 10: Role Set.
+
+@line 11: Role Id Set name.
+
+Match AS Path Set
+'''''''''''''''''
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5,7
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <match-as-path-set>
+                <as-path-set>
+                    /rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:as-path-sets/bgp-pol:as-path-set/[as-path-set-name="as-path-set-example"]
+                </as-path-set>
+                <match-set-options>ANY</match-set-options>
+            </match-as-path-set>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Match AS Path Set.
+
+@line 5: AS Path Set reference.
+
+@line 7: Match Set Option(ANY, ALL, INVERT).
+
+-----
+
+Defined set
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 4,5,6
+
+    <defined-sets>
+        <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
+            <as-path-sets>
+                <as-path-set>
+                    <as-path-set-name>as-path-set-example</as-path-set-name>
+                    <as-path-set-member>65</as-path-set-member>
+                    <as-path-set-member>64</as-path-set-member>
+                    <as-path-set-member>63</as-path-set-member>
+                </as-path-set>
+            </as-path-sets>
+        </bgp-defined-sets>
+    </defined-sets>
+
+@line 4: AS Path Set.
+
+@line 5: AS Path Set name.
+
+@line 6: AS Path set member
+
+Match Community Set
+'''''''''''''''''''
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <match-community-set>
+                <community-set>
+                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-example"]
+                </community-set>
+                <match-set-options>ANY</match-set-options>
+            </match-community-set>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Match Community Set.
+
+@line 5: Match Community Set reference.
+
+@line 7: Match Set Option(ANY, ALL, INVERT).
+
+-----
+
+Defined set
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 4,5,6,10
+
+    <defined-sets>
+        <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
+            <community-sets>
+                <community-set>
+                    <community-set-name>community-set-name-example</community-set-name>
+                    <communities>
+                        <as-number>65</as-number>
+                        <semantics>10</semantics>
+                    </communities>
+                    <communities>
+                        <as-number>66</as-number>
+                        <semantics>11</semantics>
+                    </communities>
+                </community-set>
+            </community-sets>
+        </bgp-defined-sets>
+    </defined-sets>
+
+@line 4: Community Set.
+
+@line 5: Community Set name.
+
+@line 6: Communities.
+
+@line 10: Communities.
+
+Match Extended Community Set
+''''''''''''''''''''''''''''
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5,7
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <match-ext-community-set>
+                <ext-community-set>
+                    /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-test"]
+                </ext-community-set>
+                <match-set-options>ANY</match-set-options>
+            </match-ext-community-set>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Match Extended Community Set.
+
+@line 5: Match Extended Community Set reference.
+
+@line 7: Match Set Option(ANY, ALL, INVERT).
+
+-----
+
+Defined set
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 4,5,6,11
+
+    <defined-sets>
+        <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
+            <ext-community-sets>
+                <ext-community-set>
+                    <ext-community-set-name>ext-community-set-name-test</ext-community-set-name>
+                    <ext-community-member>
+                        <encapsulation-extended-community>
+                            <tunnel-type>vxlan</tunnel-type>
+                        </encapsulation-extended-community>
+                    </ext-community-member>
+                    <ext-community-member>
+                        <as-4-route-origin-extended-community>
+                            <as-4-specific-common>
+                                <as-number>65000</as-number>
+                                <local-administrator>123</local-administrator>
+                            </as-4-specific-common>
+                        </as-4-route-origin-extended-community>
+                    </ext-community-member>
+                </ext-community-set>
+            </ext-community-sets>
+        </bgp-defined-sets>
+    </defined-sets>
+
+@line 4: Extended Community Set.
+
+@line 5: Extended Community Set name.
+
+@line 6: Extended Communities.
+
+@line 11: Extended Communities.
+
+Match in Afi Safi
+'''''''''''''''''
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <afi-safi-in xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-in>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Afi Safi match.
+
+Match not in Afi Safi
+'''''''''''''''''''''
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <afi-safi-not-in xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"
+                xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-not-in>
+            <afi-safi-not-in xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"
+                xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-not-in>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Afi Safi not in match.
+
+Match As Path Length
+''''''''''''''''''''
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <as-path-length>
+                <operator xmlns:x="http://openconfig.net/yang/policy-types">x:attribute-eq</operator>
+                <value>2</value>
+            </as-path-length>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: As Path Length match.
+
+Match Local Pref
+''''''''''''''''
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <local-pref-eq>100</local-pref-eq>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Local Preference match.
+
+Match Origin
+''''''''''''
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <origin-eq>IGP</origin-eq>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Origin match.
+
+Match MED
+'''''''''
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <med-eq>100</med-eq>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: MED match.
+
+Match Next Hop
+''''''''''''''
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <next-hop-in>192.168.2.2</next-hop-in>
+            <next-hop-in>42.42.42.42</next-hop-in>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: Next hop match.
+
+Match VPN Non member
+''''''''''''''''''''
+
+True if Route Targets attributes does not match with any Route Target Contrain advertized per Advertized peer.
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+    <conditions>
+        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+            <vpn-non-member xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
+        </bgp-conditions>
+    </conditions>
+
+@line 3: VPN Non member match.
diff --git a/docs/bgp/bgp-user-guide-route-refresh-capability.rst b/docs/bgp/bgp-user-guide-route-refresh-capability.rst
new file mode 100644 (file)
index 0000000..1d28ae7
--- /dev/null
@@ -0,0 +1,69 @@
+.. _bgp-user-guide-route-refresh-capability:
+
+Route Refresh
+=============
+The Route Refresh Capability allows to dynamically request a re-advertisement of the Adj-RIB-Out from a BGP peer.
+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.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+The capability is enabled by default, no additional configuration is required.
+
+Usage
+^^^^^
+To send a Route Refresh request from OpenDaylight BGP speaker instance to its neighbor, invoke RPC:
+
+**URL:** ``/restconf/operations/bgp-peer-rpc:route-refresh-request``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <input xmlns="urn:opendaylight:params:xml:ns:yang:bgp-peer-rpc">
+       <afi xmlns:types="urn:opendaylight:params:xml:ns:yang:bgp-types">types:ipv4-address-family</afi>
+       <safi xmlns:types="urn:opendaylight:params:xml:ns:yang:bgp-types">types:unicast-subsequent-address-family</safi>
+       <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>
+   </input>
+
+References
+^^^^^^^^^^
+* `Route Refresh Capability for BGP-4 <https://tools.ietf.org/html/rfc2918>`_
+
+Peer Session Release
+--------------------
+
+BGP provides a RPC feature to release a Neighbor session.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+The capability is enabled by default, no additional configuration is required.
+
+Usage
+^^^^^
+To release neighbor session, invoke RPC:
+
+**URL:** ``/restconf/operations/bgp-peer-rpc:reset-session``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <input xmlns="urn:opendaylight:params:xml:ns:yang:bgp-peer-rpc">
+       <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>
+   </input>
diff --git a/docs/bgp/bgp-user-guide-route-target-family.rst b/docs/bgp/bgp-user-guide-route-target-family.rst
new file mode 100644 (file)
index 0000000..5ad90aa
--- /dev/null
@@ -0,0 +1,231 @@
+.. _bgp-user-guide-route-target-family:
+
+Route Target Constrain Family
+=============================
+The BGP Multicast Route Target (RT) Constrain Multiprotocol extension can be used to restrict advertisement of VPN NLRI to peers that have advertised
+their respective Route Targets, effectively building a route distribution graph.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+This section shows a way to enable ROUTE-TARGET-CONSTRAIN family in BGP speaker and peer configuration.
+
+BGP Speaker
+'''''''''''
+To enable ROUTE-TARGET-CONSTRAIN support in BGP plugin, first configure BGP speaker instance:
+
+**URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <protocol xmlns="http://openconfig.net/yang/network-instance">
+       <name>bgp-example</name>
+       <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
+       <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+           <global>
+               <config>
+                   <router-id>192.0.2.2</router-id>
+                   <as>65000</as>
+               </config>
+               <afi-safis>
+                   <afi-safi>
+                       <afi-safi-name>ROUTE-TARGET-CONSTRAIN</afi-safi-name>
+                   </afi-safi>
+               </afi-safis>
+           </global>
+       </bgp>
+   </protocol>
+
+BGP Peer
+''''''''
+Here is an example for BGP peer configuration with enabled ROUTE-TARGET-CONSTRAIN family.
+
+**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``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+       <neighbor-address>192.0.2.1</neighbor-address>
+       <afi-safis>
+           <afi-safi>
+               <afi-safi-name>ROUTE-TARGET-CONSTRAIN</afi-safi-name>
+           </afi-safi>
+       </afi-safis>
+   </neighbor>
+
+ROUTE-TARGET-CONSTRAIN Route API
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Following tree illustrates the BGP ROUTE-TARGET-CONSTRAIN route structure.
+
+.. code-block:: console
+
+   :(route-target-constrain-routes-case)
+     +--rw route-target-constrain-routes
+        +--rw route-target-constrain-route* [route-key path-id]
+           +--rw origin-as                  inet:as-number
+           +--rw (route-target-constrain-choice)
+              +--:(route-target-constrain-default-case)
+              |  +--rw route-target-constrain-default-route!
+              +--:(route-target-constrain-route-case)
+              |  +--rw route-target-extended-community
+              |     +--rw global-administrator?   short-as-number
+              |     +--rw local-administrator?    binary
+              +--:(route-target-constrain-ipv4-route-case)
+              |  +--rw route-target-ipv4
+              |     +--rw global-administrator?   inet:ipv4-address
+              |     +--rw local-administrator?    uint16
+              +--:(route-target-constrain-as-4-extended-community-case)
+                 +--rw as-4-route-target-extended-community
+                    +--rw as-4-specific-common
+                       +--rw as-number              inet:as-number
+                       +--rw local-administrator    uint16
+
+Usage
+^^^^^
+The ROUTE TARGET CONSTRAIN table in an instance of the speaker's Loc-RIB can be verified via REST:
+
+**URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-route-target-constrain:route-target-constrain-subsequent-address-family/bgp-route-target-constrain:route-target-constrain-routes``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <route-target-constrain-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp:route:target:constrain">
+      <route-target-constrain-route>
+         <route-key>flow1</route-key>
+         <path-id>0</path-id>
+         <origin-as>64511</origin-as>
+         <route-target-extended-community>
+             <global-administrator>64511</global-administrator>
+             <local-administrator>AAAAZQ==</local-administrator>
+         </route-target-extended-community>
+         <attributes>
+            <ipv4-next-hop>
+               <global>199.20.166.41</global>
+            </ipv4-next-hop>
+            <as-path/>
+            <origin>
+               <value>igp</value>
+            </origin>
+            <local-pref>
+               <pref>100</pref>
+            </local-pref>
+         </attributes>
+      </route-target-constrain-route>
+   </route-target-constrain-routes>
+
+Routing Policies
+^^^^^^^^^^^^^^^^
+
+.. code-block:: xml
+
+   <policy-definition>
+       <name>default-odl-export-policy</name>
+       <statement>
+       ...
+       <statement>
+           <name>from-external-to-external-RTC</name>
+           <conditions>
+               <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+                   <afi-safi-in xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">x:ROUTE-TARGET-CONSTRAIN</afi-safi-in>
+                   <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                       <from-role>
+                           <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                       </from-role>
+                       <to-role>
+                           <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                       </to-role>
+                   </match-role-set>
+               </bgp-conditions>
+           </conditions>
+           <actions>
+               <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+                   <client-attribute-prepend xmlns="urn:opendaylight:params:xml:ns:yang:bgp:route:target:constrain"/>
+               </bgp-actions>
+           </actions>
+       </statement>
+       ...
+       </statement>
+       <statement>
+           <name>from-internal-or-rr-client-to-route-reflector</name>
+           <conditions>
+               <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+                   <afi-safi-not-in xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions"
+                                    xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">x:ROUTE-TARGET-CONSTRAIN
+                   </afi-safi-not-in>
+                   <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                       <from-role>
+                           <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
+                       </from-role>
+                       <to-role>
+                           <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
+                       </to-role>
+                   </match-role-set>
+               </bgp-conditions>
+           </conditions>
+           <actions>
+               <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+                   <set-cluster-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
+                   <set-originator-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
+               </bgp-actions>
+           </actions>
+       </statement>
+       <statement>
+           <name>from-internal-or-rr-client-to-route-RTC</name>
+           <conditions>
+               <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+                   <afi-safi-in xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">x:ROUTE-TARGET-CONSTRAIN</afi-safi-in>
+                   <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
+                       <from-role>
+                           <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
+                       </from-role>
+                       <to-role>
+                           <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
+                       </to-role>
+                   </match-role-set>
+               </bgp-conditions>
+           </conditions>
+           <actions>
+               <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
+                   <set-originator-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
+                   <set-next-hop>SELF</set-next-hop>
+               </bgp-actions>
+           </actions>
+       </statement>
+       <statement>
+           <name>vpn-membership-RTC</name>
+           <conditions>
+               <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
+                   <afi-safi-in xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-in>
+                   <afi-safi-in xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-in>
+                   <vpn-non-member xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
+               </bgp-conditions>
+           </conditions>
+           <actions>
+               <reject-route/>
+           </actions>
+       </statement>
+       ...
+       ...
+   </policy-definition>
+
+References
+^^^^^^^^^^
+* `Constrained Route Distribution for Border Gateway Protocol/MultiProtocol Label Switching (BGP/MPLS) Internet Protocol (IP) Virtual Private Networks (VPNs) <https://tools.ietf.org/html/rfc4684>`_
diff --git a/docs/bgp/bgp-user-guide-running-bgp.rst b/docs/bgp/bgp-user-guide-running-bgp.rst
new file mode 100644 (file)
index 0000000..d7158d3
--- /dev/null
@@ -0,0 +1,33 @@
+.. _bgp-user-guide-running-bgp:
+
+Running BGP
+===========
+This section explains how to install BGP plugin.
+
+1. Install BGP feature - ``odl-bgpcep-bgp``.
+   Also, for sake of this sample, it is required to install RESTCONF.
+   In the Karaf console, type command:
+
+   .. code-block:: console
+
+      feature:install odl-restconf odl-bgpcep-bgp
+
+2. The BGP plugin contains a default configuration, which is applied after the feature starts up.
+   One instance of BGP plugin is created (named *example-bgp-rib*), and its presence can be verified via REST:
+
+   **URL:** ``/restconf/operational/bgp-rib:bgp-rib``
+
+   **Method:** ``GET``
+
+   **Response Body:**
+
+   .. code-block:: xml
+
+      <bgp-rib xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
+         <rib>
+             <id>example-bgp-rib</id>
+             <loc-rib>
+             ....
+             </loc-rib>
+         </rib>
+      </bgp-rib>
diff --git a/docs/bgp/bgp-user-guide-supported-capabilities.rst b/docs/bgp/bgp-user-guide-supported-capabilities.rst
new file mode 100644 (file)
index 0000000..a56417f
--- /dev/null
@@ -0,0 +1,41 @@
+.. _bgp-user-guide-supported-capabilities:
+
+List of supported capabilities
+==============================
+In addition to the base protocol implementation, the plugin provides many extensions to BGP, all based on IETF standards.
+
+* `RFC4271 <https://tools.ietf.org/html/rfc4271>`_ - A Border Gateway Protocol 4 (BGP-4)
+* `RFC4456 <https://tools.ietf.org/html/rfc4456>`_ - BGP Route Reflection: An Alternative to Full Mesh Internal BGP (IBGP)
+* `RFC1997 <https://tools.ietf.org/html/rfc1997>`_ - BGP Communities Attribute
+* `RFC4360 <https://tools.ietf.org/html/rfc4360>`_ - BGP Extended Communities Attribute
+* `RFC4486 <https://tools.ietf.org/html/rfc4486>`_ - Subcodes for BGP Cease Notification Message
+* `RFC5492 <https://tools.ietf.org/html/rfc5492>`_ - Capabilities Advertisement with BGP-4
+* `RFC5004 <https://tools.ietf.org/html/rfc5004>`_ - Avoid BGP Best Path Transitions from One External to Another
+* `RFC6286 <https://tools.ietf.org/html/rfc6286>`_ - Autonomous-System-Wide Unique BGP Identifier for BGP-4
+* `RFC6793 <https://tools.ietf.org/html/rfc6793>`_ - BGP Support for Four-Octet Autonomous System (AS) Number Space
+* `RFC7311 <https://tools.ietf.org/html/rfc7311>`_ - The Accumulated IGP Metric Attribute for BGP
+* `RFC5668 <https://tools.ietf.org/html/rfc5668>`_ - 4-Octet AS Specific BGP Extended Community
+* `draft-ietf-idr-link-bandwidth <https://tools.ietf.org/html/draft-ietf-idr-link-bandwidth-06>`_ - BGP Link Bandwidth Extended Community
+* `draft-ietf-idr-bgp-extended-messages <https://tools.ietf.org/html/draft-ietf-idr-bgp-extended-messages-13>`_ - Extended Message support for BGP
+* `RFC4760 <https://tools.ietf.org/html/rfc4760>`_ - Multiprotocol Extensions for BGP-4
+   * `RFC7752 <https://tools.ietf.org/html/rfc7752>`_ - North-Bound Distribution of Link-State and TE Information using BGP
+      * `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
+      * `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
+   * `RFC5575 <https://tools.ietf.org/html/rfc5575>`_ - Dissemination of Flow Specification Rules
+      * `RFC7674 <http://tools.ietf.org/html/rfc7674>`_  - Clarification of the Flowspec Redirect Extended Community
+      * `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
+      * `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
+   * `RFC3107 <https://tools.ietf.org/html/rfc3107>`_  - Carrying Label Information in BGP-4
+      * `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
+   * `RFC4364 <https://tools.ietf.org/html/rfc4364>`_  - BGP/MPLS IP Virtual Private Networks (VPNs)
+      * `RFC4659 <https://tools.ietf.org/html/rfc4659>`_  - BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN
+   * `RFC6513 <https://tools.ietf.org/html/rfc6513>`_  - Multicast in MPLS/BGP IP VPNs (VPNs)
+      * `RFC6514 <https://tools.ietf.org/html/rfc6514>`_  - BGP Encodings and Procedures for Multicast in MPLS/BGP IP VPNs
+      * `RFC6515 <https://tools.ietf.org/html/rfc6515>`_  - IPv4 and IPv6 Infrastructure Addresses in BGP Updates for Multicast VPN
+      * `RFC4684 <https://tools.ietf.org/html/rfc4684>`_  - Constrained Route Distribution for Border Gateway Protocol/MultiProtocol Label Switching (BGP/MPLS) Internet Protocol (IP) Virtual Private Networks (VPNs)
+   * `RFC7432 <https://tools.ietf.org/html/rfc7432>`_  - BGP MPLS-Based Ethernet VPN
+      * `draft-ietf-bess-evpn-overlay <https://tools.ietf.org/html/draft-ietf-bess-evpn-overlay-04>`_  - A Network Virtualization Overlay Solution using EVPN
+      * `draft-ietf-bess-evpn-vpws <https://tools.ietf.org/html/draft-ietf-bess-evpn-vpws-07>`_  - VPWS support in EVPN
+      * `draft-sajassi-bess-evpn-vpws-fxc-01 <https://tools.ietf.org/html/draft-sajassi-bess-evpn-vpws-fxc-01>`_ - EVPN VPWS Flexible Cross-Connect Service
+* `RFC7911 <https://tools.ietf.org/html/rfc7911>`_  - Advertisement of Multiple Paths in BGP
+* `RFC2918 <https://tools.ietf.org/html/rfc2918>`_  - Route Refresh Capability for BGP-4
diff --git a/docs/bgp/bgp-user-guide-test-tools.rst b/docs/bgp/bgp-user-guide-test-tools.rst
new file mode 100644 (file)
index 0000000..79addc1
--- /dev/null
@@ -0,0 +1,178 @@
+.. _bgp-user-guide-test-tools:
+
+Test Tools
+==========
+BGP test tools serves to test basic BGP functionality, scalability and performance.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+BGP Test Tool
+^^^^^^^^^^^^^
+The BGP Test Tool is a stand-alone Java application purposed to simulate remote BGP peers, that are capable to advertise sample routes.
+This application is not part of the OpenDaylight Karaf distribution, however it can be downloaded from OpenDaylight's Nexus (use latest release version):
+
+``https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/bgpcep/bgp-testtool``
+
+Usage
+'''''
+The application can be run from command line:
+
+.. code-block:: console
+
+   java -jar bgp-testtool-*-executable.jar
+
+
+with optional input parameters:
+
+.. code-block:: console
+
+   -i <BOOLEAN>, --active <BOOLEAN>
+      Active initialisation of the connection, by default false.
+
+   -ho <N>, --holdtimer <N>
+      In seconds, value of the desired holdtimer, by default 90.
+
+   -sc <N>, --speakersCount <N>
+      Number of simulated BGP speakers, when creating each speaker, uses incremented local-address for binding, by default 0.
+
+   -ra <IP_ADDRESS:PORT,...>, --remote-address <IP_ADDRESS:PORT,...>
+      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.
+
+   -la <IP_ADDRESS:PORT>, --localAddress <IP_ADDRESS:PORT>
+      IP address of BGP speakers which the tools simulates, by default 192.0.2.2:0.
+
+   -pr <N>, --prefixes <N>
+      Number of prefixes to be advertised by each simulated speaker
+
+   -mp <BOOLEAN>, --multiPathSupport <BOOLEAN>
+      Active ADD-PATH support, by default false.
+
+   -as <N>, --as <N>
+      Local AS Number, by default 64496.
+
+   -ec <EXTENDED_COMMUNITIES>, --extended_communities <EXTENDED_COMMUNITIES>
+      Extended communities to be send. Format: x,x,x  where  x  is  each  extended  community from bgp-types.yang, by default empty.
+
+   -ll <LOG_LEVEL>, --log_level <LOG_LEVEL>
+      Log level for console output, by default INFO.
+
+BGP Application Peer Benchmark
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+It is a simple OpenDaylight application which is capable to inject and remove specific amount of IPv4 routes.
+This application is part of the OpenDaylight Karaf distribution.
+
+Configuration
+'''''''''''''
+As a first step install BGP and RESTCONF, then configure *Application Peer*.
+Install ``odl-bgpcep-bgp-benchmark`` feature and reconfigure BGP Application Peer Benchmark application as per following:
+
+**URL:** ``/restconf/config/odl-bgp-app-peer-benchmark-config:config``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2
+
+   <odl-bgp-app-peer-benchmark-config xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark-config">
+      <app-peer-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark-config">10.25.1.9</app-peer-id>
+   </odl-bgp-app-peer-benchmark-config>
+
+@line 2: The *Application Peer* identifier.
+
+Inject routes
+'''''''''''''
+Routes injection can be invoked via RPC:
+
+**URL:** ``/restconf/operations/odl-bgp-app-peer-benchmark:add-prefix``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,3,4,5
+
+   <input xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
+       <prefix>1.1.1.1/32</prefix>
+       <count>100000</count>
+       <batchsize>2000</batchsize>
+       <nexthop>192.0.2.2</nexthop>
+   </input>
+
+@line 2: A initial IPv4 prefix carried in route. Value is incremented for following routes.
+
+@line 3: An amount of routes to be added to *Application Peer's* programmable RIB.
+
+@line 4: A size of the transaction batch.
+
+@line 5: A NEXT_HOP attribute value used in all injected routes.
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,4,5
+
+   <output xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
+       <result>
+           <duration>4301</duration>
+           <rate>25000</rate>
+           <count>100000</count>
+       </result>
+   </output>
+
+@line 3: Request duration in milliseconds.
+
+@line 4: Writes per second rate.
+
+@line 5: An amount of routes added to *Application Peer's* programmable RIB.
+
+Remove routes
+'''''''''''''
+Routes deletion can be invoked via RPC:
+
+**URL:** ``/restconf/operations/odl-bgp-app-peer-benchmark:delete-prefix``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,3,4
+
+   <input xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
+       <prefix>1.1.1.1/32</prefix>
+       <count>100000</count>
+       <batchsize>2000</batchsize>
+   </input>
+
+@line 2: A initial IPv4 prefix carried in route to be removed. Value is incremented for following routes.
+
+@line 3: An amount of routes to be removed from *Application Peer's* programmable RIB.
+
+@line 4: A size of the transaction batch.
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <output xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
+       <result>
+           <duration>1837</duration>
+           <rate>54500</rate>
+           <count>100000</count>
+       </result>
+   </output>
diff --git a/docs/bgp/bgp-user-guide-topology-provider.rst b/docs/bgp/bgp-user-guide-topology-provider.rst
new file mode 100644 (file)
index 0000000..413621c
--- /dev/null
@@ -0,0 +1,359 @@
+.. _bgp-user-guide-topology-provider:
+
+Topology Provider
+=================
+This section provides an overview of the BGP topology provider service.
+It shows how to configure and use all available BGP topology providers.
+Providers are building topology view of BGP routes stored in local BGP speaker's Loc-RIB.
+Output topologies are rendered in a form of standardised IETF network topology model.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Inet Reachability Topology
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+Inet reachability topology exporter offers a mapping service from IPv4/6 routes to network topology nodes.
+
+Configuration
+'''''''''''''
+Following example shows how to create a new instance of IPv4 BGP topology exporter:
+
+**URL:** ``/restconf/config/network-topology:network-topology``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,4,6
+
+   <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+       <topology-id>bgp-example-ipv4-topology</topology-id>
+       <topology-types>
+           <bgp-ipv4-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-ipv4-reachability-topology>
+       </topology-types>
+       <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">bgp-example</rib-id>
+   </topology>
+
+@line 2: An identifier for a topology.
+
+@line 4: Used to identify type of the topology. In this case BGP IPv4 reachability topology.
+
+@line 6: A name of the local BGP speaker instance.
+
+-----
+
+The topology exporter instance can be removed in a following way:
+
+**URL:** ``/restconf/config/network-topology:network-topology/topology/bgp-example-ipv4-topology``
+
+**Method:** ``DELETE``
+
+-----
+
+Following example shows how to create a new instance of IPv6 BGP topology exporter:
+
+**URL:** ``/restconf/config/network-topology:network-topology``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+       <topology-id>bgp-example-ipv6-topology</topology-id>
+       <topology-types>
+           <bgp-ipv6-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-ipv6-reachability-topology>
+       </topology-types>
+       <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">bgp-example</rib-id>
+   </topology>
+
+Usage
+'''''
+Operational state of the topology can be verified via REST:
+
+**URL:** ``/restconf/operational/network-topology:network-topology/topology/bgp-example-ipv4-topology``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 8,11
+
+   <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+       <topology-id>bgp-example-ipv4-topology</topology-id>
+       <server-provided>true</server-provided>
+       <topology-types>
+           <bgp-ipv4-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-ipv4-reachability-topology>
+       </topology-types>
+       <node>
+           <node-id>10.10.1.1</node-id>
+           <igp-node-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
+               <prefix>
+                   <prefix>10.0.0.10/32</prefix>
+               </prefix>
+           </igp-node-attributes>
+       </node>
+   </topology>
+
+@line 8: The identifier of a node in a topology. Its value is mapped from route's NEXT_HOP attribute.
+
+@line 11: The IP prefix attribute of the node. Its value is mapped from routes's destination IP prefix.
+
+BGP Linkstate Topology
+^^^^^^^^^^^^^^^^^^^^^^
+BGP linkstate topology exporter offers a mapping service from BGP-LS routes to network topology nodes and links.
+
+Configuration
+'''''''''''''
+Following example shows how to create a new instance of linkstate BGP topology exporter:
+
+**URL:** ``/restconf/config/network-topology:network-topology``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+
+   <topology  xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+       <topology-id>bgp-example-linkstate-topology</topology-id>
+       <topology-types>
+           <bgp-linkstate-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-linkstate-topology>
+       </topology-types>
+       <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">bgp-example</rib-id>
+   </topology>
+
+Usage
+'''''
+Operational state of the topology can be verified via REST.
+A sample output below represents a two node topology with two unidirectional links interconnecting those nodes.
+
+**URL:** ``/restconf/operational/network-topology:network-topology/topology/bgp-example-linkstate-topology``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+
+   <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+       <topology-id>bgp-example-linkstate-topology</topology-id>
+       <server-provided>true</server-provided>
+       <topology-types>
+           <bgp-linkstate-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"></bgp-linkstate-topology>
+       </topology-types>
+       <node>
+           <node-id>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0040</node-id>
+           <termination-point>
+               <tp-id>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.40</tp-id>
+               <igp-termination-point-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology"/>
+           </termination-point>
+           <igp-node-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
+               <prefix>
+                   <prefix>40.40.40.40/32</prefix>
+                   <metric>10</metric>
+               </prefix>
+               <prefix>
+                   <prefix>203.20.160.0/24</prefix>
+                   <metric>10</metric>
+               </prefix>
+               <name>node1</name>
+               <router-id>40.40.40.40</router-id>
+               <isis-node-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
+                   <ted>
+                       <te-router-id-ipv4>40.40.40.40</te-router-id-ipv4>
+                   </ted>
+                   <iso>
+                       <iso-system-id>MDAwMDAwMDAwMDY0</iso-system-id>
+                   </iso>
+               </isis-node-attributes>
+           </igp-node-attributes>
+       </node>
+       <node>
+           <node-id>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0039</node-id>
+           <termination-point>
+               <tp-id>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.39</tp-id>
+               <igp-termination-point-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology"/>
+           </termination-point>
+           <igp-node-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
+               <prefix>
+                   <prefix>39.39.39.39/32</prefix>
+                   <metric>10</metric>
+               </prefix>
+               <prefix>
+                   <prefix>203.20.160.0/24</prefix>
+                   <metric>10</metric>
+               </prefix>
+               <name>node2</name>
+               <router-id>39.39.39.39</router-id>
+               <isis-node-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
+                   <ted>
+                       <te-router-id-ipv4>39.39.39.39</te-router-id-ipv4>
+                   </ted>
+                   <iso>
+                       <iso-system-id>MDAwMDAwMDAwMDg3</iso-system-id>
+                   </iso>
+               </isis-node-attributes>
+           </igp-node-attributes>
+       </node>
+       <link>
+           <destination>
+               <dest-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0039</dest-node>
+               <dest-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.39</dest-tp>
+           </destination>
+           <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>
+           <source>
+               <source-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0040</source-node>
+               <source-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.40</source-tp>
+           </source>
+           <igp-link-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
+               <metric>10</metric>
+               <isis-link-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
+                   <ted>
+                       <color>0</color>
+                       <max-link-bandwidth>1250000.0</max-link-bandwidth>
+                       <max-resv-link-bandwidth>12500.0</max-resv-link-bandwidth>
+                       <te-default-metric>0</te-default-metric>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>0</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>1</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>2</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>3</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>4</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>5</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>6</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>7</priority>
+                       </unreserved-bandwidth>
+                   </ted>
+               </isis-link-attributes>
+           </igp-link-attributes>
+       </link>
+       <link>
+           <destination>
+               <dest-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0040</dest-node>
+               <dest-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.40</dest-tp>
+           </destination>
+           <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>
+           <source>
+               <source-node>bgpls://IsisLevel2:1/type=node&amp;as=65000&amp;domain=673720360&amp;router=0000.0000.0039</source-node>
+               <source-tp>bgpls://IsisLevel2:1/type=tp&amp;ipv4=203.20.160.39</source-tp>
+           </source>
+           <igp-link-attributes xmlns="urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology">
+               <metric>10</metric>
+               <isis-link-attributes xmlns="urn:TBD:params:xml:ns:yang:network:isis-topology">
+                   <ted>
+                       <color>0</color>
+                       <max-link-bandwidth>1250000.0</max-link-bandwidth>
+                       <max-resv-link-bandwidth>12500.0</max-resv-link-bandwidth>
+                       <te-default-metric>0</te-default-metric>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>0</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>1</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>2</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>3</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>4</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>5</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>6</priority>
+                       </unreserved-bandwidth>
+                       <unreserved-bandwidth>
+                           <bandwidth>12500.0</bandwidth>
+                           <priority>7</priority>
+                       </unreserved-bandwidth>
+                   </ted>
+               </isis-link-attributes>
+           </igp-link-attributes>
+       </link>
+   </topology>
+
+BGP Network Topology Configuration Loader
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+BGP Network Topology Configuration Loader allows user to define static initial
+configuration for a BGP protocol instance.
+This service will detect the creation of new configuration files following the
+pattern ``network-topology-*.xml`` under the path ``etc/opendaylight/bgpcep``.
+Once the file is processed, the defined configuration will be available from
+the configuration Data Store.
+
+.. note:: If the BGP topology instance is already present, no update or configuration will be applied.
+
+**PATH:** ``etc/opendaylight/bgpcep/network-topology-config.xml``
+
+.. code-block:: xml
+
+    <network-topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+        <topology>
+            <topology-id>example-ipv4-topology</topology-id>
+            <topology-types>
+                <bgp-ipv4-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"/>
+            </topology-types>
+            <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">example-bgp-rib</rib-id>
+        </topology>
+        <topology>
+            <topology-id>example-ipv6-topology</topology-id>
+            <topology-types>
+                <bgp-ipv6-reachability-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"/>
+            </topology-types>
+            <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">example-bgp-rib</rib-id>
+        </topology>
+        <topology>
+            <topology-id>example-linkstate-topology</topology-id>
+            <topology-types>
+                <bgp-linkstate-topology xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-types"/>
+            </topology-types>
+            <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-topology-config">example-bgp-rib</rib-id>
+        </topology>
+    </network-topology>
diff --git a/docs/bgp/bgp-user-guide-troubleshooting.rst b/docs/bgp/bgp-user-guide-troubleshooting.rst
new file mode 100644 (file)
index 0000000..7c41215
--- /dev/null
@@ -0,0 +1,51 @@
+.. _bgp-user-guide-troubleshooting:
+
+Troubleshooting
+===============
+This section offers advices in a case OpenDaylight BGP plugin is not working as expected.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+BGP is not working...
+^^^^^^^^^^^^^^^^^^^^^
+* First of all, ensure that all required features are installed, local and remote BGP configuration is correct.
+
+* Check OpenDaylight Karaf logs:
+
+From Karaf console:
+
+.. code-block:: console
+
+   log:tail
+
+or open log file: ``data/log/karaf.log``
+
+Possibly, a reason/hint for a cause of the problem can be found there.
+
+* Try to minimise effect of other OpenDaylight features, when searching for a reason of the problem.
+
+* Try to set DEBUG severity level for BGP logger via Karaf console commands, in order to collect more information:
+
+.. code-block:: console
+
+   log:set DEBUG org.opendaylight.protocol.bgp
+
+.. code-block:: console
+
+   log:set DEBUG org.opendaylight.bgpcep.bgp
+
+Bug reporting
+^^^^^^^^^^^^^
+Before you report a bug, check `BGPCEP Jira <https://jira.opendaylight.org/browse/BGPCEP-756?jql=project%20%3D%20BGPCEP%20AND%20component%20%3D%20BGP>`_ to ensure same/similar bug is not already filed there.
+
+Write an e-mail to bgpcep-users@lists.opendaylight.org and provide following information:
+
+#. State OpenDaylight version
+
+#. Describe your use-case and provide as much details related to BGP as possible
+
+#. Steps to reproduce
+
+#. Attach Karaf log files, optionally packet captures, REST input/output
diff --git a/docs/bgp/images/BGP_HA.png b/docs/bgp/images/BGP_HA.png
new file mode 100644 (file)
index 0000000..4557bf9
Binary files /dev/null and b/docs/bgp/images/BGP_HA.png differ
diff --git a/docs/bgp/images/BGP_HA_failure.png b/docs/bgp/images/BGP_HA_failure.png
new file mode 100644 (file)
index 0000000..2ce8672
Binary files /dev/null and b/docs/bgp/images/BGP_HA_failure.png differ
diff --git a/docs/bgp/images/BGP_HA_recovery.png b/docs/bgp/images/BGP_HA_recovery.png
new file mode 100644 (file)
index 0000000..800c4f0
Binary files /dev/null and b/docs/bgp/images/BGP_HA_recovery.png differ
diff --git a/docs/bgp/images/MultipleClustersIds.png b/docs/bgp/images/MultipleClustersIds.png
new file mode 100755 (executable)
index 0000000..8a1e4b4
Binary files /dev/null and b/docs/bgp/images/MultipleClustersIds.png differ
diff --git a/docs/bgp/images/bgp-app-pipeline.png b/docs/bgp/images/bgp-app-pipeline.png
new file mode 100644 (file)
index 0000000..3544e24
Binary files /dev/null and b/docs/bgp/images/bgp-app-pipeline.png differ
diff --git a/docs/bgp/images/bgp-pipeline.png b/docs/bgp/images/bgp-pipeline.png
new file mode 100644 (file)
index 0000000..493d2d2
Binary files /dev/null and b/docs/bgp/images/bgp-pipeline.png differ
diff --git a/docs/bgp/images/local-as.png b/docs/bgp/images/local-as.png
new file mode 100755 (executable)
index 0000000..b5c73ec
Binary files /dev/null and b/docs/bgp/images/local-as.png differ
diff --git a/docs/bgp/index.rst b/docs/bgp/index.rst
new file mode 100644 (file)
index 0000000..f7f516c
--- /dev/null
@@ -0,0 +1,30 @@
+.. _bgp-user-guide:
+
+BGP User Guide
+==============
+This guide contains information on how to use OpenDaylight Border Gateway Protocol (BGP) plugin.
+The user should learn about BGP basic concepts, supported capabilities, configuration and usage.
+
+.. toctree::
+   :maxdepth: 4
+
+   bgp-user-guide-overview
+   bgp-user-guide-supported-capabilities
+   bgp-user-guide-running-bgp
+   bgp-user-guide-config-concepts
+   bgp-user-guide-ip-unicast-family
+   bgp-user-guide-labeled-family
+   bgp-user-guide-l3vpn-family
+   bgp-user-guide-linkstate-family
+   bgp-user-guide-flowspec-family
+   bgp-user-guide-mvpn-family
+   bgp-user-guide-evpn-family
+   bgp-user-guide-route-target-family
+   bgp-user-guide-additional-path-capability
+   bgp-user-guide-route-refresh-capability
+   bgp-user-guide-operational-state
+   bgp-user-guide-high-availability
+   bgp-user-guide-topology-provider
+   bgp-user-guide-test-tools
+   bgp-user-guide-pmsi-attribute
+   bgp-user-guide-troubleshooting
diff --git a/docs/bmp/bgp-monitoring-protocol-user-guide-config-concepts.rst b/docs/bmp/bgp-monitoring-protocol-user-guide-config-concepts.rst
new file mode 100644 (file)
index 0000000..ce75583
--- /dev/null
@@ -0,0 +1,409 @@
+.. _bgp-monitoring-protocol-user-guide-config-concepts:
+
+BMP Monitoring Station
+======================
+The following section shows how to configure BMP basics, how to verify functionality and presents essential components of the plugin. Next samples demonstrate the plugin’s runtime configuration capability.
+
+The monitoring station is responsible for received BMP PDUs processing and storage.
+The default BMP server is listening at port *12345*.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+This section shows the way to configure the BMP monitoring station via REST API.
+
+Monitoring station configuration
+''''''''''''''''''''''''''''''''
+In order to change default's BMP monitoring station configuration, use following request.
+
+**URL:** ``/restconf/config/odl-bmp-monitor-config:odl-bmp-monitors/bmp-monitor-config/example-bmp-monitor``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 4,5
+
+   <bmp-monitor-config xmlns="urn:opendaylight:params:xml:ns:yang:bmp-monitor-config">
+      <monitor-id>example-bmp-monitor</monitor-id>
+      <server>
+         <binding-port>12345</binding-port>
+         <binding-address>0.0.0.0</binding-address>
+      </server>
+   </bmp-monitor-config>
+
+@line 4: **binding-port** - The BMP server listening port.
+
+@line 5: **binding-address** - The BMP server biding address.
+
+.. note:: User may create multiple BMP monitoring station instances at runtime.
+
+Active mode configuration
+'''''''''''''''''''''''''
+In order to enable active connection, use following request.
+
+**URL:** ``/restconf/config/odl-bmp-monitor-config:odl-bmp-monitors/bmp-monitor-config/example-bmp-monitor``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 8,9,10
+
+   <bmp-monitor-config xmlns="urn:opendaylight:params:xml:ns:yang:bmp-monitor-config">
+      <monitor-id>example-bmp-monitor</monitor-id>
+      <server>
+         <binding-port>12345</binding-port>
+         <binding-address>0.0.0.0</binding-address>
+      </server>
+      <monitored-router>
+         <address>192.0.2.2</address>
+         <port>1234</port>
+         <active>true</active>
+      </monitored-router>
+   </bmp-monitor-config>
+
+@line 8: **address** - The monitored router's IP address.
+
+@line 9: **port** - The monitored router's port.
+
+@line 10: **active** - Active mode set.
+
+.. note:: User may configure active session establishment for multiple monitored routers.
+
+MD5 authentication configuration
+''''''''''''''''''''''''''''''''
+In order to enable active connection, use following request.
+
+**URL:** ``/restconf/config/odl-bmp-monitor-config:odl-bmp-monitors/bmp-monitor-config/example-bmp-monitor``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 8,9
+
+   <bmp-monitor-config xmlns="urn:opendaylight:params:xml:ns:yang:bmp-monitor-config">
+      <monitor-id>example-bmp-monitor</monitor-id>
+      <server>
+         <binding-port>12345</binding-port>
+         <binding-address>0.0.0.0</binding-address>
+      </server>
+      <monitored-router>
+         <address>192.0.2.2</address>
+         <password>changeme</password>
+      </monitored-router>
+   </bmp-monitor-config>
+
+@line 8: **address** - The monitored router's IP address.
+
+@line 9: **password** - The TCP MD5 signature.
+
+BMP Monitors Configuration Loader
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+BMP Monitors Configuration Loader allows user to define static initial
+configuration for a BMP protocol instance.
+This service will detect the creation of new configuration files following the
+pattern ``odl-bmp-monitors-*.xml`` under the path ``etc/opendaylight/bgpcep``.
+Once the file is processed, the defined configuration will be available from
+the configuration Data Store.
+
+.. note:: If the BMP Monitor instance is already present, no update or configuration will be applied.
+
+**PATH:** ``etc/opendaylight/bgpcep/odl-bmp-monitors-config.xml``
+
+.. code-block:: xml
+
+    <odl-bmp-monitors xmlns="urn:opendaylight:params:xml:ns:yang:bmp-monitor-config">
+        <bmp-monitor-config>
+            <monitor-id>example-bmp-monitor</monitor-id>
+            <server>
+                <binding-port>12345</binding-port>
+                <binding-address>0.0.0.0</binding-address>
+            </server>
+        </bmp-monitor-config>
+    </odl-bmp-monitors>
+
+BMP Monitor Configuration Example
+'''''''''''''''''''''''''''''''''
+
+BGP provides a feature providing a BMP Monitor configuration file example.
+Once feature is installed defined configuration will be loaded and setup.
+
+.. code-block:: console
+
+   feature:install odl-bgpcep-bmp-config-example
+
+Collector DB Tree
+^^^^^^^^^^^^^^^^^
+
+.. code-block:: console
+
+   module: bmp-monitor
+      +--rw bmp-monitor
+         +--ro monitor* [monitor-id]
+            +--ro monitor-id    monitor-id
+            +--ro router* [router-id]
+               +--ro name?          string
+               +--ro description?   string
+               +--ro info?          string
+               +--ro router-id      router-id
+               +--ro status?        status
+               +--ro peer* [peer-id]
+                  +--ro peer-id                 rib:peer-id
+                  +--ro type                    peer-type
+                  x--ro distinguisher
+                  |  +--ro distinguisher-type?   distinguisher-type
+                  |  +--ro distinguisher?        string
+                  +--ro peer-distinguisher?     union
+                  +--ro address                 inet:ip-address
+                  +--ro as                      inet:as-number
+                  +--ro bgp-id                  inet:ipv4-address
+                  +--ro router-distinguisher?   string
+                  +--ro peer-session
+                  |  +--ro local-address      inet:ip-address
+                  |  +--ro local-port         inet:port-number
+                  |  +--ro remote-port        inet:port-number
+                  |  +--ro sent-open
+                  |  |  +--ro version?          protocol-version
+                  |  |  +--ro my-as-number?     uint16
+                  |  |  +--ro hold-timer        uint16
+                  |  |  +--ro bgp-identifier    inet:ipv4-address
+                  |  |  +--ro bgp-parameters*
+                  |  |     +--ro optional-capabilities*
+                  |  |        +--ro c-parameters
+                  |  |           +--ro as4-bytes-capability
+                  |  |           |  +--ro as-number?   inet:as-number
+                  |  |           +--ro bgp-extended-message-capability!
+                  |  |           +--ro multiprotocol-capability
+                  |  |           |  +--ro afi?    identityref
+                  |  |           |  +--ro safi?   identityref
+                  |  |           +--ro graceful-restart-capability
+                  |  |           |  +--ro restart-flags    bits
+                  |  |           |  +--ro restart-time     uint16
+                  |  |           |  +--ro tables* [afi safi]
+                  |  |           |     +--ro afi          identityref
+                  |  |           |     +--ro safi         identityref
+                  |  |           |     +--ro afi-flags    bits
+                  |  |           +--ro add-path-capability
+                  |  |           |  +--ro address-families*
+                  |  |           |     +--ro afi?            identityref
+                  |  |           |     +--ro safi?           identityref
+                  |  |           |     +--ro send-receive?   send-receive
+                  |  |           +--ro route-refresh-capability!
+                  |  +--ro received-open
+                  |  |  +--ro version?          protocol-version
+                  |  |  +--ro my-as-number?     uint16
+                  |  |  +--ro hold-timer        uint16
+                  |  |  +--ro bgp-identifier    inet:ipv4-address
+                  |  |  +--ro bgp-parameters*
+                  |  |     +--ro optional-capabilities*
+                  |  |        +--ro c-parameters
+                  |  |           +--ro as4-bytes-capability
+                  |  |           |  +--ro as-number?   inet:as-number
+                  |  |           +--ro bgp-extended-message-capability!
+                  |  |           +--ro multiprotocol-capability
+                  |  |           |  +--ro afi?    identityref
+                  |  |           |  +--ro safi?   identityref
+                  |  |           +--ro graceful-restart-capability
+                  |  |           |  +--ro restart-flags    bits
+                  |  |           |  +--ro restart-time     uint16
+                  |  |           |  +--ro tables* [afi safi]
+                  |  |           |     +--ro afi          identityref
+                  |  |           |     +--ro safi         identityref
+                  |  |           |     +--ro afi-flags    bits
+                  |  |           +--ro add-path-capability
+                  |  |           |  +--ro address-families*
+                  |  |           |     +--ro afi?            identityref
+                  |  |           |     +--ro safi?           identityref
+                  |  |           |     +--ro send-receive?   send-receive
+                  |  |           +--ro route-refresh-capability!
+                  |  +--ro information
+                  |  |  +--ro string-information*
+                  |  |     +--ro string-tlv
+                  |  |        +--ro string-info?   string
+                  |  +--ro status?            status
+                  |  +--ro timestamp-sec?     yang:timestamp
+                  |  +--ro timestamp-micro?   yang:timestamp
+                  +--ro stats
+                  |  +--ro rejected-prefixes?                 yang:counter32
+                  |  +--ro duplicate-prefix-advertisements?   yang:counter32
+                  |  +--ro duplicate-withdraws?               yang:counter32
+                  |  +--ro invalidated-cluster-list-loop?     yang:counter32
+                  |  +--ro invalidated-as-path-loop?          yang:counter32
+                  |  +--ro invalidated-originator-id?         yang:counter32
+                  |  +--ro invalidated-as-confed-loop?        yang:counter32
+                  |  +--ro adj-ribs-in-routes?                yang:gauge64
+                  |  +--ro loc-rib-routes?                    yang:gauge64
+                  |  +--ro per-afi-safi-adj-rib-in-routes
+                  |  |  +--ro afi-safi* [afi safi]
+                  |  |     +--ro afi      identityref
+                  |  |     +--ro safi     identityref
+                  |  |     +--ro count?   yang:gauge64
+                  |  +--ro per-afi-safi-loc-rib-routes
+                  |  |  +--ro afi-safi* [afi safi]
+                  |  |     +--ro afi      identityref
+                  |  |     +--ro safi     identityref
+                  |  |     +--ro count?   yang:gauge64
+                  |  +--ro updates-treated-as-withdraw?       yang:counter32
+                  |  +--ro prefixes-treated-as-withdraw?      yang:counter32
+                  |  +--ro duplicate-updates?                 yang:counter32
+                  |  +--ro timestamp-sec?                     yang:timestamp
+                  |  +--ro timestamp-micro?                   yang:timestamp
+                  +--ro pre-policy-rib
+                  |  +--ro tables* [afi safi]
+                  |     +--ro afi           identityref
+                  |     +--ro safi          identityref
+                  |     +--ro attributes
+                  |     |  +--ro uptodate?   boolean
+                  |     +--ro (routes)?
+                  +--ro post-policy-rib
+                  |  +--ro tables* [afi safi]
+                  |     +--ro afi           identityref
+                  |     +--ro safi          identityref
+                  |     +--ro attributes
+                  |     |  +--ro uptodate?   boolean
+                  |     +--ro (routes)?
+                  +--ro mirrors
+                     +--ro information?       bmp-msg:mirror-information-code
+                     +--ro timestamp-sec?     yang:timestamp
+                     +--ro timestamp-micro?   yang:timestamp
+
+
+Operations
+^^^^^^^^^^
+The BMP plugin offers view of collected routes and statistical information from monitored peers.
+To get top-level view of monitoring station:
+
+**URL:** ``/restconf/operational/bmp-monitor:bmp-monitor/monitor/example-bmp-monitor``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,5,11,12,13,14,15,17,20,21,22,27,33,50,53
+
+   <bmp-monitor xmlns="urn:opendaylight:params:xml:ns:yang:bmp-monitor">
+      <monitor>
+         <monitor-id>example-bmp-monitor</monitor-id>
+            <router>
+               <router-id>10.10.10.10</router-id>
+               <name>name</name>
+               <description>monitored-router</description>
+               <info>monitored router;</info>
+               <status>up</status>
+               <peer>
+                   <peer-id>20.20.20.20</peer-id>
+                   <address>20.20.20.20</address>
+                   <bgp-id>20.20.20.20</bgp-id>
+                   <as>65000</as>
+                   <type>global</type>
+                   <peer-session>
+                     <remote-port>1790</remote-port>
+                     <timestamp-sec>0</timestamp-sec>
+                     <status>up</status>
+                     <local-address>10.10.10.10</local-address>
+                     <local-port>2200</local-port>
+                     <received-open>
+                        <hold-timer>180</hold-timer>
+                        <my-as-number>65000</my-as-number>
+                        <bgp-identifier>20.20.20.20</bgp-identifier>
+                     </received-open>
+                     <sent-open>
+                        <hold-timer>180</hold-timer>
+                        <my-as-number>65000</my-as-number>
+                        <bgp-identifier>65000</bgp-identifier>
+                     </sent-open>
+                   </peer-session>
+                   <pre-policy-rib>
+                     <tables>
+                        <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
+                        <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
+                        <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
+                           <ipv4-route>
+                              <prefix>10.10.10.0/24</prefix>
+                              <attributes>
+                              ...
+                              </attributes>
+                           </ipv4-route>
+                        </ipv4-routes>
+                        <attributes>
+                           <uptodate>true</uptodate>
+                        </attributes>
+                     </tables>
+                   </pre-policy-rib>
+                   <post-policy-rib>
+                     ...
+                   </post-policy-rib>
+                   <stats>
+                     <timestamp-sec>0</timestamp-sec>
+                     <invalidated-cluster-list-loop>0</invalidated-cluster-list-loop>
+                     <duplicate-prefix-advertisements>0</duplicate-prefix-advertisements>
+                     <loc-rib-routes>100</loc-rib-routes>
+                     <duplicate-withdraws>0</duplicate-withdraws>
+                     <invalidated-as-confed-loop>0</invalidated-as-confed-loop>
+                     <adj-ribs-in-routes>10</adj-ribs-in-routes>
+                     <invalidated-as-path-loop>0</invalidated-as-path-loop>
+                     <invalidated-originator-id>0</invalidated-originator-id>
+                     <rejected-prefixes>8</rejected-prefixes>
+                  </stats>
+               </peer>
+         </router>
+      </monitor>
+   </bmp-monitor>
+
+@line 3: **monitor-id** - The BMP monitoring station instance identifier.
+
+@line 5: **router-id** - The monitored router IP address, serves as an identifier.
+
+@line 11: **peer-id** - The monitored peer's BGP identifier, serves a an identifier.
+
+@line 12: **address** - The IP address of the peer, associated with the TCP session.
+
+@line 13: **bgp-id** - The BGP Identifier of the peer.
+
+@line 14: **as** - The Autonomous System number of the peer.
+
+@line 15: **type** - Identifies type of the peer - *Global Instance*, *RD Instance* or *Local Instance*
+
+@line 17: **remote-port** - The peer's port number associated with TCP session.
+
+@line 20: **local-address** - The IP address of the monitored router associated with the peering TCP session.
+
+@line 21: **local-port** - The port number of the monitored router associated with the peering TCP session.
+
+@line 22: **received-open** - The full OPEN message received by monitored router from the peer.
+
+@line 27: **sent-open** - The full OPEN message send by monitored router to the peer.
+
+@line 33: **pre-policy-rib** - The Adj-RIB-In that contains unprocessed routing information.
+
+@line 50: **post-policy-rib** - The Post-Policy Ad-RIB-In that contains routes filtered by inbound policy.
+
+@line 53: **stats** - Contains various statistics, periodically updated by the router.
+
+-----
+
+* To view collected information from particular monitored router:
+      **URL:** ``/restconf/operational/bmp-monitor:bmp-monitor/monitor/example-bmp-monitor/router/10.10.10.10``
+
+* To view collected information from particular monitored peer:
+      **URL:** ``/restconf/operational/bmp-monitor:bmp-monitor/monitor/example-bmp-monitor/router/10.10.10.10/peer/20.20.20.20``
diff --git a/docs/bmp/bgp-monitoring-protocol-user-guide-overview.rst b/docs/bmp/bgp-monitoring-protocol-user-guide-overview.rst
new file mode 100644 (file)
index 0000000..83646ee
--- /dev/null
@@ -0,0 +1,56 @@
+.. _bgp-monitoring-protocol-user-guide-overview:
+
+Overview
+========
+This section provides high-level overview of the BMP plugin, OpenDaylight implementation and BMP usage for SDN.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+BGP Monitoring Protocol
+^^^^^^^^^^^^^^^^^^^^^^^
+The BGP Monitoring Protocol (BMP) serves to monitor BGP sessions.
+The BMP can be used to obtain route view instead of screen scraping.
+The BMP provides access to unprocessed routing information (Adj-RIB-In) and processed routes (applied inbound policy) of monitored router's peer.
+In addition, monitored router can provide periodic dump of statistics.
+
+The BMP runs over TCP.
+Both monitored router and monitoring station can be configured as active or passive party of the connection.
+The passive party listens at particular port.
+The router can be monitored by multiple monitoring stations.
+BMP messages are sent by monitored router only, monitoring station supposed to collect and process data received over BMP.
+
+.. figure:: ./images/bmp.png
+   :align: center
+   :alt: BMP
+
+   The BMP overview - Monitoring Station, Monitored Router and Monitored Peers.
+
+
+BMP in SDN
+^^^^^^^^^^
+The main concept of BMP is to monitor BGP sessions - monitoring station is aware of monitored peer's status, collects statistics and analyzes them in order to provide valuable information for network operators.
+
+Moreover, BMP provides provides peer RIBs visibility, without need to establish BGP sessions.
+Unprocessed routes may serve as a source of information for software-driven routing optimization.
+In this case, SDN controller, a BMP monitoring station, collects routing information from monitored routers.
+The routes are used in subsequent optimization procedures.
+
+
+OpenDaylight BMP plugin
+^^^^^^^^^^^^^^^^^^^^^^^
+The OpenDaylight BMP plugin provides monitoring station implementation.
+The plugin can establish BMP session with one or more monitored routers in order to collect routing and statistical information.
+
+* Runtime configurable monitoring station
+* Read-only routes and statistics view
+* Supports various routing information types
+
+.. figure:: ./images/bmp-plugin.png
+   :align: center
+   :alt: BMP plugin
+
+   OpenDaylight BMP plugin overview.
+
+.. important:: The BMP plugin is not storing historical data, it provides current snapshot only.
diff --git a/docs/bmp/bgp-monitoring-protocol-user-guide-running-bmp.rst b/docs/bmp/bgp-monitoring-protocol-user-guide-running-bmp.rst
new file mode 100644 (file)
index 0000000..3e58d26
--- /dev/null
@@ -0,0 +1,32 @@
+.. _bgp-monitoring-protocol-user-guide-running-bmp:
+
+Running BMP
+===========
+This section explains how to install BMP plugin.
+
+1. Install BMP feature - ``odl-bgpcep-bmp``.
+   Also, for sake of this sample, it is required to install RESTCONF.
+   In the Karaf console, type command:
+
+   .. code-block:: console
+
+      feature:install odl-restconf odl-bgpcep-bmp
+
+2. The BMP plugin contains a default configuration, which is applied after the feature starts up.
+   One instance of BMP monitoring station is created (named *example-bmp-monitor*), and its presence can be verified via REST:
+
+   **URL:** ``/restconf/config/odl-bmp-monitor-config:odl-bmp-monitors/bmp-monitor-config/example-bmp-monitor``
+
+   **Method:** ``GET``
+
+   **Response Body:**
+
+   .. code-block:: xml
+
+      <bmp-monitor-config xmlns="urn:opendaylight:params:xml:ns:yang:bmp-monitor-config">
+         <monitor-id>example-bmp-monitor</monitor-id>
+         <server>
+            <binding-port>12345</binding-port>
+            <binding-address>0.0.0.0</binding-address>
+         </server>
+      </bmp-monitor-config>
diff --git a/docs/bmp/bgp-monitoring-protocol-user-guide-supported-capabilities.rst b/docs/bmp/bgp-monitoring-protocol-user-guide-supported-capabilities.rst
new file mode 100644 (file)
index 0000000..7d8df87
--- /dev/null
@@ -0,0 +1,10 @@
+.. _bgp-monitoring-protocol-user-guide-supported-capabilities:
+
+List of supported capabilities
+==============================
+The BMP plugin implementation is based on Internet standards:
+
+* `RFC7854 <https://tools.ietf.org/html/rfc7854>`_ - BGP Monitoring Protocol (BMP)
+
+.. note:: The BMP plugin is capable to process various types of routing information (IP Unicast, EVPN, L3VPN, Link-State,...).
+   Please, see complete list in BGP user guide.
diff --git a/docs/bmp/bgp-monitoring-protocol-user-guide-test-tools.rst b/docs/bmp/bgp-monitoring-protocol-user-guide-test-tools.rst
new file mode 100644 (file)
index 0000000..bf5547b
--- /dev/null
@@ -0,0 +1,50 @@
+.. _bgp-monitoring-protocol-user-guide-test-tools:
+
+Test tools
+==========
+BMP test tool serves to test basic BMP functionality, scalability and performance.
+
+BMP mock
+^^^^^^^^
+The BMP mock is a stand-alone Java application purposed to simulate a BMP-enabled router(s) and peers.
+The simulator is capable to report dummy routes and statistics.
+This application is not part of the OpenDaylight Karaf distribution, however it can be downloaded from OpenDaylight's Nexus (use latest release version):
+
+``https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/bgpcep/bgp-bmp-mock``
+
+Usage
+'''''
+The application can be run from command line:
+
+.. code-block:: console
+
+   java -jar bgp-bmp-mock-*-executable.jar
+
+
+with optional input parameters:
+
+.. code-block:: console
+
+   --local_address <address> (optional, default 127.0.0.1)
+      The IPv4 address where BMP mock is bind to.
+
+   -ra <IP_ADDRESS:PORT,...>, --remote_address <IP_ADDRESS:PORT,...>
+      A list of IP addresses of BMP monitoring station, by default 127.0.0.1:12345.
+
+   --passive (optional, not present by default)
+      This flags enables passive mode for simulated routers.
+
+   --routers_count <0..N> (optional, default 1)
+       An amount of BMP routers to be connected to the BMP monitoring station.
+
+   --peers_count <0..N> (optional, default 0)
+      An amount of peers reported by each BMP router.
+
+   --pre_policy_routes <0..N> (optional, default 0)
+      An amount of "pre-policy" simple IPv4 routes reported by each peer.
+
+   --post_policy_routes <0..N> (optional, default 0)
+      An amount of "post-policy" simple IPv4 routes reported by each peer.
+
+   --log_level <FATAL|ERROR|INFO|DEBUG|TRACE> (optional, default INFO)
+      Set logging level for BMP mock.
diff --git a/docs/bmp/bgp-monitoring-protocol-user-guide-troubleshooting.rst b/docs/bmp/bgp-monitoring-protocol-user-guide-troubleshooting.rst
new file mode 100644 (file)
index 0000000..e26ae3c
--- /dev/null
@@ -0,0 +1,53 @@
+.. _bgp-monitoring-protocol-user-guide-troubleshooting:
+
+Troubleshooting
+===============
+This section offers advices in a case OpenDaylight BMP plugin is not working as expected.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+BMP is not working...
+^^^^^^^^^^^^^^^^^^^^^
+* First of all, ensure that all required features are installed, local monitoring station and monitored router/peers configuration is correct.
+
+  To list all installed features in OpenDaylight use the following command at the Karaf console:
+
+  .. code-block:: console
+
+     feature:list -i
+
+* Check OpenDaylight Karaf logs:
+
+  From Karaf console:
+
+  .. code-block:: console
+
+     log:tail
+
+  or open log file: ``data/log/karaf.log``
+
+  Possibly, a reason/hint for a cause of the problem can be found there.
+
+* Try to minimize effect of other OpenDaylight features, when searching for a reason of the problem.
+
+* Try to set DEBUG severity level for BMP logger via Karaf console commands, in order to collect more information:
+
+  .. code-block:: console
+
+     log:set DEBUG org.opendaylight.protocol.bmp
+
+Bug reporting
+^^^^^^^^^^^^^
+Before you report a bug, check `BGPCEP Jira <https://jira.opendaylight.org/projects/BGPCEP/issues/BGPCEP-589?filter=allopenissues>`_ to ensure same/similar bug is not already filed there.
+
+Write an e-mail to bgpcep-users@lists.opendaylight.org and provide following information:
+
+#. State OpenDaylight version
+
+#. Describe your use-case and provide as much details related to BMP as possible
+
+#. Steps to reproduce
+
+#. Attach Karaf log files, optionally packet captures, REST input/output
diff --git a/docs/bmp/images/bmp-plugin.png b/docs/bmp/images/bmp-plugin.png
new file mode 100644 (file)
index 0000000..dd36522
Binary files /dev/null and b/docs/bmp/images/bmp-plugin.png differ
diff --git a/docs/bmp/images/bmp.png b/docs/bmp/images/bmp.png
new file mode 100644 (file)
index 0000000..791eeae
Binary files /dev/null and b/docs/bmp/images/bmp.png differ
diff --git a/docs/bmp/index.rst b/docs/bmp/index.rst
new file mode 100644 (file)
index 0000000..91bb5ab
--- /dev/null
@@ -0,0 +1,16 @@
+.. _bgp-monitoring-protocol-user-guide:
+
+BGP Monitoring Protocol User Guide
+==================================
+This guide contains information on how to use the OpenDaylight BGP Monitoring Protocol (BMP) plugin.
+It covers BMP basic concepts, supported capabilities, configuration and operations.
+
+.. toctree::
+   :maxdepth: 1
+
+   bgp-monitoring-protocol-user-guide-overview
+   bgp-monitoring-protocol-user-guide-supported-capabilities
+   bgp-monitoring-protocol-user-guide-running-bmp
+   bgp-monitoring-protocol-user-guide-config-concepts
+   bgp-monitoring-protocol-user-guide-test-tools
+   bgp-monitoring-protocol-user-guide-troubleshooting
diff --git a/docs/images/bgpcep/PathAttributesSerialization.png b/docs/images/bgpcep/PathAttributesSerialization.png
new file mode 100644 (file)
index 0000000..d4cca7d
Binary files /dev/null and b/docs/images/bgpcep/PathAttributesSerialization.png differ
diff --git a/docs/images/bgpcep/RIB.png b/docs/images/bgpcep/RIB.png
new file mode 100644 (file)
index 0000000..3c834c9
Binary files /dev/null and b/docs/images/bgpcep/RIB.png differ
diff --git a/docs/images/bgpcep/bgp-dependency-tree.png b/docs/images/bgpcep/bgp-dependency-tree.png
new file mode 100644 (file)
index 0000000..987afed
Binary files /dev/null and b/docs/images/bgpcep/bgp-dependency-tree.png differ
diff --git a/docs/images/bgpcep/pcep-dependency-tree.png b/docs/images/bgpcep/pcep-dependency-tree.png
new file mode 100644 (file)
index 0000000..3bc6b23
Binary files /dev/null and b/docs/images/bgpcep/pcep-dependency-tree.png differ
diff --git a/docs/images/bgpcep/pcep-parsing.png b/docs/images/bgpcep/pcep-parsing.png
new file mode 100644 (file)
index 0000000..9c2f4f2
Binary files /dev/null and b/docs/images/bgpcep/pcep-parsing.png differ
diff --git a/docs/images/bgpcep/validation.png b/docs/images/bgpcep/validation.png
new file mode 100644 (file)
index 0000000..df4b65f
Binary files /dev/null and b/docs/images/bgpcep/validation.png differ
index 02fae6560e80bab1ea3e1e417b34c3f2f4fc15fd..4fc9abaf5c0c58c65cafc565de223992dee55cbe 100644 (file)
@@ -3,3 +3,27 @@
 ####################
 BGPCEP Documentation
 ####################
+
+This documentation provides critical information needed to help you write
+code for the BGPCEP project.
+
+
+Developer Guides
+-----------------
+
+.. toctree::
+   :maxdepth: 1
+
+   bgp-developer-guide
+   bgp-monitoring-protocol-developer-guide
+   pcep-developer-guide
+
+User Guides
+-----------
+
+.. toctree::
+   :maxdepth: 1
+
+   bgp/index
+   bmp/index
+   pcep/index
diff --git a/docs/pcep-developer-guide.rst b/docs/pcep-developer-guide.rst
new file mode 100644 (file)
index 0000000..18c7fa5
--- /dev/null
@@ -0,0 +1,337 @@
+.. _pcep-developer-guide:
+
+PCEP Developer Guide
+====================
+
+Overview
+--------
+
+This section provides an overview of **feature odl-bgpcep-pcep-all** .
+This feature will install everything needed for PCEP (Path Computation
+Element Protocol) including establishing the connection, storing
+information about LSPs (Label Switched Paths) and displaying data in
+network-topology overview.
+
+PCEP Architecture
+-----------------
+
+Each feature represents a module in the BGPCEP codebase. The following
+diagram illustrates how the features are related.
+
+.. figure:: ./images/bgpcep/pcep-dependency-tree.png
+   :alt: PCEP Dependency Tree
+
+   PCEP Dependency Tree
+
+Key APIs and Interfaces
+-----------------------
+
+PCEP
+~~~~
+
+Session handling
+^^^^^^^^^^^^^^^^
+
+*32-pcep.xml* defines only pcep-dispatcher the parser should be using
+(global-pcep-extensions), factory for creating session proposals (you
+can create different proposals for different PCCs (Path Computation
+Clients)).
+
+.. code:: xml
+
+     <module>
+      <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:impl">prefix:pcep-dispatcher-impl</type>
+      <name>global-pcep-dispatcher</name>
+      <pcep-extensions>
+       <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extensions</type>
+       <name>global-pcep-extensions</name>
+      </pcep-extensions>
+      <pcep-session-proposal-factory>
+       <type xmlns:pcep="urn:opendaylight:params:xml:ns:yang:controller:pcep">pcep:pcep-session-proposal-factory</type>
+       <name>global-pcep-session-proposal-factory</name>
+      </pcep-session-proposal-factory>
+      <boss-group>
+       <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-threadgroup</type>
+       <name>global-boss-group</name>
+      </boss-group>
+      <worker-group>
+       <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-threadgroup</type>
+       <name>global-worker-group</name>
+      </worker-group>
+     </module>
+
+For user configuration of PCEP, check User Guide.
+
+Parser
+^^^^^^
+
+The base PCEP parser includes messages and attributes from
+`RFC5441 <http://tools.ietf.org/html/rfc5441>`__,
+`RFC5541 <http://tools.ietf.org/html/rfc5541>`__,
+`RFC5455 <http://tools.ietf.org/html/rfc5455>`__,
+`RFC5557 <http://tools.ietf.org/html/rfc5557>`__ and
+`RFC5521 <http://tools.ietf.org/html/rfc5521>`__.
+
+Registration
+^^^^^^^^^^^^
+
+All parsers and serializers need to be registered into *Extension
+provider*. This *Extension provider* is configured in initial
+configuration of the parser-spi module (*32-pcep.xml*).
+
+.. code:: xml
+
+    <module>
+     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">prefix:pcep-extensions-impl</type>
+     <name>global-pcep-extensions</name>
+     <extension>
+      <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
+      <name>pcep-parser-base</name>
+     </extension>
+     <extension>
+      <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
+      <name>pcep-parser-ietf-stateful07</name>
+     </extension>
+     <extension>
+      <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
+      <name>pcep-parser-ietf-initiated00</name>
+     </extension>
+     <extension>
+      <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
+      <name>pcep-parser-sync-optimizations</name>
+     </extension>
+    </module>
+
+-  *pcep-parser-base* - will register parsers and serializers
+   implemented in pcep-impl module
+
+-  *pcep-parser-ietf-stateful07* - will register parsers and serializers
+   of draft-ietf-pce-stateful-pce-07 implementation
+
+-  *pcep-parser-ietf-initiated00* - will register parser and serializer
+   of draft-ietf-pce-pce-initiated-lsp-00 implementation
+
+-  *pcep-parser-sync-optimizations* - will register parser and
+   serializers of draft-ietf-pce-stateful-sync-optimizations-03
+   implementation
+
+Stateful07 module is a good example of a PCEP parser extension.
+
+Configuration of PCEP parsers specifies one implementation of *Extension
+provider* that will take care of registering mentioned parser
+extensions:
+`SimplePCEPExtensionProviderContext <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimplePCEPExtensionProviderContext.java;hb=refs/for/stable/boron>`__.
+All registries are implemented in package
+`pcep-spi <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=tree;f=pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo;hb=refs/for/stable/boron>`__.
+
+Parsing
+^^^^^^^
+
+Parsing of PCEP elements is mostly done equally to BGP, the only
+exception is message parsing, that is described here.
+
+In BGP messages, parsing of first-level elements (path-attributes) can
+be validated in a simple way, as the attributes should be ordered
+chronologically. PCEP, on the other hand, has a strict object order
+policy, that is described in RBNF (Routing Backus-Naur Form) in each
+RFC. Therefore the algorithm for parsing here is to parse all objects in
+order as they appear in the message. The result of parsing is a list of
+*PCEPObjects*, that is put through validation. *validate()* methods are
+present in each message parser. Depending on the complexity of the
+message, it can contain either a simple condition (checking the presence
+of a mandatory object) or a full state machine.
+
+In addition to that, PCEP requires sending error message for each
+documented parsing error. This is handled by creating an empty list of
+messages *errors* which is then passed as argument throughout whole
+parsing process. If some parser encounters *PCEPDocumentedException*, it
+has the duty to create appropriate PCEP error message and add it to this
+list. In the end, when the parsing is finished, this list is examined
+and all messages are sent to peer.
+
+Better understanding provides this sequence diagram:
+
+.. figure:: ./images/bgpcep/pcep-parsing.png
+   :alt: Parsing
+
+   Parsing
+
+PCEP IETF stateful
+~~~~~~~~~~~~~~~~~~
+
+This section summarizes module pcep-ietf-stateful07. The term *stateful*
+refers to
+`draft-ietf-pce-stateful-pce <http://tools.ietf.org/html/draft-ietf-pce-stateful-pce>`__
+and
+`draft-ietf-pce-pce-initiated-lsp <http://tools.ietf.org/html/draft-ietf-pce-pce-initiated-lsp>`__
+in versions draft-ietf-pce-stateful-pce-07 with
+draft-ietf-pce-pce-initiated-lsp-00.
+
+We will upgrade our implementation, when the stateful draft gets
+promoted to RFC.
+
+The stateful module is implemented as extensions to pcep-base-parser.
+The stateful draft declared new elements as well as additional fields or
+TLVs (type,length,value) to known objects. All new elements are defined
+in yang models, that contain augmentations to elements defined in
+`pcep-types.yang <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=pcep/api/src/main/yang/pcep-types.yang;hb=refs/for/stable/boron>`__.
+In the case of extending known elements, the *Parser* class merely
+extends the base class and overrides necessary methods as shown in
+following diagram:
+
+.. figure:: ./images/bgpcep/validation.png
+   :alt: Extending existing parsers
+
+   Extending existing parsers
+
+All parsers (including those for newly defined PCEP elements) have to be
+registered via the *Activator* class. This class is present in both
+modules.
+
+In addition to parsers, the stateful module also introduces additional
+session proposal. This proposal includes new fields defined in stateful
+drafts for Open object.
+
+PCEP segment routing (SR)
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+PCEP Segment Routing is an extension of base PCEP and
+pcep-ietf-stateful-07 extension. The pcep-segment-routing module
+implements
+`draft-ietf-pce-segment-routing-01 <http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01>`__.
+
+The extension brings new SR-ERO (Explicit Route Object) and SR-RRO
+(Reported Route Object) subobject composed of SID (Segment Identifier)
+and/or NAI (Node or Adjacency Identifier). The segment Routing path is
+carried in the ERO and RRO object, as a list of SR-ERO/SR-RRO subobjects
+in an order specified by the user. The draft defines new TLV -
+SR-PCE-CAPABILITY TLV, carried in PCEP Open object, used to negotiate
+Segment Routing ability.
+
+| The yang models of subobject, SR-PCE-CAPABILITY TLV and appropriate
+  augmentations are defined in
+  `odl-pcep-segment-routing.yang <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=pcep/segment-routing/src/main/yang/odl-pcep-segment-routing.yang;hb=refs/for/stable/boron>`__.
+| The pcep-segment-routing module includes parsers/serializers for new
+  subobject
+  (`SrEroSubobjectParser <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrEroSubobjectParser.java;hb=refs/for/stable/boron>`__)
+  and TLV
+  (`SrPceCapabilityTlvParser <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrPceCapabilityTlvParser.java;hb=refs/for/stable/boron>`__).
+
+The pcep-segment-routing module implements
+`draft-ietf-pce-lsp-setup-type-01 <http://tools.ietf.org/html/draft-ietf-pce-lsp-setup-type-01>`__,
+too. The draft defines new TLV - Path Setup Type TLV, which value
+indicate path setup signaling technique. The TLV may be included in
+RP(Request Parameters)/SRP(Stateful PCE Request Parameters) object. For
+the default RSVP-TE (Resource Reservation Protocol), the TLV is omitted.
+For Segment Routing, PST = 1 is defined.
+
+The Path Setup Type TLV is modeled with yang in module
+`pcep-types.yang <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=pcep/api/src/main/yang/pcep-types.yang;hb=refs/for/stable/boron>`__.
+A parser/serializer is implemented in
+`PathSetupTypeTlvParser <https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=blob;f=pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/tlv/PathSetupTypeTlvParser.java;hb=refs/for/stable/boron>`__
+and it is overriden in segment-routing module to provide the aditional
+PST.
+
+PCEP Synchronization Procedures Optimization
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Optimizations of Label Switched Path State Synchronization Procedures
+for a Stateful PCE draft-ietf-pce-stateful-sync-optimizations-03
+specifies following optimizations for state synchronization and the
+corresponding PCEP procedures and extensions:
+
+-  **State Synchronization Avoidance:** To skip state synchronization if
+   the state has survived and not changed during session restart.
+
+-  **Incremental State Synchronization:** To do incremental (delta)
+   state synchronization when possible.
+
+-  **PCE-triggered Initial Synchronization:** To let PCE control the
+   timing of the initial state synchronization. The capability can be
+   applied to both full and incremental state synchronization.
+
+-  **PCE-triggered Re-synchronization:** To let PCE re-synchronize the
+   state for sanity check.
+
+PCEP Topology
+~~~~~~~~~~~~~
+
+PCEP data is displayed only through one URL that is accessible from the
+base network-topology URL:
+
+*http://localhost:8181/restconf/operational/network-topology:network-topology/topology/pcep-topology*
+
+Each PCC will be displayed as a node:
+
+.. code:: xml
+
+    <node>
+     <path-computation-client>
+      <ip-address>42.42.42.42</ip-address>
+      <state-sync>synchronized</state-sync>
+      <stateful-tlv>
+       <stateful>
+        <initiation>true</initiation>
+        <lsp-update-capability>true</lsp-update-capability>
+       </stateful>
+      </stateful-tlv>
+     </path-computation-client>
+     <node-id>pcc://42.42.42.42</node-id>
+    </node>
+    </source>
+
+If some tunnels are configured on the network, they would be displayed
+on the same page, within a node that initiated the tunnel:
+
+.. code:: xml
+
+    <node>
+     <path-computation-client>
+      <state-sync>synchronized</state-sync>
+      <stateful-tlv>
+       <stateful>
+        <initiation>true</initiation>
+        <lsp-update-capability>true</lsp-update-capability>
+       </stateful>
+      </stateful-tlv>
+      <reported-lsp>
+       <name>foo</name>
+       <lsp>
+        <operational>down</operational>
+        <sync>false</sync>
+        <ignore>false</ignore>
+        <plsp-id>1</plsp-id>
+        <create>false</create>
+        <administrative>true</administrative>
+        <remove>false</remove>
+        <delegate>true</delegate>
+        <processing-rule>false</processing-rule>
+        <tlvs>
+        <lsp-identifiers>
+          <ipv4>
+           <ipv4-tunnel-sender-address>43.43.43.43</ipv4-tunnel-sender-address>
+           <ipv4-tunnel-endpoint-address>0.0.0.0</ipv4-tunnel-endpoint-address>
+           <ipv4-extended-tunnel-id>0.0.0.0</ipv4-extended-tunnel-id>
+          </ipv4>
+          <tunnel-id>0</tunnel-id>
+          <lsp-id>0</lsp-id>
+         </lsp-identifiers>
+         <symbolic-path-name>
+          <path-name>Zm9v</path-name>
+         </symbolic-path-name>
+        </tlvs>
+       </lsp>
+      </reported-lsp>
+      <ip-address>43.43.43.43</ip-address>
+     </path-computation-client>
+     <node-id>pcc://43.43.43.43</node-id>
+    </node>
+
+Note that, the *<path-name>* tag displays tunnel name in Base64
+encoding.
+
+API Reference Documentation
+---------------------------
+
+Javadocs are generated while creating mvn:site and they are located in
+target/ directory in each module.
diff --git a/docs/pcep/images/pcep-delegation-return.png b/docs/pcep/images/pcep-delegation-return.png
new file mode 100644 (file)
index 0000000..05f7058
Binary files /dev/null and b/docs/pcep/images/pcep-delegation-return.png differ
diff --git a/docs/pcep/images/pcep-deletion.png b/docs/pcep/images/pcep-deletion.png
new file mode 100644 (file)
index 0000000..ec69358
Binary files /dev/null and b/docs/pcep/images/pcep-deletion.png differ
diff --git a/docs/pcep/images/pcep-initiate.png b/docs/pcep/images/pcep-initiate.png
new file mode 100644 (file)
index 0000000..ca26a2c
Binary files /dev/null and b/docs/pcep/images/pcep-initiate.png differ
diff --git a/docs/pcep/images/pcep-plugin.png b/docs/pcep/images/pcep-plugin.png
new file mode 100644 (file)
index 0000000..2a4a0cb
Binary files /dev/null and b/docs/pcep/images/pcep-plugin.png differ
diff --git a/docs/pcep/images/pcep-re-sync.png b/docs/pcep/images/pcep-re-sync.png
new file mode 100644 (file)
index 0000000..f7269de
Binary files /dev/null and b/docs/pcep/images/pcep-re-sync.png differ
diff --git a/docs/pcep/images/pcep-revoke-delegation.png b/docs/pcep/images/pcep-revoke-delegation.png
new file mode 100644 (file)
index 0000000..9782006
Binary files /dev/null and b/docs/pcep/images/pcep-revoke-delegation.png differ
diff --git a/docs/pcep/images/pcep-sync-incremental.png b/docs/pcep/images/pcep-sync-incremental.png
new file mode 100644 (file)
index 0000000..cce0719
Binary files /dev/null and b/docs/pcep/images/pcep-sync-incremental.png differ
diff --git a/docs/pcep/images/pcep-sync-initial.png b/docs/pcep/images/pcep-sync-initial.png
new file mode 100644 (file)
index 0000000..b3f5aa4
Binary files /dev/null and b/docs/pcep/images/pcep-sync-initial.png differ
diff --git a/docs/pcep/images/pcep-sync-skipped.png b/docs/pcep/images/pcep-sync-skipped.png
new file mode 100644 (file)
index 0000000..493412c
Binary files /dev/null and b/docs/pcep/images/pcep-sync-skipped.png differ
diff --git a/docs/pcep/images/pcep-sync.png b/docs/pcep/images/pcep-sync.png
new file mode 100644 (file)
index 0000000..d3ac54e
Binary files /dev/null and b/docs/pcep/images/pcep-sync.png differ
diff --git a/docs/pcep/images/pcep-update.png b/docs/pcep/images/pcep-update.png
new file mode 100644 (file)
index 0000000..e9d9be9
Binary files /dev/null and b/docs/pcep/images/pcep-update.png differ
diff --git a/docs/pcep/images/pcep.png b/docs/pcep/images/pcep.png
new file mode 100644 (file)
index 0000000..08568da
Binary files /dev/null and b/docs/pcep/images/pcep.png differ
diff --git a/docs/pcep/index.rst b/docs/pcep/index.rst
new file mode 100644 (file)
index 0000000..59bf603
--- /dev/null
@@ -0,0 +1,19 @@
+.. _pcep-user-guide:
+
+PCEP User Guide
+===============
+This guide contains information on how to use the OpenDaylight Path Computation Element Configuration Protocol (PCEP) plugin.
+The user should learn about PCEP basic concepts, supported capabilities, configuration and operations.
+
+
+.. toctree::
+   :maxdepth: 1
+
+   pcep-user-guide-overview
+   pcep-user-guide-supported-capabilities
+   pcep-user-guide-running-pcep
+   pcep-user-guide-active-stateful-pce
+   pcep-user-guide-session-statistics
+   pcep-user-guide-cli
+   pcep-user-guide-test-tools
+   pcep-user-guide-troubleshooting
diff --git a/docs/pcep/pcep-user-guide-active-stateful-pce.rst b/docs/pcep/pcep-user-guide-active-stateful-pce.rst
new file mode 100644 (file)
index 0000000..da6c70f
--- /dev/null
@@ -0,0 +1,1099 @@
+.. _pcep-user-guide-active-stateful-pce:
+
+Active Stateful PCE
+===================
+The PCEP extension for Stateful PCE brings a visibility of active LSPs to PCE, in order to optimize path computation, while considering individual LSPs and their interactions.
+This requires state synchronization mechanism between PCE and PCC.
+Moreover, Active Stateful PCE is capable to address LSP parameter changes to the PCC.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Configuration
+^^^^^^^^^^^^^
+This capability is enabled by default. No additional configuration is required.
+
+Speaker Entity identifier
+'''''''''''''''''''''''''
+The Speaker Entity Identifier is an optional
+TLV that may be included in the OPEN Object when a PCEP speaker
+wishes to determine if state synchronization can be skipped when a
+PCEP session is restarted.
+
+**URL:** ``/restconf/config/network-topology:network-topology/topology/pcep-topology/node/43.43.43.43``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,4
+
+
+    <node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+        <node-id>43.43.43.43</node-id>
+        <session-config xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep:config">
+            <speaker-entity-id-value xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep:sync:optimizations:config">AQIDBA==</speaker-entity-id-value>
+        </session-config>
+    </node>
+
+@line 2: **address** - A PCC IP address.
+
+@line 4: **Speaker Entity Identifier** - The Speaker Entity identifier assigned to PCEP Node.
+
+MD5 authentication configuration
+''''''''''''''''''''''''''''''''
+The OpenDaylight PCEP implementation supports TCP MD5 for authentication.
+The sample configuration below shows how to set authentication password for a particular PCC.
+
+**URL:** ``/restconf/config/network-topology:network-topology/topology/pcep-topology/node/43.43.43.43``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,4
+
+
+    <node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+        <node-id>43.43.43.43</node-id>
+        <session-config xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep:config">
+            <password>topsecret</password>
+        </session-config>
+    </node>
+
+@line 2: **address** - A PCC IP address.
+
+@line 4: **password** - MD5 authentication phrase.
+
+LSP State Database
+^^^^^^^^^^^^^^^^^^
+The *LSP State Database* (LSP-DB) contains an information about all LSPs and their attributes.
+The LSP state is synchronized between the PCC and PCE.
+First, initial LSP state synchronization is performed once the session between PCC and PCE is established in order to learn PCC's LPSs.
+This step is a prerequisite to following LSPs manipulation operations.
+
+
+.. figure:: ./images/pcep-sync.png
+   :align: center
+   :alt: LSP State synchronization
+
+   LSP State Synchronization.
+
+LSP-DB API
+''''''''''
+
+.. code-block:: console
+
+   path-computation-client
+      +--ro reported-lsp* [name]
+         +--ro name        string
+         +--ro path* [lsp-id]
+         |  +--ro lsp-id                      rsvp:lsp-id
+         |  +--ro ero
+         |  |  +--ro processing-rule?   boolean
+         |  |  +--ro ignore?            boolean
+         |  |  +--ro subobject*
+         |  |     +--ro loose         boolean
+         |  |     +--ro (subobject-type)?
+         |  |        +--:(as-number-case)
+         |  |        |  +--ro as-number
+         |  |        |     +--ro as-number    inet:as-number
+         |  |        +--:(ip-prefix-case)
+         |  |        |  +--ro ip-prefix
+         |  |        |     +--ro ip-prefix    inet:ip-prefix
+         |  |        +--:(label-case)
+         |  |        |  +--ro label
+         |  |        |     +--ro uni-directional             boolean
+         |  |        |     +--ro (label-type)?
+         |  |        |        +--:(type1-label-case)
+         |  |        |        |  +--ro type1-label
+         |  |        |        |     +--ro type1-label    uint32
+         |  |        |        +--:(generalized-label-case)
+         |  |        |        |  +--ro generalized-label
+         |  |        |        |     +--ro generalized-label    binary
+         |  |        |        +--:(waveband-switching-label-case)
+         |  |        |           +--ro waveband-switching-label
+         |  |        |              +--ro end-label      uint32
+         |  |        |              +--ro start-label    uint32
+         |  |        |              +--ro waveband-id    uint32
+         |  |        +--:(srlg-case)
+         |  |        |  +--ro srlg
+         |  |        |     +--ro srlg-id    srlg-id
+         |  |        +--:(unnumbered-case)
+         |  |        |  +--ro unnumbered
+         |  |        |     +--ro router-id       uint32
+         |  |        |     +--ro interface-id    uint32
+         |  |        +--:(exrs-case)
+         |  |        |  +--ro exrs
+         |  |        |     +--ro exrs*
+         |  |        |        +--ro mandatory?    boolean
+         |  |        |        +--ro attribute     enumeration
+         |  |        |        +--ro (subobject-type)?
+         |  |        |           +--:(as-number-case)
+         |  |        |           |  +--ro as-number
+         |  |        |           |     +--ro as-number    inet:as-number
+         |  |        |           +--:(ip-prefix-case)
+         |  |        |           |  +--ro ip-prefix
+         |  |        |           |     +--ro ip-prefix    inet:ip-prefix
+         |  |        |           +--:(label-case)
+         |  |        |           |  +--ro label
+         |  |        |           |     +--ro uni-directional             boolean
+         |  |        |           |     +--ro (label-type)?
+         |  |        |           |        +--:(type1-label-case)
+         |  |        |           |        |  +--ro type1-label
+         |  |        |           |        |     +--ro type1-label    uint32
+         |  |        |           |        +--:(generalized-label-case)
+         |  |        |           |        |  +--ro generalized-label
+         |  |        |           |        |     +--ro generalized-label    binary
+         |  |        |           |        +--:(waveband-switching-label-case)
+         |  |        |           |           +--ro waveband-switching-label
+         |  |        |           |              +--ro end-label      uint32
+         |  |        |           |              +--ro start-label    uint32
+         |  |        |           |              +--ro waveband-id    uint32
+         |  |        |           +--:(srlg-case)
+         |  |        |           |  +--ro srlg
+         |  |        |           |     +--ro srlg-id    srlg-id
+         |  |        |           +--:(unnumbered-case)
+         |  |        |              +--ro unnumbered
+         |  |        |                 +--ro router-id       uint32
+         |  |        |                 +--ro interface-id    uint32
+         |  |        +--:(path-key-case)
+         |  |           +--ro path-key
+         |  |              +--ro pce-id      pce-id
+         |  |              +--ro path-key    path-key
+         |  +--ro lspa
+         |  |  +--ro processing-rule?            boolean
+         |  |  +--ro ignore?                     boolean
+         |  |  +--ro hold-priority?              uint8
+         |  |  +--ro setup-priority?             uint8
+         |  |  +--ro local-protection-desired?   boolean
+         |  |  +--ro label-recording-desired?    boolean
+         |  |  +--ro se-style-desired?           boolean
+         |  |  +--ro session-name?               string
+         |  |  +--ro include-any?                attribute-filter
+         |  |  +--ro exclude-any?                attribute-filter
+         |  |  +--ro include-all?                attribute-filter
+         |  |  +--ro tlvs
+         |  |     +--ro vendor-information-tlv*
+         |  |        +--ro enterprise-number?   iana:enterprise-number
+         |  |        +--ro (enterprise-specific-information)?
+         |  +--ro bandwidth
+         |  |  +--ro processing-rule?   boolean
+         |  |  +--ro ignore?            boolean
+         |  |  +--ro bandwidth?         netc:bandwidth
+         |  +--ro reoptimization-bandwidth
+         |  |  +--ro processing-rule?   boolean
+         |  |  +--ro ignore?            boolean
+         |  |  +--ro bandwidth?         netc:bandwidth
+         |  +--ro metrics*
+         |  |  +--ro metric
+         |  |     +--ro processing-rule?   boolean
+         |  |     +--ro ignore?            boolean
+         |  |     +--ro metric-type        uint8
+         |  |     +--ro bound?             boolean
+         |  |     +--ro computed?          boolean
+         |  |     +--ro value?             ieee754:float32
+         |  +--ro iro
+         |  |  +--ro processing-rule?   boolean
+         |  |  +--ro ignore?            boolean
+         |  |  +--ro subobject*
+         |  |     +--ro loose         boolean
+         |  |     +--ro (subobject-type)?
+         |  |        +--:(as-number-case)
+         |  |        |  +--ro as-number
+         |  |        |     +--ro as-number    inet:as-number
+         |  |        +--:(ip-prefix-case)
+         |  |        |  +--ro ip-prefix
+         |  |        |     +--ro ip-prefix    inet:ip-prefix
+         |  |        +--:(label-case)
+         |  |        |  +--ro label
+         |  |        |     +--ro uni-directional             boolean
+         |  |        |     +--ro (label-type)?
+         |  |        |        +--:(type1-label-case)
+         |  |        |        |  +--ro type1-label
+         |  |        |        |     +--ro type1-label    uint32
+         |  |        |        +--:(generalized-label-case)
+         |  |        |        |  +--ro generalized-label
+         |  |        |        |     +--ro generalized-label    binary
+         |  |        |        +--:(waveband-switching-label-case)
+         |  |        |           +--ro waveband-switching-label
+         |  |        |              +--ro end-label      uint32
+         |  |        |              +--ro start-label    uint32
+         |  |        |              +--ro waveband-id    uint32
+         |  |        +--:(srlg-case)
+         |  |        |  +--ro srlg
+         |  |        |     +--ro srlg-id    srlg-id
+         |  |        +--:(unnumbered-case)
+         |  |        |  +--ro unnumbered
+         |  |        |     +--ro router-id       uint32
+         |  |        |     +--ro interface-id    uint32
+         |  |        +--:(exrs-case)
+         |  |        |  +--ro exrs
+         |  |        |     +--ro exrs*
+         |  |        |        +--ro mandatory?    boolean
+         |  |        |        +--ro attribute     enumeration
+         |  |        |        +--ro (subobject-type)?
+         |  |        |           +--:(as-number-case)
+         |  |        |           |  +--ro as-number
+         |  |        |           |     +--ro as-number    inet:as-number
+         |  |        |           +--:(ip-prefix-case)
+         |  |        |           |  +--ro ip-prefix
+         |  |        |           |     +--ro ip-prefix    inet:ip-prefix
+         |  |        |           +--:(label-case)
+         |  |        |           |  +--ro label
+         |  |        |           |     +--ro uni-directional             boolean
+         |  |        |           |     +--ro (label-type)?
+         |  |        |           |        +--:(type1-label-case)
+         |  |        |           |        |  +--ro type1-label
+         |  |        |           |        |     +--ro type1-label    uint32
+         |  |        |           |        +--:(generalized-label-case)
+         |  |        |           |        |  +--ro generalized-label
+         |  |        |           |        |     +--ro generalized-label    binary
+         |  |        |           |        +--:(waveband-switching-label-case)
+         |  |        |           |           +--ro waveband-switching-label
+         |  |        |           |              +--ro end-label      uint32
+         |  |        |           |              +--ro start-label    uint32
+         |  |        |           |              +--ro waveband-id    uint32
+         |  |        |           +--:(srlg-case)
+         |  |        |           |  +--ro srlg
+         |  |        |           |     +--ro srlg-id    srlg-id
+         |  |        |           +--:(unnumbered-case)
+         |  |        |              +--ro unnumbered
+         |  |        |                 +--ro router-id       uint32
+         |  |        |                 +--ro interface-id    uint32
+         |  |        +--:(path-key-case)
+         |  |           +--ro path-key
+         |  |              +--ro pce-id      pce-id
+         |  |              +--ro path-key    path-key
+         |  +--ro rro
+         |  |  +--ro processing-rule?   boolean
+         |  |  +--ro ignore?            boolean
+         |  |  +--ro subobject*
+         |  |     +--ro protection-available?   boolean
+         |  |     +--ro protection-in-use?      boolean
+         |  |     +--ro (subobject-type)?
+         |  |        +--:(ip-prefix-case)
+         |  |        |  +--ro ip-prefix
+         |  |        |     +--ro ip-prefix    inet:ip-prefix
+         |  |        +--:(label-case)
+         |  |        |  +--ro label
+         |  |        |     +--ro uni-directional             boolean
+         |  |        |     +--ro (label-type)?
+         |  |        |     |  +--:(type1-label-case)
+         |  |        |     |  |  +--ro type1-label
+         |  |        |     |  |     +--ro type1-label    uint32
+         |  |        |     |  +--:(generalized-label-case)
+         |  |        |     |  |  +--ro generalized-label
+         |  |        |     |  |     +--ro generalized-label    binary
+         |  |        |     |  +--:(waveband-switching-label-case)
+         |  |        |     |     +--ro waveband-switching-label
+         |  |        |     |        +--ro end-label      uint32
+         |  |        |     |        +--ro start-label    uint32
+         |  |        |     |        +--ro waveband-id    uint32
+         |  |        |     +--ro global?                     boolean
+         |  |        +--:(unnumbered-case)
+         |  |        |  +--ro unnumbered
+         |  |        |     +--ro router-id       uint32
+         |  |        |     +--ro interface-id    uint32
+         |  |        +--:(path-key-case)
+         |  |           +--ro path-key
+         |  |              +--ro pce-id      pce-id
+         |  |              +--ro path-key    path-key
+         |  +--ro xro
+         |  |  +--ro processing-rule?   boolean
+         |  |  +--ro ignore?            boolean
+         |  |  +--ro flags              bits
+         |  |  +--ro subobject*
+         |  |     +--ro mandatory?    boolean
+         |  |     +--ro attribute     enumeration
+         |  |     +--ro (subobject-type)?
+         |  |        +--:(as-number-case)
+         |  |        |  +--ro as-number
+         |  |        |     +--ro as-number    inet:as-number
+         |  |        +--:(ip-prefix-case)
+         |  |        |  +--ro ip-prefix
+         |  |        |     +--ro ip-prefix    inet:ip-prefix
+         |  |        +--:(label-case)
+         |  |        |  +--ro label
+         |  |        |     +--ro uni-directional             boolean
+         |  |        |     +--ro (label-type)?
+         |  |        |        +--:(type1-label-case)
+         |  |        |        |  +--ro type1-label
+         |  |        |        |     +--ro type1-label    uint32
+         |  |        |        +--:(generalized-label-case)
+         |  |        |        |  +--ro generalized-label
+         |  |        |        |     +--ro generalized-label    binary
+         |  |        |        +--:(waveband-switching-label-case)
+         |  |        |           +--ro waveband-switching-label
+         |  |        |              +--ro end-label      uint32
+         |  |        |              +--ro start-label    uint32
+         |  |        |              +--ro waveband-id    uint32
+         |  |        +--:(srlg-case)
+         |  |        |  +--ro srlg
+         |  |        |     +--ro srlg-id    srlg-id
+         |  |        +--:(unnumbered-case)
+         |  |           +--ro unnumbered
+         |  |              +--ro router-id       uint32
+         |  |              +--ro interface-id    uint32
+         |  +--ro of
+         |  |  +--ro processing-rule?   boolean
+         |  |  +--ro ignore?            boolean
+         |  |  +--ro code               of-id
+         |  |  +--ro tlvs
+         |  |     +--ro vendor-information-tlv*
+         |  |        +--ro enterprise-number?   iana:enterprise-number
+         |  |        +--ro (enterprise-specific-information)?
+         |  +--ro class-type
+         |     +--ro processing-rule?   boolean
+         |     +--ro ignore?            boolean
+         |     +--ro class-type         class-type
+         +--ro metadata
+         +--ro lsp
+         |  +--ro processing-rule?   boolean
+         |  +--ro ignore?            boolean
+         |  +--ro tlvs
+         |  |  +--ro lsp-error-code
+         |  |  |  +--ro error-code?   uint32
+         |  |  +--ro lsp-identifiers
+         |  |  |  +--ro lsp-id?      rsvp:lsp-id
+         |  |  |  +--ro tunnel-id?   rsvp:tunnel-id
+         |  |  |  +--ro (address-family)?
+         |  |  |     +--:(ipv4-case)
+         |  |  |     |  +--ro ipv4
+         |  |  |     |     +--ro ipv4-tunnel-sender-address      inet:ipv4-address
+         |  |  |     |     +--ro ipv4-extended-tunnel-id         rsvp:ipv4-extended-tunnel-id
+         |  |  |     |     +--ro ipv4-tunnel-endpoint-address    inet:ipv4-address
+         |  |  |     +--:(ipv6-case)
+         |  |  |        +--ro ipv6
+         |  |  |           +--ro ipv6-tunnel-sender-address      inet:ipv6-address
+         |  |  |           +--ro ipv6-extended-tunnel-id         rsvp:ipv6-extended-tunnel-id
+         |  |  |           +--ro ipv6-tunnel-endpoint-address    inet:ipv6-address
+         |  |  +--ro rsvp-error-spec
+         |  |  |  +--ro (error-type)?
+         |  |  |     +--:(rsvp-case)
+         |  |  |     |  +--ro rsvp-error
+         |  |  |     +--:(user-case)
+         |  |  |        +--ro user-error
+         |  |  +--ro symbolic-path-name
+         |  |  |  +--ro path-name?   symbolic-path-name
+         |  |  o--ro vs-tlv
+         |  |  |  +--ro enterprise-number?   iana:enterprise-number
+         |  |  |  +--ro (vendor-payload)?
+         |  |  +--ro vendor-information-tlv*
+         |  |  |  +--ro enterprise-number?   iana:enterprise-number
+         |  |  |  +--ro (enterprise-specific-information)?
+         |  |  +--ro path-binding
+         |  |     x--ro binding-type?      uint8
+         |  |     x--ro binding-value?     binary
+         |  |     +--ro (binding-type-value)?
+         |  |        +--:(mpls-label)
+         |  |        |  +--ro mpls-label?        netc:mpls-label
+         |  |        +--:(mpls-label-entry)
+         |  |           +--ro label?             netc:mpls-label
+         |  |           +--ro traffic-class?     uint8
+         |  |           +--ro bottom-of-stack?   boolean
+         |  |           +--ro time-to-live?      uint8
+         |  +--ro plsp-id?           plsp-id
+         |  +--ro delegate?          boolean
+         |  +--ro sync?              boolean
+         |  +--ro remove?            boolean
+         |  +--ro administrative?    boolean
+         |  +--ro operational?       operational-status
+         +--ro path-setup-type
+            +--ro pst?   uint8
+
+-----
+
+The LSP-DB is accessible via RESTCONF.
+The PCC's LSPs are stored in the ``pcep-topology`` while the session is active.
+In a next example, there is one PCEP session with PCC identified by its IP address (*43.43.43.43*) and one reported LSP (*foo*).
+
+**URL:** ``/restconf/operational/network-topology:network-topology/topology/pcep-topology/node/pcc:%2F%2F43.43.43.43``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,4,5,8,12,14,15,16,17,18,20,24,25,26,28,29,32,36
+
+   <node>
+      <node-id>pcc://43.43.43.43</node-id>
+      <path-computation-client>
+         <ip-address>43.43.43.43</ip-address>
+         <state-sync>synchronized</state-sync>
+         <stateful-tlv>
+            <stateful>
+               <lsp-update-capability>true</lsp-update-capability>
+            </stateful>
+         </stateful-tlv>
+         <reported-lsp>
+            <name>foo</name>
+            <lsp>
+               <operational>up</operational>
+               <sync>true</sync>
+               <plsp-id>1</plsp-id>
+               <create>false</create>
+               <administrative>true</administrative>
+               <remove>false</remove>
+               <delegate>true</delegate>
+               <tlvs>
+                  <lsp-identifiers>
+                     <ipv4>
+                        <ipv4-tunnel-sender-address>43.43.43.43</ipv4-tunnel-sender-address>
+                        <ipv4-tunnel-endpoint-address>39.39.39.39</ipv4-tunnel-endpoint-address>
+                        <ipv4-extended-tunnel-id>39.39.39.39</ipv4-extended-tunnel-id>
+                     </ipv4>
+                     <tunnel-id>1</tunnel-id>
+                     <lsp-id>1</lsp-id>
+                  </lsp-identifiers>
+                  <symbolic-path-name>
+                     <path-name>Zm9v</path-name>
+                  </symbolic-path-name>
+               </tlvs>
+            </lsp>
+            <ero>
+               <subobject>
+                  <loose>false</loose>
+                  <ip-prefix>
+                     <ip-prefix>201.20.160.40/32</ip-prefix>
+                  </ip-prefix>
+               </subobject>
+               <subobject>
+                  <loose>false</loose>
+                  <ip-prefix>
+                     <ip-prefix>195.20.160.39/32</ip-prefix>
+                  </ip-prefix>
+               </subobject>
+               <subobject>
+                  <loose>false</loose>
+                  <ip-prefix>
+                     <ip-prefix>39.39.39.39/32</ip-prefix>
+                  </ip-prefix>
+               </subobject>
+            </ero>
+         </reported-lsp>
+      </path-computation-client>
+   </node>
+
+@line 2: **node-id** The PCC identifier.
+
+@line 4: **ip-address** IP address of the PCC.
+
+@line 5: **state-sync** Synchronization status of the PCC's LSPs. The *synchronized* indicates the State Synchronization is done.
+
+@line 8: **lsp-update-capability** - Indicates that PCC allows LSP modifications.
+
+@line 12: **name** - Textual representation of LPS's name.
+
+@line 14: **operational** - Represent operational status of the LSP:
+
+   * *down* - not active.
+   * *up* - signaled.
+   * *active* - up and carrying traffic.
+   * *going-down* - LSP is being torn down, resources are being released.
+   * *going-up* - LSP is being signaled.
+
+@line 15: **sync** - The flag set by PCC during LSPs State Synchronization.
+
+@line 16: **plsp-id** - A PCEP-specific identifier for the LSP. It is assigned by PCC and it is constant for a lifetime of a PCEP session.
+
+@line 17: **create** - The *false* indicates that LSP is PCC-initiated.
+
+@line 18: **administrative** - The flag indicates target operational status of the LSP.
+
+@line 20: **delegate** - The delegate flag indicates that the PCC is delegating the LSP to the PCE.
+
+@line 24: **ipv4-tunnel-sender-address** - Contains the sender node's IP address.
+
+@line 25: **ipv4-tunnel-endpoint-address** - Contains the egress node's IP address.
+
+@line 26: **ipv4-extended-tunnel-id** - The *Extended Tunnel ID* identifier.
+
+@line 28: **tunnel-id** - The *Tunnel ID* identifier.
+
+@line 29: **lsp-id** - The *LSP ID* identifier.
+
+@line 32: **path-name** - The symbolic name for the LSP.
+
+@line 36: **ero** - The *Explicit Route Object* is encoding the path of the TE LSP through the network.
+
+LSP Delegation
+''''''''''''''
+The LSP control delegations is an mechanism, where PCC grants to a PCE the temporary right in order to modify LSP attributes.
+The PCC can revoke the delegation or the PCE may waive the delegation at any time.
+The LSP control is delegated to at most one PCE at the same time.
+
+.. figure:: ./images/pcep-delegation-return.png
+   :align: center
+   :alt: Returning a Delegation
+
+   Returning a Delegation.
+
+-----
+
+Following RPC example illustrates a request for the LSP delegation give up:
+
+**URL:** ``/restconf/operations/network-topology-pcep:update-lsp``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,3,6,10
+
+   <input>
+      <node>pcc://43.43.43.43</node>
+      <name>foo</name>
+      <arguments>
+         <lsp xmlns:stateful="urn:opendaylight:params:xml:ns:yang:pcep:ietf:stateful">
+            <delegate>false</delegate>
+            <administrative>true</administrative>
+            <tlvs>
+               <symbolic-path-name>
+                  <path-name>Zm9v</path-name>
+               </symbolic-path-name>
+            </tlvs>
+         </lsp>
+      </arguments>
+      <network-topology-ref xmlns:topo="urn:TBD:params:xml:ns:yang:network-topology">/topo:network-topology/topo:topology[topo:topology-id="pcep-topology"]</network-topology-ref>
+   </input>
+
+@line 2: **node** The PCC identifier.
+
+@line 3: **name** The name of the LSP.
+
+@line 6: **delegate** - Delegation flag set *false* in order to return the LSP delegation.
+
+@line 10: **path-name** - The Symbolic Path Name TLV must be present when sending a request to give up the delegation.
+
+LSP Update
+''''''''''
+The LSP Update Request is an operation where a PCE requests a PCC to update attributes of an LSP and to rebuild the LSP with updated attributes.
+In order to update LSP, the PCE must hold a LSP delegation.
+The LSP update is done in *make-before-break* fashion - first, new LSP is initiated and then the old LSP is torn down.
+
+.. figure:: ./images/pcep-update.png
+   :align: center
+   :alt: Active Stateful PCE LSP Update
+
+   Active Stateful PCE LSP Update.
+
+-----
+
+Following RPC example shows a request for the LSP update:
+
+**URL:** ``/restconf/operations/network-topology-pcep:update-lsp``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,3,6,7,9
+
+   <input xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep">
+      <node>pcc://43.43.43.43</node>
+      <name>foo</name>
+      <arguments>
+         <lsp xmlns="urn:opendaylight:params:xml:ns:yang:pcep:ietf:stateful">
+            <delegate>true</delegate>
+            <administrative>true</administrative>
+         </lsp>
+         <ero>
+            <subobject>
+               <loose>false</loose>
+               <ip-prefix>
+                  <ip-prefix>200.20.160.41/32</ip-prefix>
+               </ip-prefix>
+            </subobject>
+            <subobject>
+               <loose>false</loose>
+               <ip-prefix>
+                  <ip-prefix>196.20.160.39/32</ip-prefix>
+               </ip-prefix>
+            </subobject>
+            <subobject>
+               <loose>false</loose>
+               <ip-prefix>
+                  <ip-prefix>39.39.39.39/32</ip-prefix>
+               </ip-prefix>
+            </subobject>
+         </ero>
+      </arguments>
+      <network-topology-ref xmlns:topo="urn:TBD:params:xml:ns:yang:network-topology">/topo:network-topology/topo:topology[topo:topology-id="pcep-topology"]</network-topology-ref>
+   </input>
+
+@line 2: **node** The PCC identifier.
+
+@line 3: **name** The name of the LSP to be updated.
+
+@line 6: **delegate** - Delegation flag set *true* in order to keep the LSP control.
+
+@line 7: **administrative** - Desired administrative status of the LSP is active.
+
+@line 9: **ero** - This LSP attribute is changed.
+
+PCE-initiated LSP Setup
+^^^^^^^^^^^^^^^^^^^^^^^
+The PCEP Extension for PCE-initiated LSP Setup allows PCE to request a creation and deletion of LSPs.
+
+Configuration
+'''''''''''''
+This capability is enabled by default. No additional configuration is required.
+
+LSP Instantiation
+'''''''''''''''''
+The PCE can request LSP creation.
+The LSP instantiation is done by sending an LSP Initiate Message to PCC.
+The PCC assign delegation to PCE which triggered creation.
+PCE-initiated LSPs are identified by *Create* flag.
+
+.. figure:: ./images/pcep-initiate.png
+   :align: center
+   :alt: LSP instantiation
+
+   LSP instantiation.
+
+-----
+
+Following RPC example shows a request for the LSP initiation:
+
+**URL:** ``/restconf/operations/network-topology-pcep:add-lsp``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,3,8,14
+
+   <input xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep">
+      <node>pcc://43.43.43.43</node>
+      <name>update-tunel</name>
+         <arguments>
+            <lsp xmlns="urn:opendaylight:params:xml:ns:yang:pcep:ietf:stateful">
+               <delegate>true</delegate>
+               <administrative>true</administrative>
+            </lsp>
+            <endpoints-obj>
+               <ipv4>
+                  <source-ipv4-address>43.43.43.43</source-ipv4-address>
+                  <destination-ipv4-address>39.39.39.39</destination-ipv4-address>
+               </ipv4>
+            </endpoints-obj>
+            <ero>
+               <subobject>
+                  <loose>false</loose>
+                  <ip-prefix>
+                     <ip-prefix>201.20.160.40/32</ip-prefix>
+                  </ip-prefix>
+               </subobject>
+               <subobject>
+                  <loose>false</loose>
+                  <ip-prefix>
+                     <ip-prefix>195.20.160.39/32</ip-prefix>
+                  </ip-prefix>
+               </subobject>
+               <subobject>
+                  <loose>false</loose>
+                  <ip-prefix>
+                     <ip-prefix>39.39.39.39/32</ip-prefix>
+                  </ip-prefix>
+               </subobject>
+            </ero>
+         </arguments>
+      <network-topology-ref xmlns:topo="urn:TBD:params:xml:ns:yang:network-topology">/topo:network-topology/topo:topology[topo:topology-id="pcep-topology"]</network-topology-ref>
+   </input>
+
+@line 2: **node** The PCC identifier.
+
+@line 3: **name** The name of the LSP to be created.
+
+@line 8: **endpoints-obj** - The *END-POINT* Object is mandatory for an instantiation request of an RSVP-signaled LSP. It contains source and destination addresses for provisioning the LSP.
+
+@line 14: **ero** - The *ERO* object is mandatory for LSP initiation request.
+
+LSP Deletion
+''''''''''''
+The PCE may request a deletion of PCE-initiated LSPs.
+The PCE must be delegation holder for this particular LSP.
+
+.. figure:: ./images/pcep-deletion.png
+   :align: center
+   :alt: LSP deletion.
+
+   LSP deletion.
+
+-----
+
+Following RPC example shows a request for the LSP deletion:
+
+**URL:** ``/restconf/operations/network-topology-pcep:remove-lsp``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,3
+
+   <input xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep">
+      <node>pcc://43.43.43.43</node>
+      <name>update-tunel</name>
+      <network-topology-ref xmlns:topo="urn:TBD:params:xml:ns:yang:network-topology">/topo:network-topology/topo:topology[topo:topology-id="pcep-topology"]</network-topology-ref>
+   </input>
+
+@line 2: **node** The PCC identifier.
+
+@line 3: **name** The name of the LSP to be removed.
+
+PCE-initiated LSP Delegation
+''''''''''''''''''''''''''''
+The PCE-initiated LSP control is delegated to the PCE which requested the initiation.
+The PCC cannot revoke delegation of PCE-initiated LSP.
+When PCE returns delegation for such LSP or PCE fails, then the LSP become orphan and can be removed by a PCC after some time.
+The PCE may ask for a delegation of the orphan LSP.
+
+.. figure:: ./images/pcep-revoke-delegation.png
+   :align: center
+   :alt: LSP re-delegation
+
+   Orphan PCE-initiated LSP - control taken by PCE.
+
+-----
+
+Following RPC example illustrates a request for the LSP delegation:
+
+**URL:** ``/restconf/operations/network-topology-pcep:update-lsp``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,3,6,10
+
+   <input>
+      <node>pcc://43.43.43.43</node>
+      <name>update-tunel</name>
+      <arguments>
+         <lsp xmlns:stateful="urn:opendaylight:params:xml:ns:yang:pcep:ietf:stateful">
+            <delegate>true</delegate>
+            <administrative>true</administrative>
+            <tlvs>
+               <symbolic-path-name>
+                  <path-name>dXBkYXRlLXR1bmVs</path-name>
+               </symbolic-path-name>
+            </tlvs>
+         </lsp>
+      </arguments>
+      <network-topology-ref xmlns:topo="urn:TBD:params:xml:ns:yang:network-topology">/topo:network-topology/topo:topology[topo:topology-id="pcep-topology"]</network-topology-ref>
+   </input>
+
+@line 2: **node** The PCC identifier.
+
+@line 3: **name** The name of the LSP.
+
+@line 6: **delegate** - *Delegation* flag set *true* in order to take the LSP delegation.
+
+@line 10: **path-name** - The *Symbolic Path Name* TLV must be present when sending a request to take a delegation.
+
+Segment Routing
+^^^^^^^^^^^^^^^
+The PCEP Extensions for Segment Routing (SR) allow a stateful PCE to compute and initiate TE paths in SR networks.
+The SR path is defined as an order list  of *segments*.
+Segment Routing architecture can be directly applied to the MPLS forwarding plane without changes.
+Segment Identifier (SID) is encoded as a MPLS label.
+
+Configuration
+'''''''''''''
+This capability is enabled by default. In order to disable it, a configuration should be changed as follows:
+
+**URL:** ``/restconf/config/pcep-segment-routing-app-config:pcep-segment-routing-app-config``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2
+
+   <pcep-segment-routing-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:pcep:segment-routing-app-config">
+      <sr-capable>false</sr-capable>
+   </pcep-segment-routing-config>
+
+@line 2: **sr-capable** - True if capability is supported.
+
+IANA code points
+''''''''''''''''
+
+In PCEP-SR draft version 6, SR Explicit Route Object/Record Route Object subobjects IANA code points change was proposed.
+In order to use the latest code points, a configuration should be changed as follows:
+
+**URL:** ``/restconf/config/pcep-segment-routing-app-config:pcep-segment-routing-config``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2
+
+   <pcep-segment-routing-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:pcep:segment-routing-app-config">
+      <iana-sr-subobjects-type>true</iana-sr-subobjects-type>
+   </pcep-segment-routing-config>
+
+@line 2: **iana-sr-subobjects-type** - True if IANA code points should be used.
+
+LSP Operations for PCEP SR
+''''''''''''''''''''''''''
+The PCEP SR extension defines new ERO subobject - *SR-ERO subobject* capable of carrying a SID.
+
+.. code-block:: console
+
+   sr-ero-type
+      +---- c-flag?                boolean
+      +---- m-flag?                boolean
+      +---- sid-type?              sid-type
+      +---- sid?                   uint32
+      +---- (nai)?
+         +--:(ip-node-id)
+         |  +---- ip-address             inet:ip-address
+         +--:(ip-adjacency)
+         |  +---- local-ip-address       inet:ip-address
+         |  +---- remote-ip-address      inet:ip-address
+         +--:(unnumbered-adjacency)
+            +---- local-node-id          uint32
+            +---- local-interface-id     uint32
+            +---- remote-node-id         uint32
+            +---- remote-interface-id    uint32
+
+-----
+
+Following RPC example illustrates a request for the SR-TE LSP creation:
+
+**URL:** ``/restconf/operations/network-topology-pcep:add-lsp``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 16,21,22,23
+
+   <input xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep">
+      <node>pcc://43.43.43.43</node>
+      <name>sr-path</name>
+      <arguments>
+         <lsp xmlns="urn:opendaylight:params:xml:ns:yang:pcep:ietf:stateful">
+            <delegate>true</delegate>
+            <administrative>true</administrative>
+         </lsp>
+         <endpoints-obj>
+            <ipv4>
+               <source-ipv4-address>43.43.43.43</source-ipv4-address>
+               <destination-ipv4-address>39.39.39.39</destination-ipv4-address>
+            </ipv4>
+         </endpoints-obj>
+         <path-setup-type xmlns="urn:opendaylight:params:xml:ns:yang:pcep:ietf:stateful">
+            <pst>1</pst>
+         </path-setup-type>
+         <ero>
+            <subobject>
+               <loose>false</loose>
+               <sid-type xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">ipv4-node-id</sid-type>
+               <m-flag xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">true</m-flag>
+               <sid xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">24001</sid>
+               <ip-address xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">39.39.39.39</ip-address>
+           </subobject>
+         </ero>
+      </arguments>
+      <network-topology-ref xmlns:topo="urn:TBD:params:xml:ns:yang:network-topology">/topo:network-topology/topo:topology[topo:topology-id="pcep-topology"]</network-topology-ref>
+   </input>
+
+@line 16: **path-setup-type** - Set *1* for SR-TE LSP
+
+@line 21: **ipv4-node-id** - The SR-ERO subobject represents *IPv4 Node ID* NAI.
+
+@line 22: **m-flag** - The SID value represents an MPLS label.
+
+@line 23: **sid** - The Segment Identifier.
+
+-----
+
+Following RPC example illustrates a request for the SR-TE LSP update including modified path:
+
+**URL:** ``/restconf/operations/network-topology-pcep:update-lsp``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+
+   <input xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep">
+      <node>pcc://43.43.43.43</node>
+      <name>update-tunnel</name>
+      <arguments>
+         <lsp xmlns="urn:opendaylight:params:xml:ns:yang:pcep:ietf:stateful">
+            <delegate>true</delegate>
+            <administrative>true</administrative>
+         </lsp>
+         <path-setup-type xmlns="urn:opendaylight:params:xml:ns:yang:pcep:ietf:stateful">
+            <pst>1</pst>
+         </path-setup-type>
+         <ero>
+            <subobject>
+               <loose>false</loose>
+               <sid-type xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">ipv4-node-id</sid-type>
+               <m-flag xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">true</m-flag>
+               <sid xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">24002</sid>
+               <ip-address xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">200.20.160.41</ip-address>
+            </subobject>
+            <subobject>
+               <loose>false</loose>
+               <sid-type xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">ipv4-node-id</sid-type>
+               <m-flag xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">true</m-flag>
+               <sid xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">24001</sid>
+               <ip-address xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">39.39.39.39</ip-address>
+            </subobject>
+         </ero>
+      </arguments>
+      <network-topology-ref xmlns:topo="urn:TBD:params:xml:ns:yang:network-topology">/topo:network-topology/topo:topology[topo:topology-id="pcep-topology"]</network-topology-ref>
+   </input>
+
+LSP State Synchronization Optimization Procedures
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+This extension bring optimizations for state synchronization:
+
+* State Synchronization Avoidance
+* Incremental State Synchronization
+* PCE-triggered Initial Synchronization
+* PCE-triggered Re-synchronization
+
+Configuration
+'''''''''''''
+This capability is enabled by default. No additional configuration is required.
+
+State Synchronization Avoidance
+'''''''''''''''''''''''''''''''
+The State Synchronization Avoidance procedure is intended to skip state synchronization if the state has survived and not changed during session restart.
+
+.. figure:: ./images/pcep-sync-skipped.png
+   :align: center
+   :alt: Sync skipped
+
+   State Synchronization Skipped.
+
+Incremental State Synchronization
+'''''''''''''''''''''''''''''''''
+The Incremental State Synchronization procedure is intended to do incremental (delta) state synchronization when possible.
+
+.. figure:: ./images/pcep-sync-incremental.png
+   :align: center
+   :alt: Sync incremental
+
+   Incremental Synchronization Procedure.
+
+PCE-triggered Initial Synchronization
+'''''''''''''''''''''''''''''''''''''
+The PCE-triggered Initial Synchronization procedure is intended to do let PCE control the timing of the initial state synchronization.
+
+.. figure:: ./images/pcep-sync-initial.png
+   :align: center
+   :alt: Initial Sync
+
+   PCE-triggered Initial State Synchronization Procedure.
+
+-----
+
+Following RPC example illustrates a request for the initial synchronization:
+
+**URL:** ``/restconf/operations/network-topology-pcep:trigger-sync``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+
+   <input xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep">
+      <node>pcc://43.43.43.43</node>
+      <network-topology-ref xmlns:topo="urn:TBD:params:xml:ns:yang:network-topology">/topo:network-topology/topo:topology[topo:topology-id="pcep-topology"]</network-topology-ref>
+   </input>
+
+PCE-triggered Re-synchronization
+''''''''''''''''''''''''''''''''
+The PCE-triggered Re-synchronization: To let PCE re-synchronize the state for sanity check.
+
+.. figure:: ./images/pcep-re-sync.png
+   :align: center
+   :alt: Re-sync
+
+   PCE-triggered Re-synchronization Procedure.
+
+-----
+
+Following RPC example illustrates a request for the LSP re-synchronization:
+
+**URL:** ``/restconf/operations/network-topology-pcep:trigger-sync``
+
+**Method:** ``POST``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3
+
+   <input xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep">
+      <node>pcc://43.43.43.43</node>
+      <name>update-lsp</name>
+      <network-topology-ref xmlns:topo="urn:TBD:params:xml:ns:yang:network-topology">/topo:network-topology/topo:topology[topo:topology-id="pcep-topology"]</network-topology-ref>
+   </input>
+
+@line 3: **name** - The LSP name. If this parameter is omitted, re-synchronization is requested for all PCC's LSPs.
diff --git a/docs/pcep/pcep-user-guide-cli.rst b/docs/pcep/pcep-user-guide-cli.rst
new file mode 100644 (file)
index 0000000..468ae75
--- /dev/null
@@ -0,0 +1,10 @@
+.. _pcep-user-guide-cli:
+
+CLI
+===
+PCEP Karaf Console (odl-bgpcep-pcep-cli) provides a CLI feature to read session statistics per node.
+
+.. code-block:: bash
+   :linenos:
+
+   opendaylight-user@root> pcep:node-state -topology-id pcep-topology -node-id pcc://43.43.43.43
diff --git a/docs/pcep/pcep-user-guide-overview.rst b/docs/pcep/pcep-user-guide-overview.rst
new file mode 100644 (file)
index 0000000..a6fb26b
--- /dev/null
@@ -0,0 +1,55 @@
+.. _pcep-user-guide-overview:
+
+Overview
+========
+This section provides a high-level overview of the PCEP, SDN use-cases and OpenDaylight implementation.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+Path Computation Element Communication Protocol
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+The Path Computation Element (PCE) Communication Protocol (PCEP) is used for communication between a Path Computation Client (PCC) and a PCE in context of MPLS and GMPLS Traffic Engineering (TE) Label Switched Paths (LSPs).
+This interaction include path computation requests and computation replies.
+The PCE operates on a network graph, built from the (Traffic Engineering Database) TED, in order to compute paths based on the path computation request issued by the PCC.
+The path computation request includes the source and destination of the path and set of constrains to be applied during the computation.
+The PCE response contains the computed path or the computation failure reason.
+The PCEP operates on top the TCP, which provides reliable communication.
+
+.. figure:: ./images/pcep.png
+   :align: center
+   :alt: PCEP
+
+   PCE-based architecture.
+
+PCEP in SDN
+^^^^^^^^^^^
+The Path Computation Element perfectly fits into the centralized SDN controller architecture.
+The PCE's knowledge of the availability of network resources (i.e. TED) and active LSPs awareness (LSP-DB) allows to perform automated application-driven network operations:
+
+* LSP Re-optimization
+* Resource defragmentation
+* Link failure restoration
+* Auto-bandwidth adjustment
+* Bandwidth scheduling
+* Shared Risk Link Group (SRLG) diversity maintenance
+
+OpenDaylight PCEP plugin
+^^^^^^^^^^^^^^^^^^^^^^^^
+The OpenDaylight PCEP plugin provides all basic service units necessary to build-up a PCE-based controller.
+In addition, it offers LSP management functionality for Active Stateful PCE - the cornerstone for majority of PCE-enabled SDN solutions.
+It consists of the following components:
+
+* Protocol library
+* PCEP session handling
+* Stateful PCE LSP-DB
+* Active Stateful PCE LSP Operations
+
+.. figure:: ./images/pcep-plugin.png
+   :align: center
+   :alt: PCEP plugin
+
+   OpenDaylight PCEP plugin overview.
+
+.. important:: The PCEP plugin does not provide path computational functionality and does not build TED.
diff --git a/docs/pcep/pcep-user-guide-running-pcep.rst b/docs/pcep/pcep-user-guide-running-pcep.rst
new file mode 100644 (file)
index 0000000..4c20798
--- /dev/null
@@ -0,0 +1,31 @@
+.. _pcep-user-guide-running-pcep:
+
+Running PCEP
+============
+This section explains how to install PCEP plugin.
+
+1. Install PCEP feature - ``odl-bgpcep-pcep``.
+   Also, for sake of this sample, it is required to install RESTCONF.
+   In the Karaf console, type command:
+
+   .. code-block:: console
+
+      feature:install odl-restconf odl-bgpcep-pcep
+
+2. The PCEP plugin contains a default configuration, which is applied after the feature starts up.
+   One instance of PCEP plugin is created (named *pcep-topology*), and its presence can be verified via REST:
+
+   **URL:** ``restconf/operational/network-topology:network-topology/topology/pcep-topology``
+
+   **Method:** ``GET``
+
+   **Response Body:**
+
+   .. code-block:: xml
+
+      <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+          <topology-id>pcep-topology</topology-id>
+          <topology-types>
+              <topology-pcep xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep"></topology-pcep>
+          </topology-types>
+      </topology>
diff --git a/docs/pcep/pcep-user-guide-session-statistics.rst b/docs/pcep/pcep-user-guide-session-statistics.rst
new file mode 100644 (file)
index 0000000..f40236f
--- /dev/null
@@ -0,0 +1,114 @@
+.. _pcep-user-guide-session-statistics:
+
+Session statistics
+==================
+The PCEP statistics provides information about PCE <-> PCC session and its stateful listener (topology-provider).
+
+Usage
+'''''
+
+**URL:** ``/restconf/operational/network-topology:network-topology/topology/pcep-topology/node/pcc:%2F%2F43.43.43.43/pcep-session-state``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 3,4,5,6,7,8,9,10,13,14,15,16,19,20,21,22,25,26,27,28,31,32,33,35,36,37
+
+   <pcep-session-state xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep:stats">
+      <messages>
+         <last-received-rpt-msg-timestamp xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">1512640592</last-received-rpt-msg-timestamp>
+         <sent-upd-msg-count xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">0</sent-upd-msg-count>
+         <received-rpt-msg-count xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">2</received-rpt-msg-count>
+         <sent-init-msg-count xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">0</sent-init-msg-count>
+         <sent-msg-count>0</sent-msg-count>
+         <last-sent-msg-timestamp>0</last-sent-msg-timestamp>
+         <unknown-msg-received>0</unknown-msg-received>
+         <received-msg-count>2</received-msg-count>
+         <error-messages>
+            <last-sent-error></last-sent-error>
+            <received-error-msg-count>0</received-error-msg-count>
+            <sent-error-msg-count>0</sent-error-msg-count>
+            <last-received-error></last-received-error>
+         </error-messages>
+         <reply-time>
+            <average-time>0</average-time>
+            <min-time>0</min-time>
+            <max-time>0</max-time>
+         </reply-time>
+      </messages>
+      <peer-pref>
+         <keepalive>30</keepalive>
+         <deadtimer>120</deadtimer>
+         <ip-address>127.0.0.1</ip-address>
+         <session-id>0</session-id>
+      </peer-pref>
+      <local-pref>
+         <keepalive>30</keepalive>
+         <deadtimer>120</deadtimer>
+         <ip-address>127.0.0.1</ip-address>
+         <session-id>0</session-id>
+      </local-pref>
+      <peer-capabilities>
+         <stateful xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">true</stateful>
+         <instantiation xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">true</instantiation>
+         <active xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">true</active>
+      </peer-capabilities>
+      <session-duration>0:00:00:18</session-duration>
+      <delegated-lsps-count>1</delegated-lsps-count>
+      <synchronized>true</synchronized>
+   </pcep-session-state>
+
+@line 3: **last-received-rpt-msg-timestamp** - The timestamp of last received PCRpt message.
+
+@line 4: **sent-upd-msg-count** - The number of sent PCUpd messages.
+
+@line 5: **received-rpt-msg-count** - The number of received PcRpt messages.
+
+@line 6: **sent-init-msg-count** - The number of sent PCInitiate messages.
+
+@line 7: **sent-msg-count** - Total number of sent PCEP messages.
+
+@line 8: **last-sent-msg-timestamp** - The timestamp of last sent message.
+
+@line 9: **unknown-msg-received** - The number of received unknown messages.
+
+@line 10: **received-msg-count** - Total number of received PCEP messages.
+
+@line 13: **last-sent-error** - Type/value tuple of last sent error.
+
+@line 14: **received-error-msg-count** - Total number of received PCErr messages.
+
+@line 15: **sent-error-msg-count** - Total number of sent PCErr messages.
+
+@line 16: **last-received-error** - Type/value tuple of last sent error.
+
+@line 19: **keepalive** - Advertised keep-alive value.
+
+@line 20: **deadtimer** - Advertised deadtimer value.
+
+@line 21: **ip-address** - Peer's IP address.
+
+@line 22: **session-id** - Peer's session identifier.
+
+@line 25: **keepalive** - Advertised keep-alive value.
+
+@line 26: **deadtimer** - Advertised deadtimer value.
+
+@line 27: **ip-address** - Peer's IP address.
+
+@line 28: **session-id** - Peer's session identifier.
+
+@line 31: **stateful** - Represents peer's stateful/stateless capability.
+
+@line 32: **instantiation** - Represents peer's instantiation capability.
+
+@line 33: **active** - Represents peer's LSP update capability.
+
+@line 35: **session-duration** - Elapsed time (in d:H:m:s) from session-up until last statistic update.
+
+@line 36: **delegated-lsps-count** - The number of delegated LSPs (tunnels) from PCC.
+
+@line 37: **synchronized** - Represents synchronization status.
diff --git a/docs/pcep/pcep-user-guide-supported-capabilities.rst b/docs/pcep/pcep-user-guide-supported-capabilities.rst
new file mode 100644 (file)
index 0000000..bd44ef3
--- /dev/null
@@ -0,0 +1,21 @@
+.. _pcep-user-guide-supported-capabilities:
+
+List of supported capabilities
+==============================
+
+* `RFC5440 <https://tools.ietf.org/html/rfc5440>`_ - Path Computation Element (PCE) Communication Protocol (PCEP)
+* `RFC5455 <https://tools.ietf.org/html/rfc5455>`_ - Diffserv-Aware Class-Type Object for the Path Computation Element Communication Protocol
+* `RFC5520 <https://tools.ietf.org/html/rfc5520>`_ - Preserving Topology Confidentiality in Inter-Domain Path Computation Using a Path-Key-Based Mechanism
+* `RFC5521 <https://tools.ietf.org/html/rfc5521>`_ - Extensions to the Path Computation Element Communication Protocol (PCEP) for Route Exclusions
+* `RFC5541 <https://tools.ietf.org/html/rfc5541>`_ - Encoding of Objective Functions in the Path Computation Element Communication Protocol (PCEP)
+* `RFC5557 <https://tools.ietf.org/html/rfc5557>`_ - Path Computation Element Communication Protocol (PCEP) Requirements and Protocol Extensions in Support of Global Concurrent Optimization
+* `RFC5886 <https://tools.ietf.org/html/rfc5886>`_ - A Set of Monitoring Tools for Path Computation Element (PCE)-Based Architecture
+* `RFC7470 <https://tools.ietf.org/html/rfc7470>`_ - Conveying Vendor-Specific Constraints in the Path Computation Element Communication Protocol
+* `RFC7896 <https://tools.ietf.org/html/rfc7896>`_ - Update to the Include Route Object (IRO) Specification in the Path Computation Element Communication Protocol (PCEP)
+* `draft-ietf-pce-stateful-pce <https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-16>`_ - PCEP Extensions for Stateful PCE
+   * `draft-ietf-pce-pce-initiated-lsp <https://tools.ietf.org/html/draft-ietf-pce-pce-initiated-lsp-07>`_ - PCEP Extensions for PCE-initiated LSP Setup in a Stateful PCE Model
+   * `draft-ietf-pce-segment-routing <https://tools.ietf.org/html/draft-ietf-pce-segment-routing-07>`_ - PCEP Extension for segment routing
+   * `draft-ietf-pce-lsp-setup-type <https://tools.ietf.org/html/draft-ietf-pce-lsp-setup-type-03>`_ - PCEP Extension for path setup type
+   * `draft-ietf-pce-stateful-sync-optimizations <https://tools.ietf.org/html/draft-ietf-pce-stateful-sync-optimizations-05>`_ - Optimizations of Label Switched Path State Synchronization Procedures for a Stateful PCE
+   * `draft-sivabalan-pce-binding-label-sid <https://tools.ietf.org/html/draft-sivabalan-pce-binding-label-sid-01>`_ - Carrying Binding Label/Segment-ID in PCE-based Networks
+* `draft-ietf-pce-pceps <https://tools.ietf.org/html/draft-ietf-pce-pceps-10>`_ - Secure Transport for PCEP
diff --git a/docs/pcep/pcep-user-guide-test-tools.rst b/docs/pcep/pcep-user-guide-test-tools.rst
new file mode 100644 (file)
index 0000000..921e843
--- /dev/null
@@ -0,0 +1,145 @@
+.. _pcep-user-guide-test-tools:
+
+Test tools
+==========
+
+PCC Mock
+^^^^^^^^
+The PCC Mock is a stand-alone Java application purposed to simulate a PCC(s).
+The simulator is capable to report sample LSPs, respond to delegation, LSP management operations and synchronization optimization procedures.
+This application is not part of the OpenDaylight Karaf distribution, however it can be downloaded from OpenDaylight's Nexus (use latest release version):
+
+``https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/bgpcep/pcep-pcc-mock``
+
+Usage
+'''''
+The application can be run from command line:
+
+.. code-block:: console
+
+   java -jar pcep-pcc-mock-*-executable.jar
+
+
+with optional input parameters:
+
+.. code-block:: console
+
+   --local-address <Address:Port> (optional, default 127.0.0.1)
+      The first PCC IP address. If more PCCs are required, the IP address will be incremented. Port number can be optionally specified.
+
+   --remote-address <Address1:Port1,Address2:Port2,Address3:Port3,...> (optional, default 127.0.0.1:4189)
+      The list of IP address for the PCE servers. Port number can be optionally specified, otherwise default port number 4189 is used.
+
+   --pcc <N> (optional, default 1)
+      Number of mocked PCC instances.
+
+   --lsp <N> (optional, default 1)
+      Number of tunnels (LSPs) reported per PCC, might be zero.
+
+   --pcerr (optional flag)
+      If the flag is present, response with PCErr, otherwise PCUpd.
+
+   --log-level <LEVEL> (optional, default INFO)
+      Set logging level for pcc-mock.
+
+   -d, --deadtimer <0..255> (optional, default 120)
+      DeadTimer value in seconds.
+
+   -ka, --keepalive <0.255> (optional, default 30)
+      KeepAlive timer value in seconds.
+
+   --password <password> (optional)
+      If the password is present, it is used in TCP MD5 signature, otherwise plain TCP is used.
+
+   --reconnect <seconds> (optional)
+      If the argument is present, the value in seconds, is used as a delay before each new reconnect (initial connect or connection re-establishment) attempt.
+      The number of reconnect attempts is unlimited. If the argument is omitted, pcc-mock is not trying to reconnect.
+
+   --redelegation-timeout <seconds> (optional, default 0)
+      The timeout starts when LSP delegation is returned or PCE fails, stops when LSP is re-delegated to PCE.
+      When timeout expires, LSP delegation is revoked and held by PCC.
+
+   --state-timeout <seconds> (optional, default -1 (disabled))
+      The timeout starts when LSP delegation is returned or PCE fails, stops when LSP is re-delegated to PCE.
+      When timeout expires, PCE-initiated LSP is removed.
+
+   --state-sync-avoidance <disconnect_after_x_seconds> <reconnect_after_x_seconds> <dbVersion>
+      Synchronization avoidance capability enabled.
+         - disconnect_after_x_seconds: seconds that will pass until disconnections is forced. If set to smaller number than 1, disconnection wont be performed.
+         - reconnect_after_x_seconds: seconds that will pass between disconnection and new connection attempt. Only happens if disconnection has been performed.
+         - dbVersion: dbVersion used in new Open and must be always equal or bigger than LSP. If equal than LSP skip synchronization will be performed,
+           if not full synchronization will be performed taking in account new starting dbVersion desired.
+    --incremental-sync-procedure <disconnect_after_x_seconds> <reconnect_after_x_seconds> <dbVersion>
+      Incremental synchronization capability enabled.
+         - dbVersion: dbVersion used in new Open and must be always bigger than LSP. Incremental synchronization will be performed taking in account new starting dbVersion desired.
+
+    --triggered-initial-sync
+      PCE-triggered synchronization capability enabled. Can be combined combined with state-sync-avoidance/incremental-sync-procedure.
+
+    --triggered-re-sync
+      PCE-triggered re-synchronization capability enabled.
+
+Data Change Counter Tool
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Data Change Counter tool registers a Data Change Listener to a specified topology's subtree.
+This will allow us to know the quantity of changes produced under it, with each data change event counter will be incremented.
+
+Installation
+''''''''''''
+Installing data change counter tool
+
+.. code-block:: console
+
+   feature:install odl-restconf odl-bgpcep-data-change-counter
+
+Configuration
+'''''''''''''
+Once we set the configuration, a new data change counter will be created and registers to example-linkstate-topology.
+
+.. important:: **Clustering** - Each Counter Identifier should be unique.
+
+**URL:** ``/restconf/config/odl-data-change-counter-config:data-change-counter-config/data-change-counter``
+
+**Method:** ``PUT``
+
+**Content-Type:** ``application/xml``
+
+**Request Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,3
+
+   <data-change-counter-config xmlns="urn:opendaylight:params:xml:ns:yang:bgpcep:data-change-counter-config">
+       <counter-id>data-change-counter</counter-id>
+       <topology-name>example-linkstate-topology</topology-name>
+   </data-change-counter-config>
+
+@line 2: **Counter Id** - Unique counter change identifier.
+
+@line 3: **Topology Name** - An identifier for a topology.
+
+Usage
+'''''
+
+Counter state for topology
+
+**URL:** ``/restconf/operational/data-change-counter:data-change-counter/counter/data-change-counter``
+
+**Method:** ``GET``
+
+**Response Body:**
+
+.. code-block:: xml
+   :linenos:
+   :emphasize-lines: 2,3
+
+   <counter xmlns="urn:opendaylight:params:xml:ns:yang:bgp-data-change-counter">
+       <id>data-change-counter</id>
+       <count>0</count>
+   </counter>
+
+@line 2: **Counter Id** - Unique counter change identifier.
+
+@line 3: **Count** - Number of changes under registered topology's subtree.
diff --git a/docs/pcep/pcep-user-guide-troubleshooting.rst b/docs/pcep/pcep-user-guide-troubleshooting.rst
new file mode 100644 (file)
index 0000000..6da8747
--- /dev/null
@@ -0,0 +1,66 @@
+.. _pcep-user-guide-troubleshooting:
+
+Troubleshooting
+===============
+This section offers advices in a case OpenDaylight PCEP plugin is not working as expected.
+
+.. contents:: Contents
+   :depth: 2
+   :local:
+
+PCEP is not working...
+^^^^^^^^^^^^^^^^^^^^^^
+* First of all, ensure that all required features are installed, local PCE and remote PCC configuration is correct.
+
+  To list all installed features in OpenDaylight use the following command at the Karaf console:
+
+  .. code-block:: console
+
+     feature:list -i
+
+* Check OpenDaylight Karaf logs:
+
+  From Karaf console:
+
+  .. code-block:: console
+
+     log:tail
+
+  or open log file: ``data/log/karaf.log``
+
+  Possibly, a reason/hint for a cause of the problem can be found there.
+
+* Try to minimize effect of other OpenDaylight features, when searching for a reason of the problem.
+
+* Try to set DEBUG severity level for PCEP logger via Karaf console commands, in order to collect more information:
+
+  .. code-block:: console
+
+     log:set DEBUG org.opendaylight.protocol.pcep
+
+  .. code-block:: console
+
+     log:set DEBUG org.opendaylight.bgpcep.pcep
+
+Bug reporting
+^^^^^^^^^^^^^
+Before you report a bug, check `BGPCEP Jira <https://jira.opendaylight.org/projects/BGPCEP/issues/BGPCEP-589?filter=allopenissues>`_ to ensure same/similar bug is not already filed there.
+
+Write an e-mail to bgpcep-users@lists.opendaylight.org and provide following information:
+
+#. State OpenDaylight version
+
+#. Describe your use-case and provide as much details related to PCEP as possible
+
+#. Steps to reproduce
+
+#. Attach Karaf log files, optionally packet captures, REST input/output
+
+References
+----------
+* `A Path Computation Element (PCE)-Based Architecture <https://tools.ietf.org/html/rfc4655>`_
+* `Path Computation Element (PCE) Communication Protocol Generic Requirements <https://tools.ietf.org/html/rfc4657>`_
+* `Unanswered Questions in the Path Computation Element Architecture <https://tools.ietf.org/html/rfc7399>`_
+* `A PCE-Based Architecture for Application-Based Network Operations <https://tools.ietf.org/html/rfc7491>`_
+* `Framework for PCE-Based Inter-Layer MPLS and GMPLS Traffic Engineering <https://tools.ietf.org/html/rfc5623>`_
+* `Applicability of a Stateful Path Computation Element (PCE) <https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-app-07>`_