First real draft of YangIDE user guide.
[docs.git] / manuals / user-guide / src / main / asciidoc / bgpcep / helium-bgpcep.adoc
1 == BGP LS PCEP
2
3 === BGP LS
4
5 OpenDaylight comes pre-configured in the installation. You can find it in the opendaylight/configuration/initial directory and it consists of two files:
6
7 https://jenkins.opendaylight.org/integration/view/Integration%20jobs/job/integration-master-project-centralized-integration/lastSuccessfulBuild/artifact/distributions/serviceprovider/target/distributions-serviceprovider-0.2.0-SNAPSHOT-osgipackage/opendaylight/configuration/initial/31-bgp.xml[31-bgp.xml], which defines the basic parser and RIB support. Unless you need to add a new AFI/SAFI, you should keep this file as is. +
8
9 https://jenkins.opendaylight.org/integration/view/Integration%20jobs/job/integration-master-project-centralized-integration/lastSuccessfulBuild/artifact/distributions/serviceprovider/target/distributions-serviceprovider-0.2.0-SNAPSHOT-osgipackage/opendaylight/configuration/initial/41-bgp-example.xml[41-bgp-example.xml], which contains a sample configuration which needs to be customized to your deployment.
10
11 *Currently the configuration for BGP peer is ignored in the configuration, to prevent the client from starting with default configuration. Therefore the first step is to uncomment ALL the commented parts in this file.*
12
13 . Adjust values for initial BGP Open message
14 +
15
16 [literal]
17 <module>
18     <type>prefix:rib-impl</type>
19     <name>example-bgp-rib</name>
20     <rib-id>example-bgp-rib</rib-id>
21     <local-as>64496</local-as>         // Our AS number, we use this in best path selection
22     <bgp-id>192.0.2.2</bgp-id>         // Our BGP identifier, we use this in best path selection
23         
24 . Specify IP address of your BGP speaker
25
26 [literal]
27 <module>
28     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
29         prefix:bgp-peer
30     </type>
31     <name>example-bgp-peer</name>
32     <host>192.0.2.1</host>                         // IP address or hostname of the speaker
33     <holdtimer>180</holdtimer>
34
35 You can also add more BGP peers with different instance name and hostname.
36
37 [literal]
38 <module>
39     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
40         prefix:bgp-peer
41     </type>
42     <name>example-bgp-peer2</name>
43     <host>192.0.2.2</host>
44     <holdtimer>180</holdtimer>
45
46 [start = 3]     
47 . Configure connection attributes (all in milliseconds)
48
49 [literal]
50 <module>
51    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:reconnectstrategy">
52         prefix:timed-reconnect-strategy
53    </type>
54    <name>example-reconnect-strategy</name>
55    <min-sleep>1000</min-sleep>             // Minimum sleep time in between reconnect tries
56    <max-sleep>180000</max-sleep>           // Maximum sleep time in between reconnect tries
57    <sleep-factor>2.00</sleep-factor>       // Power factor of the sleep time between reconnect tries
58    <connect-time>5000</connect-time>       // How long we should wait for the TCP connect attempt, overrides default connection timeout dictated by TCP retransmits
59    <executor>
60        <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">
61            netty:netty-event-executor
62        </type>
63        <name>global-event-executor</name>
64    </executor>
65 </module>
66
67
68 ==== BGP speaker configuration +
69
70 Previous entries addressed the configuration of a BGP connection initiated by ODL. ODL also supports BGP Speaker functionality and accepts incoming BGP connections. 
71
72 The configuration of BGP speaker is located in https://jenkins.opendaylight.org/integration/view/Integration%20jobs/job/integration-master-project-centralized-integration/lastSuccessfulBuild/artifact/distributions/serviceprovider/target/distributions-serviceprovider-0.2.0-SNAPSHOT-osgipackage/opendaylight/configuration/initial/41-bgp-example.xml[41-bgp-example.xml].
73
74 ---------------------
75 <module>
76    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
77        prefix:bgp-peer-acceptor
78    </type>
79    <name>bgp-peer-server</name>
80    <!--Default parameters-->
81     <!--<binding-address>0.0.0.0</binding-address>-->
82     <!--<binding-port>179</binding-port>-->
83    <bgp-dispatcher>
84        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
85            prefix:bgp-dispatcher
86        </type>
87        <name>global-bgp-dispatcher</name>
88    </bgp-dispatcher>
89    <!--Drops or accepts incoming BGP connection, every BGP Peer that should be accepted needs to be added to this registry-->
90    <peer-registry>
91        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
92            prefix:bgp-peer-registry
93        </type>
94        <name>global-bgp-peer-registry</name>
95    </peer-registry>
96 </module>
97 ---------------------
98
99 . Changing speaker configuration
100
101 * Changing binding address: Uncomment tag binding-address and change the address to e.g. 127.0.0.1. The default binding address is 0.0.0.0.
102 * Changing binding port: Uncomment tag binding-port and change the port to e.g. 1790. The default binding port is 179 as specified in BGP RFC.
103 . Configuring incoming BGP connections
104
105 By default, the *BGP speaker drops all BGP connections from unknown BGP peers*. The decision is made in component bgp-peer-registry that is injected into the speaker (The registry is configured in 31-bgp.xml). 
106
107 To add BGP Peer configuration into the registry, it is necessary to configure regular BGP peer just like in example in https://jenkins.opendaylight.org/integration/view/Integration%20jobs/job/integration-master-project-centralized-integration/lastSuccessfulBuild/artifact/distributions/serviceprovider/target/distributions-serviceprovider-0.2.0-SNAPSHOT-osgipackage/opendaylight/configuration/initial/41-bgp-example.xml[41-bgp-example.xml]. Notice that the BGP peer depends on the same _bgp-peer-registry as bgp-speaker_:
108 [literal]
109
110 <module>
111     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
112         prefix:bgp-peer
113     </type>
114     <name>example-bgp-peer</name>
115     <host>192.0.2.1</host>
116     ...
117     <peer-registry>
118         <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
119             prefix:bgp-peer-registry
120         </type>
121         <name>global-bgp-peer-registry</name>
122     </peer-registry>
123     ...
124 </module>
125
126 BGP peer registers itself into the registry, which allows incoming BGP connections handled by the _bgp-speaker_. (Config attribute _peer-registry_ is optional for now to preserve backwards compatibility). With this configuration, the connection to 192.0.2.1 is initiated by ODL but will also be accepted from 192.0.2.1. In case both connections are being established, only one of them will be preserved and the other will be dropped. The connection initiated from device with lower bgp id will be dropped by the registry. 
127
128 There is a way to configure the peer only for incoming connections (The connection will not be initiated by the ODL, ODL will only wait for incoming connection from the peer. The peer is identified by its IP address). To configure peer only for incoming connection add attribute _initiate-connection_ to peer configuration:
129
130 [literal]
131 <module>
132     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
133         prefix:bgp-peer
134     </type>
135     <name>example-bgp-peer</name>
136     <host>192.0.2.1</host>                         // IP address or hostname of the speaker
137     <holdtimer>180</holdtimer>
138     <initiate-connection>false</initiate-connection>  // Connection will not be initiated by ODL
139     ...
140 </module>
141
142 The attribute initiate-connection is optional with the default value set to *true*.
143
144 *Application peer configuration* +
145
146 Application peer is a special type of BGP peer. It has own BGP RIB. This RIB can be populated through RESTCONF. 
147 If ODL is set as BGP speaker, the changes are sent to other BGP clients as well. To properly configure application peer, add following lines to https://jenkins.opendaylight.org/integration/view/Integration%20jobs/job/integration-master-project-centralized-integration/lastSuccessfulBuild/artifact/distributions/serviceprovider/target/distributions-serviceprovider-0.2.0-SNAPSHOT-osgipackage/opendaylight/configuration/initial/41-bgp-example.xml[41-bgp-example.xml] and make appropriate changes.
148
149 [literal]
150 <module>
151  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
152   prefix:bgp-application-peer
153  </type>
154  <name>example-bgp-peer-app</name>
155  <bgp-id>10.1.9.9</bgp-id> <!-- Your local BGP-ID that will be used in BGP Best Path Selection algorithm -->
156  <target-rib>
157   <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
158     prefix:rib-instance
159   </type>
160   <name>example-bgp-rib</name> <!-- RIB where the changes from application RIB should be propagated -->
161  </target-rib>
162  <application-rib-id>example-app-rib</application-rib-id>  <!-- Your application RIB identifier -->
163  <data-broker>
164   <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
165     binding:binding-async-data-broker
166   </type>
167   <name>binding-data-broker</name>
168  </data-broker>
169 </module>
170
171 === PCEP
172 OpenDaylight is pre-configured with baseline PCEP configuration. The default shipped configuration will start a PCE server on port 4189.
173
174 https://jenkins.opendaylight.org/integration/view/Integration%20jobs/job/integration-master-project-centralized-integration/lastSuccessfulBuild/artifact/distributions/serviceprovider/target/distributions-serviceprovider-0.2.0-SNAPSHOT-osgipackage/opendaylight/configuration/initial/32-pcep.xml[32-pcep.xml] - basic PCEP configuration, including session parameters
175 https://jenkins.opendaylight.org/integration/view/Integration%20jobs/job/integration-master-project-centralized-integration/lastSuccessfulBuild/artifact/distributions/serviceprovider/target/distributions-serviceprovider-0.2.0-SNAPSHOT-osgipackage/opendaylight/configuration/initial/39-pcep-provider.xml[39-pcep-provider.xml] - configuration for PCEP provider
176
177 ==== Configure draft versions +
178
179 There are already two extensions for PCEP: 
180 https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-09[draft-ietf-pce-stateful-pce] - in versions 02 and 07 
181 https://tools.ietf.org/html/draft-ietf-pce-pce-initiated-lsp-01[draft-ietf-pce-pce-initiated-lsp] - versions crabbe-initiated-00 and ietf-initiated-00.
182
183 NOTE: It is important to load the extensions with compatible versions because they extend each other. In this case crabbe-initiated-00 is compatible with stateful-02 and ietf-initiated-00 is compatible with stateful-07. Default configuration is to use newest versions of the drafts.
184
185 Complete the following steps in order to get stateful02 PCEP connection running and synchronized.
186
187 To use older version: 
188 . Switch commented code to ignore stateful-7 and ietf-initiated-00 versions in https://jenkins.opendaylight.org/integration/view/Integration%20jobs/job/integration-master-project-centralized-integration/lastSuccessfulBuild/artifact/distributions/serviceprovider/target/distributions-serviceprovider-0.2.0-SNAPSHOT-osgipackage/opendaylight/configuration/initial/32-pcep.xml[32-pcep.xml]:
189
190 [literal]
191  <!-- This block is draft-ietf-pce-stateful-pce-07 + draft-ietf-pce-inititated-pce-00 -->
192  <!--extension>
193   <type>pcepspi:extension</type>
194   <name>pcep-parser-ietf-stateful07</name>
195  </extension>
196  <extension>
197   <type>pcepspi:extension</type>
198   <name>pcep-parser-ietf-initiated00</name>
199  </extension-->
200  <!-- This block is draft-ietf-pce-stateful-pce-02 + draft-crabbe-pce-inititated-pce-00 -->
201 <extension>
202  <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">
203    pcepspi:extension
204  </type>
205  <name>pcep-parser-ietf-stateful02</name>
206 </extension>
207 <extension>
208  <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">
209   pcepspi:extension
210  </type>
211  <name>pcep-parser-crabbe-initiated00</name>
212 </extension>
213
214 . In the same file, make sure the proposal matches your chosen draft version. Change _stateful07-proposal_ to _stateful02-proposal_:
215
216 [literal]
217
218 <pcep-session-proposal-factory>
219     <type>pcep:pcep-session-proposal-factory</type>
220     <name>stateful02-proposal</name>
221 </pcep-session-proposal-factory>
222
223 . In https://jenkins.opendaylight.org/integration/view/Integration%20jobs/job/integration-master-project-centralized-integration/lastSuccessfulBuild/artifact/distributions/serviceprovider/target/distributions-serviceprovider-0.2.0-SNAPSHOT-osgipackage/opendaylight/configuration/initial/39-pcep-provider.xml[39-pcep-provider.xml], stateful-plugin also needs to match. Change _stateful07_ to _stateful02_:
224 [literal]
225 <stateful-plugin>
226     <type>prefix:pcep-topology-stateful</type>
227     <name>stateful02</name>
228 </stateful-plugin>
229
230 ==== Configure PCEP segment routing
231 http://tools.ietf.org/html/draft-sivabalan-pce-segment-routing-02[draft-sivabalan-pce-segment-routing-02] PCEP extension for Segment Routing
232
233 PCEP Segment Routing initial configuration:
234 https://jenkins.opendaylight.org/bgpcep/job/bgpcep-nightly/ws/pcep/controller-config/src/main/resources/initial/33-pcep-segment-routing.xml[33-pcep-segment-routing.xml] +
235
236 * To use Segment Routing uncomment two commented blocks + 
237
238 * Activate parsers/serializes extension: +
239
240 ** Create _pcep-parser-segment-routing02_ instance
241 ** Reconfigure (inject into list of extensions) global-pcep-extensions
242
243 [literal]
244 <module>
245     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:sr02:cfg">
246         prefix:pcep-parser-segment-routing02
247     </type>
248     <name>pcep-parser-segment-routing02</name>
249 </module>
250 <module>
251     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">
252         prefix:pcep-extensions-impl
253     </type>
254     <name>global-pcep-extensions</name>
255     <extension>
256         <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">
257             pcepspi:extension
258         </type>
259         <name>pcep-parser-segment-routing02</name>
260     </extension>
261 </module>
262 .
263 .
264 .
265 <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
266     <service>
267         <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">
268             pcepspi:extension
269         </type>
270         <instance>
271             <name>pcep-parser-segment-routing02</name>
272             <provider>/config/modules/module[name='pcep-parser-segment-routing02']/instance[name='pcep-parser-segment-routing02']</provider>
273         </instance>
274     </service>
275 </services>
276
277 * Advertise Segment Routing capability in Open Message:
278 ** Instantiate pcep-session-proposal-factory-sr02
279 ** Reconfigure _global-pcep-dispatcher_
280
281 [literal]
282 <module>
283     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:sr02:cfg">
284         prefix:pcep-session-proposal-factory-sr02
285     </type>
286     <name>pcep-session-proposal-factory-sr02</name>
287 </module>
288 <module>
289     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:impl">
290         prefix:pcep-dispatcher-impl
291     </type>
292     <name>global-pcep-dispatcher</name>
293     <pcep-session-proposal-factory>
294         <type xmlns:pcep="urn:opendaylight:params:xml:ns:yang:controller:pcep">
295             pcep:pcep-session-proposal-factory
296         </type>
297         <name>pcep-session-proposal-factory-sr02</name>
298     </pcep-session-proposal-factory>
299 </module>
300 .
301 .
302 .
303 <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
304     <service>
305         <type xmlns:pcep="urn:opendaylight:params:xml:ns:yang:controller:pcep">
306             pcep:pcep-session-proposal-factory
307         </type>
308         <instance>
309             <name>pcep-session-proposal-factory-sr02</name>
310             <provider>/config/modules/module[name='pcep-session-proposal-factory-sr02']/instance[name='pcep-session-proposal-factory-sr02']</provider>
311         </instance>
312     </service>
313 </services>