@itentialopensource/adapter-dna_center 0.5.4 → 0.5.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.
Files changed (45) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +12 -12
  3. package/CHANGELOG.md +24 -0
  4. package/ENHANCE.md +69 -0
  5. package/PROPERTIES.md +247 -0
  6. package/README.md +151 -379
  7. package/SUMMARY.md +9 -0
  8. package/TROUBLESHOOT.md +46 -0
  9. package/adapter.js +2212 -85
  10. package/adapterBase.js +848 -50
  11. package/entities/.generic/action.json +214 -0
  12. package/entities/.generic/schema.json +28 -0
  13. package/entities/.system/action.json +1 -1
  14. package/entities/Sites/action.json +42 -0
  15. package/entities/Sites/schema.json +2 -0
  16. package/error.json +12 -0
  17. package/package.json +45 -23
  18. package/pronghorn.json +780 -0
  19. package/propertiesDecorators.json +14 -0
  20. package/propertiesSchema.json +451 -11
  21. package/refs?service=git-upload-pack +0 -0
  22. package/report/updateReport1594147160686.json +95 -0
  23. package/report/updateReport1614887797185.json +95 -0
  24. package/report/updateReport1651598418513.json +114 -0
  25. package/sampleProperties.json +20 -5
  26. package/test/integration/adapterTestBasicGet.js +85 -0
  27. package/test/integration/adapterTestConnectivity.js +93 -0
  28. package/test/integration/adapterTestIntegration.js +87 -11
  29. package/test/unit/adapterBaseTestUnit.js +947 -0
  30. package/test/unit/adapterTestUnit.js +794 -18
  31. package/utils/addAuth.js +94 -0
  32. package/utils/artifactize.js +9 -14
  33. package/utils/basicGet.js +50 -0
  34. package/utils/checkMigrate.js +63 -0
  35. package/utils/entitiesToDB.js +224 -0
  36. package/utils/findPath.js +74 -0
  37. package/utils/modify.js +154 -0
  38. package/utils/packModificationScript.js +1 -1
  39. package/utils/patches2bundledDeps.js +90 -0
  40. package/utils/pre-commit.sh +1 -1
  41. package/utils/removeHooks.js +20 -0
  42. package/utils/tbScript.js +169 -0
  43. package/utils/tbUtils.js +464 -0
  44. package/utils/troubleshootingAdapter.js +190 -0
  45. package/gl-code-quality-report.json +0 -1
package/README.md CHANGED
@@ -1,303 +1,190 @@
1
- # Dna_center Adapter
1
+ # Adapter for Dna_center
2
+
3
+ ## Table of Contents
4
+
5
+ * [Overview](./SUMMARY.md)
6
+ * [Versioning](#versioning)
7
+ * [Supported IAP Versions](#supported-iap-versions)
8
+ * [Getting Started](#getting-started)
9
+ * [Helpful Background Information](#helpful-background-information)
10
+ * [Prerequisites](#prerequisites)
11
+ * [How to Install](#how-to-install)
12
+ * [Testing](#testing)
13
+ * [Configuration](./PROPERTIES.md)
14
+ * [Using this Adapter](./CALLS.md)
15
+ * [Additional Information](#additional-information)
16
+ * [Enhancements](./ENHANCE.md)
17
+ * [Contributing](./CONTRIBUTING.md)
18
+ * [Helpful Links](#helpful-links)
19
+ * [Node Scripts](#node-scripts)
20
+ * [Troubleshoot](./TROUBLESHOOT.md)
21
+ * [License and Maintainers](#license-and-maintainers)
22
+ * [Product License](#product-license)
23
+
24
+ ## [Overview](./SUMMARY.md)
2
25
 
3
- This adapter is used to integrate the Itential Automation Platform (IAP) with the Dna_center System. The API for Dna_center is available at [undefined API URL]. The adapter utilizes the Dna_center API to provide the integrations that are deemed pertinent to IAP. This ReadMe file is intended to provide information on this adapter.
4
-
5
- >**Note**: It is possible that some integrations will be supported through the Dna_center adapter while other integrations will not.
26
+ ## Versioning
6
27
 
7
- Itential provides information on all of its product adapters in the Customer Knowledge Base. Information in the [Customer Knowledge Base](https://itential.atlassian.net/servicedesk/customer/portals) is consistently maintained and goes through documentation reviews. As a result, it should be the first place to go for information.
28
+ Itential Product and opensource adapters utilize SemVer for versioning. The current version of the adapter can be found in the `package.json` file or viewed in the IAP GUI on the System page. All Itential opensource adapters can be found in the [Itential OpenSource Repository](https://gitlab.com/itentialopensource/adapters).
8
29
 
9
- For custom built adapters, it is a starting point to understand what you have built, provide the information for you to be able to update the adapter, and assist you with deploying the adapter into IAP.
30
+ Any release prior to 1.0.0 is a pre-release. Initial builds of adapters are generally set up as pre-releases as there is often work that needs to be done to configure the adapter and make sure the authentication process to Dna_center works appropriately.
10
31
 
11
- ## Versioning
32
+ Release notes can be viewed in CHANGELOG.md or in the [Customer Knowledge Base](https://itential.atlassian.net/servicedesk/customer/portals) for Itential adapters.
12
33
 
13
- Itential Product adapters utilize SemVer for versioning. The current version of the adapter can be found in the `package.json` file or viewed in the IAP GUI on the System page. For Open Source Adapters, the versions available can be found in the [Itential OpenSource Repository](https://www.npmjs.com/search?q=itentialopensource%2Fadapter).
34
+ ## Supported IAP Versions
14
35
 
15
- ## Release History
36
+ Itential Product adapters are built for particular versions of IAP and packaged with the versions they work with.
16
37
 
17
- Any release prior to 1.0.0 is a pre-release. Initial builds of adapters are generally set up as pre-releases as there is often work that needs to be done to configure the adapter and make sure the authentication process to Dna_center works appropriately.
38
+ Itential opensource adapter as well as custom adapters built with the Itential Adapter Builder work acoss many releases of IAP. As a result, it is not often necessary to modify an adapter when upgrading IAP. If IAP has changes that impact the pronghorn.json, like adding a new required section, this will most likely require changes to all adapters when upgrading IAP.
18
39
 
19
- Release notes can be viewed in CHANGELOG.md or in the [Customer Knowledge Base](https://itential.atlassian.net/servicedesk/customer/portals) for Itential adapters.
40
+ Many of the scripts that come with all adapters built using the Itential Adapter Builder do have some dependencies on IAP or the IAP database schema and so it is possible these scripts could stop working in different versions of IAP. If you notify Itential of any issues, the Adapter Team will attempt to fix the scripts for newer releases of IAP.
20
41
 
21
42
  ## Getting Started
22
43
 
23
44
  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
45
 
25
- ### Environment Prerequisites
46
+ ### Helpful Background Information
26
47
 
27
- The following is a list of required packages for an adapter.
48
+ There is adapter documentation available on the Itential Developer Site [HERE](https://www.itential.com/automation-platform/integrations/adapters-resources/). This documentation includes information and examples that are helpful for:
28
49
 
29
- ```json
50
+ ```text
51
+ Authentication
52
+ Properties
53
+ Code Files
54
+ Action Files
55
+ Schema Files
56
+ Mock Data Files
57
+ Linting and Testing
58
+ Troubleshooting
59
+ ```
60
+
61
+ Others will be added over time.
62
+ Want to build a new adapter? Use the Itential Adapter Builder [HERE](https://adapters.itential.io)
63
+
64
+ ### Prerequisites
65
+
66
+ The following is a list of required packages for installation on the system the adapter will run on:
67
+
68
+ ```text
30
69
  Node.js
70
+ npm
31
71
  Git
32
72
  ```
33
73
 
34
- ### Adapter Prerequisites
35
-
36
- The following list of packages are required for Itential product adapters or custom adapters that have been built utilizing the Itential Adapter Builder.
74
+ The following list of packages are required for Itential opensource adapters or custom adapters that have been built utilizing the Itential Adapter Builder. You can install these packages by running npm install inside the adapter directory.
37
75
 
38
76
  | Package | Description |
39
77
  | ------- | ------- |
40
- | @itentialopensource/adapter-utils | Runtime library classes for all adapters; includes request handling, connection, throttling, and translation. |
78
+ | @itentialopensource/adapter-utils | Runtime library classes for all adapters; includes request handling, connection, authentication throttling, and translation. |
41
79
  | ajv | Required for validation of adapter properties to integrate with Dna_center. |
80
+ | axios | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
81
+ | commander | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
42
82
  | fs-extra | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
43
- | readline-sync | Utilized by the testRunner script that comes with the adapter; helps to test unit and integration functionality. |
44
-
45
- ### Additional Prerequisites for Development and Testing
46
-
47
- 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
-
49
- ```json
83
+ | mocha | Testing library that is utilized by some of the node scripts that are included with the adapter. |
84
+ | mocha-param | Testing library that is utilized by some of the node scripts that are included with the adapter. |
85
+ | mongodb | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
86
+
87
+ | network-diagnostics | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
88
+ | nyc | Testing coverage library that is utilized by some of the node scripts that are included with the adapter. |
89
+ | readline-sync | Utilized by the node script that comes with the adapter; helps to test unit and integration functionality. |
90
+ | semver | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
91
+ | winston | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
92
+
93
+ If you are developing and testing a custom adapter, or have testing capabilities on an Itential opensource adapter, you will need to install these packages as well.
94
+
95
+ ```text
50
96
  chai
51
97
  eslint
52
98
  eslint-config-airbnb-base
53
99
  eslint-plugin-import
54
100
  eslint-plugin-json
55
- mocha
56
- nyc
101
+ package-json-validator
57
102
  testdouble
58
- winston
59
103
  ```
60
104
 
61
- ### Creating a Workspace
105
+ ### How to Install
62
106
 
63
- The following provides a local copy of the repository along with adapter dependencies.
64
-
65
- ```json
66
- git clone git@gitlab.com:\@itentialopensource/adapters/adapter-dna_center
67
- npm install
68
- ```
107
+ 1. Set up the name space location in your IAP node_modules.
69
108
 
70
- ## Adapter Properties and Descriptions
71
-
72
- This section defines **all** the properties that are available for the adapter, including detailed information on what each property is for. If you are not using certain capabilities with this adapter, you do not need to define all of the properties. An example of how the properties for this adapter can be used with tests or IAP are provided in the **Installation** section.
73
-
74
- ```json
75
- {
76
- "id": "ALL ADAPTER PROPERTIES!!!",
77
- "properties": {
78
- "host": "system.access.resolved",
79
- "port": 443,
80
- "base_path": "/",
81
- "version": "v1",
82
- "cache_location": "local",
83
- "save_metric": true,
84
- "stub": false,
85
- "protocol": "https",
86
- "authentication": {
87
- "auth_method": "basic user_password",
88
- "username": "username",
89
- "password": "password",
90
- "auth_field": "header.headers.X-AUTH-TOKEN",
91
- "auth_field_format": "{token}",
92
- "token": "token",
93
- "invalid_token_error": 401,
94
- "token_timeout": 0,
95
- "token_cache": "local"
96
- },
97
- "healthcheck": {
98
- "type": "startup",
99
- "frequency": 300000
100
- },
101
- "request": {
102
- "number_retries": 3,
103
- "limit_retry_error": 401,
104
- "failover_codes": [404, 405],
105
- "attempt_timeout": 5000,
106
- "global_request": {
107
- "payload": {},
108
- "uriOptions": {},
109
- "addlHeaders": {},
110
- "authData": {}
111
- },
112
- "healthcheck_on_timeout": false,
113
- "return_raw": false,
114
- "archiving": false
115
- },
116
- "ssl": {
117
- "ecdhCurve": "",
118
- "enabled": false,
119
- "accept_invalid_cert": false,
120
- "ca_file": "",
121
- "secure_protocol": "",
122
- "ciphers": ""
123
- },
124
- "throttle": {
125
- "throttle_enabled": false,
126
- "number_pronghorns": 1,
127
- "sync_async": "sync",
128
- "max_in_queue": 1000,
129
- "concurrent_max": 1,
130
- "expire_timeout": 0,
131
- "avg_runtime": 200
132
- },
133
- "proxy": {
134
- "enabled": false,
135
- "host": "localhost",
136
- "port": 9999,
137
- "protocol": "http"
138
- },
139
- "mongo": {
140
- "host": "",
141
- "port": 0,
142
- "database": "",
143
- "username": "",
144
- "password": ""
145
- }
146
- },
147
- "type": "YOUR ADAPTER CLASS"
148
- }
109
+ ```bash
110
+ cd /opt/pronghorn/current/node_modules (* could be in a different place)
111
+ if the @itentialopensource directory does not exist, create it:
112
+ mkdir @itentialopensource
149
113
  ```
150
114
 
151
- ### Connection Properties
152
-
153
- These base properties are used to connect to Dna_center upon the adapter initially coming up. It is important to set these properties appropriately.
154
-
155
- | Property | Description |
156
- | ------- | ------- |
157
- | host | Required. A fully qualified domain name or IP address.|
158
- | port | Required. Used to connect to the server.|
159
- | 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 ``.|
160
- | 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 ``.|
161
- | 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.|
162
- | 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.|
163
- | stub | Optional. Indicates whether the stub should run instead of making calls to Dna_center (very useful during basic testing). Default is false (which means connect to Dna_center).|
164
- | protocol | Optional. Notifies the adapter whether to use HTTP or HTTPS. Default is HTTP.|
165
-
166
- A connectivity check tells IAP the adapter has loaded successfully.
167
-
168
- ### Authentication Properties
169
-
170
- The following properties are used to define the authentication process to Dna_center.
171
-
172
- >**Note**: Depending on the method that is used to authenticate with Dna_center, you may not need to set all of the authentication properties.
115
+ 2. Clone/unzip/tar the adapter into your IAP environment.
173
116
 
174
- | Property | Description |
175
- | ------- | ------- |
176
- | 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`.|
177
- | username | Used to authenticate with Dna_center on every request or when pulling a token that will be used in subsequent requests.|
178
- | password | Used to authenticate with Dna_center on every request or when pulling a token that will be used in subsequent requests.|
179
- | 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.|
180
- | 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. |
181
- | token | Defines a static token that can be used on all requests. Only used with `static_token` as an authentication method (auth\_method).|
182
- | 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.|
183
- | 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 Dna_center. 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.|
184
- | token\_cache | Used to determine where the token should be stored (local memory or in Redis).|
185
-
186
- #### Examples of authentication field format
187
-
188
- ```json
189
- "{token}",
190
- "Token {token}",
191
- "{username}:{password}",
192
- "Basic {b64}{username}:{password}{/b64}"
117
+ ```bash
118
+ cd \@itentialopensource
119
+ git clone git@gitlab.com:\@itentialopensource/adapters/adapter-dna_center
120
+ or
121
+ unzip adapter-dna_center.zip
122
+ or
123
+ tar -xvf adapter-dna_center.tar
193
124
  ```
194
125
 
195
- ### Healthcheck Properties
196
-
197
- The healthcheck properties defines the API that runs the healthcheck to tell the adapter that it can reach Dna_center. There are currently three types of healthchecks.
198
-
199
- - None - Not recommended. Adapter will not run a healthcheck. Consequently, unable to determine before making a request if the adapter can reach Dna_center.
200
- - Startup - Adapter will check for connectivity when the adapter initially comes up, but it will not check afterwards.
201
- - Intermittent - Adapter will check connectivity to Dna_center at a frequency defined in the `frequency` property.
202
-
203
- | Property | Description |
204
- | ------- | ------- |
205
- | type | Required. The type of health check to run. |
206
- | frequency | Required if intermittent. Defines how often the health check should run. Measured in milliseconds. Default is 300000.|
126
+ 3. Run the adapter install script.
207
127
 
208
- ### Request Properties
128
+ ```bash
129
+ cd adapter-dna_center
130
+ npm run adapter:install
131
+ ```
209
132
 
210
- The request section defines properties to help handle requests.
133
+ 4. Restart IAP
211
134
 
212
- | Property | Description |
213
- | ------- | ------- |
214
- | number\_retries | Tells the adapter how many times to retry a request that has either aborted or reached a limit error before giving up and returning an error.|
215
- | limit\_retry\_error | Optional. Indicates the http error status number to define that no capacity was available and, after waiting a short interval, the adapter can retry the request. Default is 0.|
216
- | failover\_codes | An array of error codes for which the adapter will send back a failover flag to IAP so that the Platform can attempt the action in another adapter.|
217
- | attempt\_timeout | Optional. Tells how long the adapter should wait before aborting the attempt. On abort, the adapter will do one of two things: 1) return the error; or 2) if **healthcheck\_on\_timeout** is set to true, it will abort the request and run a Healthcheck until it re-establishes connectivity to Dna_center, and then will re-attempt the request that aborted. Default is 5000 milliseconds.|
218
- | global\_request | Optional. This is information that the adapter can include in all requests to the other system. This is easier to define and maintain than adding this information in either the code (adapter.js) or the action files.|
219
- | global\_request -> payload | Optional. Defines any information that should be included on all requests sent to the other system that have a payload/body.|
220
- | global\_request -> uriOptions | Optional. Defines any information that should be sent as untranslated query options (e.g. page, size) on all requests to the other system.|
221
- | global\_request -> addlHeaders | Optioonal. Defines any headers that should be sent on all requests to the other system.|
222
- | global\_request -> authData | Optional. Defines any additional authentication data used to authentice with the other system. This authData needs to be consistent on every request.|
223
- | 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.|
224
- | 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.|
225
- | archiving | Optional flag. Default is false. It archives the request, the results and the various times (wait time, Dna_center 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.|
226
-
227
- ### SSL Properties
228
-
229
- The SSL section defines the properties utilized for ssl authentication with Dna_center. SSL can work two different ways: set the `accept\_invalid\_certs` flag to true (only recommended for lab environments), or provide a `ca\_file`.
230
-
231
- | Property | Description |
232
- | ------- | ------- |
233
- | enabled | If SSL is required, set to true. |
234
- | accept\_invalid\_certs | Defines if the adapter should accept invalid certificates (only recommended for lab environments). Required if SSL is enabled. Default is false.|
235
- | ca\_file | Defines the path name to the CA file used for SSL. If SSL is enabled and the accept invalid certifications is false, then ca_file is required.|
236
- | secure\_protocol | Defines the protocol (e.g., SSLv3_method) to use on the SSL request.|
237
- | ciphers | Required if SSL enabled. Specifies a list of SSL ciphers to use.|
238
- | ecdhCurve | During testing on some Node 8 environments, you need to set `ecdhCurve` to auto. If you do not, you will receive PROTO errors when attempting the calls. This is the only usage of this property and to our knowledge it only impacts Node 8 and 9. |
135
+ ```bash
136
+ systemctl restart pronghorn
137
+ ```
239
138
 
240
- ### Throttle Properties
139
+ 5. Change the adapter service instance configuration (host, port, credentials, etc) in IAP Admin Essentials GUI
241
140
 
242
- The throttle section is used when requests to Dna_center must be queued (throttled). All of the properties in this section are optional.
141
+ npm run adapter:install can be dependent on where the adapter is installed and on the version of IAP so it is subject to fail. If this happens you can replace step 3-5 above with these:
243
142
 
244
- | Property | Description |
245
- | ------- | ------- |
246
- | throttle\_enabled | Default is false. Defines if the adapter should use throttling o rnot. |
247
- | number\_pronghorns | Default is 1. Defines if throttling is done in a single Itential instance or whether requests are being throttled across multiple Itential instances (minimum = 1, maximum = 20). Throttling in a single Itential instance uses an in-memory queue so there is less overhead. Throttling across multiple Itential instances requires placing the request and queue information into a shared resource (e.g. database) so that each instance can determine what is running and what is next to run. Throttling across multiple instances requires additional I/O overhead.|
248
- | sync-async | This property is not used at the current time (it is for future expansion of the throttling engine).|
249
- | max\_in\_queue | Represents the maximum number of requests the adapter should allow into the queue before rejecting requests (minimum = 1, maximum = 5000). This is not a limit on what the adapter can handle but more about timely responses to requests. The default is currently 1000.|
250
- | concurrent\_max | Defines the number of requests the adapter can send to Dna_center at one time (minimum = 1, maximum = 1000). The default is 1 meaning each request must be sent to Dna_center in a serial manner. |
251
- | 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).|
252
- | average\_runtime | Represents the approximate average of how long it takes Dna_center 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 Dna_center performance is exceptional you might run a little slower than you might like, but when it is poor you still run efficiently.|
143
+ 3. Install adapter dependencies and check the adapter.
253
144
 
254
- ### Proxy Properties
145
+ ```bash
146
+ cd adapter-dna_center
147
+ npm run install
148
+ npm run lint:errors
149
+ npm run test
150
+ ```
255
151
 
256
- The proxy section defines the properties to utilize when Dna_center is behind a proxy server.
152
+ 4. Restart IAP
257
153
 
258
- | Property | Description |
259
- | ------- | ------- |
260
- | enabled | Required. Default is false. If Dna_center is behind a proxy server, set enabled flag to true. |
261
- | host | Host information for the proxy server. Required if `enabled` is true.|
262
- | port | Port information for the proxy server. Required if `enabled` is true.|
263
- | protocol | The protocol (i.e., http, https, etc.) used to connect to the proxy. Default is http.|
154
+ ```bash
155
+ systemctl restart pronghorn
156
+ ```
264
157
 
265
- ### Mongo Properties
158
+ 5. Create an adapter service instance configuration in IAP Admin Essentials GUI
266
159
 
267
- The mongo section defines the properties used to connect to a Mongo database. Mongo can be used for throttling as well as to persist metric data. If not provided, metrics will be stored in the file system.
160
+ 6. Copy the properties from the sampleProperties.json and paste them into the service instance configuration in the inner/second properties field.
268
161
 
269
- | Property | Description |
270
- | ------- | ------- |
271
- | host | Optional. Host information for the mongo server.|
272
- | port | Optional. Port information for the mongo server.|
273
- | database | Optional. The database for the adapter to use for its data.|
274
- | username | Optional. If credentials are required to access mongo, this is the user to login as.|
275
- | password | Optional. If credentials are required to access mongo, this is the password to login with.|
162
+ 7. Change the adapter service instance configuration (host, port, credentials, etc) in IAP Admin Essentials GUI
276
163
 
277
- ## Testing an Itential Product Adapter
164
+ ### Testing
278
165
 
279
- Mocha is generally used to test all Itential Product Adapters. There are unit tests as well as integration tests performed. Integration tests can generally be run as standalone using mock data and running the adapter in stub mode, or as integrated. When running integrated, every effort is made to prevent environmental failures, however there is still a possibility.
166
+ Mocha is generally used to test all Itential Opensource Adapters. There are unit tests as well as integration tests performed. Integration tests can generally be run as standalone using mock data and running the adapter in stub mode, or as integrated. When running integrated, every effort is made to prevent environmental failures, however there is still a possibility.
280
167
 
281
- ### Unit Testing
168
+ #### Unit Testing
282
169
 
283
170
  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.
284
171
 
285
-
286
- ```json
172
+ ```bash
287
173
  node utils/testRunner --unit
288
174
 
289
175
  npm run test:unit
176
+ npm run test:baseunit
290
177
  ```
291
178
 
292
179
  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.
293
180
 
294
- ### Integration Testing - Standalone
181
+ #### Integration Testing - Standalone
295
182
 
296
183
  Standalone Integration Testing requires mock data to be provided with the entities. If this data is not provided, standalone integration testing will fail. When the adapter is set to run in stub mode (setting the stub property to true), the adapter will run through its code up to the point of making the request. It will then retrieve the mock data and return that as if it had received that data as the response from Dna_center. It will then translate the data so that the adapter can return the expected response to the rest of the Itential software. Standalone is the default integration test.
297
184
 
298
185
  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.
299
186
 
300
- ```json
187
+ ```bash
301
188
  node utils/testRunner
302
189
  answer no at the first prompt
303
190
 
@@ -306,13 +193,13 @@ npm run test:integration
306
193
 
307
194
  To add new integration tests, edit the `test/integration/adapterTestIntegration.js` file. The tests that are already in this file should provide guidance for adding additional tests.
308
195
 
309
- ### Integration Testing
196
+ #### Integration Testing
310
197
 
311
198
  Integration Testing requires connectivity to Dna_center. By using the testRunner script it prevents you from having to edit the integration test. It also resets the integration test after the test is complete so that credentials are not saved in the file.
312
199
 
313
200
  > **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 Dna_center. 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 Dna_center which change order dependencies or required data.
314
201
 
315
- ```json
202
+ ```bash
316
203
  node utils/testRunner
317
204
  answer yes at the first prompt
318
205
  answer all other questions on connectivity and credentials
@@ -322,164 +209,49 @@ Test should also be written to clean up after themselves. However, it is importa
322
209
 
323
210
  > **Reminder**: Do not check in code with actual credentials to systems.
324
211
 
325
- ## Installing an Itential Product Adapter
326
-
327
- 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.
328
-
329
- 1. Set up the name space location in your IAP node_modules.
330
-
331
- ```json
332
- cd /opt/pronghorn/current/node_modules
333
- if the @itentialopensource directory does not exist, create it:
334
- mkdir @itentialopensource
335
- ```
336
-
337
- 1. Clone the adapter into your IAP environment.
212
+ ## [Configuration](./PROPERTIES.md)
338
213
 
339
- ```json
340
- cd \@itentialopensource
341
- git clone git@gitlab.com:\@itentialopensource/adapters/adapter-dna_center
342
- ```
343
-
344
- 1. Install the dependencies for the adapter.
345
-
346
- ```json
347
- cd adapter-dna_center
348
- npm install
349
- ```
350
-
351
- 1. If you are running IAP 2019.1 or older, add the adapter properties for Dna_center (created from Adapter Builder) to the `properties.json` file for your Itential build. You will need to change the credentials and possibly the host information below.
352
- [Dna_center 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.
353
-
354
- 1. Restart IAP
355
-
356
- ```json
357
- systemctl restart pronghorn
358
- ```
359
-
360
- ## Installing a Custom Adapter
361
-
362
- If you built this as a custom adapter through the Adapter Builder, it is recommended you go through setting up a development environment and testing the adapter before installing it. There is often configuration and authentication work that is required before the adapter will work in IAP.
363
-
364
- 1. Move the adapter into the IAP `node_modules` directory.
365
-
366
- ```json
367
- Depending on where your code is located, this process is different.
368
- Could be a tar, move, untar
369
- Could be a git clone of a repository
370
- Could also be a cp -R from a coding directory
371
- Adapter should be placed into: /opt/pronghorn/current/node_modules/\@itentialopensource
372
- ```
373
-
374
- 1. Follow Steps 3-5 (above) to install an Itential adapter to load your properties, dependencies and restart IAP.
375
-
376
- ## Using this Adapter
377
-
378
- The `adapter.js` file contains the calls the adapter makes available to the rest of the Itential Platform. The API detailed for these calls should be available through JSDOC. The following is a brief summary of the calls.
379
-
380
- ### Generic Adapter Calls
381
-
382
- ```json
383
- connect()
384
- The connect call is run when the Adapter is first loaded by he Itential Platform. It validates the properties have been provided correctly.
385
- ```
386
-
387
- ```json
388
- healthCheck(callback)
389
- Insures that the adapter can communicate with Dna_center. The actual call that is used is defined in the adapter properties.
390
- ```
391
-
392
- ```json
393
- refreshProperties(properties)
394
- Provides the adapter the ability to accept property changes without having to restart the adapter.
395
- ```
396
-
397
- ```json
398
- encryptProperty(property, technique, callback)
399
- 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 Dna_center.
400
- ```
401
-
402
- ```json
403
- getQueue(callback)
404
- Will return the requests that are waiting in the queue if throttling is enabled.
405
- ```
406
-
407
- ```json
408
- addEntityCache(entityType, entities, key, callback)
409
- Will take the entities and add the list to the entity cache to expedite performance.
410
- ```
411
-
412
- ```json
413
- capabilityResults(results, callback)
414
- Will take the results from a verifyCompatibility and put them in the format to be passed back to the Itential Platform.
415
- ```
416
-
417
- ```json
418
- hasEntity(entityType, entityId, callback)
419
- Verifies the adapter has the specific entity.
420
- ```
421
-
422
- ```json
423
- verifyCapability(entityType, actionType, entityId, callback)
424
- Verifies the adapter can perform the provided action on the specific entity.
425
- ```
426
-
427
- ```json
428
- updateEntityCache()
429
- Call to update the entity cache.
430
- ```
431
-
432
- ### Specific Adapter Calls
214
+ ## [Using this Adapter](./CALLS.md)
433
215
 
434
- Specific adapter calls are built based on the API of the Dna_center. 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.
216
+ ### [Authentication](./AUTH.md)
435
217
 
436
- ## Troubleshooting the Adapter
218
+ ## Additional Information
437
219
 
438
- ### Connectivity Issues
220
+ ### [Enhancements](./ENHANCE.md)
439
221
 
440
- 1. Verify the adapter properties are set up correctly.
222
+ ### [Contributing](./CONTRIBUTING.md)
441
223
 
442
- ```json
443
- Go into the Itential Platform GUI and verify/update the properties
444
- ```
445
-
446
- 1. Verify there is connectivity between the Itential Platform Server and Dna_center Server.
447
-
448
- ```json
449
- ping the ip address of Dna_center server
450
- try telnet to the ip address port of Dna_center
451
- ```
452
-
453
- 1. Verify the credentials provided for Dna_center.
454
-
455
- ```json
456
- login to Dna_center using the provided credentials
457
- ```
224
+ ### Helpful Links
458
225
 
459
- 1. Verify the API of the call utilized for Dna_center Healthcheck.
226
+ [Adapter Technical Resources](https://www.itential.com/automation-platform/integrations/adapters-resources/)
460
227
 
461
- ```json
462
- Go into the Itential Platform GUI and verify/update the properties
463
- ```
464
-
465
- ### Functional Issues
466
-
467
- Adapter logs are located in `/var/log/pronghorn`. In older releases of the Itential Platform, there is a `pronghorn.log` file which contains logs for all of the Itential Platform. In newer versions, adapters are logging into their own files.
468
-
469
- ## Contributing to Dna_center
228
+ ### Node Scripts
470
229
 
471
- Please check out the [Contributing Guidelines](./CONTRIBUTING.md).
230
+ There are several node scripts that now accompany the adapter. These scripts are provided to make several activities easier. Many of these scripts can have issues with different versions of IAP as they have dependencies on IAP and Mongo. If you have issues with the scripts please report them to the Itential Adapter Team. Each of these scripts are described below.
472
231
 
473
- ## License & Maintainers
474
-
475
- ### Maintained By
476
-
477
- ```json
478
- Itential Product Adapters are maintained by the Itential Adapter Team.
479
- Itential OpenSource Adapters are maintained by the community at large.
232
+ | Run | Description |
233
+ | ------- | ------- |
234
+ | npm run adapter:install | Provides an easier way to install the adapter.|
235
+ | npm run adapter:checkMigrate | Checks whether your adapter can and should be migrated to the latest foundation.|
236
+ | npm run adapter:findPath | Can be used to see if the adapter supports a particular API call.|
237
+ | npm run adapter:migrate | Provides an easier way to migrate your adapter after you download the migration zip from Itential DevSite|
238
+ | npm run adapter:update | Provides an easier way to update your adapter after you download the migration zip from Itential DevSite|
239
+ | npm run adapter:revert | Allows you to revert after a migration or update if it resulted in issues.|
240
+ | npm run troubleshoot | Provides a way to troubleshoot the adapter - runs connectivity, healthcheck and basic get.|
241
+ | npm run connectivity | Provides a connectivity check to the Dna_center system.|
242
+ | npm run healthcheck | Checks whether the configured healthcheck call works to Dna_center.|
243
+ | npm run basicget | Checks whether the basic get calls works to Dna_center.|
244
+
245
+ ## [Troubleshoot](./TROUBLESHOOT.md)
246
+
247
+ ## License and Maintainers
248
+
249
+ ```text
250
+ Itential Product Adapters are maintained by the Itential Product Team.
251
+ Itential OpenSource Adapters are maintained by the Itential Adapter Team and the community at large.
480
252
  Custom Adapters are maintained by other sources.
481
253
  ```
482
254
 
483
- ### Product License
255
+ ## Product License
484
256
 
485
257
  [Apache 2.0](./LICENSE)