@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,1125 @@
1
+ /* @copyright Itential, LLC 2019 (pre-modifications) */
2
+
3
+ // Set globals
4
+ /* global describe it log pronghornProps */
5
+ /* eslint no-unused-vars: warn */
6
+
7
+ // include required items for testing & logging
8
+ const assert = require('assert');
9
+ const fs = require('fs');
10
+ const mocha = require('mocha');
11
+ const path = require('path');
12
+ const winston = require('winston');
13
+ const { expect } = require('chai');
14
+ const { use } = require('chai');
15
+ const td = require('testdouble');
16
+
17
+ const anything = td.matchers.anything();
18
+
19
+ // stub and attemptTimeout are used throughout the code so set them here
20
+ let logLevel = 'none';
21
+ const stub = true;
22
+ const isRapidFail = false;
23
+ const isSaveMockData = false;
24
+ const attemptTimeout = 55000;
25
+
26
+ // these variables can be changed to run in integrated mode so easier to set them here
27
+ // always check these in with bogus data!!!
28
+ const host = 'replace.hostorip.here';
29
+ const username = 'username';
30
+ const password = 'password';
31
+ const protocol = 'http';
32
+ const port = 80;
33
+ const sslenable = false;
34
+ const sslinvalid = false;
35
+
36
+ // these are the adapter properties. You generally should not need to alter
37
+ // any of these after they are initially set up
38
+ global.pronghornProps = {
39
+ pathProps: {
40
+ encrypted: false
41
+ },
42
+ adapterProps: {
43
+ adapters: [{
44
+ id: 'Test-aruba_airwave',
45
+ type: 'ArubaAirwave',
46
+ properties: {
47
+ host,
48
+ port,
49
+ base_path: '/',
50
+ version: '',
51
+ cache_location: 'none',
52
+ encode_pathvars: true,
53
+ save_metric: false,
54
+ stub,
55
+ protocol,
56
+ authentication: {
57
+ auth_method: 'no_authentication',
58
+ username,
59
+ password,
60
+ token: '',
61
+ invalid_token_error: 401,
62
+ token_timeout: -1,
63
+ token_cache: 'local',
64
+ auth_field: 'header.headers.Authorization',
65
+ auth_field_format: 'Basic {b64}{username}:{password}{/b64}'
66
+ },
67
+ healthcheck: {
68
+ type: 'none',
69
+ frequency: 60000
70
+ },
71
+ throttle: {
72
+ throttle_enabled: false,
73
+ number_pronghorns: 1,
74
+ sync_async: 'sync',
75
+ max_in_queue: 1000,
76
+ concurrent_max: 1,
77
+ expire_timeout: 0,
78
+ avg_runtime: 200,
79
+ priorities: [
80
+ {
81
+ value: 0,
82
+ percent: 100
83
+ }
84
+ ]
85
+ },
86
+ request: {
87
+ number_redirects: 0,
88
+ number_retries: 3,
89
+ limit_retry_error: [0],
90
+ failover_codes: [],
91
+ attempt_timeout: attemptTimeout,
92
+ global_request: {
93
+ payload: {},
94
+ uriOptions: {},
95
+ addlHeaders: {},
96
+ authData: {}
97
+ },
98
+ healthcheck_on_timeout: true,
99
+ return_raw: true,
100
+ archiving: false
101
+ },
102
+ proxy: {
103
+ enabled: false,
104
+ host: '',
105
+ port: 1,
106
+ protocol: 'http'
107
+ },
108
+ ssl: {
109
+ ecdhCurve: '',
110
+ enabled: sslenable,
111
+ accept_invalid_cert: sslinvalid,
112
+ ca_file: '',
113
+ key_file: '',
114
+ cert_file: '',
115
+ secure_protocol: '',
116
+ ciphers: ''
117
+ },
118
+ mongo: {
119
+ host: '',
120
+ port: 0,
121
+ database: '',
122
+ username: '',
123
+ password: '',
124
+ replSet: '',
125
+ db_ssl: {
126
+ enabled: false,
127
+ accept_invalid_cert: false,
128
+ ca_file: '',
129
+ key_file: '',
130
+ cert_file: ''
131
+ }
132
+ }
133
+ }
134
+ }]
135
+ }
136
+ };
137
+
138
+ global.$HOME = `${__dirname}/../..`;
139
+
140
+ // set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
141
+ // this you may error on log.trace calls.
142
+ const myCustomLevels = {
143
+ levels: {
144
+ spam: 6,
145
+ trace: 5,
146
+ debug: 4,
147
+ info: 3,
148
+ warn: 2,
149
+ error: 1,
150
+ none: 0
151
+ }
152
+ };
153
+
154
+ // need to see if there is a log level passed in
155
+ process.argv.forEach((val) => {
156
+ // is there a log level defined to be passed in?
157
+ if (val.indexOf('--LOG') === 0) {
158
+ // get the desired log level
159
+ const inputVal = val.split('=')[1];
160
+
161
+ // validate the log level is supported, if so set it
162
+ if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
163
+ logLevel = inputVal;
164
+ }
165
+ }
166
+ });
167
+
168
+ // need to set global logging
169
+ global.log = winston.createLogger({
170
+ level: logLevel,
171
+ levels: myCustomLevels.levels,
172
+ transports: [
173
+ new winston.transports.Console()
174
+ ]
175
+ });
176
+
177
+ /**
178
+ * Runs the common asserts for test
179
+ */
180
+ function runCommonAsserts(data, error) {
181
+ assert.equal(undefined, error);
182
+ assert.notEqual(undefined, data);
183
+ assert.notEqual(null, data);
184
+ assert.notEqual(undefined, data.response);
185
+ assert.notEqual(null, data.response);
186
+ }
187
+
188
+ /**
189
+ * Runs the error asserts for the test
190
+ */
191
+ function runErrorAsserts(data, error, code, origin, displayStr) {
192
+ assert.equal(null, data);
193
+ assert.notEqual(undefined, error);
194
+ assert.notEqual(null, error);
195
+ assert.notEqual(undefined, error.IAPerror);
196
+ assert.notEqual(null, error.IAPerror);
197
+ assert.notEqual(undefined, error.IAPerror.displayString);
198
+ assert.notEqual(null, error.IAPerror.displayString);
199
+ assert.equal(code, error.icode);
200
+ assert.equal(origin, error.IAPerror.origin);
201
+ assert.equal(displayStr, error.IAPerror.displayString);
202
+ }
203
+
204
+ /**
205
+ * @function saveMockData
206
+ * Attempts to take data from responses and place them in MockDataFiles to help create Mockdata.
207
+ * Note, this was built based on entity file structure for Adapter-Engine 1.6.x
208
+ * @param {string} entityName - Name of the entity saving mock data for
209
+ * @param {string} actionName - Name of the action saving mock data for
210
+ * @param {string} descriptor - Something to describe this test (used as a type)
211
+ * @param {string or object} responseData - The data to put in the mock file.
212
+ */
213
+ function saveMockData(entityName, actionName, descriptor, responseData) {
214
+ // do not need to save mockdata if we are running in stub mode (already has mock data) or if told not to save
215
+ if (stub || !isSaveMockData) {
216
+ return false;
217
+ }
218
+
219
+ // must have a response in order to store the response
220
+ if (responseData && responseData.response) {
221
+ let data = responseData.response;
222
+
223
+ // if there was a raw response that one is better as it is untranslated
224
+ if (responseData.raw) {
225
+ data = responseData.raw;
226
+
227
+ try {
228
+ const temp = JSON.parse(data);
229
+ data = temp;
230
+ } catch (pex) {
231
+ // do not care if it did not parse as we will just use data
232
+ }
233
+ }
234
+
235
+ try {
236
+ const base = path.join(__dirname, `../../entities/${entityName}/`);
237
+ const mockdatafolder = 'mockdatafiles';
238
+ const filename = `mockdatafiles/${actionName}-${descriptor}.json`;
239
+
240
+ if (!fs.existsSync(base + mockdatafolder)) {
241
+ fs.mkdirSync(base + mockdatafolder);
242
+ }
243
+
244
+ // write the data we retrieved
245
+ fs.writeFile(base + filename, JSON.stringify(data, null, 2), 'utf8', (errWritingMock) => {
246
+ if (errWritingMock) throw errWritingMock;
247
+
248
+ // update the action file to reflect the changes. Note: We're replacing the default object for now!
249
+ fs.readFile(`${base}action.json`, (errRead, content) => {
250
+ if (errRead) throw errRead;
251
+
252
+ // parse the action file into JSON
253
+ const parsedJson = JSON.parse(content);
254
+
255
+ // The object update we'll write in.
256
+ const responseObj = {
257
+ type: descriptor,
258
+ key: '',
259
+ mockFile: filename
260
+ };
261
+
262
+ // get the object for method we're trying to change.
263
+ const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
264
+
265
+ // if the method was not found - should never happen but...
266
+ if (!currentMethodAction) {
267
+ throw Error('Can\'t find an action for this method in the provided entity.');
268
+ }
269
+
270
+ // if there is a response object, we want to replace the Response object. Otherwise we'll create one.
271
+ const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
272
+
273
+ // Add the action responseObj back into the array of response objects.
274
+ if (!actionResponseObj) {
275
+ // if there is a default response object, we want to get the key.
276
+ const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
277
+
278
+ // save the default key into the new response object
279
+ if (defaultResponseObj) {
280
+ responseObj.key = defaultResponseObj.key;
281
+ }
282
+
283
+ // save the new response object
284
+ currentMethodAction.responseObjects = [responseObj];
285
+ } else {
286
+ // update the location of the mock data file
287
+ actionResponseObj.mockFile = responseObj.mockFile;
288
+ }
289
+
290
+ // Save results
291
+ fs.writeFile(`${base}action.json`, JSON.stringify(parsedJson, null, 2), (err) => {
292
+ if (err) throw err;
293
+ });
294
+ });
295
+ });
296
+ } catch (e) {
297
+ log.debug(`Failed to save mock data for ${actionName}. ${e.message}`);
298
+ return false;
299
+ }
300
+ }
301
+
302
+ // no response to save
303
+ log.debug(`No data passed to save into mockdata for ${actionName}`);
304
+ return false;
305
+ }
306
+
307
+ // require the adapter that we are going to be using
308
+ const ArubaAirwave = require('../../adapter');
309
+
310
+ // begin the testing - these should be pretty well defined between the describe and the it!
311
+ describe('[integration] Aruba_airwave Adapter Test', () => {
312
+ describe('ArubaAirwave Class Tests', () => {
313
+ const a = new ArubaAirwave(
314
+ pronghornProps.adapterProps.adapters[0].id,
315
+ pronghornProps.adapterProps.adapters[0].properties
316
+ );
317
+
318
+ if (isRapidFail) {
319
+ const state = {};
320
+ state.passed = true;
321
+
322
+ mocha.afterEach(function x() {
323
+ state.passed = state.passed
324
+ && (this.currentTest.state === 'passed');
325
+ });
326
+ mocha.beforeEach(function x() {
327
+ if (!state.passed) {
328
+ return this.currentTest.skip();
329
+ }
330
+ return true;
331
+ });
332
+ }
333
+
334
+ describe('#class instance created', () => {
335
+ it('should be a class with properties', (done) => {
336
+ try {
337
+ assert.notEqual(null, a);
338
+ assert.notEqual(undefined, a);
339
+ assert.notEqual(null, a.allProps);
340
+ const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
341
+ assert.equal(check, a.healthcheckType);
342
+ done();
343
+ } catch (error) {
344
+ log.error(`Test Failure: ${error}`);
345
+ done(error);
346
+ }
347
+ }).timeout(attemptTimeout);
348
+ });
349
+
350
+ describe('#connect', () => {
351
+ it('should get connected - no healthcheck', (done) => {
352
+ try {
353
+ a.healthcheckType = 'none';
354
+ a.connect();
355
+
356
+ try {
357
+ assert.equal(true, a.alive);
358
+ done();
359
+ } catch (error) {
360
+ log.error(`Test Failure: ${error}`);
361
+ done(error);
362
+ }
363
+ } catch (error) {
364
+ log.error(`Adapter Exception: ${error}`);
365
+ done(error);
366
+ }
367
+ });
368
+ it('should get connected - startup healthcheck', (done) => {
369
+ try {
370
+ a.healthcheckType = 'startup';
371
+ a.connect();
372
+
373
+ try {
374
+ assert.equal(true, a.alive);
375
+ done();
376
+ } catch (error) {
377
+ log.error(`Test Failure: ${error}`);
378
+ done(error);
379
+ }
380
+ } catch (error) {
381
+ log.error(`Adapter Exception: ${error}`);
382
+ done(error);
383
+ }
384
+ });
385
+ });
386
+
387
+ describe('#healthCheck', () => {
388
+ it('should be healthy', (done) => {
389
+ try {
390
+ a.healthCheck(null, (data) => {
391
+ try {
392
+ assert.equal(true, a.healthy);
393
+ saveMockData('system', 'healthcheck', 'default', data);
394
+ done();
395
+ } catch (err) {
396
+ log.error(`Test Failure: ${err}`);
397
+ done(err);
398
+ }
399
+ });
400
+ } catch (error) {
401
+ log.error(`Adapter Exception: ${error}`);
402
+ done(error);
403
+ }
404
+ }).timeout(attemptTimeout);
405
+ });
406
+
407
+ /*
408
+ -----------------------------------------------------------------------
409
+ -----------------------------------------------------------------------
410
+ *** All code above this comment will be replaced during a migration ***
411
+ ******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
412
+ -----------------------------------------------------------------------
413
+ -----------------------------------------------------------------------
414
+ */
415
+
416
+ describe('#alertList - errors', () => {
417
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
418
+ try {
419
+ a.alertList((data, error) => {
420
+ try {
421
+ if (stub) {
422
+ const displayE = 'Error 400 received on request';
423
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
424
+ } else {
425
+ runCommonAsserts(data, error);
426
+ }
427
+ saveMockData('QueryAPIS', 'alertList', 'default', data);
428
+ done();
429
+ } catch (err) {
430
+ log.error(`Test Failure: ${err}`);
431
+ done(err);
432
+ }
433
+ });
434
+ } catch (error) {
435
+ log.error(`Adapter Exception: ${error}`);
436
+ done(error);
437
+ }
438
+ }).timeout(attemptTimeout);
439
+ });
440
+
441
+ describe('#aMPStats - errors', () => {
442
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
443
+ try {
444
+ a.aMPStats((data, error) => {
445
+ try {
446
+ if (stub) {
447
+ const displayE = 'Error 400 received on request';
448
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
449
+ } else {
450
+ runCommonAsserts(data, error);
451
+ }
452
+ saveMockData('QueryAPIS', 'aMPStats', 'default', data);
453
+ done();
454
+ } catch (err) {
455
+ log.error(`Test Failure: ${err}`);
456
+ done(err);
457
+ }
458
+ });
459
+ } catch (error) {
460
+ log.error(`Adapter Exception: ${error}`);
461
+ done(error);
462
+ }
463
+ }).timeout(attemptTimeout);
464
+ });
465
+
466
+ describe('#aPDetail - errors', () => {
467
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
468
+ try {
469
+ a.aPDetail({}, (data, error) => {
470
+ try {
471
+ if (stub) {
472
+ const displayE = 'Error 400 received on request';
473
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
474
+ } else {
475
+ runCommonAsserts(data, error);
476
+ }
477
+ saveMockData('QueryAPIS', 'aPDetail', 'default', data);
478
+ done();
479
+ } catch (err) {
480
+ log.error(`Test Failure: ${err}`);
481
+ done(err);
482
+ }
483
+ });
484
+ } catch (error) {
485
+ log.error(`Adapter Exception: ${error}`);
486
+ done(error);
487
+ }
488
+ }).timeout(attemptTimeout);
489
+ });
490
+
491
+ describe('#aPList - errors', () => {
492
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
493
+ try {
494
+ a.aPList({}, (data, error) => {
495
+ try {
496
+ if (stub) {
497
+ const displayE = 'Error 400 received on request';
498
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
499
+ } else {
500
+ runCommonAsserts(data, error);
501
+ }
502
+ saveMockData('QueryAPIS', 'aPList', 'default', data);
503
+ done();
504
+ } catch (err) {
505
+ log.error(`Test Failure: ${err}`);
506
+ done(err);
507
+ }
508
+ });
509
+ } catch (error) {
510
+ log.error(`Adapter Exception: ${error}`);
511
+ done(error);
512
+ }
513
+ }).timeout(attemptTimeout);
514
+ });
515
+
516
+ const queryAPISId = 555;
517
+ const queryAPISLimit = 555;
518
+ describe('#aPLog - errors', () => {
519
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
520
+ try {
521
+ a.aPLog(queryAPISId, queryAPISLimit, (data, error) => {
522
+ try {
523
+ if (stub) {
524
+ const displayE = 'Error 400 received on request';
525
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
526
+ } else {
527
+ runCommonAsserts(data, error);
528
+ }
529
+ saveMockData('QueryAPIS', 'aPLog', 'default', data);
530
+ done();
531
+ } catch (err) {
532
+ log.error(`Test Failure: ${err}`);
533
+ done(err);
534
+ }
535
+ });
536
+ } catch (error) {
537
+ log.error(`Adapter Exception: ${error}`);
538
+ done(error);
539
+ }
540
+ }).timeout(attemptTimeout);
541
+ });
542
+
543
+ describe('#aPBSSIDList - errors', () => {
544
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
545
+ try {
546
+ a.aPBSSIDList((data, error) => {
547
+ try {
548
+ if (stub) {
549
+ const displayE = 'Error 400 received on request';
550
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
551
+ } else {
552
+ runCommonAsserts(data, error);
553
+ }
554
+ saveMockData('QueryAPIS', 'aPBSSIDList', 'default', data);
555
+ done();
556
+ } catch (err) {
557
+ log.error(`Test Failure: ${err}`);
558
+ done(err);
559
+ }
560
+ });
561
+ } catch (error) {
562
+ log.error(`Adapter Exception: ${error}`);
563
+ done(error);
564
+ }
565
+ }).timeout(attemptTimeout);
566
+ });
567
+
568
+ const queryAPISMac = 'fakedata';
569
+ describe('#clientDetail - errors', () => {
570
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
571
+ try {
572
+ a.clientDetail(queryAPISMac, (data, error) => {
573
+ try {
574
+ if (stub) {
575
+ const displayE = 'Error 400 received on request';
576
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
577
+ } else {
578
+ runCommonAsserts(data, error);
579
+ }
580
+ saveMockData('QueryAPIS', 'clientDetail', 'default', data);
581
+ done();
582
+ } catch (err) {
583
+ log.error(`Test Failure: ${err}`);
584
+ done(err);
585
+ }
586
+ });
587
+ } catch (error) {
588
+ log.error(`Adapter Exception: ${error}`);
589
+ done(error);
590
+ }
591
+ }).timeout(attemptTimeout);
592
+ });
593
+
594
+ describe('#deviceRRDInfo - errors', () => {
595
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
596
+ try {
597
+ a.deviceRRDInfo((data, error) => {
598
+ try {
599
+ if (stub) {
600
+ const displayE = 'Error 400 received on request';
601
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
602
+ } else {
603
+ runCommonAsserts(data, error);
604
+ }
605
+ saveMockData('QueryAPIS', 'deviceRRDInfo', 'default', data);
606
+ done();
607
+ } catch (err) {
608
+ log.error(`Test Failure: ${err}`);
609
+ done(err);
610
+ }
611
+ });
612
+ } catch (error) {
613
+ log.error(`Adapter Exception: ${error}`);
614
+ done(error);
615
+ }
616
+ }).timeout(attemptTimeout);
617
+ });
618
+
619
+ describe('#folderList - errors', () => {
620
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
621
+ try {
622
+ a.folderList({}, (data, error) => {
623
+ try {
624
+ if (stub) {
625
+ const displayE = 'Error 400 received on request';
626
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
627
+ } else {
628
+ runCommonAsserts(data, error);
629
+ }
630
+ saveMockData('QueryAPIS', 'folderList', 'default', data);
631
+ done();
632
+ } catch (err) {
633
+ log.error(`Test Failure: ${err}`);
634
+ done(err);
635
+ }
636
+ });
637
+ } catch (error) {
638
+ log.error(`Adapter Exception: ${error}`);
639
+ done(error);
640
+ }
641
+ }).timeout(attemptTimeout);
642
+ });
643
+
644
+ describe('#rogueDetail - errors', () => {
645
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
646
+ try {
647
+ a.rogueDetail(queryAPISId, (data, error) => {
648
+ try {
649
+ if (stub) {
650
+ const displayE = 'Error 400 received on request';
651
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
652
+ } else {
653
+ runCommonAsserts(data, error);
654
+ }
655
+ saveMockData('QueryAPIS', 'rogueDetail', 'default', data);
656
+ done();
657
+ } catch (err) {
658
+ log.error(`Test Failure: ${err}`);
659
+ done(err);
660
+ }
661
+ });
662
+ } catch (error) {
663
+ log.error(`Adapter Exception: ${error}`);
664
+ done(error);
665
+ }
666
+ }).timeout(attemptTimeout);
667
+ });
668
+
669
+ describe('#catalogRepository - errors', () => {
670
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
671
+ try {
672
+ a.catalogRepository((data, error) => {
673
+ try {
674
+ if (stub) {
675
+ const displayE = 'Error 400 received on request';
676
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
677
+ } else {
678
+ runCommonAsserts(data, error);
679
+ }
680
+ saveMockData('QueryAPIS', 'catalogRepository', 'default', data);
681
+ done();
682
+ } catch (err) {
683
+ log.error(`Test Failure: ${err}`);
684
+ done(err);
685
+ }
686
+ });
687
+ } catch (error) {
688
+ log.error(`Adapter Exception: ${error}`);
689
+ done(error);
690
+ }
691
+ }).timeout(attemptTimeout);
692
+ });
693
+
694
+ describe('#userInfo - errors', () => {
695
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
696
+ try {
697
+ a.userInfo((data, error) => {
698
+ try {
699
+ if (stub) {
700
+ const displayE = 'Error 400 received on request';
701
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
702
+ } else {
703
+ runCommonAsserts(data, error);
704
+ }
705
+ saveMockData('QueryAPIS', 'userInfo', 'default', data);
706
+ done();
707
+ } catch (err) {
708
+ log.error(`Test Failure: ${err}`);
709
+ done(err);
710
+ }
711
+ });
712
+ } catch (error) {
713
+ log.error(`Adapter Exception: ${error}`);
714
+ done(error);
715
+ }
716
+ }).timeout(attemptTimeout);
717
+ });
718
+
719
+ describe('#clientRRDInfo - errors', () => {
720
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
721
+ try {
722
+ a.clientRRDInfo((data, error) => {
723
+ try {
724
+ if (stub) {
725
+ const displayE = 'Error 400 received on request';
726
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
727
+ } else {
728
+ runCommonAsserts(data, error);
729
+ }
730
+ saveMockData('QueryAPIS', 'clientRRDInfo', 'default', data);
731
+ done();
732
+ } catch (err) {
733
+ log.error(`Test Failure: ${err}`);
734
+ done(err);
735
+ }
736
+ });
737
+ } catch (error) {
738
+ log.error(`Adapter Exception: ${error}`);
739
+ done(error);
740
+ }
741
+ }).timeout(attemptTimeout);
742
+ });
743
+
744
+ describe('#visualRFConfig - errors', () => {
745
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
746
+ try {
747
+ a.visualRFConfig((data, error) => {
748
+ try {
749
+ if (stub) {
750
+ const displayE = 'Error 400 received on request';
751
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
752
+ } else {
753
+ runCommonAsserts(data, error);
754
+ }
755
+ saveMockData('QueryAPIS', 'visualRFConfig', 'default', data);
756
+ done();
757
+ } catch (err) {
758
+ log.error(`Test Failure: ${err}`);
759
+ done(err);
760
+ }
761
+ });
762
+ } catch (error) {
763
+ log.error(`Adapter Exception: ${error}`);
764
+ done(error);
765
+ }
766
+ }).timeout(attemptTimeout);
767
+ });
768
+
769
+ const configurationAPISAppendWhitelist = 555;
770
+ const configurationAPISImportAPWhitelistBodyParam = {};
771
+ describe('#importAPWhitelist - errors', () => {
772
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
773
+ try {
774
+ a.importAPWhitelist(configurationAPISAppendWhitelist, configurationAPISImportAPWhitelistBodyParam, (data, error) => {
775
+ try {
776
+ if (stub) {
777
+ const displayE = 'Error 400 received on request';
778
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
779
+ } else {
780
+ runCommonAsserts(data, error);
781
+ }
782
+ saveMockData('ConfigurationAPIS', 'importAPWhitelist', 'default', data);
783
+ done();
784
+ } catch (err) {
785
+ log.error(`Test Failure: ${err}`);
786
+ done(err);
787
+ }
788
+ });
789
+ } catch (error) {
790
+ log.error(`Adapter Exception: ${error}`);
791
+ done(error);
792
+ }
793
+ }).timeout(attemptTimeout);
794
+ });
795
+
796
+ const configurationAPISBodyFormData = 'fakedata';
797
+ describe('#guestUserCreateUser - errors', () => {
798
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
799
+ try {
800
+ a.guestUserCreateUser(configurationAPISBodyFormData, (data, error) => {
801
+ try {
802
+ if (stub) {
803
+ const displayE = 'Error 400 received on request';
804
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
805
+ } else {
806
+ runCommonAsserts(data, error);
807
+ }
808
+ saveMockData('ConfigurationAPIS', 'guestUserCreateUser', 'default', data);
809
+ done();
810
+ } catch (err) {
811
+ log.error(`Test Failure: ${err}`);
812
+ done(err);
813
+ }
814
+ });
815
+ } catch (error) {
816
+ log.error(`Adapter Exception: ${error}`);
817
+ done(error);
818
+ }
819
+ }).timeout(attemptTimeout);
820
+ });
821
+
822
+ const configurationAPISChangeSetBodyParam = {
823
+ version: 9,
824
+ ap: [
825
+ {}
826
+ ]
827
+ };
828
+ describe('#changeSet - errors', () => {
829
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
830
+ try {
831
+ a.changeSet(configurationAPISChangeSetBodyParam, (data, error) => {
832
+ try {
833
+ if (stub) {
834
+ const displayE = 'Error 400 received on request';
835
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
836
+ } else {
837
+ runCommonAsserts(data, error);
838
+ }
839
+ saveMockData('ConfigurationAPIS', 'changeSet', 'default', data);
840
+ done();
841
+ } catch (err) {
842
+ log.error(`Test Failure: ${err}`);
843
+ done(err);
844
+ }
845
+ });
846
+ } catch (error) {
847
+ log.error(`Adapter Exception: ${error}`);
848
+ done(error);
849
+ }
850
+ }).timeout(attemptTimeout);
851
+ });
852
+
853
+ const configurationAPISModifyTemplateVariablesBodyParam = {
854
+ version: 10,
855
+ ap: [
856
+ {}
857
+ ]
858
+ };
859
+ describe('#modifyTemplateVariables - errors', () => {
860
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
861
+ try {
862
+ a.modifyTemplateVariables(configurationAPISModifyTemplateVariablesBodyParam, (data, error) => {
863
+ try {
864
+ if (stub) {
865
+ const displayE = 'Error 400 received on request';
866
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
867
+ } else {
868
+ runCommonAsserts(data, error);
869
+ }
870
+ saveMockData('ConfigurationAPIS', 'modifyTemplateVariables', 'default', data);
871
+ done();
872
+ } catch (err) {
873
+ log.error(`Test Failure: ${err}`);
874
+ done(err);
875
+ }
876
+ });
877
+ } catch (error) {
878
+ log.error(`Adapter Exception: ${error}`);
879
+ done(error);
880
+ }
881
+ }).timeout(attemptTimeout);
882
+ });
883
+
884
+ const configurationAPISMac = 'fakedata';
885
+ describe('#deauthenticateClient - errors', () => {
886
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
887
+ try {
888
+ a.deauthenticateClient(configurationAPISMac, (data, error) => {
889
+ try {
890
+ if (stub) {
891
+ const displayE = 'Error 400 received on request';
892
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
893
+ } else {
894
+ runCommonAsserts(data, error);
895
+ }
896
+ saveMockData('ConfigurationAPIS', 'deauthenticateClient', 'default', data);
897
+ done();
898
+ } catch (err) {
899
+ log.error(`Test Failure: ${err}`);
900
+ done(err);
901
+ }
902
+ });
903
+ } catch (error) {
904
+ log.error(`Adapter Exception: ${error}`);
905
+ done(error);
906
+ }
907
+ }).timeout(attemptTimeout);
908
+ });
909
+
910
+ const configurationAPISApId = 555;
911
+ const configurationAPISApGroupId = 555;
912
+ const configurationAPISDownStatusMessage = 'fakedata';
913
+ const configurationAPISAutoClearDownStatusMessage = 555;
914
+ describe('#downStatusMessage - errors', () => {
915
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
916
+ try {
917
+ a.downStatusMessage(configurationAPISApId, configurationAPISApGroupId, configurationAPISDownStatusMessage, configurationAPISAutoClearDownStatusMessage, (data, error) => {
918
+ try {
919
+ if (stub) {
920
+ const displayE = 'Error 400 received on request';
921
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
922
+ } else {
923
+ runCommonAsserts(data, error);
924
+ }
925
+ saveMockData('ConfigurationAPIS', 'downStatusMessage', 'default', data);
926
+ done();
927
+ } catch (err) {
928
+ log.error(`Test Failure: ${err}`);
929
+ done(err);
930
+ }
931
+ });
932
+ } catch (error) {
933
+ log.error(`Adapter Exception: ${error}`);
934
+ done(error);
935
+ }
936
+ }).timeout(attemptTimeout);
937
+ });
938
+
939
+ const searchAPISQuery = 'fakedata';
940
+ describe('#aPSearch - errors', () => {
941
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
942
+ try {
943
+ a.aPSearch(searchAPISQuery, (data, error) => {
944
+ try {
945
+ if (stub) {
946
+ const displayE = 'Error 400 received on request';
947
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
948
+ } else {
949
+ runCommonAsserts(data, error);
950
+ }
951
+ saveMockData('SearchAPIS', 'aPSearch', 'default', data);
952
+ done();
953
+ } catch (err) {
954
+ log.error(`Test Failure: ${err}`);
955
+ done(err);
956
+ }
957
+ });
958
+ } catch (error) {
959
+ log.error(`Adapter Exception: ${error}`);
960
+ done(error);
961
+ }
962
+ }).timeout(attemptTimeout);
963
+ });
964
+
965
+ describe('#clientSearch - errors', () => {
966
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
967
+ try {
968
+ a.clientSearch(searchAPISQuery, (data, error) => {
969
+ try {
970
+ if (stub) {
971
+ const displayE = 'Error 400 received on request';
972
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
973
+ } else {
974
+ runCommonAsserts(data, error);
975
+ }
976
+ saveMockData('SearchAPIS', 'clientSearch', 'default', data);
977
+ done();
978
+ } catch (err) {
979
+ log.error(`Test Failure: ${err}`);
980
+ done(err);
981
+ }
982
+ });
983
+ } catch (error) {
984
+ log.error(`Adapter Exception: ${error}`);
985
+ done(error);
986
+ }
987
+ }).timeout(attemptTimeout);
988
+ });
989
+
990
+ describe('#vPNUserSearch - errors', () => {
991
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
992
+ try {
993
+ a.vPNUserSearch(searchAPISQuery, (data, error) => {
994
+ try {
995
+ if (stub) {
996
+ const displayE = 'Error 400 received on request';
997
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
998
+ } else {
999
+ runCommonAsserts(data, error);
1000
+ }
1001
+ saveMockData('SearchAPIS', 'vPNUserSearch', 'default', data);
1002
+ done();
1003
+ } catch (err) {
1004
+ log.error(`Test Failure: ${err}`);
1005
+ done(err);
1006
+ }
1007
+ });
1008
+ } catch (error) {
1009
+ log.error(`Adapter Exception: ${error}`);
1010
+ done(error);
1011
+ }
1012
+ }).timeout(attemptTimeout);
1013
+ });
1014
+
1015
+ const reportAPISDefinitionsEdit = 555;
1016
+ const reportAPISId = 555;
1017
+ describe('#latestReport - errors', () => {
1018
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1019
+ try {
1020
+ a.latestReport(reportAPISDefinitionsEdit, reportAPISId, (data, error) => {
1021
+ try {
1022
+ if (stub) {
1023
+ const displayE = 'Error 400 received on request';
1024
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
1025
+ } else {
1026
+ runCommonAsserts(data, error);
1027
+ }
1028
+ saveMockData('ReportAPIS', 'latestReport', 'default', data);
1029
+ done();
1030
+ } catch (err) {
1031
+ log.error(`Test Failure: ${err}`);
1032
+ done(err);
1033
+ }
1034
+ });
1035
+ } catch (error) {
1036
+ log.error(`Adapter Exception: ${error}`);
1037
+ done(error);
1038
+ }
1039
+ }).timeout(attemptTimeout);
1040
+ });
1041
+
1042
+ const batchExecuteAPCommandsAPISBatchExecuteAPCommandBodyParam = {
1043
+ version: 7,
1044
+ cmds: 'string',
1045
+ cmd_type: 'string',
1046
+ ap: [
1047
+ {}
1048
+ ]
1049
+ };
1050
+ describe('#batchExecuteAPCommand - errors', () => {
1051
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1052
+ try {
1053
+ a.batchExecuteAPCommand(batchExecuteAPCommandsAPISBatchExecuteAPCommandBodyParam, (data, error) => {
1054
+ try {
1055
+ if (stub) {
1056
+ const displayE = 'Error 400 received on request';
1057
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
1058
+ } else {
1059
+ runCommonAsserts(data, error);
1060
+ }
1061
+ saveMockData('BatchExecuteAPCommandsAPIS', 'batchExecuteAPCommand', 'default', data);
1062
+ done();
1063
+ } catch (err) {
1064
+ log.error(`Test Failure: ${err}`);
1065
+ done(err);
1066
+ }
1067
+ });
1068
+ } catch (error) {
1069
+ log.error(`Adapter Exception: ${error}`);
1070
+ done(error);
1071
+ }
1072
+ }).timeout(attemptTimeout);
1073
+ });
1074
+
1075
+ describe('#batchExecuteAPCommandResult - errors', () => {
1076
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1077
+ try {
1078
+ a.batchExecuteAPCommandResult((data, error) => {
1079
+ try {
1080
+ if (stub) {
1081
+ const displayE = 'Error 400 received on request';
1082
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
1083
+ } else {
1084
+ runCommonAsserts(data, error);
1085
+ }
1086
+ saveMockData('BatchExecuteAPCommandsAPIS', 'batchExecuteAPCommandResult', 'default', data);
1087
+ done();
1088
+ } catch (err) {
1089
+ log.error(`Test Failure: ${err}`);
1090
+ done(err);
1091
+ }
1092
+ });
1093
+ } catch (error) {
1094
+ log.error(`Adapter Exception: ${error}`);
1095
+ done(error);
1096
+ }
1097
+ }).timeout(attemptTimeout);
1098
+ });
1099
+
1100
+ describe('#aMPLogin - errors', () => {
1101
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1102
+ try {
1103
+ a.aMPLogin(null, null, null, (data, error) => {
1104
+ try {
1105
+ if (stub) {
1106
+ const displayE = 'Error 400 received on request';
1107
+ runErrorAsserts(data, error, 'AD.500', 'Test-aruba_airwave-connectorRest-handleEndResponse', displayE);
1108
+ } else {
1109
+ runCommonAsserts(data, error);
1110
+ }
1111
+ saveMockData('LOGIN', 'aMPLogin', 'default', data);
1112
+ done();
1113
+ } catch (err) {
1114
+ log.error(`Test Failure: ${err}`);
1115
+ done(err);
1116
+ }
1117
+ });
1118
+ } catch (error) {
1119
+ log.error(`Adapter Exception: ${error}`);
1120
+ done(error);
1121
+ }
1122
+ }).timeout(attemptTimeout);
1123
+ });
1124
+ });
1125
+ });