[Python-modules-commits] [mrtparse] 02/05: New upstream release.

Vincent Bernat bernat at moszumanska.debian.org
Mon Sep 18 17:47:01 UTC 2017


This is an automated email from the git hooks/post-receive script.

bernat pushed a commit to branch debian/master
in repository mrtparse.

commit d845f9ccbca23215970200a3cba8a0cc50ed9a00
Author: Vincent Bernat <bernat at debian.org>
Date:   Mon Sep 18 19:40:57 2017 +0200

    New upstream release.
---
 PKG-INFO                             |  84 +++++-
 README.rst                           |  82 ++++-
 examples/README-ja.rst               | 384 -----------------------
 examples/README.rst                  |   8 +-
 examples/mrt2bgpdump.py              |   2 +-
 examples/mrt2exabgp.py               |  54 +++-
 examples/print_all.py                | 570 ++++++++++++++++++++---------------
 examples/slice.py                    |   2 +-
 examples/summary.py                  |  42 +--
 mrtparse.egg-info/PKG-INFO           |  84 +++++-
 mrtparse.egg-info/SOURCES.txt        |  13 +-
 mrtparse/__init__.py                 | 324 +++++++++-----------
 samples/README-ja.rst                |  57 ----
 samples/README.rst                   | 167 +++++++---
 samples/bird-mrtdump.conf            |  42 +++
 samples/bird-mrtdump_bgp             | Bin 0 -> 1875 bytes
 samples/bird-mrtdump_rib             | Bin 0 -> 1560 bytes
 samples/bird.conf                    |  54 ++++
 samples/bird6-mrtdump.conf           |  42 +++
 samples/bird6-mrtdump_bgp            | Bin 0 -> 2629 bytes
 samples/bird6-mrtdump_rib            | Bin 0 -> 868 bytes
 samples/bird6.conf                   |  54 ++++
 samples/bird6_bgp                    | Bin 3166 -> 3029 bytes
 samples/bird_bgp                     | Bin 4610 -> 2149 bytes
 samples/openbgpd.conf                |  17 ++
 samples/quagga.conf                  |  40 +++
 samples/quagga_bgp                   | Bin 6606 -> 5629 bytes
 samples/quagga_bgp_large_communities | Bin 590 -> 0 bytes
 samples/quagga_rib                   | Bin 1685 -> 1111 bytes
 setup.cfg                            |   1 -
 setup.py                             |   2 +-
 31 files changed, 1145 insertions(+), 980 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 5db9009..804af1b 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: mrtparse
-Version: 1.5
+Version: 1.6
 Summary: MRT format data parser
 Home-page: https://github.com/YoshiyukiYamauchi/mrtparse
 Author: Tetsumune KISO, Yoshiyuki YAMAUCHI, Nobuhiro ITOU
@@ -29,15 +29,82 @@ Description: mrtparse
         +-------------------+---------+
         | Name              | Value   |
         +===================+=========+
-        | Table\_Dump       | 12      |
+        | TABLE\_DUMP       | 12      |
         +-------------------+---------+
-        | Table\_Dump\_V2   | 13      |
+        | TABLE\_DUMP\_V2   | 13      |
         +-------------------+---------+
         | BGP4MP            | 16      |
         +-------------------+---------+
         | BGP4MP\_ET        | 17      |
         +-------------------+---------+
         
+        Supported TABLE_DUMP subtypes
+        ------------------------------
+        
+        +-------------------+---------+
+        | Name              | Value   |
+        +===================+=========+
+        | AFI\_IPv4         | 1       |
+        +-------------------+---------+
+        | AFI\_IPv6         | 2       |
+        +-------------------+---------+
+        
+        Supported TABLE_DUMP_V2 subtypes
+        --------------------------------
+        
+        +-------------------------------+---------+
+        | Name                          | Value   |
+        +===============================+=========+
+        | PEER_INDEX_TABLE              | 1       |
+        +-------------------------------+---------+
+        | RIB\_IPV4\_UNICAST            | 2       |
+        +-------------------------------+---------+
+        | RIB\_IPV4\_MULTICAST          | 3       |
+        +-------------------------------+---------+
+        | RIB\_IPV6\_UNICAST            | 4       |
+        +-------------------------------+---------+
+        | RIB\_IPV6\_MULTICAST          | 5       |
+        +-------------------------------+---------+
+        | RIB\_GENERIC                  | 6       |
+        +-------------------------------+---------+
+        | RIB\_IPV4\_UNICAST\_ADDPATH   | 8       |
+        +-------------------------------+---------+
+        | RIB\_IPV4\_MULTICAST\_ADDPATH | 9       |
+        +-------------------------------+---------+
+        | RIB\_IPV6\_UNICAST\_ADDPATH   | 10      |
+        +-------------------------------+---------+
+        | RIB\_IPV6\_MULTICAST\_ADDPATH | 11      |
+        +-------------------------------+---------+
+        | RIB\_GENERIC\_ADDPATH         | 12      |
+        +-------------------------------+---------+
+        
+        Supported BGP4MP/BGP4MP_ET subtypes
+        -----------------------------------
+        
+        +--------------------------------------+---------+
+        | Name                                 | Value   |
+        +======================================+=========+
+        | BGP4MP\_STATE\_CHANGE                | 0       |
+        +--------------------------------------+---------+
+        | BGP4MP\_MESSAGE                      | 1       |
+        +--------------------------------------+---------+
+        | BGP4MP\_MESSAGE\_AS4                 | 4       |
+        +--------------------------------------+---------+
+        | BGP4MP\_STATE\_CHANGE\_AS4           | 5       |
+        +--------------------------------------+---------+
+        | BGP4MP\_MESSAGE\_LOCAL               | 6       |
+        +--------------------------------------+---------+
+        | BGP4MP\_MESSAGE\_AS4\_LOCAL          | 7       |
+        +--------------------------------------+---------+
+        | BGP4MP\_MESSAGE\_ADDPATH             | 8       |
+        +--------------------------------------+---------+
+        | BGP4MP\_MESSAGE\_AS4\_ADDPATH        | 9       |
+        +--------------------------------------+---------+
+        | BGP4MP\_MESSAGE\_LOCAL\_ADDPATH      | 10      |
+        +--------------------------------------+---------+
+        | BGP4MP\_MESSAGE\_AS4\_LOCAL\_ADDPATH | 11      |
+        +--------------------------------------+---------+
+        
         Supported BGP capabilities
         --------------------------
         
@@ -119,14 +186,6 @@ Description: mrtparse
             $ git clone https://github.com/YoshiyukiYamauchi/mrtparse.git
             $ cd mrtparse
             $ python setup.py install
-            running install
-            running build
-            running build_py
-            running install_lib
-            copying build/lib/mrtparse.py -> /Library/Python/2.7/site-packages
-            byte-compiling /Library/Python/2.7/site-packages/mrtparse.py to mrtparse.pyc
-            running install_egg_info
-            Writing /Library/Python/2.7/site-packages/mrtparse-0.8-py2.7.egg-info
         
         Usage
         -----
@@ -176,10 +235,9 @@ Description: mrtparse
         -------
         
         | Licensed under the `Apache License, Version 2.0`_
-        | Copyright © 2016 `greenHippo, LLC.`_
+        | Copyright © 2017 Tetsumune KISO
         
         .. _`Apache License, Version 2.0`: http://www.apache.org/licenses/LICENSE-2.0
-        .. _`GreenHippo, LLC.`: http://greenhippo.co.jp
         
 Keywords: mrt bgp
 Platform: any
diff --git a/README.rst b/README.rst
index 6156145..48586e3 100644
--- a/README.rst
+++ b/README.rst
@@ -21,15 +21,82 @@ Supported MRT types
 +-------------------+---------+
 | Name              | Value   |
 +===================+=========+
-| Table\_Dump       | 12      |
+| TABLE\_DUMP       | 12      |
 +-------------------+---------+
-| Table\_Dump\_V2   | 13      |
+| TABLE\_DUMP\_V2   | 13      |
 +-------------------+---------+
 | BGP4MP            | 16      |
 +-------------------+---------+
 | BGP4MP\_ET        | 17      |
 +-------------------+---------+
 
+Supported TABLE_DUMP subtypes
+------------------------------
+
++-------------------+---------+
+| Name              | Value   |
++===================+=========+
+| AFI\_IPv4         | 1       |
++-------------------+---------+
+| AFI\_IPv6         | 2       |
++-------------------+---------+
+
+Supported TABLE_DUMP_V2 subtypes
+--------------------------------
+
++-------------------------------+---------+
+| Name                          | Value   |
++===============================+=========+
+| PEER_INDEX_TABLE              | 1       |
++-------------------------------+---------+
+| RIB\_IPV4\_UNICAST            | 2       |
++-------------------------------+---------+
+| RIB\_IPV4\_MULTICAST          | 3       |
++-------------------------------+---------+
+| RIB\_IPV6\_UNICAST            | 4       |
++-------------------------------+---------+
+| RIB\_IPV6\_MULTICAST          | 5       |
++-------------------------------+---------+
+| RIB\_GENERIC                  | 6       |
++-------------------------------+---------+
+| RIB\_IPV4\_UNICAST\_ADDPATH   | 8       |
++-------------------------------+---------+
+| RIB\_IPV4\_MULTICAST\_ADDPATH | 9       |
++-------------------------------+---------+
+| RIB\_IPV6\_UNICAST\_ADDPATH   | 10      |
++-------------------------------+---------+
+| RIB\_IPV6\_MULTICAST\_ADDPATH | 11      |
++-------------------------------+---------+
+| RIB\_GENERIC\_ADDPATH         | 12      |
++-------------------------------+---------+
+
+Supported BGP4MP/BGP4MP_ET subtypes
+-----------------------------------
+
++--------------------------------------+---------+
+| Name                                 | Value   |
++======================================+=========+
+| BGP4MP\_STATE\_CHANGE                | 0       |
++--------------------------------------+---------+
+| BGP4MP\_MESSAGE                      | 1       |
++--------------------------------------+---------+
+| BGP4MP\_MESSAGE\_AS4                 | 4       |
++--------------------------------------+---------+
+| BGP4MP\_STATE\_CHANGE\_AS4           | 5       |
++--------------------------------------+---------+
+| BGP4MP\_MESSAGE\_LOCAL               | 6       |
++--------------------------------------+---------+
+| BGP4MP\_MESSAGE\_AS4\_LOCAL          | 7       |
++--------------------------------------+---------+
+| BGP4MP\_MESSAGE\_ADDPATH             | 8       |
++--------------------------------------+---------+
+| BGP4MP\_MESSAGE\_AS4\_ADDPATH        | 9       |
++--------------------------------------+---------+
+| BGP4MP\_MESSAGE\_LOCAL\_ADDPATH      | 10      |
++--------------------------------------+---------+
+| BGP4MP\_MESSAGE\_AS4\_LOCAL\_ADDPATH | 11      |
++--------------------------------------+---------+
+
 Supported BGP capabilities
 --------------------------
 
@@ -111,14 +178,6 @@ or
     $ git clone https://github.com/YoshiyukiYamauchi/mrtparse.git
     $ cd mrtparse
     $ python setup.py install
-    running install
-    running build
-    running build_py
-    running install_lib
-    copying build/lib/mrtparse.py -> /Library/Python/2.7/site-packages
-    byte-compiling /Library/Python/2.7/site-packages/mrtparse.py to mrtparse.pyc
-    running install_egg_info
-    Writing /Library/Python/2.7/site-packages/mrtparse-0.8-py2.7.egg-info
 
 Usage
 -----
@@ -168,7 +227,6 @@ License
 -------
 
 | Licensed under the `Apache License, Version 2.0`_
-| Copyright © 2016 `greenHippo, LLC.`_
+| Copyright © 2017 Tetsumune KISO
 
 .. _`Apache License, Version 2.0`: http://www.apache.org/licenses/LICENSE-2.0
-.. _`GreenHippo, LLC.`: http://greenhippo.co.jp
diff --git a/examples/README-ja.rst b/examples/README-ja.rst
deleted file mode 100644
index 517cd07..0000000
--- a/examples/README-ja.rst
+++ /dev/null
@@ -1,384 +0,0 @@
-スクリプトの作成例
-==================
-
-print\_all.py
--------------
-
-内容
-~~~~~~~~~~~
-
-MRT形式のファイルの内容を出力する
-
-使用方法
-~~~~~~~~~
-
-::
-
-    print_all.py ファイルへのパス
-
-出力例
-~~~~~~
-
-::
-
-    ---------------------------------------------------------------
-    MRT Header
-        Timestamp: 1392828028(2014-02-20 01:40:28)
-        Type: 16(BGP4MP)
-        Subtype: 5(BGP4MP_STATE_CHANGE_AS4)
-        Length: 24
-    BGP4MP_STATE_CHANGE_AS4
-        Peer AS Number: 100
-        Local AS Number: 64512
-        Interface Index: 0
-        Address Family: 1(AFI_IPv4)
-        Peer IP Address: 192.168.1.21
-        Local IP Address: 192.168.1.100
-        Old State: 5(OpenConfirm)
-        New State: 6(Established)
-    ---------------------------------------------------------------
-    MRT Header
-        Timestamp: 1392828028(2014-02-20 01:40:28)
-        Type: 16(BGP4MP)
-        Subtype: 4(BGP4MP_MESSAGE_AS4)
-    ...
-
-エラーが発生した場合は、以下のようにデータをバイトで表示する。
-
-::
-
-    ---------------------------------------------------------------
-    MRT Header
-        Timestamp: 1442843462(2015-09-21 22:51:02)
-        Type: 16(BGP4MP)
-        Subtype: 5(BGP4MP_STATE_CHANGE_AS4)
-        Length: 12
-    MRT Data Error: Unsupported AFI 8(Unknown)
-        00 00 00 00 00 00 00 00  00 01 00 08
-    ...
-    ---------------------------------------------------------------
-    MRT Header
-        Timestamp: 1443251615(2015-09-26 16:13:35)
-        Type: 16(BGP4MP)
-        Subtype: 2(BGP4MP_ENTRY)
-        Length: 80
-    MRT Data Error: Unsupported BGP4MP subtype 2(BGP4MP_ENTRY)
-        fd e8 fd e8 00 00 00 01  c0 a8 01 66 c0 a8 01 0a 
-        00 00 00 01 56 06 43 5f  00 01 01 04 c0 a8 00 0b 
-        10 c0 a8 00 2b 40 01 01  00 40 02 04 02 01 fd f3 
-        40 05 04 00 00 00 64 c0  07 08 00 00 fd e8 c0 a8 
-        00 0b 80 09 04 c0 a8 00  0b 80 0a 04 c0 a8 00 0a
-
-mrt2exabgp.py (旧exabgp_conf.py)
-----------------------------------------
-
-内容
-~~~~~~~~~~~
-
-| MRT形式のファイルを ExaBGP_ 用のコンフィグ形式に変換して出力する。
-| Exa-BGPのAPIに関して詳しく知りたい場合は、 `the wiki`_ を読んで下さい。
-
-.. _ExaBGP: https://github.com/Exa-Networks/exabgp
-.. _`the wiki`: https://github.com/YoshiyukiYamauchi/mrtparse/wiki
-
-使用方法
-~~~~~~~~~
-
-::
-
-    使用方法: mrt2exabgp.py [-h] [-r ルータID] [-l ローカルAS] [-p ピアAS]
-                         [-L ローカルアドレス] [-n ネイバーのアドレス] [-4 [ネクストホップ]]
-                         [-6 [ネクストホップ]] [-a] [-A] [-G [数値]] [-g [数値]] [-P]
-                         ファイルのパス
-
-    このスクリプトはExaBGPのフォーマットに変換する
-    
-    オプションなし引数:
-      ファイルのパス        MRT形式のファイルのパスを指定する
-    
-    オプションあり引数:
-      -h, --help               ヘルプメッセージを表示して終了する
-      -r ルータID              ルータIDを指定する (デフォルト: 192.168.0.1)
-      -l ローカルAS            ローカルASを指定する (デフォルト: 64512)
-      -p ピアAS                ピアASを指定する (デフォルト: 65000)
-      -L ローカルアドレス      ローカルアドレスを指定する (デフォルト: 192.168.1.1)
-      -n ネイバーのアドレス    ネイバーのアドレスを指定する (デフォルト: 192.168.1.100)
-      -4 [ネクストホップ]      IPv4のエントリーを変換して、指定されていればネクストホップを変更する
-      -6 [ネクストホップ]      IPv6のエントリーを変換して、指定されていればネクストホップを変更する
-      -a                       全エントリを変換する (デフォルト: プレフィックスごとに最初のエントリーのみ)
-      -A                       ExaBGPのAPIのフォーマットに変換する
-      -G [数値]                ExaBGPのAPIのフォーマットに変換して、指定されたプレフィックス数ごとに同じアトリビュートでグルーピングして、"announce attributes ..."の形式で出力する。
-                               (デフォルト: 1000000)
-      -g [数値]                ExaBGPのAPIのフォーマットに変換して、指定されたプレフィックス数ごとに>同じアトリビュートでグルーピングして、"announce attribute ..."の形式で出力する。
-                               (デフォルト: 1000000)
-      -P                       ExaBGPのAPIのプログラムに変換する。
-
-出力例 (コンフィグフォーマット)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-"-A"/"-G"/"-g"/"-P"オプションを使用しない場合は、コンフィグ形式で出力する。
-
-::
-
-    neighbor 192.168.1.1 {
-        router-id 192.168.0.2;
-        local-address 192.168.1.2;
-        local-as 64512;
-        peer-as 65000;
-        graceful-restart;
-        aigp enable;
-
-        static {
-            route 1.0.0.0/24 origin IGP as-path [57821 12586 13101 15169 ] community [12586:147 12586:13000 64587:13101] next-hop 192.168.1.254;
-            route 1.0.4.0/24 origin IGP as-path [57821 6939 4826 56203 ] next-hop 192.168.1.254;
-            route 1.0.5.0/24 origin IGP as-path [57821 6939 4826 56203 ] next-hop 192.168.1.254;
-            route 1.0.6.0/24 origin IGP as-path [57821 6939 4826 56203 ] next-hop 192.168.1.254;
-            route 1.0.7.0/24 origin IGP as-path [57821 6939 4826 56203 56203 56203 ] next-hop 192.168.1.254;
-            route 1.0.64.0/18 origin IGP as-path [57821 6939 4725 4725 7670 7670 7670 18144 ] atomic-aggregate aggregator (18144:219.118.225.189) next-hop 192.168.1.254;
-            route 1.0.128.0/17 origin IGP as-path [57821 12586 3257 38040 9737 ] atomic-aggregate aggregator (9737:203.113.12.254) community [12586:145 12586:12000 64587:3257] next-hop 192.168.1.254;
-            route 1.0.128.0/18 origin IGP as-path [57821 12586 3257 38040 9737 ] atomic-aggregate aggregator (9737:203.113.12.254) community [12586:145 12586:12000 64587:3257] next-hop 192.168.1.254;
-            ...
-        }
-    }
-
-"-A"オプションでの出力例 (APIフォーマット)
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-| このオプションは、ほとんどの場合でパフォーマンスを改善することができる。
-| 特にインターネット全経路などを広告する場合など、
-
-::
-
-    announce route 1.0.0.0/24 origin IGP as-path [57821 12586 13101 15169 ] community [12586:147 12586:13000 64587:13101] next-hop 192.168.1.254
-    announce route 1.0.4.0/24 origin IGP as-path [57821 6939 4826 56203 ] next-hop 192.168.1.254
-    announce route 1.0.5.0/24 origin IGP as-path [57821 6939 4826 56203 ] next-hop 192.168.1.254
-    announce route 1.0.6.0/24 origin IGP as-path [57821 6939 4826 56203 ] next-hop 192.168.1.254
-    announce route 1.0.7.0/24 origin IGP as-path [57821 6939 4826 56203 56203 56203 ] next-hop 192.168.1.254
-    announce route 1.0.64.0/18 origin IGP as-path [57821 6939 4725 4725 7670 7670 7670 18144 ] atomic-aggregate aggregator (18144:219.118.225.189) next-hop 192.168.1.254
-    announce route 1.0.128.0/17 origin IGP as-path [57821 12586 3257 38040 9737 ] atomic-aggregate aggregator (9737:203.113.12.254) community [12586:145 12586:12000 64587:3257] next-hop 192.168.1.254
-    announce route 1.0.128.0/18 origin IGP as-path [57821 12586 3257 38040 9737 ] atomic-aggregate aggregator (9737:203.113.12.254) community [12586:145 12586:12000 64587:3257] next-hop 192.168.1.254
-    ...
-
-"-G"オプションでの出力例 (APIグルーピングフォーマット)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-このオプションは、特にインターネットの全経路を広告する場合にパフォーマンスを改善することができる。
-出力は、"announce attributes ..."形式を使用する。
-"BGP4MP"または"BGP4MP_ET"を含むMRTデータを使用する場合は、このオプションか"-g"オプションを使用しなければならない。
-また、その場合には、このオプションの引数は指定されていても無視される。
-
-::
-
-    announce attributes origin IGP as-path [57821 6939 4826 56203 ] next-hop 192.168.1.254 nlri 1.0.4.0/24 1.0.5.0/24 1.0.6.0/24 103.2.176.0/24 103.2.177.0/24 103.2.178.0/24 103.2.179.0/24
-    announce attributes origin IGP as-path [57821 6939 4826 56203 56203 56203 ] next-hop 192.168.1.254 nlri 1.0.7.0/24
-    announce attributes origin IGP as-path [57821 6939 4725 4725 7670 7670 7670 18144 ] atomic-aggregate aggregator (18144:219.118.225.189) next-hop 192.168.1.254 nlri 1.0.64.0/18 58.183.0.0/16 222.231.64.0/18
-    announce attributes origin IGP as-path [57821 12586 3257 38040 9737 ] atomic-aggregate aggregator (9737:203.113.12.254) community [12586:145 12586:12000 64587:3257] next-hop 192.168.1.254 nlri 1.0.128.0/17 1.0.128.0/18 1.0.192.0/18 1.2.128.0/17 1.4.128.0/17 1.4.128.0/18 1.179.128.0/17 101.51.0.0/16 101.51.64.0/18 113.53.0.0/16 113.53.0.0/18 118.172.0.0/16 118.173.0.0/16 118.173.192.0/18 118.174.0.0/16 118.175.0.0/16 118.175.0.0/18 125.25.0.0/16 125.25.128.0/18 180.180.0.0/16 182.52.0 [...]
-    announce attributes origin IGP as-path [4608 1221 4637 4651 9737 23969 ] next-hop 192.168.1.254 nlri 1.0.128.0/24
-    announce attributes origin IGP as-path [57821 12586 3257 1299 38040 9737 ] atomic-aggregate aggregator (9737:203.113.12.254) community [12586:145 12586:12000 64587:3257] next-hop 192.168.1.254 nlri 1.0.160.0/19 1.0.224.0/19 118.173.64.0/19 118.173.192.0/19 118.174.128.0/19 118.174.192.0/19 118.175.160.0/19 125.25.0.0/19 125.25.128.0/19 182.53.0.0/19 203.113.0.0/19 203.113.96.0/19
-    announce attributes origin IGP as-path [57821 12586 3257 4134 ] community [12586:145 12586:12000 64587:3257] next-hop 192.168.1.254 nlri 1.1.8.0/24 36.106.0.0/16 36.108.0.0/16 36.109.0.0/16 101.248.0.0/16 106.0.4.0/22 106.7.0.0/16 118.85.204.0/24 118.85.215.0/24 120.88.8.0/21 122.198.64.0/18 171.44.0.0/16 183.91.56.0/24 183.91.57.0/24 202.80.192.0/22 221.231.151.0/24
-    announce attributes origin IGP as-path [57821 12586 13101 15412 17408 58730 ] community [12586:147 12586:13000 64587:13101] next-hop 192.168.1.254 nlri 1.1.32.0/24 1.2.1.0/24 1.10.8.0/24 14.0.7.0/24 27.34.239.0/24 27.109.63.0/24 36.37.0.0/24 42.0.8.0/24 49.128.2.0/24 49.246.249.0/24 101.102.104.0/24 106.3.174.0/24 118.91.255.0/24 123.108.143.0/24 180.200.252.0/24 183.182.9.0/24 202.6.6.0/24 202.12.98.0/24 202.85.202.0/24 202.131.63.0/24 211.155.79.0/24 211.156.109.0/24 218.98.224.0/2 [...]
-    ...
-
-"-g"オプションでの出力例 (APIグルーピングフォーマット)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-このオプションは、特にインターネットの全経路を広告する場合にパフォーマンスを改善することができる。
-出力は、"announce attribute ..."の古い形式を使用する。
-"BGP4MP"または"BGP4MP_ET"を含むMRTデータを使用する場合は、このオプションか"-G"オプションを使用しなければならない。
-また、その場合には、このオプションの引数は指定されていても無視される。
-
-::
-
-    announce attribute origin IGP as-path [57821 6939 4826 56203 ] next-hop 192.168.1.254 nlri 1.0.4.0/24 1.0.5.0/24 1.0.6.0/24 103.2.176.0/24 103.2.177.0/24 103.2.178.0/24 103.2.179.0/24
-    announce attribute origin IGP as-path [57821 6939 4826 56203 56203 56203 ] next-hop 192.168.1.254 nlri 1.0.7.0/24
-    announce attribute origin IGP as-path [57821 6939 4725 4725 7670 7670 7670 18144 ] atomic-aggregate aggregator (18144:219.118.225.189) next-hop 192.168.1.254 nlri 1.0.64.0/18 58.183.0.0/16 222.231.64.0/18
-    announce attribute origin IGP as-path [57821 12586 3257 38040 9737 ] atomic-aggregate aggregator (9737:203.113.12.254) community [12586:145 12586:12000 64587:3257] next-hop 192.168.1.254 nlri 1.0.128.0/17 1.0.128.0/18 1.0.192.0/18 1.2.128.0/17 1.4.128.0/17 1.4.128.0/18 1.179.128.0/17 101.51.0.0/16 101.51.64.0/18 113.53.0.0/16 113.53.0.0/18 118.172.0.0/16 118.173.0.0/16 118.173.192.0/18 118.174.0.0/16 118.175.0.0/16 118.175.0.0/18 125.25.0.0/16 125.25.128.0/18 180.180.0.0/16 182.52.0. [...]
-    announce attribute origin IGP as-path [4608 1221 4637 4651 9737 23969 ] next-hop 192.168.1.254 nlri 1.0.128.0/24
-    announce attribute origin IGP as-path [57821 12586 3257 1299 38040 9737 ] atomic-aggregate aggregator (9737:203.113.12.254) community [12586:145 12586:12000 64587:3257] next-hop 192.168.1.254 nlri 1.0.160.0/19 1.0.224.0/19 118.173.64.0/19 118.173.192.0/19 118.174.128.0/19 118.174.192.0/19 118.175.160.0/19 125.25.0.0/19 125.25.128.0/19 182.53.0.0/19 203.113.0.0/19 203.113.96.0/19
-    announce attribute origin IGP as-path [57821 12586 3257 4134 ] community [12586:145 12586:12000 64587:3257] next-hop 192.168.1.254 nlri 1.1.8.0/24 36.106.0.0/16 36.108.0.0/16 36.109.0.0/16 101.248.0.0/16 106.0.4.0/22 106.7.0.0/16 118.85.204.0/24 118.85.215.0/24 120.88.8.0/21 122.198.64.0/18 171.44.0.0/16 183.91.56.0/24 183.91.57.0/24 202.80.192.0/22 221.231.151.0/24
-    announce attribute origin IGP as-path [57821 12586 13101 15412 17408 58730 ] community [12586:147 12586:13000 64587:13101] next-hop 192.168.1.254 nlri 1.1.32.0/24 1.2.1.0/24 1.10.8.0/24 14.0.7.0/24 27.34.239.0/24 27.109.63.0/24 36.37.0.0/24 42.0.8.0/24 49.128.2.0/24 49.246.249.0/24 101.102.104.0/24 106.3.174.0/24 118.91.255.0/24 123.108.143.0/24 180.200.252.0/24 183.182.9.0/24 202.6.6.0/24 202.12.98.0/24 202.85.202.0/24 202.131.63.0/24 211.155.79.0/24 211.156.109.0/24 218.98.224.0/24 [...]
-    ...
-
-"-P"オプションでの出力例 (APIプログラムフォーマット)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-| このオプションは、同じMRTデータを繰り返し使用する場合に便利である。
-| "-G"または"-g"オプションと一緒に使用することができる。
-
-::
-
-    #!/usr/bin/env python
-    
-    import sys
-    import time
-    
-    msgs = [
-    'announce route 0.0.0.0/0 origin IGP as-path [8758 6830 ] community [8758:110 8758:300] next-hop 192.168.1.254',
-    'announce route 1.0.4.0/24 origin IGP as-path [50304 174 4637 1221 38803 56203 ] next-hop 192.168.1.254',
-    'announce route 1.0.5.0/24 origin IGP as-path [50304 174 4637 1221 38803 56203 ] next-hop 192.168.1.254',
-    'announce route 1.0.6.0/24 origin IGP as-path [50304 174 4637 1221 38803 56203 56203 56203 ] next-hop 192.168.1.254',
-    'announce route 1.0.38.0/24 origin IGP as-path [50304 10026 24155 ] next-hop 192.168.1.254',
-    'announce route 1.0.64.0/18 origin IGP as-path [50304 174 209 2516 7670 18144 ] atomic-aggregate aggregator (18144:219.118.225.188) next-hop 192.168.1.254',
-    'announce route 1.0.128.0/17 origin IGP as-path [50304 24482 38040 9737 ] atomic-aggregate aggregator (9737:203.113.12.254) next-hop 192.168.1.254',
-    'announce route 1.0.128.0/18 origin IGP as-path [50304 24482 38040 9737 ] atomic-aggregate aggregator (9737:203.113.12.254) next-hop 192.168.1.254',
-    ...
-    ]
-    
-    while msgs:
-        msg = msgs.pop(0)
-        if isinstance(msg, str):
-            sys.stdout.write(msg + '\n')
-            sys.stdout.flush()
-        else:
-            time.sleep(msg)
-
-    while True:
-        time.sleep(1)
-
-slice.py
---------
-
-内容
-~~~~~~~~~~~
-
-| MRT形式のファイルについて、下記データをファイル出力する  
-|
-| 1. 指定された開始時間から終了時間までの指定された秒単位の間隔についてのデータ  
-| 2. 指定された開始時間から終了時間までのデータ  
-| 3. 指定された秒単位の間隔についてのデータ  
-
-使用方法
-~~~~~~~~~
-
-::
-
-    使用方法: slice.py [-h] [-s 開始時間] [-e 終了時間] [-i 間隔] [-c {gz,bz2}]
-                    ファイルのパス
-    
-    このスクリプトはMRT形式のファイルを分割する
-    
-    オプションなし引数:
-      ファイルのパス  MRT形式のファイルのパスを指定する
-    
-    オプションあり引数:
-      -h, --help      ヘルプメッセージを表示して終了する
-      -s 開始時間     開始時間を YYYY-MM-DD HH:MM:SS の形式で指定する
-      -e 終了時間     終了時間を YYYY-MM-DD HH:MM:SS の形式で指定する
-      -i 間隔         ファイルを分割する間隔(秒)を指定する
-      -c {gz,bz2}     分割ファイルの圧縮形式(gz, bz2)を指定する
-
-出力例
-~~~~~~
-
-::
-
-    # slice.py -s '2015-04-26 03:26:00' -e '2014-04-26 03:27:00' -i 10 -c bz2 -f latest-update.gz
-    # ls
-    latest-update-20150426-032600.bz2
-    latest-update-20150426-032610.bz2
-    latest-update-20150426-032620.bz2
-    latest-update-20150426-032630.bz2
-    latest-update-20150426-032640.bz2
-    latest-update-20150426-032650.bz2
-
-summary.py
-----------
-
-内容
-~~~~~~~~~~~
-
-MRT形式のファイルのサマリーを出力する
-
-使用方法
-~~~~~~~~~
-
-::
-
-    summary.py ファイルへのパス
-
-出力例
-~~~~~~
-
-::
-
-    [2014-08-11 03:45:00 - 2014-08-11 03:49:59]
-    BGP4MP: 5973
-        BGP4MP_MESSAGE: 34
-            UPDATE: 24
-            KEEPALIVE: 10
-        BGP4MP_MESSAGE_AS4: 5896
-            UPDATE: 5825
-            KEEPALIVE: 71
-        BGP4MP_STATE_CHANGE_AS4: 43
-            Idle: 1
-            Connect: 20
-            Active: 18
-            OpenSent: 4
-
-mrt2bgpdump.py
---------------
-
-内容
-~~~~~~~~~~~
-
-このスクリプトは bgpdump_ のフォーマットに変換する
-
-.. _bgpdump: https://bitbucket.org/ripencc/bgpdump/wiki/Home
-
-使用方法
-~~~~~~~~
-
-::
-
-    使用方法: mrt2bgpdump.py [-h] [-m] [-M] [-O [file]] [-s] [-v] [-t {dump,change}]
-                          [-p] ファイルのパス
-    
-    このスクリプトはbgpdumpのフォーマットに変換する
-    
-    オプションなし引数:
-      ファイルのパス    MRT形式のファイルのパスを指定する
-    
-    オプションあり引数:
-      -h, --help        ヘルプメッセージを表示して終了する
-      -m                1エントリに対して1行ずつUNIX時間で出力する
-      -M                1エントリに対して1行ずつわかりやすい時間形式で出力する(デフォルト動作)
-      -O [ファイル]     出力ファイルを指定する
-      -s                標準出力に出力する(デフォルト動作)
-      -v                標準エラー出力に出力する
-      -t {dump,change}  MRTデータが出力された時間(dump)、または経路が追加された時間(change)で出力するかをを選択する
-                        (デフォルト: dump)
-      -p                2番目のカラムにパケットのインデックスを追加する
-
-出力例
-~~~~~~
-
-::
-
-    BGP4MP|0|1438386900|A|193.0.0.56|3333|204.80.242.0/24|3333 1273 7922 33667 54169 54169 54169 54169 54169 54169 54169 54169|IGP|193.0.0.56|0|0|1273:21000|NAG||
-    BGP4MP|1|1438386900|A|2405:fc00::6|37989|2001:4c0:2001::/48|37989 4844 2914 174 855|IGP|2405:fc00::6|0|0||NAG||
-    BGP4MP|1|1438386900|A|2405:fc00::6|37989|2001:4c0:6002::/48|37989 4844 2914 174 855|IGP|2405:fc00::6|0|0||NAG||
-    BGP4MP|2|1438386900|A|146.228.1.3|1836|189.127.0.0/21|1836 174 12956 262589 27693|IGP|146.228.1.3|0|0|1836:110 1836:6000 1836:6031|NAG|27693 189.127.15.253|
-    BGP4MP|4|1438386900|A|2405:fc00::6|37989|2406:e400:1a::/48|37989 4844 7642|INCOMPLETE|2405:fc00::6|0|0||NAG||
-    BGP4MP|5|1438386900|A|2001:8e0:0:ffff::9|8758|2c0f:fe90::/32|8758 174 2914 30844 37105 37105 37105 36943|IGP|2001:8e0:0:ffff::9|0|0|174:21100 174:22005 8758:110 8758:301|NAG||
-    BGP4MP|6|1438386900|A|213.200.87.254|3257|187.110.144.0/20|3257 174 16735 27693 53117|IGP|213.200.87.254|0|10|3257:8093 3257:30235 3257:50002 3257:51100 3257:51102|NAG||
-    BGP4MP|7|1438386900|A|213.200.87.254|3257|187.95.16.0/20|3257 174 16735 27693 53081|IGP|213.200.87.254|0|10|3257:8063 3257:30252 3257:50002 3257:51300 3257:51302|NAG||
-    BGP4MP|8|1438386900|A|213.200.87.254|3257|189.127.208.0/21|3257 174 16735 27693 28235|IGP|213.200.87.254|0|10|3257:8093 3257:30235 3257:50002 3257:51100 3257:51102|NAG||
-    BGP4MP|8|1438386900|A|213.200.87.254|3257|189.127.216.0/21|3257 174 16735 27693 28235|IGP|213.200.87.254|0|10|3257:8093 3257:30235 3257:50002 3257:51100 3257:51102|NAG||
-    ...
-
-作者
--------
-
-| Tetsumune KISO t2mune at gmail.com
-| Yoshiyuki YAMAUCHI info at greenhippo.co.jp
-| Nobuhiro ITOU js333123 at gmail.com
-
-ライセンス
-----------
-
-| Licensed under the `Apache License, Version 2.0`_
-| Copyright © 2016 `greenHippo, LLC.`_
-
-.. _`Apache License, Version 2.0`: http://www.apache.org/licenses/LICENSE-2.0
-.. _`GreenHippo, LLC.`: http://greenhippo.co.jp
-
diff --git a/examples/README.rst b/examples/README.rst
index 25e1b61..116962a 100644
--- a/examples/README.rst
+++ b/examples/README.rst
@@ -88,7 +88,7 @@ Usage
 
     usage: mrt2exabgp.py [-h] [-r ROUTER_ID] [-l LOCAL_AS] [-p PEER_AS]
                          [-L LOCAL_ADDR] [-n NEIGHBOR] [-4 [NEXT_HOP]]
-                         [-6 [NEXT_HOP]] [-a] [-A] [-G [NUM]] [-g [NUM]] [-P]
+                         [-6 [NEXT_HOP]] [-a] [-s] [-A] [-G [NUM]] [-g [NUM]] [-P]
                          path_to_file
 
     This script converts to ExaBGP format.
@@ -107,6 +107,8 @@ Usage
       -6 [NEXT_HOP]  convert IPv6 entries and change IPv6 next-hop if specified
       -a             convert all entries (default: convert only first entry per
                      one prefix)
+      -s             convert only entries from a single asn (the peer asn, specify
+                     as -p PEER_ASN)
       -A             convert to ExaBGP API format
       -G [NUM]       convert to ExaBGP API format and group updates with the same
                      attributes for each spceified the number of prefixes using
@@ -379,8 +381,6 @@ License
 -------
 
 | Licensed under the `Apache License, Version 2.0`_
-| Copyright © 2016 `greenHippo, LLC.`_
+| Copyright © 2017 Tetsumune KISO
 
 .. _`Apache License, Version 2.0`: http://www.apache.org/licenses/LICENSE-2.0
-.. _`GreenHippo, LLC.`: http://greenhippo.co.jp
-
diff --git a/examples/mrt2bgpdump.py b/examples/mrt2bgpdump.py
index 8d2e496..cab8be3 100755
--- a/examples/mrt2bgpdump.py
+++ b/examples/mrt2bgpdump.py
@@ -2,7 +2,7 @@
 '''
 mrt2bgpdump.py - a script to convert MRT format to bgpdump format.
 
-Copyright (C) 2016 greenHippo, LLC.
+Copyright (C) 2017 Tetsumune KISO
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
diff --git a/examples/mrt2exabgp.py b/examples/mrt2exabgp.py
index e2d4adc..770c301 100755
--- a/examples/mrt2exabgp.py
+++ b/examples/mrt2exabgp.py
@@ -2,7 +2,7 @@
 '''
 mrt2exabgp.py - a script to convert MRT format to ExaBGP format.
 
-Copyright (C) 2016 greenHippo, LLC.
+Copyright (C) 2017 Tetsumune KISO
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
@@ -29,12 +29,16 @@ FLAG_T = {
     'IPv4': 0x01,
     'IPv6': 0x02,
     'ALL' : 0x04,
-    'API' : 0x08,
-    'API_GROUP_OLD' : 0x10,
-    'API_GROUP' : 0x20,
-    'API_PROG' : 0x40,
+    'SINGLE' : 0x08,
+    'API' : 0x10,
+    'API_GROUP_OLD' : 0x20,
+    'API_GROUP' : 0x40,
+    'API_PROG' : 0x80,
 }
 
+class NotDisplay(Exception):
+    pass
+
 def print_conf_header(args):
     print('''\
 neighbor %s {
@@ -111,6 +115,10 @@ def parse_args():
         help='convert all entries \
             (default: convert only first entry per one prefix)')
     p.add_argument(
+        '-s', default=False, action='store_true',
+        help='convert only entries from a single asn \
+            (the peer asn, specify as -p PEER_ASN)')
+    p.add_argument(
         '-A', action='store_false',
         help='convert to ExaBGP API format')
     p.add_argument(
@@ -144,6 +152,8 @@ def parse_args():
         flags = FLAG_T['IPv4'] | FLAG_T['IPv6']
     if '-a' in sys.argv:
         flags |= FLAG_T['ALL']
+    if '-s' in sys.argv:
+        flags |= FLAG_T['SINGLE']
     if '-A' in sys.argv:
         flags |= FLAG_T['API']
     if '-G' in sys.argv:
@@ -152,7 +162,6 @@ def parse_args():
         flags |= FLAG_T['API'] | FLAG_T['API_GROUP_OLD'] | FLAG_T['API_GROUP']
     if '-P' in sys.argv:
         flags |= FLAG_T['API'] | FLAG_T['API_PROG']
-
     return (r, flags)
 
 def conv_format(args, flags, d):
@@ -246,11 +255,16 @@ def print_route_td(args, params, m):
         else:
             entry.append(m.td)
 
-    line = ''
     for e in entry:
+        line = ''
         params['next_hop'] = ''
-        for attr in e.attr:
-            line += get_bgp_attr(args, params, m, attr)
+
+        try:
+            for attr in e.attr:
+                line += get_bgp_attr(args, params, m, attr)
+
+        except NotDisplay:
+            continue
 
         if params['flags'] & FLAG_T['API_GROUP']:
             params['api_grp'].setdefault('%s next-hop %s' \
@@ -300,8 +314,13 @@ def print_route_bgp4mp(args, params, m):
     msg = m.bgp.msg
 
     attr_line = ''
-    for attr in msg.attr:
-        attr_line += get_bgp_attr(args, params, m, attr)
+
+    try:
+        for attr in msg.attr:
+            attr_line += get_bgp_attr(args, params, m, attr)
+
+    except NotDisplay:
+        return
 
     wd_line = ''
     for wd in params['mp_withdrawn']:
@@ -354,13 +373,20 @@ def get_bgp_attr(args, params, m, attr):
     if attr.type == BGP_ATTR_T['ATOMIC_AGGREGATE']:
         line += ' atomic-aggregate'
 
-    if attr.len == 0:
-        return line
-
     if attr.type == BGP_ATTR_T['ORIGIN']:
         line += ' origin %s' % ORIGIN_T[attr.origin]
 
     elif attr.type == BGP_ATTR_T['AS_PATH']: 
+        if flags & FLAG_T['SINGLE']:
+            if len(attr.as_path) == 0:
+                raise NotDisplay()
+
+            path_seg = attr.as_path[0]
+            if path_seg['type'] != AS_PATH_SEG_T['AS_SEQUENCE'] \
+                or len(path_seg['val']) == 0 \
+                or path_seg['val'][0] != str(args.peer_as):
+                raise NotDisplay()
+
         as_path = ''
         for path_seg in attr.as_path:
             if path_seg['type'] == AS_PATH_SEG_T['AS_SET']:
diff --git a/examples/print_all.py b/examples/print_all.py
index bd7ca15..871be0b 100755
--- a/examples/print_all.py
+++ b/examples/print_all.py
@@ -2,7 +2,7 @@
 '''
 print_all.py - a script to print a MRT format data using mrtparse.
 
-Copyright (C) 2016 greenHippo, LLC.
+Copyright (C) 2017 Tetsumune KISO
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
@@ -27,7 +27,9 @@ from optparse import OptionParser
 from datetime import *
 from mrtparse import *
 
-indt = 0
+indt = ' ' * 4
+indt_num = 0
+contents = ''
 
 def prerror(m):
     print('%s: %s' % (MRT_ERR_C[m.err], m.err_msg))
@@ -50,355 +52,439 @@ def prerror(m):
     if len(s):
         print('    %s' % s)
 
-def prline(line):
-    global indt
-    print('    ' * indt + line)
+def put_lines(*lines):
+    global contents
+    for line in lines:
+        contents += indt * indt_num + line + '\n'
 
 def print_mrt(m):
-    global indt
-    indt = 0
-    prline('MRT Header')
-
-    indt += 1
-    prline('Timestamp: %d(%s)' %
-        (m.ts, datetime.fromtimestamp(m.ts)))
-    prline('Type: %d(%s)' % (m.type, MRT_T[m.type]))
-    prline('Subtype: %d(%s)' %
-        (m.subtype, MRT_ST[m.type][m.subtype]))
-    prline('Length: %d' % m.len)
-
-    if (   m.type == MRT_T['BGP4MP_ET']
-        or m.type == MRT_T['ISIS_ET']
-        or m.type == MRT_T['OSPFv3_ET']):
-        prline('Microsecond Timestamp: %d' % m.micro_ts)
+    global indt_num
+    indt_num = 0
+    put_lines('MRT Header')
+
+    indt_num += 1
+
+    try:
+        subtype = MRT_ST[m.type][m.subtype]
+    except KeyError:
+        subtype = 'Unknown'
+
+    put_lines(
+        'Timestamp: %d(%s)' % (m.ts, datetime.fromtimestamp(m.ts)),
+        'Type: %d(%s)' % (m.type, MRT_T[m.type]),
+        'Subtype: %d(%s)' % (m.subtype, subtype),
+        'Length: %d' % m.len
+    )
+
+    if m.type == MRT_T['BGP4MP_ET'] \
+        or m.type == MRT_T['ISIS_ET'] \
+        or m.type == MRT_T['OSPFv3_ET']:
+        put_lines('Microsecond Timestamp: %d' % m.micro_ts)
 
 def print_td(m):
-    global indt
-    indt = 0
-    prline('%s' % MRT_T[m.type])
-
-    indt += 1
-    prline('View Number: %d' % m.td.view)
-    prline('Sequence Number: %d' % m.td.seq)
-    prline('Prefix: %s' % m.td.prefix)
-    prline('Prefix length: %d' % m.td.plen)
-    prline('Status: %d' % m.td.status)
-    prline('Originated Time: %d(%s)' %
-        (m.td.org_time,
-         datetime.fromtimestamp(m.td.org_time)))
-    prline('Peer IP Address: %s' % m.td.peer_ip)
-    prline('Peer AS: %s' % m.td.peer_as)
-    prline('Attribute Length: %d' % m.td.attr_len)
+    global indt_num
+    indt_num = 0
+    put_lines('%s' % MRT_T[m.type])
+
+    indt_num += 1
+    put_lines(
+        'View Number: %d' % m.td.view,
+        'Sequence Number: %d' % m.td.seq,
+        'Prefix: %s' % m.td.prefix,
+        'Prefix length: %d' % m.td.plen,
+        'Status: %d' % m.td.status,
+        'Originated Time: %d(%s)' %
+        (m.td.org_time, datetime.fromtimestamp(m.td.org_time)),
+        'Peer IP Address: %s' % m.td.peer_ip,
+        'Peer AS: %s' % m.td.peer_as,
+        'Attribute Length: %d' % m.td.attr_len
+    )
+
     for attr in m.td.attr:
         print_bgp_attr(attr, 1)
 
 def print_td_v2(m):
-    global indt
-    indt = 0
-    prline('%s' % TD_V2_ST[m.subtype])
+    global indt_num
+    indt_num = 0
+    put_lines('%s' % TD_V2_ST[m.subtype])
 
-    indt += 1
+    indt_num += 1
     if m.subtype == TD_V2_ST['PEER_INDEX_TABLE']:
-        prline('Collector: %s' % m.peer.collector)
-        prline('View Name Length: %d' % m.peer.view_len)
-        prline('View Name: %s' % m.peer.view)
-        prline('Peer Count: %d' % m.peer.count)
+        put_lines(
+            'Collector: %s' % m.peer.collector,
+            'View Name Length: %d' % m.peer.view_len,
+            'View Name: %s' % m.peer.view,
+            'Peer Count: %d' % m.peer.count
+        )
 
         for entry in m.peer.entry:
-            prline('Peer Type: 0x%02x' % entry.type)
-            prline('Peer BGP ID: %s' % entry.bgp_id)
-            prline('Peer IP Address: %s' % entry.ip)
-            prline('Peer AS: %s' % entry.asn)
-
-    elif ( m.subtype == TD_V2_ST['RIB_IPV4_UNICAST']
-        or m.subtype == TD_V2_ST['RIB_IPV4_MULTICAST']
-        or m.subtype == TD_V2_ST['RIB_IPV6_UNICAST']
-        or m.subtype == TD_V2_ST['RIB_IPV6_MULTICAST']):
-        prline('Sequence Number: %d' % m.rib.seq)
-        prline('Prefix Length: %d' % m.rib.plen)
-        prline('Prefix: %s' % m.rib.prefix)
-        prline('Entry Count: %d' % m.rib.count)
+            put_lines(
+                'Peer Type: 0x%02x' % entry.type,
+                'Peer BGP ID: %s' % entry.bgp_id,
+                'Peer IP Address: %s' % entry.ip,
+                'Peer AS: %s' % entry.asn
+            )
+
+    elif m.subtype == TD_V2_ST['RIB_IPV4_UNICAST'] \
+        or m.subtype == TD_V2_ST['RIB_IPV4_MULTICAST'] \
+        or m.subtype == TD_V2_ST['RIB_IPV6_UNICAST'] \
+        or m.subtype == TD_V2_ST['RIB_IPV6_MULTICAST'] \
+        or m.subtype == TD_V2_ST['RIB_IPV4_UNICAST_ADDPATH'] \
+        or m.subtype == TD_V2_ST['RIB_IPV4_MULTICAST_ADDPATH'] \
+        or m.subtype == TD_V2_ST['RIB_IPV6_UNICAST_ADDPATH'] \
+        or m.subtype == TD_V2_ST['RIB_IPV6_MULTICAST_ADDPATH']:
+        put_lines(
+            'Sequence Number: %d' % m.rib.seq,
... 2143 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/mrtparse.git



More information about the Python-modules-commits mailing list