Update BMP test tool argument doc
[docs.git] / docs / user-guide / bgp-monitoring-protocol-user-guide.rst
1 .. _bgp-monitoring-protocol-user-guide:
2 BGP Monitoring Protocol User Guide
3 ==================================
4 This guide contains information on how to use the OpenDaylight BGP Monitoring Protocol (BMP) plugin.
5 It covers BMP basic concepts, supported capabilities, configuration and operations.
6
7 .. contents:: Contents
8    :depth: 1
9    :local:
10
11 Overview
12 --------
13 This section provides high-level overview of the BMP plugin, OpenDaylight implementation and BMP usage for SDN.
14
15 .. contents:: Contents
16    :depth: 2
17    :local:
18
19 BGP Monitoring Protocol
20 ^^^^^^^^^^^^^^^^^^^^^^^
21 The BGP Monitoring Protocol (BMP) serves to monitor BGP sessions.
22 The BMP can be used to obtain route view instead of screen scraping.
23 The BMP provides access to unprocessed routing information (Adj-RIB-In) and processed routes (applied inbound policy) of monitored router's peer.
24 In addition, monitored router can provide periodic dump of statistics.
25
26 The BMP runs over TCP.
27 Both monitored router and monitoring station can be configured as active or passive party of the connection.
28 The passive party listens at particular port.
29 The router can be monitored by multiple monitoring stations.
30 BMP messages are sent by monitored router only, monitoring station supposed to collect and process data received over BMP.
31
32 .. figure:: ./images/bgpcep/bmp.png
33    :align: center
34    :alt: BMP
35
36    The BMP overview - Monitoring Station, Monitored Router and Monitored Peers.
37
38
39 BMP in SDN
40 ^^^^^^^^^^
41 The main concept of BMP is to monitor BGP sessions - monitoring station is aware of monitored peer's status, collects statistics and analyzes them in order to provide valuable information for network operators.
42
43 Moreover, BMP provides provides peer RIBs visibility, without need to establish BGP sessions.
44 Unprocessed routes may serve as a source of information for software-driven routing optimization.
45 In this case, SDN controller, a BMP monitoring station, collects routing information from monitored routers.
46 The routes are used in subsequent optimization procedures.
47
48
49 OpenDaylight BMP plugin
50 ^^^^^^^^^^^^^^^^^^^^^^^
51 The OpenDaylight BMP plugin provides monitoring station implementation.
52 The plugin can establish BMP session with one or more monitored routers in order to collect routing and statistical information.
53
54 * Runtime configurable monitoring station
55 * Read-only routes and statistics view
56 * Supports various routing information types
57
58 .. figure:: ./images/bgpcep/bmp-plugin.png
59    :align: center
60    :alt: BMP plugin
61
62    OpenDaylight BMP plugin overview.
63
64 .. important:: The BMP plugin is not storing historical data, it provides current snapshot only.
65
66 List of supported capabilities
67 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68 The BMP plugin implementation is based on Internet standards:
69
70 * `RFC7854 <https://tools.ietf.org/html/rfc7854>`_ - BGP Monitoring Protocol (BMP)
71
72 .. note:: The BMP plugin is capable to process various types of routing information (IP Unicast, EVPN, L3VPN, Link-State,...).
73    Please, see complete list in BGP user guide.
74
75 Running BMP
76 -----------
77 This section explains how to install BMP plugin.
78
79 1. Install BMP feature - ``odl-bgpcep-bmp``.
80    Also, for sake of this sample, it is required to install RESTCONF.
81    In the Karaf console, type command:
82
83    .. code-block:: console
84
85       feature:install odl-restconf odl-bgpcep-bmp
86
87 2. The BMP plugin contains a default configuration, which is applied after the feature starts up.
88    One instance of BMP monitoring station is created (named *example-bmp-monitor*), and its presence can be verified via REST:
89
90    **URL:** ``/restconf/config/odl-bmp-monitor-config:odl-bmp-monitors/bmp-monitor-config/example-bmp-monitor``
91
92    **Method:** ``GET``
93
94    **Response Body:**
95
96    .. code-block:: xml
97
98       <bmp-monitor-config xmlns="urn:opendaylight:params:xml:ns:yang:bmp-monitor-config">
99          <monitor-id>example-bmp-monitor</monitor-id>
100          <server>
101             <binding-port>12345</binding-port>
102             <binding-address>0.0.0.0</binding-address>
103          </server>
104       </bmp-monitor-config>
105
106 BMP Monitoring Station
107 ----------------------
108 The following section shows how to configure BMP basics, how to verify functionality and presents essential components of the plugin. Next samples demonstrate the plugin’s runtime configuration capability.
109
110 The monitoring station is responsible for received BMP PDUs processing and storage.
111 The default BMP server is listening at port *12345*.
112
113 .. contents:: Contents
114    :depth: 2
115    :local:
116
117 Configuration
118 ^^^^^^^^^^^^^
119 This section shows the way to configure the BMP monitoring station via REST API.
120
121 Monitoring station configuration
122 ''''''''''''''''''''''''''''''''
123 In order to change default's BMP monitoring station configuration, use following request.
124
125 **URL:** ``/restconf/config/odl-bmp-monitor-config:odl-bmp-monitors/bmp-monitor-config/example-bmp-monitor``
126
127 **Method:** ``PUT``
128
129 **Content-Type:** ``application/xml``
130
131 **Request Body:**
132
133 .. code-block:: xml
134    :linenos:
135    :emphasize-lines: 4,5
136
137    <bmp-monitor-config xmlns="urn:opendaylight:params:xml:ns:yang:bmp-monitor-config">
138       <monitor-id>example-bmp-monitor</monitor-id>
139       <server>
140          <binding-port>12345</binding-port>
141          <binding-address>0.0.0.0</binding-address>
142       </server>
143    </bmp-monitor-config>
144
145 @line 4: **binding-port** - The BMP server listening port.
146
147 @line 5: **binding-address** - The BMP server biding address.
148
149 .. note:: User may create multiple BMP monitoring station instances at runtime.
150
151 Active mode configuration
152 '''''''''''''''''''''''''
153 In order to enable active connection, use following request.
154
155 **URL:** ``/restconf/config/odl-bmp-monitor-config:odl-bmp-monitors/bmp-monitor-config/example-bmp-monitor``
156
157 **Method:** ``PUT``
158
159 **Content-Type:** ``application/xml``
160
161 **Request Body:**
162
163 .. code-block:: xml
164    :linenos:
165    :emphasize-lines: 8,9,10
166
167    <bmp-monitor-config xmlns="urn:opendaylight:params:xml:ns:yang:bmp-monitor-config">
168       <monitor-id>example-bmp-monitor</monitor-id>
169       <server>
170          <binding-port>12345</binding-port>
171          <binding-address>0.0.0.0</binding-address>
172       </server>
173       <monitored-router>
174          <address>192.0.2.2</address>
175          <port>1234</port>
176          <active>true</active>
177       </monitored-router>
178    </bmp-monitor-config>
179
180 @line 8: **address** - The monitored router's IP address.
181
182 @line 9: **port** - The monitored router's port.
183
184 @line 10: **active** - Active mode set.
185
186 .. note:: User may configure active session establishment for multiple monitored routers.
187
188 MD5 authentication configuration
189 ''''''''''''''''''''''''''''''''
190 In order to enable active connection, use following request.
191
192 **URL:** ``/restconf/config/odl-bmp-monitor-config:odl-bmp-monitors/bmp-monitor-config/example-bmp-monitor``
193
194 **Method:** ``PUT``
195
196 **Content-Type:** ``application/xml``
197
198 **Request Body:**
199
200 .. code-block:: xml
201    :linenos:
202    :emphasize-lines: 8,9
203
204    <bmp-monitor-config xmlns="urn:opendaylight:params:xml:ns:yang:bmp-monitor-config">
205       <monitor-id>example-bmp-monitor</monitor-id>
206       <server>
207          <binding-port>12345</binding-port>
208          <binding-address>0.0.0.0</binding-address>
209       </server>
210       <monitored-router>
211          <address>192.0.2.2</address>
212          <password>changeme</password>
213       </monitored-router>
214    </bmp-monitor-config>
215
216 @line 8: **address** - The monitored router's IP address.
217
218 @line 9: **password** - The TCP MD5 signature.
219
220 BMP Monitors Configuration Loader
221 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
222
223 BMP Monitors Configuration Loader allows user to define static initial configuration for a BMP protocol instance.
224 This service will detect the creation of new configuration files following the pattern "odl-bmp-monitors-*.xml" under the path "etc/opendaylight/bgpcep".
225 Once the file is processed, the defined configuration will be available from the configuration Data Store.
226
227 .. note:: If the BMP Monitor instance is already present, no update or configuration will be applied.
228
229 **PATH:** ``etc/opendaylight/bgpcep/odl-bmp-monitors-config.xml``
230
231 .. code-block:: xml
232
233     <odl-bmp-monitors xmlns="urn:opendaylight:params:xml:ns:yang:bmp-monitor-config">
234         <bmp-monitor-config>
235             <monitor-id>example-bmp-monitor</monitor-id>
236             <server>
237                 <binding-port>12345</binding-port>
238                 <binding-address>0.0.0.0</binding-address>
239             </server>
240         </bmp-monitor-config>
241     </odl-bmp-monitors>
242
243 BMP Monitor Configuration Example
244 '''''''''''''''''''''''''''''''''
245
246 BGP provides a feature providing a BMP Monitor configuration file example.
247 Once feature is installed defined configuration will be loaded and setup.
248
249 .. code-block:: console
250
251    feature:install odl-bgpcep-bmp-config-example
252
253 Collector DB Tree
254 ^^^^^^^^^^^^^^^^^
255
256 .. code-block:: console
257
258    module: bmp-monitor
259       +--rw bmp-monitor
260          +--ro monitor* [monitor-id]
261             +--ro monitor-id    monitor-id
262             +--ro router* [router-id]
263                +--ro name?          string
264                +--ro description?   string
265                +--ro info?          string
266                +--ro router-id      router-id
267                +--ro status?        status
268                +--ro peer* [peer-id]
269                   +--ro peer-id                 rib:peer-id
270                   +--ro type                    peer-type
271                   x--ro distinguisher
272                   |  +--ro distinguisher-type?   distinguisher-type
273                   |  +--ro distinguisher?        string
274                   +--ro peer-distinguisher?     union
275                   +--ro address                 inet:ip-address
276                   +--ro as                      inet:as-number
277                   +--ro bgp-id                  inet:ipv4-address
278                   +--ro router-distinguisher?   string
279                   +--ro peer-session
280                   |  +--ro local-address      inet:ip-address
281                   |  +--ro local-port         inet:port-number
282                   |  +--ro remote-port        inet:port-number
283                   |  +--ro sent-open
284                   |  |  +--ro version?          protocol-version
285                   |  |  +--ro my-as-number?     uint16
286                   |  |  +--ro hold-timer        uint16
287                   |  |  +--ro bgp-identifier    inet:ipv4-address
288                   |  |  +--ro bgp-parameters*
289                   |  |     +--ro optional-capabilities*
290                   |  |        +--ro c-parameters
291                   |  |           +--ro as4-bytes-capability
292                   |  |           |  +--ro as-number?   inet:as-number
293                   |  |           +--ro bgp-extended-message-capability!
294                   |  |           +--ro multiprotocol-capability
295                   |  |           |  +--ro afi?    identityref
296                   |  |           |  +--ro safi?   identityref
297                   |  |           +--ro graceful-restart-capability
298                   |  |           |  +--ro restart-flags    bits
299                   |  |           |  +--ro restart-time     uint16
300                   |  |           |  +--ro tables* [afi safi]
301                   |  |           |     +--ro afi          identityref
302                   |  |           |     +--ro safi         identityref
303                   |  |           |     +--ro afi-flags    bits
304                   |  |           +--ro add-path-capability
305                   |  |           |  +--ro address-families*
306                   |  |           |     +--ro afi?            identityref
307                   |  |           |     +--ro safi?           identityref
308                   |  |           |     +--ro send-receive?   send-receive
309                   |  |           +--ro route-refresh-capability!
310                   |  +--ro received-open
311                   |  |  +--ro version?          protocol-version
312                   |  |  +--ro my-as-number?     uint16
313                   |  |  +--ro hold-timer        uint16
314                   |  |  +--ro bgp-identifier    inet:ipv4-address
315                   |  |  +--ro bgp-parameters*
316                   |  |     +--ro optional-capabilities*
317                   |  |        +--ro c-parameters
318                   |  |           +--ro as4-bytes-capability
319                   |  |           |  +--ro as-number?   inet:as-number
320                   |  |           +--ro bgp-extended-message-capability!
321                   |  |           +--ro multiprotocol-capability
322                   |  |           |  +--ro afi?    identityref
323                   |  |           |  +--ro safi?   identityref
324                   |  |           +--ro graceful-restart-capability
325                   |  |           |  +--ro restart-flags    bits
326                   |  |           |  +--ro restart-time     uint16
327                   |  |           |  +--ro tables* [afi safi]
328                   |  |           |     +--ro afi          identityref
329                   |  |           |     +--ro safi         identityref
330                   |  |           |     +--ro afi-flags    bits
331                   |  |           +--ro add-path-capability
332                   |  |           |  +--ro address-families*
333                   |  |           |     +--ro afi?            identityref
334                   |  |           |     +--ro safi?           identityref
335                   |  |           |     +--ro send-receive?   send-receive
336                   |  |           +--ro route-refresh-capability!
337                   |  +--ro information
338                   |  |  +--ro string-information*
339                   |  |     +--ro string-tlv
340                   |  |        +--ro string-info?   string
341                   |  +--ro status?            status
342                   |  +--ro timestamp-sec?     yang:timestamp
343                   |  +--ro timestamp-micro?   yang:timestamp
344                   +--ro stats
345                   |  +--ro rejected-prefixes?                 yang:counter32
346                   |  +--ro duplicate-prefix-advertisements?   yang:counter32
347                   |  +--ro duplicate-withdraws?               yang:counter32
348                   |  +--ro invalidated-cluster-list-loop?     yang:counter32
349                   |  +--ro invalidated-as-path-loop?          yang:counter32
350                   |  +--ro invalidated-originator-id?         yang:counter32
351                   |  +--ro invalidated-as-confed-loop?        yang:counter32
352                   |  +--ro adj-ribs-in-routes?                yang:gauge64
353                   |  +--ro loc-rib-routes?                    yang:gauge64
354                   |  +--ro per-afi-safi-adj-rib-in-routes
355                   |  |  +--ro afi-safi* [afi safi]
356                   |  |     +--ro afi      identityref
357                   |  |     +--ro safi     identityref
358                   |  |     +--ro count?   yang:gauge64
359                   |  +--ro per-afi-safi-loc-rib-routes
360                   |  |  +--ro afi-safi* [afi safi]
361                   |  |     +--ro afi      identityref
362                   |  |     +--ro safi     identityref
363                   |  |     +--ro count?   yang:gauge64
364                   |  +--ro updates-treated-as-withdraw?       yang:counter32
365                   |  +--ro prefixes-treated-as-withdraw?      yang:counter32
366                   |  +--ro duplicate-updates?                 yang:counter32
367                   |  +--ro timestamp-sec?                     yang:timestamp
368                   |  +--ro timestamp-micro?                   yang:timestamp
369                   +--ro pre-policy-rib
370                   |  +--ro tables* [afi safi]
371                   |     +--ro afi           identityref
372                   |     +--ro safi          identityref
373                   |     +--ro attributes
374                   |     |  +--ro uptodate?   boolean
375                   |     +--ro (routes)?
376                   +--ro post-policy-rib
377                   |  +--ro tables* [afi safi]
378                   |     +--ro afi           identityref
379                   |     +--ro safi          identityref
380                   |     +--ro attributes
381                   |     |  +--ro uptodate?   boolean
382                   |     +--ro (routes)?
383                   +--ro mirrors
384                      +--ro information?       bmp-msg:mirror-information-code
385                      +--ro timestamp-sec?     yang:timestamp
386                      +--ro timestamp-micro?   yang:timestamp
387
388
389 Operations
390 ^^^^^^^^^^
391 The BMP plugin offers view of collected routes and statistical information from monitored peers.
392 To get top-level view of monitoring station:
393
394 **URL:** ``/restconf/operational/bmp-monitor:bmp-monitor/monitor/example-bmp-monitor``
395
396 **Method:** ``GET``
397
398 **Response Body:**
399
400 .. code-block:: xml
401    :linenos:
402    :emphasize-lines: 3,5,11,12,13,14,15,17,20,21,22,27,33,50,53
403
404    <bmp-monitor xmlns="urn:opendaylight:params:xml:ns:yang:bmp-monitor">
405       <monitor>
406          <monitor-id>example-bmp-monitor</monitor-id>
407             <router>
408                <router-id>10.10.10.10</router-id>
409                <name>name</name>
410                <description>monitored-router</description>
411                <info>monitored router;</info>
412                <status>up</status>
413                <peer>
414                    <peer-id>20.20.20.20</peer-id>
415                    <address>20.20.20.20</address>
416                    <bgp-id>20.20.20.20</bgp-id>
417                    <as>65000</as>
418                    <type>global</type>
419                    <peer-session>
420                      <remote-port>1790</remote-port>
421                      <timestamp-sec>0</timestamp-sec>
422                      <status>up</status>
423                      <local-address>10.10.10.10</local-address>
424                      <local-port>2200</local-port>
425                      <received-open>
426                         <hold-timer>180</hold-timer>
427                         <my-as-number>65000</my-as-number>
428                         <bgp-identifier>20.20.20.20</bgp-identifier>
429                      </received-open>
430                      <sent-open>
431                         <hold-timer>180</hold-timer>
432                         <my-as-number>65000</my-as-number>
433                         <bgp-identifier>65000</bgp-identifier>
434                      </sent-open>
435                    </peer-session>
436                    <pre-policy-rib>
437                      <tables>
438                         <afi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:ipv4-address-family</afi>
439                         <safi xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp-types">x:unicast-subsequent-address-family</safi>
440                         <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
441                            <ipv4-route>
442                               <prefix>10.10.10.0/24</prefix>
443                               <attributes>
444                               ...
445                               </attributes>
446                            </ipv4-route>
447                         </ipv4-routes>
448                         <attributes>
449                            <uptodate>true</uptodate>
450                         </attributes>
451                      </tables>
452                    </pre-policy-rib>
453                    <post-policy-rib>
454                      ...
455                    </post-policy-rib>
456                    <stats>
457                      <timestamp-sec>0</timestamp-sec>
458                      <invalidated-cluster-list-loop>0</invalidated-cluster-list-loop>
459                      <duplicate-prefix-advertisements>0</duplicate-prefix-advertisements>
460                      <loc-rib-routes>100</loc-rib-routes>
461                      <duplicate-withdraws>0</duplicate-withdraws>
462                      <invalidated-as-confed-loop>0</invalidated-as-confed-loop>
463                      <adj-ribs-in-routes>10</adj-ribs-in-routes>
464                      <invalidated-as-path-loop>0</invalidated-as-path-loop>
465                      <invalidated-originator-id>0</invalidated-originator-id>
466                      <rejected-prefixes>8</rejected-prefixes>
467                   </stats>
468                </peer>
469          </router>
470       </monitor>
471    </bmp-monitor>
472
473 @line 3: **monitor-id** - The BMP monitoring station instance identifier.
474
475 @line 5: **router-id** - The monitored router IP address, serves as an identifier.
476
477 @line 11: **peer-id** - The monitored peer's BGP identifier, serves a an identifier.
478
479 @line 12: **address** - The IP address of the peer, associated with the TCP session.
480
481 @line 13: **bgp-id** - The BGP Identifier of the peer.
482
483 @line 14: **as** - The Autonomous System number of the peer.
484
485 @line 15: **type** - Identifies type of the peer - *Global Instance*, *RD Instance* or *Local Instance*
486
487 @line 17: **remote-port** - The peer's port number associated with TCP session.
488
489 @line 20: **local-address** - The IP address of the monitored router associated with the peering TCP session.
490
491 @line 21: **local-port** - The port number of the monitored router associated with the peering TCP session.
492
493 @line 22: **received-open** - The full OPEN message received by monitored router from the peer.
494
495 @line 27: **sent-open** - The full OPEN message send by monitored router to the peer.
496
497 @line 33: **pre-policy-rib** - The Adj-RIB-In that contains unprocessed routing information.
498
499 @line 50: **post-policy-rib** - The Post-Policy Ad-RIB-In that contains routes filtered by inbound policy.
500
501 @line 53: **stats** - Contains various statistics, periodically updated by the router.
502
503 -----
504
505 * To view collected information from particular monitored router:
506       **URL:** ``/restconf/operational/bmp-monitor:bmp-monitor/monitor/example-bmp-monitor/router/10.10.10.10``
507
508 * To view collected information from particular monitored peer:
509       **URL:** ``/restconf/operational/bmp-monitor:bmp-monitor/monitor/example-bmp-monitor/router/10.10.10.10/peer/20.20.20.20``
510
511 Test tools
512 ----------
513 BMP test tool serves to test basic BMP functionality, scalability and performance.
514
515 BMP mock
516 ^^^^^^^^
517 The BMP mock is a stand-alone Java application purposed to simulate a BMP-enabled router(s) and peers.
518 The simulator is capable to report dummy routes and statistics.
519 This application is not part of the OpenDaylight Karaf distribution, however it can be downloaded from OpenDaylight's Nexus (use latest release version):
520
521 ``https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/bgpcep/bgp-bmp-mock``
522
523 Usage
524 '''''
525 The application can be run from command line:
526
527 .. code-block:: console
528
529    java -jar bgp-bmp-mock-*-executable.jar
530
531
532 with optional input parameters:
533
534 .. code-block:: console
535
536    --local_address <address> (optional, default 127.0.0.1)
537       The IPv4 address where BMP mock is bind to.
538
539    -ra <IP_ADDRESS:PORT,...>, --remote_address <IP_ADDRESS:PORT,...>
540       A list of IP addresses of BMP monitoring station, by default 127.0.0.1:12345.
541
542    --passive (optional, not present by default)
543       This flags enables passive mode for simulated routers.
544
545    --routers_count <0..N> (optional, default 1)
546        An amount of BMP routers to be connected to the BMP monitoring station.
547
548    --peers_count <0..N> (optional, default 0)
549       An amount of peers reported by each BMP router.
550
551    --pre_policy_routes <0..N> (optional, default 0)
552       An amount of "pre-policy" simple IPv4 routes reported by each peer.
553
554    --post_policy_routes <0..N> (optional, default 0)
555       An amount of "post-policy" simple IPv4 routes reported by each peer.
556
557    --log_level <FATAL|ERROR|INFO|DEBUG|TRACE> (optional, default INFO)
558       Set logging level for BMP mock.
559
560 Troubleshooting
561 ---------------
562 This section offers advices in a case OpenDaylight BMP plugin is not working as expected.
563
564 .. contents:: Contents
565    :depth: 2
566    :local:
567
568 BMP is not working...
569 ^^^^^^^^^^^^^^^^^^^^^
570 * First of all, ensure that all required features are installed, local monitoring station and monitored router/peers configuration is correct.
571
572   To list all installed features in OpenDaylight use the following command at the Karaf console:
573
574   .. code-block:: console
575
576      feature:list -i
577
578 * Check OpenDaylight Karaf logs:
579
580   From Karaf console:
581
582   .. code-block:: console
583
584      log:tail
585
586   or open log file: ``data/log/karaf.log``
587
588   Possibly, a reason/hint for a cause of the problem can be found there.
589
590 * Try to minimize effect of other OpenDaylight features, when searching for a reason of the problem.
591
592 * Try to set DEBUG severity level for BMP logger via Karaf console commands, in order to collect more information:
593
594   .. code-block:: console
595
596      log:set DEBUG org.opendaylight.protocol.bmp
597
598 Bug reporting
599 ^^^^^^^^^^^^^
600 Before you report a bug, check `BGPCEP Bugzilla <https://bugs.opendaylight.org/buglist.cgi?list_id=65849&product=bgpcep&resolution=--->`_ to ensure same/similar bug is not already filed there.
601
602 Write an e-mail to bgpcep-users@lists.opendaylight.org and provide following information:
603
604 #. State OpenDaylight version
605
606 #. Describe your use-case and provide as much details related to BMP as possible
607
608 #. Steps to reproduce
609
610 #. Attach Karaf log files, optionally packet captures, REST input/output