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