[Python-modules-commits] [mrtparse] 02/06: Import mrtparse_1.5.orig.tar.gz

Vincent Bernat bernat at moszumanska.debian.org
Sun Jan 8 17:13:50 UTC 2017


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

bernat pushed a commit to branch master
in repository mrtparse.

commit 60a7b2e8e45ce7ec42f893676692b0a86f562d98
Author: Vincent Bernat <bernat at debian.org>
Date:   Sun Jan 8 17:56:36 2017 +0100

    Import mrtparse_1.5.orig.tar.gz
---
 MANIFEST.in                                        |    3 +-
 PKG-INFO                                           |  194 ++-
 README.rst                                         |  174 +++
 .../README-ja.md => examples/README-ja.rst         |  279 +++-
 mrtparse/examples/README.md => examples/README.rst |  312 +++-
 {mrtparse/examples => examples}/mrt2bgpdump.py     |    2 +-
 examples/mrt2exabgp.py                             |  472 ++++++
 {mrtparse/examples => examples}/print_all.py       |    4 +-
 {mrtparse/examples => examples}/slice.py           |    2 +-
 {mrtparse/examples => examples}/summary.py         |    2 +-
 mrtparse.egg-info/PKG-INFO                         |  194 ++-
 mrtparse.egg-info/SOURCES.txt                      |   38 +-
 mrtparse.egg-info/not-zip-safe                     |    1 +
 mrtparse/__init__.py                               | 1545 +++++++++++++++++++-
 mrtparse/examples/mrt2exabgp.py                    |  286 ----
 mrtparse/mrtparse.py                               | 1322 -----------------
 mrtparse/samples/README-ja.md                      |   25 -
 mrtparse/samples/README.md                         |   25 -
 samples/README-ja.rst                              |   57 +
 samples/README.rst                                 |   57 +
 {mrtparse/samples => samples}/bird6_bgp            |  Bin
 {mrtparse/samples => samples}/bird_bgp             |  Bin
 {mrtparse/samples => samples}/openbgpd_bgp         |  Bin
 {mrtparse/samples => samples}/openbgpd_rib_table   |  Bin
 .../samples => samples}/openbgpd_rib_table-mp      |  Bin
 .../samples => samples}/openbgpd_rib_table-v2      |  Bin
 {mrtparse/samples => samples}/quagga_bgp           |  Bin
 samples/quagga_bgp_large_communities               |  Bin 0 -> 590 bytes
 {mrtparse/samples => samples}/quagga_rib           |  Bin
 setup.cfg                                          |    2 +-
 setup.py                                           |  106 +-
 31 files changed, 3220 insertions(+), 1882 deletions(-)

diff --git a/MANIFEST.in b/MANIFEST.in
index d3debd2..bfd98f5 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1 +1,2 @@
-graft mrtparse
+recursive-include examples *
+recursive-include samples *
diff --git a/PKG-INFO b/PKG-INFO
index 0253d4a..5db9009 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,24 +1,196 @@
 Metadata-Version: 1.1
 Name: mrtparse
-Version: 1.4
-Summary: mrtparse is a module to read and analyze the MRT format data.
+Version: 1.5
+Summary: MRT format data parser
 Home-page: https://github.com/YoshiyukiYamauchi/mrtparse
 Author: Tetsumune KISO, Yoshiyuki YAMAUCHI, Nobuhiro ITOU
 Author-email: t2mune at gmail.com, info at greenhippo.co.jp, js333123 at gmail.com
 License: Apache License 2.0
-Description: UNKNOWN
-Keywords: mrt,bgp
+Description: mrtparse
+        ========
+        
+        | mrtparse is a module to read and analyze the MRT format data.
+        | The MRT format can be used to export routing protocol messages, state changes, and routing information base contents, and is defined in RFC6396_.
+        | Programs like Quagga_ / Zebra_, BIRD_, OpenBGPD_ and PyRT_ can dump the MRT format data.
+        | You can also download archives from `the Route Views Projects`_, `RIPE NCC`_.
+        
+        .. _RFC6396: https://tools.ietf.org/html/rfc6396
+        .. _Quagga: http://www.nongnu.org/quagga/
+        .. _Zebra: https://www.gnu.org/software/zebra/
+        .. _BIRD: http://bird.network.cz/
+        .. _OpenBGPD: http://www.openbgpd.org/
+        .. _PyRT: https://github.com/mor1/pyrt
+        .. _`the Route Views Projects`: http://archive.routeviews.org/
+        .. _`RIPE NCC`: https://www.ripe.net/analyse/internet-measurements/routing-information-service-ris/ris-raw-data
+        
+        Supported MRT types
+        -------------------
+        
+        +-------------------+---------+
+        | Name              | Value   |
+        +===================+=========+
+        | Table\_Dump       | 12      |
+        +-------------------+---------+
+        | Table\_Dump\_V2   | 13      |
+        +-------------------+---------+
+        | BGP4MP            | 16      |
+        +-------------------+---------+
+        | BGP4MP\_ET        | 17      |
+        +-------------------+---------+
+        
+        Supported BGP capabilities
+        --------------------------
+        
+        +--------------------------------------------+---------+
+        | Name                                       | Value   |
+        +============================================+=========+
+        | Multiprotocol Extensions for BGP-4         | 1       |
+        +--------------------------------------------+---------+
+        | Route Refresh Capability for BGP-4         | 2       |
+        +--------------------------------------------+---------+
+        | Outbound Route Filtering Capability        | 3       |
+        +--------------------------------------------+---------+
+        | Graceful Restart Capability                | 64      |
+        +--------------------------------------------+---------+
+        | Support for 4-octet AS number capability   | 65      |
+        +--------------------------------------------+---------+
+        | ADD-PATH Capability                        | 69      |
+        +--------------------------------------------+---------+
+        
+        Supported BGP attributes
+        ------------------------
+        
+        +-------------------------+---------+
+        | Name                    | Value   |
+        +=========================+=========+
+        | ORIGIN                  | 1       |
+        +-------------------------+---------+
+        | AS\_PATH                | 2       |
+        +-------------------------+---------+
+        | NEXT\_HOP               | 3       |
+        +-------------------------+---------+
+        | MULTI\_EXIT\_DISC       | 4       |
+        +-------------------------+---------+
+        | LOCAL\_PREF             | 5       |
+        +-------------------------+---------+
+        | ATOMIC\_AGGREGATE       | 6       |
+        +-------------------------+---------+
+        | AGGREGATOR              | 7       |
+        +-------------------------+---------+
+        | COMMUNITY               | 8       |
+        +-------------------------+---------+
+        | ORIGINATOR\_ID          | 9       |
+        +-------------------------+---------+
+        | CLUSTER\_LIST           | 10      |
+        +-------------------------+---------+
+        | MP\_REACH\_NLRI         | 14      |
+        +-------------------------+---------+
+        | MP\_UNREACH\_NLRI       | 15      |
+        +-------------------------+---------+
+        | EXTENDED\_COMMUNITIES   | 16      |
+        +-------------------------+---------+
+        | AS4\_PATH               | 17      |
+        +-------------------------+---------+
+        | AS4\_AGGREGATOR         | 18      |
+        +-------------------------+---------+
+        | AIGP                    | 26      |
+        +-------------------------+---------+
+        | LARGE\_COMMUNITY        | 32      |
+        +-------------------------+---------+
+        | ATTR\_SET               | 128     |
+        +-------------------------+---------+
+        
+        Requirements
+        ------------
+        
+        Python2 or Python3 or PyPy or PyPy3
+        
+        Installation
+        ------------
+        
+        ::
+        
+            $ pip install mrtparse
+        
+        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
+        -----
+        
+        ::
+        
+            from mrtparse import *
+        
+        or
+        
+        ::
+        
+            import mrtparse
+        
+        Programming
+        -----------
+        
+        First, import the module.
+        
+        ::
+        
+            from mrtparse import *
+        
+        | And pass a MRT format data as a filepath string or file object to a class Reader().
+        | It is also supported gzip and bzip2 format.
+        | You can retrieve each entry from the returned object using a loop and then process it.
+        
+        ::
+        
+            d = Reader(f)
+            for m in d:
+                <statements>
+        
+        We have prepared some example scripts and sample data in `"examples"`_ and `"samples"`_ directory.
+        
+        .. _`"examples"`: https://github.com/YoshiyukiYamauchi/mrtparse/tree/master/examples
+        .. _`"samples"`: https://github.com/YoshiyukiYamauchi/mrtparse/tree/master/samples
+        
+        Authors
+        -------
+        
+        | Tetsumune KISO t2mune at gmail.com
+        | Yoshiyuki YAMAUCHI info at greenhippo.co.jp
+        | Nobuhiro ITOU js333123 at gmail.com
+        
+        License
+        -------
+        
+        | 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
+        
+Keywords: mrt bgp
 Platform: any
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
-Classifier: Topic :: System :: Networking
+Classifier: Intended Audience :: System Administrators
+Classifier: Intended Audience :: Telecommunications Industry
 Classifier: License :: OSI Approved :: Apache Software License
+Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
-Classifier: Programming Language :: Python :: 3.4
-Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: Implementation :: PyPy
+Classifier: Topic :: Internet
+Classifier: Topic :: System :: Networking
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..6156145
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,174 @@
+mrtparse
+========
+
+| mrtparse is a module to read and analyze the MRT format data.
+| The MRT format can be used to export routing protocol messages, state changes, and routing information base contents, and is defined in RFC6396_.
+| Programs like Quagga_ / Zebra_, BIRD_, OpenBGPD_ and PyRT_ can dump the MRT format data.
+| You can also download archives from `the Route Views Projects`_, `RIPE NCC`_.
+
+.. _RFC6396: https://tools.ietf.org/html/rfc6396
+.. _Quagga: http://www.nongnu.org/quagga/
+.. _Zebra: https://www.gnu.org/software/zebra/
+.. _BIRD: http://bird.network.cz/
+.. _OpenBGPD: http://www.openbgpd.org/
+.. _PyRT: https://github.com/mor1/pyrt
+.. _`the Route Views Projects`: http://archive.routeviews.org/
+.. _`RIPE NCC`: https://www.ripe.net/analyse/internet-measurements/routing-information-service-ris/ris-raw-data
+
+Supported MRT types
+-------------------
+
++-------------------+---------+
+| Name              | Value   |
++===================+=========+
+| Table\_Dump       | 12      |
++-------------------+---------+
+| Table\_Dump\_V2   | 13      |
++-------------------+---------+
+| BGP4MP            | 16      |
++-------------------+---------+
+| BGP4MP\_ET        | 17      |
++-------------------+---------+
+
+Supported BGP capabilities
+--------------------------
+
++--------------------------------------------+---------+
+| Name                                       | Value   |
++============================================+=========+
+| Multiprotocol Extensions for BGP-4         | 1       |
++--------------------------------------------+---------+
+| Route Refresh Capability for BGP-4         | 2       |
++--------------------------------------------+---------+
+| Outbound Route Filtering Capability        | 3       |
++--------------------------------------------+---------+
+| Graceful Restart Capability                | 64      |
++--------------------------------------------+---------+
+| Support for 4-octet AS number capability   | 65      |
++--------------------------------------------+---------+
+| ADD-PATH Capability                        | 69      |
++--------------------------------------------+---------+
+
+Supported BGP attributes
+------------------------
+
++-------------------------+---------+
+| Name                    | Value   |
++=========================+=========+
+| ORIGIN                  | 1       |
++-------------------------+---------+
+| AS\_PATH                | 2       |
++-------------------------+---------+
+| NEXT\_HOP               | 3       |
++-------------------------+---------+
+| MULTI\_EXIT\_DISC       | 4       |
++-------------------------+---------+
+| LOCAL\_PREF             | 5       |
++-------------------------+---------+
+| ATOMIC\_AGGREGATE       | 6       |
++-------------------------+---------+
+| AGGREGATOR              | 7       |
++-------------------------+---------+
+| COMMUNITY               | 8       |
++-------------------------+---------+
+| ORIGINATOR\_ID          | 9       |
++-------------------------+---------+
+| CLUSTER\_LIST           | 10      |
++-------------------------+---------+
+| MP\_REACH\_NLRI         | 14      |
++-------------------------+---------+
+| MP\_UNREACH\_NLRI       | 15      |
++-------------------------+---------+
+| EXTENDED\_COMMUNITIES   | 16      |
++-------------------------+---------+
+| AS4\_PATH               | 17      |
++-------------------------+---------+
+| AS4\_AGGREGATOR         | 18      |
++-------------------------+---------+
+| AIGP                    | 26      |
++-------------------------+---------+
+| LARGE\_COMMUNITY        | 32      |
++-------------------------+---------+
+| ATTR\_SET               | 128     |
++-------------------------+---------+
+
+Requirements
+------------
+
+Python2 or Python3 or PyPy or PyPy3
+
+Installation
+------------
+
+::
+
+    $ pip install mrtparse
+
+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
+-----
+
+::
+
+    from mrtparse import *
+
+or
+
+::
+
+    import mrtparse
+
+Programming
+-----------
+
+First, import the module.
+
+::
+
+    from mrtparse import *
+
+| And pass a MRT format data as a filepath string or file object to a class Reader().
+| It is also supported gzip and bzip2 format.
+| You can retrieve each entry from the returned object using a loop and then process it.
+
+::
+
+    d = Reader(f)
+    for m in d:
+        <statements>
+
+We have prepared some example scripts and sample data in `"examples"`_ and `"samples"`_ directory.
+
+.. _`"examples"`: https://github.com/YoshiyukiYamauchi/mrtparse/tree/master/examples
+.. _`"samples"`: https://github.com/YoshiyukiYamauchi/mrtparse/tree/master/samples
+
+Authors
+-------
+
+| Tetsumune KISO t2mune at gmail.com
+| Yoshiyuki YAMAUCHI info at greenhippo.co.jp
+| Nobuhiro ITOU js333123 at gmail.com
+
+License
+-------
+
+| 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/mrtparse/examples/README-ja.md b/examples/README-ja.rst
similarity index 58%
rename from mrtparse/examples/README-ja.md
rename to examples/README-ja.rst
index 1a3e68d..517cd07 100644
--- a/mrtparse/examples/README-ja.md
+++ b/examples/README-ja.rst
@@ -1,10 +1,26 @@
-##スクリプトの作成例
-###print_all.py
-####内容
+スクリプトの作成例
+==================
+
+print\_all.py
+-------------
+
+内容
+~~~~~~~~~~~
+
 MRT形式のファイルの内容を出力する
-####使用方法
+
+使用方法
+~~~~~~~~~
+
+::
+
     print_all.py ファイルへのパス
-####出力例
+
+出力例
+~~~~~~
+
+::
+
     ---------------------------------------------------------------
     MRT Header
         Timestamp: 1392828028(2014-02-20 01:40:28)
@@ -25,9 +41,11 @@ MRT形式のファイルの内容を出力する
         Timestamp: 1392828028(2014-02-20 01:40:28)
         Type: 16(BGP4MP)
         Subtype: 4(BGP4MP_MESSAGE_AS4)
-        ...
+    ...
+
+エラーが発生した場合は、以下のようにデータをバイトで表示する。
 
-エラーが発生した場合、以下のようにデータをバイトで表示する。
+::
 
     ---------------------------------------------------------------
     MRT Header
@@ -51,19 +69,28 @@ MRT形式のファイルの内容を出力する
         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 (旧exabgp_conf.py)
-####内容
-MRT形式のファイルを[exabgp][exabgp_git]用のコンフィグ形式に変換して出力する。
-Exa-BGPのAPIに関して詳しく知りたい場合は、[Wiki][wiki]を読んで下さい。
-[exabgp_git]: https://github.com/Exa-Networks/exabgp
-[wiki]: https://github.com/YoshiyukiYamauchi/mrtparse/wiki
-####使用方法
     使用方法: mrt2exabgp.py [-h] [-r ルータID] [-l ローカルAS] [-p ピアAS]
                          [-L ローカルアドレス] [-n ネイバーのアドレス] [-4 [ネクストホップ]]
-                         [-6 [ネクストホップ]] [-a] [-A] [-G [数値]]
+                         [-6 [ネクストホップ]] [-a] [-A] [-G [数値]] [-g [数値]] [-P]
                          ファイルのパス
-    
+
     このスクリプトはExaBGPのフォーマットに変換する
     
     オプションなし引数:
@@ -76,14 +103,23 @@ Exa-BGPのAPIに関して詳しく知りたい場合は、[Wiki][wiki]を読ん
       -p ピアAS                ピアASを指定する (デフォルト: 65000)
       -L ローカルアドレス      ローカルアドレスを指定する (デフォルト: 192.168.1.1)
       -n ネイバーのアドレス    ネイバーのアドレスを指定する (デフォルト: 192.168.1.100)
-      -4 [ネクストホップ]      IPv4のエントリーを変換して、指定されていればそのネクストホップを使用する
-      -6 [ネクストホップ]      IPv6のエントリーを変換して、指定されていればそのネクストホップを使用する
+      -4 [ネクストホップ]      IPv4のエントリーを変換して、指定されていればネクストホップを変更する
+      -6 [ネクストホップ]      IPv6のエントリーを変換して、指定されていればネクストホップを変更する
       -a                       全エントリを変換する (デフォルト: プレフィックスごとに最初のエントリーのみ)
       -A                       ExaBGPのAPIのフォーマットに変換する
-      -G [数値]                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;
@@ -91,7 +127,7 @@ Exa-BGPのAPIに関して詳しく知りたい場合は、[Wiki][wiki]を読ん
         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;
@@ -105,7 +141,14 @@ Exa-BGPのAPIに関して詳しく知りたい場合は、[Wiki][wiki]を読ん
         }
     }
 
-####出力例 (APIフォーマット)
+"-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
@@ -116,7 +159,36 @@ Exa-BGPのAPIに関して詳しく知りたい場合は、[Wiki][wiki]を読ん
     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
     ...
 
-####出力例 (APIグルーピングフォーマット)
+"-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
@@ -127,14 +199,59 @@ Exa-BGPのAPIに関して詳しく知りたい場合は、[Wiki][wiki]を読ん
     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
-####内容
-MRT形式のファイルについて、下記データをファイル出力する  
-1. 指定された開始時間から終了時間までの指定された秒単位の間隔についてのデータ  
-2. 指定された開始時間から終了時間までのデータ  
-3. 指定された秒単位の間隔についてのデータ  
-####使用方法
     使用方法: slice.py [-h] [-s 開始時間] [-e 終了時間] [-i 間隔] [-c {gz,bz2}]
                     ファイルのパス
     
@@ -149,7 +266,12 @@ MRT形式のファイルについて、下記データをファイル出力す
       -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
@@ -159,33 +281,55 @@ MRT形式のファイルについて、下記データをファイル出力す
     latest-update-20150426-032640.bz2
     latest-update-20150426-032650.bz2
 
+summary.py
+----------
+
+内容
+~~~~~~~~~~~
 
-###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]のフォーマットに変換する
-[bgpdump]: https://bitbucket.org/ripencc/bgpdump/wiki/Home
-####使用方法
+    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] ファイルのパス
     
@@ -204,7 +348,12 @@ MRT形式のファイルのサマリーを出力する
       -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||
@@ -217,15 +366,19 @@ MRT形式のファイルのサマリーを出力する
     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>
+| 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][Apache]  
-Copyright © 2015 [greenHippo, LLC.][greenHippo]  
-[Apache]: http://www.apache.org/licenses/LICENSE-2.0
-[greenHippo]: http://greenhippo.co.jp
+
+| 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/mrtparse/examples/README.md b/examples/README.rst
similarity index 58%
rename from mrtparse/examples/README.md
rename to examples/README.rst
index 81d4125..25e1b61 100644
--- a/mrtparse/examples/README.md
+++ b/examples/README.rst
@@ -1,10 +1,26 @@
-##Example Scripts
-###print_all.py
-####Description
-This script displays the contents of a MRT format file.
-####Usage
-    print_all.py <path to the file>
-####Result
+Example Scripts
+===============
+
+print\_all.py
+-------------
+
+Description
+~~~~~~~~~~~
+
+This script displays the contents of a MRT format data.
+
+Usage
+~~~~~
+
+::
+
+    print_all.py path_to_file
+
+Result
+~~~~~~
+
+::
+
     ---------------------------------------------------------------
     MRT Header
         Timestamp: 1392828028(2014-02-20 01:40:28)
@@ -25,10 +41,12 @@ This script displays the contents of a MRT format file.
         Timestamp: 1392828028(2014-02-20 01:40:28)
         Type: 16(BGP4MP)
         Subtype: 4(BGP4MP_MESSAGE_AS4)
-        ...
+    ...
 
 If error occurred, it displays data in byte as below.
 
+::
+
     ---------------------------------------------------------------
     MRT Header
         Timestamp: 1442843462(2015-09-21 22:51:02)
@@ -51,24 +69,33 @@ If error occurred, it displays data in byte as below.
         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 (formerly exabgp_conf.py)
-####Description
-This script converts MRT format to [ExaBGP][exabgp_git] config/API format and displays it.
-If you want to know how to use ExaBGP API, please read [the wiki][wiki]. 
-[exabgp_git]: https://github.com/Exa-Networks/exabgp
-[wiki]: https://github.com/YoshiyukiYamauchi/mrtparse/wiki
-####Usage
+mrt2exabgp.py (formerly exabgp\_conf.py)
+----------------------------------------
+
+Description
+~~~~~~~~~~~
+
+| This script converts MRT format to ExaBGP_ config/API format and displays it.
+| If you want to know how to use ExaBGP API, please read `the wiki`_.
+
+.. _ExaBGP: https://github.com/Exa-Networks/exabgp
+.. _`the wiki`: https://github.com/YoshiyukiYamauchi/mrtparse/wiki
+
+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]]
+                         [-6 [NEXT_HOP]] [-a] [-A] [-G [NUM]] [-g [NUM]] [-P]
                          path_to_file
-    
-    This script converts to ExaBGP format config.
-    
+
+    This script converts to ExaBGP format.
+
     positional arguments:
       path_to_file   specify path to MRT format file
-    
+
     optional arguments:
       -h, --help     show this help message and exit
       -r ROUTER_ID   specify router-id (default: 192.168.0.1)
@@ -76,16 +103,26 @@ If you want to know how to use ExaBGP API, please read [the wiki][wiki].
       -p PEER_AS     specify peer AS number (default: 65000)
       -L LOCAL_ADDR  specify local address (default: 192.168.1.1)
       -n NEIGHBOR    specify neighbor address (default: 192.168.1.100)
-      -4 [NEXT_HOP]  convert IPv4 entries and use IPv4 next-hop if specified
-      -6 [NEXT_HOP]  convert IPv6 entries and use IPv6 next-hop if specified
+      -4 [NEXT_HOP]  convert IPv4 entries and change IPv4 next-hop if specified
+      -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)
       -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
-                     (default: 1000000)
+                     attributes for each spceified the number of prefixes using
+                     "announce attributes ..." syntax (default: 1000000)
+      -g [NUM]       convert to ExaBGP API format and group updates with the same
+                     attributes for each spceified the number of prefixes using
+                     "announce attribute ..." old syntax (default: 1000000)
+      -P             convert to ExaBGP API program
+
+Result (Config format)
+~~~~~~~~~~~~~~~~~~~~~~
+
+Without "-A"/"-G"/"-g"/"-P" options, it outputs a ExaBGP config.
+
+::
 
-####Result (Config format)
     neighbor 192.168.1.1 {
         router-id 192.168.0.2;
         local-address 192.168.1.2;
@@ -93,7 +130,7 @@ If you want to know how to use ExaBGP API, please read [the wiki][wiki].
         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;
@@ -107,7 +144,13 @@ If you want to know how to use ExaBGP API, please read [the wiki][wiki].
         }
     }
 
-####Result (API format)
+Result in "-A" option (API format)
+~~~~~~~~~~~~~~~~~~~
+
+This option is possible to improve the performance in most cases.
+
+::
+
     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
@@ -118,7 +161,36 @@ If you want to know how to use ExaBGP API, please read [the wiki][wiki].
     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
     ...
 
-####Result (API grouping format)
+Result in "-G" option (API grouping format)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+| This option is possible to improve the performance, especially when advertising huge prefixes like full internet routes.
+| It outputs with "announce attributes ..." syntax.
+| If you use MRT format data included "BGP4MP" or "BGP4MP_ET", you must use this or "-g" option.
+| In that case "NUM" argument is ignored even if specified it.
+
+::
+
+    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 [...]
... 4598 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