1 .. _bgp-user-guide-bgp-application-peer:
3 BGP Application Peer and programmable RIB
4 =========================================
5 The OpenDaylight BGP implementation also supports routes injection via *Application Peer*.
6 Such peer has its own programmable RIB, which can be modified by user.
7 This concept allows user to originate new routes and advertise them to all connected peers.
9 Application Peer configuration
10 ''''''''''''''''''''''''''''''
11 Following configuration sample show a way to configure the *Application Peer*:
13 **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``
17 **Content-Type:** ``application/xml``
25 <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
26 <neighbor-address>10.25.1.9</neighbor-address>
28 <peer-group>application-peers</peer-group>
32 @line 2: IP address is uniquely identifying *Application Peer* and its programmable RIB. Address is also used in local BGP speaker decision process.
34 @line 4: Indicates that peer is associated with *application-peers* group. It serves to distinguish *Application Peer's* from regular neighbors.
38 The *Application Peer* presence can be verified via REST:
40 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/peer/bgp:%2F%2F10.25.1.9``
50 <peer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
51 <peer-id>bgp://10.25.1.9</peer-id>
52 <peer-role>internal</peer-role>
55 <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
56 <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
57 <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet"></ipv4-routes>
59 <uptodate>false</uptodate>
65 <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
66 <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
67 <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet"></ipv4-routes>
68 <attributes></attributes>
73 @line 3: Peer role for *Application Peer* is *internal*.
75 @line 8: Adj-RIB-In is empty, as no routes were originated yet.
77 .. note:: There is no Adj-RIB-Out for *Application Peer*.
81 Next example shows how to inject a route into the programmable RIB.
83 **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``
87 **Content-Type:** ``application/xml``
93 <ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
95 <prefix>10.0.0.11/32</prefix>
105 <global>10.11.1.1</global>
112 Now the injected route appears in *Application Peer's* RIBs and in local speaker's Loc-RIB:
114 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/peer/bgp:%2F%2F10.25.1.9``
124 <peer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
125 <peer-id>bgp://10.25.1.9</peer-id>
126 <peer-role>internal</peer-role>
129 <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
130 <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
131 <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
134 <prefix>10.0.0.11/32</prefix>
144 <global>10.11.1.1</global>
150 <uptodate>false</uptodate>
156 <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
157 <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
158 <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
161 <prefix>10.0.0.11/32</prefix>
171 <global>10.11.1.1</global>
176 <attributes></attributes>
181 @line 9: Injected route is present in *Application Peer's* Adj-RIB-In and Effective-RIB-In.
185 **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``
195 <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
198 <prefix>10.0.0.10/32</prefix>
208 <global>10.11.1.1</global>
214 <prefix>10.0.0.10/32</prefix>
224 <global>10.10.1.1</global>
230 @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.
234 This route is also advertised to the remote peer (*192.0.2.1*), hence route appears in its Adj-RIB-Out:
236 **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``
244 <ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
246 <prefix>10.0.0.11/32</prefix>
256 <global>10.11.1.1</global>
263 The injected route can be modified (i.e. different path attribute):
265 **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``
269 **Content-Type:** ``application/xml``
275 <ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
277 <prefix>10.0.0.11/32</prefix>
287 <global>10.11.1.2</global>
294 The route can be removed from programmable RIB in a following way:
296 **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``
298 **Method:** ``DELETE``
302 Also it is possible to remove all routes from a particular table at once:
304 **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/``
306 **Method:** ``DELETE``
310 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).
312 .. note:: Routes stored in programmable RIB are persisted on OpendDaylight shutdown and restored after the re-start.