Merge "BGPCEP-781: Add path-id to all AFI/SAFI guides"
[docs.git] / docs / user-guide / bgpcep-guide / bgp / bgp-user-guide-operational-state.rst
1 .. _bgp-user-guide-operational-state:
2
3 Operational State
4 =================
5
6 The OpenDaylight BGP implementation provides a set of APIs (described below), that give its operational state refreshed periodically, by default every 5 seconds.
7 The following APIs describe what is available starting with how to change the default refresh rate.
8
9 .. contents:: Contents
10    :depth: 2
11    :local:
12
13 Operational State Configuration
14 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15
16 **URL:** ``/restconf/config/bgp-state-config:bgp-state-config``
17
18 **Method:** ``PUT``
19
20 **Content-Type:** ``application/xml``
21
22 **Request Body:**
23
24 .. code-block:: xml
25    :linenos:
26    :emphasize-lines: 3
27
28    <bgp-state-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
29        <config-name xmlns="urn:opendaylight:params:xml:ns:yang:bgp-state-config">operationalState</config-name>
30        <timer xmlns="urn:opendaylight:params:xml:ns:yang:bgp-state-config">1</timer>
31    </bgp-state-config>
32
33 @line 3: Time in seconds between operational state update.
34
35 BGP RIB Operational State
36 ^^^^^^^^^^^^^^^^^^^^^^^^^
37
38 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/global/state``
39
40 **Method:** ``GET``
41
42 **Content-Type:** ``application/xml``
43
44 **Response Body:**
45
46 .. code-block:: xml
47    :linenos:
48
49    <state xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
50        <as>65000</as>
51        <router-id>192.0.2.2</router-id>
52        <total-paths>0</total-paths>
53        <total-prefixes>0</total-prefixes>
54    </state>
55
56 @line 2: AS number of the remote peer.
57
58 @line 3: The unique protocol instance identifier.
59
60 @line 4: Total number of Paths installed on RIB (Loc-RIB)
61
62 @line 5: Total number of Prefixes installed on RIB (Loc-RIB)
63
64 BGP RIB Families Operational State
65 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
67 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/global/afi-safis``
68
69 **Method:** ``GET``
70
71 **Content-Type:** ``application/xml``
72
73 **Response Body:**
74
75 .. code-block:: xml
76    :linenos:
77    :emphasize-lines: 3,5,6
78
79    <afi-safis xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
80        <afi-safi>
81            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
82            <state>
83                <total-paths>0</total-paths>
84                <total-prefixes>0</total-prefixes>
85            </state>
86        </afi-safi>
87        <afi-safi>
88            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
89            <state>
90                <total-paths>0</total-paths>
91                <total-prefixes>0</total-prefixes>
92            </state>
93        </afi-safi>
94        ....
95    </afi-safis>
96
97 @line 3: Family Identifier.
98
99 @line 5: Total number of Paths installed on RIB (Loc-RIB) per specific family.
100
101 @line 6: Total number of Prefixes installed on RIB (Loc-RIB) per specific family.
102
103 BGP Neighbors Operational State
104 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105
106 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors``
107
108 **Method:** ``GET``
109
110 **Content-Type:** ``application/xml``
111
112 **Response Body:**
113
114 .. code-block:: xml
115    :linenos:
116    :emphasize-lines: 3
117
118    <neighbors xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
119        <neighbor>
120            <neighbor-address>192.0.2.1</neighbor-address>
121            .....
122        </neighbor>
123        <neighbor>
124            <neighbor-address>192.0.2.2</neighbor-address>
125            .....
126        </neighbor>
127    </neighbors>
128
129 @line 3: IP address of the remote BGP peer. Also serves as an unique identifier of a neighbor in a list of neighbors.
130
131 BGP Neighbor Operational State
132 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
133
134 .. note:: Supported Capabilities only provided when session has been established.
135
136 **URL:** ``/restconf/operational/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``
137
138 **Method:** ``GET``
139
140 **Content-Type:** ``application/xml``
141
142 **Response Body:**
143
144 .. code-block:: xml
145    :linenos:
146    :emphasize-lines: 2,3,4,7,8,11,12
147
148    <state xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
149        <session-state>ESTABLISHED</session-state>
150        <supported-capabilities xmlns:x="http://openconfig.net/yang/bgp-types">x:ASN32</supported-capabilities>
151        <supported-capabilities xmlns:x="http://openconfig.net/yang/bgp-types">x:MPBGP</supported-capabilities>
152        <messages>
153            <sent>
154                <UPDATE>0</UPDATE>
155                <NOTIFICATION>0</NOTIFICATION>
156            </sent>
157            <received>
158                <UPDATE>4</UPDATE>
159                <NOTIFICATION>0</NOTIFICATION>
160            </received>
161        </messages>
162    </state>
163
164 @line 2: Session status
165
166 @line 3-4: BGP capabilities supported ( ASN32 / MPBGP / ROUTE_REFRESH / GRACEFUL_RESTART / ADD_PATHS)
167
168 @line 7: Total count of Update Messages sent
169
170 @line 8: Total count of Notification Messages sent
171
172 @line 11: Total count of Update Messages received
173
174 @line 12: Total count of Notification Messages received
175
176 BGP Neighbor Families Operational State
177 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
178
179 .. note:: Graceful Restart not supported yet. Planned for Carbon.
180
181
182 **URL:** ``/restconf/operational/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``
183
184 **Method:** ``GET``
185
186 **Content-Type:** ``application/xml``
187
188 **Response Body:**
189
190 .. code-block:: xml
191    :linenos:
192    :emphasize-lines: 3,5,7,9,10
193
194    <afi-safis xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
195         <afi-safi>
196             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
197             <state>
198                 <active>false</active>
199             </state>
200             <graceful-restart>
201                 <state>
202                     <received>false</received>
203                     <advertised>false</advertised>
204                 </state>
205             </graceful-restart>
206         </afi-safi>
207         <afi-safi>
208             <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
209             <state>
210                 <active>false</active>
211             </state>
212             <graceful-restart>
213                 <state>
214                     <received>false</received>
215                     <advertised>false</advertised>
216                 </state>
217             </graceful-restart>
218         </afi-safi>
219    </afi-safis>
220
221 @line 3: Family Identifier.
222
223 @line 5: True if family is advertized by peer.
224
225 @line 7: Graceful Restart Operational State per specific family.
226
227 @line 9: True if the peer supports graceful restart.
228
229 @line 10: True if we support graceful restart.
230
231 BGP Neighbor Family Operational State
232 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
233
234 .. note:: Prefixes state is only provided once session is established.
235 .. note:: Graceful Restart not supported yet. Planned to be implemented in Carbon.
236
237 **URL:** ``/restconf/operational/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``
238
239 **Method:** ``GET``
240
241 **Content-Type:** ``application/xml``
242
243 **Response Body:**
244
245 .. code-block:: xml
246    :linenos:
247    :emphasize-lines: 2,4,6,7,8
248
249    <afi-safi xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
250        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
251        <state>
252            <active>true</active>
253            <prefixes>
254                <installed>3</installed>
255                <sent>0</sent>
256                <received>3</received>
257            </prefixes>
258        </state>
259        <graceful-restart>
260            <state>
261                <received>false</received>
262                <advertised>false</advertised>
263            </state>
264        </graceful-restart>
265    </afi-safi>
266
267 @line 2: Family Identifier.
268
269 @line 4: True if family is advertized to and by peer.
270
271 @line 6: Total count of prefixes advertized by peer and installed (effective-rib-in).
272
273 @line 7: Total count of prefixes advertized to peer (adj-rib-out).
274
275 @line 8: Total count of prefixes advertized by peer (adj-rib-in).
276
277 BGP Neighbor Timers Operational State
278 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
279
280 .. note:: State is only provided once session is established.
281
282 **URL:** ``/restconf/operational/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``
283
284 **Method:** ``GET``
285
286 **Content-Type:** ``application/xml``
287
288 **Response Body:**
289
290 .. code-block:: xml
291    :linenos:
292    :emphasize-lines: 3,4
293
294    <timers xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
295        <state>
296            <negotiated-hold-time>180</negotiated-hold-time>
297            <uptime>1580676</uptime>
298        </state>
299    </timers>
300
301 @line 3: The negotiated hold-time for the BGP session in seconds.
302
303 @line 4: Session duration since establishment in milliseconds.
304
305 BGP Neighbor Transport Operational State
306 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
307
308 .. note:: State is only provided once session is established.
309
310 **URL:** ``/restconf/operational/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``
311
312 **Method:** ``GET``
313
314 **Content-Type:** ``application/xml``
315
316 **Response Body:**
317
318 .. code-block:: xml
319    :linenos:
320    :emphasize-lines: 3,4,5
321
322    <transport xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
323        <state>
324            <remote-address>127.0.0.2</remote-address>
325            <remote-port>44718</remote-port>
326            <local-port>1790</local-port>
327        </state>
328    </transport>
329
330 @line 3: IP address of the remote BGP peer.
331
332 @line 4: Port of the remote BGP peer.
333
334 @line 5: Local port.
335
336 BGP Neighbor Error Handling Operational State
337 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
338
339 .. note:: State is only provided once session is established.
340 .. note:: Error handling not supported yet. Planned for Carbon.
341
342 **URL:** ``/restconf/operational/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``
343
344 **Method:** ``GET``
345
346 **Content-Type:** ``application/xml``
347
348 **Response Body:**
349
350 .. code-block:: xml
351    :linenos:
352    :emphasize-lines: 3
353
354    <error-handling xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
355        <state>
356            <erroneous-update-messages>0</erroneous-update-messages>
357        </state>
358    </error-handling>
359
360 @line 3: The number of BGP UPDATE messages for which the treat-as-withdraw mechanism has been applied based on
361 erroneous message contents
362
363 BGP Neighbor Graceful Restart Operational State
364 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
365
366 .. note:: Graceful Restart not supported yet. Planned for Carbon.
367
368 **URL:** ``/restconf/operational/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``
369
370 **Method:** ``GET``
371
372 **Content-Type:** ``application/xml``
373
374 **Response Body:**
375
376 .. code-block:: xml
377    :linenos:
378    :emphasize-lines: 3,4,5
379
380    <graceful-restart xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
381        <state>
382            <peer-restart-time>0</peer-restart-time>
383            <peer-restarting>false</peer-restarting>
384            <local-restarting>false</local-restarting>
385        </state>
386    </graceful-restart>
387
388 @line 3: The period of time (advertised by the peer) that the peer expects a restart of a BGP session to take.
389
390 @line 4: This flag indicates whether the remote neighbor is currently in the process of restarting, and hence
391 received routes are currently stale.
392
393 @line 5: This flag indicates whether the local neighbor is currently restarting. The flag is unset after all NLRI
394 have been advertised to the peer, and the End-of-RIB (EOR) marker has been unset.
395
396 BGP Peer Groups Operational State
397 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
398
399 **URL:** ``/restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/peer-groups``
400
401 **Method:** ``GET``
402
403 **Content-Type:** ``application/xml``
404
405 **Response Body:**
406
407 .. code-block:: xml
408    :linenos:
409    :emphasize-lines: 3,5,6
410
411    <peer-groups>
412        <peer-group>
413            <peer-group-name>application-peers</peer-group-name>
414            <state>
415                <total-paths>0</total-paths>
416                <total-prefixes>0</total-prefixes>
417            </state>
418        </peer-group>
419    </peer-groups>
420
421 @line 3: Peer Group Identifier.
422
423 @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.
424
425 @line 6: Total Prefixes installed under by peers pertaining to this peer group (effective-rib-in).
426 This count doesn't differentiate repeated prefixes.
427
428 CLI
429 ---
430
431 BGP Karaf Console (odl-bgpcep-bgp-cli) provides a CLI feature to read operational state per RIB, Neighbor and Peer Group.
432
433 .. code-block:: bash
434    :linenos:
435
436    opendaylight-user@root> bgp:operational-state -rib example-bgp-rib
437
438 .. code-block:: bash
439    :linenos:
440
441    opendaylight-user@root> bgp:operational-state -rib example-bgp-rib -neighbor 192.0.2.1
442
443 .. code-block:: bash
444    :linenos:
445
446    opendaylight-user@root> bgp:operational-state -rib -peer-group application-peers