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: /rests/data/openconfig-network-instance:network-instances/network-instance=global-bgp/openconfig-network-instance:protocols/protocol=openconfig-policy-types:BGP,bgp-example/bgp-openconfig-extensions:bgp/neighbors

Method: POST

Content-Type: application/xml

Request Body:

1<neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2    <neighbor-address>10.25.1.9</neighbor-address>
3    <config>
4        <peer-group>application-peers</peer-group>
5    </config>
6</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: /rests/data/bgp-rib:bgp-rib/rib=bgp-example/peer=bgp%3A%2F%2F10.25.1.9?content=nonconfig

Method: GET

Response Body:

 1<peer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
 2    <peer-id>bgp://10.25.1.9</peer-id>
 3    <peer-role>internal</peer-role>
 4    <adj-rib-in>
 5        <tables>
 6            <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
 7            <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
 8            <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet"></ipv4-routes>
 9            <attributes>
10                <uptodate>false</uptodate>
11            </attributes>
12        </tables>
13    </adj-rib-in>
14    <effective-rib-in>
15        <tables>
16            <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
17            <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
18            <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet"></ipv4-routes>
19            <attributes></attributes>
20        </tables>
21    </effective-rib-in>
22</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: /rests/data/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:

<ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
    <path-id>0</path-id>
    <prefix>10.0.0.11/32</prefix>
    <attributes>
        <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: /rests/data/bgp-rib:bgp-rib/rib=bgp-example/peer=bgp%3A%2F%2F10.25.1.9?content=nonconfig

Method: GET

Response Body:

 1<peer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
 2    <peer-id>bgp://10.25.1.9</peer-id>
 3    <peer-role>internal</peer-role>
 4    <adj-rib-in>
 5        <tables>
 6            <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
 7            <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
 8            <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
 9                <ipv4-route>
10                    <path-id>0</path-id>
11                    <prefix>10.0.0.11/32</prefix>
12                    <attributes>
13                        <origin>
14                            <value>igp</value>
15                        </origin>
16                        <local-pref>
17                            <pref>100</pref>
18                        </local-pref>
19                        <ipv4-next-hop>
20                            <global>10.11.1.1</global>
21                        </ipv4-next-hop>
22                    </attributes>
23                </ipv4-route>
24            </ipv4-routes>
25            <attributes>
26                <uptodate>false</uptodate>
27            </attributes>
28        </tables>
29    </adj-rib-in>
30    <effective-rib-in>
31        <tables>
32            <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
33            <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
34            <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
35                <ipv4-route>
36                    <path-id>0</path-id>
37                    <prefix>10.0.0.11/32</prefix>
38                    <attributes>
39                        <origin>
40                            <value>igp</value>
41                        </origin>
42                        <local-pref>
43                            <pref>100</pref>
44                        </local-pref>
45                        <ipv4-next-hop>
46                            <global>10.11.1.1</global>
47                        </ipv4-next-hop>
48                    </attributes>
49                </ipv4-route>
50            </ipv4-routes>
51            <attributes></attributes>
52        </tables>
53    </effective-rib-in>
54</peer>

@line 9: Injected route is present in Application Peer’s Adj-RIB-In and Effective-RIB-In.


URL: /rests/data/bgp-rib:bgp-rib/rib=bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/ipv4-routes?content=nonconfig

Method: GET

Response Body:

 1<ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
 2    <ipv4-route>
 3        <path-id>0</path-id>
 4        <prefix>10.0.0.10/32</prefix>
 5        <attributes>
 6            <origin>
 7                <value>igp</value>
 8            </origin>
 9            <local-pref>
10                <pref>100</pref>
11            </local-pref>
12            <ipv4-next-hop>
13                <global>10.11.1.1</global>
14            </ipv4-next-hop>
15        </attributes>
16    </ipv4-route>
17    <ipv4-route>
18        <path-id>0</path-id>
19        <prefix>10.0.0.10/32</prefix>
20        <attributes>
21            <origin>
22                <value>igp</value>
23            </origin>
24            <local-pref>
25                <pref>100</pref>
26            </local-pref>
27            <ipv4-next-hop>
28                <global>10.10.1.1</global>
29            </ipv4-next-hop>
30        </attributes>
31    </ipv4-route>
32</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: /rests/data/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?content=nonconfig

Method: GET

Response Body:

<ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
    <path-id>0</path-id>
    <prefix>10.0.0.11/32</prefix>
    <attributes>
        <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: /rests/data/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:

<ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
    <path-id>0</path-id>
    <prefix>10.0.0.11/32</prefix>
    <attributes>
        <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: /rests/data/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: /rests/data/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.