Skip to content

Commit c67a762

Browse files
committed
Documentation of the XML-RPC class
Improved documentation of the XML-RPC glue class and a few smaller fixes.
1 parent 30fa9ef commit c67a762

File tree

7 files changed

+297
-24
lines changed

7 files changed

+297
-24
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
*.sw[po]
33
*.pyc
44
*.class
5+
*.tar.gz
6+
*.deb
57
docs/sphinx/_build/

docs/sphinx/authlib.rst

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.. automodule:: nipap.authlib
2+
:members:

docs/sphinx/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# serve to show the default.
1313

1414
import sys, os
15-
sys.path.append('../../nipap')
16-
sys.path.append('../../nipap-www/nipapwww')
15+
sys.path.insert(0, '../../nipap')
16+
#sys.path.append('../../nipap-www/nipapwww')
1717

1818
# If extensions (or modules to document with autodoc) are in another directory,
1919
# add these directories to sys.path here. If the directory is relative to the

docs/sphinx/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Contents:
2727
design
2828
nipap
2929
xmlrpc
30+
authlib
3031

3132

3233
Indices and tables

nipap/nipap/authlib.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
""" A base authentication & authorization module.
1+
""" Authentication library
2+
======================
3+
4+
A base authentication & authorization module.
25
36
Includes the base class BaseAuth.
47
"""

nipap/nipap/nipap.py

+55-4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
* :func:`~Nipap.add_schema` - Create a new schema.
3333
* :func:`~Nipap.edit_schema` - Edit a schema.
3434
* :func:`~Nipap.remove_schema` - Remove a schema.
35+
* :func:`~Nipap.search_schema` - Search schemas from a specifically formatted dict.
36+
* :func:`~Nipap.smart_search_schema` - Search schemas from arbitarly formatted string.
3537
3638
3739
Prefix
@@ -57,7 +59,8 @@
5759
* :attr:`indent` - Depth in prefix tree. Set by NIPAP.
5860
* :attr:`country` - Country where the prefix resides (two-letter country code).
5961
* :attr:`order_id` - Order identifier.
60-
* :attr:`authoritative_source` - String identifying which system added the prefix.
62+
* :attr:`authoritative_source` - String identifying which system last
63+
modified the prefix.
6164
* :attr:`alarm_priority` - String 'low', 'medium' or 'high'. Used by netwatch.
6265
* :attr:`monitor` - A boolean specifying whether the prefix should be
6366
monitored or not.
@@ -126,6 +129,17 @@
126129
127130
If multiple keys are given, they will be ANDed together.
128131
132+
Authorization & accounting
133+
--------------------------
134+
With each query an object extending the BaseAuth class should be passed.
135+
This object is used in the Nipap class to perform authorization (not yet
136+
implemented) and accounting. Authentication should be performed at an
137+
earlier stage and is NOT done in the Nipap class.
138+
139+
Each command which alters data stored in NIPAP is logged. There are
140+
currently no API functions for extracting this data, but this will change
141+
in the future.
142+
129143
Classes
130144
-------
131145
"""
@@ -567,6 +581,8 @@ def _expand_schema_query(self, query, table_name = None):
567581
def add_schema(self, auth, attr):
568582
""" Add a new network schema.
569583
584+
* `auth` [BaseAuth]
585+
AAA options.
570586
* `attr` [schema_attr]
571587
The news schema's attributes.
572588
@@ -608,6 +624,8 @@ def add_schema(self, auth, attr):
608624
def remove_schema(self, auth, spec):
609625
""" Remove a schema.
610626
627+
* `auth` [BaseAuth]
628+
AAA options.
611629
* `spec` [schema_spec]
612630
A schema specification.
613631
@@ -640,6 +658,8 @@ def remove_schema(self, auth, spec):
640658
def list_schema(self, auth, spec=None):
641659
""" Return a list of schemas matching `spec`.
642660
661+
* `auth` [BaseAuth]
662+
AAA options.
643663
* `spec` [schema_spec]
644664
A schema specification. If omitted, all schemas are returned.
645665
@@ -688,6 +708,8 @@ def _get_schema(self, auth, spec):
688708
def edit_schema(self, auth, spec, attr):
689709
""" Updata schema matching `spec` with attributes `attr`.
690710
711+
* `auth` [BaseAuth]
712+
AAA options.
691713
* `spec` [schema_spec]
692714
Schema specification.
693715
* `attr` [schema_attr]
@@ -732,6 +754,8 @@ def edit_schema(self, auth, spec, attr):
732754
def search_schema(self, auth, query, search_options = {}):
733755
""" Search schema list for schemas matching `query`.
734756
757+
* `auth` [BaseAuth]
758+
AAA options.
735759
* `query` [dict_to_sql]
736760
How the search should be performed.
737761
* `search_options` [options_dict]
@@ -852,6 +876,8 @@ def search_schema(self, auth, query, search_options = {}):
852876
def smart_search_schema(self, auth, query_str, search_options = {}):
853877
""" Perform a smart search on schema list.
854878
879+
* `auth` [BaseAuth]
880+
AAA options.
855881
* `query_str` [string]
856882
Search string
857883
* `search_options` [options_dict]
@@ -1043,9 +1069,10 @@ def _expand_pool_query(self, query, table_name = None):
10431069
def add_pool(self, auth, schema_spec, attr):
10441070
""" Create a pool according to `attr`.
10451071
1072+
* `auth` [BaseAuth]
1073+
AAA options.
10461074
* `schema_spec` [schema_spec]
10471075
Specifies what schema we are working within.
1048-
10491076
* `attr` [pool_attr]
10501077
A dict containing the attributes the new pool should have.
10511078
@@ -1090,6 +1117,8 @@ def add_pool(self, auth, schema_spec, attr):
10901117
def remove_pool(self, auth, schema_spec, spec):
10911118
""" Remove a pool.
10921119
1120+
* `auth` [BaseAuth]
1121+
AAA options.
10931122
* `schema_spec` [schema_spec]
10941123
Specifies what schema we are working within.
10951124
* `spec` [pool_spec]
@@ -1129,6 +1158,8 @@ def remove_pool(self, auth, schema_spec, spec):
11291158
def list_pool(self, auth, schema_spec, spec = {}):
11301159
""" Return a list of pools.
11311160
1161+
* `auth` [BaseAuth]
1162+
AAA options.
11321163
* `schema_spec` [schema_spec]
11331164
Specifies what schema we are working within.
11341165
* `spec` [pool_spec]
@@ -1196,6 +1227,8 @@ def _get_pool(self, auth, schema_spec, spec):
11961227
def edit_pool(self, auth, schema_spec, spec, attr):
11971228
""" Update pool given by `spec` with attributes `attr`.
11981229
1230+
* `auth` [BaseAuth]
1231+
AAA options.
11991232
* `schema_spec` [schema_spec]
12001233
Specifies what schema we are working within.
12011234
* `spec` [pool_spec]
@@ -1255,6 +1288,8 @@ def edit_pool(self, auth, schema_spec, spec, attr):
12551288
def search_pool(self, auth, schema_spec, query, search_options = {}):
12561289
""" Search pool list for pools matching `query`.
12571290
1291+
* `auth` [BaseAuth]
1292+
AAA options.
12581293
* `schema_spec` [schema_spec]
12591294
Specifies what schema we are working within.
12601295
* `query` [dict_to_sql]
@@ -1400,6 +1435,8 @@ def search_pool(self, auth, schema_spec, query, search_options = {}):
14001435
def smart_search_pool(self, auth, schema_spec, query_str, search_options = {}):
14011436
""" Perform a smart search on pool list.
14021437
1438+
* `auth` [BaseAuth]
1439+
AAA options.
14031440
* `schema_spec` [schema_spec]
14041441
Specifies what schema we are working within.
14051442
* `query_str` [string]
@@ -1605,6 +1642,8 @@ def _expand_prefix_query(self, query, table_name = None):
16051642
def add_prefix(self, auth, schema_spec, attr, args = {}):
16061643
""" Add a prefix and return its ID.
16071644
1645+
* `auth` [BaseAuth]
1646+
AAA options.
16081647
* `schema_spec` [schema_spec]
16091648
Specifies what schema we are working within.
16101649
* `attr` [prefix_attr]
@@ -1722,6 +1761,8 @@ def add_prefix(self, auth, schema_spec, attr, args = {}):
17221761
def edit_prefix(self, auth, schema_spec, spec, attr):
17231762
""" Update prefix matching `spec` with attributes `attr`.
17241763
1764+
* `auth` [BaseAuth]
1765+
AAA options.
17251766
* `schema_spec` [schema_spec]
17261767
Specifies what schema we are working within.
17271768
* `spec` [prefix_spec]
@@ -1810,6 +1851,8 @@ def edit_prefix(self, auth, schema_spec, spec, attr):
18101851
def find_free_prefix(self, auth, schema_spec, args):
18111852
""" Finds free prefixes in the sources given in `args`.
18121853
1854+
* `auth` [BaseAuth]
1855+
AAA options.
18131856
`schema_spec` [schema_spec]
18141857
Specifies what schema we are working within.
18151858
`args` [find_free_prefix_args]
@@ -1829,7 +1872,7 @@ def find_free_prefix(self, auth, schema_spec, args):
18291872
18301873
Example::
18311874
1832-
attr = {
1875+
args = {
18331876
'from-pool': { 'name': 'CUSTOMER-' },
18341877
'family': 6,
18351878
'prefix_length': 64
@@ -1844,7 +1887,7 @@ def find_free_prefix(self, auth, schema_spec, args):
18441887
18451888
Example::
18461889
1847-
attr = {
1890+
args = {
18481891
'from-prefix': '192.0.2.0/24'
18491892
'prefix_length': 27
18501893
}
@@ -1964,6 +2007,8 @@ def find_free_prefix(self, auth, schema_spec, args):
19642007
def list_prefix(self, auth, schema_spec, spec = None):
19652008
""" List prefixes matching the `spec`.
19662009
2010+
* `auth` [BaseAuth]
2011+
AAA options.
19672012
* `schema_spec` [schema_spec]
19682013
Specifies what schema we are working within.
19692014
* `spec` [prefix_spec]
@@ -2002,6 +2047,8 @@ def list_prefix(self, auth, schema_spec, spec = None):
20022047
def remove_prefix(self, auth, schema_spec, spec):
20032048
""" Remove prefix matching `spec`.
20042049
2050+
* `auth` [BaseAuth]
2051+
AAA options.
20052052
* `schema_spec` [schema_spec]
20062053
Specifies what schema we are working within.
20072054
* `spec` [prefix_spec]
@@ -2055,6 +2102,8 @@ def remove_prefix(self, auth, schema_spec, spec):
20552102
def search_prefix(self, auth, schema_spec, query, search_options = {}):
20562103
""" Search prefix list for prefixes matching `query`.
20572104
2105+
* `auth` [BaseAuth]
2106+
AAA options.
20582107
* `schema_spec` [schema_spec]
20592108
Specifies what schema we are working within.
20602109
* `query` [dict_to_sql]
@@ -2344,6 +2393,8 @@ def search_prefix(self, auth, schema_spec, query, search_options = {}):
23442393
def smart_search_prefix(self, auth, schema_spec, query_str, search_options = {}):
23452394
""" Perform a smart search on prefix list.
23462395
2396+
* `auth` [BaseAuth]
2397+
AAA options.
23472398
* `schema_spec` [schema_spec]
23482399
Specifies what schema we are working within.
23492400
* `query_str` [string]

0 commit comments

Comments
 (0)