@itentialopensource/adapter-aruba_airwave 0.1.1

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 (58) hide show
  1. package/.eslintignore +6 -0
  2. package/.eslintrc.js +18 -0
  3. package/.gitlab/.gitkeep +0 -0
  4. package/.gitlab/issue_templates/.gitkeep +0 -0
  5. package/.gitlab/issue_templates/Default.md +17 -0
  6. package/.gitlab/issue_templates/bugReportTemplate.md +76 -0
  7. package/.gitlab/issue_templates/featureRequestTemplate.md +14 -0
  8. package/.jshintrc +0 -0
  9. package/CHANGELOG.md +9 -0
  10. package/CODE_OF_CONDUCT.md +48 -0
  11. package/CONTRIBUTING.md +158 -0
  12. package/LICENSE +201 -0
  13. package/README.md +544 -0
  14. package/adapter.js +2860 -0
  15. package/adapterBase.js +906 -0
  16. package/entities/.system/action.json +50 -0
  17. package/entities/.system/mockdatafiles/getToken-default.json +3 -0
  18. package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
  19. package/entities/.system/schema.json +19 -0
  20. package/entities/.system/schemaTokenReq.json +77 -0
  21. package/entities/.system/schemaTokenResp.json +65 -0
  22. package/entities/BatchExecuteAPCommandsAPIS/action.json +45 -0
  23. package/entities/BatchExecuteAPCommandsAPIS/schema.json +20 -0
  24. package/entities/ConfigurationAPIS/action.json +126 -0
  25. package/entities/ConfigurationAPIS/schema.json +90 -0
  26. package/entities/DeviceAPIS/action.json +46 -0
  27. package/entities/DeviceAPIS/schema.json +20 -0
  28. package/entities/LOGIN/action.json +24 -0
  29. package/entities/LOGIN/schema.json +41 -0
  30. package/entities/QueryAPIS/action.json +298 -0
  31. package/entities/QueryAPIS/schema.json +32 -0
  32. package/entities/ReportAPIS/action.json +25 -0
  33. package/entities/ReportAPIS/schema.json +30 -0
  34. package/entities/SearchAPIS/action.json +67 -0
  35. package/entities/SearchAPIS/schema.json +21 -0
  36. package/error.json +184 -0
  37. package/package.json +86 -0
  38. package/pronghorn.json +1589 -0
  39. package/propertiesSchema.json +801 -0
  40. package/refs?service=git-upload-pack +0 -0
  41. package/report/ArubaAirwavePostman.json-OpenApi3Json.json +1583 -0
  42. package/report/creationReport.json +381 -0
  43. package/sampleProperties.json +97 -0
  44. package/test/integration/adapterTestBasicGet.js +85 -0
  45. package/test/integration/adapterTestConnectivity.js +93 -0
  46. package/test/integration/adapterTestIntegration.js +1125 -0
  47. package/test/unit/adapterBaseTestUnit.js +929 -0
  48. package/test/unit/adapterTestUnit.js +1413 -0
  49. package/utils/artifactize.js +146 -0
  50. package/utils/basicGet.js +63 -0
  51. package/utils/packModificationScript.js +35 -0
  52. package/utils/pre-commit.sh +27 -0
  53. package/utils/setup.js +33 -0
  54. package/utils/tbScript.js +163 -0
  55. package/utils/tbUtils.js +372 -0
  56. package/utils/testRunner.js +298 -0
  57. package/utils/troubleshootingAdapter.js +219 -0
  58. package/workflows/README.md +3 -0
@@ -0,0 +1,381 @@
1
+ {
2
+ "errors": [],
3
+ "statistics": [
4
+ {
5
+ "owner": "errorJson",
6
+ "description": "Standard adapter errors available for use",
7
+ "value": 30
8
+ },
9
+ {
10
+ "owner": "packageJson",
11
+ "description": "Number of production dependencies",
12
+ "value": 5
13
+ },
14
+ {
15
+ "owner": "packageJson",
16
+ "description": "Number of development dependencies",
17
+ "value": 12
18
+ },
19
+ {
20
+ "owner": "packageJson",
21
+ "description": "Number of npm scripts",
22
+ "value": 16
23
+ },
24
+ {
25
+ "owner": "packageJson",
26
+ "description": "Runtime Library dependency",
27
+ "value": "^4.38.0"
28
+ },
29
+ {
30
+ "owner": "propertiesSchemaJson",
31
+ "description": "Adapter properties defined in the propertiesSchema file",
32
+ "value": 56
33
+ },
34
+ {
35
+ "owner": "adapterJS",
36
+ "description": "Lines of code generated in adapter.js",
37
+ "value": 2696
38
+ },
39
+ {
40
+ "owner": "adapterJS",
41
+ "description": "Number of Functions added to adapter.js",
42
+ "value": 27
43
+ },
44
+ {
45
+ "owner": "pronghornJson",
46
+ "description": "Number of Methods added to pronghorn.json",
47
+ "value": 27
48
+ },
49
+ {
50
+ "owner": "readmeMd",
51
+ "description": "Number of lines in the README.md",
52
+ "value": 545
53
+ },
54
+ {
55
+ "owner": "unitTestJS",
56
+ "description": "Number of lines of code in unit tests",
57
+ "value": 1414
58
+ },
59
+ {
60
+ "owner": "unitTestJS",
61
+ "description": "Number of unit tests",
62
+ "value": 76
63
+ },
64
+ {
65
+ "owner": "integrationTestJS",
66
+ "description": "Number of lines of code in integration tests",
67
+ "value": 1126
68
+ },
69
+ {
70
+ "owner": "integrationTestJS",
71
+ "description": "Number of integration tests",
72
+ "value": 32
73
+ },
74
+ {
75
+ "owner": "actionJson",
76
+ "description": "Number of actions for QueryAPIS entity",
77
+ "value": 14
78
+ },
79
+ {
80
+ "owner": "actionJson",
81
+ "description": "Number of actions for ConfigurationAPIS entity",
82
+ "value": 6
83
+ },
84
+ {
85
+ "owner": "actionJson",
86
+ "description": "Number of actions for SearchAPIS entity",
87
+ "value": 3
88
+ },
89
+ {
90
+ "owner": "actionJson",
91
+ "description": "Number of actions for ReportAPIS entity",
92
+ "value": 1
93
+ },
94
+ {
95
+ "owner": "actionJson",
96
+ "description": "Number of actions for BatchExecuteAPCommandsAPIS entity",
97
+ "value": 2
98
+ },
99
+ {
100
+ "owner": "actionJson",
101
+ "description": "Number of actions for LOGIN entity",
102
+ "value": 1
103
+ },
104
+ {
105
+ "owner": "actionJson",
106
+ "description": "Total number of actions",
107
+ "value": 27
108
+ },
109
+ {
110
+ "owner": "actionJson",
111
+ "description": "Total number of entities",
112
+ "value": 6
113
+ },
114
+ {
115
+ "owner": "schemaJson",
116
+ "description": "Number of schemas for QueryAPIS entity",
117
+ "value": 1
118
+ },
119
+ {
120
+ "owner": "schemaJson",
121
+ "description": "Number of schemas for ConfigurationAPIS entity",
122
+ "value": 1
123
+ },
124
+ {
125
+ "owner": "schemaJson",
126
+ "description": "Number of schemas for SearchAPIS entity",
127
+ "value": 1
128
+ },
129
+ {
130
+ "owner": "schemaJson",
131
+ "description": "Number of schemas for ReportAPIS entity",
132
+ "value": 1
133
+ },
134
+ {
135
+ "owner": "schemaJson",
136
+ "description": "Number of schemas for BatchExecuteAPCommandsAPIS entity",
137
+ "value": 1
138
+ },
139
+ {
140
+ "owner": "schemaJson",
141
+ "description": "Number of schemas for LOGIN entity",
142
+ "value": 1
143
+ },
144
+ {
145
+ "owner": "schemaJson",
146
+ "description": "Total number of schemas",
147
+ "value": 6
148
+ },
149
+ {
150
+ "owner": "mockdata",
151
+ "description": "Number of mock data files for QueryAPIS entity",
152
+ "value": 0
153
+ },
154
+ {
155
+ "owner": "mockdata",
156
+ "description": "Number of mock data files for ConfigurationAPIS entity",
157
+ "value": 0
158
+ },
159
+ {
160
+ "owner": "mockdata",
161
+ "description": "Number of mock data files for SearchAPIS entity",
162
+ "value": 0
163
+ },
164
+ {
165
+ "owner": "mockdata",
166
+ "description": "Number of mock data files for ReportAPIS entity",
167
+ "value": 0
168
+ },
169
+ {
170
+ "owner": "mockdata",
171
+ "description": "Number of mock data files for BatchExecuteAPCommandsAPIS entity",
172
+ "value": 0
173
+ },
174
+ {
175
+ "owner": "mockdata",
176
+ "description": "Number of mock data files for LOGIN entity",
177
+ "value": 0
178
+ },
179
+ {
180
+ "owner": "mockdata",
181
+ "description": "Total number of mock data files",
182
+ "value": 0
183
+ },
184
+ {
185
+ "owner": "actionJson",
186
+ "description": "Number of actions for .system entity",
187
+ "value": 2
188
+ },
189
+ {
190
+ "owner": "schemaJson",
191
+ "description": "Number of schemas for .system entity",
192
+ "value": 3
193
+ },
194
+ {
195
+ "owner": "mockdata",
196
+ "description": "Number of mock data files for .system entity",
197
+ "value": 2
198
+ },
199
+ {
200
+ "owner": "System",
201
+ "description": "System entity files",
202
+ "value": 6
203
+ },
204
+ {
205
+ "owner": "usecases",
206
+ "description": "Number of workflows",
207
+ "value": 0
208
+ },
209
+ {
210
+ "owner": "staticFile",
211
+ "description": "Number of lines of code in adapterBase.js",
212
+ "value": 907
213
+ },
214
+ {
215
+ "owner": "staticFile",
216
+ "description": "Number of static files added",
217
+ "value": 26
218
+ },
219
+ {
220
+ "owner": "Overall",
221
+ "description": "Total lines of Code",
222
+ "value": 6143
223
+ },
224
+ {
225
+ "owner": "Overall",
226
+ "description": "Total Tests",
227
+ "value": 108
228
+ },
229
+ {
230
+ "owner": "Overall",
231
+ "description": "Total Files",
232
+ "value": 52
233
+ }
234
+ ],
235
+ "apiParsingReport": {
236
+ "no_mockdata": [
237
+ {
238
+ "fnName": "aMPStats",
239
+ "method": "get",
240
+ "path": "/amp_stats.xml"
241
+ },
242
+ {
243
+ "fnName": "folderList",
244
+ "method": "get",
245
+ "path": "/folder_list.xml"
246
+ },
247
+ {
248
+ "fnName": "catalogRepository",
249
+ "method": "get",
250
+ "path": "/static/catalog_repository.xml"
251
+ },
252
+ {
253
+ "fnName": "alertList",
254
+ "method": "get",
255
+ "path": "/alerts.xml"
256
+ },
257
+ {
258
+ "fnName": "aPList",
259
+ "method": "get",
260
+ "path": "/ap_list.xml"
261
+ },
262
+ {
263
+ "fnName": "aPBSSIDList",
264
+ "method": "get",
265
+ "path": "/api/ap_bssid_list.xml"
266
+ },
267
+ {
268
+ "fnName": "aPDetail",
269
+ "method": "get",
270
+ "path": "/ap_detail.xml"
271
+ },
272
+ {
273
+ "fnName": "aPLog",
274
+ "method": "get",
275
+ "path": "/ap_log.xml"
276
+ },
277
+ {
278
+ "fnName": "rogueDetail",
279
+ "method": "get",
280
+ "path": "/rogue_detail.xml"
281
+ },
282
+ {
283
+ "fnName": "clientDetail",
284
+ "method": "get",
285
+ "path": "/client_detail.xml"
286
+ },
287
+ {
288
+ "fnName": "visualRFConfig",
289
+ "method": "get",
290
+ "path": "/visualrf_config.xml"
291
+ },
292
+ {
293
+ "fnName": "userInfo",
294
+ "method": "get",
295
+ "path": "/user_info.xml"
296
+ },
297
+ {
298
+ "fnName": "deviceRRDInfo",
299
+ "method": "get",
300
+ "path": "/device_rrd_info.xml"
301
+ },
302
+ {
303
+ "fnName": "clientRRDInfo",
304
+ "method": "get",
305
+ "path": "/user_rrd_info.xml"
306
+ },
307
+ {
308
+ "fnName": "changeSet",
309
+ "method": "post",
310
+ "path": "/site_changes"
311
+ },
312
+ {
313
+ "fnName": "guestUserCreateUser",
314
+ "method": "post",
315
+ "path": "/guest_user_api"
316
+ },
317
+ {
318
+ "fnName": "modifyTemplateVariables",
319
+ "method": "post",
320
+ "path": "/template_variable_api"
321
+ },
322
+ {
323
+ "fnName": "importAPWhitelist",
324
+ "method": "post",
325
+ "path": "/api/ap_whitelist_upload"
326
+ },
327
+ {
328
+ "fnName": "deauthenticateClient",
329
+ "method": "get",
330
+ "path": "/deauthenticate_user.xml"
331
+ },
332
+ {
333
+ "fnName": "downStatusMessage",
334
+ "method": "get",
335
+ "path": "/down_status_message.xml"
336
+ },
337
+ {
338
+ "fnName": "aPSearch",
339
+ "method": "get",
340
+ "path": "/ap_search.xml"
341
+ },
342
+ {
343
+ "fnName": "clientSearch",
344
+ "method": "get",
345
+ "path": "/client_search.xml"
346
+ },
347
+ {
348
+ "fnName": "vPNUserSearch",
349
+ "method": "get",
350
+ "path": "/vpn_user_search.xml"
351
+ },
352
+ {
353
+ "fnName": "latestReport",
354
+ "method": "get",
355
+ "path": "/latest_report.xml"
356
+ },
357
+ {
358
+ "fnName": "batchExecuteAPCommand",
359
+ "method": "post",
360
+ "path": "/api/batch_command_execute"
361
+ },
362
+ {
363
+ "fnName": "batchExecuteAPCommandResult",
364
+ "method": "get",
365
+ "path": "/api/batch_command_execute_result"
366
+ },
367
+ {
368
+ "fnName": "aMPLogin",
369
+ "method": "post",
370
+ "path": "/LOGIN"
371
+ }
372
+ ],
373
+ "errors": [],
374
+ "warnings": [
375
+ "Method post in path /guest_user_api has 2 parameters with the same name. Parameter name changed to bodyFormData to avoid errors."
376
+ ],
377
+ "callsTotal": 27,
378
+ "callsConverted": 27,
379
+ "no_mockdata_num": 27
380
+ }
381
+ }
@@ -0,0 +1,97 @@
1
+ {
2
+ "id": "Adapter-aruba_airwave",
3
+ "type": "ArubaAirwave",
4
+ "properties": {
5
+ "host": "localhost",
6
+ "port": 443,
7
+ "base_path": "/",
8
+ "version": "",
9
+ "cache_location": "none",
10
+ "save_metric": true,
11
+ "stub": true,
12
+ "protocol": "https",
13
+ "authentication": {
14
+ "auth_method": "no_authentication",
15
+ "username": "username",
16
+ "password": "password",
17
+ "token": "token",
18
+ "token_timeout": 600000,
19
+ "token_cache": "local",
20
+ "invalid_token_error": 401,
21
+ "auth_field": "header.headers.Authorization",
22
+ "auth_field_format": "Basic {b64}{username}:{password}{/b64}"
23
+ },
24
+ "healthcheck": {
25
+ "type": "none",
26
+ "frequency": 60000
27
+ },
28
+ "throttle": {
29
+ "throttle_enabled": false,
30
+ "number_pronghorns": 1,
31
+ "sync_async": "sync",
32
+ "max_in_queue": 1000,
33
+ "concurrent_max": 1,
34
+ "expire_timeout": 0,
35
+ "avg_runtime": 200,
36
+ "priorities": [
37
+ {
38
+ "value": 0,
39
+ "percent": 100
40
+ }
41
+ ]
42
+ },
43
+ "request": {
44
+ "number_redirects": 0,
45
+ "number_retries": 3,
46
+ "limit_retry_error": [
47
+ 0
48
+ ],
49
+ "failover_codes": [],
50
+ "attempt_timeout": 5000,
51
+ "global_request": {
52
+ "payload": {},
53
+ "uriOptions": {},
54
+ "addlHeaders": {},
55
+ "authData": {}
56
+ },
57
+ "healthcheck_on_timeout": true,
58
+ "return_raw": false,
59
+ "archiving": false
60
+ },
61
+ "proxy": {
62
+ "enabled": false,
63
+ "host": "",
64
+ "port": 1,
65
+ "protocol": "http"
66
+ },
67
+ "ssl": {
68
+ "ecdhCurve": "",
69
+ "enabled": false,
70
+ "accept_invalid_cert": false,
71
+ "ca_file": "",
72
+ "key_file": "",
73
+ "cert_file": "",
74
+ "secure_protocol": "",
75
+ "ciphers": ""
76
+ },
77
+ "mongo": {
78
+ "host": "",
79
+ "port": 0,
80
+ "database": "",
81
+ "username": "",
82
+ "password": "",
83
+ "replSet": "",
84
+ "db_ssl": {
85
+ "enabled": false,
86
+ "accept_invalid_cert": false,
87
+ "ca_file": "",
88
+ "key_file": "",
89
+ "cert_file": ""
90
+ }
91
+ }
92
+ },
93
+ "groups": [],
94
+ "brokers": [],
95
+ "logLevel": "none",
96
+ "timeout": 120000
97
+ }
@@ -0,0 +1,85 @@
1
+ /* @copyright Itential, LLC 2020 */
2
+
3
+ /* global describe context before after */
4
+ /* eslint global-require: warn */
5
+ /* eslint no-unused-vars: warn */
6
+ /* eslint import/no-extraneous-dependencies: warn */
7
+ /* eslint import/no-dynamic-require: warn */
8
+ /* eslint import/no-unresolved: warn */
9
+
10
+ const mocha = require('mocha');
11
+ const path = require('path');
12
+ const assert = require('assert');
13
+ const itParam = require('mocha-param');
14
+
15
+ const utils = require('../../utils/tbUtils');
16
+ const basicGet = require('../../utils/basicGet');
17
+ const { name } = require('../../package.json');
18
+ const { methods } = require('../../pronghorn.json');
19
+
20
+ const getPronghornProps = (iapDir) => {
21
+ const { Discovery } = require('@itential/itential-utils');
22
+ console.log('Retrieving properties.json file...');
23
+ const rawProps = require(path.join(iapDir, 'properties.json'));
24
+ console.log('Decrypting properties...');
25
+ const discovery = new Discovery();
26
+ const pronghornProps = utils.decryptProperties(rawProps, path.join(__dirname, '..'), discovery);
27
+ console.log('Found properties.\n');
28
+ return pronghornProps;
29
+ };
30
+
31
+ let a;
32
+
33
+ describe('[integration] Adapter BasicGET Test', () => {
34
+ context('Testing GET calls without query parameters', () => {
35
+ before(async () => {
36
+ const iapDir = path.join(__dirname, '../../../../../');
37
+ if (!utils.withinIAP(iapDir)) {
38
+ const sampleProperties = require('../../sampleProperties.json');
39
+ const adapter = { properties: sampleProperties };
40
+ a = basicGet.getAdapterInstance(adapter);
41
+ } else {
42
+ const pronghornProps = getPronghornProps(iapDir);
43
+ console.log('Connecting to Database...');
44
+ const database = await basicGet.connect(pronghornProps);
45
+ console.log('Connection established.');
46
+ const adapter = await database.collection(utils.SERVICE_CONFIGS_COLLECTION).findOne(
47
+ { model: name }
48
+ );
49
+ a = basicGet.getAdapterInstance(adapter);
50
+ }
51
+ });
52
+
53
+ after((done) => {
54
+ done();
55
+ });
56
+
57
+ const basicGets = methods.filter((method) => (method.route.verb === 'GET' && method.input.length === 0));
58
+ if (basicGets.length === 0) {
59
+ console.log('No non-parameter GET calls found.');
60
+ process.exit(0);
61
+ }
62
+ const functionNames = basicGets.map((g) => g.name);
63
+ const request = function request(f, ad) {
64
+ return new Promise((resolve, reject) => {
65
+ const getRespCode = (resp) => {
66
+ if (resp) {
67
+ if (resp.metrics.code !== 200) {
68
+ console.log('\x1b[31m', `Testing ${f} \nResponseCode: ${resp.metrics.code}`);
69
+ }
70
+ resolve(resp.metrics.code);
71
+ } else {
72
+ console.log('\x1b[31m', `call ${f} results in failure`);
73
+ reject(new Error(`${f} failed`));
74
+ }
75
+ };
76
+ ad[f](getRespCode, console.log);
77
+ });
78
+ };
79
+
80
+ itParam('GET call should return 200', functionNames, (fname) => {
81
+ console.log(`\t ${fname}`);
82
+ return request(fname, a).then((result) => assert.equal(result, 200));
83
+ });
84
+ });
85
+ });
@@ -0,0 +1,93 @@
1
+ /* @copyright Itential, LLC 2020 */
2
+
3
+ /* global describe it context before after */
4
+ /* eslint no-unused-vars: warn */
5
+
6
+ const mocha = require('mocha');
7
+ const assert = require('assert');
8
+ const diagnostics = require('network-diagnostics');
9
+
10
+ let host;
11
+ process.argv.forEach((val) => {
12
+ if (val.indexOf('--HOST') === 0) {
13
+ [, host] = val.split('=');
14
+ }
15
+ });
16
+
17
+ describe('[integration] Adapter Test', () => {
18
+ context(`Testing network connection on ${host}`, () => {
19
+ before(() => {
20
+ diagnostics.setTestURL(host);
21
+ });
22
+
23
+ after((done) => {
24
+ done();
25
+ });
26
+
27
+ it('DNS resolve', (done) => {
28
+ diagnostics.haveDNS((result) => {
29
+ try {
30
+ assert.equal(result, true);
31
+ done();
32
+ } catch (error) {
33
+ done(error);
34
+ }
35
+ });
36
+ });
37
+
38
+ it('Responds to ping', (done) => {
39
+ diagnostics.havePing((result) => {
40
+ try {
41
+ assert.equal(result, true);
42
+ done();
43
+ } catch (error) {
44
+ done(error);
45
+ }
46
+ });
47
+ });
48
+
49
+ it('Support HTTP on port 80', (done) => {
50
+ diagnostics.haveHTTP((result) => {
51
+ try {
52
+ assert.equal(result, true);
53
+ done();
54
+ } catch (error) {
55
+ done(error);
56
+ }
57
+ });
58
+ });
59
+
60
+ it('Support HTTPS on port 443', (done) => {
61
+ diagnostics.haveHTTPS((result) => {
62
+ try {
63
+ assert.equal(result, true);
64
+ done();
65
+ } catch (error) {
66
+ done(error);
67
+ }
68
+ });
69
+ });
70
+
71
+ it('Support IPv4', (done) => {
72
+ diagnostics.haveIPv4Async((result) => {
73
+ try {
74
+ assert.equal(result, true);
75
+ done();
76
+ } catch (error) {
77
+ done(error);
78
+ }
79
+ });
80
+ });
81
+
82
+ it('Support IPv6', (done) => {
83
+ diagnostics.haveIPv6Async((result) => {
84
+ try {
85
+ assert.equal(result, true);
86
+ done();
87
+ } catch (error) {
88
+ done(error);
89
+ }
90
+ });
91
+ });
92
+ });
93
+ });