32
32
* :func:`~Nipap.add_schema` - Create a new schema.
33
33
* :func:`~Nipap.edit_schema` - Edit a schema.
34
34
* :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.
35
37
36
38
37
39
Prefix
57
59
* :attr:`indent` - Depth in prefix tree. Set by NIPAP.
58
60
* :attr:`country` - Country where the prefix resides (two-letter country code).
59
61
* :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.
61
64
* :attr:`alarm_priority` - String 'low', 'medium' or 'high'. Used by netwatch.
62
65
* :attr:`monitor` - A boolean specifying whether the prefix should be
63
66
monitored or not.
126
129
127
130
If multiple keys are given, they will be ANDed together.
128
131
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
+
129
143
Classes
130
144
-------
131
145
"""
@@ -567,6 +581,8 @@ def _expand_schema_query(self, query, table_name = None):
567
581
def add_schema (self , auth , attr ):
568
582
""" Add a new network schema.
569
583
584
+ * `auth` [BaseAuth]
585
+ AAA options.
570
586
* `attr` [schema_attr]
571
587
The news schema's attributes.
572
588
@@ -608,6 +624,8 @@ def add_schema(self, auth, attr):
608
624
def remove_schema (self , auth , spec ):
609
625
""" Remove a schema.
610
626
627
+ * `auth` [BaseAuth]
628
+ AAA options.
611
629
* `spec` [schema_spec]
612
630
A schema specification.
613
631
@@ -640,6 +658,8 @@ def remove_schema(self, auth, spec):
640
658
def list_schema (self , auth , spec = None ):
641
659
""" Return a list of schemas matching `spec`.
642
660
661
+ * `auth` [BaseAuth]
662
+ AAA options.
643
663
* `spec` [schema_spec]
644
664
A schema specification. If omitted, all schemas are returned.
645
665
@@ -688,6 +708,8 @@ def _get_schema(self, auth, spec):
688
708
def edit_schema (self , auth , spec , attr ):
689
709
""" Updata schema matching `spec` with attributes `attr`.
690
710
711
+ * `auth` [BaseAuth]
712
+ AAA options.
691
713
* `spec` [schema_spec]
692
714
Schema specification.
693
715
* `attr` [schema_attr]
@@ -732,6 +754,8 @@ def edit_schema(self, auth, spec, attr):
732
754
def search_schema (self , auth , query , search_options = {}):
733
755
""" Search schema list for schemas matching `query`.
734
756
757
+ * `auth` [BaseAuth]
758
+ AAA options.
735
759
* `query` [dict_to_sql]
736
760
How the search should be performed.
737
761
* `search_options` [options_dict]
@@ -852,6 +876,8 @@ def search_schema(self, auth, query, search_options = {}):
852
876
def smart_search_schema (self , auth , query_str , search_options = {}):
853
877
""" Perform a smart search on schema list.
854
878
879
+ * `auth` [BaseAuth]
880
+ AAA options.
855
881
* `query_str` [string]
856
882
Search string
857
883
* `search_options` [options_dict]
@@ -1043,9 +1069,10 @@ def _expand_pool_query(self, query, table_name = None):
1043
1069
def add_pool (self , auth , schema_spec , attr ):
1044
1070
""" Create a pool according to `attr`.
1045
1071
1072
+ * `auth` [BaseAuth]
1073
+ AAA options.
1046
1074
* `schema_spec` [schema_spec]
1047
1075
Specifies what schema we are working within.
1048
-
1049
1076
* `attr` [pool_attr]
1050
1077
A dict containing the attributes the new pool should have.
1051
1078
@@ -1090,6 +1117,8 @@ def add_pool(self, auth, schema_spec, attr):
1090
1117
def remove_pool (self , auth , schema_spec , spec ):
1091
1118
""" Remove a pool.
1092
1119
1120
+ * `auth` [BaseAuth]
1121
+ AAA options.
1093
1122
* `schema_spec` [schema_spec]
1094
1123
Specifies what schema we are working within.
1095
1124
* `spec` [pool_spec]
@@ -1129,6 +1158,8 @@ def remove_pool(self, auth, schema_spec, spec):
1129
1158
def list_pool (self , auth , schema_spec , spec = {}):
1130
1159
""" Return a list of pools.
1131
1160
1161
+ * `auth` [BaseAuth]
1162
+ AAA options.
1132
1163
* `schema_spec` [schema_spec]
1133
1164
Specifies what schema we are working within.
1134
1165
* `spec` [pool_spec]
@@ -1196,6 +1227,8 @@ def _get_pool(self, auth, schema_spec, spec):
1196
1227
def edit_pool (self , auth , schema_spec , spec , attr ):
1197
1228
""" Update pool given by `spec` with attributes `attr`.
1198
1229
1230
+ * `auth` [BaseAuth]
1231
+ AAA options.
1199
1232
* `schema_spec` [schema_spec]
1200
1233
Specifies what schema we are working within.
1201
1234
* `spec` [pool_spec]
@@ -1255,6 +1288,8 @@ def edit_pool(self, auth, schema_spec, spec, attr):
1255
1288
def search_pool (self , auth , schema_spec , query , search_options = {}):
1256
1289
""" Search pool list for pools matching `query`.
1257
1290
1291
+ * `auth` [BaseAuth]
1292
+ AAA options.
1258
1293
* `schema_spec` [schema_spec]
1259
1294
Specifies what schema we are working within.
1260
1295
* `query` [dict_to_sql]
@@ -1400,6 +1435,8 @@ def search_pool(self, auth, schema_spec, query, search_options = {}):
1400
1435
def smart_search_pool (self , auth , schema_spec , query_str , search_options = {}):
1401
1436
""" Perform a smart search on pool list.
1402
1437
1438
+ * `auth` [BaseAuth]
1439
+ AAA options.
1403
1440
* `schema_spec` [schema_spec]
1404
1441
Specifies what schema we are working within.
1405
1442
* `query_str` [string]
@@ -1605,6 +1642,8 @@ def _expand_prefix_query(self, query, table_name = None):
1605
1642
def add_prefix (self , auth , schema_spec , attr , args = {}):
1606
1643
""" Add a prefix and return its ID.
1607
1644
1645
+ * `auth` [BaseAuth]
1646
+ AAA options.
1608
1647
* `schema_spec` [schema_spec]
1609
1648
Specifies what schema we are working within.
1610
1649
* `attr` [prefix_attr]
@@ -1722,6 +1761,8 @@ def add_prefix(self, auth, schema_spec, attr, args = {}):
1722
1761
def edit_prefix (self , auth , schema_spec , spec , attr ):
1723
1762
""" Update prefix matching `spec` with attributes `attr`.
1724
1763
1764
+ * `auth` [BaseAuth]
1765
+ AAA options.
1725
1766
* `schema_spec` [schema_spec]
1726
1767
Specifies what schema we are working within.
1727
1768
* `spec` [prefix_spec]
@@ -1810,6 +1851,8 @@ def edit_prefix(self, auth, schema_spec, spec, attr):
1810
1851
def find_free_prefix (self , auth , schema_spec , args ):
1811
1852
""" Finds free prefixes in the sources given in `args`.
1812
1853
1854
+ * `auth` [BaseAuth]
1855
+ AAA options.
1813
1856
`schema_spec` [schema_spec]
1814
1857
Specifies what schema we are working within.
1815
1858
`args` [find_free_prefix_args]
@@ -1829,7 +1872,7 @@ def find_free_prefix(self, auth, schema_spec, args):
1829
1872
1830
1873
Example::
1831
1874
1832
- attr = {
1875
+ args = {
1833
1876
'from-pool': { 'name': 'CUSTOMER-' },
1834
1877
'family': 6,
1835
1878
'prefix_length': 64
@@ -1844,7 +1887,7 @@ def find_free_prefix(self, auth, schema_spec, args):
1844
1887
1845
1888
Example::
1846
1889
1847
- attr = {
1890
+ args = {
1848
1891
'from-prefix': '192.0.2.0/24'
1849
1892
'prefix_length': 27
1850
1893
}
@@ -1964,6 +2007,8 @@ def find_free_prefix(self, auth, schema_spec, args):
1964
2007
def list_prefix (self , auth , schema_spec , spec = None ):
1965
2008
""" List prefixes matching the `spec`.
1966
2009
2010
+ * `auth` [BaseAuth]
2011
+ AAA options.
1967
2012
* `schema_spec` [schema_spec]
1968
2013
Specifies what schema we are working within.
1969
2014
* `spec` [prefix_spec]
@@ -2002,6 +2047,8 @@ def list_prefix(self, auth, schema_spec, spec = None):
2002
2047
def remove_prefix (self , auth , schema_spec , spec ):
2003
2048
""" Remove prefix matching `spec`.
2004
2049
2050
+ * `auth` [BaseAuth]
2051
+ AAA options.
2005
2052
* `schema_spec` [schema_spec]
2006
2053
Specifies what schema we are working within.
2007
2054
* `spec` [prefix_spec]
@@ -2055,6 +2102,8 @@ def remove_prefix(self, auth, schema_spec, spec):
2055
2102
def search_prefix (self , auth , schema_spec , query , search_options = {}):
2056
2103
""" Search prefix list for prefixes matching `query`.
2057
2104
2105
+ * `auth` [BaseAuth]
2106
+ AAA options.
2058
2107
* `schema_spec` [schema_spec]
2059
2108
Specifies what schema we are working within.
2060
2109
* `query` [dict_to_sql]
@@ -2344,6 +2393,8 @@ def search_prefix(self, auth, schema_spec, query, search_options = {}):
2344
2393
def smart_search_prefix (self , auth , schema_spec , query_str , search_options = {}):
2345
2394
""" Perform a smart search on prefix list.
2346
2395
2396
+ * `auth` [BaseAuth]
2397
+ AAA options.
2347
2398
* `schema_spec` [schema_spec]
2348
2399
Specifies what schema we are working within.
2349
2400
* `query_str` [string]
0 commit comments