@itentialopensource/adapter-netbox_v33 2.1.5 → 2.1.7

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.
package/CALLS.md CHANGED
@@ -3407,7 +3407,7 @@ Specific adapter calls are built based on the API of the Netbox_v33. The Adapter
3407
3407
  <td style="padding:15px">Yes</td>
3408
3408
  </tr>
3409
3409
  <tr>
3410
- <td style="padding:15px">deleteIpamIpAddresses(callback)</td>
3410
+ <td style="padding:15px">deleteIpamIpAddresses(data, callback)</td>
3411
3411
  <td style="padding:15px">ipam_ip-addresses_bulk_delete</td>
3412
3412
  <td style="padding:15px">{base_path}/{version}/ipam/ip-addresses/?{query}</td>
3413
3413
  <td style="padding:15px">Yes</td>
package/CHANGELOG.md CHANGED
@@ -1,4 +1,20 @@
1
1
 
2
+ ## 2.1.7 [05-01-2024]
3
+
4
+ * Patch/adapt 3335
5
+
6
+ See merge request itentialopensource/adapters/inventory/adapter-netbox_v33!11
7
+
8
+ ---
9
+
10
+ ## 2.1.6 [03-26-2024]
11
+
12
+ * Changes made at 2024.03.26_14:41PM
13
+
14
+ See merge request itentialopensource/adapters/inventory/adapter-netbox_v33!10
15
+
16
+ ---
17
+
2
18
  ## 2.1.5 [03-20-2024]
3
19
 
4
20
  * Fix field schemas
package/TAB1.md ADDED
@@ -0,0 +1,5 @@
1
+ # Overview
2
+
3
+ This adapter is used to integrate the Itential Automation Platform (IAP) with the Netbox_v33 System. The API that was used to build the adapter for Netbox_v33 is usually available in the report directory of this adapter. The adapter utilizes the Netbox_v33 API to provide the integrations that are deemed pertinent to IAP. The ReadMe file is intended to provide information on this adapter it is generated from various other Markdown files.
4
+
5
+ For further technical details on how to install and use this adapter, please click the Technical Documentation tab.
package/TAB2.md ADDED
@@ -0,0 +1,309 @@
1
+ # Netbox_v33
2
+
3
+ ## Table of Contents
4
+
5
+ - [Specific Adapter Information](#specific-adapter-information)
6
+ - [Authentication](#authentication)
7
+ - [Sample Properties](#sample-properties)
8
+ - [Swagger](#swagger)
9
+ - [Generic Adapter Information](#generic-adapter-information)
10
+
11
+ ## Specific Adapter Information
12
+ ### Authentication
13
+
14
+ This document will go through the steps for authenticating the Netbox_v33 adapter with Basic Authentication. Properly configuring the properties for an adapter in IAP is critical for getting the adapter online. You can read more about adapter authentication <a href="https://www.itential.com/automation-platform/integrations/adapters-resources/authentication/" target="_blank">HERE</a>.
15
+
16
+ #### Basic Authentication
17
+ The Netbox_v33 adapter requires Basic Authentication. If you change authentication methods, you should change this section accordingly and merge it back into the adapter repository.
18
+
19
+ STEPS
20
+ 1. Ensure you have access to a Netbox_v33 server and that it is running
21
+ 2. Follow the steps in the README.md to import the adapter into IAP if you have not already done so
22
+ 3. Use the properties below for the ```properties.authentication``` field
23
+ ```json
24
+ "authentication": {
25
+ "auth_method": "basic user_password",
26
+ "username": "<username>",
27
+ "password": "<password>",
28
+ "token": "",
29
+ "token_timeout": 1800000,
30
+ "token_cache": "local",
31
+ "invalid_token_error": 401,
32
+ "auth_field": "header.headers.Authorization",
33
+ "auth_field_format": "Basic {b64}{username}:{password}{/b64}",
34
+ "auth_logging": false,
35
+ "client_id": "",
36
+ "client_secret": "",
37
+ "grant_type": ""
38
+ }
39
+ ```
40
+ 4. Restart the adapter. If your properties were set correctly, the adapter should go online.
41
+
42
+ #### Troubleshooting
43
+ - Make sure you copied over the correct username and password.
44
+ - Turn on debug level logs for the adapter in IAP Admin Essentials.
45
+ - Turn on auth_logging for the adapter in IAP Admin Essentials (adapter properties).
46
+ - Investigate the logs - in particular:
47
+ - The FULL REQUEST log to make sure the proper headers are being sent with the request.
48
+ - The FULL BODY log to make sure the payload is accurate.
49
+ - The CALL RETURN log to see what the other system is telling us.
50
+ - Remember when you are done to turn auth_logging off as you do not want to log credentials.
51
+
52
+ ### Sample Properties
53
+
54
+ Sample Properties can be used to help you configure the adapter in the Itential Automation Platform. You will need to update connectivity information such as the host, port, protocol and credentials.
55
+
56
+ ```json
57
+ "properties": {
58
+ "host": "netbox.core-services.test.leaseplan.systems",
59
+ "port": 443,
60
+ "choosepath": "",
61
+ "base_path": "/api",
62
+ "version": "",
63
+ "cache_location": "none",
64
+ "encode_pathvars": true,
65
+ "encode_queryvars": true,
66
+ "save_metric": false,
67
+ "stub": true,
68
+ "protocol": "https",
69
+ "authentication": {
70
+ "auth_method": "no_authentication",
71
+ "username": "username",
72
+ "password": "password",
73
+ "token": "token",
74
+ "token_timeout": 600000,
75
+ "token_cache": "local",
76
+ "invalid_token_error": 401,
77
+ "auth_field": "header.headers.Authorization",
78
+ "auth_field_format": "Basic {b64}{username}:{password}{/b64}",
79
+ "auth_logging": false,
80
+ "client_id": "",
81
+ "client_secret": "",
82
+ "grant_type": "",
83
+ "sensitive": [],
84
+ "sso": {
85
+ "protocol": "",
86
+ "host": "",
87
+ "port": 0
88
+ },
89
+ "multiStepAuthCalls": [
90
+ {
91
+ "name": "",
92
+ "requestFields": {},
93
+ "responseFields": {},
94
+ "successfullResponseCode": 200
95
+ }
96
+ ]
97
+ },
98
+ "healthcheck": {
99
+ "type": "none",
100
+ "frequency": 60000,
101
+ "query_object": {},
102
+ "addlHeaders": {}
103
+ },
104
+ "throttle": {
105
+ "throttle_enabled": false,
106
+ "number_pronghorns": 1,
107
+ "sync_async": "sync",
108
+ "max_in_queue": 1000,
109
+ "concurrent_max": 1,
110
+ "expire_timeout": 0,
111
+ "avg_runtime": 200,
112
+ "priorities": [
113
+ {
114
+ "value": 0,
115
+ "percent": 100
116
+ }
117
+ ]
118
+ },
119
+ "request": {
120
+ "number_redirects": 0,
121
+ "number_retries": 3,
122
+ "limit_retry_error": [
123
+ 0
124
+ ],
125
+ "failover_codes": [],
126
+ "attempt_timeout": 5000,
127
+ "global_request": {
128
+ "payload": {},
129
+ "uriOptions": {},
130
+ "addlHeaders": {},
131
+ "authData": {}
132
+ },
133
+ "healthcheck_on_timeout": true,
134
+ "return_raw": false,
135
+ "archiving": false,
136
+ "return_request": false
137
+ },
138
+ "proxy": {
139
+ "enabled": false,
140
+ "host": "",
141
+ "port": 1,
142
+ "protocol": "http",
143
+ "username": "",
144
+ "password": ""
145
+ },
146
+ "ssl": {
147
+ "ecdhCurve": "",
148
+ "enabled": false,
149
+ "accept_invalid_cert": false,
150
+ "ca_file": "",
151
+ "key_file": "",
152
+ "cert_file": "",
153
+ "secure_protocol": "",
154
+ "ciphers": ""
155
+ },
156
+ "mongo": {
157
+ "host": "",
158
+ "port": 0,
159
+ "database": "",
160
+ "username": "",
161
+ "password": "",
162
+ "replSet": "",
163
+ "db_ssl": {
164
+ "enabled": false,
165
+ "accept_invalid_cert": false,
166
+ "ca_file": "",
167
+ "key_file": "",
168
+ "cert_file": ""
169
+ }
170
+ },
171
+ "devicebroker": {
172
+ "getDevice": [
173
+ {
174
+ "path": "/get/devices/{id}",
175
+ "method": "GET",
176
+ "query": {},
177
+ "body": {},
178
+ "headers": {},
179
+ "handleFailure": "ignore",
180
+ "requestFields": {
181
+ "id": "name"
182
+ },
183
+ "responseDatakey": "",
184
+ "responseFields": {
185
+ "name": "host",
186
+ "ostype": "os",
187
+ "ostypePrefix": "system-",
188
+ "ipaddress": "attributes.ipaddr",
189
+ "port": "443"
190
+ }
191
+ }
192
+ ],
193
+ "getDevicesFiltered": [
194
+ {
195
+ "path": "/get/devices",
196
+ "method": "GET",
197
+ "pagination": {
198
+ "offsetVar": "",
199
+ "limitVar": "",
200
+ "incrementBy": "limit",
201
+ "requestLocation": "query"
202
+ },
203
+ "query": {},
204
+ "body": {},
205
+ "headers": {},
206
+ "handleFailure": "ignore",
207
+ "requestFields": {},
208
+ "responseDatakey": "",
209
+ "responseFields": {
210
+ "name": "host",
211
+ "ostype": "os",
212
+ "ostypePrefix": "system-",
213
+ "ipaddress": "attributes.ipaddr",
214
+ "port": "443"
215
+ }
216
+ }
217
+ ],
218
+ "isAlive": [
219
+ {
220
+ "path": "/get/devices/{id}/status",
221
+ "method": "GET",
222
+ "query": {},
223
+ "body": {},
224
+ "headers": {},
225
+ "handleFailure": "ignore",
226
+ "requestFields": {
227
+ "id": "name"
228
+ },
229
+ "responseDatakey": "",
230
+ "responseFields": {
231
+ "status": "status",
232
+ "statusValue": "online"
233
+ }
234
+ }
235
+ ],
236
+ "getConfig": [
237
+ {
238
+ "path": "/get/devices/{id}/configPart1",
239
+ "method": "GET",
240
+ "query": {},
241
+ "body": {},
242
+ "headers": {},
243
+ "handleFailure": "ignore",
244
+ "requestFields": {
245
+ "id": "name"
246
+ },
247
+ "responseDatakey": "",
248
+ "responseFields": {}
249
+ }
250
+ ],
251
+ "getCount": [
252
+ {
253
+ "path": "/get/devices",
254
+ "method": "GET",
255
+ "query": {},
256
+ "body": {},
257
+ "headers": {},
258
+ "handleFailure": "ignore",
259
+ "requestFields": {},
260
+ "responseDatakey": "",
261
+ "responseFields": {}
262
+ }
263
+ ]
264
+ },
265
+ "cache": {
266
+ "enabled": false,
267
+ "entities": [
268
+ {
269
+ "entityType": "",
270
+ "frequency": 1440,
271
+ "flushOnFail": false,
272
+ "limit": 1000,
273
+ "retryAttempts": 5,
274
+ "sort": true,
275
+ "populate": [
276
+ {
277
+ "path": "",
278
+ "method": "GET",
279
+ "pagination": {
280
+ "offsetVar": "",
281
+ "limitVar": "",
282
+ "incrementBy": "limit",
283
+ "requestLocation": "query"
284
+ },
285
+ "query": {},
286
+ "body": {},
287
+ "headers": {},
288
+ "handleFailure": "ignore",
289
+ "requestFields": {},
290
+ "responseDatakey": "",
291
+ "responseFields": {}
292
+ }
293
+ ],
294
+ "cachedTasks": [
295
+ {
296
+ "name": "",
297
+ "filterField": "",
298
+ "filterLoc": ""
299
+ }
300
+ ]
301
+ }
302
+ ]
303
+ }
304
+ }
305
+ ```
306
+ ### [Swagger](https://gitlab.com/itentialopensource/adapters/inventory/adapter-netbox_v33/-/blob/master/report/adapter-openapi.json)
307
+
308
+ ## [Generic Adapter Information](https://gitlab.com/itentialopensource/adapters/inventory/adapter-netbox_v33/-/blob/master/README.md)
309
+
package/adapter.js CHANGED
@@ -49071,6 +49071,7 @@ via a protocol such as LLDP. Two query parameters must be included in the reques
49071
49071
  * @name deleteIpamIpAddresses
49072
49072
  * @summary ipam_ip-addresses_bulk_delete
49073
49073
  *
49074
+ * @param {Array} data - data param
49074
49075
  * @param {getCallback} callback - a callback function to return the result
49075
49076
  * @return {object} results - An object containing the response of the action
49076
49077
  *
@@ -49079,7 +49080,7 @@ via a protocol such as LLDP. Two query parameters must be included in the reques
49079
49080
  * @task true
49080
49081
  */
49081
49082
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
49082
- deleteIpamIpAddresses(callback) {
49083
+ deleteIpamIpAddresses(data, callback) {
49083
49084
  const meth = 'adapter-deleteIpamIpAddresses';
49084
49085
  const origin = `${this.id}-${meth}`;
49085
49086
  log.trace(origin);
@@ -49091,12 +49092,17 @@ via a protocol such as LLDP. Two query parameters must be included in the reques
49091
49092
  }
49092
49093
 
49093
49094
  /* HERE IS WHERE YOU VALIDATE DATA */
49095
+ if (data === undefined || data === null || data === '') {
49096
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['data'], null, null, null);
49097
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
49098
+ return callback(null, errorObj);
49099
+ }
49094
49100
 
49095
49101
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
49096
49102
  const queryParamsAvailable = {};
49097
49103
  const queryParams = {};
49098
49104
  const pathVars = [];
49099
- const bodyVars = {};
49105
+ const bodyVars = data;
49100
49106
 
49101
49107
  // loop in template. long callback arg name to avoid identifier conflicts
49102
49108
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-netbox_v33",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "description": "This adapter integrates with system described as: Netbox v3.3",
5
5
  "main": "adapter.js",
6
6
  "wizardVersion": "2.44.7",
@@ -53,10 +53,10 @@
53
53
  "author": "Itential",
54
54
  "homepage": "https://gitlab.com/itentialopensource/adapters/inventory/adapter-netbox_v33#readme",
55
55
  "dependencies": {
56
- "@itentialopensource/adapter-utils": "^5.3.8",
56
+ "@itentialopensource/adapter-utils": "^5.3.10",
57
57
  "acorn": "^8.10.0",
58
58
  "ajv": "^8.12.0",
59
- "axios": "^1.6.7",
59
+ "axios": "^1.6.8",
60
60
  "commander": "^11.0.0",
61
61
  "dns-lookup-promise": "^1.0.4",
62
62
  "fs-extra": "^11.1.1",
package/pronghorn.json CHANGED
@@ -121709,7 +121709,19 @@
121709
121709
  "name": "deleteIpamIpAddresses",
121710
121710
  "summary": "ipam_ip-addresses_bulk_delete",
121711
121711
  "description": "ipam_ip-addresses_bulk_delete",
121712
- "input": [],
121712
+ "input": [
121713
+ {
121714
+ "name": "data",
121715
+ "type": "array",
121716
+ "info": "List of IP Objects",
121717
+ "required": true,
121718
+ "schema": {
121719
+ "required": [
121720
+ ],
121721
+ "type": "object"
121722
+ }
121723
+ }
121724
+ ],
121713
121725
  "output": {
121714
121726
  "name": "result",
121715
121727
  "type": "object",
Binary file
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "2.0.0",
3
- "configLines": 185559,
2
+ "version": "2.1.6",
3
+ "configLines": 185571,
4
4
  "scriptLines": 1783,
5
- "codeLines": 79698,
5
+ "codeLines": 79704,
6
6
  "testLines": 52921,
7
7
  "testCases": 2758,
8
- "totalCodeLines": 134402,
8
+ "totalCodeLines": 134408,
9
9
  "wfTasks": 896
10
10
  }
@@ -22109,7 +22109,7 @@ describe('[integration] Netbox_v33 Adapter Test', () => {
22109
22109
  describe('#deleteIpamIpAddresses - errors', () => {
22110
22110
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
22111
22111
  try {
22112
- a.deleteIpamIpAddresses((data, error) => {
22112
+ a.deleteIpamIpAddresses([], (data, error) => {
22113
22113
  try {
22114
22114
  if (stub) {
22115
22115
  const displayE = 'Error 400 received on request';
@@ -316,7 +316,7 @@ describe('[unit] Netbox_v33 Adapter Test', () => {
316
316
  assert.notEqual(null, packageDotJson.dependencies);
317
317
  assert.notEqual('', packageDotJson.dependencies);
318
318
  assert.equal('^8.12.0', packageDotJson.dependencies.ajv);
319
- assert.equal('^1.6.7', packageDotJson.dependencies.axios);
319
+ assert.equal('^1.6.8', packageDotJson.dependencies.axios);
320
320
  assert.equal('^11.0.0', packageDotJson.dependencies.commander);
321
321
  assert.equal('^11.1.1', packageDotJson.dependencies['fs-extra']);
322
322
  assert.equal('^10.3.0', packageDotJson.dependencies.mocha);