4 The OpenDaylight Karaf distribution comes pre-configured with baseline BGP
5 configuration. You can find it in the etc/opendaylight/karaf directory and it
8 - *31-bgp.xml* (defines the basic parser and RIB support)
9 - *41-bgp-example.xml* (which contains a sample configuration which needs to be
10 customized to your deployment)
12 The next sections will describe how to configure BGP manually or using RESTCONF.
14 === Configuring BGP ===
20 <type>prefix:rib-impl</type>
21 <name>example-bgp-rib</name>
22 <rib-id>example-bgp-rib</rib-id>
23 <local-as>64496</local-as>
24 <bgp-id>192.0.2.2</bgp-id>
25 <cluster-id>192.0.2.3</cluster-id>
30 - *rib-id* - BGP RIB Identifier, in this configuration file you can specify more BGP RIBs by
31 copy-pasting the above module. These RIBs must have a unique rib-id and name.
32 - *local-as* - Our local AS number (where OpenDaylight is deployed), we use this in best path selection
33 - *bgp-id* - Our local BGP identifier (the IP of the VM where OpenDaylight is deployed),
34 we use this in best path selection.
35 - *cluster-id* - Cluster Identifier, non-mandatory, if not specified, BGP Identifier will be used
37 MIGHT NOT BE NEEDED: depending on your BGP router, you might need to switch from
38 linkstate attribute type 99 to 29. Check with your router vendor. Change the
39 field iana-linkstate-attribute-type to true if your router supports type 29.
40 This snippet is located in 31-bgp.xml file.
45 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:linkstate">prefix:bgp-linkstate</type>
46 <name>bgp-linkstate</name>
47 <iana-linkstate-attribute-type>true</iana-linkstate-attribute-type>
51 - *iana-linkstate-attribute-type* - IANA has issued an early allocation for the
52 BGP Linkstate path attribute (=29). To preserve (TYPE = 99) set value bellow
53 to false; to use IANA assigned type set the value to true or remove it as it's true by default.
57 The initial configuration is written so that it will be ignored to prevent the
58 client from starting with default configuration. Therefore the first step is to
59 uncomment the module containing bgp-peer.
64 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-peer</type>
65 <name>example-bgp-peer</name>
66 <host>192.0.2.1</host>
67 <holdtimer>180</holdtimer>
68 <peer-role>ibgp</peer-role>
70 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:rib-instance</type>
71 <name>example-bgp-rib</name>
77 - *name* - BGP Peer name, in this configuration file you can specify more BGP Peers by copy-pasting the above module. These peers must have a *unique* name.
78 - *host* - IP address or hostname of BGP speaker (IP where OpenDaylight should connect to gather topology)
79 - *holdtimer* - unit: seconds
80 - *peer-role* - If peer role is not present, default value "ibgp" will be used (allowed values are also "ebgp" and "rr-client"). This field is case-sensitive.
81 - *rib* - BGP RIB identifier
83 ==== Configure Connection Attributes - OPTIONAL ====
88 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:reconnectstrategy">prefix:timed-reconnect-strategy</type>
89 <name>example-reconnect-strategy</name>
90 <min-sleep>1000</min-sleep>
91 <max-sleep>180000</max-sleep>
92 <sleep-factor>2.00</sleep-factor>
93 <connect-time>5000</connect-time>
95 <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-event-executor</type>
96 <name>global-event-executor</name>
101 - *min-sleep* - Minimum sleep time (miliseconds) in between reconnect tries
102 - *max-sleep* - Maximum sleep time (miliseconds) in between reconnect tries
103 - *sleep-factor* - Power factor of the sleep time between reconnect tries
104 - *connect-time* - How long we should wait (miliseconds) for the TCP connect
105 attempt, overrides default connection timeout dictated by TCP retransmits
108 ==== BGP Speaker Configuration ====
110 Previous entries addressed the configuration of a BGP connection initiated by
111 OpenDaylight. OpenDaylight also supports BGP Speaker functionality and accepts
112 incoming BGP connections.
114 *The configuration of BGP speaker is located in: 41-bgp-example.xml:
119 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-peer-acceptor</type>
120 <name>bgp-peer-server</name>
122 <!--Default parameters-->
123 <!--<binding-address>0.0.0.0</binding-address>-->
124 <!--<binding-port>1790</binding-port>-->
127 <!--Drops or accepts incoming BGP connection, every BGP Peer that should be accepted needs to be added to this registry-->
129 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-peer-registry</type>
130 <name>global-bgp-peer-registry</name>
135 *Changing speaker configuration*
136 - 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_.
137 - Changing binding port: Uncomment tag binding-port and change the port to e.g.
138 _1790_. The default binding port is _179_ as specified in link:http://tools.ietf.org/html/rfc4271[BGP RFC]. --
140 ==== Incomming BGP Connections ====
142 *BGP speaker drops all BGP connections from unknown BGP peers.* The decision is
143 made in component bgp-peer-registry that is injected into the speaker (The
144 registry is configured in 31-bgp.xml).
146 To add BGP Peer configuration into the registry, it is necessary to configure
147 regular BGP peer just like in example in 41-bgp-example.xml. Notice that the
148 BGP peer depends on the same bgp-peer-registry as bgp-speaker:
153 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-peer</type>
154 <name>example-bgp-peer</name>
155 <host>192.0.2.1</host>
158 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-peer-registry</type>
159 <name>global-bgp-peer-registry</name>
165 The BGP peer registers itself into the registry, which allows incoming BGP
166 connections handled by the bgp-speaker. (Config attribute peer-registry is
167 optional for now to preserve backwards compatibility). With this configuration,
168 the connection to 192.0.2.1 is initiated by OpenDaylight but will also be accepted from
169 192.0.2.1. In case both connections are being established, only one of them
170 will be preserved and the other will be dropped. The connection initiated from
171 device with lower bgp id will be dropped by the registry. Each BGP peer must
172 be configured in its own module. Note, that the name of the module needs to be
173 unique, so if you are configuring more peers, when changing the *host*, change
175 There is a way to configure the peer only for incoming connections (The
176 connection will not be initiated by the OpenDaylight, OpenDaylight will only wait for incoming
177 connection from the peer. The peer is identified by its IP address). To
178 configure peer only for incoming connection add attribute initiate-connection
179 to peer's configuration:
184 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-peer</type>
185 <name>example-bgp-peer</name>
186 <host>192.0.2.1</host> // IP address or hostname of the speaker
187 <holdtimer>180</holdtimer>
188 <initiate-connection>false</initiate-connection> // Connection will not be initiated by ODL
193 - *initiate-connection* - if set to false OpenDaylight will not initiate connection to this peer. Default value is true for all peers.
195 ==== BGP Application Peer ====
197 A BGP speaker needs to register all peers that can be connected to it (meaning if
198 a BGP peer is not configured, the connection with OpenDaylight won't be
199 successful). As a first step, configure RIB. Then, instead of configuring
200 regular peer, configure this application peer, with its own application RIB.
201 Change the value in bold bgp-peer-id which is your local BGP-ID that will be
202 used in BGP Best Path Selection algorithm.
207 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">x:bgp-application-peer</type>
208 <name>example-bgp-peer-app</name>
209 <bgp-peer-id>10.25.1.9</bgp-peer-id>
211 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">x:rib-instance</type>
212 <name>example-bgp-rib</name>
214 <application-rib-id>example-app-rib</application-rib-id>
219 - *bgp-peer-id* - Our local BGP identifier (the IP of the VM where OpenDaylight is deployed), we use this in best path selection
220 - *target-rib* - RIB ID of existing RIB where the data should be transferred
221 - *application-rib-id* - RIB ID of local application RIB (all the routes that you put to OpenDaylight will be displayed here)
223 //TODO: internal link to Populate RIB
224 //To populate RIB use
226 //TODO: internal jump to section?
227 //In order to get routes advertised to other peers, you have to also configure the peers, as described in section BGP Peer
229 === Configuration through RESTCONF ===
231 Another method to configure BGP is dynamically through RESTCONF. Before you
232 start, make sure, you've completed steps 1-5 in Installation Guide. Instead of
233 restarting Karaf, install another feature, that provides you the access to
234 'restconf/config/' URLs.
236 feature:install odl-netconf-connector-all
238 To check what modules you have currently configured, check following link:
239 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/
240 This URL is also used to POST new configuration. If you want to change any
241 other configuration that is listed here, make sure you include the correct
242 namespaces. RESTCONF will tell you if some namespace is wrong.
244 To update an existing configuration use *PUT* and give the full path to the element you wish to update.
246 It is vital that you respect the order of steps described in user guide.
250 First, configure RIB. This module is already present in the configuration,
251 therefore we change only the parameters we need. In this case, it's
252 *bgp-rib-id* and *local-as*.
254 *URL:* _http://127.0.0.1:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/odl-bgp-rib-impl-cfg:bgp-rib/example-bgp-rib_
259 <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
260 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">x:rib-impl</type>
261 <name>example-bgp-rib</name>
262 <session-reconnect-strategy xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
263 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:protocol:framework">x:reconnect-strategy-factory</type>
264 <name>example-reconnect-strategy-factory</name>
265 </session-reconnect-strategy>
266 <rib-id xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">example-bgp-rib</rib-id>
267 <extensions xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
268 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:spi">x:extensions</type>
269 <name>global-rib-extensions</name>
271 <codec-tree-factory xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
272 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">x:binding-codec-tree-factory</type>
273 <name>runtime-mapping-singleton</name>
274 </codec-tree-factory>
275 <tcp-reconnect-strategy xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
276 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:protocol:framework">x:reconnect-strategy-factory</type>
277 <name>example-reconnect-strategy-factory</name>
278 </tcp-reconnect-strategy>
279 <data-provider xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
280 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">x:binding-async-data-broker</type>
281 <name>pingpong-binding-data-broker</name>
283 <local-as xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">64496</local-as>
284 <bgp-dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
285 <type>bgp-dispatcher</type>
286 <name>global-bgp-dispatcher</name>
288 <dom-data-provider xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
289 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">x:dom-async-data-broker</type>
290 <name>pingpong-broker</name>
292 <local-table xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
293 <type>bgp-table-type</type>
294 <name>ipv4-unicast</name>
296 <local-table xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
297 <type>bgp-table-type</type>
298 <name>ipv6-unicast</name>
300 <local-table xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
301 <type>bgp-table-type</type>
302 <name>linkstate</name>
304 <local-table xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
305 <type>bgp-table-type</type>
306 <name>flowspec</name>
308 <bgp-rib-id xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">192.0.2.2</bgp-rib-id>
312 IMPORTANT: MIGHT NOT BE NEEDED depending on your BGP router, you might need a
313 switch from linkstate attribute type 99 to 29. Check with your router vendor.
314 Switch the field to true if your router supports type 29.
316 *URL:* _http://127.0.0.1:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/odl-bgp-linkstate-cfg:bgp-linkstate_
321 <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
322 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:linkstate">x:bgp-linkstate</type>
323 <name>bgp-linkstate</name>
324 <iana-linkstate-attribute-type xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:linkstate">true</iana-linkstate-attribute-type>
330 We also need to add new module to configuration (bgp-peer). In this case, the
331 whole module needs to be configured. Please change values *host*, *holdtimer*
332 and *peer-role* (if necessary).
338 <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
339 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">x:bgp-peer</type>
340 <name>example-bgp-peer</name>
341 <host xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">192.0.2.1</host>
342 <holdtimer xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">180</holdtimer>
343 <peer-role xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">ibgp</peer-role>
344 <rib xmlns"urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
345 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">x:rib-instance</type>
346 <name>example-bgp-rib</name>
348 <peer-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
349 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">x:bgp-peer-registry</type>
350 <name>global-bgp-peer-registry</name>
352 <advertized-table xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
353 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">x:bgp-table-type</type>
354 <name>ipv4-unicast</name>
356 <advertized-table xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
357 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">x:bgp-table-type</type>
358 <name>ipv6-unicast</name>
360 <advertized-table xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
361 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">x:bgp-table-type</type>
362 <name>linkstate</name>
364 <advertized-table xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
365 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">x:bgp-table-type</type>
366 <name>flowspec</name>
371 This is all necessary information that you need to get ODL connect to your speaker.
373 ==== BGP Application Peer ====
375 Change the value *bgp-peer-id* which is your local BGP ID that will be used in
376 BGP Best Path Selection algorithm.
381 <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
382 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">x:bgp-application-peer</type>
383 <name>example-bgp-peer-app</name>
384 <bgp-peer-id xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">10.25.1.9</bgp-peer-id> <!-- Your local BGP-ID that will be used in BGP Best Path Selection algorithm -->
385 <target-rib xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
386 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">x:rib-instance</type>
387 <name>example-bgp-rib</name>
389 <application-rib-id xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">example-app-rib</application-rib-id>
390 <data-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
391 <type xmlns:x="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">x:binding-async-data-broker</type>
392 <name>pingpong-binding-data-broker</name>
399 ==== Viewing BGP Topology ====
401 This section summarizes how data from BGP can be viewed through RESTCONF. Currently it is the only way to view the data.
403 IMPORTANT: From Helium release the port changed from 8080 to 8181.
405 ===== Network Topology View =====
407 Basic URL for network topology is *http://localhost:8181/restconf/operational/network-topology:network-topology/* .
409 If BGP is configured properly, it should display output similar to this one:
415 <topology-id>pcep-topology</topology-id>
421 <server-provided>true</server-provided>
422 <topology-id>example-ipv4-topology</topology-id>
426 <server-provided>true</server-provided>
427 <topology-id>example-linkstate-topology</topology-id>
433 BGP data as were sent from BGP speaker are listed in three topologies (if all three are configured):
435 *example-linkstate-topology* - displays links and nodes advertised through linkstate Update messages
437 http://localhost:8181/restconf/operational/network-topology:network-topology/topology/example-linkstate-topology
439 *example-ipv4-topology* - display Ipv4 adresses of nodes in the topology
441 http://localhost:8181/restconf/operational/network-topology:network-topology/topology/example-ipv4-topology
443 *example-ipv6-topology* - display Ipv6 adresses of nodes in the topology
445 http://localhost:8181/restconf/operational/network-topology:network-topology/topology/example-ipv6-topology
447 ===== Route Information Base (RIB) View =====
449 Another view of BGP data is through *BGP RIBs*, located here:
451 http://localhost:8181/restconf/operational/bgp-rib:bgp-rib/
453 There are multiple RIBs configured:
455 - AdjRibsIn (per Peer) : Adjacency RIBs In, BGP routes as they come from BGP Peer
456 - EffectiveRib (per Peer) : BGP routes after applying Import policies
457 - LocRib (per RIB) : Local RIB, BGP routes from all peers
458 - AdjRibsOut (per Peer) : BGP routes that will be advertizes, after applying Export policies
460 This is how the output looks like, when address families for IPv4 and Linkstate were configured:
467 <safi>x:linkstate-subsequent-address-family</safi>
468 <afi>x:linkstate-address-family</afi>
473 <safi>x:unicast-subsequent-address-family</safi>
474 <afi>x:ipv4-address-family</afi>
480 You can see details for each AFI by expanding the RESTCONF link:
482 *IPv4* : http://localhost:8181/restconf/operational/bgp-rib:bgp-rib/rib/example-bgp-rib/loc-rib/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/ipv4-routes
484 *Linkstate* : http://localhost:8181/restconf/operational/bgp-rib:bgp-rib/rib/example-bgp-rib/loc-rib/tables/bgp-linkstate:linkstate-address-family/bgp-linkstate:linkstate-subsequent-address-family/linkstate-routes
486 ==== Populate RIB ====
488 If your peer is configured, you can populate the RIB by making following POST call to RESTCONF:
490 *URL:* http://localhost:8181/restconf/config/bgp-rib:application-rib/example-app-rib/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/
492 - where example-app-rib is your application RIB id (that you specified in the configuration) and tables specifies AFI and SAFI of the data that you want to add.
496 *Content-Type:* application/xml
500 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
501 <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
503 <prefix>200.20.160.1/32</prefix>
506 <global>199.20.160.41</global>
507 </ipv4-next-hop><as-path/>
515 <originator>41.41.41.41</originator>
521 <cluster>40.40.40.40</cluster>
528 The request results in *204 No content*. This is expected.