@itentialopensource/adapter-aruba_airwave 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +6 -0
- package/.eslintrc.js +18 -0
- package/.gitlab/.gitkeep +0 -0
- package/.gitlab/issue_templates/.gitkeep +0 -0
- package/.gitlab/issue_templates/Default.md +17 -0
- package/.gitlab/issue_templates/bugReportTemplate.md +76 -0
- package/.gitlab/issue_templates/featureRequestTemplate.md +14 -0
- package/.jshintrc +0 -0
- package/CHANGELOG.md +9 -0
- package/CODE_OF_CONDUCT.md +48 -0
- package/CONTRIBUTING.md +158 -0
- package/LICENSE +201 -0
- package/README.md +544 -0
- package/adapter.js +2860 -0
- package/adapterBase.js +906 -0
- package/entities/.system/action.json +50 -0
- package/entities/.system/mockdatafiles/getToken-default.json +3 -0
- package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
- package/entities/.system/schema.json +19 -0
- package/entities/.system/schemaTokenReq.json +77 -0
- package/entities/.system/schemaTokenResp.json +65 -0
- package/entities/BatchExecuteAPCommandsAPIS/action.json +45 -0
- package/entities/BatchExecuteAPCommandsAPIS/schema.json +20 -0
- package/entities/ConfigurationAPIS/action.json +126 -0
- package/entities/ConfigurationAPIS/schema.json +90 -0
- package/entities/DeviceAPIS/action.json +46 -0
- package/entities/DeviceAPIS/schema.json +20 -0
- package/entities/LOGIN/action.json +24 -0
- package/entities/LOGIN/schema.json +41 -0
- package/entities/QueryAPIS/action.json +298 -0
- package/entities/QueryAPIS/schema.json +32 -0
- package/entities/ReportAPIS/action.json +25 -0
- package/entities/ReportAPIS/schema.json +30 -0
- package/entities/SearchAPIS/action.json +67 -0
- package/entities/SearchAPIS/schema.json +21 -0
- package/error.json +184 -0
- package/package.json +86 -0
- package/pronghorn.json +1589 -0
- package/propertiesSchema.json +801 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/ArubaAirwavePostman.json-OpenApi3Json.json +1583 -0
- package/report/creationReport.json +381 -0
- package/sampleProperties.json +97 -0
- package/test/integration/adapterTestBasicGet.js +85 -0
- package/test/integration/adapterTestConnectivity.js +93 -0
- package/test/integration/adapterTestIntegration.js +1125 -0
- package/test/unit/adapterBaseTestUnit.js +929 -0
- package/test/unit/adapterTestUnit.js +1413 -0
- package/utils/artifactize.js +146 -0
- package/utils/basicGet.js +63 -0
- package/utils/packModificationScript.js +35 -0
- package/utils/pre-commit.sh +27 -0
- package/utils/setup.js +33 -0
- package/utils/tbScript.js +163 -0
- package/utils/tbUtils.js +372 -0
- package/utils/testRunner.js +298 -0
- package/utils/troubleshootingAdapter.js +219 -0
- package/workflows/README.md +3 -0
|
@@ -0,0 +1,1413 @@
|
|
|
1
|
+
/* @copyright Itential, LLC 2019 (pre-modifications) */
|
|
2
|
+
|
|
3
|
+
// Set globals
|
|
4
|
+
/* global describe it log pronghornProps */
|
|
5
|
+
/* eslint global-require: warn */
|
|
6
|
+
/* eslint no-unused-vars: warn */
|
|
7
|
+
|
|
8
|
+
// include required items for testing & logging
|
|
9
|
+
const assert = require('assert');
|
|
10
|
+
const fs = require('fs-extra');
|
|
11
|
+
const mocha = require('mocha');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const util = require('util');
|
|
14
|
+
const winston = require('winston');
|
|
15
|
+
const execute = require('child_process').execSync;
|
|
16
|
+
const { expect } = require('chai');
|
|
17
|
+
const { use } = require('chai');
|
|
18
|
+
const td = require('testdouble');
|
|
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 stub = true;
|
|
25
|
+
const isRapidFail = false;
|
|
26
|
+
const attemptTimeout = 120000;
|
|
27
|
+
|
|
28
|
+
// these variables can be changed to run in integrated mode so easier to set them here
|
|
29
|
+
// always check these in with bogus data!!!
|
|
30
|
+
const host = 'replace.hostorip.here';
|
|
31
|
+
const username = 'username';
|
|
32
|
+
const password = 'password';
|
|
33
|
+
const protocol = 'http';
|
|
34
|
+
const port = 80;
|
|
35
|
+
const sslenable = false;
|
|
36
|
+
const sslinvalid = false;
|
|
37
|
+
|
|
38
|
+
// these are the adapter properties. You generally should not need to alter
|
|
39
|
+
// any of these after they are initially set up
|
|
40
|
+
global.pronghornProps = {
|
|
41
|
+
pathProps: {
|
|
42
|
+
encrypted: false
|
|
43
|
+
},
|
|
44
|
+
adapterProps: {
|
|
45
|
+
adapters: [{
|
|
46
|
+
id: 'Test-aruba_airwave',
|
|
47
|
+
type: 'ArubaAirwave',
|
|
48
|
+
properties: {
|
|
49
|
+
host,
|
|
50
|
+
port,
|
|
51
|
+
base_path: '/',
|
|
52
|
+
version: '',
|
|
53
|
+
cache_location: 'none',
|
|
54
|
+
encode_pathvars: true,
|
|
55
|
+
save_metric: false,
|
|
56
|
+
stub,
|
|
57
|
+
protocol,
|
|
58
|
+
authentication: {
|
|
59
|
+
auth_method: 'no_authentication',
|
|
60
|
+
username,
|
|
61
|
+
password,
|
|
62
|
+
token: '',
|
|
63
|
+
invalid_token_error: 401,
|
|
64
|
+
token_timeout: -1,
|
|
65
|
+
token_cache: 'local',
|
|
66
|
+
auth_field: 'header.headers.Authorization',
|
|
67
|
+
auth_field_format: 'Basic {b64}{username}:{password}{/b64}'
|
|
68
|
+
},
|
|
69
|
+
healthcheck: {
|
|
70
|
+
type: 'none',
|
|
71
|
+
frequency: 60000
|
|
72
|
+
},
|
|
73
|
+
throttle: {
|
|
74
|
+
throttle_enabled: false,
|
|
75
|
+
number_pronghorns: 1,
|
|
76
|
+
sync_async: 'sync',
|
|
77
|
+
max_in_queue: 1000,
|
|
78
|
+
concurrent_max: 1,
|
|
79
|
+
expire_timeout: 0,
|
|
80
|
+
avg_runtime: 200,
|
|
81
|
+
priorities: [
|
|
82
|
+
{
|
|
83
|
+
value: 0,
|
|
84
|
+
percent: 100
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
request: {
|
|
89
|
+
number_redirects: 0,
|
|
90
|
+
number_retries: 3,
|
|
91
|
+
limit_retry_error: [0],
|
|
92
|
+
failover_codes: [],
|
|
93
|
+
attempt_timeout: attemptTimeout,
|
|
94
|
+
global_request: {
|
|
95
|
+
payload: {},
|
|
96
|
+
uriOptions: {},
|
|
97
|
+
addlHeaders: {},
|
|
98
|
+
authData: {}
|
|
99
|
+
},
|
|
100
|
+
healthcheck_on_timeout: true,
|
|
101
|
+
return_raw: true,
|
|
102
|
+
archiving: false
|
|
103
|
+
},
|
|
104
|
+
proxy: {
|
|
105
|
+
enabled: false,
|
|
106
|
+
host: '',
|
|
107
|
+
port: 1,
|
|
108
|
+
protocol: 'http'
|
|
109
|
+
},
|
|
110
|
+
ssl: {
|
|
111
|
+
ecdhCurve: '',
|
|
112
|
+
enabled: sslenable,
|
|
113
|
+
accept_invalid_cert: sslinvalid,
|
|
114
|
+
ca_file: '',
|
|
115
|
+
key_file: '',
|
|
116
|
+
cert_file: '',
|
|
117
|
+
secure_protocol: '',
|
|
118
|
+
ciphers: ''
|
|
119
|
+
},
|
|
120
|
+
mongo: {
|
|
121
|
+
host: '',
|
|
122
|
+
port: 0,
|
|
123
|
+
database: '',
|
|
124
|
+
username: '',
|
|
125
|
+
password: '',
|
|
126
|
+
replSet: '',
|
|
127
|
+
db_ssl: {
|
|
128
|
+
enabled: false,
|
|
129
|
+
accept_invalid_cert: false,
|
|
130
|
+
ca_file: '',
|
|
131
|
+
key_file: '',
|
|
132
|
+
cert_file: ''
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}]
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
global.$HOME = `${__dirname}/../..`;
|
|
141
|
+
|
|
142
|
+
// set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
|
|
143
|
+
// this you may error on log.trace calls.
|
|
144
|
+
const myCustomLevels = {
|
|
145
|
+
levels: {
|
|
146
|
+
spam: 6,
|
|
147
|
+
trace: 5,
|
|
148
|
+
debug: 4,
|
|
149
|
+
info: 3,
|
|
150
|
+
warn: 2,
|
|
151
|
+
error: 1,
|
|
152
|
+
none: 0
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// need to see if there is a log level passed in
|
|
157
|
+
process.argv.forEach((val) => {
|
|
158
|
+
// is there a log level defined to be passed in?
|
|
159
|
+
if (val.indexOf('--LOG') === 0) {
|
|
160
|
+
// get the desired log level
|
|
161
|
+
const inputVal = val.split('=')[1];
|
|
162
|
+
|
|
163
|
+
// validate the log level is supported, if so set it
|
|
164
|
+
if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
|
|
165
|
+
logLevel = inputVal;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// need to set global logging
|
|
171
|
+
global.log = winston.createLogger({
|
|
172
|
+
level: logLevel,
|
|
173
|
+
levels: myCustomLevels.levels,
|
|
174
|
+
transports: [
|
|
175
|
+
new winston.transports.Console()
|
|
176
|
+
]
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Runs the error asserts for the test
|
|
181
|
+
*/
|
|
182
|
+
function runErrorAsserts(data, error, code, origin, displayStr) {
|
|
183
|
+
assert.equal(null, data);
|
|
184
|
+
assert.notEqual(undefined, error);
|
|
185
|
+
assert.notEqual(null, error);
|
|
186
|
+
assert.notEqual(undefined, error.IAPerror);
|
|
187
|
+
assert.notEqual(null, error.IAPerror);
|
|
188
|
+
assert.notEqual(undefined, error.IAPerror.displayString);
|
|
189
|
+
assert.notEqual(null, error.IAPerror.displayString);
|
|
190
|
+
assert.equal(code, error.icode);
|
|
191
|
+
assert.equal(origin, error.IAPerror.origin);
|
|
192
|
+
assert.equal(displayStr, error.IAPerror.displayString);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// require the adapter that we are going to be using
|
|
196
|
+
const ArubaAirwave = require('../../adapter');
|
|
197
|
+
|
|
198
|
+
// delete the .DS_Store directory in entities -- otherwise this will cause errors
|
|
199
|
+
const dirPath = path.join(__dirname, '../../entities/.DS_Store');
|
|
200
|
+
if (fs.existsSync(dirPath)) {
|
|
201
|
+
try {
|
|
202
|
+
fs.removeSync(dirPath);
|
|
203
|
+
console.log('.DS_Store deleted');
|
|
204
|
+
} catch (e) {
|
|
205
|
+
console.log('Error when deleting .DS_Store:', e);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// begin the testing - these should be pretty well defined between the describe and the it!
|
|
210
|
+
describe('[unit] Aruba_airwave Adapter Test', () => {
|
|
211
|
+
describe('ArubaAirwave Class Tests', () => {
|
|
212
|
+
const a = new ArubaAirwave(
|
|
213
|
+
pronghornProps.adapterProps.adapters[0].id,
|
|
214
|
+
pronghornProps.adapterProps.adapters[0].properties
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
if (isRapidFail) {
|
|
218
|
+
const state = {};
|
|
219
|
+
state.passed = true;
|
|
220
|
+
|
|
221
|
+
mocha.afterEach(function x() {
|
|
222
|
+
state.passed = state.passed
|
|
223
|
+
&& (this.currentTest.state === 'passed');
|
|
224
|
+
});
|
|
225
|
+
mocha.beforeEach(function x() {
|
|
226
|
+
if (!state.passed) {
|
|
227
|
+
return this.currentTest.skip();
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
describe('#class instance created', () => {
|
|
234
|
+
it('should be a class with properties', (done) => {
|
|
235
|
+
try {
|
|
236
|
+
assert.notEqual(null, a);
|
|
237
|
+
assert.notEqual(undefined, a);
|
|
238
|
+
assert.notEqual(null, a.allProps);
|
|
239
|
+
const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
|
|
240
|
+
assert.equal(check, a.healthcheckType);
|
|
241
|
+
done();
|
|
242
|
+
} catch (error) {
|
|
243
|
+
log.error(`Test Failure: ${error}`);
|
|
244
|
+
done(error);
|
|
245
|
+
}
|
|
246
|
+
}).timeout(attemptTimeout);
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
describe('adapterBase.js', () => {
|
|
250
|
+
it('should have an adapterBase.js', (done) => {
|
|
251
|
+
try {
|
|
252
|
+
fs.exists('adapterBase.js', (val) => {
|
|
253
|
+
assert.equal(true, val);
|
|
254
|
+
done();
|
|
255
|
+
});
|
|
256
|
+
} catch (error) {
|
|
257
|
+
log.error(`Test Failure: ${error}`);
|
|
258
|
+
done(error);
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
let wffunctions = [];
|
|
264
|
+
describe('#getWorkflowFunctions', () => {
|
|
265
|
+
it('should retrieve workflow functions', (done) => {
|
|
266
|
+
try {
|
|
267
|
+
wffunctions = a.getWorkflowFunctions([]);
|
|
268
|
+
|
|
269
|
+
try {
|
|
270
|
+
assert.notEqual(0, wffunctions.length);
|
|
271
|
+
done();
|
|
272
|
+
} catch (err) {
|
|
273
|
+
log.error(`Test Failure: ${err}`);
|
|
274
|
+
done(err);
|
|
275
|
+
}
|
|
276
|
+
} catch (error) {
|
|
277
|
+
log.error(`Adapter Exception: ${error}`);
|
|
278
|
+
done(error);
|
|
279
|
+
}
|
|
280
|
+
}).timeout(attemptTimeout);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
describe('package.json', () => {
|
|
284
|
+
it('should have a package.json', (done) => {
|
|
285
|
+
try {
|
|
286
|
+
fs.exists('package.json', (val) => {
|
|
287
|
+
assert.equal(true, val);
|
|
288
|
+
done();
|
|
289
|
+
});
|
|
290
|
+
} catch (error) {
|
|
291
|
+
log.error(`Test Failure: ${error}`);
|
|
292
|
+
done(error);
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
it('package.json should be validated', (done) => {
|
|
296
|
+
try {
|
|
297
|
+
const packageDotJson = require('../../package.json');
|
|
298
|
+
const { PJV } = require('package-json-validator');
|
|
299
|
+
const options = {
|
|
300
|
+
warnings: true, // show warnings
|
|
301
|
+
recommendations: true // show recommendations
|
|
302
|
+
};
|
|
303
|
+
const results = PJV.validate(JSON.stringify(packageDotJson), 'npm', options);
|
|
304
|
+
|
|
305
|
+
if (results.valid === false) {
|
|
306
|
+
log.error('The package.json contains the following errors: ');
|
|
307
|
+
log.error(util.inspect(results));
|
|
308
|
+
assert.equal(true, results.valid);
|
|
309
|
+
} else {
|
|
310
|
+
assert.equal(true, results.valid);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
done();
|
|
314
|
+
} catch (error) {
|
|
315
|
+
log.error(`Test Failure: ${error}`);
|
|
316
|
+
done(error);
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
it('package.json should be customized', (done) => {
|
|
320
|
+
try {
|
|
321
|
+
const packageDotJson = require('../../package.json');
|
|
322
|
+
assert.notEqual(-1, packageDotJson.name.indexOf('aruba_airwave'));
|
|
323
|
+
assert.notEqual(undefined, packageDotJson.version);
|
|
324
|
+
assert.notEqual(null, packageDotJson.version);
|
|
325
|
+
assert.notEqual('', packageDotJson.version);
|
|
326
|
+
done();
|
|
327
|
+
} catch (error) {
|
|
328
|
+
log.error(`Test Failure: ${error}`);
|
|
329
|
+
done(error);
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
describe('pronghorn.json', () => {
|
|
335
|
+
it('should have a pronghorn.json', (done) => {
|
|
336
|
+
try {
|
|
337
|
+
fs.exists('pronghorn.json', (val) => {
|
|
338
|
+
assert.equal(true, val);
|
|
339
|
+
done();
|
|
340
|
+
});
|
|
341
|
+
} catch (error) {
|
|
342
|
+
log.error(`Test Failure: ${error}`);
|
|
343
|
+
done(error);
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
it('pronghorn.json should be customized', (done) => {
|
|
347
|
+
try {
|
|
348
|
+
const pronghornDotJson = require('../../pronghorn.json');
|
|
349
|
+
assert.notEqual(-1, pronghornDotJson.id.indexOf('aruba_airwave'));
|
|
350
|
+
assert.equal('ArubaAirwave', pronghornDotJson.export);
|
|
351
|
+
assert.equal('Aruba_airwave', pronghornDotJson.title);
|
|
352
|
+
done();
|
|
353
|
+
} catch (error) {
|
|
354
|
+
log.error(`Test Failure: ${error}`);
|
|
355
|
+
done(error);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
it('pronghorn.json should only expose workflow functions', (done) => {
|
|
359
|
+
try {
|
|
360
|
+
const pronghornDotJson = require('../../pronghorn.json');
|
|
361
|
+
|
|
362
|
+
for (let m = 0; m < pronghornDotJson.methods.length; m += 1) {
|
|
363
|
+
let found = false;
|
|
364
|
+
let paramissue = false;
|
|
365
|
+
|
|
366
|
+
for (let w = 0; w < wffunctions.length; w += 1) {
|
|
367
|
+
if (pronghornDotJson.methods[m].name === wffunctions[w]) {
|
|
368
|
+
found = true;
|
|
369
|
+
const methLine = execute(`grep " ${wffunctions[w]}(" adapter.js | grep "callback) {"`).toString();
|
|
370
|
+
let wfparams = [];
|
|
371
|
+
|
|
372
|
+
if (methLine && methLine.indexOf('(') >= 0 && methLine.indexOf(')') >= 0) {
|
|
373
|
+
const temp = methLine.substring(methLine.indexOf('(') + 1, methLine.lastIndexOf(')'));
|
|
374
|
+
wfparams = temp.split(',');
|
|
375
|
+
|
|
376
|
+
for (let t = 0; t < wfparams.length; t += 1) {
|
|
377
|
+
// remove default value from the parameter name
|
|
378
|
+
wfparams[t] = wfparams[t].substring(0, wfparams[t].search(/=/) > 0 ? wfparams[t].search(/#|\?|=/) : wfparams[t].length);
|
|
379
|
+
// remove spaces
|
|
380
|
+
wfparams[t] = wfparams[t].trim();
|
|
381
|
+
|
|
382
|
+
if (wfparams[t] === 'callback') {
|
|
383
|
+
wfparams.splice(t, 1);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// if there are inputs defined but not on the method line
|
|
389
|
+
if (wfparams.length === 0 && (pronghornDotJson.methods[m].input
|
|
390
|
+
&& pronghornDotJson.methods[m].input.length > 0)) {
|
|
391
|
+
paramissue = true;
|
|
392
|
+
} else if (wfparams.length > 0 && (!pronghornDotJson.methods[m].input
|
|
393
|
+
|| pronghornDotJson.methods[m].input.length === 0)) {
|
|
394
|
+
// if there are no inputs defined but there are on the method line
|
|
395
|
+
paramissue = true;
|
|
396
|
+
} else {
|
|
397
|
+
for (let p = 0; p < pronghornDotJson.methods[m].input.length; p += 1) {
|
|
398
|
+
let pfound = false;
|
|
399
|
+
for (let wfp = 0; wfp < wfparams.length; wfp += 1) {
|
|
400
|
+
if (pronghornDotJson.methods[m].input[p].name.toUpperCase() === wfparams[wfp].toUpperCase()) {
|
|
401
|
+
pfound = true;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
if (!pfound) {
|
|
406
|
+
paramissue = true;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
for (let wfp = 0; wfp < wfparams.length; wfp += 1) {
|
|
410
|
+
let pfound = false;
|
|
411
|
+
for (let p = 0; p < pronghornDotJson.methods[m].input.length; p += 1) {
|
|
412
|
+
if (pronghornDotJson.methods[m].input[p].name.toUpperCase() === wfparams[wfp].toUpperCase()) {
|
|
413
|
+
pfound = true;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (!pfound) {
|
|
418
|
+
paramissue = true;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
if (!found) {
|
|
428
|
+
// this is the reason to go through both loops - log which ones are not found so
|
|
429
|
+
// they can be worked
|
|
430
|
+
log.error(`${pronghornDotJson.methods[m].name} not found in workflow functions`);
|
|
431
|
+
}
|
|
432
|
+
if (paramissue) {
|
|
433
|
+
// this is the reason to go through both loops - log which ones are not found so
|
|
434
|
+
// they can be worked
|
|
435
|
+
log.error(`${pronghornDotJson.methods[m].name} has a parameter mismatch`);
|
|
436
|
+
}
|
|
437
|
+
assert.equal(true, found);
|
|
438
|
+
assert.equal(false, paramissue);
|
|
439
|
+
}
|
|
440
|
+
done();
|
|
441
|
+
} catch (error) {
|
|
442
|
+
log.error(`Adapter Exception: ${error}`);
|
|
443
|
+
done(error);
|
|
444
|
+
}
|
|
445
|
+
}).timeout(attemptTimeout);
|
|
446
|
+
it('pronghorn.json should expose all workflow functions', (done) => {
|
|
447
|
+
try {
|
|
448
|
+
const pronghornDotJson = require('../../pronghorn.json');
|
|
449
|
+
for (let w = 0; w < wffunctions.length; w += 1) {
|
|
450
|
+
let found = false;
|
|
451
|
+
|
|
452
|
+
for (let m = 0; m < pronghornDotJson.methods.length; m += 1) {
|
|
453
|
+
if (pronghornDotJson.methods[m].name === wffunctions[w]) {
|
|
454
|
+
found = true;
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
if (!found) {
|
|
460
|
+
// this is the reason to go through both loops - log which ones are not found so
|
|
461
|
+
// they can be worked
|
|
462
|
+
log.error(`${wffunctions[w]} not found in pronghorn.json`);
|
|
463
|
+
}
|
|
464
|
+
assert.equal(true, found);
|
|
465
|
+
}
|
|
466
|
+
done();
|
|
467
|
+
} catch (error) {
|
|
468
|
+
log.error(`Adapter Exception: ${error}`);
|
|
469
|
+
done(error);
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
describe('propertiesSchema.json', () => {
|
|
475
|
+
it('should have a propertiesSchema.json', (done) => {
|
|
476
|
+
try {
|
|
477
|
+
fs.exists('propertiesSchema.json', (val) => {
|
|
478
|
+
assert.equal(true, val);
|
|
479
|
+
done();
|
|
480
|
+
});
|
|
481
|
+
} catch (error) {
|
|
482
|
+
log.error(`Test Failure: ${error}`);
|
|
483
|
+
done(error);
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
it('propertiesSchema.json should be customized', (done) => {
|
|
487
|
+
try {
|
|
488
|
+
const propertiesDotJson = require('../../propertiesSchema.json');
|
|
489
|
+
assert.equal('adapter-aruba_airwave', propertiesDotJson.$id);
|
|
490
|
+
done();
|
|
491
|
+
} catch (error) {
|
|
492
|
+
log.error(`Test Failure: ${error}`);
|
|
493
|
+
done(error);
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
describe('error.json', () => {
|
|
499
|
+
it('should have an error.json', (done) => {
|
|
500
|
+
try {
|
|
501
|
+
fs.exists('error.json', (val) => {
|
|
502
|
+
assert.equal(true, val);
|
|
503
|
+
done();
|
|
504
|
+
});
|
|
505
|
+
} catch (error) {
|
|
506
|
+
log.error(`Test Failure: ${error}`);
|
|
507
|
+
done(error);
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
describe('sampleProperties.json', () => {
|
|
513
|
+
it('should have a sampleProperties.json', (done) => {
|
|
514
|
+
try {
|
|
515
|
+
fs.exists('sampleProperties.json', (val) => {
|
|
516
|
+
assert.equal(true, val);
|
|
517
|
+
done();
|
|
518
|
+
});
|
|
519
|
+
} catch (error) {
|
|
520
|
+
log.error(`Test Failure: ${error}`);
|
|
521
|
+
done(error);
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
describe('#checkProperties', () => {
|
|
527
|
+
it('should have a checkProperties function', (done) => {
|
|
528
|
+
try {
|
|
529
|
+
assert.equal(true, typeof a.checkProperties === 'function');
|
|
530
|
+
done();
|
|
531
|
+
} catch (error) {
|
|
532
|
+
log.error(`Test Failure: ${error}`);
|
|
533
|
+
done(error);
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
it('the sample properties should be good - if failure change the log level', (done) => {
|
|
537
|
+
try {
|
|
538
|
+
const samplePropsJson = require('../../sampleProperties.json');
|
|
539
|
+
const clean = a.checkProperties(samplePropsJson.properties);
|
|
540
|
+
|
|
541
|
+
try {
|
|
542
|
+
assert.notEqual(0, Object.keys(clean));
|
|
543
|
+
assert.equal(undefined, clean.exception);
|
|
544
|
+
assert.notEqual(undefined, clean.host);
|
|
545
|
+
assert.notEqual(null, clean.host);
|
|
546
|
+
assert.notEqual('', clean.host);
|
|
547
|
+
done();
|
|
548
|
+
} catch (err) {
|
|
549
|
+
log.error(`Test Failure: ${err}`);
|
|
550
|
+
done(err);
|
|
551
|
+
}
|
|
552
|
+
} catch (error) {
|
|
553
|
+
log.error(`Adapter Exception: ${error}`);
|
|
554
|
+
done(error);
|
|
555
|
+
}
|
|
556
|
+
}).timeout(attemptTimeout);
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
describe('README.md', () => {
|
|
560
|
+
it('should have a README', (done) => {
|
|
561
|
+
try {
|
|
562
|
+
fs.exists('README.md', (val) => {
|
|
563
|
+
assert.equal(true, val);
|
|
564
|
+
done();
|
|
565
|
+
});
|
|
566
|
+
} catch (error) {
|
|
567
|
+
log.error(`Test Failure: ${error}`);
|
|
568
|
+
done(error);
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
it('README.md should be customized', (done) => {
|
|
572
|
+
try {
|
|
573
|
+
fs.readFile('README.md', 'utf8', (err, data) => {
|
|
574
|
+
assert.equal(-1, data.indexOf('[System]'));
|
|
575
|
+
assert.equal(-1, data.indexOf('[system]'));
|
|
576
|
+
assert.equal(-1, data.indexOf('[version]'));
|
|
577
|
+
assert.equal(-1, data.indexOf('[namespace]'));
|
|
578
|
+
done();
|
|
579
|
+
});
|
|
580
|
+
} catch (error) {
|
|
581
|
+
log.error(`Test Failure: ${error}`);
|
|
582
|
+
done(error);
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
describe('#connect', () => {
|
|
588
|
+
it('should have a connect function', (done) => {
|
|
589
|
+
try {
|
|
590
|
+
assert.equal(true, typeof a.connect === 'function');
|
|
591
|
+
done();
|
|
592
|
+
} catch (error) {
|
|
593
|
+
log.error(`Test Failure: ${error}`);
|
|
594
|
+
done(error);
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
describe('#healthCheck', () => {
|
|
600
|
+
it('should have a healthCheck function', (done) => {
|
|
601
|
+
try {
|
|
602
|
+
assert.equal(true, typeof a.healthCheck === 'function');
|
|
603
|
+
done();
|
|
604
|
+
} catch (error) {
|
|
605
|
+
log.error(`Test Failure: ${error}`);
|
|
606
|
+
done(error);
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
describe('#checkActionFiles', () => {
|
|
612
|
+
it('should have a checkActionFiles function', (done) => {
|
|
613
|
+
try {
|
|
614
|
+
assert.equal(true, typeof a.checkActionFiles === 'function');
|
|
615
|
+
done();
|
|
616
|
+
} catch (error) {
|
|
617
|
+
log.error(`Test Failure: ${error}`);
|
|
618
|
+
done(error);
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
it('the action files should be good - if failure change the log level as most issues are warnings', (done) => {
|
|
622
|
+
try {
|
|
623
|
+
const clean = a.checkActionFiles();
|
|
624
|
+
|
|
625
|
+
try {
|
|
626
|
+
for (let c = 0; c < clean.length; c += 1) {
|
|
627
|
+
log.error(clean[c]);
|
|
628
|
+
}
|
|
629
|
+
assert.equal(0, clean.length);
|
|
630
|
+
done();
|
|
631
|
+
} catch (err) {
|
|
632
|
+
log.error(`Test Failure: ${err}`);
|
|
633
|
+
done(err);
|
|
634
|
+
}
|
|
635
|
+
} catch (error) {
|
|
636
|
+
log.error(`Adapter Exception: ${error}`);
|
|
637
|
+
done(error);
|
|
638
|
+
}
|
|
639
|
+
}).timeout(attemptTimeout);
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
describe('#encryptProperty', () => {
|
|
643
|
+
it('should have a encryptProperty function', (done) => {
|
|
644
|
+
try {
|
|
645
|
+
assert.equal(true, typeof a.encryptProperty === 'function');
|
|
646
|
+
done();
|
|
647
|
+
} catch (error) {
|
|
648
|
+
log.error(`Test Failure: ${error}`);
|
|
649
|
+
done(error);
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
it('should get base64 encoded property', (done) => {
|
|
653
|
+
try {
|
|
654
|
+
a.encryptProperty('testing', 'base64', (data, error) => {
|
|
655
|
+
try {
|
|
656
|
+
assert.equal(undefined, error);
|
|
657
|
+
assert.notEqual(undefined, data);
|
|
658
|
+
assert.notEqual(null, data);
|
|
659
|
+
assert.notEqual(undefined, data.response);
|
|
660
|
+
assert.notEqual(null, data.response);
|
|
661
|
+
assert.equal(0, data.response.indexOf('{code}'));
|
|
662
|
+
done();
|
|
663
|
+
} catch (err) {
|
|
664
|
+
log.error(`Test Failure: ${err}`);
|
|
665
|
+
done(err);
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
} catch (error) {
|
|
669
|
+
log.error(`Adapter Exception: ${error}`);
|
|
670
|
+
done(error);
|
|
671
|
+
}
|
|
672
|
+
}).timeout(attemptTimeout);
|
|
673
|
+
it('should get encrypted property', (done) => {
|
|
674
|
+
try {
|
|
675
|
+
a.encryptProperty('testing', 'encrypt', (data, error) => {
|
|
676
|
+
try {
|
|
677
|
+
assert.equal(undefined, error);
|
|
678
|
+
assert.notEqual(undefined, data);
|
|
679
|
+
assert.notEqual(null, data);
|
|
680
|
+
assert.notEqual(undefined, data.response);
|
|
681
|
+
assert.notEqual(null, data.response);
|
|
682
|
+
assert.equal(0, data.response.indexOf('{crypt}'));
|
|
683
|
+
done();
|
|
684
|
+
} catch (err) {
|
|
685
|
+
log.error(`Test Failure: ${err}`);
|
|
686
|
+
done(err);
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
} catch (error) {
|
|
690
|
+
log.error(`Adapter Exception: ${error}`);
|
|
691
|
+
done(error);
|
|
692
|
+
}
|
|
693
|
+
}).timeout(attemptTimeout);
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
// describe('#hasEntity', () => {
|
|
697
|
+
// it('should have a hasEntity function', (done) => {
|
|
698
|
+
// try {
|
|
699
|
+
// assert.equal(true, typeof a.hasEntity === 'function');
|
|
700
|
+
// done();
|
|
701
|
+
// } catch (error) {
|
|
702
|
+
// log.error(`Test Failure: ${error}`);
|
|
703
|
+
// done(error);
|
|
704
|
+
// }
|
|
705
|
+
// });
|
|
706
|
+
// it('should find entity', (done) => {
|
|
707
|
+
// try {
|
|
708
|
+
// a.hasEntity('template_entity', // 'a9e9c33dc61122760072455df62663d2', (data) => {
|
|
709
|
+
// try {
|
|
710
|
+
// assert.equal(true, data[0]);
|
|
711
|
+
// done();
|
|
712
|
+
// } catch (err) {
|
|
713
|
+
// log.error(`Test Failure: ${err}`);
|
|
714
|
+
// done(err);
|
|
715
|
+
// }
|
|
716
|
+
// });
|
|
717
|
+
// } catch (error) {
|
|
718
|
+
// log.error(`Adapter Exception: ${error}`);
|
|
719
|
+
// done(error);
|
|
720
|
+
// }
|
|
721
|
+
// }).timeout(attemptTimeout);
|
|
722
|
+
// it('should not find entity', (done) => {
|
|
723
|
+
// try {
|
|
724
|
+
// a.hasEntity('template_entity', 'blah', (data) => {
|
|
725
|
+
// try {
|
|
726
|
+
// assert.equal(false, data[0]);
|
|
727
|
+
// done();
|
|
728
|
+
// } catch (err) {
|
|
729
|
+
// log.error(`Test Failure: ${err}`);
|
|
730
|
+
// done(err);
|
|
731
|
+
// }
|
|
732
|
+
// });
|
|
733
|
+
// } catch (error) {
|
|
734
|
+
// log.error(`Adapter Exception: ${error}`);
|
|
735
|
+
// done(error);
|
|
736
|
+
// }
|
|
737
|
+
// }).timeout(attemptTimeout);
|
|
738
|
+
// });
|
|
739
|
+
|
|
740
|
+
/*
|
|
741
|
+
-----------------------------------------------------------------------
|
|
742
|
+
-----------------------------------------------------------------------
|
|
743
|
+
*** All code above this comment will be replaced during a migration ***
|
|
744
|
+
******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
|
|
745
|
+
-----------------------------------------------------------------------
|
|
746
|
+
-----------------------------------------------------------------------
|
|
747
|
+
*/
|
|
748
|
+
|
|
749
|
+
describe('#aMPStats - errors', () => {
|
|
750
|
+
it('should have a aMPStats function', (done) => {
|
|
751
|
+
try {
|
|
752
|
+
assert.equal(true, typeof a.aMPStats === 'function');
|
|
753
|
+
done();
|
|
754
|
+
} catch (error) {
|
|
755
|
+
log.error(`Test Failure: ${error}`);
|
|
756
|
+
done(error);
|
|
757
|
+
}
|
|
758
|
+
}).timeout(attemptTimeout);
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
describe('#folderList - errors', () => {
|
|
762
|
+
it('should have a folderList function', (done) => {
|
|
763
|
+
try {
|
|
764
|
+
assert.equal(true, typeof a.folderList === 'function');
|
|
765
|
+
done();
|
|
766
|
+
} catch (error) {
|
|
767
|
+
log.error(`Test Failure: ${error}`);
|
|
768
|
+
done(error);
|
|
769
|
+
}
|
|
770
|
+
}).timeout(attemptTimeout);
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
describe('#catalogRepository - errors', () => {
|
|
774
|
+
it('should have a catalogRepository function', (done) => {
|
|
775
|
+
try {
|
|
776
|
+
assert.equal(true, typeof a.catalogRepository === 'function');
|
|
777
|
+
done();
|
|
778
|
+
} catch (error) {
|
|
779
|
+
log.error(`Test Failure: ${error}`);
|
|
780
|
+
done(error);
|
|
781
|
+
}
|
|
782
|
+
}).timeout(attemptTimeout);
|
|
783
|
+
});
|
|
784
|
+
|
|
785
|
+
describe('#alertList - errors', () => {
|
|
786
|
+
it('should have a alertList function', (done) => {
|
|
787
|
+
try {
|
|
788
|
+
assert.equal(true, typeof a.alertList === 'function');
|
|
789
|
+
done();
|
|
790
|
+
} catch (error) {
|
|
791
|
+
log.error(`Test Failure: ${error}`);
|
|
792
|
+
done(error);
|
|
793
|
+
}
|
|
794
|
+
}).timeout(attemptTimeout);
|
|
795
|
+
});
|
|
796
|
+
|
|
797
|
+
describe('#aPList - errors', () => {
|
|
798
|
+
it('should have a aPList function', (done) => {
|
|
799
|
+
try {
|
|
800
|
+
assert.equal(true, typeof a.aPList === 'function');
|
|
801
|
+
done();
|
|
802
|
+
} catch (error) {
|
|
803
|
+
log.error(`Test Failure: ${error}`);
|
|
804
|
+
done(error);
|
|
805
|
+
}
|
|
806
|
+
}).timeout(attemptTimeout);
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
describe('#aPBSSIDList - errors', () => {
|
|
810
|
+
it('should have a aPBSSIDList function', (done) => {
|
|
811
|
+
try {
|
|
812
|
+
assert.equal(true, typeof a.aPBSSIDList === 'function');
|
|
813
|
+
done();
|
|
814
|
+
} catch (error) {
|
|
815
|
+
log.error(`Test Failure: ${error}`);
|
|
816
|
+
done(error);
|
|
817
|
+
}
|
|
818
|
+
}).timeout(attemptTimeout);
|
|
819
|
+
});
|
|
820
|
+
|
|
821
|
+
describe('#aPDetail - errors', () => {
|
|
822
|
+
it('should have a aPDetail function', (done) => {
|
|
823
|
+
try {
|
|
824
|
+
assert.equal(true, typeof a.aPDetail === 'function');
|
|
825
|
+
done();
|
|
826
|
+
} catch (error) {
|
|
827
|
+
log.error(`Test Failure: ${error}`);
|
|
828
|
+
done(error);
|
|
829
|
+
}
|
|
830
|
+
}).timeout(attemptTimeout);
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
describe('#aPLog - errors', () => {
|
|
834
|
+
it('should have a aPLog function', (done) => {
|
|
835
|
+
try {
|
|
836
|
+
assert.equal(true, typeof a.aPLog === 'function');
|
|
837
|
+
done();
|
|
838
|
+
} catch (error) {
|
|
839
|
+
log.error(`Test Failure: ${error}`);
|
|
840
|
+
done(error);
|
|
841
|
+
}
|
|
842
|
+
}).timeout(attemptTimeout);
|
|
843
|
+
it('should error if - missing id', (done) => {
|
|
844
|
+
try {
|
|
845
|
+
a.aPLog(null, null, (data, error) => {
|
|
846
|
+
try {
|
|
847
|
+
const displayE = 'id is required';
|
|
848
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-aPLog', displayE);
|
|
849
|
+
done();
|
|
850
|
+
} catch (err) {
|
|
851
|
+
log.error(`Test Failure: ${err}`);
|
|
852
|
+
done(err);
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
} catch (error) {
|
|
856
|
+
log.error(`Adapter Exception: ${error}`);
|
|
857
|
+
done(error);
|
|
858
|
+
}
|
|
859
|
+
}).timeout(attemptTimeout);
|
|
860
|
+
it('should error if - missing limit', (done) => {
|
|
861
|
+
try {
|
|
862
|
+
a.aPLog('fakeparam', null, (data, error) => {
|
|
863
|
+
try {
|
|
864
|
+
const displayE = 'limit is required';
|
|
865
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-aPLog', displayE);
|
|
866
|
+
done();
|
|
867
|
+
} catch (err) {
|
|
868
|
+
log.error(`Test Failure: ${err}`);
|
|
869
|
+
done(err);
|
|
870
|
+
}
|
|
871
|
+
});
|
|
872
|
+
} catch (error) {
|
|
873
|
+
log.error(`Adapter Exception: ${error}`);
|
|
874
|
+
done(error);
|
|
875
|
+
}
|
|
876
|
+
}).timeout(attemptTimeout);
|
|
877
|
+
});
|
|
878
|
+
|
|
879
|
+
describe('#rogueDetail - errors', () => {
|
|
880
|
+
it('should have a rogueDetail function', (done) => {
|
|
881
|
+
try {
|
|
882
|
+
assert.equal(true, typeof a.rogueDetail === 'function');
|
|
883
|
+
done();
|
|
884
|
+
} catch (error) {
|
|
885
|
+
log.error(`Test Failure: ${error}`);
|
|
886
|
+
done(error);
|
|
887
|
+
}
|
|
888
|
+
}).timeout(attemptTimeout);
|
|
889
|
+
it('should error if - missing id', (done) => {
|
|
890
|
+
try {
|
|
891
|
+
a.rogueDetail(null, (data, error) => {
|
|
892
|
+
try {
|
|
893
|
+
const displayE = 'id is required';
|
|
894
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-rogueDetail', displayE);
|
|
895
|
+
done();
|
|
896
|
+
} catch (err) {
|
|
897
|
+
log.error(`Test Failure: ${err}`);
|
|
898
|
+
done(err);
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
} catch (error) {
|
|
902
|
+
log.error(`Adapter Exception: ${error}`);
|
|
903
|
+
done(error);
|
|
904
|
+
}
|
|
905
|
+
}).timeout(attemptTimeout);
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
describe('#clientDetail - errors', () => {
|
|
909
|
+
it('should have a clientDetail function', (done) => {
|
|
910
|
+
try {
|
|
911
|
+
assert.equal(true, typeof a.clientDetail === 'function');
|
|
912
|
+
done();
|
|
913
|
+
} catch (error) {
|
|
914
|
+
log.error(`Test Failure: ${error}`);
|
|
915
|
+
done(error);
|
|
916
|
+
}
|
|
917
|
+
}).timeout(attemptTimeout);
|
|
918
|
+
it('should error if - missing mac', (done) => {
|
|
919
|
+
try {
|
|
920
|
+
a.clientDetail(null, (data, error) => {
|
|
921
|
+
try {
|
|
922
|
+
const displayE = 'mac is required';
|
|
923
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-clientDetail', displayE);
|
|
924
|
+
done();
|
|
925
|
+
} catch (err) {
|
|
926
|
+
log.error(`Test Failure: ${err}`);
|
|
927
|
+
done(err);
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
} catch (error) {
|
|
931
|
+
log.error(`Adapter Exception: ${error}`);
|
|
932
|
+
done(error);
|
|
933
|
+
}
|
|
934
|
+
}).timeout(attemptTimeout);
|
|
935
|
+
});
|
|
936
|
+
|
|
937
|
+
describe('#visualRFConfig - errors', () => {
|
|
938
|
+
it('should have a visualRFConfig function', (done) => {
|
|
939
|
+
try {
|
|
940
|
+
assert.equal(true, typeof a.visualRFConfig === 'function');
|
|
941
|
+
done();
|
|
942
|
+
} catch (error) {
|
|
943
|
+
log.error(`Test Failure: ${error}`);
|
|
944
|
+
done(error);
|
|
945
|
+
}
|
|
946
|
+
}).timeout(attemptTimeout);
|
|
947
|
+
});
|
|
948
|
+
|
|
949
|
+
describe('#userInfo - errors', () => {
|
|
950
|
+
it('should have a userInfo function', (done) => {
|
|
951
|
+
try {
|
|
952
|
+
assert.equal(true, typeof a.userInfo === 'function');
|
|
953
|
+
done();
|
|
954
|
+
} catch (error) {
|
|
955
|
+
log.error(`Test Failure: ${error}`);
|
|
956
|
+
done(error);
|
|
957
|
+
}
|
|
958
|
+
}).timeout(attemptTimeout);
|
|
959
|
+
});
|
|
960
|
+
|
|
961
|
+
describe('#deviceRRDInfo - errors', () => {
|
|
962
|
+
it('should have a deviceRRDInfo function', (done) => {
|
|
963
|
+
try {
|
|
964
|
+
assert.equal(true, typeof a.deviceRRDInfo === 'function');
|
|
965
|
+
done();
|
|
966
|
+
} catch (error) {
|
|
967
|
+
log.error(`Test Failure: ${error}`);
|
|
968
|
+
done(error);
|
|
969
|
+
}
|
|
970
|
+
}).timeout(attemptTimeout);
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
describe('#clientRRDInfo - errors', () => {
|
|
974
|
+
it('should have a clientRRDInfo function', (done) => {
|
|
975
|
+
try {
|
|
976
|
+
assert.equal(true, typeof a.clientRRDInfo === 'function');
|
|
977
|
+
done();
|
|
978
|
+
} catch (error) {
|
|
979
|
+
log.error(`Test Failure: ${error}`);
|
|
980
|
+
done(error);
|
|
981
|
+
}
|
|
982
|
+
}).timeout(attemptTimeout);
|
|
983
|
+
});
|
|
984
|
+
|
|
985
|
+
describe('#changeSet - errors', () => {
|
|
986
|
+
it('should have a changeSet function', (done) => {
|
|
987
|
+
try {
|
|
988
|
+
assert.equal(true, typeof a.changeSet === 'function');
|
|
989
|
+
done();
|
|
990
|
+
} catch (error) {
|
|
991
|
+
log.error(`Test Failure: ${error}`);
|
|
992
|
+
done(error);
|
|
993
|
+
}
|
|
994
|
+
}).timeout(attemptTimeout);
|
|
995
|
+
it('should error if - missing body', (done) => {
|
|
996
|
+
try {
|
|
997
|
+
a.changeSet(null, (data, error) => {
|
|
998
|
+
try {
|
|
999
|
+
const displayE = 'body is required';
|
|
1000
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-changeSet', displayE);
|
|
1001
|
+
done();
|
|
1002
|
+
} catch (err) {
|
|
1003
|
+
log.error(`Test Failure: ${err}`);
|
|
1004
|
+
done(err);
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
} catch (error) {
|
|
1008
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1009
|
+
done(error);
|
|
1010
|
+
}
|
|
1011
|
+
}).timeout(attemptTimeout);
|
|
1012
|
+
});
|
|
1013
|
+
|
|
1014
|
+
describe('#guestUserCreateUser - errors', () => {
|
|
1015
|
+
it('should have a guestUserCreateUser function', (done) => {
|
|
1016
|
+
try {
|
|
1017
|
+
assert.equal(true, typeof a.guestUserCreateUser === 'function');
|
|
1018
|
+
done();
|
|
1019
|
+
} catch (error) {
|
|
1020
|
+
log.error(`Test Failure: ${error}`);
|
|
1021
|
+
done(error);
|
|
1022
|
+
}
|
|
1023
|
+
}).timeout(attemptTimeout);
|
|
1024
|
+
it('should error if - missing bodyFormData', (done) => {
|
|
1025
|
+
try {
|
|
1026
|
+
a.guestUserCreateUser(null, (data, error) => {
|
|
1027
|
+
try {
|
|
1028
|
+
const displayE = 'bodyFormData is required';
|
|
1029
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-guestUserCreateUser', displayE);
|
|
1030
|
+
done();
|
|
1031
|
+
} catch (err) {
|
|
1032
|
+
log.error(`Test Failure: ${err}`);
|
|
1033
|
+
done(err);
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
} catch (error) {
|
|
1037
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1038
|
+
done(error);
|
|
1039
|
+
}
|
|
1040
|
+
}).timeout(attemptTimeout);
|
|
1041
|
+
});
|
|
1042
|
+
|
|
1043
|
+
describe('#modifyTemplateVariables - errors', () => {
|
|
1044
|
+
it('should have a modifyTemplateVariables function', (done) => {
|
|
1045
|
+
try {
|
|
1046
|
+
assert.equal(true, typeof a.modifyTemplateVariables === 'function');
|
|
1047
|
+
done();
|
|
1048
|
+
} catch (error) {
|
|
1049
|
+
log.error(`Test Failure: ${error}`);
|
|
1050
|
+
done(error);
|
|
1051
|
+
}
|
|
1052
|
+
}).timeout(attemptTimeout);
|
|
1053
|
+
it('should error if - missing body', (done) => {
|
|
1054
|
+
try {
|
|
1055
|
+
a.modifyTemplateVariables(null, (data, error) => {
|
|
1056
|
+
try {
|
|
1057
|
+
const displayE = 'body is required';
|
|
1058
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-modifyTemplateVariables', displayE);
|
|
1059
|
+
done();
|
|
1060
|
+
} catch (err) {
|
|
1061
|
+
log.error(`Test Failure: ${err}`);
|
|
1062
|
+
done(err);
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
} catch (error) {
|
|
1066
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1067
|
+
done(error);
|
|
1068
|
+
}
|
|
1069
|
+
}).timeout(attemptTimeout);
|
|
1070
|
+
});
|
|
1071
|
+
|
|
1072
|
+
describe('#importAPWhitelist - errors', () => {
|
|
1073
|
+
it('should have a importAPWhitelist function', (done) => {
|
|
1074
|
+
try {
|
|
1075
|
+
assert.equal(true, typeof a.importAPWhitelist === 'function');
|
|
1076
|
+
done();
|
|
1077
|
+
} catch (error) {
|
|
1078
|
+
log.error(`Test Failure: ${error}`);
|
|
1079
|
+
done(error);
|
|
1080
|
+
}
|
|
1081
|
+
}).timeout(attemptTimeout);
|
|
1082
|
+
it('should error if - missing appendWhitelist', (done) => {
|
|
1083
|
+
try {
|
|
1084
|
+
a.importAPWhitelist(null, null, (data, error) => {
|
|
1085
|
+
try {
|
|
1086
|
+
const displayE = 'appendWhitelist is required';
|
|
1087
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-importAPWhitelist', displayE);
|
|
1088
|
+
done();
|
|
1089
|
+
} catch (err) {
|
|
1090
|
+
log.error(`Test Failure: ${err}`);
|
|
1091
|
+
done(err);
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
} catch (error) {
|
|
1095
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1096
|
+
done(error);
|
|
1097
|
+
}
|
|
1098
|
+
}).timeout(attemptTimeout);
|
|
1099
|
+
it('should error if - missing body', (done) => {
|
|
1100
|
+
try {
|
|
1101
|
+
a.importAPWhitelist('fakeparam', null, (data, error) => {
|
|
1102
|
+
try {
|
|
1103
|
+
const displayE = 'body is required';
|
|
1104
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-importAPWhitelist', displayE);
|
|
1105
|
+
done();
|
|
1106
|
+
} catch (err) {
|
|
1107
|
+
log.error(`Test Failure: ${err}`);
|
|
1108
|
+
done(err);
|
|
1109
|
+
}
|
|
1110
|
+
});
|
|
1111
|
+
} catch (error) {
|
|
1112
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1113
|
+
done(error);
|
|
1114
|
+
}
|
|
1115
|
+
}).timeout(attemptTimeout);
|
|
1116
|
+
});
|
|
1117
|
+
|
|
1118
|
+
describe('#deauthenticateClient - errors', () => {
|
|
1119
|
+
it('should have a deauthenticateClient function', (done) => {
|
|
1120
|
+
try {
|
|
1121
|
+
assert.equal(true, typeof a.deauthenticateClient === 'function');
|
|
1122
|
+
done();
|
|
1123
|
+
} catch (error) {
|
|
1124
|
+
log.error(`Test Failure: ${error}`);
|
|
1125
|
+
done(error);
|
|
1126
|
+
}
|
|
1127
|
+
}).timeout(attemptTimeout);
|
|
1128
|
+
it('should error if - missing mac', (done) => {
|
|
1129
|
+
try {
|
|
1130
|
+
a.deauthenticateClient(null, (data, error) => {
|
|
1131
|
+
try {
|
|
1132
|
+
const displayE = 'mac is required';
|
|
1133
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-deauthenticateClient', displayE);
|
|
1134
|
+
done();
|
|
1135
|
+
} catch (err) {
|
|
1136
|
+
log.error(`Test Failure: ${err}`);
|
|
1137
|
+
done(err);
|
|
1138
|
+
}
|
|
1139
|
+
});
|
|
1140
|
+
} catch (error) {
|
|
1141
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1142
|
+
done(error);
|
|
1143
|
+
}
|
|
1144
|
+
}).timeout(attemptTimeout);
|
|
1145
|
+
});
|
|
1146
|
+
|
|
1147
|
+
describe('#downStatusMessage - errors', () => {
|
|
1148
|
+
it('should have a downStatusMessage function', (done) => {
|
|
1149
|
+
try {
|
|
1150
|
+
assert.equal(true, typeof a.downStatusMessage === 'function');
|
|
1151
|
+
done();
|
|
1152
|
+
} catch (error) {
|
|
1153
|
+
log.error(`Test Failure: ${error}`);
|
|
1154
|
+
done(error);
|
|
1155
|
+
}
|
|
1156
|
+
}).timeout(attemptTimeout);
|
|
1157
|
+
it('should error if - missing apId', (done) => {
|
|
1158
|
+
try {
|
|
1159
|
+
a.downStatusMessage(null, null, null, null, (data, error) => {
|
|
1160
|
+
try {
|
|
1161
|
+
const displayE = 'apId is required';
|
|
1162
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-downStatusMessage', displayE);
|
|
1163
|
+
done();
|
|
1164
|
+
} catch (err) {
|
|
1165
|
+
log.error(`Test Failure: ${err}`);
|
|
1166
|
+
done(err);
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
} catch (error) {
|
|
1170
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1171
|
+
done(error);
|
|
1172
|
+
}
|
|
1173
|
+
}).timeout(attemptTimeout);
|
|
1174
|
+
it('should error if - missing apGroupId', (done) => {
|
|
1175
|
+
try {
|
|
1176
|
+
a.downStatusMessage('fakeparam', null, null, null, (data, error) => {
|
|
1177
|
+
try {
|
|
1178
|
+
const displayE = 'apGroupId is required';
|
|
1179
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-downStatusMessage', displayE);
|
|
1180
|
+
done();
|
|
1181
|
+
} catch (err) {
|
|
1182
|
+
log.error(`Test Failure: ${err}`);
|
|
1183
|
+
done(err);
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
} catch (error) {
|
|
1187
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1188
|
+
done(error);
|
|
1189
|
+
}
|
|
1190
|
+
}).timeout(attemptTimeout);
|
|
1191
|
+
it('should error if - missing downStatusMessage', (done) => {
|
|
1192
|
+
try {
|
|
1193
|
+
a.downStatusMessage('fakeparam', 'fakeparam', null, null, (data, error) => {
|
|
1194
|
+
try {
|
|
1195
|
+
const displayE = 'downStatusMessage is required';
|
|
1196
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-downStatusMessage', displayE);
|
|
1197
|
+
done();
|
|
1198
|
+
} catch (err) {
|
|
1199
|
+
log.error(`Test Failure: ${err}`);
|
|
1200
|
+
done(err);
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1203
|
+
} catch (error) {
|
|
1204
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1205
|
+
done(error);
|
|
1206
|
+
}
|
|
1207
|
+
}).timeout(attemptTimeout);
|
|
1208
|
+
it('should error if - missing autoClearDownStatusMessage', (done) => {
|
|
1209
|
+
try {
|
|
1210
|
+
a.downStatusMessage('fakeparam', 'fakeparam', 'fakeparam', null, (data, error) => {
|
|
1211
|
+
try {
|
|
1212
|
+
const displayE = 'autoClearDownStatusMessage is required';
|
|
1213
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-downStatusMessage', displayE);
|
|
1214
|
+
done();
|
|
1215
|
+
} catch (err) {
|
|
1216
|
+
log.error(`Test Failure: ${err}`);
|
|
1217
|
+
done(err);
|
|
1218
|
+
}
|
|
1219
|
+
});
|
|
1220
|
+
} catch (error) {
|
|
1221
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1222
|
+
done(error);
|
|
1223
|
+
}
|
|
1224
|
+
}).timeout(attemptTimeout);
|
|
1225
|
+
});
|
|
1226
|
+
|
|
1227
|
+
describe('#aPSearch - errors', () => {
|
|
1228
|
+
it('should have a aPSearch function', (done) => {
|
|
1229
|
+
try {
|
|
1230
|
+
assert.equal(true, typeof a.aPSearch === 'function');
|
|
1231
|
+
done();
|
|
1232
|
+
} catch (error) {
|
|
1233
|
+
log.error(`Test Failure: ${error}`);
|
|
1234
|
+
done(error);
|
|
1235
|
+
}
|
|
1236
|
+
}).timeout(attemptTimeout);
|
|
1237
|
+
it('should error if - missing query', (done) => {
|
|
1238
|
+
try {
|
|
1239
|
+
a.aPSearch(null, (data, error) => {
|
|
1240
|
+
try {
|
|
1241
|
+
const displayE = 'query is required';
|
|
1242
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-aPSearch', displayE);
|
|
1243
|
+
done();
|
|
1244
|
+
} catch (err) {
|
|
1245
|
+
log.error(`Test Failure: ${err}`);
|
|
1246
|
+
done(err);
|
|
1247
|
+
}
|
|
1248
|
+
});
|
|
1249
|
+
} catch (error) {
|
|
1250
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1251
|
+
done(error);
|
|
1252
|
+
}
|
|
1253
|
+
}).timeout(attemptTimeout);
|
|
1254
|
+
});
|
|
1255
|
+
|
|
1256
|
+
describe('#clientSearch - errors', () => {
|
|
1257
|
+
it('should have a clientSearch function', (done) => {
|
|
1258
|
+
try {
|
|
1259
|
+
assert.equal(true, typeof a.clientSearch === 'function');
|
|
1260
|
+
done();
|
|
1261
|
+
} catch (error) {
|
|
1262
|
+
log.error(`Test Failure: ${error}`);
|
|
1263
|
+
done(error);
|
|
1264
|
+
}
|
|
1265
|
+
}).timeout(attemptTimeout);
|
|
1266
|
+
it('should error if - missing query', (done) => {
|
|
1267
|
+
try {
|
|
1268
|
+
a.clientSearch(null, (data, error) => {
|
|
1269
|
+
try {
|
|
1270
|
+
const displayE = 'query is required';
|
|
1271
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-clientSearch', displayE);
|
|
1272
|
+
done();
|
|
1273
|
+
} catch (err) {
|
|
1274
|
+
log.error(`Test Failure: ${err}`);
|
|
1275
|
+
done(err);
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1278
|
+
} catch (error) {
|
|
1279
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1280
|
+
done(error);
|
|
1281
|
+
}
|
|
1282
|
+
}).timeout(attemptTimeout);
|
|
1283
|
+
});
|
|
1284
|
+
|
|
1285
|
+
describe('#vPNUserSearch - errors', () => {
|
|
1286
|
+
it('should have a vPNUserSearch function', (done) => {
|
|
1287
|
+
try {
|
|
1288
|
+
assert.equal(true, typeof a.vPNUserSearch === 'function');
|
|
1289
|
+
done();
|
|
1290
|
+
} catch (error) {
|
|
1291
|
+
log.error(`Test Failure: ${error}`);
|
|
1292
|
+
done(error);
|
|
1293
|
+
}
|
|
1294
|
+
}).timeout(attemptTimeout);
|
|
1295
|
+
it('should error if - missing query', (done) => {
|
|
1296
|
+
try {
|
|
1297
|
+
a.vPNUserSearch(null, (data, error) => {
|
|
1298
|
+
try {
|
|
1299
|
+
const displayE = 'query is required';
|
|
1300
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-vPNUserSearch', displayE);
|
|
1301
|
+
done();
|
|
1302
|
+
} catch (err) {
|
|
1303
|
+
log.error(`Test Failure: ${err}`);
|
|
1304
|
+
done(err);
|
|
1305
|
+
}
|
|
1306
|
+
});
|
|
1307
|
+
} catch (error) {
|
|
1308
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1309
|
+
done(error);
|
|
1310
|
+
}
|
|
1311
|
+
}).timeout(attemptTimeout);
|
|
1312
|
+
});
|
|
1313
|
+
|
|
1314
|
+
describe('#latestReport - errors', () => {
|
|
1315
|
+
it('should have a latestReport function', (done) => {
|
|
1316
|
+
try {
|
|
1317
|
+
assert.equal(true, typeof a.latestReport === 'function');
|
|
1318
|
+
done();
|
|
1319
|
+
} catch (error) {
|
|
1320
|
+
log.error(`Test Failure: ${error}`);
|
|
1321
|
+
done(error);
|
|
1322
|
+
}
|
|
1323
|
+
}).timeout(attemptTimeout);
|
|
1324
|
+
it('should error if - missing definitionsEdit', (done) => {
|
|
1325
|
+
try {
|
|
1326
|
+
a.latestReport(null, null, (data, error) => {
|
|
1327
|
+
try {
|
|
1328
|
+
const displayE = 'definitionsEdit is required';
|
|
1329
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-latestReport', displayE);
|
|
1330
|
+
done();
|
|
1331
|
+
} catch (err) {
|
|
1332
|
+
log.error(`Test Failure: ${err}`);
|
|
1333
|
+
done(err);
|
|
1334
|
+
}
|
|
1335
|
+
});
|
|
1336
|
+
} catch (error) {
|
|
1337
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1338
|
+
done(error);
|
|
1339
|
+
}
|
|
1340
|
+
}).timeout(attemptTimeout);
|
|
1341
|
+
it('should error if - missing id', (done) => {
|
|
1342
|
+
try {
|
|
1343
|
+
a.latestReport('fakeparam', null, (data, error) => {
|
|
1344
|
+
try {
|
|
1345
|
+
const displayE = 'id is required';
|
|
1346
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-latestReport', displayE);
|
|
1347
|
+
done();
|
|
1348
|
+
} catch (err) {
|
|
1349
|
+
log.error(`Test Failure: ${err}`);
|
|
1350
|
+
done(err);
|
|
1351
|
+
}
|
|
1352
|
+
});
|
|
1353
|
+
} catch (error) {
|
|
1354
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1355
|
+
done(error);
|
|
1356
|
+
}
|
|
1357
|
+
}).timeout(attemptTimeout);
|
|
1358
|
+
});
|
|
1359
|
+
|
|
1360
|
+
describe('#batchExecuteAPCommand - errors', () => {
|
|
1361
|
+
it('should have a batchExecuteAPCommand function', (done) => {
|
|
1362
|
+
try {
|
|
1363
|
+
assert.equal(true, typeof a.batchExecuteAPCommand === 'function');
|
|
1364
|
+
done();
|
|
1365
|
+
} catch (error) {
|
|
1366
|
+
log.error(`Test Failure: ${error}`);
|
|
1367
|
+
done(error);
|
|
1368
|
+
}
|
|
1369
|
+
}).timeout(attemptTimeout);
|
|
1370
|
+
it('should error if - missing body', (done) => {
|
|
1371
|
+
try {
|
|
1372
|
+
a.batchExecuteAPCommand(null, (data, error) => {
|
|
1373
|
+
try {
|
|
1374
|
+
const displayE = 'body is required';
|
|
1375
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-aruba_airwave-adapter-batchExecuteAPCommand', displayE);
|
|
1376
|
+
done();
|
|
1377
|
+
} catch (err) {
|
|
1378
|
+
log.error(`Test Failure: ${err}`);
|
|
1379
|
+
done(err);
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
} catch (error) {
|
|
1383
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1384
|
+
done(error);
|
|
1385
|
+
}
|
|
1386
|
+
}).timeout(attemptTimeout);
|
|
1387
|
+
});
|
|
1388
|
+
|
|
1389
|
+
describe('#batchExecuteAPCommandResult - errors', () => {
|
|
1390
|
+
it('should have a batchExecuteAPCommandResult function', (done) => {
|
|
1391
|
+
try {
|
|
1392
|
+
assert.equal(true, typeof a.batchExecuteAPCommandResult === 'function');
|
|
1393
|
+
done();
|
|
1394
|
+
} catch (error) {
|
|
1395
|
+
log.error(`Test Failure: ${error}`);
|
|
1396
|
+
done(error);
|
|
1397
|
+
}
|
|
1398
|
+
}).timeout(attemptTimeout);
|
|
1399
|
+
});
|
|
1400
|
+
|
|
1401
|
+
describe('#aMPLogin - errors', () => {
|
|
1402
|
+
it('should have a aMPLogin function', (done) => {
|
|
1403
|
+
try {
|
|
1404
|
+
assert.equal(true, typeof a.aMPLogin === 'function');
|
|
1405
|
+
done();
|
|
1406
|
+
} catch (error) {
|
|
1407
|
+
log.error(`Test Failure: ${error}`);
|
|
1408
|
+
done(error);
|
|
1409
|
+
}
|
|
1410
|
+
}).timeout(attemptTimeout);
|
|
1411
|
+
});
|
|
1412
|
+
});
|
|
1413
|
+
});
|