BGP speaker configuration

Previous entries addressed the configuration of a BGP connection initiated by ODL. ODL also supports BGP Speaker functionality and accepts incoming BGP connections.

The configuration of BGP speaker is located in 41-bgp-example.xml.

<module>
   <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
       prefix:bgp-peer-acceptor
   </type>
   <name>bgp-peer-server</name>
   <!--Default parameters-->
    <!--<binding-address>0.0.0.0</binding-address>-->
    <!--<binding-port>179</binding-port>-->
   <bgp-dispatcher>
       <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
           prefix:bgp-dispatcher
       </type>
       <name>global-bgp-dispatcher</name>
   </bgp-dispatcher>
   <!--Drops or accepts incoming BGP connection, every BGP Peer that should be accepted needs to be added to this registry-->
   <peer-registry>
       <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
           prefix:bgp-peer-registry
       </type>
       <name>global-bgp-peer-registry</name>
   </peer-registry>
</module>
  1. Changing speaker configuration

    • 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.
    • 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.
  2. Configuring incoming BGP connections

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).

To add BGP Peer configuration into the registry, it is necessary to configure regular BGP peer just like in example in 41-bgp-example.xml. Notice that the BGP peer depends on the same bgp-peer-registry as bgp-speaker:

<module>
    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
        prefix:bgp-peer
    </type>
    <name>example-bgp-peer</name>
    <host>192.0.2.1</host>
    ...
    <peer-registry>
        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
            prefix:bgp-peer-registry
        </type>
        <name>global-bgp-peer-registry</name>
    </peer-registry>
    ...
</module>

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.

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:

<module>
    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
        prefix:bgp-peer
    </type>
    <name>example-bgp-peer</name>
    <host>192.0.2.1</host>                         // IP address or hostname of the speaker
    <holdtimer>180</holdtimer>
    <initiate-connection>false</initiate-connection>  // Connection will not be initiated by ODL
    ...
</module>

The attribute initiate-connection is optional with the default value set to true.

Application peer configuration

Application peer is a special type of BGP peer. It has own BGP RIB. This RIB can be populated through RESTCONF. 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 41-bgp-example.xml and make appropriate changes.

<module>
 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
  prefix:bgp-application-peer
 </type>
 <name>example-bgp-peer-app</name>
 <bgp-id>10.1.9.9</bgp-id> <!-- Your local BGP-ID that will be used in BGP Best Path Selection algorithm -->
 <target-rib>
  <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
    prefix:rib-instance
  </type>
  <name>example-bgp-rib</name> <!-- RIB where the changes from application RIB should be propagated -->
 </target-rib>
 <application-rib-id>example-app-rib</application-rib-id>  <!-- Your application RIB identifier -->
 <data-broker>
  <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
    binding:binding-async-data-broker
  </type>
  <name>binding-data-broker</name>
 </data-broker>
</module>

loading table of contents...