@itentialopensource/adapter-meraki 0.7.2 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- package/AUTH.md +40 -0
- package/CALLS.md +100 -0
- package/CHANGELOG.md +24 -0
- package/ENHANCE.md +69 -0
- package/PROPERTIES.md +247 -0
- package/README.md +113 -470
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +11 -0
- package/TROUBLESHOOT.md +46 -0
- package/adapter.js +911 -64
- package/adapterBase.js +294 -271
- package/entities/.generic/action.json +5 -5
- package/error.json +12 -0
- package/package.json +18 -13
- package/pronghorn.json +289 -104
- package/propertiesSchema.json +238 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/updateReport1642739939352.json +95 -0
- package/sampleProperties.json +4 -1
- package/test/integration/adapterTestBasicGet.js +1 -1
- package/test/integration/adapterTestIntegration.js +11 -2
- package/test/unit/adapterBaseTestUnit.js +27 -26
- package/test/unit/adapterTestUnit.js +632 -11
- package/utils/addAuth.js +94 -0
- package/utils/basicGet.js +1 -14
- package/utils/entitiesToDB.js +224 -0
- package/utils/modify.js +1 -1
- package/utils/packModificationScript.js +1 -1
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/removeHooks.js +20 -0
- package/utils/tbScript.js +14 -8
- package/utils/tbUtils.js +98 -19
- package/utils/troubleshootingAdapter.js +2 -26
package/README.md
CHANGED
@@ -1,30 +1,51 @@
|
|
1
|
-
# Adapter for Meraki
|
1
|
+
# Adapter for Meraki
|
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
|
-
|
4
|
-
|
5
|
-
>**Note**: It is possible that some integrations will be supported through the Meraki adapter while other integrations will not.
|
26
|
+
## Versioning
|
6
27
|
|
7
|
-
Itential
|
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
|
-
|
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 Meraki works appropriately.
|
10
31
|
|
11
|
-
|
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
|
-
|
34
|
+
## Supported IAP Versions
|
14
35
|
|
15
|
-
|
36
|
+
Itential Product adapters are built for particular versions of IAP and packaged with the versions they work with.
|
16
37
|
|
17
|
-
|
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
|
-
|
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
|
-
###
|
46
|
+
### Helpful Background Information
|
26
47
|
|
27
|
-
There is adapter documentation available on the Itential Developer Site [HERE](https://
|
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
50
|
```text
|
30
51
|
Authentication
|
@@ -38,11 +59,11 @@ Troubleshooting
|
|
38
59
|
```
|
39
60
|
|
40
61
|
Others will be added over time.
|
41
|
-
Want to build a new adapter? Use the Adapter Builder [HERE](https://adapters.itential.io)
|
62
|
+
Want to build a new adapter? Use the Itential Adapter Builder [HERE](https://adapters.itential.io)
|
42
63
|
|
43
|
-
###
|
64
|
+
### Prerequisites
|
44
65
|
|
45
|
-
The following is a list of required packages for
|
66
|
+
The following is a list of required packages for installation on the system the adapter will run on:
|
46
67
|
|
47
68
|
```text
|
48
69
|
Node.js
|
@@ -50,26 +71,26 @@ npm
|
|
50
71
|
Git
|
51
72
|
```
|
52
73
|
|
53
|
-
|
54
|
-
|
55
|
-
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.
|
56
75
|
|
57
76
|
| Package | Description |
|
58
77
|
| ------- | ------- |
|
59
|
-
| @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. |
|
60
79
|
| ajv | Required for validation of adapter properties to integrate with Meraki. |
|
61
80
|
| axios | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
|
62
81
|
| commander | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
|
63
82
|
| fs-extra | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
|
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
|
+
|
64
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. |
|
65
89
|
| readline-sync | Utilized by the node script that comes with the adapter; helps to test unit and integration functionality. |
|
66
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. |
|
67
92
|
|
68
|
-
|
69
|
-
|
70
|
-
### Additional Prerequisites for Development and Testing
|
71
|
-
|
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.
|
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.
|
73
94
|
|
74
95
|
```text
|
75
96
|
chai
|
@@ -77,272 +98,77 @@ eslint
|
|
77
98
|
eslint-config-airbnb-base
|
78
99
|
eslint-plugin-import
|
79
100
|
eslint-plugin-json
|
80
|
-
mocha
|
81
|
-
mocha-param
|
82
|
-
nyc
|
83
101
|
package-json-validator
|
84
102
|
testdouble
|
85
|
-
winston
|
86
103
|
```
|
87
104
|
|
88
|
-
###
|
105
|
+
### How to Install
|
89
106
|
|
90
|
-
|
107
|
+
1. Set up the name space location in your IAP node_modules.
|
91
108
|
|
92
109
|
```bash
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
## Adapter Properties and Descriptions
|
98
|
-
|
99
|
-
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.
|
100
|
-
|
101
|
-
```json
|
102
|
-
{
|
103
|
-
"id": "ALL ADAPTER PROPERTIES!!!",
|
104
|
-
"properties": {
|
105
|
-
"host": "system.access.resolved",
|
106
|
-
"port": 443,
|
107
|
-
"base_path": "/",
|
108
|
-
"version": "v1",
|
109
|
-
"cache_location": "local",
|
110
|
-
"encode_pathvars": true,
|
111
|
-
"save_metric": true,
|
112
|
-
"stub": false,
|
113
|
-
"protocol": "https",
|
114
|
-
"authentication": {
|
115
|
-
"auth_method": "basic user_password",
|
116
|
-
"username": "username",
|
117
|
-
"password": "password",
|
118
|
-
"token": "token",
|
119
|
-
"invalid_token_error": 401,
|
120
|
-
"token_timeout": 0,
|
121
|
-
"token_cache": "local",
|
122
|
-
"auth_field": "header.headers.X-AUTH-TOKEN",
|
123
|
-
"auth_field_format": "{token}",
|
124
|
-
"auth_logging": false
|
125
|
-
},
|
126
|
-
"healthcheck": {
|
127
|
-
"type": "startup",
|
128
|
-
"frequency": 300000
|
129
|
-
},
|
130
|
-
"request": {
|
131
|
-
"number_redirects": 0,
|
132
|
-
"number_retries": 3,
|
133
|
-
"limit_retry_error": [401],
|
134
|
-
"failover_codes": [404, 405],
|
135
|
-
"attempt_timeout": 5000,
|
136
|
-
"global_request": {
|
137
|
-
"payload": {},
|
138
|
-
"uriOptions": {},
|
139
|
-
"addlHeaders": {},
|
140
|
-
"authData": {}
|
141
|
-
},
|
142
|
-
"healthcheck_on_timeout": false,
|
143
|
-
"return_raw": false,
|
144
|
-
"archiving": false,
|
145
|
-
"return_request": false
|
146
|
-
},
|
147
|
-
"ssl": {
|
148
|
-
"ecdhCurve": "",
|
149
|
-
"enabled": false,
|
150
|
-
"accept_invalid_cert": false,
|
151
|
-
"ca_file": "",
|
152
|
-
"key_file": "",
|
153
|
-
"cert_file": "",
|
154
|
-
"secure_protocol": "",
|
155
|
-
"ciphers": ""
|
156
|
-
},
|
157
|
-
"throttle": {
|
158
|
-
"throttle_enabled": false,
|
159
|
-
"number_pronghorns": 1,
|
160
|
-
"sync_async": "sync",
|
161
|
-
"max_in_queue": 1000,
|
162
|
-
"concurrent_max": 1,
|
163
|
-
"expire_timeout": 0,
|
164
|
-
"avg_runtime": 200,
|
165
|
-
"priorities": []
|
166
|
-
},
|
167
|
-
"proxy": {
|
168
|
-
"enabled": false,
|
169
|
-
"host": "localhost",
|
170
|
-
"port": 9999,
|
171
|
-
"protocol": "http",
|
172
|
-
"username": "",
|
173
|
-
"password": "",
|
174
|
-
},
|
175
|
-
"mongo": {
|
176
|
-
"host": "",
|
177
|
-
"port": 0,
|
178
|
-
"database": "",
|
179
|
-
"username": "",
|
180
|
-
"password": "",
|
181
|
-
"replSet": "",
|
182
|
-
"db_ssl": {
|
183
|
-
"enabled": false,
|
184
|
-
"accept_invalid_cert": false,
|
185
|
-
"ca_file": "",
|
186
|
-
"key_file": "",
|
187
|
-
"cert_file": ""
|
188
|
-
}
|
189
|
-
}
|
190
|
-
},
|
191
|
-
"type": "YOUR ADAPTER CLASS"
|
192
|
-
}
|
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
|
193
113
|
```
|
194
114
|
|
195
|
-
|
196
|
-
|
197
|
-
These base properties are used to connect to Meraki upon the adapter initially coming up. It is important to set these properties appropriately.
|
198
|
-
|
199
|
-
| Property | Description |
|
200
|
-
| ------- | ------- |
|
201
|
-
| host | Required. A fully qualified domain name or IP address.|
|
202
|
-
| port | Required. Used to connect to the server.|
|
203
|
-
| 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 ``.|
|
204
|
-
| 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 ``.|
|
205
|
-
| 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.|
|
206
|
-
| 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.|
|
207
|
-
| 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.|
|
208
|
-
| stub | Optional. Indicates whether the stub should run instead of making calls to Meraki (very useful during basic testing). Default is false (which means connect to Meraki).|
|
209
|
-
| protocol | Optional. Notifies the adapter whether to use HTTP or HTTPS. Default is HTTP.|
|
210
|
-
|
211
|
-
A connectivity check tells IAP the adapter has loaded successfully.
|
212
|
-
|
213
|
-
### Authentication Properties
|
115
|
+
2. Clone/unzip/tar the adapter into your IAP environment.
|
214
116
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
| username | Used to authenticate with Meraki on every request or when pulling a token that will be used in subsequent requests.|
|
223
|
-
| password | Used to authenticate with Meraki on every request or when pulling a token that will be used in subsequent requests.|
|
224
|
-
| token | Defines a static token that can be used on all requests. Only used with `static_token` as an authentication method (auth\_method).|
|
225
|
-
| 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.|
|
226
|
-
| 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 Meraki. 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.|
|
227
|
-
| token\_cache | Used to determine where the token should be stored (local memory or in Redis).|
|
228
|
-
| 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.|
|
229
|
-
| 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. |
|
230
|
-
| 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. |
|
231
|
-
|
232
|
-
#### Examples of authentication field format
|
233
|
-
|
234
|
-
```json
|
235
|
-
"{token}"
|
236
|
-
"Token {token}"
|
237
|
-
"{username}:{password}"
|
238
|
-
"Basic {b64}{username}:{password}{/b64}"
|
117
|
+
```bash
|
118
|
+
cd \@itentialopensource
|
119
|
+
git clone git@gitlab.com:\@itentialopensource/adapters/adapter-meraki
|
120
|
+
or
|
121
|
+
unzip adapter-meraki.zip
|
122
|
+
or
|
123
|
+
tar -xvf adapter-meraki.tar
|
239
124
|
```
|
240
125
|
|
241
|
-
|
242
|
-
|
243
|
-
The healthcheck properties defines the API that runs the healthcheck to tell the adapter that it can reach Meraki. There are currently three types of healthchecks.
|
244
|
-
|
245
|
-
- None - Not recommended. Adapter will not run a healthcheck. Consequently, unable to determine before making a request if the adapter can reach Meraki.
|
246
|
-
- Startup - Adapter will check for connectivity when the adapter initially comes up, but it will not check afterwards.
|
247
|
-
- Intermittent - Adapter will check connectivity to Meraki at a frequency defined in the `frequency` property.
|
248
|
-
|
249
|
-
| Property | Description |
|
250
|
-
| ------- | ------- |
|
251
|
-
| type | Required. The type of health check to run. |
|
252
|
-
| 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.
|
253
127
|
|
254
|
-
|
128
|
+
```bash
|
129
|
+
cd adapter-meraki
|
130
|
+
npm run adapter:install
|
131
|
+
```
|
255
132
|
|
256
|
-
|
133
|
+
4. Restart IAP
|
257
134
|
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
| 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.|
|
262
|
-
| limit\_retry\_error | Optional. Can be either an integer or an array. 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. If an array is provvided, the array can contain integers or strings. Strings in the array are used to define ranges (e.g. "502-506"). Default is [0].|
|
263
|
-
| 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.|
|
264
|
-
| 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 Meraki, and then will re-attempt the request that aborted. Default is 5000 milliseconds.|
|
265
|
-
| 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.|
|
266
|
-
| global\_request -> payload | Optional. Defines any information that should be included on all requests sent to the other system that have a payload/body.|
|
267
|
-
| 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.|
|
268
|
-
| global\_request -> addlHeaders | Optioonal. Defines any headers that should be sent on all requests to the other system.|
|
269
|
-
| 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.|
|
270
|
-
| 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.|
|
271
|
-
| 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.|
|
272
|
-
| archiving | Optional flag. Default is false. It archives the request, the results and the various times (wait time, Meraki 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.|
|
273
|
-
| 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.|
|
274
|
-
|
275
|
-
### SSL Properties
|
276
|
-
|
277
|
-
The SSL section defines the properties utilized for ssl authentication with Meraki. SSL can work two different ways: set the `accept\_invalid\_certs` flag to true (only recommended for lab environments), or provide a `ca\_file`.
|
278
|
-
|
279
|
-
| Property | Description |
|
280
|
-
| ------- | ------- |
|
281
|
-
| enabled | If SSL is required, set to true. |
|
282
|
-
| accept\_invalid\_certs | Defines if the adapter should accept invalid certificates (only recommended for lab environments). Required if SSL is enabled. Default is false.|
|
283
|
-
| 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.|
|
284
|
-
| key\_file | Defines the path name to the Key file used for SSL. The key_file may be needed for some systems but it is not required for SSL.|
|
285
|
-
| cert\_file | Defines the path name to the Certificate file used for SSL. The cert_file may be needed for some systems but it is not required for SSL.|
|
286
|
-
| secure\_protocol | Defines the protocol (e.g., SSLv3_method) to use on the SSL request.|
|
287
|
-
| ciphers | Required if SSL enabled. Specifies a list of SSL ciphers to use.|
|
288
|
-
| 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
|
+
```
|
289
138
|
|
290
|
-
|
139
|
+
5. Change the adapter service instance configuration (host, port, credentials, etc) in IAP Admin Essentials GUI
|
291
140
|
|
292
|
-
|
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:
|
293
142
|
|
294
|
-
|
295
|
-
| ------- | ------- |
|
296
|
-
| throttle\_enabled | Default is false. Defines if the adapter should use throttling o rnot. |
|
297
|
-
| 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.|
|
298
|
-
| sync-async | This property is not used at the current time (it is for future expansion of the throttling engine).|
|
299
|
-
| 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.|
|
300
|
-
| concurrent\_max | Defines the number of requests the adapter can send to Meraki at one time (minimum = 1, maximum = 1000). The default is 1 meaning each request must be sent to Meraki in a serial manner. |
|
301
|
-
| 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).|
|
302
|
-
| average\_runtime | Represents the approximate average of how long it takes Meraki 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 Meraki performance is exceptional you might run a little slower than you might like, but when it is poor you still run efficiently.|
|
303
|
-
| 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 }|
|
143
|
+
3. Install adapter dependencies and check the adapter.
|
304
144
|
|
305
|
-
|
145
|
+
```bash
|
146
|
+
cd adapter-meraki
|
147
|
+
npm run install
|
148
|
+
npm run lint:errors
|
149
|
+
npm run test
|
150
|
+
```
|
306
151
|
|
307
|
-
|
152
|
+
4. Restart IAP
|
308
153
|
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
| host | Host information for the proxy server. Required if `enabled` is true.|
|
313
|
-
| port | Port information for the proxy server. Required if `enabled` is true.|
|
314
|
-
| protocol | The protocol (i.e., http, https, etc.) used to connect to the proxy. Default is http.|
|
315
|
-
| username | If there is authentication for the proxy, provide the username here.|
|
316
|
-
| password | If there is authentication for the proxy, provide the password here.|
|
154
|
+
```bash
|
155
|
+
systemctl restart pronghorn
|
156
|
+
```
|
317
157
|
|
318
|
-
|
158
|
+
5. Create an adapter service instance configuration in IAP Admin Essentials GUI
|
319
159
|
|
320
|
-
|
160
|
+
6. Copy the properties from the sampleProperties.json and paste them into the service instance configuration in the inner/second properties field.
|
321
161
|
|
322
|
-
|
323
|
-
| ------- | ------- |
|
324
|
-
| host | Optional. Host information for the mongo server.|
|
325
|
-
| port | Optional. Port information for the mongo server.|
|
326
|
-
| database | Optional. The database for the adapter to use for its data.|
|
327
|
-
| username | Optional. If credentials are required to access mongo, this is the user to login as.|
|
328
|
-
| password | Optional. If credentials are required to access mongo, this is the password to login with.|
|
329
|
-
| replSet | Optional. If the database is set up to use replica sets, define it here so it can be added to the database connection.|
|
330
|
-
| db\_ssl | Optional. Contains information for SSL connectivity to the database.|
|
331
|
-
| db\_ssl -> enabled | If SSL is required, set to true.|
|
332
|
-
| db\_ssl -> accept_invalid_cert | Defines if the adapter should accept invalid certificates (only recommended for lab environments). Required if SSL is enabled. Default is false.|
|
333
|
-
| db\_ssl -> 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.|
|
334
|
-
| db\_ssl -> key_file | Defines the path name to the Key file used for SSL. The key_file may be needed for some systems but it is not required for SSL.|
|
335
|
-
| db\_ssl -> cert_file | Defines the path name to the Certificate file used for SSL. The cert_file may be needed for some systems but it is not required for SSL.|
|
162
|
+
7. Change the adapter service instance configuration (host, port, credentials, etc) in IAP Admin Essentials GUI
|
336
163
|
|
337
|
-
|
164
|
+
### Testing
|
338
165
|
|
339
|
-
Mocha is generally used to test all Itential
|
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.
|
340
167
|
|
341
|
-
|
168
|
+
#### Unit Testing
|
342
169
|
|
343
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.
|
344
171
|
|
345
|
-
|
346
172
|
```bash
|
347
173
|
node utils/testRunner --unit
|
348
174
|
|
@@ -352,7 +178,7 @@ npm run test:baseunit
|
|
352
178
|
|
353
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.
|
354
180
|
|
355
|
-
|
181
|
+
#### Integration Testing - Standalone
|
356
182
|
|
357
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 Meraki. 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.
|
358
184
|
|
@@ -367,7 +193,7 @@ npm run test:integration
|
|
367
193
|
|
368
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.
|
369
195
|
|
370
|
-
|
196
|
+
#### Integration Testing
|
371
197
|
|
372
198
|
Integration Testing requires connectivity to Meraki. 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.
|
373
199
|
|
@@ -383,9 +209,25 @@ Test should also be written to clean up after themselves. However, it is importa
|
|
383
209
|
|
384
210
|
> **Reminder**: Do not check in code with actual credentials to systems.
|
385
211
|
|
386
|
-
##
|
212
|
+
## [Configuration](./PROPERTIES.md)
|
213
|
+
|
214
|
+
## [Using this Adapter](./CALLS.md)
|
387
215
|
|
388
|
-
|
216
|
+
### [Authentication](./AUTH.md)
|
217
|
+
|
218
|
+
## Additional Information
|
219
|
+
|
220
|
+
### [Enhancements](./ENHANCE.md)
|
221
|
+
|
222
|
+
### [Contributing](./CONTRIBUTING.md)
|
223
|
+
|
224
|
+
### Helpful Links
|
225
|
+
|
226
|
+
[Adapter Technical Resources](https://www.itential.com/automation-platform/integrations/adapters-resources/)
|
227
|
+
|
228
|
+
### Node Scripts
|
229
|
+
|
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.
|
389
231
|
|
390
232
|
| Run | Description |
|
391
233
|
| ------- | ------- |
|
@@ -398,217 +240,18 @@ There are several node scripts that now accompany the adapter. These scripts are
|
|
398
240
|
| npm run troubleshoot | Provides a way to troubleshoot the adapter - runs connectivity, healthcheck and basic get.|
|
399
241
|
| npm run connectivity | Provides a connectivity check to the Meraki system.|
|
400
242
|
| npm run healthcheck | Checks whether the configured healthcheck call works to Meraki.|
|
401
|
-
| npm run basicget | Checks whether the
|
402
|
-
|
403
|
-
## Installing an Itential Product Adapter
|
404
|
-
|
405
|
-
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.
|
406
|
-
|
407
|
-
1. Set up the name space location in your IAP node_modules.
|
408
|
-
|
409
|
-
```bash
|
410
|
-
cd /opt/pronghorn/current/node_modules
|
411
|
-
if the @itentialopensource directory does not exist, create it:
|
412
|
-
mkdir @itentialopensource
|
413
|
-
```
|
414
|
-
|
415
|
-
1. Clone the adapter into your IAP environment.
|
416
|
-
|
417
|
-
```bash
|
418
|
-
cd \@itentialopensource
|
419
|
-
git clone git@gitlab.com:\@itentialopensource/adapters/adapter-meraki
|
420
|
-
```
|
421
|
-
|
422
|
-
1. Run the adapter install script.
|
423
|
-
|
424
|
-
```bash
|
425
|
-
cd adapter-meraki
|
426
|
-
npm run adapter:install
|
427
|
-
```
|
428
|
-
|
429
|
-
1. Restart IAP
|
430
|
-
|
431
|
-
```bash
|
432
|
-
systemctl restart pronghorn
|
433
|
-
```
|
434
|
-
|
435
|
-
## Installing a Custom Adapter
|
436
|
-
|
437
|
-
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.
|
438
|
-
|
439
|
-
1. Move the adapter into the IAP `node_modules` directory.
|
440
|
-
|
441
|
-
```text
|
442
|
-
Depending on where your code is located, this process is different.
|
443
|
-
Could be a tar, move, untar
|
444
|
-
Could be a git clone of a repository
|
445
|
-
Could also be a cp -R from a coding directory
|
446
|
-
Adapter should be placed into: /opt/pronghorn/current/node_modules/\@itentialopensource
|
447
|
-
```
|
448
|
-
|
449
|
-
1. Follow Steps 3-4 (above) to install an Itential adapter to load your properties, dependencies and restart IAP.
|
450
|
-
|
451
|
-
## Using this Adapter
|
452
|
-
|
453
|
-
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.
|
454
|
-
|
455
|
-
### Generic Adapter Calls
|
456
|
-
|
457
|
-
The `connect` call is run when the Adapter is first loaded by he Itential Platform. It validates the properties have been provided correctly.
|
458
|
-
```js
|
459
|
-
connect()
|
460
|
-
```
|
461
|
-
|
462
|
-
The `healthCheck` call ensures that the adapter can communicate with Meraki. The actual call that is used is defined in the adapter properties.
|
463
|
-
```js
|
464
|
-
healthCheck(callback)
|
465
|
-
```
|
466
|
-
|
467
|
-
The `refreshProperties` call provides the adapter the ability to accept property changes without having to restart the adapter.
|
468
|
-
```js
|
469
|
-
refreshProperties(properties)
|
470
|
-
```
|
471
|
-
|
472
|
-
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 Meraki.
|
473
|
-
```js
|
474
|
-
encryptProperty(property, technique, callback)
|
475
|
-
```
|
476
|
-
|
477
|
-
The `addEntityCache` call will take the entities and add the list to the entity cache to expedite performance.
|
478
|
-
```js
|
479
|
-
addEntityCache(entityType, entities, key, callback)
|
480
|
-
```
|
481
|
-
|
482
|
-
The `capabilityResults` call will take the results from a verifyCompatibility and put them in the format to be passed back to the Itential Platform.
|
483
|
-
```js
|
484
|
-
capabilityResults(results, callback)
|
485
|
-
```
|
486
|
-
|
487
|
-
The `hasEntity` call verifies the adapter has the specific entity.
|
488
|
-
```js
|
489
|
-
hasEntity(entityType, entityId, callback)
|
490
|
-
```
|
491
|
-
|
492
|
-
The `verifyCapability` call verifies the adapter can perform the provided action on the specific entity.
|
493
|
-
```js
|
494
|
-
verifyCapability(entityType, actionType, entityId, callback)
|
495
|
-
```
|
496
|
-
|
497
|
-
The `updateEntityCache` call will update the entity cache.
|
498
|
-
```js
|
499
|
-
updateEntityCache()
|
500
|
-
```
|
501
|
-
|
502
|
-
The `updateAdapterConfiguration` call provides the ability to update the adapter configuration from IAP - includes actions, schema, mockdata and other configurations.
|
503
|
-
```js
|
504
|
-
updateAdapterConfiguration(configFile, changes, entity, type, action, callback)
|
505
|
-
```
|
506
|
-
|
507
|
-
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.
|
508
|
-
```js
|
509
|
-
suspend(mode, callback)
|
510
|
-
```
|
511
|
-
|
512
|
-
The `unsuspend` call provides the ability to resume a suspended adapter. Any requests in queue will be processed before new requests.
|
513
|
-
```js
|
514
|
-
unsuspend(callback)
|
515
|
-
```
|
516
|
-
|
517
|
-
The `findPath` call provides the ability to see if a particular API path is supported by the adapter.
|
518
|
-
```js
|
519
|
-
findPath(apiPath, callback)
|
520
|
-
```
|
521
|
-
|
522
|
-
The `troubleshoot` call can be used to check on the performance of the adapter - it checks connectivity, healthcheck and basic get calls.
|
523
|
-
```js
|
524
|
-
troubleshoot(props, persistFlag, adapter, callback)
|
525
|
-
```
|
526
|
-
|
527
|
-
The `runHealthcheck` call will return the results of a healthcheck.
|
528
|
-
```js
|
529
|
-
runHealthcheck(adapter, callback)
|
530
|
-
```
|
531
|
-
|
532
|
-
The `runConnectivity` call will return the results of a connectivity check.
|
533
|
-
```js
|
534
|
-
runConnectivity(callback)
|
535
|
-
```
|
536
|
-
|
537
|
-
The `runBasicGet` call will return the results of running basic get API calls.
|
538
|
-
```js
|
539
|
-
runBasicGet(callback)
|
540
|
-
```
|
541
|
-
|
542
|
-
The `getQueue` call will return the requests that are waiting in the queue if throttling is enabled.
|
543
|
-
```js
|
544
|
-
getQueue(callback)
|
545
|
-
```
|
546
|
-
|
547
|
-
### Specific Adapter Calls
|
548
|
-
|
549
|
-
Specific adapter calls are built based on the API of the Meraki. 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.
|
550
|
-
|
551
|
-
## Troubleshooting the Adapter
|
552
|
-
|
553
|
-
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.
|
554
|
-
|
555
|
-
User also have the option to run individual command to perform specific test
|
556
|
-
|
557
|
-
- `npm run healthcheck` will perform a healthcheck request of with current setting.
|
558
|
-
- `npm run basicget` will perform some non-parameter GET request with current setting.
|
559
|
-
- `npm run connectivity` will perform networking diagnostics of the adatper endpoint.
|
560
|
-
|
561
|
-
### Connectivity Issues
|
562
|
-
|
563
|
-
1. You can run the adapter troubleshooting script which will check connectivity, run the healthcheck and run basic get calls.
|
564
|
-
|
565
|
-
```bash
|
566
|
-
npm run troubleshoot
|
567
|
-
```
|
568
|
-
|
569
|
-
1. Verify the adapter properties are set up correctly.
|
570
|
-
|
571
|
-
```text
|
572
|
-
Go into the Itential Platform GUI and verify/update the properties
|
573
|
-
```
|
574
|
-
|
575
|
-
1. Verify there is connectivity between the Itential Platform Server and Meraki Server.
|
576
|
-
|
577
|
-
```text
|
578
|
-
ping the ip address of Meraki server
|
579
|
-
try telnet to the ip address port of Meraki
|
580
|
-
```
|
581
|
-
|
582
|
-
1. Verify the credentials provided for Meraki.
|
583
|
-
|
584
|
-
```text
|
585
|
-
login to Meraki using the provided credentials
|
586
|
-
```
|
587
|
-
|
588
|
-
1. Verify the API of the call utilized for Meraki Healthcheck.
|
589
|
-
|
590
|
-
```text
|
591
|
-
Go into the Itential Platform GUI and verify/update the properties
|
592
|
-
```
|
593
|
-
|
594
|
-
### Functional Issues
|
595
|
-
|
596
|
-
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.
|
597
|
-
|
598
|
-
## Contributing to Meraki
|
599
|
-
|
600
|
-
Please check out the [Contributing Guidelines](./CONTRIBUTING.md).
|
243
|
+
| npm run basicget | Checks whether the basic get calls works to Meraki.|
|
601
244
|
|
602
|
-
##
|
245
|
+
## [Troubleshoot](./TROUBLESHOOT.md)
|
603
246
|
|
604
|
-
|
247
|
+
## License and Maintainers
|
605
248
|
|
606
249
|
```text
|
607
|
-
Itential Product Adapters are maintained by the Itential
|
608
|
-
Itential OpenSource Adapters are maintained by the community at large.
|
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.
|
609
252
|
Custom Adapters are maintained by other sources.
|
610
253
|
```
|
611
254
|
|
612
|
-
|
255
|
+
## Product License
|
613
256
|
|
614
257
|
[Apache 2.0](./LICENSE)
|