@itentialopensource/adapter-thingspace 0.2.3 → 0.3.0

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/TAB2.md ADDED
@@ -0,0 +1,373 @@
1
+ # Thingspace
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 Thingspace adapter with Multi Factor/Step 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
+ #### Multi Step Authentication
17
+ The Thingspace adapter requires Multi Step 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 Thingspace 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": "multi_step_authentication",
26
+ "multiStepAuthCalls": [
27
+ {
28
+ "name": "getAccessToken",
29
+ "requestFields": {
30
+ "grant_type": "client_credentials",
31
+ "header.Authorization": "Basic <token>"
32
+ },
33
+ "responseFields": {
34
+ "accessToken": "access_token"
35
+ },
36
+ "successfullResponseCode": 200
37
+ },
38
+ {
39
+ "name": "getSessionToken",
40
+ "requestFields": {
41
+ "header.Authorization": "Bearer {getAccessToken.responseFields.accessToken}",
42
+ "username": "<username>",
43
+ "password": "<password>"
44
+ },
45
+ "responseFields": {
46
+ "token": "sessionToken"
47
+ },
48
+ "successfullResponseCode": 200
49
+ }
50
+ ],
51
+ "token_timeout": 600000,
52
+ "token_cache": "local",
53
+ "invalid_token_error": 401,
54
+ "auth_field": [
55
+ "header.headers.VZ-M2M-Token",
56
+ "header.headers.Authorization"
57
+ ],
58
+ "auth_field_format": [
59
+ "{token}",
60
+ "Bearer {getAccessToken.responseFields.accessToken}"
61
+ ],
62
+ "auth_logging": false,
63
+ "client_id": "",
64
+ "client_secret": "",
65
+ "grant_type": ""
66
+ }
67
+ ```
68
+ 4. Restart the adapter. If your properties were set correctly, the adapter should go online.
69
+
70
+ #### Troubleshooting
71
+ - Make sure you copied over the correct username and password.
72
+ - Turn on debug level logs for the adapter in IAP Admin Essentials.
73
+ - Turn on auth_logging for the adapter in IAP Admin Essentials (adapter properties).
74
+ - Investigate the logs - in particular:
75
+ - The FULL REQUEST log to make sure the proper headers are being sent with the request.
76
+ - The FULL BODY log to make sure the payload is accurate.
77
+ - The CALL RETURN log to see what the other system is telling us.
78
+ - Credentials should be ** masked ** by the adapter so make sure you verify the username and password - including that there are erroneous spaces at the front or end.
79
+ - Remember when you are done to turn auth_logging off as you do not want to log credentials.
80
+
81
+ ### Sample Properties
82
+
83
+ 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.
84
+
85
+ ```json
86
+ "properties": {
87
+ "host": "localhost",
88
+ "port": 443,
89
+ "choosepath": "",
90
+ "base_path": "/api/m2m",
91
+ "version": "v1",
92
+ "cache_location": "none",
93
+ "encode_pathvars": true,
94
+ "encode_queryvars": true,
95
+ "save_metric": false,
96
+ "stub": true,
97
+ "protocol": "https",
98
+ "authentication": {
99
+ "auth_method": "no_authentication",
100
+ "username": "username",
101
+ "password": "password",
102
+ "token": "token",
103
+ "token_timeout": 600000,
104
+ "token_cache": "local",
105
+ "invalid_token_error": 401,
106
+ "auth_field": [
107
+ "header.headers.VZ-M2M-Token",
108
+ "header.headers.Authorization"
109
+ ],
110
+ "auth_field_format": [
111
+ "{token}",
112
+ "Bearer {getAccessToken.responseFields.accessToken}"
113
+ ],
114
+ "auth_logging": false,
115
+ "client_id": "",
116
+ "client_secret": "",
117
+ "grant_type": "",
118
+ "sensitive": [],
119
+ "sso": {
120
+ "protocol": "",
121
+ "host": "",
122
+ "port": 0
123
+ },
124
+ "multiStepAuthCalls": [
125
+ {
126
+ "name": "getAccessToken",
127
+ "requestFields": {
128
+ "grant_type": "client_credentials",
129
+ "header.Authorization": "Basic <token>"
130
+ },
131
+ "responseFields": {
132
+ "accessToken": "access_token"
133
+ },
134
+ "successfullResponseCode": 200
135
+ },
136
+ {
137
+ "name": "getSessionToken",
138
+ "requestFields": {
139
+ "header.Authorization": "Bearer {getAccessToken.responseFields.accessToken}",
140
+ "username": "<username>",
141
+ "password": "<password>"
142
+ },
143
+ "responseFields": {
144
+ "token": "sessionToken"
145
+ },
146
+ "successfullResponseCode": 200
147
+ }
148
+ ]
149
+ },
150
+ "healthcheck": {
151
+ "type": "none",
152
+ "frequency": 60000,
153
+ "query_object": {},
154
+ "addlHeaders": {}
155
+ },
156
+ "throttle": {
157
+ "throttle_enabled": false,
158
+ "number_pronghorns": 1,
159
+ "sync_async": "sync",
160
+ "max_in_queue": 1000,
161
+ "concurrent_max": 1,
162
+ "expire_timeout": 0,
163
+ "avg_runtime": 200,
164
+ "priorities": [
165
+ {
166
+ "value": 0,
167
+ "percent": 100
168
+ }
169
+ ]
170
+ },
171
+ "request": {
172
+ "number_redirects": 0,
173
+ "number_retries": 3,
174
+ "limit_retry_error": [
175
+ 0
176
+ ],
177
+ "failover_codes": [],
178
+ "attempt_timeout": 5000,
179
+ "global_request": {
180
+ "payload": {},
181
+ "uriOptions": {},
182
+ "addlHeaders": {},
183
+ "authData": {}
184
+ },
185
+ "healthcheck_on_timeout": true,
186
+ "return_raw": false,
187
+ "archiving": false,
188
+ "return_request": false
189
+ },
190
+ "proxy": {
191
+ "enabled": false,
192
+ "host": "",
193
+ "port": 1,
194
+ "protocol": "http",
195
+ "username": "",
196
+ "password": ""
197
+ },
198
+ "ssl": {
199
+ "ecdhCurve": "",
200
+ "enabled": false,
201
+ "accept_invalid_cert": false,
202
+ "ca_file": "",
203
+ "key_file": "",
204
+ "cert_file": "",
205
+ "secure_protocol": "",
206
+ "ciphers": ""
207
+ },
208
+ "mongo": {
209
+ "host": "",
210
+ "port": 0,
211
+ "database": "",
212
+ "username": "",
213
+ "password": "",
214
+ "replSet": "",
215
+ "db_ssl": {
216
+ "enabled": false,
217
+ "accept_invalid_cert": false,
218
+ "ca_file": "",
219
+ "key_file": "",
220
+ "cert_file": ""
221
+ }
222
+ },
223
+ "devicebroker": {
224
+ "enabled": false,
225
+ "getDevice": [
226
+ {
227
+ "path": "/not/mapped",
228
+ "method": "GET",
229
+ "query": {},
230
+ "body": {},
231
+ "headers": {},
232
+ "handleFailure": "ignore",
233
+ "requestFields": {
234
+ "insample": "{port}"
235
+ },
236
+ "responseDatakey": "",
237
+ "responseFields": {
238
+ "name": "{this}{||}{that}",
239
+ "ostype": "{osfield}",
240
+ "ostypePrefix": "meraki-",
241
+ "port": "{port}",
242
+ "ipaddress": "{ip_addr}",
243
+ "serial": "{serial}"
244
+ }
245
+ }
246
+ ],
247
+ "getDevicesFiltered": [
248
+ {
249
+ "path": "/not/mapped",
250
+ "method": "GET",
251
+ "pagination": {
252
+ "offsetVar": "",
253
+ "limitVar": "",
254
+ "incrementBy": "limit",
255
+ "requestLocation": "query"
256
+ },
257
+ "query": {},
258
+ "body": {},
259
+ "headers": {},
260
+ "handleFailure": "ignore",
261
+ "requestFields": {},
262
+ "responseDatakey": "",
263
+ "responseFields": {
264
+ "name": "{this}{||}{that}",
265
+ "ostype": "{osfield}",
266
+ "ostypePrefix": "meraki-",
267
+ "port": "{port}",
268
+ "ipaddress": "{ip_addr}",
269
+ "serial": "{serial}",
270
+ "id": "{myid}"
271
+ }
272
+ }
273
+ ],
274
+ "isAlive": [
275
+ {
276
+ "path": "/not/mapped/{devID}",
277
+ "method": "GET",
278
+ "query": {},
279
+ "body": {},
280
+ "headers": {},
281
+ "handleFailure": "ignore",
282
+ "requestFields": {
283
+ "devID": "{id}"
284
+ },
285
+ "responseDatakey": "",
286
+ "responseFields": {
287
+ "status": "return2xx",
288
+ "statusValue": "AD.200"
289
+ }
290
+ }
291
+ ],
292
+ "getConfig": [
293
+ {
294
+ "path": "/not/mapped/{devID}",
295
+ "method": "GET",
296
+ "query": {},
297
+ "body": {},
298
+ "headers": {},
299
+ "handleFailure": "ignore",
300
+ "requestFields": {
301
+ "devID": "{id}"
302
+ },
303
+ "responseDatakey": "",
304
+ "responseFields": {}
305
+ }
306
+ ],
307
+ "getCount": [
308
+ {
309
+ "path": "/not/mapped",
310
+ "method": "GET",
311
+ "query": {},
312
+ "body": {},
313
+ "headers": {},
314
+ "handleFailure": "ignore",
315
+ "requestFields": {},
316
+ "responseDatakey": "",
317
+ "responseFields": {}
318
+ }
319
+ ]
320
+ },
321
+ "cache": {
322
+ "enabled": false,
323
+ "entities": [
324
+ {
325
+ "entityType": "device",
326
+ "frequency": 3600,
327
+ "flushOnFail": false,
328
+ "limit": 10000,
329
+ "retryAttempts": 5,
330
+ "sort": true,
331
+ "populate": [
332
+ {
333
+ "path": "/not/mapped",
334
+ "method": "GET",
335
+ "pagination": {
336
+ "offsetVar": "",
337
+ "limitVar": "",
338
+ "incrementBy": "limit",
339
+ "requestLocation": "query"
340
+ },
341
+ "query": {},
342
+ "body": {},
343
+ "headers": {},
344
+ "handleFailure": "ignore",
345
+ "requestFields": {},
346
+ "responseDatakey": "",
347
+ "responseFields": {
348
+ "name": "{this}{||}{that}",
349
+ "ostype": "{osfield}",
350
+ "ostypePrefix": "meraki-",
351
+ "port": "{port}",
352
+ "ipaddress": "{ip_addr}",
353
+ "serial": "{serial}",
354
+ "id": "{myid}"
355
+ }
356
+ }
357
+ ],
358
+ "cachedTasks": [
359
+ {
360
+ "name": "",
361
+ "filterField": "",
362
+ "filterLoc": ""
363
+ }
364
+ ]
365
+ }
366
+ ]
367
+ }
368
+ }
369
+ ```
370
+ ### [Swagger](https://gitlab.com/itentialopensource/adapters/controller-orchestrator/adapter-thingspace/-/blob/master/report/adapter-openapi.json)
371
+
372
+ ## [Generic Adapter Information](https://gitlab.com/itentialopensource/adapters/controller-orchestrator/adapter-thingspace/-/blob/master/README.md)
373
+
package/metadata.json CHANGED
@@ -39,20 +39,38 @@
39
39
  "isDeprecated": false
40
40
  },
41
41
  "brokerSince": "",
42
+ "authMethods": [
43
+ {
44
+ "type": "Multi Factor Auth",
45
+ "subtypes": [],
46
+ "primary": true
47
+ }
48
+ ],
42
49
  "documentation": {
43
50
  "storeLink": "",
44
51
  "npmLink": "https://www.npmjs.com/package/@itentialopensource/adapter-thingspace",
45
- "repoLink": "https://gitlab.com/itentialopensource/adapters/controller-orchestrator/adapter-thingspace",
52
+ "repoLink": "https://gitlab.com/itentialopensource/adapters/adapter-thingspace",
46
53
  "docLink": "https://docs.itential.com/opensource/docs/thingspace",
47
54
  "demoLinks": [],
48
- "trainingLinks": [],
55
+ "trainingLinks": [
56
+ {
57
+ "title": "Itential Academy",
58
+ "link": "https://www.itential.com/itential-academy/"
59
+ }
60
+ ],
49
61
  "faqLink": "https://docs.itential.com/opensource/docs/troubleshooting-an-adapter",
50
62
  "contributeLink": "https://gitlab.com/itentialopensource/adapters/contributing-guide",
51
63
  "issueLink": "https://itential.atlassian.net/servicedesk/customer/portals",
52
64
  "webLink": "",
53
- "vendorLink": "",
54
- "productLink": "",
55
- "apiLinks": []
65
+ "vendorLink": "https://www.verizon.com/",
66
+ "productLink": "https://thingspace.verizon.com/index.html",
67
+ "apiLinks": [
68
+ {
69
+ "title": "Thingspace API Reference",
70
+ "link": "https://thingspace.verizon.com/documentation/apis/connectivity-management/api-reference.html",
71
+ "public": true
72
+ }
73
+ ]
56
74
  },
57
75
  "assets": [],
58
76
  "relatedItems": {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-thingspace",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "This adapter integrates with system described as: ThingSpace.",
5
5
  "main": "adapter.js",
6
6
  "wizardVersion": "2.44.7",
7
- "engineVersion": "1.67.14",
7
+ "engineVersion": "1.67.19",
8
8
  "adapterType": "http",
9
9
  "scripts": {
10
10
  "artifactize": "npm i && node utils/packModificationScript.js",
@@ -15,7 +15,6 @@
15
15
  "test:baseunit": "mocha test/unit/adapterBaseTestUnit.js --LOG=error",
16
16
  "test:unit": "mocha test/unit/adapterTestUnit.js --LOG=error",
17
17
  "test:integration": "mocha test/integration/adapterTestIntegration.js --LOG=error",
18
- "test:cover": "nyc --reporter html --reporter text mocha --reporter dot test/*",
19
18
  "test": "npm run test:baseunit && npm run test:unit && npm run test:integration",
20
19
  "adapter:install": "npm i && node utils/tbScript.js install",
21
20
  "adapter:checkMigrate": "node utils/checkMigrate.js",
@@ -42,7 +41,7 @@
42
41
  ],
43
42
  "license": "Apache-2.0",
44
43
  "engines": {
45
- "node": ">= 8.0.0",
44
+ "node": ">= 14.0.0",
46
45
  "npm": ">= 6.0.0"
47
46
  },
48
47
  "repository": {
@@ -52,10 +51,10 @@
52
51
  "author": "Itential",
53
52
  "homepage": "https://gitlab.com/itentialopensource/adapters/adapter-thingspace#readme",
54
53
  "dependencies": {
55
- "@itentialopensource/adapter-utils": "^5.3.8",
54
+ "@itentialopensource/adapter-utils": "^5.3.10",
56
55
  "acorn": "^8.10.0",
57
56
  "ajv": "^8.12.0",
58
- "axios": "^1.6.7",
57
+ "axios": "^1.6.8",
59
58
  "commander": "^11.0.0",
60
59
  "dns-lookup-promise": "^1.0.4",
61
60
  "fs-extra": "^11.1.1",
@@ -63,7 +62,6 @@
63
62
  "mocha": "^10.3.0",
64
63
  "mocha-param": "^2.0.1",
65
64
  "mongodb": "^4.16.0",
66
- "nyc": "^15.1.0",
67
65
  "ping": "^0.4.4",
68
66
  "prompts": "^2.4.2",
69
67
  "readline-sync": "^1.4.10",
@@ -945,6 +945,11 @@
945
945
  "devicebroker": {
946
946
  "type": "object",
947
947
  "properties": {
948
+ "enabled": {
949
+ "type": "boolean",
950
+ "description": "Whether or not the device broker calls have been mapped",
951
+ "default": false
952
+ },
948
953
  "getDevice": {
949
954
  "type": "array",
950
955
  "description": "Broker call(s) to getDevice",
Binary file
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "0.1.3",
3
- "configLines": 5944,
2
+ "version": "0.2.4",
3
+ "configLines": 5949,
4
4
  "scriptLines": 1783,
5
5
  "codeLines": 6309,
6
- "testLines": 6167,
6
+ "testLines": 6166,
7
7
  "testCases": 279,
8
- "totalCodeLines": 14259,
8
+ "totalCodeLines": 14258,
9
9
  "wfTasks": 67
10
10
  }
@@ -0,0 +1,120 @@
1
+ {
2
+ "errors": [],
3
+ "statistics": [
4
+ {
5
+ "owner": "errorJson",
6
+ "description": "New adapter errors available for use",
7
+ "value": 0
8
+ },
9
+ {
10
+ "owner": "errorJson",
11
+ "description": "Adapter errors no longer available for use",
12
+ "value": 0
13
+ },
14
+ {
15
+ "owner": "errorJson",
16
+ "description": "Adapter errors that have been updated (e.g. recommendation changes)",
17
+ "value": 31
18
+ },
19
+ {
20
+ "owner": "packageJson",
21
+ "description": "Number of production dependencies",
22
+ "value": 16
23
+ },
24
+ {
25
+ "owner": "packageJson",
26
+ "description": "Number of development dependencies",
27
+ "value": 6
28
+ },
29
+ {
30
+ "owner": "packageJson",
31
+ "description": "Number of npm scripts",
32
+ "value": 21
33
+ },
34
+ {
35
+ "owner": "packageJson",
36
+ "description": "Runtime Library dependency",
37
+ "value": "^5.3.10"
38
+ },
39
+ {
40
+ "owner": "propertiesSchemaJson",
41
+ "description": "Adapter properties defined in the propertiesSchema file",
42
+ "value": 78
43
+ },
44
+ {
45
+ "owner": "markdown",
46
+ "description": "Number of lines in the README.md",
47
+ "value": 344
48
+ },
49
+ {
50
+ "owner": "markdown",
51
+ "description": "Number of lines in the SUMMARY.md",
52
+ "value": 9
53
+ },
54
+ {
55
+ "owner": "markdown",
56
+ "description": "Number of lines in the PROPERTIES.md",
57
+ "value": 647
58
+ },
59
+ {
60
+ "owner": "markdown",
61
+ "description": "Number of lines in the TROUBLESHOOT.md",
62
+ "value": 48
63
+ },
64
+ {
65
+ "owner": "markdown",
66
+ "description": "Number of lines in the ENHANCE.md",
67
+ "value": 70
68
+ },
69
+ {
70
+ "owner": "markdown",
71
+ "description": "Number of lines in the BROKER.md",
72
+ "value": 70
73
+ },
74
+ {
75
+ "owner": "unitTestJS",
76
+ "description": "Number of lines of code in unit tests",
77
+ "value": 2827
78
+ },
79
+ {
80
+ "owner": "unitTestJS",
81
+ "description": "Number of unit tests",
82
+ "value": 158
83
+ },
84
+ {
85
+ "owner": "integrationTestJS",
86
+ "description": "Number of lines of code in integration tests",
87
+ "value": 2087
88
+ },
89
+ {
90
+ "owner": "integrationTestJS",
91
+ "description": "Number of integration tests",
92
+ "value": 51
93
+ },
94
+ {
95
+ "owner": "staticFile",
96
+ "description": "Number of lines of code in adapterBase.js",
97
+ "value": 1453
98
+ },
99
+ {
100
+ "owner": "staticFile",
101
+ "description": "Number of static files added",
102
+ "value": 36
103
+ },
104
+ {
105
+ "owner": "Overall",
106
+ "description": "Total lines of Code",
107
+ "value": 6367
108
+ },
109
+ {
110
+ "owner": "Overall",
111
+ "description": "Total Tests",
112
+ "value": 209
113
+ },
114
+ {
115
+ "owner": "Overall",
116
+ "description": "Total Files",
117
+ "value": 6
118
+ }
119
+ ]
120
+ }