.. _bgp-user-guide-operational-state: 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. .. contents:: Contents :depth: 2 :local: Operational State Configuration ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **URL:** ``/rests/data/bgp-state-config:bgp-state-config`` **Method:** ``PUT`` .. tabs:: .. tab:: XML **Content-Type:** ``application/xml`` **Request Body:** .. code-block:: xml :linenos: :emphasize-lines: 3 operationalState 1 @line 3: Time in seconds between operational state update. .. tab:: JSON **Method:** ``PUT`` **Content-Type:** ``application/json`` **Request Body:** .. code-block:: json :linenos: :emphasize-lines: 4 { "bgp-state-config": { "config-name": "operationalState", "timer": 1 } } @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/global/state?content=nonconfig`` **Method:** ``GET`` .. tabs:: .. tab:: XML **Content-Type:** ``application/xml`` **Response Body:** .. code-block:: xml :linenos: :emphasize-lines: 2,3,4,5 65000 192.0.2.2 0 0 @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) .. tab:: JSON **Content-Type:** ``application/json`` **Response Body:** .. code-block:: json :linenos: :emphasize-lines: 3,4,5,6 { "bgp-openconfig-extensions:state": { "as": 65000, "router-id": "192.0.2.2", "total-paths": 0, "total-prefixes": 0 } } @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/global/afi-safis?content=nonconfig`` **Method:** ``GET`` .. tabs:: .. tab:: XML **Content-Type:** ``application/xml`` **Response Body:** .. code-block:: xml :linenos: :emphasize-lines: 3,5,6 x:IPV4-UNICAST 0 0 x:IPV6-UNICAST 0 0 .... @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. .. tab:: JSON **Content-Type:** ``application/json`` **Response Body:** .. code-block:: json :linenos: :emphasize-lines: 5,7,8 { "bgp-openconfig-extensions:afi-safis": { "afi-safi": [ { "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST", "state": { "total-paths": 0, "total-prefixes": 0 }, "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST", "state": { "total-paths": 0, "total-prefixes": 0 } } ] } } @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/neighbors?content=nonconfig`` **Method:** ``GET`` .. tabs:: .. tab:: XML **Content-Type:** ``application/xml`` **Response Body:** .. code-block:: xml :linenos: :emphasize-lines: 3 192.0.2.1 ..... 192.0.2.2 ..... @line 3: IP address of the remote BGP peer. Also serves as an unique identifier of a neighbor in a list of neighbors. .. tab:: JSON **Content-Type:** ``application/json`` **Response Body:** .. code-block:: json :linenos: :emphasize-lines: 5 { "bgp-openconfig-extensions:neighbors": { "neighbor": [ { "neighbor-address": "192.0.2.1" }, { "neighbor-address": "192.0.2.2" } ] } } @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/neighbors/neighbor/127.0.0.2/state?content=nonconfig`` **Method:** ``GET`` .. tabs:: .. tab:: XML **Content-Type:** ``application/xml`` **Response Body:** .. code-block:: xml :linenos: :emphasize-lines: 2,3,4,7,8,11,12 ESTABLISHED x:ASN32 x:MPBGP 0 0 4 0 @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 .. tab:: JSON **Content-Type:** ``application/json`` **Response Body:** .. code-block:: json :linenos: :emphasize-lines: 3,4,7,10,11,14,15 { "bgp:openconfig-extensions:state": { "session-state": "ESTABLISHED", "supported-capabilities": [ "openconfig-bgp-types:ASN32", "openconfig-bgp-types:MPBGP" ], "messages": { "sent": { "UPDATE": 0, "NOTIFICATION": 0 }, "received": { "UPDATE": 4, "NOTIFICATION": 0 } } } } @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/neighbors/neighbor/192.0.2.1/afi-safis?content=nonconfig`` **Method:** ``GET`` .. tabs:: .. tab:: XML **Content-Type:** ``application/xml`` **Response Body:** .. code-block:: xml :linenos: :emphasize-lines: 3,5,7,9,10,11,12,13 x:IPV4-UNICAST false true true true 180 true x:IPV6-UNICAST false true true true 100 true @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. .. tab:: JSON **Content-Type:** ``application/json`` **Response Body:** .. code-block:: json :linenos: :emphasize-lines: 5,7,9,11,12,13,14,15 { "bgp-openconfig-extensions:afi-safis": { "afi-safi": [ { "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST", "state": { "active": false }, "graceful-restart": { "state": { "received": true, "ll-received": true, "ll-advertised": true, "ll-stale-timer": 180, "advertised": true } } }, { "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST", "state": { "active": false }, "graceful-restart": { "state": { "received": true, "ll-received": true, "ll-advertised": true, "ll-stale-timer": 100, "advertised": true } } } ] } } @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/neighbors/neighbor/192.0.2.1/afi-safis/afi-safi=openconfig-bgp-types:IPV4%2DUNICAST?content=nonconfig`` **Method:** ``GET`` .. tabs:: .. tab:: XML **Content-Type:** ``application/xml`` **Response Body:** .. code-block:: xml :linenos: :emphasize-lines: 2,4,6,7,8 x:IPV4-UNICAST true 3 0 3 true true true 180 true @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). .. tab:: JSON **Content-Type:** ``application/json`` **Response Body:** .. code-block:: json :linenos: :emphasize-lines: 3,5,8,9,10 { "bgp-openconfig-extensions:afi-safi": [ { "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST", "state": { "active": true, "prefixes": { "installed": 3, "sent": 0 , "received": 3 } }, "graceful-restart": { "state": { "received": true, "ll-received": true, "ll-advertised": true, "ll-stale-timer": 180, "advertised": true } } } ] } @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/neighbors/neighbor/192.0.2.1/timers?content=nonconfig`` **Method:** ``GET`` .. tabs:: .. tab:: XML **Content-Type:** ``application/xml`` **Response Body:** .. code-block:: xml :linenos: :emphasize-lines: 3,4 180 1580676 @line 3: The negotiated hold-time for the BGP session in seconds. @line 4: Session duration since establishment in timeticks (hundredths of a second). .. tab:: JSON **Content-Type:** ``application/json`` **Response Body:** .. code-block:: json :linenos: :emphasize-lines: 4,5 { "bgp:openconfig-extensions:timers": { "state": { "negotiated-hold-time": 180, "uptime": 1580676 } } } @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/neighbors/neighbor/192.0.2.1/transport?content=nonconfig`` **Method:** ``GET`` .. tabs:: .. tab:: XML **Content-Type:** ``application/xml`` **Response Body:** .. code-block:: xml :linenos: :emphasize-lines: 3,4,5 127.0.0.2 44718 1790 @line 3: IP address of the remote BGP peer. @line 4: Port of the remote BGP peer. @line 5: Local port. .. tab:: JSON **Content-Type:** ``application/json`` **Response Body:** .. code-block:: json :linenos: :emphasize-lines: 4,5,6 { "bgp:openconfig-extensions:transport": { "state": { "remote-address": "127.0.0.2", "remote-port": 44718, "local-port": 1790 } } } @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/neighbors/neighbor/192.0.2.1/error-handling?content=nonconfig`` **Method:** ``GET`` .. tabs:: .. tab:: XML **Content-Type:** ``application/xml`` **Response Body:** .. code-block:: xml :linenos: :emphasize-lines: 3 0 @line 3: The number of BGP UPDATE messages for which the treat-as-withdraw mechanism has been applied based on erroneous message contents .. tab:: JSON **Content-Type:** ``application/json`` **Response Body:** .. code-block:: json :linenos: :emphasize-lines: 4 { "bgp-openconfig-extensions:error-handling": { "state": { "erroneous-update-messages": 0 } } } @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/neighbors/neighbor/192.0.2.1/graceful-restart?content=nonconfig`` **Method:** ``GET`` .. tabs:: .. tab:: XML **Content-Type:** ``application/xml`` **Response Body:** .. code-block:: xml :linenos: :emphasize-lines: 3,4,5,6 false false 5 BILATERAL @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). .. tab:: JSON **Content-Type:** ``application/json`` **Response Body:** .. code-block:: json :linenos: :emphasize-lines: 4,5,6,7 { "bgp-openconfig-extensions:graceful-restart": { "state": { "peer-restarting": false, "local-restarting": false, "peer-restart-time": 0, "mode": "HELPER-ONLY" } } } @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`` .. tabs:: .. tab:: XML **Content-Type:** ``application/xml`` **Response Body:** .. code-block:: xml :linenos: :emphasize-lines: 3,5,6 application-peers 0 0 @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. .. tab:: JSON **Content-Type:** ``application/json`` **Response Body:** .. code-block:: json :linenos: :emphasize-lines: 4,6,7 { "peer-groups": { "peer-group": { "peer-group-name": "application-peers", "state": { "total-paths": 0, "total-prefixes": 0 } } } } @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. .. code-block:: bash :linenos: opendaylight-user@root> bgp:operational-state -rib example-bgp-rib .. code-block:: bash :linenos: opendaylight-user@root> bgp:operational-state -rib example-bgp-rib -neighbor 192.0.2.1 .. code-block:: bash :linenos: opendaylight-user@root> bgp:operational-state -rib -peer-group application-peers