@itentialopensource/adapter-kentik_v5 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 (85) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +18 -0
  3. package/.jshintrc +3 -0
  4. package/AUTH.md +39 -0
  5. package/BROKER.md +199 -0
  6. package/CALLS.md +170 -0
  7. package/CHANGELOG.md +9 -0
  8. package/CODE_OF_CONDUCT.md +43 -0
  9. package/CONTRIBUTING.md +172 -0
  10. package/ENHANCE.md +69 -0
  11. package/LICENSE +201 -0
  12. package/PROPERTIES.md +641 -0
  13. package/README.md +337 -0
  14. package/SUMMARY.md +9 -0
  15. package/SYSTEMINFO.md +11 -0
  16. package/TROUBLESHOOT.md +47 -0
  17. package/adapter.js +5915 -0
  18. package/adapterBase.js +1787 -0
  19. package/entities/.generic/action.json +214 -0
  20. package/entities/.generic/schema.json +28 -0
  21. package/entities/.system/action.json +50 -0
  22. package/entities/.system/mockdatafiles/getToken-default.json +3 -0
  23. package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
  24. package/entities/.system/schema.json +19 -0
  25. package/entities/.system/schemaTokenReq.json +53 -0
  26. package/entities/.system/schemaTokenResp.json +53 -0
  27. package/entities/Alerts/action.json +24 -0
  28. package/entities/Alerts/schema.json +19 -0
  29. package/entities/AlertsActive/action.json +46 -0
  30. package/entities/AlertsActive/schema.json +20 -0
  31. package/entities/CustomApplication/action.json +85 -0
  32. package/entities/CustomApplication/schema.json +33 -0
  33. package/entities/CustomDimension/action.json +166 -0
  34. package/entities/CustomDimension/schema.json +48 -0
  35. package/entities/Device/action.json +228 -0
  36. package/entities/Device/schema.json +51 -0
  37. package/entities/DeviceLabel/action.json +106 -0
  38. package/entities/DeviceLabel/schema.json +34 -0
  39. package/entities/MyKentikPortal/action.json +86 -0
  40. package/entities/MyKentikPortal/schema.json +44 -0
  41. package/entities/Plan/action.json +25 -0
  42. package/entities/Plan/schema.json +19 -0
  43. package/entities/QueryMethods/action.json +84 -0
  44. package/entities/QueryMethods/schema.json +22 -0
  45. package/entities/Savedfilter/action.json +106 -0
  46. package/entities/Savedfilter/schema.json +34 -0
  47. package/entities/Site/action.json +106 -0
  48. package/entities/Site/schema.json +34 -0
  49. package/entities/Tag/action.json +106 -0
  50. package/entities/Tag/schema.json +34 -0
  51. package/entities/User/action.json +106 -0
  52. package/entities/User/schema.json +34 -0
  53. package/error.json +190 -0
  54. package/package.json +85 -0
  55. package/pronghorn.json +6212 -0
  56. package/propertiesDecorators.json +14 -0
  57. package/propertiesSchema.json +1248 -0
  58. package/refs?service=git-upload-pack +0 -0
  59. package/report/creationReport.json +690 -0
  60. package/report/kentik-v5.json-OpenApi3Json.json +4780 -0
  61. package/sampleProperties.json +203 -0
  62. package/test/integration/adapterTestBasicGet.js +83 -0
  63. package/test/integration/adapterTestConnectivity.js +93 -0
  64. package/test/integration/adapterTestIntegration.js +2323 -0
  65. package/test/unit/adapterBaseTestUnit.js +949 -0
  66. package/test/unit/adapterTestUnit.js +3476 -0
  67. package/utils/adapterInfo.js +206 -0
  68. package/utils/addAuth.js +94 -0
  69. package/utils/artifactize.js +146 -0
  70. package/utils/basicGet.js +50 -0
  71. package/utils/checkMigrate.js +63 -0
  72. package/utils/entitiesToDB.js +178 -0
  73. package/utils/findPath.js +74 -0
  74. package/utils/methodDocumentor.js +225 -0
  75. package/utils/modify.js +154 -0
  76. package/utils/packModificationScript.js +35 -0
  77. package/utils/patches2bundledDeps.js +90 -0
  78. package/utils/pre-commit.sh +32 -0
  79. package/utils/removeHooks.js +20 -0
  80. package/utils/setup.js +33 -0
  81. package/utils/tbScript.js +246 -0
  82. package/utils/tbUtils.js +490 -0
  83. package/utils/testRunner.js +298 -0
  84. package/utils/troubleshootingAdapter.js +195 -0
  85. package/workflows/README.md +3 -0
@@ -0,0 +1,2323 @@
1
+ /* @copyright Itential, LLC 2019 (pre-modifications) */
2
+
3
+ // Set globals
4
+ /* global describe it log pronghornProps */
5
+ /* eslint no-unused-vars: warn */
6
+ /* eslint no-underscore-dangle: warn */
7
+ /* eslint import/no-dynamic-require:warn */
8
+
9
+ // include required items for testing & logging
10
+ const assert = require('assert');
11
+ const fs = require('fs');
12
+ const mocha = require('mocha');
13
+ const path = require('path');
14
+ const winston = require('winston');
15
+ const { expect } = require('chai');
16
+ const { use } = require('chai');
17
+ const td = require('testdouble');
18
+ const util = require('util');
19
+
20
+ const anything = td.matchers.anything();
21
+
22
+ // stub and attemptTimeout are used throughout the code so set them here
23
+ let logLevel = 'none';
24
+ const isRapidFail = false;
25
+ const isSaveMockData = false;
26
+
27
+ // read in the properties from the sampleProperties files
28
+ let adaptdir = __dirname;
29
+ if (adaptdir.endsWith('/test/integration')) {
30
+ adaptdir = adaptdir.substring(0, adaptdir.length - 17);
31
+ } else if (adaptdir.endsWith('/test/unit')) {
32
+ adaptdir = adaptdir.substring(0, adaptdir.length - 10);
33
+ }
34
+ const samProps = require(`${adaptdir}/sampleProperties.json`).properties;
35
+
36
+ // these variables can be changed to run in integrated mode so easier to set them here
37
+ // always check these in with bogus data!!!
38
+ samProps.stub = true;
39
+ samProps.host = 'replace.hostorip.here';
40
+ samProps.authentication.username = 'username';
41
+ samProps.authentication.password = 'password';
42
+ samProps.protocol = 'http';
43
+ samProps.port = 80;
44
+ samProps.ssl.enabled = false;
45
+ samProps.ssl.accept_invalid_cert = false;
46
+ if (samProps.request.attempt_timeout < 30000) {
47
+ samProps.request.attempt_timeout = 30000;
48
+ }
49
+ const attemptTimeout = samProps.request.attempt_timeout;
50
+ const { stub } = samProps;
51
+
52
+ // these are the adapter properties. You generally should not need to alter
53
+ // any of these after they are initially set up
54
+ global.pronghornProps = {
55
+ pathProps: {
56
+ encrypted: false
57
+ },
58
+ adapterProps: {
59
+ adapters: [{
60
+ id: 'Test-kentik_v5',
61
+ type: 'KentikV5',
62
+ properties: samProps
63
+ }]
64
+ }
65
+ };
66
+
67
+ global.$HOME = `${__dirname}/../..`;
68
+
69
+ // set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
70
+ // this you may error on log.trace calls.
71
+ const myCustomLevels = {
72
+ levels: {
73
+ spam: 6,
74
+ trace: 5,
75
+ debug: 4,
76
+ info: 3,
77
+ warn: 2,
78
+ error: 1,
79
+ none: 0
80
+ }
81
+ };
82
+
83
+ // need to see if there is a log level passed in
84
+ process.argv.forEach((val) => {
85
+ // is there a log level defined to be passed in?
86
+ if (val.indexOf('--LOG') === 0) {
87
+ // get the desired log level
88
+ const inputVal = val.split('=')[1];
89
+
90
+ // validate the log level is supported, if so set it
91
+ if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
92
+ logLevel = inputVal;
93
+ }
94
+ }
95
+ });
96
+
97
+ // need to set global logging
98
+ global.log = winston.createLogger({
99
+ level: logLevel,
100
+ levels: myCustomLevels.levels,
101
+ transports: [
102
+ new winston.transports.Console()
103
+ ]
104
+ });
105
+
106
+ /**
107
+ * Runs the common asserts for test
108
+ */
109
+ function runCommonAsserts(data, error) {
110
+ assert.equal(undefined, error);
111
+ assert.notEqual(undefined, data);
112
+ assert.notEqual(null, data);
113
+ assert.notEqual(undefined, data.response);
114
+ assert.notEqual(null, data.response);
115
+ }
116
+
117
+ /**
118
+ * Runs the error asserts for the test
119
+ */
120
+ function runErrorAsserts(data, error, code, origin, displayStr) {
121
+ assert.equal(null, data);
122
+ assert.notEqual(undefined, error);
123
+ assert.notEqual(null, error);
124
+ assert.notEqual(undefined, error.IAPerror);
125
+ assert.notEqual(null, error.IAPerror);
126
+ assert.notEqual(undefined, error.IAPerror.displayString);
127
+ assert.notEqual(null, error.IAPerror.displayString);
128
+ assert.equal(code, error.icode);
129
+ assert.equal(origin, error.IAPerror.origin);
130
+ assert.equal(displayStr, error.IAPerror.displayString);
131
+ }
132
+
133
+ /**
134
+ * @function saveMockData
135
+ * Attempts to take data from responses and place them in MockDataFiles to help create Mockdata.
136
+ * Note, this was built based on entity file structure for Adapter-Engine 1.6.x
137
+ * @param {string} entityName - Name of the entity saving mock data for
138
+ * @param {string} actionName - Name of the action saving mock data for
139
+ * @param {string} descriptor - Something to describe this test (used as a type)
140
+ * @param {string or object} responseData - The data to put in the mock file.
141
+ */
142
+ function saveMockData(entityName, actionName, descriptor, responseData) {
143
+ // do not need to save mockdata if we are running in stub mode (already has mock data) or if told not to save
144
+ if (stub || !isSaveMockData) {
145
+ return false;
146
+ }
147
+
148
+ // must have a response in order to store the response
149
+ if (responseData && responseData.response) {
150
+ let data = responseData.response;
151
+
152
+ // if there was a raw response that one is better as it is untranslated
153
+ if (responseData.raw) {
154
+ data = responseData.raw;
155
+
156
+ try {
157
+ const temp = JSON.parse(data);
158
+ data = temp;
159
+ } catch (pex) {
160
+ // do not care if it did not parse as we will just use data
161
+ }
162
+ }
163
+
164
+ try {
165
+ const base = path.join(__dirname, `../../entities/${entityName}/`);
166
+ const mockdatafolder = 'mockdatafiles';
167
+ const filename = `mockdatafiles/${actionName}-${descriptor}.json`;
168
+
169
+ if (!fs.existsSync(base + mockdatafolder)) {
170
+ fs.mkdirSync(base + mockdatafolder);
171
+ }
172
+
173
+ // write the data we retrieved
174
+ fs.writeFile(base + filename, JSON.stringify(data, null, 2), 'utf8', (errWritingMock) => {
175
+ if (errWritingMock) throw errWritingMock;
176
+
177
+ // update the action file to reflect the changes. Note: We're replacing the default object for now!
178
+ fs.readFile(`${base}action.json`, (errRead, content) => {
179
+ if (errRead) throw errRead;
180
+
181
+ // parse the action file into JSON
182
+ const parsedJson = JSON.parse(content);
183
+
184
+ // The object update we'll write in.
185
+ const responseObj = {
186
+ type: descriptor,
187
+ key: '',
188
+ mockFile: filename
189
+ };
190
+
191
+ // get the object for method we're trying to change.
192
+ const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
193
+
194
+ // if the method was not found - should never happen but...
195
+ if (!currentMethodAction) {
196
+ throw Error('Can\'t find an action for this method in the provided entity.');
197
+ }
198
+
199
+ // if there is a response object, we want to replace the Response object. Otherwise we'll create one.
200
+ const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
201
+
202
+ // Add the action responseObj back into the array of response objects.
203
+ if (!actionResponseObj) {
204
+ // if there is a default response object, we want to get the key.
205
+ const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
206
+
207
+ // save the default key into the new response object
208
+ if (defaultResponseObj) {
209
+ responseObj.key = defaultResponseObj.key;
210
+ }
211
+
212
+ // save the new response object
213
+ currentMethodAction.responseObjects = [responseObj];
214
+ } else {
215
+ // update the location of the mock data file
216
+ actionResponseObj.mockFile = responseObj.mockFile;
217
+ }
218
+
219
+ // Save results
220
+ fs.writeFile(`${base}action.json`, JSON.stringify(parsedJson, null, 2), (err) => {
221
+ if (err) throw err;
222
+ });
223
+ });
224
+ });
225
+ } catch (e) {
226
+ log.debug(`Failed to save mock data for ${actionName}. ${e.message}`);
227
+ return false;
228
+ }
229
+ }
230
+
231
+ // no response to save
232
+ log.debug(`No data passed to save into mockdata for ${actionName}`);
233
+ return false;
234
+ }
235
+
236
+ // require the adapter that we are going to be using
237
+ const KentikV5 = require('../../adapter');
238
+
239
+ // begin the testing - these should be pretty well defined between the describe and the it!
240
+ describe('[integration] Kentik_v5 Adapter Test', () => {
241
+ describe('KentikV5 Class Tests', () => {
242
+ const a = new KentikV5(
243
+ pronghornProps.adapterProps.adapters[0].id,
244
+ pronghornProps.adapterProps.adapters[0].properties
245
+ );
246
+
247
+ if (isRapidFail) {
248
+ const state = {};
249
+ state.passed = true;
250
+
251
+ mocha.afterEach(function x() {
252
+ state.passed = state.passed
253
+ && (this.currentTest.state === 'passed');
254
+ });
255
+ mocha.beforeEach(function x() {
256
+ if (!state.passed) {
257
+ return this.currentTest.skip();
258
+ }
259
+ return true;
260
+ });
261
+ }
262
+
263
+ describe('#class instance created', () => {
264
+ it('should be a class with properties', (done) => {
265
+ try {
266
+ assert.notEqual(null, a);
267
+ assert.notEqual(undefined, a);
268
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
269
+ assert.equal(checkId, a.id);
270
+ assert.notEqual(null, a.allProps);
271
+ const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
272
+ assert.equal(check, a.healthcheckType);
273
+ done();
274
+ } catch (error) {
275
+ log.error(`Test Failure: ${error}`);
276
+ done(error);
277
+ }
278
+ }).timeout(attemptTimeout);
279
+ });
280
+
281
+ describe('#connect', () => {
282
+ it('should get connected - no healthcheck', (done) => {
283
+ try {
284
+ a.healthcheckType = 'none';
285
+ a.connect();
286
+
287
+ try {
288
+ assert.equal(true, a.alive);
289
+ done();
290
+ } catch (error) {
291
+ log.error(`Test Failure: ${error}`);
292
+ done(error);
293
+ }
294
+ } catch (error) {
295
+ log.error(`Adapter Exception: ${error}`);
296
+ done(error);
297
+ }
298
+ });
299
+ it('should get connected - startup healthcheck', (done) => {
300
+ try {
301
+ a.healthcheckType = 'startup';
302
+ a.connect();
303
+
304
+ try {
305
+ assert.equal(true, a.alive);
306
+ done();
307
+ } catch (error) {
308
+ log.error(`Test Failure: ${error}`);
309
+ done(error);
310
+ }
311
+ } catch (error) {
312
+ log.error(`Adapter Exception: ${error}`);
313
+ done(error);
314
+ }
315
+ });
316
+ });
317
+
318
+ describe('#healthCheck', () => {
319
+ it('should be healthy', (done) => {
320
+ try {
321
+ a.healthCheck(null, (data) => {
322
+ try {
323
+ assert.equal(true, a.healthy);
324
+ saveMockData('system', 'healthcheck', 'default', data);
325
+ done();
326
+ } catch (err) {
327
+ log.error(`Test Failure: ${err}`);
328
+ done(err);
329
+ }
330
+ });
331
+ } catch (error) {
332
+ log.error(`Adapter Exception: ${error}`);
333
+ done(error);
334
+ }
335
+ }).timeout(attemptTimeout);
336
+ });
337
+
338
+ /*
339
+ -----------------------------------------------------------------------
340
+ -----------------------------------------------------------------------
341
+ *** All code above this comment will be replaced during a migration ***
342
+ ******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
343
+ -----------------------------------------------------------------------
344
+ -----------------------------------------------------------------------
345
+ */
346
+
347
+ const queryMethodsRunQueryBodyParam = {
348
+ query: 'string'
349
+ };
350
+ describe('#runQuery - errors', () => {
351
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
352
+ try {
353
+ a.runQuery(queryMethodsRunQueryBodyParam, (data, error) => {
354
+ try {
355
+ if (stub) {
356
+ const displayE = 'Error 400 received on request';
357
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
358
+ } else {
359
+ runCommonAsserts(data, error);
360
+ }
361
+ saveMockData('QueryMethods', 'runQuery', 'default', data);
362
+ done();
363
+ } catch (err) {
364
+ log.error(`Test Failure: ${err}`);
365
+ done(err);
366
+ }
367
+ });
368
+ } catch (error) {
369
+ log.error(`Adapter Exception: ${error}`);
370
+ done(error);
371
+ }
372
+ }).timeout(attemptTimeout);
373
+ });
374
+
375
+ const queryMethodsTopxchartBodyParam = {
376
+ queries: [
377
+ {
378
+ query: {
379
+ viz_type: 'string',
380
+ show_overlay: false,
381
+ overlay_day: 8,
382
+ sync_axes: false,
383
+ dimension: [
384
+ 'RegionTopTalkers'
385
+ ],
386
+ cidr: 8,
387
+ cidr6: 7,
388
+ pps_threshold: 5,
389
+ metric: null,
390
+ topx: 2,
391
+ depth: 1,
392
+ fastData: null,
393
+ outsort: 'string',
394
+ lookback_seconds: 8,
395
+ hostname_lookup: true,
396
+ starting_time: 'string',
397
+ ending_time: 'string',
398
+ device_name: 'string',
399
+ all_selected: false,
400
+ filters_obj: {
401
+ connector: null,
402
+ filterGroups: [
403
+ {
404
+ connector: null,
405
+ filters: [
406
+ {
407
+ filterField: null,
408
+ operator: null,
409
+ filterValue: 'string'
410
+ }
411
+ ],
412
+ not: false
413
+ }
414
+ ]
415
+ },
416
+ saved_filters: [
417
+ {
418
+ filter_id: 7,
419
+ isNot: false
420
+ }
421
+ ],
422
+ descriptor: 'string',
423
+ aggregates: [
424
+ {
425
+ name: 'string',
426
+ column: null,
427
+ fn: null,
428
+ rank: 8,
429
+ leftOperand: 'string',
430
+ compositeFn: null,
431
+ rightOperand: null,
432
+ raw: true
433
+ }
434
+ ],
435
+ query_title: 'string'
436
+ },
437
+ bucket: 'string',
438
+ bucketIndex: 7,
439
+ isOverlay: false
440
+ }
441
+ ],
442
+ imageType: null
443
+ };
444
+ describe('#topxchart - errors', () => {
445
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
446
+ try {
447
+ a.topxchart(queryMethodsTopxchartBodyParam, (data, error) => {
448
+ try {
449
+ if (stub) {
450
+ const displayE = 'Error 400 received on request';
451
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
452
+ } else {
453
+ runCommonAsserts(data, error);
454
+ }
455
+ saveMockData('QueryMethods', 'topxchart', 'default', data);
456
+ done();
457
+ } catch (err) {
458
+ log.error(`Test Failure: ${err}`);
459
+ done(err);
460
+ }
461
+ });
462
+ } catch (error) {
463
+ log.error(`Adapter Exception: ${error}`);
464
+ done(error);
465
+ }
466
+ }).timeout(attemptTimeout);
467
+ });
468
+
469
+ const queryMethodsTopxdataBodyParam = {
470
+ queries: [
471
+ {
472
+ query: {
473
+ dimension: [
474
+ 'src_geo_region'
475
+ ],
476
+ cidr: 2,
477
+ cidr6: 2,
478
+ pps_threshold: 8,
479
+ metric: null,
480
+ topx: 9,
481
+ depth: 8,
482
+ fastData: null,
483
+ outsort: 'string',
484
+ lookback_seconds: 1,
485
+ hostname_lookup: true,
486
+ starting_time: 'string',
487
+ ending_time: 'string',
488
+ device_name: 'string',
489
+ all_selected: false,
490
+ filters_obj: {
491
+ connector: null,
492
+ filterGroups: [
493
+ {
494
+ connector: null,
495
+ filters: [
496
+ {
497
+ filterField: null,
498
+ operator: null,
499
+ filterValue: 'string'
500
+ }
501
+ ],
502
+ not: false
503
+ }
504
+ ]
505
+ },
506
+ saved_filters: [
507
+ {
508
+ filter_id: 4,
509
+ isNot: true
510
+ }
511
+ ],
512
+ descriptor: 'string',
513
+ aggregates: [
514
+ {
515
+ name: 'string',
516
+ column: null,
517
+ fn: null,
518
+ rank: 4,
519
+ leftOperand: 'string',
520
+ compositeFn: null,
521
+ rightOperand: null,
522
+ raw: true
523
+ }
524
+ ]
525
+ },
526
+ bucket: 'string',
527
+ bucketIndex: 4
528
+ }
529
+ ]
530
+ };
531
+ describe('#topxdata - errors', () => {
532
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
533
+ try {
534
+ a.topxdata(queryMethodsTopxdataBodyParam, (data, error) => {
535
+ try {
536
+ if (stub) {
537
+ const displayE = 'Error 400 received on request';
538
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
539
+ } else {
540
+ runCommonAsserts(data, error);
541
+ }
542
+ saveMockData('QueryMethods', 'topxdata', 'default', data);
543
+ done();
544
+ } catch (err) {
545
+ log.error(`Test Failure: ${err}`);
546
+ done(err);
547
+ }
548
+ });
549
+ } catch (error) {
550
+ log.error(`Adapter Exception: ${error}`);
551
+ done(error);
552
+ }
553
+ }).timeout(attemptTimeout);
554
+ });
555
+
556
+ const queryMethodsQueryUrlBodyParam = {
557
+ version: null,
558
+ queries: [
559
+ {
560
+ query: {
561
+ dimension: [
562
+ 'dst_geo_region'
563
+ ],
564
+ cidr: 6,
565
+ cidr6: 8,
566
+ pps_threshold: 7,
567
+ metric: null,
568
+ topx: 8,
569
+ depth: 7,
570
+ fastData: null,
571
+ outsort: 'string',
572
+ lookback_seconds: 6,
573
+ time_format: null,
574
+ hostname_lookup: true,
575
+ starting_time: 'string',
576
+ ending_time: 'string',
577
+ device_name: 'string',
578
+ all_selected: false,
579
+ filters_obj: {
580
+ connector: null,
581
+ filterGroups: [
582
+ {
583
+ connector: null,
584
+ filters: [
585
+ {
586
+ filterField: null,
587
+ operator: null,
588
+ filterValue: 'string'
589
+ }
590
+ ],
591
+ not: false
592
+ }
593
+ ]
594
+ },
595
+ saved_filters: [
596
+ {
597
+ filter_id: 10,
598
+ isNot: false
599
+ }
600
+ ],
601
+ descriptor: 'string',
602
+ aggregates: [
603
+ {
604
+ name: 'string',
605
+ column: null,
606
+ fn: null,
607
+ rank: 2,
608
+ leftOperand: 'string',
609
+ compositeFn: null,
610
+ rightOperand: null,
611
+ raw: false
612
+ }
613
+ ]
614
+ },
615
+ bucket: 'string',
616
+ bucketIndex: 8
617
+ }
618
+ ]
619
+ };
620
+ describe('#queryUrl - errors', () => {
621
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
622
+ try {
623
+ a.queryUrl(queryMethodsQueryUrlBodyParam, (data, error) => {
624
+ try {
625
+ if (stub) {
626
+ const displayE = 'Error 400 received on request';
627
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
628
+ } else {
629
+ runCommonAsserts(data, error);
630
+ }
631
+ saveMockData('QueryMethods', 'queryUrl', 'default', data);
632
+ done();
633
+ } catch (err) {
634
+ log.error(`Test Failure: ${err}`);
635
+ done(err);
636
+ }
637
+ });
638
+ } catch (error) {
639
+ log.error(`Adapter Exception: ${error}`);
640
+ done(error);
641
+ }
642
+ }).timeout(attemptTimeout);
643
+ });
644
+
645
+ const userCreateUserBodyParam = {
646
+ user: {
647
+ user_email: 'string',
648
+ user_full_name: 'string',
649
+ role: null,
650
+ email_product: true,
651
+ email_service: true
652
+ }
653
+ };
654
+ describe('#createUser - errors', () => {
655
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
656
+ try {
657
+ a.createUser(userCreateUserBodyParam, (data, error) => {
658
+ try {
659
+ if (stub) {
660
+ const displayE = 'Error 400 received on request';
661
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
662
+ } else {
663
+ runCommonAsserts(data, error);
664
+ }
665
+ saveMockData('User', 'createUser', 'default', data);
666
+ done();
667
+ } catch (err) {
668
+ log.error(`Test Failure: ${err}`);
669
+ done(err);
670
+ }
671
+ });
672
+ } catch (error) {
673
+ log.error(`Adapter Exception: ${error}`);
674
+ done(error);
675
+ }
676
+ }).timeout(attemptTimeout);
677
+ });
678
+
679
+ const userUserId = 555;
680
+ const userUpdateUserBodyParam = {
681
+ user: {
682
+ user_email: 'string',
683
+ user_full_name: 'string',
684
+ role: null,
685
+ email_product: true,
686
+ email_service: true
687
+ }
688
+ };
689
+ describe('#updateUser - errors', () => {
690
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
691
+ try {
692
+ a.updateUser(userUserId, userUpdateUserBodyParam, (data, error) => {
693
+ try {
694
+ if (stub) {
695
+ const displayE = 'Error 400 received on request';
696
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
697
+ } else {
698
+ runCommonAsserts(data, error);
699
+ }
700
+ saveMockData('User', 'updateUser', 'default', data);
701
+ done();
702
+ } catch (err) {
703
+ log.error(`Test Failure: ${err}`);
704
+ done(err);
705
+ }
706
+ });
707
+ } catch (error) {
708
+ log.error(`Adapter Exception: ${error}`);
709
+ done(error);
710
+ }
711
+ }).timeout(attemptTimeout);
712
+ });
713
+
714
+ describe('#findUser - errors', () => {
715
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
716
+ try {
717
+ a.findUser(userUserId, (data, error) => {
718
+ try {
719
+ if (stub) {
720
+ const displayE = 'Error 400 received on request';
721
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
722
+ } else {
723
+ runCommonAsserts(data, error);
724
+ }
725
+ saveMockData('User', 'findUser', 'default', data);
726
+ done();
727
+ } catch (err) {
728
+ log.error(`Test Failure: ${err}`);
729
+ done(err);
730
+ }
731
+ });
732
+ } catch (error) {
733
+ log.error(`Adapter Exception: ${error}`);
734
+ done(error);
735
+ }
736
+ }).timeout(attemptTimeout);
737
+ });
738
+
739
+ describe('#findUsers - errors', () => {
740
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
741
+ try {
742
+ a.findUsers((data, error) => {
743
+ try {
744
+ if (stub) {
745
+ const displayE = 'Error 400 received on request';
746
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
747
+ } else {
748
+ runCommonAsserts(data, error);
749
+ }
750
+ saveMockData('User', 'findUsers', 'default', data);
751
+ done();
752
+ } catch (err) {
753
+ log.error(`Test Failure: ${err}`);
754
+ done(err);
755
+ }
756
+ });
757
+ } catch (error) {
758
+ log.error(`Adapter Exception: ${error}`);
759
+ done(error);
760
+ }
761
+ }).timeout(attemptTimeout);
762
+ });
763
+
764
+ const deviceCreateDeviceBodyParam = {
765
+ device: {
766
+ device_name: 'string',
767
+ device_subtype: null,
768
+ cdn_attr: null,
769
+ device_description: 'string',
770
+ sending_ips: [],
771
+ device_sample_rate: 5,
772
+ plan_id: 10,
773
+ site_id: 7,
774
+ minimize_snmp: false,
775
+ device_snmp_ip: 'string',
776
+ device_snmp_community: 'string',
777
+ device_snmp_v3_conf: {
778
+ UserName: 'string',
779
+ AuthenticationProtocol: null,
780
+ AuthenticationPassphrase: 'string',
781
+ PrivacyProtocol: null,
782
+ PrivacyPassphrase: 'string'
783
+ },
784
+ device_bgp_type: null,
785
+ device_bgp_neighbor_ip: 'string',
786
+ device_bgp_neighbor_ip6: 'string',
787
+ device_bgp_neighbor_asn: 'string',
788
+ device_bgp_password: 'string',
789
+ use_bgp_device_id: 1,
790
+ device_bgp_flowspec: true
791
+ }
792
+ };
793
+ describe('#createDevice - errors', () => {
794
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
795
+ try {
796
+ a.createDevice(deviceCreateDeviceBodyParam, (data, error) => {
797
+ try {
798
+ if (stub) {
799
+ const displayE = 'Error 400 received on request';
800
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
801
+ } else {
802
+ runCommonAsserts(data, error);
803
+ }
804
+ saveMockData('Device', 'createDevice', 'default', data);
805
+ done();
806
+ } catch (err) {
807
+ log.error(`Test Failure: ${err}`);
808
+ done(err);
809
+ }
810
+ });
811
+ } catch (error) {
812
+ log.error(`Adapter Exception: ${error}`);
813
+ done(error);
814
+ }
815
+ }).timeout(attemptTimeout);
816
+ });
817
+
818
+ const deviceDeviceId = 555;
819
+ const deviceCreateInterfaceBodyParam = {
820
+ snmp_id: 'string',
821
+ interface_description: 'string',
822
+ snmp_speed: 8
823
+ };
824
+ describe('#createInterface - errors', () => {
825
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
826
+ try {
827
+ a.createInterface(deviceDeviceId, deviceCreateInterfaceBodyParam, (data, error) => {
828
+ try {
829
+ if (stub) {
830
+ const displayE = 'Error 400 received on request';
831
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
832
+ } else {
833
+ runCommonAsserts(data, error);
834
+ }
835
+ saveMockData('Device', 'createInterface', 'default', data);
836
+ done();
837
+ } catch (err) {
838
+ log.error(`Test Failure: ${err}`);
839
+ done(err);
840
+ }
841
+ });
842
+ } catch (error) {
843
+ log.error(`Adapter Exception: ${error}`);
844
+ done(error);
845
+ }
846
+ }).timeout(attemptTimeout);
847
+ });
848
+
849
+ const deviceUpdateDeviceBodyParam = {
850
+ device: {
851
+ cdn_attr: null,
852
+ device_description: 'string',
853
+ sending_ips: [
854
+ 'string'
855
+ ],
856
+ device_sample_rate: 10,
857
+ plan_id: 7,
858
+ site_id: 10,
859
+ minimize_snmp: false,
860
+ device_snmp_ip: 'string',
861
+ device_snmp_community: 'string',
862
+ device_snmp_v3_conf: {
863
+ UserName: 'string',
864
+ AuthenticationProtocol: null,
865
+ AuthenticationPassphrase: 'string',
866
+ PrivacyProtocol: null,
867
+ PrivacyPassphrase: 'string'
868
+ },
869
+ device_bgp_type: null,
870
+ device_bgp_neighbor_ip: 'string',
871
+ device_bgp_neighbor_ip6: 'string',
872
+ device_bgp_neighbor_asn: 'string',
873
+ device_bgp_password: 'string',
874
+ use_bgp_device_id: 10,
875
+ device_bgp_flowspec: false
876
+ }
877
+ };
878
+ describe('#updateDevice - errors', () => {
879
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
880
+ try {
881
+ a.updateDevice(deviceDeviceId, deviceUpdateDeviceBodyParam, (data, error) => {
882
+ try {
883
+ if (stub) {
884
+ const displayE = 'Error 400 received on request';
885
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
886
+ } else {
887
+ runCommonAsserts(data, error);
888
+ }
889
+ saveMockData('Device', 'updateDevice', 'default', data);
890
+ done();
891
+ } catch (err) {
892
+ log.error(`Test Failure: ${err}`);
893
+ done(err);
894
+ }
895
+ });
896
+ } catch (error) {
897
+ log.error(`Adapter Exception: ${error}`);
898
+ done(error);
899
+ }
900
+ }).timeout(attemptTimeout);
901
+ });
902
+
903
+ describe('#findDevice - errors', () => {
904
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
905
+ try {
906
+ a.findDevice(deviceDeviceId, (data, error) => {
907
+ try {
908
+ if (stub) {
909
+ const displayE = 'Error 400 received on request';
910
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
911
+ } else {
912
+ runCommonAsserts(data, error);
913
+ }
914
+ saveMockData('Device', 'findDevice', 'default', data);
915
+ done();
916
+ } catch (err) {
917
+ log.error(`Test Failure: ${err}`);
918
+ done(err);
919
+ }
920
+ });
921
+ } catch (error) {
922
+ log.error(`Adapter Exception: ${error}`);
923
+ done(error);
924
+ }
925
+ }).timeout(attemptTimeout);
926
+ });
927
+
928
+ const deviceInterfaceId = 555;
929
+ const deviceUpdateInterfaceBodyParam = {
930
+ snmp_id: 7,
931
+ snmp_speed: 4
932
+ };
933
+ describe('#updateInterface - errors', () => {
934
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
935
+ try {
936
+ a.updateInterface(deviceDeviceId, deviceInterfaceId, deviceUpdateInterfaceBodyParam, (data, error) => {
937
+ try {
938
+ if (stub) {
939
+ const displayE = 'Error 400 received on request';
940
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
941
+ } else {
942
+ runCommonAsserts(data, error);
943
+ }
944
+ saveMockData('Device', 'updateInterface', 'default', data);
945
+ done();
946
+ } catch (err) {
947
+ log.error(`Test Failure: ${err}`);
948
+ done(err);
949
+ }
950
+ });
951
+ } catch (error) {
952
+ log.error(`Adapter Exception: ${error}`);
953
+ done(error);
954
+ }
955
+ }).timeout(attemptTimeout);
956
+ });
957
+
958
+ describe('#findInterface - errors', () => {
959
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
960
+ try {
961
+ a.findInterface(deviceDeviceId, deviceInterfaceId, (data, error) => {
962
+ try {
963
+ if (stub) {
964
+ const displayE = 'Error 400 received on request';
965
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
966
+ } else {
967
+ runCommonAsserts(data, error);
968
+ }
969
+ saveMockData('Device', 'findInterface', 'default', data);
970
+ done();
971
+ } catch (err) {
972
+ log.error(`Test Failure: ${err}`);
973
+ done(err);
974
+ }
975
+ });
976
+ } catch (error) {
977
+ log.error(`Adapter Exception: ${error}`);
978
+ done(error);
979
+ }
980
+ }).timeout(attemptTimeout);
981
+ });
982
+
983
+ describe('#findInterfaces - errors', () => {
984
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
985
+ try {
986
+ a.findInterfaces(deviceDeviceId, (data, error) => {
987
+ try {
988
+ if (stub) {
989
+ const displayE = 'Error 400 received on request';
990
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
991
+ } else {
992
+ runCommonAsserts(data, error);
993
+ }
994
+ saveMockData('Device', 'findInterfaces', 'default', data);
995
+ done();
996
+ } catch (err) {
997
+ log.error(`Test Failure: ${err}`);
998
+ done(err);
999
+ }
1000
+ });
1001
+ } catch (error) {
1002
+ log.error(`Adapter Exception: ${error}`);
1003
+ done(error);
1004
+ }
1005
+ }).timeout(attemptTimeout);
1006
+ });
1007
+
1008
+ describe('#findDevices - errors', () => {
1009
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1010
+ try {
1011
+ a.findDevices((data, error) => {
1012
+ try {
1013
+ if (stub) {
1014
+ const displayE = 'Error 400 received on request';
1015
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1016
+ } else {
1017
+ runCommonAsserts(data, error);
1018
+ }
1019
+ saveMockData('Device', 'findDevices', 'default', data);
1020
+ done();
1021
+ } catch (err) {
1022
+ log.error(`Test Failure: ${err}`);
1023
+ done(err);
1024
+ }
1025
+ });
1026
+ } catch (error) {
1027
+ log.error(`Adapter Exception: ${error}`);
1028
+ done(error);
1029
+ }
1030
+ }).timeout(attemptTimeout);
1031
+ });
1032
+
1033
+ const deviceDeviceApplyLabelsBodyParam = {
1034
+ labels: [
1035
+ {}
1036
+ ]
1037
+ };
1038
+ describe('#deviceApplyLabels - errors', () => {
1039
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1040
+ try {
1041
+ a.deviceApplyLabels(deviceDeviceId, deviceDeviceApplyLabelsBodyParam, (data, error) => {
1042
+ try {
1043
+ if (stub) {
1044
+ const displayE = 'Error 400 received on request';
1045
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1046
+ } else {
1047
+ runCommonAsserts(data, error);
1048
+ }
1049
+ saveMockData('Device', 'deviceApplyLabels', 'default', data);
1050
+ done();
1051
+ } catch (err) {
1052
+ log.error(`Test Failure: ${err}`);
1053
+ done(err);
1054
+ }
1055
+ });
1056
+ } catch (error) {
1057
+ log.error(`Adapter Exception: ${error}`);
1058
+ done(error);
1059
+ }
1060
+ }).timeout(attemptTimeout);
1061
+ });
1062
+
1063
+ const deviceLabelCreateDeviceLabelBodyParam = {
1064
+ name: 'string',
1065
+ color: 'string'
1066
+ };
1067
+ describe('#createDeviceLabel - errors', () => {
1068
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1069
+ try {
1070
+ a.createDeviceLabel(deviceLabelCreateDeviceLabelBodyParam, (data, error) => {
1071
+ try {
1072
+ if (stub) {
1073
+ const displayE = 'Error 400 received on request';
1074
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1075
+ } else {
1076
+ runCommonAsserts(data, error);
1077
+ }
1078
+ saveMockData('DeviceLabel', 'createDeviceLabel', 'default', data);
1079
+ done();
1080
+ } catch (err) {
1081
+ log.error(`Test Failure: ${err}`);
1082
+ done(err);
1083
+ }
1084
+ });
1085
+ } catch (error) {
1086
+ log.error(`Adapter Exception: ${error}`);
1087
+ done(error);
1088
+ }
1089
+ }).timeout(attemptTimeout);
1090
+ });
1091
+
1092
+ describe('#findDeviceLabels - errors', () => {
1093
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1094
+ try {
1095
+ a.findDeviceLabels((data, error) => {
1096
+ try {
1097
+ if (stub) {
1098
+ const displayE = 'Error 400 received on request';
1099
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1100
+ } else {
1101
+ runCommonAsserts(data, error);
1102
+ }
1103
+ saveMockData('DeviceLabel', 'findDeviceLabels', 'default', data);
1104
+ done();
1105
+ } catch (err) {
1106
+ log.error(`Test Failure: ${err}`);
1107
+ done(err);
1108
+ }
1109
+ });
1110
+ } catch (error) {
1111
+ log.error(`Adapter Exception: ${error}`);
1112
+ done(error);
1113
+ }
1114
+ }).timeout(attemptTimeout);
1115
+ });
1116
+
1117
+ const deviceLabelDeviceLabelId = 555;
1118
+ const deviceLabelUpdateDeviceLabelBodyParam = {
1119
+ name: 'string'
1120
+ };
1121
+ describe('#updateDeviceLabel - errors', () => {
1122
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1123
+ try {
1124
+ a.updateDeviceLabel(deviceLabelDeviceLabelId, deviceLabelUpdateDeviceLabelBodyParam, (data, error) => {
1125
+ try {
1126
+ if (stub) {
1127
+ const displayE = 'Error 400 received on request';
1128
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1129
+ } else {
1130
+ runCommonAsserts(data, error);
1131
+ }
1132
+ saveMockData('DeviceLabel', 'updateDeviceLabel', 'default', data);
1133
+ done();
1134
+ } catch (err) {
1135
+ log.error(`Test Failure: ${err}`);
1136
+ done(err);
1137
+ }
1138
+ });
1139
+ } catch (error) {
1140
+ log.error(`Adapter Exception: ${error}`);
1141
+ done(error);
1142
+ }
1143
+ }).timeout(attemptTimeout);
1144
+ });
1145
+
1146
+ describe('#findDeviceLabel - errors', () => {
1147
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1148
+ try {
1149
+ a.findDeviceLabel(deviceLabelDeviceLabelId, (data, error) => {
1150
+ try {
1151
+ if (stub) {
1152
+ const displayE = 'Error 400 received on request';
1153
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1154
+ } else {
1155
+ runCommonAsserts(data, error);
1156
+ }
1157
+ saveMockData('DeviceLabel', 'findDeviceLabel', 'default', data);
1158
+ done();
1159
+ } catch (err) {
1160
+ log.error(`Test Failure: ${err}`);
1161
+ done(err);
1162
+ }
1163
+ });
1164
+ } catch (error) {
1165
+ log.error(`Adapter Exception: ${error}`);
1166
+ done(error);
1167
+ }
1168
+ }).timeout(attemptTimeout);
1169
+ });
1170
+
1171
+ describe('#findPlans - errors', () => {
1172
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1173
+ try {
1174
+ a.findPlans((data, error) => {
1175
+ try {
1176
+ if (stub) {
1177
+ const displayE = 'Error 400 received on request';
1178
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1179
+ } else {
1180
+ runCommonAsserts(data, error);
1181
+ }
1182
+ saveMockData('Plan', 'findPlans', 'default', data);
1183
+ done();
1184
+ } catch (err) {
1185
+ log.error(`Test Failure: ${err}`);
1186
+ done(err);
1187
+ }
1188
+ });
1189
+ } catch (error) {
1190
+ log.error(`Adapter Exception: ${error}`);
1191
+ done(error);
1192
+ }
1193
+ }).timeout(attemptTimeout);
1194
+ });
1195
+
1196
+ const siteCreateSiteBodyParam = {
1197
+ site: {
1198
+ site_name: 'string',
1199
+ lat: 2,
1200
+ lon: 2
1201
+ }
1202
+ };
1203
+ describe('#createSite - errors', () => {
1204
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1205
+ try {
1206
+ a.createSite(siteCreateSiteBodyParam, (data, error) => {
1207
+ try {
1208
+ if (stub) {
1209
+ const displayE = 'Error 400 received on request';
1210
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1211
+ } else {
1212
+ runCommonAsserts(data, error);
1213
+ }
1214
+ saveMockData('Site', 'createSite', 'default', data);
1215
+ done();
1216
+ } catch (err) {
1217
+ log.error(`Test Failure: ${err}`);
1218
+ done(err);
1219
+ }
1220
+ });
1221
+ } catch (error) {
1222
+ log.error(`Adapter Exception: ${error}`);
1223
+ done(error);
1224
+ }
1225
+ }).timeout(attemptTimeout);
1226
+ });
1227
+
1228
+ const siteSiteId = 555;
1229
+ const siteUpdateSiteBodyParam = {
1230
+ site: {
1231
+ site_name: 'string',
1232
+ lat: 9,
1233
+ lon: 9
1234
+ }
1235
+ };
1236
+ describe('#updateSite - errors', () => {
1237
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1238
+ try {
1239
+ a.updateSite(siteSiteId, siteUpdateSiteBodyParam, (data, error) => {
1240
+ try {
1241
+ if (stub) {
1242
+ const displayE = 'Error 400 received on request';
1243
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1244
+ } else {
1245
+ runCommonAsserts(data, error);
1246
+ }
1247
+ saveMockData('Site', 'updateSite', 'default', data);
1248
+ done();
1249
+ } catch (err) {
1250
+ log.error(`Test Failure: ${err}`);
1251
+ done(err);
1252
+ }
1253
+ });
1254
+ } catch (error) {
1255
+ log.error(`Adapter Exception: ${error}`);
1256
+ done(error);
1257
+ }
1258
+ }).timeout(attemptTimeout);
1259
+ });
1260
+
1261
+ describe('#findSite - errors', () => {
1262
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1263
+ try {
1264
+ a.findSite(siteSiteId, (data, error) => {
1265
+ try {
1266
+ if (stub) {
1267
+ const displayE = 'Error 400 received on request';
1268
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1269
+ } else {
1270
+ runCommonAsserts(data, error);
1271
+ }
1272
+ saveMockData('Site', 'findSite', 'default', data);
1273
+ done();
1274
+ } catch (err) {
1275
+ log.error(`Test Failure: ${err}`);
1276
+ done(err);
1277
+ }
1278
+ });
1279
+ } catch (error) {
1280
+ log.error(`Adapter Exception: ${error}`);
1281
+ done(error);
1282
+ }
1283
+ }).timeout(attemptTimeout);
1284
+ });
1285
+
1286
+ describe('#findSites - errors', () => {
1287
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1288
+ try {
1289
+ a.findSites((data, error) => {
1290
+ try {
1291
+ if (stub) {
1292
+ const displayE = 'Error 400 received on request';
1293
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1294
+ } else {
1295
+ runCommonAsserts(data, error);
1296
+ }
1297
+ saveMockData('Site', 'findSites', 'default', data);
1298
+ done();
1299
+ } catch (err) {
1300
+ log.error(`Test Failure: ${err}`);
1301
+ done(err);
1302
+ }
1303
+ });
1304
+ } catch (error) {
1305
+ log.error(`Adapter Exception: ${error}`);
1306
+ done(error);
1307
+ }
1308
+ }).timeout(attemptTimeout);
1309
+ });
1310
+
1311
+ const tagCreateTagBodyParam = {
1312
+ tag: {
1313
+ flow_tag: 'string',
1314
+ device_name: 'string',
1315
+ device_type: 'string',
1316
+ site: 'string',
1317
+ interface_name: 'string',
1318
+ addr: 'string',
1319
+ port: 'string',
1320
+ tcp_flags: 'string',
1321
+ protocol: 'string',
1322
+ asn: 'string',
1323
+ lasthop_as_name: 'string',
1324
+ nexthop_asn: 'string',
1325
+ nexthop_as_name: 'string',
1326
+ nexthop: 'string',
1327
+ bgp_aspath: 'string',
1328
+ bgp_community: 'string',
1329
+ mac: 'string',
1330
+ country: 'string',
1331
+ vlans: 'string'
1332
+ }
1333
+ };
1334
+ describe('#createTag - errors', () => {
1335
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1336
+ try {
1337
+ a.createTag(tagCreateTagBodyParam, (data, error) => {
1338
+ try {
1339
+ if (stub) {
1340
+ const displayE = 'Error 400 received on request';
1341
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1342
+ } else {
1343
+ runCommonAsserts(data, error);
1344
+ }
1345
+ saveMockData('Tag', 'createTag', 'default', data);
1346
+ done();
1347
+ } catch (err) {
1348
+ log.error(`Test Failure: ${err}`);
1349
+ done(err);
1350
+ }
1351
+ });
1352
+ } catch (error) {
1353
+ log.error(`Adapter Exception: ${error}`);
1354
+ done(error);
1355
+ }
1356
+ }).timeout(attemptTimeout);
1357
+ });
1358
+
1359
+ const tagTagId = 555;
1360
+ const tagUpdateTagBodyParam = {
1361
+ tag: {
1362
+ flow_tag: 'string',
1363
+ device_name: 'string',
1364
+ device_type: 'string',
1365
+ site: 'string',
1366
+ interface_name: 'string',
1367
+ addr: 'string',
1368
+ port: 'string',
1369
+ tcp_flags: 'string',
1370
+ protocol: 'string',
1371
+ asn: 'string',
1372
+ lasthop_as_name: 'string',
1373
+ nexthop_asn: 'string',
1374
+ nexthop_as_name: 'string',
1375
+ nexthop: 'string',
1376
+ bgp_aspath: 'string',
1377
+ bgp_community: 'string',
1378
+ mac: 'string',
1379
+ country: 'string',
1380
+ vlans: 'string'
1381
+ }
1382
+ };
1383
+ describe('#updateTag - errors', () => {
1384
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1385
+ try {
1386
+ a.updateTag(tagTagId, tagUpdateTagBodyParam, (data, error) => {
1387
+ try {
1388
+ if (stub) {
1389
+ const displayE = 'Error 400 received on request';
1390
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1391
+ } else {
1392
+ runCommonAsserts(data, error);
1393
+ }
1394
+ saveMockData('Tag', 'updateTag', 'default', data);
1395
+ done();
1396
+ } catch (err) {
1397
+ log.error(`Test Failure: ${err}`);
1398
+ done(err);
1399
+ }
1400
+ });
1401
+ } catch (error) {
1402
+ log.error(`Adapter Exception: ${error}`);
1403
+ done(error);
1404
+ }
1405
+ }).timeout(attemptTimeout);
1406
+ });
1407
+
1408
+ describe('#findTag - errors', () => {
1409
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1410
+ try {
1411
+ a.findTag(tagTagId, (data, error) => {
1412
+ try {
1413
+ if (stub) {
1414
+ const displayE = 'Error 400 received on request';
1415
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1416
+ } else {
1417
+ runCommonAsserts(data, error);
1418
+ }
1419
+ saveMockData('Tag', 'findTag', 'default', data);
1420
+ done();
1421
+ } catch (err) {
1422
+ log.error(`Test Failure: ${err}`);
1423
+ done(err);
1424
+ }
1425
+ });
1426
+ } catch (error) {
1427
+ log.error(`Adapter Exception: ${error}`);
1428
+ done(error);
1429
+ }
1430
+ }).timeout(attemptTimeout);
1431
+ });
1432
+
1433
+ describe('#findTags - errors', () => {
1434
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1435
+ try {
1436
+ a.findTags((data, error) => {
1437
+ try {
1438
+ if (stub) {
1439
+ const displayE = 'Error 400 received on request';
1440
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1441
+ } else {
1442
+ runCommonAsserts(data, error);
1443
+ }
1444
+ saveMockData('Tag', 'findTags', 'default', data);
1445
+ done();
1446
+ } catch (err) {
1447
+ log.error(`Test Failure: ${err}`);
1448
+ done(err);
1449
+ }
1450
+ });
1451
+ } catch (error) {
1452
+ log.error(`Adapter Exception: ${error}`);
1453
+ done(error);
1454
+ }
1455
+ }).timeout(attemptTimeout);
1456
+ });
1457
+
1458
+ const customDimensionCreateCustomDimensionBodyParam = {
1459
+ name: 'string',
1460
+ type: null,
1461
+ display_name: 'string'
1462
+ };
1463
+ describe('#createCustomDimension - errors', () => {
1464
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1465
+ try {
1466
+ a.createCustomDimension(customDimensionCreateCustomDimensionBodyParam, (data, error) => {
1467
+ try {
1468
+ if (stub) {
1469
+ const displayE = 'Error 400 received on request';
1470
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1471
+ } else {
1472
+ runCommonAsserts(data, error);
1473
+ }
1474
+ saveMockData('CustomDimension', 'createCustomDimension', 'default', data);
1475
+ done();
1476
+ } catch (err) {
1477
+ log.error(`Test Failure: ${err}`);
1478
+ done(err);
1479
+ }
1480
+ });
1481
+ } catch (error) {
1482
+ log.error(`Adapter Exception: ${error}`);
1483
+ done(error);
1484
+ }
1485
+ }).timeout(attemptTimeout);
1486
+ });
1487
+
1488
+ const customDimensionDimensionId = 555;
1489
+ const customDimensionCreatePopulatorBodyParam = {
1490
+ populator: {
1491
+ value: 'string',
1492
+ direction: null,
1493
+ device_name: 'string',
1494
+ device_type: 'string',
1495
+ site: 'string',
1496
+ interface_name: 'string',
1497
+ addr: 'string',
1498
+ port: 'string',
1499
+ tcp_flags: 'string',
1500
+ protocol: 'string',
1501
+ asn: 'string',
1502
+ lasthop_as_name: 'string',
1503
+ nexthop_asn: 'string',
1504
+ nexthop_as_name: 'string',
1505
+ nexthop: 'string',
1506
+ bgp_aspath: 'string',
1507
+ bgp_community: 'string',
1508
+ mac: 'string',
1509
+ country: 'string',
1510
+ vlans: 'string'
1511
+ }
1512
+ };
1513
+ describe('#createPopulator - errors', () => {
1514
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1515
+ try {
1516
+ a.createPopulator(customDimensionDimensionId, customDimensionCreatePopulatorBodyParam, (data, error) => {
1517
+ try {
1518
+ if (stub) {
1519
+ const displayE = 'Error 400 received on request';
1520
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1521
+ } else {
1522
+ runCommonAsserts(data, error);
1523
+ }
1524
+ saveMockData('CustomDimension', 'createPopulator', 'default', data);
1525
+ done();
1526
+ } catch (err) {
1527
+ log.error(`Test Failure: ${err}`);
1528
+ done(err);
1529
+ }
1530
+ });
1531
+ } catch (error) {
1532
+ log.error(`Adapter Exception: ${error}`);
1533
+ done(error);
1534
+ }
1535
+ }).timeout(attemptTimeout);
1536
+ });
1537
+
1538
+ const customDimensionUpdateCustomDimensionBodyParam = {
1539
+ display_name: 'string'
1540
+ };
1541
+ describe('#updateCustomDimension - errors', () => {
1542
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1543
+ try {
1544
+ a.updateCustomDimension(customDimensionDimensionId, customDimensionUpdateCustomDimensionBodyParam, (data, error) => {
1545
+ try {
1546
+ if (stub) {
1547
+ const displayE = 'Error 400 received on request';
1548
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1549
+ } else {
1550
+ runCommonAsserts(data, error);
1551
+ }
1552
+ saveMockData('CustomDimension', 'updateCustomDimension', 'default', data);
1553
+ done();
1554
+ } catch (err) {
1555
+ log.error(`Test Failure: ${err}`);
1556
+ done(err);
1557
+ }
1558
+ });
1559
+ } catch (error) {
1560
+ log.error(`Adapter Exception: ${error}`);
1561
+ done(error);
1562
+ }
1563
+ }).timeout(attemptTimeout);
1564
+ });
1565
+
1566
+ describe('#findCustomDimension - errors', () => {
1567
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1568
+ try {
1569
+ a.findCustomDimension(customDimensionDimensionId, (data, error) => {
1570
+ try {
1571
+ if (stub) {
1572
+ const displayE = 'Error 400 received on request';
1573
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1574
+ } else {
1575
+ runCommonAsserts(data, error);
1576
+ }
1577
+ saveMockData('CustomDimension', 'findCustomDimension', 'default', data);
1578
+ done();
1579
+ } catch (err) {
1580
+ log.error(`Test Failure: ${err}`);
1581
+ done(err);
1582
+ }
1583
+ });
1584
+ } catch (error) {
1585
+ log.error(`Adapter Exception: ${error}`);
1586
+ done(error);
1587
+ }
1588
+ }).timeout(attemptTimeout);
1589
+ });
1590
+
1591
+ const customDimensionPopulatorId = 555;
1592
+ const customDimensionUpdatePopulatorBodyParam = {
1593
+ populator: {
1594
+ value: 'string',
1595
+ direction: null,
1596
+ device_name: 'string',
1597
+ device_type: 'string',
1598
+ site: 'string',
1599
+ interface_name: 'string',
1600
+ addr: 'string',
1601
+ port: 'string',
1602
+ tcp_flags: 'string',
1603
+ protocol: 'string',
1604
+ asn: 'string',
1605
+ lasthop_as_name: 'string',
1606
+ nexthop_asn: 'string',
1607
+ nexthop_as_name: 'string',
1608
+ nexthop: 'string',
1609
+ bgp_aspath: 'string',
1610
+ bgp_community: 'string',
1611
+ mac: 'string',
1612
+ country: 'string',
1613
+ vlans: 'string'
1614
+ }
1615
+ };
1616
+ describe('#updatePopulator - errors', () => {
1617
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1618
+ try {
1619
+ a.updatePopulator(customDimensionPopulatorId, customDimensionDimensionId, customDimensionUpdatePopulatorBodyParam, (data, error) => {
1620
+ try {
1621
+ if (stub) {
1622
+ const displayE = 'Error 400 received on request';
1623
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1624
+ } else {
1625
+ runCommonAsserts(data, error);
1626
+ }
1627
+ saveMockData('CustomDimension', 'updatePopulator', 'default', data);
1628
+ done();
1629
+ } catch (err) {
1630
+ log.error(`Test Failure: ${err}`);
1631
+ done(err);
1632
+ }
1633
+ });
1634
+ } catch (error) {
1635
+ log.error(`Adapter Exception: ${error}`);
1636
+ done(error);
1637
+ }
1638
+ }).timeout(attemptTimeout);
1639
+ });
1640
+
1641
+ describe('#findCustomDimensions - errors', () => {
1642
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1643
+ try {
1644
+ a.findCustomDimensions((data, error) => {
1645
+ try {
1646
+ if (stub) {
1647
+ const displayE = 'Error 400 received on request';
1648
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1649
+ } else {
1650
+ runCommonAsserts(data, error);
1651
+ }
1652
+ saveMockData('CustomDimension', 'findCustomDimensions', 'default', data);
1653
+ done();
1654
+ } catch (err) {
1655
+ log.error(`Test Failure: ${err}`);
1656
+ done(err);
1657
+ }
1658
+ });
1659
+ } catch (error) {
1660
+ log.error(`Adapter Exception: ${error}`);
1661
+ done(error);
1662
+ }
1663
+ }).timeout(attemptTimeout);
1664
+ });
1665
+
1666
+ const customApplicationCreateCustomApplicationBodyParam = {
1667
+ name: 'string'
1668
+ };
1669
+ describe('#createCustomApplication - errors', () => {
1670
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1671
+ try {
1672
+ a.createCustomApplication(customApplicationCreateCustomApplicationBodyParam, (data, error) => {
1673
+ try {
1674
+ if (stub) {
1675
+ const displayE = 'Error 400 received on request';
1676
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1677
+ } else {
1678
+ runCommonAsserts(data, error);
1679
+ }
1680
+ saveMockData('CustomApplication', 'createCustomApplication', 'default', data);
1681
+ done();
1682
+ } catch (err) {
1683
+ log.error(`Test Failure: ${err}`);
1684
+ done(err);
1685
+ }
1686
+ });
1687
+ } catch (error) {
1688
+ log.error(`Adapter Exception: ${error}`);
1689
+ done(error);
1690
+ }
1691
+ }).timeout(attemptTimeout);
1692
+ });
1693
+
1694
+ describe('#findCustomApplications - errors', () => {
1695
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1696
+ try {
1697
+ a.findCustomApplications((data, error) => {
1698
+ try {
1699
+ if (stub) {
1700
+ const displayE = 'Error 400 received on request';
1701
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1702
+ } else {
1703
+ runCommonAsserts(data, error);
1704
+ }
1705
+ saveMockData('CustomApplication', 'findCustomApplications', 'default', data);
1706
+ done();
1707
+ } catch (err) {
1708
+ log.error(`Test Failure: ${err}`);
1709
+ done(err);
1710
+ }
1711
+ });
1712
+ } catch (error) {
1713
+ log.error(`Adapter Exception: ${error}`);
1714
+ done(error);
1715
+ }
1716
+ }).timeout(attemptTimeout);
1717
+ });
1718
+
1719
+ const customApplicationApplicationId = 555;
1720
+ const customApplicationUpdateCustomApplicationBodyParam = {
1721
+ name: 'string',
1722
+ description: 'string',
1723
+ ip_range: 'string',
1724
+ protocol: 'string',
1725
+ port: 'string',
1726
+ asn: 'string'
1727
+ };
1728
+ describe('#updateCustomApplication - errors', () => {
1729
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1730
+ try {
1731
+ a.updateCustomApplication(customApplicationApplicationId, customApplicationUpdateCustomApplicationBodyParam, (data, error) => {
1732
+ try {
1733
+ if (stub) {
1734
+ const displayE = 'Error 400 received on request';
1735
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1736
+ } else {
1737
+ runCommonAsserts(data, error);
1738
+ }
1739
+ saveMockData('CustomApplication', 'updateCustomApplication', 'default', data);
1740
+ done();
1741
+ } catch (err) {
1742
+ log.error(`Test Failure: ${err}`);
1743
+ done(err);
1744
+ }
1745
+ });
1746
+ } catch (error) {
1747
+ log.error(`Adapter Exception: ${error}`);
1748
+ done(error);
1749
+ }
1750
+ }).timeout(attemptTimeout);
1751
+ });
1752
+
1753
+ const savedfilterCreateSavedFilterBodyParam = {
1754
+ filter_name: 'string'
1755
+ };
1756
+ describe('#createSavedFilter - errors', () => {
1757
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1758
+ try {
1759
+ a.createSavedFilter(savedfilterCreateSavedFilterBodyParam, (data, error) => {
1760
+ try {
1761
+ if (stub) {
1762
+ const displayE = 'Error 400 received on request';
1763
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1764
+ } else {
1765
+ runCommonAsserts(data, error);
1766
+ }
1767
+ saveMockData('Savedfilter', 'createSavedFilter', 'default', data);
1768
+ done();
1769
+ } catch (err) {
1770
+ log.error(`Test Failure: ${err}`);
1771
+ done(err);
1772
+ }
1773
+ });
1774
+ } catch (error) {
1775
+ log.error(`Adapter Exception: ${error}`);
1776
+ done(error);
1777
+ }
1778
+ }).timeout(attemptTimeout);
1779
+ });
1780
+
1781
+ const savedfilterSavedfilterId = 555;
1782
+ const savedfilterUpdateSavedFilterBodyParam = {
1783
+ filter_name: 'string',
1784
+ filter_description: 'string',
1785
+ filters: {
1786
+ connector: null,
1787
+ filterGroups: [
1788
+ {
1789
+ connector: null,
1790
+ filters: [
1791
+ {
1792
+ filterField: null,
1793
+ operator: null,
1794
+ filterValue: 'string'
1795
+ }
1796
+ ],
1797
+ not: false
1798
+ }
1799
+ ]
1800
+ }
1801
+ };
1802
+ describe('#updateSavedFilter - errors', () => {
1803
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1804
+ try {
1805
+ a.updateSavedFilter(savedfilterSavedfilterId, savedfilterUpdateSavedFilterBodyParam, (data, error) => {
1806
+ try {
1807
+ if (stub) {
1808
+ const displayE = 'Error 400 received on request';
1809
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1810
+ } else {
1811
+ runCommonAsserts(data, error);
1812
+ }
1813
+ saveMockData('Savedfilter', 'updateSavedFilter', 'default', data);
1814
+ done();
1815
+ } catch (err) {
1816
+ log.error(`Test Failure: ${err}`);
1817
+ done(err);
1818
+ }
1819
+ });
1820
+ } catch (error) {
1821
+ log.error(`Adapter Exception: ${error}`);
1822
+ done(error);
1823
+ }
1824
+ }).timeout(attemptTimeout);
1825
+ });
1826
+
1827
+ describe('#findSavedFilter - errors', () => {
1828
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1829
+ try {
1830
+ a.findSavedFilter(savedfilterSavedfilterId, (data, error) => {
1831
+ try {
1832
+ if (stub) {
1833
+ const displayE = 'Error 400 received on request';
1834
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1835
+ } else {
1836
+ runCommonAsserts(data, error);
1837
+ }
1838
+ saveMockData('Savedfilter', 'findSavedFilter', 'default', data);
1839
+ done();
1840
+ } catch (err) {
1841
+ log.error(`Test Failure: ${err}`);
1842
+ done(err);
1843
+ }
1844
+ });
1845
+ } catch (error) {
1846
+ log.error(`Adapter Exception: ${error}`);
1847
+ done(error);
1848
+ }
1849
+ }).timeout(attemptTimeout);
1850
+ });
1851
+
1852
+ describe('#findSavedFilters - errors', () => {
1853
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1854
+ try {
1855
+ a.findSavedFilters((data, error) => {
1856
+ try {
1857
+ if (stub) {
1858
+ const displayE = 'Error 400 received on request';
1859
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1860
+ } else {
1861
+ runCommonAsserts(data, error);
1862
+ }
1863
+ saveMockData('Savedfilter', 'findSavedFilters', 'default', data);
1864
+ done();
1865
+ } catch (err) {
1866
+ log.error(`Test Failure: ${err}`);
1867
+ done(err);
1868
+ }
1869
+ });
1870
+ } catch (error) {
1871
+ log.error(`Adapter Exception: ${error}`);
1872
+ done(error);
1873
+ }
1874
+ }).timeout(attemptTimeout);
1875
+ });
1876
+
1877
+ const alertsCreateManualMitigationBodyParam = {
1878
+ ipCidr: 'string',
1879
+ platformID: 'string',
1880
+ methodID: 'string'
1881
+ };
1882
+ describe('#createManualMitigation - errors', () => {
1883
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1884
+ try {
1885
+ a.createManualMitigation(alertsCreateManualMitigationBodyParam, (data, error) => {
1886
+ try {
1887
+ if (stub) {
1888
+ const displayE = 'Error 400 received on request';
1889
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1890
+ } else {
1891
+ runCommonAsserts(data, error);
1892
+ }
1893
+ saveMockData('Alerts', 'createManualMitigation', 'default', data);
1894
+ done();
1895
+ } catch (err) {
1896
+ log.error(`Test Failure: ${err}`);
1897
+ done(err);
1898
+ }
1899
+ });
1900
+ } catch (error) {
1901
+ log.error(`Adapter Exception: ${error}`);
1902
+ done(error);
1903
+ }
1904
+ }).timeout(attemptTimeout);
1905
+ });
1906
+
1907
+ const alertsActiveStartTime = 'fakedata';
1908
+ const alertsActiveEndTime = 'fakedata';
1909
+ const alertsActiveFilterBy = 'fakedata';
1910
+ const alertsActiveFilterVal = 'fakedata';
1911
+ const alertsActiveShowMitigations = 555;
1912
+ const alertsActiveShowAlarms = 555;
1913
+ const alertsActiveShowMatches = 555;
1914
+ const alertsActiveLearningMode = 555;
1915
+ describe('#alarms - errors', () => {
1916
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1917
+ try {
1918
+ a.alarms(alertsActiveStartTime, alertsActiveEndTime, alertsActiveFilterBy, alertsActiveFilterVal, alertsActiveShowMitigations, alertsActiveShowAlarms, alertsActiveShowMatches, alertsActiveLearningMode, (data, error) => {
1919
+ try {
1920
+ if (stub) {
1921
+ const displayE = 'Error 400 received on request';
1922
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1923
+ } else {
1924
+ runCommonAsserts(data, error);
1925
+ }
1926
+ saveMockData('AlertsActive', 'alarms', 'default', data);
1927
+ done();
1928
+ } catch (err) {
1929
+ log.error(`Test Failure: ${err}`);
1930
+ done(err);
1931
+ }
1932
+ });
1933
+ } catch (error) {
1934
+ log.error(`Adapter Exception: ${error}`);
1935
+ done(error);
1936
+ }
1937
+ }).timeout(attemptTimeout);
1938
+ });
1939
+
1940
+ const alertsActiveSortOrder = 'fakedata';
1941
+ describe('#alertsHistory - errors', () => {
1942
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1943
+ try {
1944
+ a.alertsHistory(alertsActiveStartTime, alertsActiveEndTime, alertsActiveFilterBy, alertsActiveFilterVal, alertsActiveSortOrder, alertsActiveShowMitigations, alertsActiveShowAlarms, alertsActiveShowMatches, alertsActiveLearningMode, (data, error) => {
1945
+ try {
1946
+ if (stub) {
1947
+ const displayE = 'Error 400 received on request';
1948
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1949
+ } else {
1950
+ runCommonAsserts(data, error);
1951
+ }
1952
+ saveMockData('AlertsActive', 'alertsHistory', 'default', data);
1953
+ done();
1954
+ } catch (err) {
1955
+ log.error(`Test Failure: ${err}`);
1956
+ done(err);
1957
+ }
1958
+ });
1959
+ } catch (error) {
1960
+ log.error(`Adapter Exception: ${error}`);
1961
+ done(error);
1962
+ }
1963
+ }).timeout(attemptTimeout);
1964
+ });
1965
+
1966
+ const myKentikPortalTenantId = 555;
1967
+ const myKentikPortalCreateTenantUserBodyParam = {
1968
+ user: {
1969
+ user_email: 'string'
1970
+ }
1971
+ };
1972
+ describe('#createTenantUser - errors', () => {
1973
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1974
+ try {
1975
+ a.createTenantUser(myKentikPortalTenantId, myKentikPortalCreateTenantUserBodyParam, (data, error) => {
1976
+ try {
1977
+ if (stub) {
1978
+ const displayE = 'Error 400 received on request';
1979
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
1980
+ } else {
1981
+ runCommonAsserts(data, error);
1982
+ }
1983
+ saveMockData('MyKentikPortal', 'createTenantUser', 'default', data);
1984
+ done();
1985
+ } catch (err) {
1986
+ log.error(`Test Failure: ${err}`);
1987
+ done(err);
1988
+ }
1989
+ });
1990
+ } catch (error) {
1991
+ log.error(`Adapter Exception: ${error}`);
1992
+ done(error);
1993
+ }
1994
+ }).timeout(attemptTimeout);
1995
+ });
1996
+
1997
+ describe('#findUserGroup - errors', () => {
1998
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1999
+ try {
2000
+ a.findUserGroup(myKentikPortalTenantId, (data, error) => {
2001
+ try {
2002
+ if (stub) {
2003
+ const displayE = 'Error 400 received on request';
2004
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
2005
+ } else {
2006
+ runCommonAsserts(data, error);
2007
+ }
2008
+ saveMockData('MyKentikPortal', 'findUserGroup', 'default', data);
2009
+ done();
2010
+ } catch (err) {
2011
+ log.error(`Test Failure: ${err}`);
2012
+ done(err);
2013
+ }
2014
+ });
2015
+ } catch (error) {
2016
+ log.error(`Adapter Exception: ${error}`);
2017
+ done(error);
2018
+ }
2019
+ }).timeout(attemptTimeout);
2020
+ });
2021
+
2022
+ describe('#findUserGroups - errors', () => {
2023
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2024
+ try {
2025
+ a.findUserGroups((data, error) => {
2026
+ try {
2027
+ if (stub) {
2028
+ const displayE = 'Error 400 received on request';
2029
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
2030
+ } else {
2031
+ runCommonAsserts(data, error);
2032
+ }
2033
+ saveMockData('MyKentikPortal', 'findUserGroups', 'default', data);
2034
+ done();
2035
+ } catch (err) {
2036
+ log.error(`Test Failure: ${err}`);
2037
+ done(err);
2038
+ }
2039
+ });
2040
+ } catch (error) {
2041
+ log.error(`Adapter Exception: ${error}`);
2042
+ done(error);
2043
+ }
2044
+ }).timeout(attemptTimeout);
2045
+ });
2046
+
2047
+ describe('#deleteUser - errors', () => {
2048
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2049
+ try {
2050
+ a.deleteUser(userUserId, (data, error) => {
2051
+ try {
2052
+ if (stub) {
2053
+ const displayE = 'Error 400 received on request';
2054
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
2055
+ } else {
2056
+ runCommonAsserts(data, error);
2057
+ }
2058
+ saveMockData('User', 'deleteUser', 'default', data);
2059
+ done();
2060
+ } catch (err) {
2061
+ log.error(`Test Failure: ${err}`);
2062
+ done(err);
2063
+ }
2064
+ });
2065
+ } catch (error) {
2066
+ log.error(`Adapter Exception: ${error}`);
2067
+ done(error);
2068
+ }
2069
+ }).timeout(attemptTimeout);
2070
+ });
2071
+
2072
+ describe('#deleteDevice - errors', () => {
2073
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2074
+ try {
2075
+ a.deleteDevice(deviceDeviceId, (data, error) => {
2076
+ try {
2077
+ if (stub) {
2078
+ const displayE = 'Error 400 received on request';
2079
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
2080
+ } else {
2081
+ runCommonAsserts(data, error);
2082
+ }
2083
+ saveMockData('Device', 'deleteDevice', 'default', data);
2084
+ done();
2085
+ } catch (err) {
2086
+ log.error(`Test Failure: ${err}`);
2087
+ done(err);
2088
+ }
2089
+ });
2090
+ } catch (error) {
2091
+ log.error(`Adapter Exception: ${error}`);
2092
+ done(error);
2093
+ }
2094
+ }).timeout(attemptTimeout);
2095
+ });
2096
+
2097
+ describe('#deleteInterface - errors', () => {
2098
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2099
+ try {
2100
+ a.deleteInterface(deviceDeviceId, deviceInterfaceId, (data, error) => {
2101
+ try {
2102
+ if (stub) {
2103
+ const displayE = 'Error 400 received on request';
2104
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
2105
+ } else {
2106
+ runCommonAsserts(data, error);
2107
+ }
2108
+ saveMockData('Device', 'deleteInterface', 'default', data);
2109
+ done();
2110
+ } catch (err) {
2111
+ log.error(`Test Failure: ${err}`);
2112
+ done(err);
2113
+ }
2114
+ });
2115
+ } catch (error) {
2116
+ log.error(`Adapter Exception: ${error}`);
2117
+ done(error);
2118
+ }
2119
+ }).timeout(attemptTimeout);
2120
+ });
2121
+
2122
+ describe('#deleteDeviceLabel - errors', () => {
2123
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2124
+ try {
2125
+ a.deleteDeviceLabel(deviceLabelDeviceLabelId, (data, error) => {
2126
+ try {
2127
+ if (stub) {
2128
+ const displayE = 'Error 400 received on request';
2129
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
2130
+ } else {
2131
+ runCommonAsserts(data, error);
2132
+ }
2133
+ saveMockData('DeviceLabel', 'deleteDeviceLabel', 'default', data);
2134
+ done();
2135
+ } catch (err) {
2136
+ log.error(`Test Failure: ${err}`);
2137
+ done(err);
2138
+ }
2139
+ });
2140
+ } catch (error) {
2141
+ log.error(`Adapter Exception: ${error}`);
2142
+ done(error);
2143
+ }
2144
+ }).timeout(attemptTimeout);
2145
+ });
2146
+
2147
+ describe('#deleteSite - errors', () => {
2148
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2149
+ try {
2150
+ a.deleteSite(siteSiteId, (data, error) => {
2151
+ try {
2152
+ if (stub) {
2153
+ const displayE = 'Error 400 received on request';
2154
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
2155
+ } else {
2156
+ runCommonAsserts(data, error);
2157
+ }
2158
+ saveMockData('Site', 'deleteSite', 'default', data);
2159
+ done();
2160
+ } catch (err) {
2161
+ log.error(`Test Failure: ${err}`);
2162
+ done(err);
2163
+ }
2164
+ });
2165
+ } catch (error) {
2166
+ log.error(`Adapter Exception: ${error}`);
2167
+ done(error);
2168
+ }
2169
+ }).timeout(attemptTimeout);
2170
+ });
2171
+
2172
+ describe('#deleteTag - errors', () => {
2173
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2174
+ try {
2175
+ a.deleteTag(tagTagId, (data, error) => {
2176
+ try {
2177
+ if (stub) {
2178
+ const displayE = 'Error 400 received on request';
2179
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
2180
+ } else {
2181
+ runCommonAsserts(data, error);
2182
+ }
2183
+ saveMockData('Tag', 'deleteTag', 'default', data);
2184
+ done();
2185
+ } catch (err) {
2186
+ log.error(`Test Failure: ${err}`);
2187
+ done(err);
2188
+ }
2189
+ });
2190
+ } catch (error) {
2191
+ log.error(`Adapter Exception: ${error}`);
2192
+ done(error);
2193
+ }
2194
+ }).timeout(attemptTimeout);
2195
+ });
2196
+
2197
+ describe('#deleteCustomDimension - errors', () => {
2198
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2199
+ try {
2200
+ a.deleteCustomDimension(customDimensionDimensionId, (data, error) => {
2201
+ try {
2202
+ if (stub) {
2203
+ const displayE = 'Error 400 received on request';
2204
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
2205
+ } else {
2206
+ runCommonAsserts(data, error);
2207
+ }
2208
+ saveMockData('CustomDimension', 'deleteCustomDimension', 'default', data);
2209
+ done();
2210
+ } catch (err) {
2211
+ log.error(`Test Failure: ${err}`);
2212
+ done(err);
2213
+ }
2214
+ });
2215
+ } catch (error) {
2216
+ log.error(`Adapter Exception: ${error}`);
2217
+ done(error);
2218
+ }
2219
+ }).timeout(attemptTimeout);
2220
+ });
2221
+
2222
+ describe('#deletePopulator - errors', () => {
2223
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2224
+ try {
2225
+ a.deletePopulator(customDimensionPopulatorId, customDimensionDimensionId, (data, error) => {
2226
+ try {
2227
+ if (stub) {
2228
+ const displayE = 'Error 400 received on request';
2229
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
2230
+ } else {
2231
+ runCommonAsserts(data, error);
2232
+ }
2233
+ saveMockData('CustomDimension', 'deletePopulator', 'default', data);
2234
+ done();
2235
+ } catch (err) {
2236
+ log.error(`Test Failure: ${err}`);
2237
+ done(err);
2238
+ }
2239
+ });
2240
+ } catch (error) {
2241
+ log.error(`Adapter Exception: ${error}`);
2242
+ done(error);
2243
+ }
2244
+ }).timeout(attemptTimeout);
2245
+ });
2246
+
2247
+ describe('#deleteCustomApplication - errors', () => {
2248
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2249
+ try {
2250
+ a.deleteCustomApplication(customApplicationApplicationId, (data, error) => {
2251
+ try {
2252
+ if (stub) {
2253
+ const displayE = 'Error 400 received on request';
2254
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
2255
+ } else {
2256
+ runCommonAsserts(data, error);
2257
+ }
2258
+ saveMockData('CustomApplication', 'deleteCustomApplication', 'default', data);
2259
+ done();
2260
+ } catch (err) {
2261
+ log.error(`Test Failure: ${err}`);
2262
+ done(err);
2263
+ }
2264
+ });
2265
+ } catch (error) {
2266
+ log.error(`Adapter Exception: ${error}`);
2267
+ done(error);
2268
+ }
2269
+ }).timeout(attemptTimeout);
2270
+ });
2271
+
2272
+ describe('#deleteSavedFilter - errors', () => {
2273
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2274
+ try {
2275
+ a.deleteSavedFilter(savedfilterSavedfilterId, (data, error) => {
2276
+ try {
2277
+ if (stub) {
2278
+ const displayE = 'Error 400 received on request';
2279
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
2280
+ } else {
2281
+ runCommonAsserts(data, error);
2282
+ }
2283
+ saveMockData('Savedfilter', 'deleteSavedFilter', 'default', data);
2284
+ done();
2285
+ } catch (err) {
2286
+ log.error(`Test Failure: ${err}`);
2287
+ done(err);
2288
+ }
2289
+ });
2290
+ } catch (error) {
2291
+ log.error(`Adapter Exception: ${error}`);
2292
+ done(error);
2293
+ }
2294
+ }).timeout(attemptTimeout);
2295
+ });
2296
+
2297
+ const myKentikPortalUserId = 555;
2298
+ describe('#deleteTenantUser - errors', () => {
2299
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
2300
+ try {
2301
+ a.deleteTenantUser(myKentikPortalTenantId, myKentikPortalUserId, (data, error) => {
2302
+ try {
2303
+ if (stub) {
2304
+ const displayE = 'Error 400 received on request';
2305
+ runErrorAsserts(data, error, 'AD.500', 'Test-kentik_v5-connectorRest-handleEndResponse', displayE);
2306
+ } else {
2307
+ runCommonAsserts(data, error);
2308
+ }
2309
+ saveMockData('MyKentikPortal', 'deleteTenantUser', 'default', data);
2310
+ done();
2311
+ } catch (err) {
2312
+ log.error(`Test Failure: ${err}`);
2313
+ done(err);
2314
+ }
2315
+ });
2316
+ } catch (error) {
2317
+ log.error(`Adapter Exception: ${error}`);
2318
+ done(error);
2319
+ }
2320
+ }).timeout(attemptTimeout);
2321
+ });
2322
+ });
2323
+ });