Operational State¶
The OpenDaylight BGP implementation provides a set of APIs (described below), that give its operational state refreshed periodically, by default every 5 seconds. The following APIs describe what is available starting with how to change the default refresh rate.
Operational State Configuration¶
URL: /rests/data/bgp-state-config:bgp-state-config
Method: PUT
Content-Type: application/xml
Request Body:
1<bgp-state-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
2 <config-name xmlns="urn:opendaylight:params:xml:ns:yang:bgp-state-config">operationalState</config-name>
3 <timer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-state-config">1</timer>
4</bgp-state-config>
@line 3: Time in seconds between operational state update.
Method: PUT
Content-Type: application/json
Request Body:
1{
2 "bgp-state-config": {
3 "config-name": "operationalState",
4 "timer": 1
5 }
6}
@line 4: Time in seconds between operational state update.
BGP RIB Operational State¶
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/global/state?content=nonconfig
Method: GET
Content-Type: application/xml
Response Body:
1<state xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2 <as>65000</as>
3 <router-id>192.0.2.2</router-id>
4 <total-paths>0</total-paths>
5 <total-prefixes>0</total-prefixes>
6</state>
@line 2: AS number of the remote peer.
@line 3: The unique protocol instance identifier.
@line 4: Total number of Paths installed on RIB (Loc-RIB)
@line 5: Total number of Prefixes installed on RIB (Loc-RIB)
Content-Type: application/json
Response Body:
1{
2 "bgp-openconfig-extensions:state": {
3 "as": 65000,
4 "router-id": "192.0.2.2",
5 "total-paths": 0,
6 "total-prefixes": 0
7 }
8}
@line 3: AS number of the remote peer.
@line 4: The unique protocol instance identifier.
@line 5: Total number of Paths installed on RIB (Loc-RIB)
@line 6: Total number of Prefixes installed on RIB (Loc-RIB)
BGP RIB Families Operational State¶
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/global/afi-safis?content=nonconfig
Method: GET
Content-Type: application/xml
Response Body:
1<afi-safis xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2 <afi-safi>
3 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4 <state>
5 <total-paths>0</total-paths>
6 <total-prefixes>0</total-prefixes>
7 </state>
8 </afi-safi>
9 <afi-safi>
10 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
11 <state>
12 <total-paths>0</total-paths>
13 <total-prefixes>0</total-prefixes>
14 </state>
15 </afi-safi>
16 ....
17</afi-safis>
@line 3: Family Identifier.
@line 5: Total number of Paths installed on RIB (Loc-RIB) per specific family.
@line 6: Total number of Prefixes installed on RIB (Loc-RIB) per specific family.
Content-Type: application/json
Response Body:
1{
2 "bgp-openconfig-extensions:afi-safis": {
3 "afi-safi": [
4 {
5 "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
6 "state": {
7 "total-paths": 0,
8 "total-prefixes": 0
9 },
10 "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST",
11 "state": {
12 "total-paths": 0,
13 "total-prefixes": 0
14 }
15 }
16 ]
17 }
18}
@line 5: Family Identifier.
@line 7: Total number of Paths installed on RIB (Loc-RIB) per specific family.
@line 8: Total number of Prefixes installed on RIB (Loc-RIB) per specific family.
BGP Neighbors Operational State¶
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?content=nonconfig
Method: GET
Content-Type: application/xml
Response Body:
1<neighbors xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2 <neighbor>
3 <neighbor-address>192.0.2.1</neighbor-address>
4 .....
5 </neighbor>
6 <neighbor>
7 <neighbor-address>192.0.2.2</neighbor-address>
8 .....
9 </neighbor>
10</neighbors>
@line 3: IP address of the remote BGP peer. Also serves as an unique identifier of a neighbor in a list of neighbors.
Content-Type: application/json
Response Body:
1{
2 "bgp-openconfig-extensions:neighbors": {
3 "neighbor": [
4 {
5 "neighbor-address": "192.0.2.1"
6 },
7 {
8 "neighbor-address": "192.0.2.2"
9 }
10 ]
11 }
12}
@line 5: IP address of the remote BGP peer. Also serves as an unique identifier of a neighbor in a list of neighbors.
BGP Neighbor Operational State¶
Note
Supported Capabilities only provided when session has been established.
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/neighbor=127.0.0.2/state?content=nonconfig
Method: GET
Content-Type: application/xml
Response Body:
1<state xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2 <session-state>ESTABLISHED</session-state>
3 <supported-capabilities xmlns:x="http://openconfig.net/yang/bgp-types">x:ASN32</supported-capabilities>
4 <supported-capabilities xmlns:x="http://openconfig.net/yang/bgp-types">x:MPBGP</supported-capabilities>
5 <messages>
6 <sent>
7 <UPDATE>0</UPDATE>
8 <NOTIFICATION>0</NOTIFICATION>
9 </sent>
10 <received>
11 <UPDATE>4</UPDATE>
12 <NOTIFICATION>0</NOTIFICATION>
13 </received>
14 </messages>
15</state>
@line 2: Session status
@line 3-4: BGP capabilities supported ( ASN32 / MPBGP / ROUTE_REFRESH / GRACEFUL_RESTART / ADD_PATHS)
@line 7: Total count of Update Messages sent
@line 8: Total count of Notification Messages sent
@line 11: Total count of Update Messages received
@line 12: Total count of Notification Messages received
Content-Type: application/json
Response Body:
1{
2 "bgp:openconfig-extensions:state": {
3 "session-state": "ESTABLISHED",
4 "supported-capabilities": [
5 "openconfig-bgp-types:ASN32",
6 "openconfig-bgp-types:MPBGP"
7 ],
8 "messages": {
9 "sent": {
10 "UPDATE": 0,
11 "NOTIFICATION": 0
12 },
13 "received": {
14 "UPDATE": 4,
15 "NOTIFICATION": 0
16 }
17 }
18 }
19}
@line 3: Session status
@line 4-7: BGP capabilities supported ( ASN32 / MPBGP / ROUTE_REFRESH / GRACEFUL_RESTART / ADD_PATHS)
@line 10: Total count of Update Messages sent
@line 11: Total count of Notification Messages sent
@line 14: Total count of Update Messages received
@line 15: Total count of Notification Messages received
BGP Neighbor Families Operational State¶
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/neighbor=192.0.2.1/afi-safis?content=nonconfig
Method: GET
Content-Type: application/xml
Response Body:
1<afi-safis xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2 <afi-safi>
3 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
4 <state>
5 <active>false</active>
6 </state>
7 <graceful-restart>
8 <state>
9 <received>true</received>
10 <ll-received>true</ll-received>
11 <ll-advertised>true</ll-advertised>
12 <ll-stale-timer>180</ll-stale-timer>
13 <advertised>true</advertised>
14 </state>
15 </graceful-restart>
16 </afi-safi>
17 <afi-safi>
18 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
19 <state>
20 <active>false</active>
21 </state>
22 <graceful-restart>
23 <state>
24 <received>true</received>
25 <ll-received>true</ll-received>
26 <ll-advertised>true</ll-advertised>
27 <ll-stale-timer>100</ll-stale-timer>
28 <advertised>true</advertised>
29 </state>
30 </graceful-restart>
31 </afi-safi>
32</afi-safis>
@line 3: Family Identifier.
@line 5: True if family is advertized by peer.
@line 7: Graceful Restart Operational State per specific family.
@line 9: True if the peer supports graceful restart.
@line 10: True if peer supports Long-Lived graceful restart.
@line 11: True if we supports Long-Lived graceful restart.
@line 12: Value of Long-Lived stale timer in seconds for specific family
@line 13: True if we support graceful restart.
Content-Type: application/json
Response Body:
1{
2 "bgp-openconfig-extensions:afi-safis": {
3 "afi-safi": [
4 {
5 "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
6 "state": {
7 "active": false
8 },
9 "graceful-restart": {
10 "state": {
11 "received": true,
12 "ll-received": true,
13 "ll-advertised": true,
14 "ll-stale-timer": 180,
15 "advertised": true
16 }
17 }
18 },
19 {
20 "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST",
21 "state": {
22 "active": false
23 },
24 "graceful-restart": {
25 "state": {
26 "received": true,
27 "ll-received": true,
28 "ll-advertised": true,
29 "ll-stale-timer": 100,
30 "advertised": true
31 }
32 }
33 }
34 ]
35 }
36}
@line 5: Family Identifier.
@line 7: True if family is advertized by peer.
@line 9: Graceful Restart Operational State per specific family.
@line 11: True if the peer supports graceful restart.
@line 12: True if peer supports Long-Lived graceful restart.
@line 13: True if we supports Long-Lived graceful restart.
@line 14: Value of Long-Lived stale timer in seconds for specific family
@line 15: True if we support graceful restart.
BGP Neighbor Family Operational State¶
Note
Prefixes state is only provided once session is established.
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/neighbor=192.0.2.1/afi-safis/afi-safi=openconfig-bgp-types:IPV4%2DUNICAST?content=nonconfig
Method: GET
Content-Type: application/xml
Response Body:
1<afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
3 <state>
4 <active>true</active>
5 <prefixes>
6 <installed>3</installed>
7 <sent>0</sent>
8 <received>3</received>
9 </prefixes>
10 </state>
11 <graceful-restart>
12 <state>
13 <received>true</received>
14 <ll-received>true</ll-received>
15 <ll-advertised>true</ll-advertised>
16 <ll-stale-timer>180</ll-stale-timer>
17 <advertised>true</advertised>
18 </state>
19 </graceful-restart>
20</afi-safi>
@line 2: Family Identifier.
@line 4: True if family is advertized to and by peer.
@line 6: Total count of prefixes advertized by peer and installed (effective-rib-in).
@line 7: Total count of prefixes advertized to peer (adj-rib-out).
@line 8: Total count of prefixes advertized by peer (adj-rib-in).
Content-Type: application/json
Response Body:
1{
2 "bgp-openconfig-extensions:afi-safi": [
3 {
4 "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
5 "state": {
6 "active": true,
7 "prefixes": {
8 "installed": 3,
9 "sent": 0 ,
10 "received": 3
11 }
12 },
13 "graceful-restart": {
14 "state": {
15 "received": true,
16 "ll-received": true,
17 "ll-advertised": true,
18 "ll-stale-timer": 180,
19 "advertised": true
20 }
21 }
22 }
23 ]
24}
@line 3: Family Identifier.
@line 5: True if family is advertized to and by peer.
@line 8: Total count of prefixes advertized by peer and installed (effective-rib-in).
@line 9: Total count of prefixes advertized to peer (adj-rib-out).
@line 10: Total count of prefixes advertized by peer (adj-rib-in).
BGP Neighbor Timers Operational State¶
Note
State is only provided once session is established.
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/neighbor=192.0.2.1/timers?content=nonconfig
Method: GET
Content-Type: application/xml
Response Body:
1<timers xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2 <state>
3 <negotiated-hold-time>180</negotiated-hold-time>
4 <uptime>1580676</uptime>
5 </state>
6</timers>
@line 3: The negotiated hold-time for the BGP session in seconds.
@line 4: Session duration since establishment in timeticks (hundredths of a second).
Content-Type: application/json
Response Body:
1{
2 "bgp:openconfig-extensions:timers": {
3 "state": {
4 "negotiated-hold-time": 180,
5 "uptime": 1580676
6 }
7 }
8}
@line 4: The negotiated hold-time for the BGP session in seconds.
@line 5: Session duration since establishment in timeticks (hundredths of a second).
BGP Neighbor Transport Operational State¶
Note
State is only provided once session is established.
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/neighbor=192.0.2.1/transport?content=nonconfig
Method: GET
Content-Type: application/xml
Response Body:
1<transport xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2 <state>
3 <remote-address>127.0.0.2</remote-address>
4 <remote-port>44718</remote-port>
5 <local-port>1790</local-port>
6 </state>
7</transport>
@line 3: IP address of the remote BGP peer.
@line 4: Port of the remote BGP peer.
@line 5: Local port.
Content-Type: application/json
Response Body:
1{
2 "bgp:openconfig-extensions:transport": {
3 "state": {
4 "remote-address": "127.0.0.2",
5 "remote-port": 44718,
6 "local-port": 1790
7 }
8 }
9}
@line 4: IP address of the remote BGP peer.
@line 5: Port of the remote BGP peer.
@line 6: Local port.
BGP Neighbor Error Handling Operational State¶
Note
State is only provided once session is established.
Note
Error handling not supported yet. Planned for Carbon.
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/neighbor=192.0.2.1/error-handling?content=nonconfig
Method: GET
Content-Type: application/xml
Response Body:
1<error-handling xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2 <state>
3 <erroneous-update-messages>0</erroneous-update-messages>
4 </state>
5</error-handling>
@line 3: The number of BGP UPDATE messages for which the treat-as-withdraw mechanism has been applied based on erroneous message contents
Content-Type: application/json
Response Body:
1{
2 "bgp-openconfig-extensions:error-handling": {
3 "state": {
4 "erroneous-update-messages": 0
5 }
6 }
7}
@line 4: The number of BGP UPDATE messages for which the treat-as-withdraw mechanism has been applied based on erroneous message contents
BGP Neighbor Graceful Restart Operational State¶
Note
Graceful Restart not supported yet. Planned for Carbon.
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/neighbor=192.0.2.1/graceful-restart?content=nonconfig
Method: GET
Content-Type: application/xml
Response Body:
1<graceful-restart xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
2 <state>
3 <peer-restarting>false</peer-restarting>
4 <local-restarting>false</local-restarting>
5 <peer-restart-time>5</peer-restart-time>
6 <mode>BILATERAL</mode>
7 </state>
8</graceful-restart>
@line 3: This flag indicates whether the remote neighbor is currently in the process of restarting, and hence received routes are currently stale.
@line 4: This flag indicates whether the local neighbor is currently restarting. The flag is unset after all NLRI have been advertised to the peer, and the End-of-RIB (EOR) marker has been unset.
@line 5: The period of time (advertised by the peer) in seconds that the peer expects a restart of a BGP session to take.
@line 6: Mode of Graceful Restart operation, depending on family support advertising to peer and receiving from peer can be HELPER-ONLY (only remote peers support some families), REMOTE-HELPER (only we advertise support), BILATERAL (two-side support).
Content-Type: application/json
Response Body:
1{
2 "bgp-openconfig-extensions:graceful-restart": {
3 "state": {
4 "peer-restarting": false,
5 "local-restarting": false,
6 "peer-restart-time": 0,
7 "mode": "HELPER-ONLY"
8 }
9 }
10}
@line 4: This flag indicates whether the remote neighbor is currently in the process of restarting, and hence received routes are currently stale.
@line 5: This flag indicates whether the local neighbor is currently restarting. The flag is unset after all NLRI have been advertised to the peer, and the End-of-RIB (EOR) marker has been unset.
@line 6: The period of time (advertised by the peer) in seconds that the peer expects a restart of a BGP session to take.
@line 7: Mode of Graceful Restart operation, depending on family support advertising to peer and receiving from peer can be HELPER-ONLY (only remote peers support some families), REMOTE-HELPER (only we advertise support), BILATERAL (two-side support).
BGP Peer Groups Operational State¶
URL: /rests/data/openconfig-network-instance:network-instances/network-instance=global-bgp/openconfig-network-instance:protocols/protocol=openconfig-policy-types:BGP,bgp-example/peer-groups?content=nonconfig
Method: GET
Content-Type: application/xml
Response Body:
1<peer-groups>
2 <peer-group>
3 <peer-group-name>application-peers</peer-group-name>
4 <state>
5 <total-paths>0</total-paths>
6 <total-prefixes>0</total-prefixes>
7 </state>
8 </peer-group>
9</peer-groups>
@line 3: Peer Group Identifier.
@line 5: At this moment the cost for count path under effect-rib-in is to high. Therefore the value is the same as total prefixes.
@line 6: Total Prefixes installed under by peers pertaining to this peer group (effective-rib-in). This count doesn’t differentiate repeated prefixes.
Content-Type: application/json
Response Body:
1{
2 "peer-groups": {
3 "peer-group": {
4 "peer-group-name": "application-peers",
5 "state": {
6 "total-paths": 0,
7 "total-prefixes": 0
8 }
9 }
10 }
11}
@line 4: Peer Group Identifier.
@line 6: At this moment the cost for count path under effect-rib-in is to high. Therefore the value is the same as total prefixes.
@line 7: Total Prefixes installed under by peers pertaining to this peer group (effective-rib-in). This count doesn’t differentiate repeated prefixes.
CLI¶
BGP Karaf Console (odl-bgpcep-bgp-cli) provides a CLI feature to read operational state per RIB, Neighbor and Peer Group.
1opendaylight-user@root> bgp:operational-state -rib example-bgp-rib
1opendaylight-user@root> bgp:operational-state -rib example-bgp-rib -neighbor 192.0.2.1
1opendaylight-user@root> bgp:operational-state -rib -peer-group application-peers