Protocol Configuration¶
As a first step, a new protocol instance needs to be configured. It is a very basic configuration conforming with RFC4271.
Note
RIB policy must already be configured and present before configuring the protocol.
URL: /rests/data/openconfig-network-instance:network-instances/network-instance=global-bgp/protocols
Method: POST
Content-Type: application/xml
Request Body:
1<protocol xmlns="http://openconfig.net/yang/network-instance">
2 <name>bgp-example</name>
3 <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
4 <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
5 <global>
6 <config>
7 <router-id>192.0.2.2</router-id>
8 <as>65000</as>
9 </config>
10 <apply-policy>
11 <config>
12 <default-export-policy>REJECT-ROUTE</default-export-policy>
13 <default-import-policy>REJECT-ROUTE</default-import-policy>
14 <import-policy>default-odl-import-policy</import-policy>
15 <export-policy>default-odl-export-policy</export-policy>
16 </config>
17 </apply-policy>
18 </global>
19 </bgp>
20</protocol>
@line 2: The unique protocol instance identifier.
@line 7: BGP Identifier of the speaker.
@line 8: Local autonomous system number of the speaker. Note that, OpenDaylight BGP implementation supports four-octet AS numbers only.
@line 14: Default ODL Import Policy.
@line 15: Default ODL Export Policy.
Content-Type: application/json
Request Body:
1{
2 "protocols": {
3 "protocol": [
4 {
5 "identifier": "openconfig-policy-types:BGP",
6 "name": "bgp-example",
7 "bgp-openconfig-extensions:bgp": {
8 "global": {
9 "config": {
10 "router-id": "192.0.2.2",
11 "as": 65000
12 },
13 "apply-policy": {
14 "config": {
15 "import-policy": [
16 "default-odl-import-policy"
17 ],
18 "export-policy": [
19 "default-odl-export-policy"
20 ],
21 "default-export-policy": "REJECT-ROUTE",
22 "default-import-policy": "REJECT-ROUTE"
23 }
24 }
25 }
26 }
27 }
28 ]
29 }
30}
@line 6: The unique protocol instance identifier.
@line 10: BGP Identifier of the speaker.
@line 11: Local autonomous system number of the speaker. Note that, OpenDaylight BGP implementation supports four-octet AS numbers only.
@line 16: Default ODL Import Policy.
@line 19: Default ODL Export Policy.
The new instance presence can be verified via REST:
URL: /rests/data/bgp-rib:bgp-rib/rib=bgp-example?content=nonconfig
Method: GET
Response Body:
1<rib xmlns="urn:opendaylight:params:xml:ns:yang:bgp-rib">
2 <id>bgp-example</id>
3 <loc-rib>
4 <tables>
5 <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
6 <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
7 <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet"></ipv4-routes>
8 <attributes>
9 <uptodate>true</uptodate>
10 </attributes>
11 </tables>
12 </loc-rib>
13</rib>
@line 3: Loc-RIB - Per-protocol instance RIB, which contains the routes that have been selected by local BGP speaker’s decision process.
@line 4: The BGP-4 supports carrying IPv4 prefixes, such routes are stored in ipv4-address-family/unicast-subsequent-address-family table.
Response Body:
1{
2 "rib": [
3 {
4 "id": "bgp-example",
5 "loc-rib": {
6 "tables": [
7 {
8 "afi": "bgp-types:ipv4-address-family",
9 "safi": "bgp-types:unicast-subsequent-address-family",
10 "attributes": {
11 "uptodate": true
12 }
13 }
14 ]
15 }
16 }
17 ]
18}
@line 5: Loc-RIB - Per-protocol instance RIB, which contains the routes that have been selected by local BGP speaker’s decision process.
@line 6: The BGP-4 supports carrying IPv4 prefixes, such routes are stored in ipv4-address-family/unicast-subsequent-address-family table.