SOLIDserverRest 2.3.11__tar.gz → 2.3.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {SOLIDserverRest-2.3.11/SOLIDserverRest.egg-info → SOLIDserverRest-2.3.12}/PKG-INFO +47 -7
  2. SOLIDserverRest-2.3.11/PKG-INFO → SOLIDserverRest-2.3.12/README.md +172 -156
  3. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/sds.py +11 -0
  4. SOLIDserverRest-2.3.11/README.md → SOLIDserverRest-2.3.12/SOLIDserverRest.egg-info/PKG-INFO +196 -132
  5. SOLIDserverRest-2.3.12/SOLIDserverRest.egg-info/requires.txt +7 -0
  6. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/setup.py +7 -7
  7. SOLIDserverRest-2.3.11/SOLIDserverRest.egg-info/requires.txt +0 -7
  8. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/LICENSE +0 -0
  9. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/Exception.py +0 -0
  10. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/SOLIDserverRest.py +0 -0
  11. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/__init__.py +0 -0
  12. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/__init__.py +0 -0
  13. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/base.py +0 -0
  14. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/class_params.py +0 -0
  15. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/device.py +0 -0
  16. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/device_tools.py +0 -0
  17. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/devif.py +0 -0
  18. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/dns.py +0 -0
  19. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/dns_record.py +0 -0
  20. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/dns_zone.py +0 -0
  21. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/ipaddress.py +0 -0
  22. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/network.py +0 -0
  23. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/space.py +0 -0
  24. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/adv/validators.py +0 -0
  25. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest/mapper.py +0 -0
  26. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest.egg-info/SOURCES.txt +0 -0
  27. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest.egg-info/dependency_links.txt +0 -0
  28. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest.egg-info/entry_points.txt +0 -0
  29. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest.egg-info/not-zip-safe +0 -0
  30. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/SOLIDserverRest.egg-info/top_level.txt +0 -0
  31. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/setup.cfg +0 -0
  32. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/tests/test_simple.py +0 -0
  33. {SOLIDserverRest-2.3.11 → SOLIDserverRest-2.3.12}/tests/tests.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: SOLIDserverRest
3
- Version: 2.3.11
3
+ Version: 2.3.12
4
4
  Summary: The SOLIDserverRest is a library to drive EfficientIP API
5
5
  Home-page: https://gitlab.com/efficientip/solidserverrest
6
6
  Author: Gregory CUGAT / Alex Chauvin
@@ -14,13 +14,13 @@ Classifier: Programming Language :: Python :: 3.10
14
14
  Requires-Python: >=3.7
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
- Requires-Dist: requests~=2.31
18
- Requires-Dist: PySocks~=1.7
19
- Requires-Dist: urllib3~=1.26
20
- Requires-Dist: idna~=3.6
21
- Requires-Dist: chardet~=5.2
17
+ Requires-Dist: requests~=2.0
18
+ Requires-Dist: PySocks~=1.0
19
+ Requires-Dist: urllib3~=1.0
20
+ Requires-Dist: idna~=3.0
21
+ Requires-Dist: chardet~=5.0
22
22
  Requires-Dist: pyopenssl~=24.0
23
- Requires-Dist: packaging~=23.2
23
+ Requires-Dist: packaging~=23.0
24
24
 
25
25
  [![License](https://img.shields.io/badge/License-BSD%202--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)
26
26
 
@@ -154,3 +154,43 @@ Methods are organized to match the ontology used in SOLIDServer, you will find:
154
154
  * VLAN manager
155
155
 
156
156
  More information about supported methods in the [specific document](docs/METHODS.md)
157
+
158
+ # Tests
159
+
160
+ Last set of tests run on 19/Feb/2024 using:
161
+ * SOLIDserver release 8.3.2
162
+ * python libs:
163
+ * chardet 5.2.0
164
+ * urllib3 1.26.18
165
+ * idna 3.6
166
+ * requests 2.31.0
167
+ * PySocks 1.7.1
168
+ * pyOpenSSL 24.0.0
169
+ * packaging 23.2
170
+
171
+ ## coverage results
172
+ ```
173
+ ---------- coverage: platform win32, python 3.11.3-final-0 -----------
174
+ Name Stmts Miss Cover
175
+ ---------------------------------------------------------
176
+ SOLIDserverRest\Exception.py 25 4 84%
177
+ SOLIDserverRest\SOLIDserverRest.py 137 17 88%
178
+ SOLIDserverRest\__init__.py 5 0 100%
179
+ SOLIDserverRest\adv\__init__.py 13 0 100%
180
+ SOLIDserverRest\adv\base.py 117 12 90%
181
+ SOLIDserverRest\adv\class_params.py 82 3 96%
182
+ SOLIDserverRest\adv\device.py 87 72 17%
183
+ SOLIDserverRest\adv\device_tools.py 128 113 12%
184
+ SOLIDserverRest\adv\devif.py 122 99 19%
185
+ SOLIDserverRest\adv\dns.py 150 5 97%
186
+ SOLIDserverRest\adv\dns_record.py 336 105 69%
187
+ SOLIDserverRest\adv\dns_zone.py 124 15 88%
188
+ SOLIDserverRest\adv\ipaddress.py 128 0 100%
189
+ SOLIDserverRest\adv\network.py 185 1 99%
190
+ SOLIDserverRest\adv\sds.py 118 3 97%
191
+ SOLIDserverRest\adv\space.py 56 1 98%
192
+ SOLIDserverRest\adv\validators.py 28 6 79%
193
+ SOLIDserverRest\mapper.py 22 0 100%
194
+ ---------------------------------------------------------
195
+ TOTAL 1863 456 76%
196
+ ```
@@ -1,156 +1,172 @@
1
- Metadata-Version: 2.1
2
- Name: SOLIDserverRest
3
- Version: 2.3.11
4
- Summary: The SOLIDserverRest is a library to drive EfficientIP API
5
- Home-page: https://gitlab.com/efficientip/solidserverrest
6
- Author: Gregory CUGAT / Alex Chauvin
7
- Author-email: gregory.cugat@efficientip.com, ach@efficientip.com
8
- License: BSD 2
9
- Classifier: Intended Audience :: Developers
10
- Classifier: Programming Language :: Python :: 3.7
11
- Classifier: Programming Language :: Python :: 3.8
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
- Requires-Python: >=3.7
15
- Description-Content-Type: text/markdown
16
- License-File: LICENSE
17
- Requires-Dist: requests~=2.31
18
- Requires-Dist: PySocks~=1.7
19
- Requires-Dist: urllib3~=1.26
20
- Requires-Dist: idna~=3.6
21
- Requires-Dist: chardet~=5.2
22
- Requires-Dist: pyopenssl~=24.0
23
- Requires-Dist: packaging~=23.2
24
-
25
- [![License](https://img.shields.io/badge/License-BSD%202--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)
26
-
27
- [![pipeline status](https://gitlab.com/efficientip/solidserverrest/badges/master/pipeline.svg)](https://gitlab.com/efficientip/solidserverrest/commits/master)
28
-
29
- # SOLIDserverRest
30
-
31
- This 'SOLIDserverRest' allows to easily interact with [SOLIDserver](https://www.efficientip.com/products/solidserver/)'s REST API.
32
- It allows managing all IPAM objects through CRUD operations.
33
-
34
- * ***Free software***: BSD2 License
35
-
36
- This 'SOLIDserverRest' is compatible with [SOLIDserver](https://www.efficientip.com/products/solidserver/) version 7 and ownward.
37
-
38
- # Install
39
- Install 'SOLIDserverRest' using pip in your virtualenv:
40
-
41
- ```
42
- pip install SOLIDserverRest
43
- ```
44
-
45
- # Usage
46
-
47
- ## Using the SOLIDserverRest advanced object (recommended)
48
-
49
- All commands and object manipulation are going through a SOLIDserver main object, handling the connection to the manager and pushing API calls. The creation of a SOLIDserver object is done like that:
50
- ```
51
- from SOLIDserverRest import *
52
- from SOLIDserverRest import adv as sdsadv
53
-
54
- SDS_HOST = "192.168.254.254"
55
- SDS_LOGIN = "foo"
56
- SDS_PWD = "bar"
57
-
58
- sds = sdsadv.SDS(ip_address=SDS_HOST,
59
- user=SDS_LOGIN,
60
- pwd=SDS_PWD)
61
- try:
62
- sds.connect(method="native")
63
- except SDSError as e:
64
- logging.error(e)
65
- exit(1)
66
-
67
- print(adv)
68
-
69
- ```
70
-
71
- More examples in the example directory.
72
-
73
- ## Using the SOLIDserverRest object
74
-
75
- The raw API is mapped using the SOLIDserverRest object which handle the connection, prepare the formating and handle some errors. It can be usefull twhen the advanced library is not yet implementing an object that you require in your code.
76
-
77
- ### 1. Declare endpoint API point
78
- Set the API endpoint you want to talk with through API. Could use an IP address
79
- (v4 or v6) or a host name
80
- * host = IP address of the SOLIDserver server
81
- ```
82
- con = SOLIDserverRest("fqdn_host.org")
83
- ```
84
-
85
- ### 2. Specify connection method
86
- You can use native connection mode using SOLIDserver default method which provide
87
- authentication through headers in the requests with information
88
- encoded in base64
89
-
90
- * user = user who want to use
91
- * password = password of the user
92
-
93
- ```python
94
- con.use_native_sds(user="apiuser", password="apipwd")
95
- ```
96
-
97
- You can also use the basic authentication method for connecting the SOLIDserver.
98
-
99
- * user = user who want to use
100
- * password = password of the user
101
-
102
- ```python
103
- con.use_basicauth_sds(user="apiuser", password="apipwd")
104
- ```
105
-
106
- ### 3. Set TLS security
107
- SSL certificate chain is validated by default, to disable it, use the set_ssl_verify method
108
-
109
- ```python
110
- con.set_ssl_verify(False) # True by default
111
- rest_answer = con.query("method", "parameters")
112
- ```
113
-
114
- Otherwise, you have to provide the certificate file:
115
- ```python
116
- con = SOLIDserverRest(SERVER)
117
- ```
118
- If the certificate file is not valide, an exception ```SDSInitError``` is raised.
119
-
120
- ### 4. Request to SOLIDserver API
121
-
122
- You need parameters:
123
- * method = choose your method in the list below
124
- * parameters = Python dictionary with parameters you want to use
125
-
126
- ```python
127
- rest_answer = con.query("method", "parameters")
128
- ```
129
-
130
- ### 5. Analyze answer
131
-
132
- * rest_answer => object name
133
- * rest_answer.status_code => current http answer code set in the object
134
- * rest_answer.content => Answer core from SOLIDserver API set in the object
135
-
136
- Example:
137
- ```python
138
- print(rest_answer)
139
- print(rest_answer.status_code)
140
- print(rest_answer.content)
141
- ```
142
-
143
- # Methods that could be used
144
- Methods are organized to match the ontology used in SOLIDServer, you will find:
145
- * Sites - address spaces
146
- * Subnets (v4 and v6)
147
- * Pools (v4 and v6)
148
- * Addresses (v4 and v6)
149
- * Aliases (v4 and v6)
150
- * DNS servers, views, zones, RR, acl, key
151
- * application manager
152
- * DHCP server, scope, shared net, range, static, group
153
- * device manager
154
- * VLAN manager
155
-
156
- More information about supported methods in the [specific document](docs/METHODS.md)
1
+ [![License](https://img.shields.io/badge/License-BSD%202--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)
2
+
3
+ [![pipeline status](https://gitlab.com/efficientip/solidserverrest/badges/master/pipeline.svg)](https://gitlab.com/efficientip/solidserverrest/commits/master)
4
+
5
+ # SOLIDserverRest
6
+
7
+ This 'SOLIDserverRest' allows to easily interact with [SOLIDserver](https://www.efficientip.com/products/solidserver/)'s REST API.
8
+ It allows managing all IPAM objects through CRUD operations.
9
+
10
+ * ***Free software***: BSD2 License
11
+
12
+ This 'SOLIDserverRest' is compatible with [SOLIDserver](https://www.efficientip.com/products/solidserver/) version 7 and ownward.
13
+
14
+ # Install
15
+ Install 'SOLIDserverRest' using pip in your virtualenv:
16
+
17
+ ```
18
+ pip install SOLIDserverRest
19
+ ```
20
+
21
+ # Usage
22
+
23
+ ## Using the SOLIDserverRest advanced object (recommended)
24
+
25
+ All commands and object manipulation are going through a SOLIDserver main object, handling the connection to the manager and pushing API calls. The creation of a SOLIDserver object is done like that:
26
+ ```
27
+ from SOLIDserverRest import *
28
+ from SOLIDserverRest import adv as sdsadv
29
+
30
+ SDS_HOST = "192.168.254.254"
31
+ SDS_LOGIN = "foo"
32
+ SDS_PWD = "bar"
33
+
34
+ sds = sdsadv.SDS(ip_address=SDS_HOST,
35
+ user=SDS_LOGIN,
36
+ pwd=SDS_PWD)
37
+ try:
38
+ sds.connect(method="native")
39
+ except SDSError as e:
40
+ logging.error(e)
41
+ exit(1)
42
+
43
+ print(adv)
44
+
45
+ ```
46
+
47
+ More examples in the example directory.
48
+
49
+ ## Using the SOLIDserverRest object
50
+
51
+ The raw API is mapped using the SOLIDserverRest object which handle the connection, prepare the formating and handle some errors. It can be usefull twhen the advanced library is not yet implementing an object that you require in your code.
52
+
53
+ ### 1. Declare endpoint API point
54
+ Set the API endpoint you want to talk with through API. Could use an IP address
55
+ (v4 or v6) or a host name
56
+ * host = IP address of the SOLIDserver server
57
+ ```
58
+ con = SOLIDserverRest("fqdn_host.org")
59
+ ```
60
+
61
+ ### 2. Specify connection method
62
+ You can use native connection mode using SOLIDserver default method which provide
63
+ authentication through headers in the requests with information
64
+ encoded in base64
65
+
66
+ * user = user who want to use
67
+ * password = password of the user
68
+
69
+ ```python
70
+ con.use_native_sds(user="apiuser", password="apipwd")
71
+ ```
72
+
73
+ You can also use the basic authentication method for connecting the SOLIDserver.
74
+
75
+ * user = user who want to use
76
+ * password = password of the user
77
+
78
+ ```python
79
+ con.use_basicauth_sds(user="apiuser", password="apipwd")
80
+ ```
81
+
82
+ ### 3. Set TLS security
83
+ SSL certificate chain is validated by default, to disable it, use the set_ssl_verify method
84
+
85
+ ```python
86
+ con.set_ssl_verify(False) # True by default
87
+ rest_answer = con.query("method", "parameters")
88
+ ```
89
+
90
+ Otherwise, you have to provide the certificate file:
91
+ ```python
92
+ con = SOLIDserverRest(SERVER)
93
+ ```
94
+ If the certificate file is not valide, an exception ```SDSInitError``` is raised.
95
+
96
+ ### 4. Request to SOLIDserver API
97
+
98
+ You need parameters:
99
+ * method = choose your method in the list below
100
+ * parameters = Python dictionary with parameters you want to use
101
+
102
+ ```python
103
+ rest_answer = con.query("method", "parameters")
104
+ ```
105
+
106
+ ### 5. Analyze answer
107
+
108
+ * rest_answer => object name
109
+ * rest_answer.status_code => current http answer code set in the object
110
+ * rest_answer.content => Answer core from SOLIDserver API set in the object
111
+
112
+ Example:
113
+ ```python
114
+ print(rest_answer)
115
+ print(rest_answer.status_code)
116
+ print(rest_answer.content)
117
+ ```
118
+
119
+ # Methods that could be used
120
+ Methods are organized to match the ontology used in SOLIDServer, you will find:
121
+ * Sites - address spaces
122
+ * Subnets (v4 and v6)
123
+ * Pools (v4 and v6)
124
+ * Addresses (v4 and v6)
125
+ * Aliases (v4 and v6)
126
+ * DNS servers, views, zones, RR, acl, key
127
+ * application manager
128
+ * DHCP server, scope, shared net, range, static, group
129
+ * device manager
130
+ * VLAN manager
131
+
132
+ More information about supported methods in the [specific document](docs/METHODS.md)
133
+
134
+ # Tests
135
+
136
+ Last set of tests run on 19/Feb/2024 using:
137
+ * SOLIDserver release 8.3.2
138
+ * python libs:
139
+ * chardet 5.2.0
140
+ * urllib3 1.26.18
141
+ * idna 3.6
142
+ * requests 2.31.0
143
+ * PySocks 1.7.1
144
+ * pyOpenSSL 24.0.0
145
+ * packaging 23.2
146
+
147
+ ## coverage results
148
+ ```
149
+ ---------- coverage: platform win32, python 3.11.3-final-0 -----------
150
+ Name Stmts Miss Cover
151
+ ---------------------------------------------------------
152
+ SOLIDserverRest\Exception.py 25 4 84%
153
+ SOLIDserverRest\SOLIDserverRest.py 137 17 88%
154
+ SOLIDserverRest\__init__.py 5 0 100%
155
+ SOLIDserverRest\adv\__init__.py 13 0 100%
156
+ SOLIDserverRest\adv\base.py 117 12 90%
157
+ SOLIDserverRest\adv\class_params.py 82 3 96%
158
+ SOLIDserverRest\adv\device.py 87 72 17%
159
+ SOLIDserverRest\adv\device_tools.py 128 113 12%
160
+ SOLIDserverRest\adv\devif.py 122 99 19%
161
+ SOLIDserverRest\adv\dns.py 150 5 97%
162
+ SOLIDserverRest\adv\dns_record.py 336 105 69%
163
+ SOLIDserverRest\adv\dns_zone.py 124 15 88%
164
+ SOLIDserverRest\adv\ipaddress.py 128 0 100%
165
+ SOLIDserverRest\adv\network.py 185 1 99%
166
+ SOLIDserverRest\adv\sds.py 118 3 97%
167
+ SOLIDserverRest\adv\space.py 56 1 98%
168
+ SOLIDserverRest\adv\validators.py 28 6 79%
169
+ SOLIDserverRest\mapper.py 22 0 100%
170
+ ---------------------------------------------------------
171
+ TOTAL 1863 456 76%
172
+ ```
@@ -11,6 +11,7 @@ SOLIDserver management server access
11
11
  import logging
12
12
  import ipaddress
13
13
  import socket
14
+ import json
14
15
 
15
16
  from json.decoder import JSONDecodeError
16
17
 
@@ -234,6 +235,16 @@ class SDS(ClassParams):
234
235
  j = answer_req.json()
235
236
  return j
236
237
  except JSONDecodeError: # pragma: no cover
238
+ logging.warning(
239
+ "no json in return, trying array and returns first entry")
240
+
241
+ try:
242
+ j = json.loads(f'[{answer_req.content.decode()}]')
243
+ if isinstance(j, list):
244
+ return j[0]
245
+ except Error:
246
+ pass
247
+
237
248
  logging.error("no json in return")
238
249
  return None
239
250
 
@@ -1,132 +1,196 @@
1
- [![License](https://img.shields.io/badge/License-BSD%202--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)
2
-
3
- [![pipeline status](https://gitlab.com/efficientip/solidserverrest/badges/master/pipeline.svg)](https://gitlab.com/efficientip/solidserverrest/commits/master)
4
-
5
- # SOLIDserverRest
6
-
7
- This 'SOLIDserverRest' allows to easily interact with [SOLIDserver](https://www.efficientip.com/products/solidserver/)'s REST API.
8
- It allows managing all IPAM objects through CRUD operations.
9
-
10
- * ***Free software***: BSD2 License
11
-
12
- This 'SOLIDserverRest' is compatible with [SOLIDserver](https://www.efficientip.com/products/solidserver/) version 7 and ownward.
13
-
14
- # Install
15
- Install 'SOLIDserverRest' using pip in your virtualenv:
16
-
17
- ```
18
- pip install SOLIDserverRest
19
- ```
20
-
21
- # Usage
22
-
23
- ## Using the SOLIDserverRest advanced object (recommended)
24
-
25
- All commands and object manipulation are going through a SOLIDserver main object, handling the connection to the manager and pushing API calls. The creation of a SOLIDserver object is done like that:
26
- ```
27
- from SOLIDserverRest import *
28
- from SOLIDserverRest import adv as sdsadv
29
-
30
- SDS_HOST = "192.168.254.254"
31
- SDS_LOGIN = "foo"
32
- SDS_PWD = "bar"
33
-
34
- sds = sdsadv.SDS(ip_address=SDS_HOST,
35
- user=SDS_LOGIN,
36
- pwd=SDS_PWD)
37
- try:
38
- sds.connect(method="native")
39
- except SDSError as e:
40
- logging.error(e)
41
- exit(1)
42
-
43
- print(adv)
44
-
45
- ```
46
-
47
- More examples in the example directory.
48
-
49
- ## Using the SOLIDserverRest object
50
-
51
- The raw API is mapped using the SOLIDserverRest object which handle the connection, prepare the formating and handle some errors. It can be usefull twhen the advanced library is not yet implementing an object that you require in your code.
52
-
53
- ### 1. Declare endpoint API point
54
- Set the API endpoint you want to talk with through API. Could use an IP address
55
- (v4 or v6) or a host name
56
- * host = IP address of the SOLIDserver server
57
- ```
58
- con = SOLIDserverRest("fqdn_host.org")
59
- ```
60
-
61
- ### 2. Specify connection method
62
- You can use native connection mode using SOLIDserver default method which provide
63
- authentication through headers in the requests with information
64
- encoded in base64
65
-
66
- * user = user who want to use
67
- * password = password of the user
68
-
69
- ```python
70
- con.use_native_sds(user="apiuser", password="apipwd")
71
- ```
72
-
73
- You can also use the basic authentication method for connecting the SOLIDserver.
74
-
75
- * user = user who want to use
76
- * password = password of the user
77
-
78
- ```python
79
- con.use_basicauth_sds(user="apiuser", password="apipwd")
80
- ```
81
-
82
- ### 3. Set TLS security
83
- SSL certificate chain is validated by default, to disable it, use the set_ssl_verify method
84
-
85
- ```python
86
- con.set_ssl_verify(False) # True by default
87
- rest_answer = con.query("method", "parameters")
88
- ```
89
-
90
- Otherwise, you have to provide the certificate file:
91
- ```python
92
- con = SOLIDserverRest(SERVER)
93
- ```
94
- If the certificate file is not valide, an exception ```SDSInitError``` is raised.
95
-
96
- ### 4. Request to SOLIDserver API
97
-
98
- You need parameters:
99
- * method = choose your method in the list below
100
- * parameters = Python dictionary with parameters you want to use
101
-
102
- ```python
103
- rest_answer = con.query("method", "parameters")
104
- ```
105
-
106
- ### 5. Analyze answer
107
-
108
- * rest_answer => object name
109
- * rest_answer.status_code => current http answer code set in the object
110
- * rest_answer.content => Answer core from SOLIDserver API set in the object
111
-
112
- Example:
113
- ```python
114
- print(rest_answer)
115
- print(rest_answer.status_code)
116
- print(rest_answer.content)
117
- ```
118
-
119
- # Methods that could be used
120
- Methods are organized to match the ontology used in SOLIDServer, you will find:
121
- * Sites - address spaces
122
- * Subnets (v4 and v6)
123
- * Pools (v4 and v6)
124
- * Addresses (v4 and v6)
125
- * Aliases (v4 and v6)
126
- * DNS servers, views, zones, RR, acl, key
127
- * application manager
128
- * DHCP server, scope, shared net, range, static, group
129
- * device manager
130
- * VLAN manager
131
-
132
- More information about supported methods in the [specific document](docs/METHODS.md)
1
+ Metadata-Version: 2.1
2
+ Name: SOLIDserverRest
3
+ Version: 2.3.12
4
+ Summary: The SOLIDserverRest is a library to drive EfficientIP API
5
+ Home-page: https://gitlab.com/efficientip/solidserverrest
6
+ Author: Gregory CUGAT / Alex Chauvin
7
+ Author-email: gregory.cugat@efficientip.com, ach@efficientip.com
8
+ License: BSD 2
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3.7
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Requires-Python: >=3.7
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: requests~=2.0
18
+ Requires-Dist: PySocks~=1.0
19
+ Requires-Dist: urllib3~=1.0
20
+ Requires-Dist: idna~=3.0
21
+ Requires-Dist: chardet~=5.0
22
+ Requires-Dist: pyopenssl~=24.0
23
+ Requires-Dist: packaging~=23.0
24
+
25
+ [![License](https://img.shields.io/badge/License-BSD%202--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)
26
+
27
+ [![pipeline status](https://gitlab.com/efficientip/solidserverrest/badges/master/pipeline.svg)](https://gitlab.com/efficientip/solidserverrest/commits/master)
28
+
29
+ # SOLIDserverRest
30
+
31
+ This 'SOLIDserverRest' allows to easily interact with [SOLIDserver](https://www.efficientip.com/products/solidserver/)'s REST API.
32
+ It allows managing all IPAM objects through CRUD operations.
33
+
34
+ * ***Free software***: BSD2 License
35
+
36
+ This 'SOLIDserverRest' is compatible with [SOLIDserver](https://www.efficientip.com/products/solidserver/) version 7 and ownward.
37
+
38
+ # Install
39
+ Install 'SOLIDserverRest' using pip in your virtualenv:
40
+
41
+ ```
42
+ pip install SOLIDserverRest
43
+ ```
44
+
45
+ # Usage
46
+
47
+ ## Using the SOLIDserverRest advanced object (recommended)
48
+
49
+ All commands and object manipulation are going through a SOLIDserver main object, handling the connection to the manager and pushing API calls. The creation of a SOLIDserver object is done like that:
50
+ ```
51
+ from SOLIDserverRest import *
52
+ from SOLIDserverRest import adv as sdsadv
53
+
54
+ SDS_HOST = "192.168.254.254"
55
+ SDS_LOGIN = "foo"
56
+ SDS_PWD = "bar"
57
+
58
+ sds = sdsadv.SDS(ip_address=SDS_HOST,
59
+ user=SDS_LOGIN,
60
+ pwd=SDS_PWD)
61
+ try:
62
+ sds.connect(method="native")
63
+ except SDSError as e:
64
+ logging.error(e)
65
+ exit(1)
66
+
67
+ print(adv)
68
+
69
+ ```
70
+
71
+ More examples in the example directory.
72
+
73
+ ## Using the SOLIDserverRest object
74
+
75
+ The raw API is mapped using the SOLIDserverRest object which handle the connection, prepare the formating and handle some errors. It can be usefull twhen the advanced library is not yet implementing an object that you require in your code.
76
+
77
+ ### 1. Declare endpoint API point
78
+ Set the API endpoint you want to talk with through API. Could use an IP address
79
+ (v4 or v6) or a host name
80
+ * host = IP address of the SOLIDserver server
81
+ ```
82
+ con = SOLIDserverRest("fqdn_host.org")
83
+ ```
84
+
85
+ ### 2. Specify connection method
86
+ You can use native connection mode using SOLIDserver default method which provide
87
+ authentication through headers in the requests with information
88
+ encoded in base64
89
+
90
+ * user = user who want to use
91
+ * password = password of the user
92
+
93
+ ```python
94
+ con.use_native_sds(user="apiuser", password="apipwd")
95
+ ```
96
+
97
+ You can also use the basic authentication method for connecting the SOLIDserver.
98
+
99
+ * user = user who want to use
100
+ * password = password of the user
101
+
102
+ ```python
103
+ con.use_basicauth_sds(user="apiuser", password="apipwd")
104
+ ```
105
+
106
+ ### 3. Set TLS security
107
+ SSL certificate chain is validated by default, to disable it, use the set_ssl_verify method
108
+
109
+ ```python
110
+ con.set_ssl_verify(False) # True by default
111
+ rest_answer = con.query("method", "parameters")
112
+ ```
113
+
114
+ Otherwise, you have to provide the certificate file:
115
+ ```python
116
+ con = SOLIDserverRest(SERVER)
117
+ ```
118
+ If the certificate file is not valide, an exception ```SDSInitError``` is raised.
119
+
120
+ ### 4. Request to SOLIDserver API
121
+
122
+ You need parameters:
123
+ * method = choose your method in the list below
124
+ * parameters = Python dictionary with parameters you want to use
125
+
126
+ ```python
127
+ rest_answer = con.query("method", "parameters")
128
+ ```
129
+
130
+ ### 5. Analyze answer
131
+
132
+ * rest_answer => object name
133
+ * rest_answer.status_code => current http answer code set in the object
134
+ * rest_answer.content => Answer core from SOLIDserver API set in the object
135
+
136
+ Example:
137
+ ```python
138
+ print(rest_answer)
139
+ print(rest_answer.status_code)
140
+ print(rest_answer.content)
141
+ ```
142
+
143
+ # Methods that could be used
144
+ Methods are organized to match the ontology used in SOLIDServer, you will find:
145
+ * Sites - address spaces
146
+ * Subnets (v4 and v6)
147
+ * Pools (v4 and v6)
148
+ * Addresses (v4 and v6)
149
+ * Aliases (v4 and v6)
150
+ * DNS servers, views, zones, RR, acl, key
151
+ * application manager
152
+ * DHCP server, scope, shared net, range, static, group
153
+ * device manager
154
+ * VLAN manager
155
+
156
+ More information about supported methods in the [specific document](docs/METHODS.md)
157
+
158
+ # Tests
159
+
160
+ Last set of tests run on 19/Feb/2024 using:
161
+ * SOLIDserver release 8.3.2
162
+ * python libs:
163
+ * chardet 5.2.0
164
+ * urllib3 1.26.18
165
+ * idna 3.6
166
+ * requests 2.31.0
167
+ * PySocks 1.7.1
168
+ * pyOpenSSL 24.0.0
169
+ * packaging 23.2
170
+
171
+ ## coverage results
172
+ ```
173
+ ---------- coverage: platform win32, python 3.11.3-final-0 -----------
174
+ Name Stmts Miss Cover
175
+ ---------------------------------------------------------
176
+ SOLIDserverRest\Exception.py 25 4 84%
177
+ SOLIDserverRest\SOLIDserverRest.py 137 17 88%
178
+ SOLIDserverRest\__init__.py 5 0 100%
179
+ SOLIDserverRest\adv\__init__.py 13 0 100%
180
+ SOLIDserverRest\adv\base.py 117 12 90%
181
+ SOLIDserverRest\adv\class_params.py 82 3 96%
182
+ SOLIDserverRest\adv\device.py 87 72 17%
183
+ SOLIDserverRest\adv\device_tools.py 128 113 12%
184
+ SOLIDserverRest\adv\devif.py 122 99 19%
185
+ SOLIDserverRest\adv\dns.py 150 5 97%
186
+ SOLIDserverRest\adv\dns_record.py 336 105 69%
187
+ SOLIDserverRest\adv\dns_zone.py 124 15 88%
188
+ SOLIDserverRest\adv\ipaddress.py 128 0 100%
189
+ SOLIDserverRest\adv\network.py 185 1 99%
190
+ SOLIDserverRest\adv\sds.py 118 3 97%
191
+ SOLIDserverRest\adv\space.py 56 1 98%
192
+ SOLIDserverRest\adv\validators.py 28 6 79%
193
+ SOLIDserverRest\mapper.py 22 0 100%
194
+ ---------------------------------------------------------
195
+ TOTAL 1863 456 76%
196
+ ```
@@ -0,0 +1,7 @@
1
+ requests~=2.0
2
+ PySocks~=1.0
3
+ urllib3~=1.0
4
+ idna~=3.0
5
+ chardet~=5.0
6
+ pyopenssl~=24.0
7
+ packaging~=23.0
@@ -10,7 +10,7 @@ with open(os.path.join(here, 'README.md')) as f:
10
10
 
11
11
  setup(
12
12
  name='SOLIDserverRest',
13
- version='2.3.11',
13
+ version='2.3.12',
14
14
  author='Gregory CUGAT / Alex Chauvin',
15
15
  url='https://gitlab.com/efficientip/solidserverrest',
16
16
  description='The SOLIDserverRest is a library to drive EfficientIP API',
@@ -24,13 +24,13 @@ setup(
24
24
  'Programming Language :: Python :: 3.9',
25
25
  'Programming Language :: Python :: 3.10',
26
26
  ],
27
- install_requires=['requests~=2.31',
28
- 'PySocks~=1.7',
29
- 'urllib3~=1.26',
30
- 'idna~=3.6',
31
- 'chardet~=5.2',
27
+ install_requires=['requests~=2.0',
28
+ 'PySocks~=1.0',
29
+ 'urllib3~=1.0',
30
+ 'idna~=3.0',
31
+ 'chardet~=5.0',
32
32
  'pyopenssl~=24.0',
33
- 'packaging~=23.2'],
33
+ 'packaging~=23.0'],
34
34
  license='BSD 2',
35
35
  packages=['SOLIDserverRest', 'SOLIDserverRest.adv'],
36
36
  zip_safe=False,
@@ -1,7 +0,0 @@
1
- requests~=2.31
2
- PySocks~=1.7
3
- urllib3~=1.26
4
- idna~=3.6
5
- chardet~=5.2
6
- pyopenssl~=24.0
7
- packaging~=23.2