@itentialopensource/adapter-128technology 0.2.1 → 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/.eslintignore +1 -0
- package/.eslintrc.js +12 -12
- package/CHANGELOG.md +32 -0
- package/README.md +246 -65
- package/adapter.js +12003 -20
- package/adapterBase.js +529 -9
- package/entities/.generic/action.json +109 -0
- package/entities/.generic/schema.json +23 -0
- package/entities/.system/action.json +1 -0
- package/entities/Analytics/action.json +2 -0
- package/entities/Asset/action.json +1 -0
- package/entities/Authenticate/action.json +1 -0
- package/entities/Config/action.json +505 -0
- package/entities/Plugins/action.json +2 -0
- package/entities/Router/action.json +1 -0
- package/entities/Stats/action.json +1037 -0
- package/error.json +6 -0
- package/package.json +41 -19
- package/pronghorn.json +571 -1
- package/propertiesSchema.json +56 -4
- package/refs?service=git-upload-pack +0 -0
- package/report/updateReport1593633611696.json +95 -0
- package/report/updateReport1614264802205.json +95 -0
- package/report/updateReport1642429912446.json +95 -0
- package/sampleProperties.json +14 -5
- package/test/integration/adapterTestBasicGet.js +85 -0
- package/test/integration/adapterTestConnectivity.js +93 -0
- package/test/integration/adapterTestIntegration.js +21 -8
- package/test/unit/adapterBaseTestUnit.js +944 -0
- package/test/unit/adapterTestUnit.js +632 -12
- package/utils/addAuth.js +94 -0
- package/utils/artifactize.js +0 -1
- package/utils/basicGet.js +50 -0
- package/utils/checkMigrate.js +63 -0
- package/utils/entitiesToDB.js +224 -0
- package/utils/findPath.js +74 -0
- package/utils/modify.js +154 -0
- package/utils/packModificationScript.js +1 -1
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/removeHooks.js +20 -0
- package/utils/tbScript.js +169 -0
- package/utils/tbUtils.js +451 -0
- package/utils/troubleshootingAdapter.js +190 -0
package/.eslintignore
CHANGED
package/.eslintrc.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es6: true,
|
|
5
|
+
node: true
|
|
6
6
|
},
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
extends: 'airbnb-base',
|
|
8
|
+
plugins: [
|
|
9
|
+
'json'
|
|
10
10
|
],
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
parserOptions: {
|
|
12
|
+
sourceType: 'module'
|
|
13
13
|
},
|
|
14
14
|
rules: {
|
|
15
15
|
'max-len': 'warn',
|
|
16
|
-
'comma-dangle': ['error', 'never']
|
|
17
|
-
}
|
|
18
|
-
};
|
|
16
|
+
'comma-dangle': ['error', 'never']
|
|
17
|
+
}
|
|
18
|
+
};
|
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
|
|
2
|
+
## 0.3.0 [01-19-2022]
|
|
3
|
+
|
|
4
|
+
* migrations to the latest adapter foundation
|
|
5
|
+
|
|
6
|
+
See merge request itentialopensource/adapters/cloud/adapter-128technology!5
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 0.2.4 [02-25-2021]
|
|
11
|
+
|
|
12
|
+
* migration to bring up to the latest foundation
|
|
13
|
+
|
|
14
|
+
See merge request itentialopensource/adapters/cloud/adapter-128technology!4
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 0.2.3 [07-06-2020]
|
|
19
|
+
|
|
20
|
+
* migration updates
|
|
21
|
+
|
|
22
|
+
See merge request itentialopensource/adapters/cloud/adapter-128technology!3
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 0.2.2 [07-01-2020]
|
|
27
|
+
|
|
28
|
+
* migration updates
|
|
29
|
+
|
|
30
|
+
See merge request itentialopensource/adapters/cloud/adapter-128technology!3
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
2
34
|
## 0.2.1 [06-02-2020]
|
|
3
35
|
|
|
4
36
|
* changes to the sampleProperties
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# 128technology
|
|
1
|
+
# Adapter for 128technology
|
|
2
2
|
|
|
3
3
|
This adapter is used to integrate the Itential Automation Platform (IAP) with the 128technology System. The API for 128technology is available at [HERE](https://docs.128technology.com/docs/apis_rest). The adapter utilizes the 128technology API to provide the integrations that are deemed pertinent to IAP. This ReadMe file is intended to provide information on this adapter.
|
|
4
4
|
|
|
@@ -22,12 +22,31 @@ Release notes can be viewed in CHANGELOG.md or in the [Customer Knowledge Base](
|
|
|
22
22
|
|
|
23
23
|
These instructions will help you get a copy of the project on your local machine for development and testing. Reading this section is also helpful for deployments as it provides you with pertinent information on prerequisites and properties.
|
|
24
24
|
|
|
25
|
+
### Adapter Technical Resources
|
|
26
|
+
|
|
27
|
+
There is adapter documentation available on the Itential Developer Site [HERE](https://developer.itential.io/adapters-resources/). This documentation includes information and examples that are helpful for:
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
Authentication
|
|
31
|
+
Properties
|
|
32
|
+
Code Files
|
|
33
|
+
Action Files
|
|
34
|
+
Schema Files
|
|
35
|
+
Mock Data Files
|
|
36
|
+
Linting and Testing
|
|
37
|
+
Troubleshooting
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Others will be added over time.
|
|
41
|
+
Want to build a new adapter? Use the Adapter Builder [HERE](https://adapters.itential.io)
|
|
42
|
+
|
|
25
43
|
### Environment Prerequisites
|
|
26
44
|
|
|
27
45
|
The following is a list of required packages for an adapter.
|
|
28
46
|
|
|
29
|
-
```
|
|
47
|
+
```text
|
|
30
48
|
Node.js
|
|
49
|
+
npm
|
|
31
50
|
Git
|
|
32
51
|
```
|
|
33
52
|
|
|
@@ -39,21 +58,29 @@ The following list of packages are required for Itential product adapters or cus
|
|
|
39
58
|
| ------- | ------- |
|
|
40
59
|
| @itentialopensource/adapter-utils | Runtime library classes for all adapters; includes request handling, connection, throttling, and translation. |
|
|
41
60
|
| ajv | Required for validation of adapter properties to integrate with 128technology. |
|
|
61
|
+
| axios | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
|
|
62
|
+
| commander | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
|
|
42
63
|
| fs-extra | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
|
|
43
|
-
|
|
|
64
|
+
| network-diagnostics | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
|
|
65
|
+
| readline-sync | Utilized by the node script that comes with the adapter; helps to test unit and integration functionality. |
|
|
66
|
+
| semver | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
|
|
67
|
+
|
|
68
|
+
Some of the adapter node scripts run testing scripts which require the dev dependencies listed below.
|
|
44
69
|
|
|
45
70
|
### Additional Prerequisites for Development and Testing
|
|
46
71
|
|
|
47
72
|
If you are developing and testing a custom adapter, or have testing capabilities on an Itential product adapter, you will need to install these packages as well.
|
|
48
73
|
|
|
49
|
-
```
|
|
74
|
+
```text
|
|
50
75
|
chai
|
|
51
76
|
eslint
|
|
52
77
|
eslint-config-airbnb-base
|
|
53
78
|
eslint-plugin-import
|
|
54
79
|
eslint-plugin-json
|
|
55
80
|
mocha
|
|
81
|
+
mocha-param
|
|
56
82
|
nyc
|
|
83
|
+
package-json-validator
|
|
57
84
|
testdouble
|
|
58
85
|
winston
|
|
59
86
|
```
|
|
@@ -62,7 +89,7 @@ winston
|
|
|
62
89
|
|
|
63
90
|
The following provides a local copy of the repository along with adapter dependencies.
|
|
64
91
|
|
|
65
|
-
```
|
|
92
|
+
```bash
|
|
66
93
|
git clone git@gitlab.com:\@itentialopensource/adapters/adapter-128technology
|
|
67
94
|
npm install
|
|
68
95
|
```
|
|
@@ -80,6 +107,7 @@ This section defines **all** the properties that are available for the adapter,
|
|
|
80
107
|
"base_path": "/",
|
|
81
108
|
"version": "v1",
|
|
82
109
|
"cache_location": "local",
|
|
110
|
+
"encode_pathvars": true,
|
|
83
111
|
"save_metric": true,
|
|
84
112
|
"stub": false,
|
|
85
113
|
"protocol": "https",
|
|
@@ -87,16 +115,18 @@ This section defines **all** the properties that are available for the adapter,
|
|
|
87
115
|
"auth_method": "basic user_password",
|
|
88
116
|
"username": "username",
|
|
89
117
|
"password": "password",
|
|
90
|
-
"auth_field": "header.headers.X-AUTH-TOKEN",
|
|
91
|
-
"auth_field_format": "{token}",
|
|
92
118
|
"token": "token",
|
|
93
119
|
"invalid_token_error": 401,
|
|
94
120
|
"token_timeout": 0,
|
|
95
|
-
"token_cache": "local"
|
|
121
|
+
"token_cache": "local",
|
|
122
|
+
"auth_field": "header.headers.X-AUTH-TOKEN",
|
|
123
|
+
"auth_field_format": "{token}",
|
|
124
|
+
"auth_logging": false
|
|
96
125
|
},
|
|
97
126
|
"healthcheck": {
|
|
98
127
|
"type": "startup",
|
|
99
|
-
"frequency": 300000
|
|
128
|
+
"frequency": 300000,
|
|
129
|
+
"query_object": {}
|
|
100
130
|
},
|
|
101
131
|
"request": {
|
|
102
132
|
"number_redirects": 0,
|
|
@@ -112,7 +142,8 @@ This section defines **all** the properties that are available for the adapter,
|
|
|
112
142
|
},
|
|
113
143
|
"healthcheck_on_timeout": false,
|
|
114
144
|
"return_raw": false,
|
|
115
|
-
"archiving": false
|
|
145
|
+
"archiving": false,
|
|
146
|
+
"return_request": false
|
|
116
147
|
},
|
|
117
148
|
"ssl": {
|
|
118
149
|
"ecdhCurve": "",
|
|
@@ -131,13 +162,16 @@ This section defines **all** the properties that are available for the adapter,
|
|
|
131
162
|
"max_in_queue": 1000,
|
|
132
163
|
"concurrent_max": 1,
|
|
133
164
|
"expire_timeout": 0,
|
|
134
|
-
"avg_runtime": 200
|
|
165
|
+
"avg_runtime": 200,
|
|
166
|
+
"priorities": []
|
|
135
167
|
},
|
|
136
168
|
"proxy": {
|
|
137
169
|
"enabled": false,
|
|
138
170
|
"host": "localhost",
|
|
139
171
|
"port": 9999,
|
|
140
|
-
"protocol": "http"
|
|
172
|
+
"protocol": "http",
|
|
173
|
+
"username": "",
|
|
174
|
+
"password": "",
|
|
141
175
|
},
|
|
142
176
|
"mongo": {
|
|
143
177
|
"host": "",
|
|
@@ -170,6 +204,7 @@ These base properties are used to connect to 128technology upon the adapter init
|
|
|
170
204
|
| base_path | Optional. Used to define part of a path that is consistent for all or most endpoints. It makes the URIs easier to use and maintain but can be overridden on individual calls. An example **base_path** might be `/rest/api`. Default is ``.|
|
|
171
205
|
| version | Optional. Used to set a global version for action endpoints. This makes it faster to update the adapter when endpoints change. As with the base-path, version can be overridden on individual endpoints. Default is ``.|
|
|
172
206
|
| cache\_location | Optional. Used to define where the adapter cache is located. The cache is used to maintain an entity list to improve performance. Storage locally is lost when the adapter is restarted. Storage in Redis is preserved upon adapter restart. Default is none which means no caching of the entity list.|
|
|
207
|
+
| encode\_pathvars | Optional. Used to tell the adapter to encode path variables or not. The default behavior is to encode them so this property can b e used to stop that behavior.|
|
|
173
208
|
| save\_metric | Optional. Used to tell the adapter to save metric information (this does not impact metrics returned on calls). This allows the adapter to gather metrics over time. Metric data can be stored in a database or on the file system.|
|
|
174
209
|
| stub | Optional. Indicates whether the stub should run instead of making calls to 128technology (very useful during basic testing). Default is false (which means connect to 128technology).|
|
|
175
210
|
| protocol | Optional. Notifies the adapter whether to use HTTP or HTTPS. Default is HTTP.|
|
|
@@ -187,19 +222,20 @@ The following properties are used to define the authentication process to 128tec
|
|
|
187
222
|
| auth\_method | Required. Used to define the type of authentication currently supported. Authentication methods currently supported are: `basic user_password`, `static_token`, `request_token`, and `no_authentication`.|
|
|
188
223
|
| username | Used to authenticate with 128technology on every request or when pulling a token that will be used in subsequent requests.|
|
|
189
224
|
| password | Used to authenticate with 128technology on every request or when pulling a token that will be used in subsequent requests.|
|
|
190
|
-
| auth\_field | Defines the request field the authentication (e.g., token are basic auth credentials) needs to be placed in order for the calls to work.|
|
|
191
|
-
| auth\_field\_format | Defines the format of the auth\_field. See examples below. Items enclosed in {} inform the adapter to perofrm an action prior to sending the data. It may be to replace the item with a value or it may be to encode the item. |
|
|
192
225
|
| token | Defines a static token that can be used on all requests. Only used with `static_token` as an authentication method (auth\_method).|
|
|
193
226
|
| invalid\_token\_error | Defines the HTTP error that is received when the token is invalid. Notifies the adapter to pull a new token and retry the request. Default is 401.|
|
|
194
227
|
| token\_timeout | Defines how long a token is valid. Measured in milliseconds. Once a dynamic token is no longer valid, the adapter has to pull a new token. If the token\_timeout is set to -1, the adapter will pull a token on every request to 128technology. If the timeout\_token is 0, the adapter will use the expiration from the token response to determine when the token is no longer valid.|
|
|
195
228
|
| token\_cache | Used to determine where the token should be stored (local memory or in Redis).|
|
|
229
|
+
| auth\_field | Defines the request field the authentication (e.g., token are basic auth credentials) needs to be placed in order for the calls to work.|
|
|
230
|
+
| auth\_field\_format | Defines the format of the auth\_field. See examples below. Items enclosed in {} inform the adapter to perofrm an action prior to sending the data. It may be to replace the item with a value or it may be to encode the item. |
|
|
231
|
+
| auth\_logging | Setting this true will add some additional logs but this should only be done when trying to debug an issue as certain credential information may be logged out when this is true. |
|
|
196
232
|
|
|
197
233
|
#### Examples of authentication field format
|
|
198
234
|
|
|
199
235
|
```json
|
|
200
|
-
"{token}"
|
|
201
|
-
"Token {token}"
|
|
202
|
-
"{username}:{password}"
|
|
236
|
+
"{token}"
|
|
237
|
+
"Token {token}"
|
|
238
|
+
"{username}:{password}"
|
|
203
239
|
"Basic {b64}{username}:{password}{/b64}"
|
|
204
240
|
```
|
|
205
241
|
|
|
@@ -215,6 +251,7 @@ The healthcheck properties defines the API that runs the healthcheck to tell the
|
|
|
215
251
|
| ------- | ------- |
|
|
216
252
|
| type | Required. The type of health check to run. |
|
|
217
253
|
| frequency | Required if intermittent. Defines how often the health check should run. Measured in milliseconds. Default is 300000.|
|
|
254
|
+
| query_object | Query parameters to be added to the adapter healthcheck call.|
|
|
218
255
|
|
|
219
256
|
### Request Properties
|
|
220
257
|
|
|
@@ -235,6 +272,7 @@ The request section defines properties to help handle requests.
|
|
|
235
272
|
| healthcheck\_on\_timeout | Required. Defines if the adapter should run a health check on timeout. If set to true, the adapter will abort the request and run a health check until it re-establishes connectivity and then it will re-attempt the request.|
|
|
236
273
|
| return\_raw | Optional. Tells the adapter whether the raw response should be returned as well as the IAP response. This is helpful when running integration tests to save mock data. It does add overhead to the response object so it is not ideal from production.|
|
|
237
274
|
| archiving | Optional flag. Default is false. It archives the request, the results and the various times (wait time, 128technology time and overall time) in the `adapterid_results` collection in MongoDB. Although archiving might be desirable, be sure to develop a strategy before enabling this capability. Consider how much to archive and what strategy to use for cleaning up the collection in the database so that it does not become too large, especially if the responses are large.|
|
|
275
|
+
| return\_request | Optional flag. Default is false. Will return the actual request that is made including headers. This should only be used during debugging issues as there could be credentials in the actual request.|
|
|
238
276
|
|
|
239
277
|
### SSL Properties
|
|
240
278
|
|
|
@@ -264,6 +302,7 @@ The throttle section is used when requests to 128technology must be queued (thro
|
|
|
264
302
|
| concurrent\_max | Defines the number of requests the adapter can send to 128technology at one time (minimum = 1, maximum = 1000). The default is 1 meaning each request must be sent to 128technology in a serial manner. |
|
|
265
303
|
| expire\_timeout | Default is 0. Defines a graceful timeout of the request session. After a request has completed, the adapter will wait additional time prior to sending the next request. Measured in milliseconds (minimum = 0, maximum = 60000).|
|
|
266
304
|
| average\_runtime | Represents the approximate average of how long it takes 128technology to handle each request. Measured in milliseconds (minimum = 50, maximum = 60000). Default is 200. This metric has performance implications. If the runtime number is set too low, it puts extra burden on the CPU and memory as the requests will continually try to run. If the runtime number is set too high, requests may wait longer than they need to before running. The number does not need to be exact but your throttling strategy depends heavily on this number being within reason. If averages range from 50 to 250 milliseconds you might pick an average run-time somewhere in the middle so that when 128technology performance is exceptional you might run a little slower than you might like, but when it is poor you still run efficiently.|
|
|
305
|
+
| priorities | An array of priorities and how to handle them in relation to the throttle queue. Array of objects that include priority value and percent of queue to put the item ex { value: 1, percent: 10 }|
|
|
267
306
|
|
|
268
307
|
### Proxy Properties
|
|
269
308
|
|
|
@@ -275,6 +314,8 @@ The proxy section defines the properties to utilize when 128technology is behind
|
|
|
275
314
|
| host | Host information for the proxy server. Required if `enabled` is true.|
|
|
276
315
|
| port | Port information for the proxy server. Required if `enabled` is true.|
|
|
277
316
|
| protocol | The protocol (i.e., http, https, etc.) used to connect to the proxy. Default is http.|
|
|
317
|
+
| username | If there is authentication for the proxy, provide the username here.|
|
|
318
|
+
| password | If there is authentication for the proxy, provide the password here.|
|
|
278
319
|
|
|
279
320
|
### Mongo Properties
|
|
280
321
|
|
|
@@ -304,10 +345,11 @@ Mocha is generally used to test all Itential Product Adapters. There are unit te
|
|
|
304
345
|
Unit Testing includes testing basic adapter functionality as well as error conditions that are triggered in the adapter prior to any integration. There are two ways to run unit tests. The prefered method is to use the testRunner script; however, both methods are provided here.
|
|
305
346
|
|
|
306
347
|
|
|
307
|
-
```
|
|
348
|
+
```bash
|
|
308
349
|
node utils/testRunner --unit
|
|
309
350
|
|
|
310
351
|
npm run test:unit
|
|
352
|
+
npm run test:baseunit
|
|
311
353
|
```
|
|
312
354
|
|
|
313
355
|
To add new unit tests, edit the `test/unit/adapterTestUnit.js` file. The tests that are already in this file should provide guidance for adding additional tests.
|
|
@@ -318,7 +360,7 @@ Standalone Integration Testing requires mock data to be provided with the entiti
|
|
|
318
360
|
|
|
319
361
|
Similar to unit testing, there are two ways to run integration tests. Using the testRunner script is better because it prevents you from having to edit the test script; it will also resets information after testing is complete so that credentials are not saved in the file.
|
|
320
362
|
|
|
321
|
-
```
|
|
363
|
+
```bash
|
|
322
364
|
node utils/testRunner
|
|
323
365
|
answer no at the first prompt
|
|
324
366
|
|
|
@@ -333,7 +375,7 @@ Integration Testing requires connectivity to 128technology. By using the testRun
|
|
|
333
375
|
|
|
334
376
|
> **Note**: These tests have been written as a best effort to make them work in most environments. However, the Adapter Builder often does not have the necessary information that is required to set up valid integration tests. For example, the order of the requests can be very important and data is often required for `creates` and `updates`. Hence, integration tests may have to be enhanced before they will work (integrate) with 128technology. Even after tests have been set up properly, it is possible there are environmental constraints that could result in test failures. Some examples of possible environmental issues are customizations that have been made within 128technology which change order dependencies or required data.
|
|
335
377
|
|
|
336
|
-
```
|
|
378
|
+
```bash
|
|
337
379
|
node utils/testRunner
|
|
338
380
|
answer yes at the first prompt
|
|
339
381
|
answer all other questions on connectivity and credentials
|
|
@@ -343,38 +385,52 @@ Test should also be written to clean up after themselves. However, it is importa
|
|
|
343
385
|
|
|
344
386
|
> **Reminder**: Do not check in code with actual credentials to systems.
|
|
345
387
|
|
|
388
|
+
## Adapter Node Scripts
|
|
389
|
+
|
|
390
|
+
There are several node scripts that now accompany the adapter. These scripts are provided to make several activities easier. Each of these scripts are described below.
|
|
391
|
+
|
|
392
|
+
| Run | Description |
|
|
393
|
+
| ------- | ------- |
|
|
394
|
+
| npm run adapter:install | Provides an easier way to install the adapter.|
|
|
395
|
+
| npm run adapter:checkMigrate | Checks whether your adapter can and should be migrated to the latest foundation.|
|
|
396
|
+
| npm run adapter:findPath | Can be used to see if the adapter supports a particular API call.|
|
|
397
|
+
| npm run adapter:migrate | Provides an easier way to migrate your adapter after you download the migration zip from Itential DevSite|
|
|
398
|
+
| npm run adapter:update | Provides an easier way to update your adapter after you download the migration zip from Itential DevSite|
|
|
399
|
+
| npm run adapter:revert | Allows you to revert after a migration or update if it resulted in issues.|
|
|
400
|
+
| npm run troubleshoot | Provides a way to troubleshoot the adapter - runs connectivity, healthcheck and basic get.|
|
|
401
|
+
| npm run connectivity | Provides a connectivity check to the 128technology system.|
|
|
402
|
+
| npm run healthcheck | Checks whether the configured healthcheck call works to 128technology.|
|
|
403
|
+
| npm run basicget | Checks whether the basic get calls works to 128technology.|
|
|
404
|
+
|
|
346
405
|
## Installing an Itential Product Adapter
|
|
347
406
|
|
|
348
407
|
If you have App-Artifact installed in IAP, you can follow the instruction for that application to install the adapter into IAP. If not, follow these instructions.
|
|
349
408
|
|
|
350
409
|
1. Set up the name space location in your IAP node_modules.
|
|
351
410
|
|
|
352
|
-
```
|
|
411
|
+
```bash
|
|
353
412
|
cd /opt/pronghorn/current/node_modules
|
|
354
413
|
if the @itentialopensource directory does not exist, create it:
|
|
355
414
|
mkdir @itentialopensource
|
|
356
415
|
```
|
|
357
416
|
|
|
358
|
-
|
|
417
|
+
2. Clone the adapter into your IAP environment.
|
|
359
418
|
|
|
360
|
-
```
|
|
419
|
+
```bash
|
|
361
420
|
cd \@itentialopensource
|
|
362
421
|
git clone git@gitlab.com:\@itentialopensource/adapters/adapter-128technology
|
|
363
422
|
```
|
|
364
423
|
|
|
365
|
-
|
|
424
|
+
3. Run the adapter install script.
|
|
366
425
|
|
|
367
|
-
```
|
|
426
|
+
```bash
|
|
368
427
|
cd adapter-128technology
|
|
369
|
-
npm install
|
|
428
|
+
npm run adapter:install
|
|
370
429
|
```
|
|
371
430
|
|
|
372
|
-
|
|
373
|
-
[128technology sample properties](sampleProperties.json). If you are running IAP 2019.2 the adapter properties need to go into the database. You can review IAP documentation for how to do this.
|
|
431
|
+
4. Restart IAP
|
|
374
432
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
```json
|
|
433
|
+
```bash
|
|
378
434
|
systemctl restart pronghorn
|
|
379
435
|
```
|
|
380
436
|
|
|
@@ -384,7 +440,7 @@ If you built this as a custom adapter through the Adapter Builder, it is recomme
|
|
|
384
440
|
|
|
385
441
|
1. Move the adapter into the IAP `node_modules` directory.
|
|
386
442
|
|
|
387
|
-
```
|
|
443
|
+
```text
|
|
388
444
|
Depending on where your code is located, this process is different.
|
|
389
445
|
Could be a tar, move, untar
|
|
390
446
|
Could be a git clone of a repository
|
|
@@ -392,7 +448,7 @@ Depending on where your code is located, this process is different.
|
|
|
392
448
|
Adapter should be placed into: /opt/pronghorn/current/node_modules/\@itentialopensource
|
|
393
449
|
```
|
|
394
450
|
|
|
395
|
-
|
|
451
|
+
2. Follow Steps 3-4 (above) to install an Itential adapter to load your properties, dependencies and restart IAP.
|
|
396
452
|
|
|
397
453
|
## Using this Adapter
|
|
398
454
|
|
|
@@ -400,86 +456,211 @@ The `adapter.js` file contains the calls the adapter makes available to the rest
|
|
|
400
456
|
|
|
401
457
|
### Generic Adapter Calls
|
|
402
458
|
|
|
403
|
-
|
|
459
|
+
The `connect` call is run when the Adapter is first loaded by he Itential Platform. It validates the properties have been provided correctly.
|
|
460
|
+
```js
|
|
404
461
|
connect()
|
|
405
|
-
The connect call is run when the Adapter is first loaded by he Itential Platform. It validates the properties have been provided correctly.
|
|
406
462
|
```
|
|
407
463
|
|
|
408
|
-
|
|
464
|
+
The `healthCheck` call ensures that the adapter can communicate with 128technology. The actual call that is used is defined in the adapter properties.
|
|
465
|
+
```js
|
|
409
466
|
healthCheck(callback)
|
|
410
|
-
Insures that the adapter can communicate with 128technology. The actual call that is used is defined in the adapter properties.
|
|
411
467
|
```
|
|
412
468
|
|
|
413
|
-
|
|
469
|
+
The `refreshProperties` call provides the adapter the ability to accept property changes without having to restart the adapter.
|
|
470
|
+
```js
|
|
414
471
|
refreshProperties(properties)
|
|
415
|
-
Provides the adapter the ability to accept property changes without having to restart the adapter.
|
|
416
472
|
```
|
|
417
473
|
|
|
418
|
-
|
|
474
|
+
The `encryptProperty` call will take the provided property and technique, and return the property encrypted with the technique. This allows the property to be used in the adapterProps section for the credential password so that the password does not have to be in clear text. The adapter will decrypt the property as needed for communications with 128technology.
|
|
475
|
+
```js
|
|
419
476
|
encryptProperty(property, technique, callback)
|
|
420
|
-
Will take the provided property and technique, and return the property encrypted with the technique. This allows the property to be used in the adapterProps section for the credential password so that the password does not have to be in clear text. The adapter will decrypt the property as needed for communications with 128technology.
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
```json
|
|
424
|
-
getQueue(callback)
|
|
425
|
-
Will return the requests that are waiting in the queue if throttling is enabled.
|
|
426
477
|
```
|
|
427
478
|
|
|
428
|
-
|
|
479
|
+
The `addEntityCache` call will take the entities and add the list to the entity cache to expedite performance.
|
|
480
|
+
```js
|
|
429
481
|
addEntityCache(entityType, entities, key, callback)
|
|
430
|
-
Will take the entities and add the list to the entity cache to expedite performance.
|
|
431
482
|
```
|
|
432
483
|
|
|
433
|
-
|
|
484
|
+
The `capabilityResults` call will take the results from a verifyCompatibility and put them in the format to be passed back to the Itential Platform.
|
|
485
|
+
```js
|
|
434
486
|
capabilityResults(results, callback)
|
|
435
|
-
Will take the results from a verifyCompatibility and put them in the format to be passed back to the Itential Platform.
|
|
436
487
|
```
|
|
437
488
|
|
|
438
|
-
|
|
489
|
+
The `hasEntity` call verifies the adapter has the specific entity.
|
|
490
|
+
```js
|
|
439
491
|
hasEntity(entityType, entityId, callback)
|
|
440
|
-
Verifies the adapter has the specific entity.
|
|
441
492
|
```
|
|
442
493
|
|
|
443
|
-
|
|
494
|
+
The `verifyCapability` call verifies the adapter can perform the provided action on the specific entity.
|
|
495
|
+
```js
|
|
444
496
|
verifyCapability(entityType, actionType, entityId, callback)
|
|
445
|
-
Verifies the adapter can perform the provided action on the specific entity.
|
|
446
497
|
```
|
|
447
498
|
|
|
448
|
-
|
|
499
|
+
The `updateEntityCache` call will update the entity cache.
|
|
500
|
+
```js
|
|
449
501
|
updateEntityCache()
|
|
450
|
-
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
The `updateAdapterConfiguration` call provides the ability to update the adapter configuration from IAP - includes actions, schema, mockdata and other configurations.
|
|
505
|
+
```js
|
|
506
|
+
updateAdapterConfiguration(configFile, changes, entity, type, action, callback)
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
The `suspend` call provides the ability to suspend the adapter and either have requests rejected or put into a queue to be processed after the adapter is resumed.
|
|
510
|
+
```js
|
|
511
|
+
suspend(mode, callback)
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
The `unsuspend` call provides the ability to resume a suspended adapter. Any requests in queue will be processed before new requests.
|
|
515
|
+
```js
|
|
516
|
+
unsuspend(callback)
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
The `findPath` call provides the ability to see if a particular API path is supported by the adapter.
|
|
520
|
+
```js
|
|
521
|
+
findPath(apiPath, callback)
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
The `troubleshoot` call can be used to check on the performance of the adapter - it checks connectivity, healthcheck and basic get calls.
|
|
525
|
+
```js
|
|
526
|
+
troubleshoot(props, persistFlag, adapter, callback)
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
The `runHealthcheck` call will return the results of a healthcheck.
|
|
530
|
+
```js
|
|
531
|
+
runHealthcheck(adapter, callback)
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
The `runConnectivity` call will return the results of a connectivity check.
|
|
535
|
+
```js
|
|
536
|
+
runConnectivity(callback)
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
The `runBasicGet` call will return the results of running basic get API calls.
|
|
540
|
+
```js
|
|
541
|
+
runBasicGet(callback)
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
The `getQueue` call will return the requests that are waiting in the queue if throttling is enabled.
|
|
545
|
+
```js
|
|
546
|
+
getQueue(callback)
|
|
451
547
|
```
|
|
452
548
|
|
|
453
549
|
### Specific Adapter Calls
|
|
454
550
|
|
|
455
551
|
Specific adapter calls are built based on the API of the 128technology. The Adapter Builder creates the proper method comments for generating JS-DOC for the adapter. This is the best way to get information on the calls.
|
|
456
552
|
|
|
553
|
+
|
|
554
|
+
## Extending/Enhancing the Adapter
|
|
555
|
+
|
|
556
|
+
### Adding a Second Instance of an Adapter
|
|
557
|
+
|
|
558
|
+
You can add a second instance of this adapter without adding new code on the file system. To do this go into the IAP Admin Essentials and add a new service config for this adapter. The two instances of the adapter should have unique ids. In addition, they should point to different instances of the other system. For example, they should be configured to talk to different hosts.
|
|
559
|
+
|
|
560
|
+
### Adding Adapter Calls
|
|
561
|
+
|
|
562
|
+
There are multiple ways to add calls to an existing adapter.
|
|
563
|
+
|
|
564
|
+
The easiest way would be to use the Adapter Builder update process. This process takes in a Swagger or OpenAPI document, allows you to select the calls you want to add and then generates a zip file that can be used to update the adapter. Once you have the zip file simple put it in the adapter direcctory and execute `npm run adapter:update`.
|
|
565
|
+
|
|
566
|
+
```bash
|
|
567
|
+
mv updatePackage.zip adapter-128technology
|
|
568
|
+
cd adapter-128technology
|
|
569
|
+
npm run adapter:update
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
If you do not have a Swagger or OpenAPI document, you can use a Postman Collection and convert that to an OpenAPI document using APIMatic and then follow the first process.
|
|
573
|
+
|
|
574
|
+
If you want to manually update the adapter that can also be done the key thing is to make sure you update all of the right files. Within the entities directory you will find 1 or more entities. You can create a new entity or add to an existing entity. Each entity has an action.json file, any new call will need to be put in the action.json file. It will also need to be added to the enum for the ph_request_type in the appropriate schema files. Once this configuration is complete you will need to add the call to the adapter.js file and in order to make it available as a workflow task in IAP, it should also be added to the pronghorn.json file. You can optionally add it to the unit and integration test files. There is more information on how to work on each of these files in the Adapter Technical Resources on Dev Site [HERE](https://developer.itential.io/adapters-resources/)
|
|
575
|
+
|
|
576
|
+
```text
|
|
577
|
+
Files to update
|
|
578
|
+
* entities/<entity>/action.json: add an action
|
|
579
|
+
* entities/<entity>/schema.json (or the schema defined on the action): add action to the enum for ph_request_type
|
|
580
|
+
* adapter.js: add the new method and make sure it calls the proper entity and action
|
|
581
|
+
* pronghorn.json: add the new method
|
|
582
|
+
* test/unit/adapterTestUnit.js (optional but best practice): add unit test(s) - function is there, any required parameters error when not passed in
|
|
583
|
+
* test/integration/adapterTestIntegration.js (optional but best practice): add integration test
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
### Adding Adapter Properties
|
|
587
|
+
|
|
588
|
+
While changing adapter properties is done in the service instance configuration section of IAP, adding properties has to be done in the adapter. To add a property you should edit the propertiesSchema.json with the proper information for the property. In addition, you should modify the sampleProperties to have the new property in it.
|
|
589
|
+
|
|
590
|
+
```text
|
|
591
|
+
Files to update
|
|
592
|
+
* propertiesSchema.json: add the new property and how it is defined
|
|
593
|
+
* sampleProperties: add the new property with a default value
|
|
594
|
+
* test/unit/adapterTestUnit.js (optional but best practice): add the property to the global properties
|
|
595
|
+
* test/integration/adapterTestIntegration.js (optional but best practice): add the property to the global properties
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
### Changing Adapter Authentication
|
|
599
|
+
|
|
600
|
+
Often an adapter is built before knowing the authentication and authentication process can also change over time. The adapter supports many different kinds of authentication but it does require configuration. Some forms of authentication can be defined entirely with the adapter properties but others require configuration.
|
|
601
|
+
|
|
602
|
+
```text
|
|
603
|
+
Files to update
|
|
604
|
+
* entities/<entity>/action.json: change the getToken action as needed
|
|
605
|
+
* entities/<entity>/schemaTokenReq.json: add input parameters (external name is name in other system)
|
|
606
|
+
* entities/<entity>/schemaTokenResp.json: add response parameters (external name is name in other system)
|
|
607
|
+
* propertiesSchema.json: add any new property and how it is defined
|
|
608
|
+
* sampleProperties: add any new property with a default value
|
|
609
|
+
* test/unit/adapterTestUnit.js (optional but best practice): add the property to the global properties
|
|
610
|
+
* test/integration/adapterTestIntegration.js (optional but best practice): add the property to the global properties
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### Enhancing Adapter Integration Tests
|
|
614
|
+
|
|
615
|
+
The adapter integration tests are written to be able to test in either stub (standalone) mode or integrated to the other system. However, if integrating to the other system, you may need to provide better data than what the adapter provides by default as that data is likely to fail for create and update. To provide better data, edit the adapter integration test file. Make sure you do not remove the marker and keep custom code below the marker so you do not impact future migrations. Once the edits are complete, run the integration test as it instructs you to above. When you run integrated to the other system, you can also save mockdata for future use by changing the isSaveMockData flag to true.
|
|
616
|
+
|
|
617
|
+
```text
|
|
618
|
+
Files to update
|
|
619
|
+
* test/integration/adapterTestIntegration.js: add better data for the create and update calls so that they will not fail.
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
As mentioned previously, for most of these changes as well as other possible changes, there is more information on how to work on an adapter in the Adapter Technical Resources on Dev Site [HERE](https://developer.itential.io/adapters-resources/)
|
|
623
|
+
|
|
457
624
|
## Troubleshooting the Adapter
|
|
458
625
|
|
|
626
|
+
Run `npm run troubleshoot` to start the interactive troubleshooting process. The command allows user to verify and update connection, authentication as well as healthcheck configuration. After that it will test these properties by sending HTTP request to the endpoint. If the tests pass, it will persist these changes into IAP.
|
|
627
|
+
|
|
628
|
+
User also have the option to run individual command to perform specific test
|
|
629
|
+
|
|
630
|
+
- `npm run healthcheck` will perform a healthcheck request of with current setting.
|
|
631
|
+
- `npm run basicget` will perform some non-parameter GET request with current setting.
|
|
632
|
+
- `npm run connectivity` will perform networking diagnostics of the adatper endpoint.
|
|
633
|
+
|
|
459
634
|
### Connectivity Issues
|
|
460
635
|
|
|
461
|
-
1.
|
|
636
|
+
1. You can run the adapter troubleshooting script which will check connectivity, run the healthcheck and run basic get calls.
|
|
462
637
|
|
|
463
|
-
```
|
|
638
|
+
```bash
|
|
639
|
+
npm run troubleshoot
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
2. Verify the adapter properties are set up correctly.
|
|
643
|
+
|
|
644
|
+
```text
|
|
464
645
|
Go into the Itential Platform GUI and verify/update the properties
|
|
465
646
|
```
|
|
466
647
|
|
|
467
|
-
|
|
648
|
+
3. Verify there is connectivity between the Itential Platform Server and 128technology Server.
|
|
468
649
|
|
|
469
|
-
```
|
|
650
|
+
```text
|
|
470
651
|
ping the ip address of 128technology server
|
|
471
652
|
try telnet to the ip address port of 128technology
|
|
472
653
|
```
|
|
473
654
|
|
|
474
|
-
|
|
655
|
+
4. Verify the credentials provided for 128technology.
|
|
475
656
|
|
|
476
|
-
```
|
|
657
|
+
```text
|
|
477
658
|
login to 128technology using the provided credentials
|
|
478
659
|
```
|
|
479
660
|
|
|
480
|
-
|
|
661
|
+
5. Verify the API of the call utilized for 128technology Healthcheck.
|
|
481
662
|
|
|
482
|
-
```
|
|
663
|
+
```text
|
|
483
664
|
Go into the Itential Platform GUI and verify/update the properties
|
|
484
665
|
```
|
|
485
666
|
|
|
@@ -495,7 +676,7 @@ Please check out the [Contributing Guidelines](./CONTRIBUTING.md).
|
|
|
495
676
|
|
|
496
677
|
### Maintained By
|
|
497
678
|
|
|
498
|
-
```
|
|
679
|
+
```text
|
|
499
680
|
Itential Product Adapters are maintained by the Itential Adapter Team.
|
|
500
681
|
Itential OpenSource Adapters are maintained by the community at large.
|
|
501
682
|
Custom Adapters are maintained by other sources.
|