Skip to content

Commit a8a66a9

Browse files
committed
add install instructions and usage example to docs
1 parent 0009bce commit a8a66a9

File tree

3 files changed

+63
-3
lines changed

3 files changed

+63
-3
lines changed

README.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
|docs|
2+
13
=============
24
rtrlib-python
35
=============
@@ -34,3 +36,8 @@ Requirements
3436
- six
3537

3638
and a c compiler for building the module.
39+
40+
41+
.. |docs| image:: https://readthedocs.org/projects/python-rtrlib/badge/?version=latest
42+
:target: http://python-rtrlib.readthedocs.io/en/latest/?badge=latest
43+
:alt: Documentation Status

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
extensions = [
3535
'sphinx.ext.autodoc',
3636
'sphinx.ext.coverage',
37+
'sphinx.ext.viewcode',
3738
]
3839

3940
# Add any paths that contain templates here, relative to this directory.

docs/index.rst

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,66 @@
66
Welcome to rtrlib-python's documentation!
77
=========================================
88

9-
rtrlib-python is a cffi based binding for rtrlib_.
9+
rtrlib-python_ is a cffi based binding for RTRlib_.
10+
11+
The RTRlib implements the client-side of the RPKI-RTR protocol (RFC
12+
6810) and BGP Prefix Origin Validation (RFC 6811). This release also
13+
supports Internet-Draft draft-ietf-sidr-rpki-rtr-rfc6810-bis, which
14+
enables the maintenance of router keys. Router keys are required to
15+
deploy BGPSEC.
1016

1117
Since this is a work in progress currently only basic validation against one cache is supported.
1218

19+
Installation
20+
------------
21+
Requirements
22+
''''''''''''''
23+
- python 2.7 or python 3
24+
- C Compiler
25+
- RTRlib_
26+
27+
Python Requirements
28+
'''''''''''''''''''
29+
If you are using virtualenv these are installed automatically during the install step,
30+
otherwise you have to use your platforms package management tool or just run ``pip install -r requirements.txt``.
31+
32+
- cffi>=1.4.0
33+
- enum34
34+
- six
35+
36+
Download and Installation
37+
'''''''''''''''''''''''''
38+
39+
- ``git clone https://github.com/rtrlib/python-binding.git``
40+
- ``cd python-binding``
41+
- ``python setup.py build``
42+
- ``python setup.py install``
43+
44+
Example
45+
-------
46+
::
47+
48+
from rtrlib import RTRManager, PfxvState
49+
50+
mgr = RTRManager('rpki-validator.realmv6.org', 8282)
51+
mgr.start()
52+
result = mgr.validate(12345, '10.10.0.0', 24)
53+
54+
if result == PfxvState.valid:
55+
print('Prefix Valid')
56+
elif result == PfxvState.invalid:
57+
print('Prefix Invalid')
58+
elif result == PfxvState.not_found:
59+
print('Prefix not found')
60+
else:
61+
print('Invalid response')
62+
63+
64+
Further examples can be found in the tools_ dir of the repository.
1365

14-
For usage examples see the tools_ directory on github
1566

16-
.. _rtrlib: https://github.com/rtrlib/rtrlib
67+
.. _rtrlib-python: https://github.com/rtrlib/python-binding
68+
.. _RTRlib: https://github.com/rtrlib/rtrlib
1769
.. _tools: https://github.com/mroethke/rtrlib-python/tree/master/tools
1870

1971
Contents:

0 commit comments

Comments
 (0)