@itentialopensource/adapter-nokia_altiplano 0.2.0 → 0.5.0
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/CHANGELOG.md +24 -0
- package/ENHANCE.md +6 -6
- package/PROPERTIES.md +9 -3
- package/README.md +112 -542
- package/SUMMARY.md +4 -4
- package/SYSTEMINFO.md +12 -0
- package/TROUBLESHOOT.md +1 -1
- package/adapter.js +1392 -540
- package/adapterBase.js +548 -283
- package/entities/Entity/action.json +70 -0
- package/entities/Entity/schema.json +21 -0
- package/entities/Intent/action.json +116 -0
- package/entities/Intent/schema.json +6 -1
- package/error.json +6 -0
- package/package.json +3 -3
- package/pronghorn.json +944 -330
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +350 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/updateReport1651493162166.json +114 -0
- package/test/integration/adapterTestIntegration.js +227 -0
- package/test/unit/adapterBaseTestUnit.js +22 -24
- package/test/unit/adapterTestUnit.js +437 -51
- package/utils/tbUtils.js +20 -7
package/adapter.js
CHANGED
|
@@ -80,10 +80,10 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
* @
|
|
83
|
+
* @iapGetAdapterWorkflowFunctions
|
|
84
84
|
*/
|
|
85
|
-
|
|
86
|
-
let myIgnore = ['hasEntities', 'hasDevices'];
|
|
85
|
+
iapGetAdapterWorkflowFunctions(inIgnore) {
|
|
86
|
+
let myIgnore = ['hasEntities', 'hasDevices', 'iapMakeBrokerCall'];
|
|
87
87
|
if (!inIgnore && Array.isArray(inIgnore)) {
|
|
88
88
|
myIgnore = inIgnore;
|
|
89
89
|
} else if (!inIgnore && typeof inIgnore === 'string') {
|
|
@@ -94,15 +94,15 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
94
94
|
// you can add specific methods that you do not want to be workflow functions to ignore like below
|
|
95
95
|
// myIgnore.push('myMethodNotInWorkflow');
|
|
96
96
|
|
|
97
|
-
return super.
|
|
97
|
+
return super.iapGetAdapterWorkflowFunctions(myIgnore);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
101
|
+
* iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
|
|
102
102
|
* allows customers to make changes to adapter configuration without having to be on the
|
|
103
103
|
* file system.
|
|
104
104
|
*
|
|
105
|
-
* @function
|
|
105
|
+
* @function iapUpdateAdapterConfiguration
|
|
106
106
|
* @param {string} configFile - the name of the file being updated (required)
|
|
107
107
|
* @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
|
|
108
108
|
* @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
|
|
@@ -110,36 +110,36 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
110
110
|
* @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
|
|
111
111
|
* @param {Callback} callback - The results of the call
|
|
112
112
|
*/
|
|
113
|
-
|
|
114
|
-
const origin = `${this.id}-adapter-
|
|
113
|
+
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
|
|
114
|
+
const origin = `${this.id}-adapter-iapUpdateAdapterConfiguration`;
|
|
115
115
|
log.trace(origin);
|
|
116
|
-
super.
|
|
116
|
+
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
120
|
* See if the API path provided is found in this adapter
|
|
121
121
|
*
|
|
122
|
-
* @function
|
|
122
|
+
* @function iapFindAdapterPath
|
|
123
123
|
* @param {string} apiPath - the api path to check on
|
|
124
124
|
* @param {Callback} callback - The results of the call
|
|
125
125
|
*/
|
|
126
|
-
|
|
127
|
-
const origin = `${this.id}-adapter-
|
|
126
|
+
iapFindAdapterPath(apiPath, callback) {
|
|
127
|
+
const origin = `${this.id}-adapter-iapFindAdapterPath`;
|
|
128
128
|
log.trace(origin);
|
|
129
|
-
super.
|
|
129
|
+
super.iapFindAdapterPath(apiPath, callback);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* @summary Suspends adapter
|
|
134
134
|
*
|
|
135
|
-
* @function
|
|
135
|
+
* @function iapSuspendAdapter
|
|
136
136
|
* @param {Callback} callback - callback function
|
|
137
137
|
*/
|
|
138
|
-
|
|
139
|
-
const origin = `${this.id}-adapter-
|
|
138
|
+
iapSuspendAdapter(mode, callback) {
|
|
139
|
+
const origin = `${this.id}-adapter-iapSuspendAdapter`;
|
|
140
140
|
log.trace(origin);
|
|
141
141
|
try {
|
|
142
|
-
return super.
|
|
142
|
+
return super.iapSuspendAdapter(mode, callback);
|
|
143
143
|
} catch (error) {
|
|
144
144
|
log.error(`${origin}: ${error}`);
|
|
145
145
|
return callback(null, error);
|
|
@@ -149,14 +149,14 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
149
149
|
/**
|
|
150
150
|
* @summary Unsuspends adapter
|
|
151
151
|
*
|
|
152
|
-
* @function
|
|
152
|
+
* @function iapUnsuspendAdapter
|
|
153
153
|
* @param {Callback} callback - callback function
|
|
154
154
|
*/
|
|
155
|
-
|
|
156
|
-
const origin = `${this.id}-adapter-
|
|
155
|
+
iapUnsuspendAdapter(callback) {
|
|
156
|
+
const origin = `${this.id}-adapter-iapUnsuspendAdapter`;
|
|
157
157
|
log.trace(origin);
|
|
158
158
|
try {
|
|
159
|
-
return super.
|
|
159
|
+
return super.iapUnsuspendAdapter(callback);
|
|
160
160
|
} catch (error) {
|
|
161
161
|
log.error(`${origin}: ${error}`);
|
|
162
162
|
return callback(null, error);
|
|
@@ -166,29 +166,29 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
166
166
|
/**
|
|
167
167
|
* @summary Get the Adaoter Queue
|
|
168
168
|
*
|
|
169
|
-
* @function
|
|
169
|
+
* @function iapGetAdapterQueue
|
|
170
170
|
* @param {Callback} callback - callback function
|
|
171
171
|
*/
|
|
172
|
-
|
|
173
|
-
const origin = `${this.id}-adapter-
|
|
172
|
+
iapGetAdapterQueue(callback) {
|
|
173
|
+
const origin = `${this.id}-adapter-iapGetAdapterQueue`;
|
|
174
174
|
log.trace(origin);
|
|
175
|
-
return super.
|
|
175
|
+
return super.iapGetAdapterQueue(callback);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
179
|
* @summary Runs troubleshoot scripts for adapter
|
|
180
180
|
*
|
|
181
|
-
* @function
|
|
181
|
+
* @function iapTroubleshootAdapter
|
|
182
182
|
* @param {Object} props - the connection, healthcheck and authentication properties
|
|
183
183
|
*
|
|
184
184
|
* @param {boolean} persistFlag - whether the adapter properties should be updated
|
|
185
185
|
* @param {Callback} callback - The results of the call
|
|
186
186
|
*/
|
|
187
|
-
|
|
188
|
-
const origin = `${this.id}-adapter-
|
|
187
|
+
iapTroubleshootAdapter(props, persistFlag, callback) {
|
|
188
|
+
const origin = `${this.id}-adapter-iapTroubleshootAdapter`;
|
|
189
189
|
log.trace(origin);
|
|
190
190
|
try {
|
|
191
|
-
return super.
|
|
191
|
+
return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
|
|
192
192
|
} catch (error) {
|
|
193
193
|
log.error(`${origin}: ${error}`);
|
|
194
194
|
return callback(null, error);
|
|
@@ -198,15 +198,15 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
198
198
|
/**
|
|
199
199
|
* @summary runs healthcheck script for adapter
|
|
200
200
|
*
|
|
201
|
-
* @function
|
|
201
|
+
* @function iapRunAdapterHealthcheck
|
|
202
202
|
* @param {Adapter} adapter - adapter instance to troubleshoot
|
|
203
203
|
* @param {Callback} callback - callback function
|
|
204
204
|
*/
|
|
205
|
-
|
|
206
|
-
const origin = `${this.id}-adapter-
|
|
205
|
+
iapRunAdapterHealthcheck(callback) {
|
|
206
|
+
const origin = `${this.id}-adapter-iapRunAdapterHealthcheck`;
|
|
207
207
|
log.trace(origin);
|
|
208
208
|
try {
|
|
209
|
-
return super.
|
|
209
|
+
return super.iapRunAdapterHealthcheck(this, callback);
|
|
210
210
|
} catch (error) {
|
|
211
211
|
log.error(`${origin}: ${error}`);
|
|
212
212
|
return callback(null, error);
|
|
@@ -216,14 +216,14 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
216
216
|
/**
|
|
217
217
|
* @summary runs connectivity check script for adapter
|
|
218
218
|
*
|
|
219
|
-
* @function
|
|
219
|
+
* @function iapRunAdapterConnectivity
|
|
220
220
|
* @param {Callback} callback - callback function
|
|
221
221
|
*/
|
|
222
|
-
|
|
223
|
-
const origin = `${this.id}-adapter-
|
|
222
|
+
iapRunAdapterConnectivity(callback) {
|
|
223
|
+
const origin = `${this.id}-adapter-iapRunAdapterConnectivity`;
|
|
224
224
|
log.trace(origin);
|
|
225
225
|
try {
|
|
226
|
-
return super.
|
|
226
|
+
return super.iapRunAdapterConnectivity(callback);
|
|
227
227
|
} catch (error) {
|
|
228
228
|
log.error(`${origin}: ${error}`);
|
|
229
229
|
return callback(null, error);
|
|
@@ -233,14 +233,14 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
233
233
|
/**
|
|
234
234
|
* @summary runs basicGet script for adapter
|
|
235
235
|
*
|
|
236
|
-
* @function
|
|
236
|
+
* @function iapRunAdapterBasicGet
|
|
237
237
|
* @param {Callback} callback - callback function
|
|
238
238
|
*/
|
|
239
|
-
|
|
240
|
-
const origin = `${this.id}-adapter-
|
|
239
|
+
iapRunAdapterBasicGet(callback) {
|
|
240
|
+
const origin = `${this.id}-adapter-iapRunAdapterBasicGet`;
|
|
241
241
|
log.trace(origin);
|
|
242
242
|
try {
|
|
243
|
-
return super.
|
|
243
|
+
return super.iapRunAdapterBasicGet(callback);
|
|
244
244
|
} catch (error) {
|
|
245
245
|
log.error(`${origin}: ${error}`);
|
|
246
246
|
return callback(null, error);
|
|
@@ -250,45 +250,46 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
250
250
|
/**
|
|
251
251
|
* @summary moves entites into Mongo DB
|
|
252
252
|
*
|
|
253
|
-
* @function
|
|
253
|
+
* @function iapMoveAdapterEntitiesToDB
|
|
254
254
|
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
255
255
|
* or the error
|
|
256
256
|
*/
|
|
257
|
-
|
|
258
|
-
const origin = `${this.id}-adapter-
|
|
257
|
+
iapMoveAdapterEntitiesToDB(callback) {
|
|
258
|
+
const origin = `${this.id}-adapter-iapMoveAdapterEntitiesToDB`;
|
|
259
259
|
log.trace(origin);
|
|
260
260
|
try {
|
|
261
|
-
return super.
|
|
261
|
+
return super.iapMoveAdapterEntitiesToDB(callback);
|
|
262
262
|
} catch (err) {
|
|
263
263
|
log.error(`${origin}: ${err}`);
|
|
264
264
|
return callback(null, err);
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
+
/* BROKER CALLS */
|
|
268
269
|
/**
|
|
269
270
|
* @summary Determines if this adapter supports the specific entity
|
|
270
271
|
*
|
|
271
|
-
* @function
|
|
272
|
+
* @function iapHasAdapterEntity
|
|
272
273
|
* @param {String} entityType - the entity type to check for
|
|
273
274
|
* @param {String/Array} entityId - the specific entity we are looking for
|
|
274
275
|
*
|
|
275
276
|
* @param {Callback} callback - An array of whether the adapter can has the
|
|
276
277
|
* desired capability or an error
|
|
277
278
|
*/
|
|
278
|
-
|
|
279
|
-
const origin = `${this.id}-adapter-
|
|
279
|
+
iapHasAdapterEntity(entityType, entityId, callback) {
|
|
280
|
+
const origin = `${this.id}-adapter-iapHasAdapterEntity`;
|
|
280
281
|
log.trace(origin);
|
|
281
282
|
|
|
282
283
|
// Make the call -
|
|
283
|
-
//
|
|
284
|
-
return this.
|
|
284
|
+
// iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
|
|
285
|
+
return this.iapVerifyAdapterCapability(entityType, null, entityId, callback);
|
|
285
286
|
}
|
|
286
287
|
|
|
287
288
|
/**
|
|
288
289
|
* @summary Provides a way for the adapter to tell north bound integrations
|
|
289
290
|
* whether the adapter supports type, action and specific entity
|
|
290
291
|
*
|
|
291
|
-
* @function
|
|
292
|
+
* @function iapVerifyAdapterCapability
|
|
292
293
|
* @param {String} entityType - the entity type to check for
|
|
293
294
|
* @param {String} actionType - the action type to check for
|
|
294
295
|
* @param {String/Array} entityId - the specific entity we are looking for
|
|
@@ -296,15 +297,15 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
296
297
|
* @param {Callback} callback - An array of whether the adapter can has the
|
|
297
298
|
* desired capability or an error
|
|
298
299
|
*/
|
|
299
|
-
|
|
300
|
-
const meth = 'adapterBase-
|
|
300
|
+
iapVerifyAdapterCapability(entityType, actionType, entityId, callback) {
|
|
301
|
+
const meth = 'adapterBase-iapVerifyAdapterCapability';
|
|
301
302
|
const origin = `${this.id}-${meth}`;
|
|
302
303
|
log.trace(origin);
|
|
303
304
|
|
|
304
305
|
// if caching
|
|
305
306
|
if (this.caching) {
|
|
306
|
-
// Make the call -
|
|
307
|
-
return this.requestHandlerInst.
|
|
307
|
+
// Make the call - iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
|
|
308
|
+
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (results, error) => {
|
|
308
309
|
if (error) {
|
|
309
310
|
return callback(null, error);
|
|
310
311
|
}
|
|
@@ -322,7 +323,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
322
323
|
}
|
|
323
324
|
|
|
324
325
|
// need to check the cache again since it has been updated
|
|
325
|
-
return this.requestHandlerInst.
|
|
326
|
+
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
|
|
326
327
|
if (verror) {
|
|
327
328
|
return callback(null, verror);
|
|
328
329
|
}
|
|
@@ -355,7 +356,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
355
356
|
// if no entity id
|
|
356
357
|
if (!entityId) {
|
|
357
358
|
// need to check the cache again since it has been updated
|
|
358
|
-
return this.requestHandlerInst.
|
|
359
|
+
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
|
|
359
360
|
if (verror) {
|
|
360
361
|
return callback(null, verror);
|
|
361
362
|
}
|
|
@@ -376,7 +377,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
376
377
|
}
|
|
377
378
|
|
|
378
379
|
// need to check the cache again since it has been updated
|
|
379
|
-
return this.requestHandlerInst.
|
|
380
|
+
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
|
|
380
381
|
if (verror) {
|
|
381
382
|
return callback(null, verror);
|
|
382
383
|
}
|
|
@@ -417,11 +418,11 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
417
418
|
/**
|
|
418
419
|
* @summary Updates the cache for all entities by call the get All entity method
|
|
419
420
|
*
|
|
420
|
-
* @function
|
|
421
|
+
* @function iapUpdateAdapterEntityCache
|
|
421
422
|
*
|
|
422
423
|
*/
|
|
423
|
-
|
|
424
|
-
const origin = `${this.id}-adapter-
|
|
424
|
+
iapUpdateAdapterEntityCache() {
|
|
425
|
+
const origin = `${this.id}-adapter-iapUpdateAdapterEntityCache`;
|
|
425
426
|
log.trace(origin);
|
|
426
427
|
|
|
427
428
|
if (this.caching) {
|
|
@@ -434,117 +435,6 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
434
435
|
}
|
|
435
436
|
}
|
|
436
437
|
|
|
437
|
-
/**
|
|
438
|
-
* Makes the requested generic call
|
|
439
|
-
*
|
|
440
|
-
* @function genericAdapterRequest
|
|
441
|
-
* @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
|
|
442
|
-
* @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
|
|
443
|
-
* @param {Object} queryData - the parameters to be put on the url (optional).
|
|
444
|
-
* Can be a stringified Object.
|
|
445
|
-
* @param {Object} requestBody - the body to add to the request (optional).
|
|
446
|
-
* Can be a stringified Object.
|
|
447
|
-
* @param {Object} addlHeaders - additional headers to be put on the call (optional).
|
|
448
|
-
* Can be a stringified Object.
|
|
449
|
-
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
450
|
-
* or the error
|
|
451
|
-
*/
|
|
452
|
-
genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
|
|
453
|
-
const meth = 'adapter-genericAdapterRequest';
|
|
454
|
-
const origin = `${this.id}-${meth}`;
|
|
455
|
-
log.trace(origin);
|
|
456
|
-
|
|
457
|
-
if (this.suspended && this.suspendMode === 'error') {
|
|
458
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
459
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
460
|
-
return callback(null, errorObj);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
464
|
-
if (uriPath === undefined || uriPath === null || uriPath === '') {
|
|
465
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
|
|
466
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
467
|
-
return callback(null, errorObj);
|
|
468
|
-
}
|
|
469
|
-
if (restMethod === undefined || restMethod === null || restMethod === '') {
|
|
470
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
|
|
471
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
472
|
-
return callback(null, errorObj);
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
476
|
-
// remove any leading / and split the uripath into path variables
|
|
477
|
-
let myPath = uriPath;
|
|
478
|
-
while (myPath.indexOf('/') === 0) {
|
|
479
|
-
myPath = myPath.substring(1);
|
|
480
|
-
}
|
|
481
|
-
const pathVars = myPath.split('/');
|
|
482
|
-
const queryParamsAvailable = queryData;
|
|
483
|
-
const queryParams = {};
|
|
484
|
-
const bodyVars = requestBody;
|
|
485
|
-
|
|
486
|
-
// loop in template. long callback arg name to avoid identifier conflicts
|
|
487
|
-
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
488
|
-
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
489
|
-
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
490
|
-
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
491
|
-
}
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
495
|
-
const reqObj = {
|
|
496
|
-
payload: bodyVars,
|
|
497
|
-
uriPathVars: pathVars,
|
|
498
|
-
uriQuery: queryParams,
|
|
499
|
-
uriOptions: {}
|
|
500
|
-
};
|
|
501
|
-
// add headers if provided
|
|
502
|
-
if (addlHeaders) {
|
|
503
|
-
reqObj.addlHeaders = addlHeaders;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
// determine the call and return flag
|
|
507
|
-
let action = 'getGenerics';
|
|
508
|
-
let returnF = true;
|
|
509
|
-
if (restMethod.toUpperCase() === 'POST') {
|
|
510
|
-
action = 'createGeneric';
|
|
511
|
-
} else if (restMethod.toUpperCase() === 'PUT') {
|
|
512
|
-
action = 'updateGeneric';
|
|
513
|
-
} else if (restMethod.toUpperCase() === 'PATCH') {
|
|
514
|
-
action = 'patchGeneric';
|
|
515
|
-
} else if (restMethod.toUpperCase() === 'DELETE') {
|
|
516
|
-
action = 'deleteGeneric';
|
|
517
|
-
returnF = false;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
try {
|
|
521
|
-
// Make the call -
|
|
522
|
-
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
523
|
-
return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
|
|
524
|
-
// if we received an error or their is no response on the results
|
|
525
|
-
// return an error
|
|
526
|
-
if (irReturnError) {
|
|
527
|
-
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
528
|
-
return callback(null, irReturnError);
|
|
529
|
-
}
|
|
530
|
-
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
531
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
|
|
532
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
533
|
-
return callback(null, errorObj);
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
537
|
-
// return the response
|
|
538
|
-
return callback(irReturnData, null);
|
|
539
|
-
});
|
|
540
|
-
} catch (ex) {
|
|
541
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
542
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
543
|
-
return callback(null, errorObj);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
/* BROKER CALLS */
|
|
548
438
|
/**
|
|
549
439
|
* @summary Determines if this adapter supports any in a list of entities
|
|
550
440
|
*
|
|
@@ -620,8 +510,9 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
620
510
|
const origin = `${this.id}-${meth}`;
|
|
621
511
|
log.trace(origin);
|
|
622
512
|
|
|
623
|
-
|
|
624
|
-
|
|
513
|
+
// make sure we are set up for device broker getDevice
|
|
514
|
+
if (!this.allProps.devicebroker || !this.allProps.devicebroker.getDevice || this.allProps.devicebroker.getDevice.length === 0 || !this.allProps.devicebroker.getDevice[0].path) {
|
|
515
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Properties', ['devicebroker.getDevice.path'], null, null, null);
|
|
625
516
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
626
517
|
return callback(null, errorObj);
|
|
627
518
|
}
|
|
@@ -651,32 +542,33 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
651
542
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
652
543
|
return callback(null, errorObj);
|
|
653
544
|
}
|
|
654
|
-
// get the uuid from the device
|
|
655
|
-
const { uuid } = devs.list[0];
|
|
656
545
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
546
|
+
const callPromises = [];
|
|
547
|
+
for (let i = 0; i < this.allProps.devicebroker.getDevice.length; i += 1) {
|
|
548
|
+
// Perform component calls here.
|
|
549
|
+
callPromises.push(
|
|
550
|
+
new Promise((resolve, reject) => {
|
|
551
|
+
this.iapMakeBrokerCall('getDevice', this.allProps.devicebroker.getDevice[i], devs.list[0], null, (callRet, callErr) => {
|
|
552
|
+
// return an error
|
|
553
|
+
if (callErr) {
|
|
554
|
+
reject(callErr);
|
|
555
|
+
} else {
|
|
556
|
+
// return the data
|
|
557
|
+
resolve(callRet);
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
})
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
// return an array of repsonses
|
|
565
|
+
return Promise.all(callPromises).then((results) => {
|
|
566
|
+
let myResult = {};
|
|
567
|
+
results.forEach((result) => {
|
|
568
|
+
myResult = { ...myResult, ...result };
|
|
569
|
+
});
|
|
670
570
|
|
|
671
|
-
|
|
672
|
-
// !! format the data we send back
|
|
673
|
-
// !! these fields are config manager fields you need to map to the data we receive
|
|
674
|
-
const thisDevice = result.response;
|
|
675
|
-
thisDevice.name = thisDevice.systemName;
|
|
676
|
-
thisDevice.ostype = `System-${thisDevice.systemType}`;
|
|
677
|
-
thisDevice.port = thisDevice.systemPort;
|
|
678
|
-
thisDevice.ipaddress = thisDevice.systemIP;
|
|
679
|
-
return callback(thisDevice);
|
|
571
|
+
return callback(myResult, null);
|
|
680
572
|
});
|
|
681
573
|
});
|
|
682
574
|
} catch (ex) {
|
|
@@ -700,6 +592,13 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
700
592
|
const origin = `${this.id}-${meth}`;
|
|
701
593
|
log.trace(origin);
|
|
702
594
|
|
|
595
|
+
// make sure we are set up for device broker getDevicesFiltered
|
|
596
|
+
if (!this.allProps.devicebroker || !this.allProps.devicebroker.getDevicesFiltered || this.allProps.devicebroker.getDevicesFiltered.length === 0 || !this.allProps.devicebroker.getDevicesFiltered[0].path) {
|
|
597
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Properties', ['devicebroker.getDevicesFiltered.path'], null, null, null);
|
|
598
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
599
|
+
return callback(null, errorObj);
|
|
600
|
+
}
|
|
601
|
+
|
|
703
602
|
// verify the required fields have been provided
|
|
704
603
|
if (options === undefined || options === null || options === '' || options.length === 0) {
|
|
705
604
|
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['options'], null, null, null);
|
|
@@ -708,115 +607,64 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
708
607
|
}
|
|
709
608
|
log.debug(`Device Filter Options: ${JSON.stringify(options)}`);
|
|
710
609
|
|
|
711
|
-
// TODO - get pagination working
|
|
712
|
-
// const nextToken = options.start;
|
|
713
|
-
// const maxResults = options.limit;
|
|
714
|
-
|
|
715
|
-
// set up the filter of Device Names
|
|
716
|
-
let filterName = [];
|
|
717
|
-
if (options && options.filter && options.filter.name) {
|
|
718
|
-
// when this hack is removed, remove the lint ignore above
|
|
719
|
-
if (Array.isArray(options.filter.name)) {
|
|
720
|
-
// eslint-disable-next-line prefer-destructuring
|
|
721
|
-
filterName = options.filter.name;
|
|
722
|
-
} else {
|
|
723
|
-
filterName = [options.filter.name];
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
// TODO - get sort and order working
|
|
728
|
-
/*
|
|
729
|
-
if (options && options.sort) {
|
|
730
|
-
reqObj.uriOptions.sort = JSON.stringify(options.sort);
|
|
731
|
-
}
|
|
732
|
-
if (options && options.order) {
|
|
733
|
-
reqObj.uriOptions.order = options.order;
|
|
734
|
-
}
|
|
735
|
-
*/
|
|
736
610
|
try {
|
|
737
|
-
//
|
|
738
|
-
//
|
|
739
|
-
const
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
if (
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
611
|
+
// TODO - get pagination working
|
|
612
|
+
// const nextToken = options.start;
|
|
613
|
+
// const maxResults = options.limit;
|
|
614
|
+
|
|
615
|
+
// set up the filter of Device Names
|
|
616
|
+
let filterName = [];
|
|
617
|
+
if (options && options.filter && options.filter.name) {
|
|
618
|
+
// when this hack is removed, remove the lint ignore above
|
|
619
|
+
if (Array.isArray(options.filter.name)) {
|
|
620
|
+
// eslint-disable-next-line prefer-destructuring
|
|
621
|
+
filterName = options.filter.name;
|
|
622
|
+
} else {
|
|
623
|
+
filterName = [options.filter.name];
|
|
749
624
|
}
|
|
625
|
+
}
|
|
750
626
|
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
if (thisDevice.name.indexOf(filterName[f]) >= 0) {
|
|
773
|
-
found = true;
|
|
774
|
-
break;
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
// matching device
|
|
778
|
-
if (found) {
|
|
779
|
-
myDevices.push(thisDevice);
|
|
627
|
+
// TODO - get sort and order working
|
|
628
|
+
/*
|
|
629
|
+
if (options && options.sort) {
|
|
630
|
+
reqObj.uriOptions.sort = JSON.stringify(options.sort);
|
|
631
|
+
}
|
|
632
|
+
if (options && options.order) {
|
|
633
|
+
reqObj.uriOptions.order = options.order;
|
|
634
|
+
}
|
|
635
|
+
*/
|
|
636
|
+
const callPromises = [];
|
|
637
|
+
for (let i = 0; i < this.allProps.devicebroker.getDevicesFiltered.length; i += 1) {
|
|
638
|
+
// Perform component calls here.
|
|
639
|
+
callPromises.push(
|
|
640
|
+
new Promise((resolve, reject) => {
|
|
641
|
+
this.iapMakeBrokerCall('getDevicesFiltered', this.allProps.devicebroker.getDevicesFiltered[i], null, filterName, (callRet, callErr) => {
|
|
642
|
+
// return an error
|
|
643
|
+
if (callErr) {
|
|
644
|
+
reject(callErr);
|
|
645
|
+
} else {
|
|
646
|
+
// return the data
|
|
647
|
+
resolve(callRet);
|
|
780
648
|
}
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
thisDevice.ipaddress = thisDevice.systemIP;
|
|
795
|
-
|
|
796
|
-
// if there is no filter - return the device
|
|
797
|
-
if (filterName.length === 0) {
|
|
798
|
-
log.debug(`${origin}: Found #1 device.`);
|
|
799
|
-
log.debug(`Device: ${JSON.stringify(thisDevice)}`);
|
|
800
|
-
return callback({ total: 1, list: [thisDevice] });
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
// if there is a filter need to check for matching device
|
|
804
|
-
let found = false;
|
|
805
|
-
for (let f = 0; f < filterName.length; f += 1) {
|
|
806
|
-
if (thisDevice.name.indexOf(filterName[f]) >= 0) {
|
|
807
|
-
found = true;
|
|
808
|
-
break;
|
|
649
|
+
});
|
|
650
|
+
})
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// return an array of repsonses
|
|
655
|
+
return Promise.all(callPromises).then((results) => {
|
|
656
|
+
let myResult = [];
|
|
657
|
+
results.forEach((result) => {
|
|
658
|
+
if (Array.isArray(result)) {
|
|
659
|
+
myResult = [...myResult, ...result];
|
|
660
|
+
} else if (Object.keys(result).length > 0) {
|
|
661
|
+
myResult.push(result);
|
|
809
662
|
}
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
return callback({ total: 1, list: [thisDevice] });
|
|
816
|
-
}
|
|
817
|
-
// not a matching device
|
|
818
|
-
log.debug(`${origin}: No matching device found.`);
|
|
819
|
-
return callback({ total: 0, list: [] });
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
log.debug(`${origin}: Found #${myResult.length} devices.`);
|
|
666
|
+
log.debug(`Devices: ${JSON.stringify(myResult)}`);
|
|
667
|
+
return callback({ total: myResult.length, list: myResult });
|
|
820
668
|
});
|
|
821
669
|
} catch (ex) {
|
|
822
670
|
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
@@ -839,6 +687,13 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
839
687
|
const origin = `${this.id}-${meth}`;
|
|
840
688
|
log.trace(origin);
|
|
841
689
|
|
|
690
|
+
// make sure we are set up for device broker isAlive
|
|
691
|
+
if (!this.allProps.devicebroker || !this.allProps.devicebroker.isAlive || this.allProps.devicebroker.isAlive.length === 0 || !this.allProps.devicebroker.isAlive[0].path) {
|
|
692
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Properties', ['devicebroker.isAlive.path'], null, null, null);
|
|
693
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
694
|
+
return callback(null, errorObj);
|
|
695
|
+
}
|
|
696
|
+
|
|
842
697
|
// verify the required fields have been provided
|
|
843
698
|
if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
|
|
844
699
|
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
|
|
@@ -864,26 +719,37 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
864
719
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
865
720
|
return callback(null, errorObj);
|
|
866
721
|
}
|
|
867
|
-
// get the uuid from the device
|
|
868
|
-
const { uuid } = devs.list[0];
|
|
869
722
|
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
723
|
+
const callPromises = [];
|
|
724
|
+
for (let i = 0; i < this.allProps.devicebroker.isAlive.length; i += 1) {
|
|
725
|
+
// Perform component calls here.
|
|
726
|
+
callPromises.push(
|
|
727
|
+
new Promise((resolve, reject) => {
|
|
728
|
+
this.iapMakeBrokerCall('isAlive', this.allProps.devicebroker.isAlive[i], devs.list[0], null, (callRet, callErr) => {
|
|
729
|
+
// return an error
|
|
730
|
+
if (callErr) {
|
|
731
|
+
reject(callErr);
|
|
732
|
+
} else {
|
|
733
|
+
// return the data
|
|
734
|
+
resolve(callRet);
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
})
|
|
738
|
+
);
|
|
739
|
+
}
|
|
884
740
|
|
|
885
|
-
|
|
886
|
-
|
|
741
|
+
// return an array of repsonses
|
|
742
|
+
return Promise.all(callPromises).then((results) => {
|
|
743
|
+
let myResult = {};
|
|
744
|
+
results.forEach((result) => {
|
|
745
|
+
myResult = { ...myResult, ...result };
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
let response = true;
|
|
749
|
+
if (myResult.isAlive !== null && myResult.isAlive !== undefined && myResult.isAlive === false) {
|
|
750
|
+
response = false;
|
|
751
|
+
}
|
|
752
|
+
return callback(response);
|
|
887
753
|
});
|
|
888
754
|
});
|
|
889
755
|
} catch (ex) {
|
|
@@ -908,6 +774,13 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
908
774
|
const origin = `${this.id}-${meth}`;
|
|
909
775
|
log.trace(origin);
|
|
910
776
|
|
|
777
|
+
// make sure we are set up for device broker getConfig
|
|
778
|
+
if (!this.allProps.devicebroker || !this.allProps.devicebroker.getConfig || this.allProps.devicebroker.getConfig.length === 0 || !this.allProps.devicebroker.getConfig[0].path) {
|
|
779
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Properties', ['devicebroker.getConfig.path'], null, null, null);
|
|
780
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
781
|
+
return callback(null, errorObj);
|
|
782
|
+
}
|
|
783
|
+
|
|
911
784
|
// verify the required fields have been provided
|
|
912
785
|
if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
|
|
913
786
|
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
|
|
@@ -933,23 +806,37 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
933
806
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
934
807
|
return callback(null, errorObj);
|
|
935
808
|
}
|
|
936
|
-
// get the uuid from the device
|
|
937
|
-
const { uuid } = devs.list[0];
|
|
938
809
|
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
810
|
+
const callPromises = [];
|
|
811
|
+
for (let i = 0; i < this.allProps.devicebroker.getConfig.length; i += 1) {
|
|
812
|
+
// Perform component calls here.
|
|
813
|
+
callPromises.push(
|
|
814
|
+
new Promise((resolve, reject) => {
|
|
815
|
+
this.iapMakeBrokerCall('getConfig', this.allProps.devicebroker.getConfig[i], devs.list[0], null, (callRet, callErr) => {
|
|
816
|
+
// return an error
|
|
817
|
+
if (callErr) {
|
|
818
|
+
reject(callErr);
|
|
819
|
+
} else {
|
|
820
|
+
// return the data
|
|
821
|
+
resolve(callRet);
|
|
822
|
+
}
|
|
823
|
+
});
|
|
824
|
+
})
|
|
825
|
+
);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
// return an array of repsonses
|
|
829
|
+
return Promise.all(callPromises).then((results) => {
|
|
830
|
+
let myResult = {};
|
|
831
|
+
results.forEach((result) => {
|
|
832
|
+
myResult = { ...myResult, ...result };
|
|
833
|
+
});
|
|
947
834
|
|
|
948
835
|
// return the result
|
|
949
836
|
const newResponse = {
|
|
950
|
-
response: JSON.stringify(
|
|
837
|
+
response: JSON.stringify(myResult, null, 2)
|
|
951
838
|
};
|
|
952
|
-
return callback(newResponse);
|
|
839
|
+
return callback(newResponse, null);
|
|
953
840
|
});
|
|
954
841
|
});
|
|
955
842
|
} catch (ex) {
|
|
@@ -962,30 +849,53 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
962
849
|
/**
|
|
963
850
|
* @summary Gets the device count from the system
|
|
964
851
|
*
|
|
965
|
-
* @function
|
|
852
|
+
* @function iapGetDeviceCount
|
|
966
853
|
*
|
|
967
854
|
* @param {getCallback} callback - callback function to return the result
|
|
968
855
|
* (count) or the error
|
|
969
856
|
*/
|
|
970
|
-
|
|
971
|
-
const meth = 'adapter-
|
|
857
|
+
iapGetDeviceCount(callback) {
|
|
858
|
+
const meth = 'adapter-iapGetDeviceCount';
|
|
972
859
|
const origin = `${this.id}-${meth}`;
|
|
973
860
|
log.trace(origin);
|
|
974
861
|
|
|
862
|
+
// make sure we are set up for device broker getCount
|
|
863
|
+
if (!this.allProps.devicebroker || !this.allProps.devicebroker.getCount || this.allProps.devicebroker.getCount.length === 0 || !this.allProps.devicebroker.getCount[0].path) {
|
|
864
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Properties', ['devicebroker.getCount.path'], null, null, null);
|
|
865
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
866
|
+
return callback(null, errorObj);
|
|
867
|
+
}
|
|
868
|
+
|
|
975
869
|
// verify the required fields have been provided
|
|
976
870
|
|
|
977
871
|
try {
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
872
|
+
const callPromises = [];
|
|
873
|
+
for (let i = 0; i < this.allProps.devicebroker.getCount.length; i += 1) {
|
|
874
|
+
// Perform component calls here.
|
|
875
|
+
callPromises.push(
|
|
876
|
+
new Promise((resolve, reject) => {
|
|
877
|
+
this.iapMakeBrokerCall('getCount', this.allProps.devicebroker.getCount[i], null, null, (callRet, callErr) => {
|
|
878
|
+
// return an error
|
|
879
|
+
if (callErr) {
|
|
880
|
+
reject(callErr);
|
|
881
|
+
} else {
|
|
882
|
+
// return the data
|
|
883
|
+
resolve(callRet);
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
})
|
|
887
|
+
);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
// return an array of repsonses
|
|
891
|
+
return Promise.all(callPromises).then((results) => {
|
|
892
|
+
let myResult = {};
|
|
893
|
+
results.forEach((result) => {
|
|
894
|
+
myResult = { ...myResult, ...result };
|
|
895
|
+
});
|
|
986
896
|
|
|
987
897
|
// return the result
|
|
988
|
-
return callback({ count:
|
|
898
|
+
return callback({ count: myResult.length });
|
|
989
899
|
});
|
|
990
900
|
} catch (ex) {
|
|
991
901
|
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
@@ -994,47 +904,24 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
994
904
|
}
|
|
995
905
|
}
|
|
996
906
|
|
|
907
|
+
/* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
|
|
997
908
|
/**
|
|
998
|
-
*
|
|
999
|
-
* @param {Object} result - the result of the get request (contains an id and a status)
|
|
1000
|
-
*/
|
|
1001
|
-
/**
|
|
1002
|
-
* @callback getCallback
|
|
1003
|
-
* @param {Object} result - the result of the get request (entity/ies)
|
|
1004
|
-
* @param {String} error - any error that occurred
|
|
1005
|
-
*/
|
|
1006
|
-
/**
|
|
1007
|
-
* @callback createCallback
|
|
1008
|
-
* @param {Object} item - the newly created entity
|
|
1009
|
-
* @param {String} error - any error that occurred
|
|
1010
|
-
*/
|
|
1011
|
-
/**
|
|
1012
|
-
* @callback updateCallback
|
|
1013
|
-
* @param {String} status - the status of the update action
|
|
1014
|
-
* @param {String} error - any error that occurred
|
|
1015
|
-
*/
|
|
1016
|
-
/**
|
|
1017
|
-
* @callback deleteCallback
|
|
1018
|
-
* @param {String} status - the status of the delete action
|
|
1019
|
-
* @param {String} error - any error that occurred
|
|
1020
|
-
*/
|
|
1021
|
-
|
|
1022
|
-
/**
|
|
1023
|
-
* @function getAccessToken
|
|
1024
|
-
* @pronghornType method
|
|
1025
|
-
* @name getAccessToken
|
|
1026
|
-
* @summary GetAccessToken
|
|
1027
|
-
*
|
|
1028
|
-
* @param {getCallback} callback - a callback function to return the result
|
|
1029
|
-
* @return {object} results - An object containing the response of the action
|
|
909
|
+
* Makes the requested generic call
|
|
1030
910
|
*
|
|
1031
|
-
* @
|
|
1032
|
-
* @
|
|
1033
|
-
* @
|
|
911
|
+
* @function genericAdapterRequest
|
|
912
|
+
* @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
|
|
913
|
+
* @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
|
|
914
|
+
* @param {Object} queryData - the parameters to be put on the url (optional).
|
|
915
|
+
* Can be a stringified Object.
|
|
916
|
+
* @param {Object} requestBody - the body to add to the request (optional).
|
|
917
|
+
* Can be a stringified Object.
|
|
918
|
+
* @param {Object} addlHeaders - additional headers to be put on the call (optional).
|
|
919
|
+
* Can be a stringified Object.
|
|
920
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
921
|
+
* or the error
|
|
1034
922
|
*/
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
const meth = 'adapter-getAccessToken';
|
|
923
|
+
genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
|
|
924
|
+
const meth = 'adapter-genericAdapterRequest';
|
|
1038
925
|
const origin = `${this.id}-${meth}`;
|
|
1039
926
|
log.trace(origin);
|
|
1040
927
|
|
|
@@ -1045,11 +932,890 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1045
932
|
}
|
|
1046
933
|
|
|
1047
934
|
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
935
|
+
if (uriPath === undefined || uriPath === null || uriPath === '') {
|
|
936
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
|
|
937
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
938
|
+
return callback(null, errorObj);
|
|
939
|
+
}
|
|
940
|
+
if (restMethod === undefined || restMethod === null || restMethod === '') {
|
|
941
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
|
|
942
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
943
|
+
return callback(null, errorObj);
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
947
|
+
// remove any leading / and split the uripath into path variables
|
|
948
|
+
let myPath = uriPath;
|
|
949
|
+
while (myPath.indexOf('/') === 0) {
|
|
950
|
+
myPath = myPath.substring(1);
|
|
951
|
+
}
|
|
952
|
+
const pathVars = myPath.split('/');
|
|
953
|
+
const queryParamsAvailable = queryData;
|
|
954
|
+
const queryParams = {};
|
|
955
|
+
const bodyVars = requestBody;
|
|
956
|
+
|
|
957
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
958
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
959
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
960
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
961
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
|
|
965
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
966
|
+
const reqObj = {
|
|
967
|
+
payload: bodyVars,
|
|
968
|
+
uriPathVars: pathVars,
|
|
969
|
+
uriQuery: queryParams,
|
|
970
|
+
uriOptions: {}
|
|
971
|
+
};
|
|
972
|
+
// add headers if provided
|
|
973
|
+
if (addlHeaders) {
|
|
974
|
+
reqObj.addlHeaders = addlHeaders;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
// determine the call and return flag
|
|
978
|
+
let action = 'getGenerics';
|
|
979
|
+
let returnF = true;
|
|
980
|
+
if (restMethod.toUpperCase() === 'POST') {
|
|
981
|
+
action = 'createGeneric';
|
|
982
|
+
} else if (restMethod.toUpperCase() === 'PUT') {
|
|
983
|
+
action = 'updateGeneric';
|
|
984
|
+
} else if (restMethod.toUpperCase() === 'PATCH') {
|
|
985
|
+
action = 'patchGeneric';
|
|
986
|
+
} else if (restMethod.toUpperCase() === 'DELETE') {
|
|
987
|
+
action = 'deleteGeneric';
|
|
988
|
+
returnF = false;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
try {
|
|
992
|
+
// Make the call -
|
|
993
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
994
|
+
return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
|
|
995
|
+
// if we received an error or their is no response on the results
|
|
996
|
+
// return an error
|
|
997
|
+
if (irReturnError) {
|
|
998
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
999
|
+
return callback(null, irReturnError);
|
|
1000
|
+
}
|
|
1001
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1002
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
|
|
1003
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1004
|
+
return callback(null, errorObj);
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1008
|
+
// return the response
|
|
1009
|
+
return callback(irReturnData, null);
|
|
1010
|
+
});
|
|
1011
|
+
} catch (ex) {
|
|
1012
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1013
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1014
|
+
return callback(null, errorObj);
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* @callback healthCallback
|
|
1020
|
+
* @param {Object} result - the result of the get request (contains an id and a status)
|
|
1021
|
+
*/
|
|
1022
|
+
/**
|
|
1023
|
+
* @callback getCallback
|
|
1024
|
+
* @param {Object} result - the result of the get request (entity/ies)
|
|
1025
|
+
* @param {String} error - any error that occurred
|
|
1026
|
+
*/
|
|
1027
|
+
/**
|
|
1028
|
+
* @callback createCallback
|
|
1029
|
+
* @param {Object} item - the newly created entity
|
|
1030
|
+
* @param {String} error - any error that occurred
|
|
1031
|
+
*/
|
|
1032
|
+
/**
|
|
1033
|
+
* @callback updateCallback
|
|
1034
|
+
* @param {String} status - the status of the update action
|
|
1035
|
+
* @param {String} error - any error that occurred
|
|
1036
|
+
*/
|
|
1037
|
+
/**
|
|
1038
|
+
* @callback deleteCallback
|
|
1039
|
+
* @param {String} status - the status of the delete action
|
|
1040
|
+
* @param {String} error - any error that occurred
|
|
1041
|
+
*/
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* @function getAccessToken
|
|
1045
|
+
* @pronghornType method
|
|
1046
|
+
* @name getAccessToken
|
|
1047
|
+
* @summary GetAccessToken
|
|
1048
|
+
*
|
|
1049
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1050
|
+
* @return {object} results - An object containing the response of the action
|
|
1051
|
+
*
|
|
1052
|
+
* @route {GET} /getAccessToken
|
|
1053
|
+
* @roles admin
|
|
1054
|
+
* @task true
|
|
1055
|
+
*/
|
|
1056
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1057
|
+
getAccessToken(callback) {
|
|
1058
|
+
const meth = 'adapter-getAccessToken';
|
|
1059
|
+
const origin = `${this.id}-${meth}`;
|
|
1060
|
+
log.trace(origin);
|
|
1061
|
+
|
|
1062
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1063
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1064
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1065
|
+
return callback(null, errorObj);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1069
|
+
|
|
1070
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1071
|
+
const queryParamsAvailable = {};
|
|
1072
|
+
const queryParams = {};
|
|
1073
|
+
const pathVars = [];
|
|
1074
|
+
const bodyVars = {};
|
|
1075
|
+
|
|
1076
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1077
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1078
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1079
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1080
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1085
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1086
|
+
const reqObj = {
|
|
1087
|
+
payload: bodyVars,
|
|
1088
|
+
uriPathVars: pathVars,
|
|
1089
|
+
uriQuery: queryParams
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
try {
|
|
1093
|
+
// Make the call -
|
|
1094
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1095
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'getAccessToken', reqObj, true, (irReturnData, irReturnError) => {
|
|
1096
|
+
// if we received an error or their is no response on the results
|
|
1097
|
+
// return an error
|
|
1098
|
+
if (irReturnError) {
|
|
1099
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1100
|
+
return callback(null, irReturnError);
|
|
1101
|
+
}
|
|
1102
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1103
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getAccessToken'], null, null, null);
|
|
1104
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1105
|
+
return callback(null, errorObj);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1109
|
+
// return the response
|
|
1110
|
+
return callback(irReturnData, null);
|
|
1111
|
+
});
|
|
1112
|
+
} catch (ex) {
|
|
1113
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1114
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1115
|
+
return callback(null, errorObj);
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* @function dependentsSummaryForDevice
|
|
1121
|
+
* @pronghornType method
|
|
1122
|
+
* @name dependentsSummaryForDevice
|
|
1123
|
+
* @summary Dependents-summary for device
|
|
1124
|
+
*
|
|
1125
|
+
* @param {string} intent - the intent
|
|
1126
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1127
|
+
* @return {object} results - An object containing the response of the action
|
|
1128
|
+
*
|
|
1129
|
+
* @route {POST} /dependentsSummaryForDevice
|
|
1130
|
+
* @roles admin
|
|
1131
|
+
* @task true
|
|
1132
|
+
*/
|
|
1133
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1134
|
+
dependentsSummaryForDevice(intent, callback) {
|
|
1135
|
+
const meth = 'adapter-dependentsSummaryForDevice';
|
|
1136
|
+
const origin = `${this.id}-${meth}`;
|
|
1137
|
+
log.trace(origin);
|
|
1138
|
+
|
|
1139
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1140
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1141
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1142
|
+
return callback(null, errorObj);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1146
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
1147
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
1148
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1149
|
+
return callback(null, errorObj);
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1153
|
+
const queryParamsAvailable = {};
|
|
1154
|
+
const queryParams = {};
|
|
1155
|
+
const pathVars = [intent];
|
|
1156
|
+
const bodyVars = {};
|
|
1157
|
+
|
|
1158
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1159
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1160
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1161
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1162
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1163
|
+
}
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1167
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1168
|
+
const reqObj = {
|
|
1169
|
+
payload: bodyVars,
|
|
1170
|
+
uriPathVars: pathVars,
|
|
1171
|
+
uriQuery: queryParams
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
try {
|
|
1175
|
+
// Make the call -
|
|
1176
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1177
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'dependentsSummaryForDevice', reqObj, true, (irReturnData, irReturnError) => {
|
|
1178
|
+
// if we received an error or their is no response on the results
|
|
1179
|
+
// return an error
|
|
1180
|
+
if (irReturnError) {
|
|
1181
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1182
|
+
return callback(null, irReturnError);
|
|
1183
|
+
}
|
|
1184
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1185
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['dependentsSummaryForDevice'], null, null, null);
|
|
1186
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1187
|
+
return callback(null, errorObj);
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1191
|
+
// return the response
|
|
1192
|
+
return callback(irReturnData, null);
|
|
1193
|
+
});
|
|
1194
|
+
} catch (ex) {
|
|
1195
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1196
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1197
|
+
return callback(null, errorObj);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
/**
|
|
1202
|
+
* @function getuplinkConnectionConfiguration
|
|
1203
|
+
* @pronghornType method
|
|
1204
|
+
* @name getuplinkConnectionConfiguration
|
|
1205
|
+
* @summary Get uplink-connection configuration
|
|
1206
|
+
*
|
|
1207
|
+
* @param {object} body - body param
|
|
1208
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1209
|
+
* @return {object} results - An object containing the response of the action
|
|
1210
|
+
*
|
|
1211
|
+
* @route {POST} /getuplinkConnectionConfiguration
|
|
1212
|
+
* @roles admin
|
|
1213
|
+
* @task true
|
|
1214
|
+
*/
|
|
1215
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1216
|
+
getuplinkConnectionConfiguration(body, callback) {
|
|
1217
|
+
const meth = 'adapter-getuplinkConnectionConfiguration';
|
|
1218
|
+
const origin = `${this.id}-${meth}`;
|
|
1219
|
+
log.trace(origin);
|
|
1220
|
+
|
|
1221
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1222
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1223
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1224
|
+
return callback(null, errorObj);
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1228
|
+
if (body === undefined || body === null || body === '') {
|
|
1229
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
1230
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1231
|
+
return callback(null, errorObj);
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1235
|
+
const queryParamsAvailable = {};
|
|
1236
|
+
const queryParams = {};
|
|
1237
|
+
const pathVars = [];
|
|
1238
|
+
const bodyVars = body;
|
|
1239
|
+
|
|
1240
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1241
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1242
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1243
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1244
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1245
|
+
}
|
|
1246
|
+
});
|
|
1247
|
+
|
|
1248
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1249
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1250
|
+
const reqObj = {
|
|
1251
|
+
payload: bodyVars,
|
|
1252
|
+
uriPathVars: pathVars,
|
|
1253
|
+
uriQuery: queryParams
|
|
1254
|
+
};
|
|
1255
|
+
|
|
1256
|
+
try {
|
|
1257
|
+
// Make the call -
|
|
1258
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1259
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'getuplinkConnectionConfiguration', reqObj, true, (irReturnData, irReturnError) => {
|
|
1260
|
+
// if we received an error or their is no response on the results
|
|
1261
|
+
// return an error
|
|
1262
|
+
if (irReturnError) {
|
|
1263
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1264
|
+
return callback(null, irReturnError);
|
|
1265
|
+
}
|
|
1266
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1267
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getuplinkConnectionConfiguration'], null, null, null);
|
|
1268
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1269
|
+
return callback(null, errorObj);
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1273
|
+
// return the response
|
|
1274
|
+
return callback(irReturnData, null);
|
|
1275
|
+
});
|
|
1276
|
+
} catch (ex) {
|
|
1277
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1278
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1279
|
+
return callback(null, errorObj);
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* @function dependentsSummaryFiber
|
|
1285
|
+
* @pronghornType method
|
|
1286
|
+
* @name dependentsSummaryFiber
|
|
1287
|
+
* @summary Dependents summary fiber
|
|
1288
|
+
*
|
|
1289
|
+
* @param {string} intent - the intent
|
|
1290
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1291
|
+
* @return {object} results - An object containing the response of the action
|
|
1292
|
+
*
|
|
1293
|
+
* @route {POST} /dependentsSummaryFiber
|
|
1294
|
+
* @roles admin
|
|
1295
|
+
* @task true
|
|
1296
|
+
*/
|
|
1297
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1298
|
+
dependentsSummaryFiber(intent, callback) {
|
|
1299
|
+
const meth = 'adapter-dependentsSummaryFiber';
|
|
1300
|
+
const origin = `${this.id}-${meth}`;
|
|
1301
|
+
log.trace(origin);
|
|
1302
|
+
|
|
1303
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1304
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1305
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1306
|
+
return callback(null, errorObj);
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1310
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
1311
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
1312
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1313
|
+
return callback(null, errorObj);
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1317
|
+
const queryParamsAvailable = {};
|
|
1318
|
+
const queryParams = {};
|
|
1319
|
+
const pathVars = [intent];
|
|
1320
|
+
const bodyVars = {};
|
|
1321
|
+
|
|
1322
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1323
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1324
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1325
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1326
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1327
|
+
}
|
|
1328
|
+
});
|
|
1329
|
+
|
|
1330
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1331
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1332
|
+
const reqObj = {
|
|
1333
|
+
payload: bodyVars,
|
|
1334
|
+
uriPathVars: pathVars,
|
|
1335
|
+
uriQuery: queryParams
|
|
1336
|
+
};
|
|
1337
|
+
|
|
1338
|
+
try {
|
|
1339
|
+
// Make the call -
|
|
1340
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1341
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'dependentsSummaryFiber', reqObj, true, (irReturnData, irReturnError) => {
|
|
1342
|
+
// if we received an error or their is no response on the results
|
|
1343
|
+
// return an error
|
|
1344
|
+
if (irReturnError) {
|
|
1345
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1346
|
+
return callback(null, irReturnError);
|
|
1347
|
+
}
|
|
1348
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1349
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['dependentsSummaryFiber'], null, null, null);
|
|
1350
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1351
|
+
return callback(null, errorObj);
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1355
|
+
// return the response
|
|
1356
|
+
return callback(irReturnData, null);
|
|
1357
|
+
});
|
|
1358
|
+
} catch (ex) {
|
|
1359
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1360
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1361
|
+
return callback(null, errorObj);
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
/**
|
|
1366
|
+
* @function createOnt
|
|
1367
|
+
* @pronghornType method
|
|
1368
|
+
* @name createOnt
|
|
1369
|
+
* @summary Create ont
|
|
1370
|
+
*
|
|
1371
|
+
* @param {object} body - body param
|
|
1372
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1373
|
+
* @return {object} results - An object containing the response of the action
|
|
1374
|
+
*
|
|
1375
|
+
* @route {POST} /createOnt
|
|
1376
|
+
* @roles admin
|
|
1377
|
+
* @task true
|
|
1378
|
+
*/
|
|
1379
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1380
|
+
createOnt(body, callback) {
|
|
1381
|
+
const meth = 'adapter-createOnt';
|
|
1382
|
+
const origin = `${this.id}-${meth}`;
|
|
1383
|
+
log.trace(origin);
|
|
1384
|
+
|
|
1385
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1386
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1387
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1388
|
+
return callback(null, errorObj);
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1392
|
+
if (body === undefined || body === null || body === '') {
|
|
1393
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
1394
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1395
|
+
return callback(null, errorObj);
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1399
|
+
const queryParamsAvailable = {};
|
|
1400
|
+
const queryParams = {};
|
|
1401
|
+
const pathVars = [];
|
|
1402
|
+
const bodyVars = body;
|
|
1403
|
+
|
|
1404
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1405
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1406
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1407
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1408
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1411
|
+
|
|
1412
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1413
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1414
|
+
const reqObj = {
|
|
1415
|
+
payload: bodyVars,
|
|
1416
|
+
uriPathVars: pathVars,
|
|
1417
|
+
uriQuery: queryParams
|
|
1418
|
+
};
|
|
1419
|
+
|
|
1420
|
+
try {
|
|
1421
|
+
// Make the call -
|
|
1422
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1423
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'createOnt', reqObj, true, (irReturnData, irReturnError) => {
|
|
1424
|
+
// if we received an error or their is no response on the results
|
|
1425
|
+
// return an error
|
|
1426
|
+
if (irReturnError) {
|
|
1427
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1428
|
+
return callback(null, irReturnError);
|
|
1429
|
+
}
|
|
1430
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1431
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createOnt'], null, null, null);
|
|
1432
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1433
|
+
return callback(null, errorObj);
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1437
|
+
// return the response
|
|
1438
|
+
return callback(irReturnData, null);
|
|
1439
|
+
});
|
|
1440
|
+
} catch (ex) {
|
|
1441
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1442
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1443
|
+
return callback(null, errorObj);
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
/**
|
|
1448
|
+
* @function createOntWithQuery
|
|
1449
|
+
* @pronghornType method
|
|
1450
|
+
* @name createOntWithQuery
|
|
1451
|
+
* @summary Create ont with query params
|
|
1452
|
+
*
|
|
1453
|
+
* @param {object} body - body param
|
|
1454
|
+
* @param {object} query - query param
|
|
1455
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1456
|
+
* @return {object} results - An object containing the response of the action
|
|
1457
|
+
*
|
|
1458
|
+
* @route {POST} /createOntWithQuery
|
|
1459
|
+
* @roles admin
|
|
1460
|
+
* @task true
|
|
1461
|
+
*/
|
|
1462
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1463
|
+
createOntWithQuery(body, query, callback) {
|
|
1464
|
+
const meth = 'adapter-createOntWithQuery';
|
|
1465
|
+
const origin = `${this.id}-${meth}`;
|
|
1466
|
+
log.trace(origin);
|
|
1467
|
+
|
|
1468
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1469
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1470
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1471
|
+
return callback(null, errorObj);
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1475
|
+
if (body === undefined || body === null || body === '') {
|
|
1476
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
1477
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1478
|
+
return callback(null, errorObj);
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1482
|
+
const queryParamsAvailable = query;
|
|
1483
|
+
const queryParams = {};
|
|
1484
|
+
const pathVars = [];
|
|
1485
|
+
const bodyVars = body;
|
|
1486
|
+
|
|
1487
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1488
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1489
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1490
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1491
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1492
|
+
}
|
|
1493
|
+
});
|
|
1494
|
+
|
|
1495
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1496
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1497
|
+
const reqObj = {
|
|
1498
|
+
payload: bodyVars,
|
|
1499
|
+
uriPathVars: pathVars,
|
|
1500
|
+
uriQuery: queryParams
|
|
1501
|
+
};
|
|
1502
|
+
|
|
1503
|
+
try {
|
|
1504
|
+
// Make the call -
|
|
1505
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1506
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'createOnt', reqObj, true, (irReturnData, irReturnError) => {
|
|
1507
|
+
// if we received an error or their is no response on the results
|
|
1508
|
+
// return an error
|
|
1509
|
+
if (irReturnError) {
|
|
1510
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1511
|
+
return callback(null, irReturnError);
|
|
1512
|
+
}
|
|
1513
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1514
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createOntWithQuery'], null, null, null);
|
|
1515
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1516
|
+
return callback(null, errorObj);
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1520
|
+
// return the response
|
|
1521
|
+
return callback(irReturnData, null);
|
|
1522
|
+
});
|
|
1523
|
+
} catch (ex) {
|
|
1524
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1525
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1526
|
+
return callback(null, errorObj);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
/**
|
|
1531
|
+
* @function getOnt
|
|
1532
|
+
* @pronghornType method
|
|
1533
|
+
* @name getOnt
|
|
1534
|
+
* @summary GET ont
|
|
1535
|
+
*
|
|
1536
|
+
* @param {string} intent - the intent
|
|
1537
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1538
|
+
* @return {object} results - An object containing the response of the action
|
|
1539
|
+
*
|
|
1540
|
+
* @route {POST} /getOnt
|
|
1541
|
+
* @roles admin
|
|
1542
|
+
* @task true
|
|
1543
|
+
*/
|
|
1544
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1545
|
+
getOnt(intent, callback) {
|
|
1546
|
+
const meth = 'adapter-getOnt';
|
|
1547
|
+
const origin = `${this.id}-${meth}`;
|
|
1548
|
+
log.trace(origin);
|
|
1549
|
+
|
|
1550
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1551
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1552
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1553
|
+
return callback(null, errorObj);
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1557
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
1558
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
1559
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1560
|
+
return callback(null, errorObj);
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1564
|
+
const queryParamsAvailable = {};
|
|
1565
|
+
const queryParams = {};
|
|
1566
|
+
const pathVars = [intent];
|
|
1567
|
+
const bodyVars = {};
|
|
1568
|
+
|
|
1569
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1570
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1571
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1572
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1573
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1574
|
+
}
|
|
1575
|
+
});
|
|
1576
|
+
|
|
1577
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1578
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1579
|
+
const reqObj = {
|
|
1580
|
+
payload: bodyVars,
|
|
1581
|
+
uriPathVars: pathVars,
|
|
1582
|
+
uriQuery: queryParams
|
|
1583
|
+
};
|
|
1584
|
+
|
|
1585
|
+
try {
|
|
1586
|
+
// Make the call -
|
|
1587
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1588
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'getOnt', reqObj, true, (irReturnData, irReturnError) => {
|
|
1589
|
+
// if we received an error or their is no response on the results
|
|
1590
|
+
// return an error
|
|
1591
|
+
if (irReturnError) {
|
|
1592
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1593
|
+
return callback(null, irReturnError);
|
|
1594
|
+
}
|
|
1595
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1596
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getOnt'], null, null, null);
|
|
1597
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1598
|
+
return callback(null, errorObj);
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1602
|
+
// return the response
|
|
1603
|
+
return callback(irReturnData, null);
|
|
1604
|
+
});
|
|
1605
|
+
} catch (ex) {
|
|
1606
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1607
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1608
|
+
return callback(null, errorObj);
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
/**
|
|
1613
|
+
* @function lockOnt
|
|
1614
|
+
* @pronghornType method
|
|
1615
|
+
* @name lockOnt
|
|
1616
|
+
* @summary Lock ont
|
|
1617
|
+
*
|
|
1618
|
+
* @param {string} intent - the intent
|
|
1619
|
+
* @param {object} body - body param
|
|
1620
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1621
|
+
* @return {object} results - An object containing the response of the action
|
|
1622
|
+
*
|
|
1623
|
+
* @route {POST} /lockOnt
|
|
1624
|
+
* @roles admin
|
|
1625
|
+
* @task true
|
|
1626
|
+
*/
|
|
1627
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1628
|
+
lockOnt(intent, body, callback) {
|
|
1629
|
+
const meth = 'adapter-lockOnt';
|
|
1630
|
+
const origin = `${this.id}-${meth}`;
|
|
1631
|
+
log.trace(origin);
|
|
1632
|
+
|
|
1633
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1634
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1635
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1636
|
+
return callback(null, errorObj);
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1640
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
1641
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
1642
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1643
|
+
return callback(null, errorObj);
|
|
1644
|
+
}
|
|
1645
|
+
if (body === undefined || body === null || body === '') {
|
|
1646
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
1647
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1648
|
+
return callback(null, errorObj);
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1652
|
+
const queryParamsAvailable = {};
|
|
1653
|
+
const queryParams = {};
|
|
1654
|
+
const pathVars = [intent];
|
|
1655
|
+
const bodyVars = body;
|
|
1656
|
+
|
|
1657
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1658
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1659
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1660
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1661
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1662
|
+
}
|
|
1663
|
+
});
|
|
1664
|
+
|
|
1665
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1666
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1667
|
+
const reqObj = {
|
|
1668
|
+
payload: bodyVars,
|
|
1669
|
+
uriPathVars: pathVars,
|
|
1670
|
+
uriQuery: queryParams
|
|
1671
|
+
};
|
|
1672
|
+
|
|
1673
|
+
try {
|
|
1674
|
+
// Make the call -
|
|
1675
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1676
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'lockOnt', reqObj, false, (irReturnData, irReturnError) => {
|
|
1677
|
+
// if we received an error or their is no response on the results
|
|
1678
|
+
// return an error
|
|
1679
|
+
if (irReturnError) {
|
|
1680
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1681
|
+
return callback(null, irReturnError);
|
|
1682
|
+
}
|
|
1683
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1684
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['lockOnt'], null, null, null);
|
|
1685
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1686
|
+
return callback(null, errorObj);
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1690
|
+
// return the response
|
|
1691
|
+
return callback(irReturnData, null);
|
|
1692
|
+
});
|
|
1693
|
+
} catch (ex) {
|
|
1694
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1695
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1696
|
+
return callback(null, errorObj);
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
/**
|
|
1701
|
+
* @function deleteOnt
|
|
1702
|
+
* @pronghornType method
|
|
1703
|
+
* @name deleteOnt
|
|
1704
|
+
* @summary Delete ont
|
|
1705
|
+
*
|
|
1706
|
+
* @param {string} intent - the intent
|
|
1707
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1708
|
+
* @return {object} results - An object containing the response of the action
|
|
1709
|
+
*
|
|
1710
|
+
* @route {POST} /deleteOnt
|
|
1711
|
+
* @roles admin
|
|
1712
|
+
* @task true
|
|
1713
|
+
*/
|
|
1714
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1715
|
+
deleteOnt(intent, callback) {
|
|
1716
|
+
const meth = 'adapter-deleteOnt';
|
|
1717
|
+
const origin = `${this.id}-${meth}`;
|
|
1718
|
+
log.trace(origin);
|
|
1719
|
+
|
|
1720
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1721
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1722
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1723
|
+
return callback(null, errorObj);
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1727
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
1728
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
1729
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1730
|
+
return callback(null, errorObj);
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1734
|
+
const queryParamsAvailable = {};
|
|
1735
|
+
const queryParams = {};
|
|
1736
|
+
const pathVars = [intent];
|
|
1737
|
+
const bodyVars = {};
|
|
1738
|
+
|
|
1739
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1740
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1741
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1742
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1743
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1744
|
+
}
|
|
1745
|
+
});
|
|
1746
|
+
|
|
1747
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1748
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1749
|
+
const reqObj = {
|
|
1750
|
+
payload: bodyVars,
|
|
1751
|
+
uriPathVars: pathVars,
|
|
1752
|
+
uriQuery: queryParams
|
|
1753
|
+
};
|
|
1754
|
+
|
|
1755
|
+
try {
|
|
1756
|
+
// Make the call -
|
|
1757
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1758
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'deleteOnt', reqObj, false, (irReturnData, irReturnError) => {
|
|
1759
|
+
// if we received an error or their is no response on the results
|
|
1760
|
+
// return an error
|
|
1761
|
+
if (irReturnError) {
|
|
1762
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1763
|
+
return callback(null, irReturnError);
|
|
1764
|
+
}
|
|
1765
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1766
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteOnt'], null, null, null);
|
|
1767
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1768
|
+
return callback(null, errorObj);
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1772
|
+
// return the response
|
|
1773
|
+
return callback(irReturnData, null);
|
|
1774
|
+
});
|
|
1775
|
+
} catch (ex) {
|
|
1776
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1777
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1778
|
+
return callback(null, errorObj);
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* @function synchronizeOnt
|
|
1784
|
+
* @pronghornType method
|
|
1785
|
+
* @name synchronizeOnt
|
|
1786
|
+
* @summary Synchronize ont
|
|
1787
|
+
*
|
|
1788
|
+
* @param {string} intent - the intent
|
|
1789
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1790
|
+
* @return {object} results - An object containing the response of the action
|
|
1791
|
+
*
|
|
1792
|
+
* @route {POST} /synchronizeOnt
|
|
1793
|
+
* @roles admin
|
|
1794
|
+
* @task true
|
|
1795
|
+
*/
|
|
1796
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1797
|
+
synchronizeOnt(intent, callback) {
|
|
1798
|
+
const meth = 'adapter-synchronizeOnt';
|
|
1799
|
+
const origin = `${this.id}-${meth}`;
|
|
1800
|
+
log.trace(origin);
|
|
1801
|
+
|
|
1802
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1803
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1804
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1805
|
+
return callback(null, errorObj);
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1809
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
1810
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
1811
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1812
|
+
return callback(null, errorObj);
|
|
1813
|
+
}
|
|
1048
1814
|
|
|
1049
1815
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1050
1816
|
const queryParamsAvailable = {};
|
|
1051
1817
|
const queryParams = {};
|
|
1052
|
-
const pathVars = [];
|
|
1818
|
+
const pathVars = [intent];
|
|
1053
1819
|
const bodyVars = {};
|
|
1054
1820
|
|
|
1055
1821
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
@@ -1071,7 +1837,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1071
1837
|
try {
|
|
1072
1838
|
// Make the call -
|
|
1073
1839
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1074
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
1840
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'synchronizeOnt', reqObj, true, (irReturnData, irReturnError) => {
|
|
1075
1841
|
// if we received an error or their is no response on the results
|
|
1076
1842
|
// return an error
|
|
1077
1843
|
if (irReturnError) {
|
|
@@ -1079,7 +1845,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1079
1845
|
return callback(null, irReturnError);
|
|
1080
1846
|
}
|
|
1081
1847
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1082
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
1848
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['synchronizeOnt'], null, null, null);
|
|
1083
1849
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1084
1850
|
return callback(null, errorObj);
|
|
1085
1851
|
}
|
|
@@ -1096,22 +1862,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1096
1862
|
}
|
|
1097
1863
|
|
|
1098
1864
|
/**
|
|
1099
|
-
* @function
|
|
1865
|
+
* @function auditOnt
|
|
1100
1866
|
* @pronghornType method
|
|
1101
|
-
* @name
|
|
1102
|
-
* @summary
|
|
1867
|
+
* @name auditOnt
|
|
1868
|
+
* @summary Audit ont
|
|
1103
1869
|
*
|
|
1104
1870
|
* @param {string} intent - the intent
|
|
1105
1871
|
* @param {getCallback} callback - a callback function to return the result
|
|
1106
1872
|
* @return {object} results - An object containing the response of the action
|
|
1107
1873
|
*
|
|
1108
|
-
* @route {POST} /
|
|
1874
|
+
* @route {POST} /auditOnt
|
|
1109
1875
|
* @roles admin
|
|
1110
1876
|
* @task true
|
|
1111
1877
|
*/
|
|
1112
1878
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1113
|
-
|
|
1114
|
-
const meth = 'adapter-
|
|
1879
|
+
auditOnt(intent, callback) {
|
|
1880
|
+
const meth = 'adapter-auditOnt';
|
|
1115
1881
|
const origin = `${this.id}-${meth}`;
|
|
1116
1882
|
log.trace(origin);
|
|
1117
1883
|
|
|
@@ -1153,7 +1919,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1153
1919
|
try {
|
|
1154
1920
|
// Make the call -
|
|
1155
1921
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1156
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
1922
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'auditOnt', reqObj, true, (irReturnData, irReturnError) => {
|
|
1157
1923
|
// if we received an error or their is no response on the results
|
|
1158
1924
|
// return an error
|
|
1159
1925
|
if (irReturnError) {
|
|
@@ -1161,7 +1927,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1161
1927
|
return callback(null, irReturnError);
|
|
1162
1928
|
}
|
|
1163
1929
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1164
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
1930
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['auditOnt'], null, null, null);
|
|
1165
1931
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1166
1932
|
return callback(null, errorObj);
|
|
1167
1933
|
}
|
|
@@ -1178,22 +1944,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1178
1944
|
}
|
|
1179
1945
|
|
|
1180
1946
|
/**
|
|
1181
|
-
* @function
|
|
1947
|
+
* @function synchronizel2User
|
|
1182
1948
|
* @pronghornType method
|
|
1183
|
-
* @name
|
|
1184
|
-
* @summary
|
|
1949
|
+
* @name synchronizel2User
|
|
1950
|
+
* @summary Synchronize l2-user
|
|
1185
1951
|
*
|
|
1186
|
-
* @param {
|
|
1952
|
+
* @param {string} intent - the intent
|
|
1187
1953
|
* @param {getCallback} callback - a callback function to return the result
|
|
1188
1954
|
* @return {object} results - An object containing the response of the action
|
|
1189
1955
|
*
|
|
1190
|
-
* @route {POST} /
|
|
1956
|
+
* @route {POST} /synchronizel2User
|
|
1191
1957
|
* @roles admin
|
|
1192
1958
|
* @task true
|
|
1193
1959
|
*/
|
|
1194
1960
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1195
|
-
|
|
1196
|
-
const meth = 'adapter-
|
|
1961
|
+
synchronizel2User(intent, callback) {
|
|
1962
|
+
const meth = 'adapter-synchronizel2User';
|
|
1197
1963
|
const origin = `${this.id}-${meth}`;
|
|
1198
1964
|
log.trace(origin);
|
|
1199
1965
|
|
|
@@ -1204,8 +1970,8 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1204
1970
|
}
|
|
1205
1971
|
|
|
1206
1972
|
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1207
|
-
if (
|
|
1208
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['
|
|
1973
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
1974
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
1209
1975
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1210
1976
|
return callback(null, errorObj);
|
|
1211
1977
|
}
|
|
@@ -1213,8 +1979,8 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1213
1979
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1214
1980
|
const queryParamsAvailable = {};
|
|
1215
1981
|
const queryParams = {};
|
|
1216
|
-
const pathVars = [];
|
|
1217
|
-
const bodyVars =
|
|
1982
|
+
const pathVars = [intent];
|
|
1983
|
+
const bodyVars = {};
|
|
1218
1984
|
|
|
1219
1985
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1220
1986
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
@@ -1235,7 +2001,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1235
2001
|
try {
|
|
1236
2002
|
// Make the call -
|
|
1237
2003
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1238
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2004
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'synchronizel2User', reqObj, true, (irReturnData, irReturnError) => {
|
|
1239
2005
|
// if we received an error or their is no response on the results
|
|
1240
2006
|
// return an error
|
|
1241
2007
|
if (irReturnError) {
|
|
@@ -1243,7 +2009,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1243
2009
|
return callback(null, irReturnError);
|
|
1244
2010
|
}
|
|
1245
2011
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1246
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2012
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['synchronizel2User'], null, null, null);
|
|
1247
2013
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1248
2014
|
return callback(null, errorObj);
|
|
1249
2015
|
}
|
|
@@ -1260,22 +2026,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1260
2026
|
}
|
|
1261
2027
|
|
|
1262
2028
|
/**
|
|
1263
|
-
* @function
|
|
2029
|
+
* @function getl2User
|
|
1264
2030
|
* @pronghornType method
|
|
1265
|
-
* @name
|
|
1266
|
-
* @summary
|
|
2031
|
+
* @name getl2User
|
|
2032
|
+
* @summary GET l2-user
|
|
1267
2033
|
*
|
|
1268
2034
|
* @param {string} intent - the intent
|
|
1269
2035
|
* @param {getCallback} callback - a callback function to return the result
|
|
1270
2036
|
* @return {object} results - An object containing the response of the action
|
|
1271
2037
|
*
|
|
1272
|
-
* @route {POST} /
|
|
2038
|
+
* @route {POST} /getl2User
|
|
1273
2039
|
* @roles admin
|
|
1274
2040
|
* @task true
|
|
1275
2041
|
*/
|
|
1276
2042
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1277
|
-
|
|
1278
|
-
const meth = 'adapter-
|
|
2043
|
+
getl2User(intent, callback) {
|
|
2044
|
+
const meth = 'adapter-getl2User';
|
|
1279
2045
|
const origin = `${this.id}-${meth}`;
|
|
1280
2046
|
log.trace(origin);
|
|
1281
2047
|
|
|
@@ -1317,7 +2083,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1317
2083
|
try {
|
|
1318
2084
|
// Make the call -
|
|
1319
2085
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1320
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2086
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'getl2User', reqObj, true, (irReturnData, irReturnError) => {
|
|
1321
2087
|
// if we received an error or their is no response on the results
|
|
1322
2088
|
// return an error
|
|
1323
2089
|
if (irReturnError) {
|
|
@@ -1325,7 +2091,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1325
2091
|
return callback(null, irReturnError);
|
|
1326
2092
|
}
|
|
1327
2093
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1328
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2094
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getl2User'], null, null, null);
|
|
1329
2095
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1330
2096
|
return callback(null, errorObj);
|
|
1331
2097
|
}
|
|
@@ -1342,22 +2108,23 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1342
2108
|
}
|
|
1343
2109
|
|
|
1344
2110
|
/**
|
|
1345
|
-
* @function
|
|
2111
|
+
* @function modifyl2User
|
|
1346
2112
|
* @pronghornType method
|
|
1347
|
-
* @name
|
|
1348
|
-
* @summary
|
|
2113
|
+
* @name modifyl2User
|
|
2114
|
+
* @summary Modify l2-user
|
|
1349
2115
|
*
|
|
2116
|
+
* @param {string} intent - the intent
|
|
1350
2117
|
* @param {object} body - body param
|
|
1351
2118
|
* @param {getCallback} callback - a callback function to return the result
|
|
1352
2119
|
* @return {object} results - An object containing the response of the action
|
|
1353
2120
|
*
|
|
1354
|
-
* @route {POST} /
|
|
2121
|
+
* @route {POST} /modifyl2User
|
|
1355
2122
|
* @roles admin
|
|
1356
2123
|
* @task true
|
|
1357
2124
|
*/
|
|
1358
2125
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1359
|
-
|
|
1360
|
-
const meth = 'adapter-
|
|
2126
|
+
modifyl2User(intent, body, callback) {
|
|
2127
|
+
const meth = 'adapter-modifyl2User';
|
|
1361
2128
|
const origin = `${this.id}-${meth}`;
|
|
1362
2129
|
log.trace(origin);
|
|
1363
2130
|
|
|
@@ -1368,6 +2135,11 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1368
2135
|
}
|
|
1369
2136
|
|
|
1370
2137
|
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2138
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
2139
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
2140
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2141
|
+
return callback(null, errorObj);
|
|
2142
|
+
}
|
|
1371
2143
|
if (body === undefined || body === null || body === '') {
|
|
1372
2144
|
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
1373
2145
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
@@ -1377,7 +2149,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1377
2149
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1378
2150
|
const queryParamsAvailable = {};
|
|
1379
2151
|
const queryParams = {};
|
|
1380
|
-
const pathVars = [];
|
|
2152
|
+
const pathVars = [intent];
|
|
1381
2153
|
const bodyVars = body;
|
|
1382
2154
|
|
|
1383
2155
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
@@ -1399,7 +2171,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1399
2171
|
try {
|
|
1400
2172
|
// Make the call -
|
|
1401
2173
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1402
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2174
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'modifyl2User', reqObj, false, (irReturnData, irReturnError) => {
|
|
1403
2175
|
// if we received an error or their is no response on the results
|
|
1404
2176
|
// return an error
|
|
1405
2177
|
if (irReturnError) {
|
|
@@ -1407,7 +2179,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1407
2179
|
return callback(null, irReturnError);
|
|
1408
2180
|
}
|
|
1409
2181
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1410
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2182
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['modifyl2User'], null, null, null);
|
|
1411
2183
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1412
2184
|
return callback(null, errorObj);
|
|
1413
2185
|
}
|
|
@@ -1424,22 +2196,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1424
2196
|
}
|
|
1425
2197
|
|
|
1426
2198
|
/**
|
|
1427
|
-
* @function
|
|
2199
|
+
* @function deletel2User
|
|
1428
2200
|
* @pronghornType method
|
|
1429
|
-
* @name
|
|
1430
|
-
* @summary
|
|
2201
|
+
* @name deletel2User
|
|
2202
|
+
* @summary Delete l2-user
|
|
1431
2203
|
*
|
|
1432
2204
|
* @param {string} intent - the intent
|
|
1433
2205
|
* @param {getCallback} callback - a callback function to return the result
|
|
1434
2206
|
* @return {object} results - An object containing the response of the action
|
|
1435
2207
|
*
|
|
1436
|
-
* @route {POST} /
|
|
2208
|
+
* @route {POST} /deletel2User
|
|
1437
2209
|
* @roles admin
|
|
1438
2210
|
* @task true
|
|
1439
2211
|
*/
|
|
1440
2212
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1441
|
-
|
|
1442
|
-
const meth = 'adapter-
|
|
2213
|
+
deletel2User(intent, callback) {
|
|
2214
|
+
const meth = 'adapter-deletel2User';
|
|
1443
2215
|
const origin = `${this.id}-${meth}`;
|
|
1444
2216
|
log.trace(origin);
|
|
1445
2217
|
|
|
@@ -1481,7 +2253,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1481
2253
|
try {
|
|
1482
2254
|
// Make the call -
|
|
1483
2255
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1484
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2256
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'deletel2User', reqObj, false, (irReturnData, irReturnError) => {
|
|
1485
2257
|
// if we received an error or their is no response on the results
|
|
1486
2258
|
// return an error
|
|
1487
2259
|
if (irReturnError) {
|
|
@@ -1489,7 +2261,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1489
2261
|
return callback(null, irReturnError);
|
|
1490
2262
|
}
|
|
1491
2263
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1492
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2264
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deletel2User'], null, null, null);
|
|
1493
2265
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1494
2266
|
return callback(null, errorObj);
|
|
1495
2267
|
}
|
|
@@ -1506,23 +2278,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1506
2278
|
}
|
|
1507
2279
|
|
|
1508
2280
|
/**
|
|
1509
|
-
* @function
|
|
2281
|
+
* @function auditl2User
|
|
1510
2282
|
* @pronghornType method
|
|
1511
|
-
* @name
|
|
1512
|
-
* @summary
|
|
2283
|
+
* @name auditl2User
|
|
2284
|
+
* @summary Audit l2-user
|
|
1513
2285
|
*
|
|
1514
2286
|
* @param {string} intent - the intent
|
|
1515
|
-
* @param {object} body - body param
|
|
1516
2287
|
* @param {getCallback} callback - a callback function to return the result
|
|
1517
2288
|
* @return {object} results - An object containing the response of the action
|
|
1518
2289
|
*
|
|
1519
|
-
* @route {POST} /
|
|
2290
|
+
* @route {POST} /auditl2User
|
|
1520
2291
|
* @roles admin
|
|
1521
2292
|
* @task true
|
|
1522
2293
|
*/
|
|
1523
2294
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1524
|
-
|
|
1525
|
-
const meth = 'adapter-
|
|
2295
|
+
auditl2User(intent, callback) {
|
|
2296
|
+
const meth = 'adapter-auditl2User';
|
|
1526
2297
|
const origin = `${this.id}-${meth}`;
|
|
1527
2298
|
log.trace(origin);
|
|
1528
2299
|
|
|
@@ -1538,17 +2309,12 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1538
2309
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1539
2310
|
return callback(null, errorObj);
|
|
1540
2311
|
}
|
|
1541
|
-
if (body === undefined || body === null || body === '') {
|
|
1542
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
1543
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1544
|
-
return callback(null, errorObj);
|
|
1545
|
-
}
|
|
1546
2312
|
|
|
1547
2313
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1548
2314
|
const queryParamsAvailable = {};
|
|
1549
2315
|
const queryParams = {};
|
|
1550
2316
|
const pathVars = [intent];
|
|
1551
|
-
const bodyVars =
|
|
2317
|
+
const bodyVars = {};
|
|
1552
2318
|
|
|
1553
2319
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1554
2320
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
@@ -1569,7 +2335,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1569
2335
|
try {
|
|
1570
2336
|
// Make the call -
|
|
1571
2337
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1572
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2338
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'auditl2User', reqObj, true, (irReturnData, irReturnError) => {
|
|
1573
2339
|
// if we received an error or their is no response on the results
|
|
1574
2340
|
// return an error
|
|
1575
2341
|
if (irReturnError) {
|
|
@@ -1577,7 +2343,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1577
2343
|
return callback(null, irReturnError);
|
|
1578
2344
|
}
|
|
1579
2345
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1580
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2346
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['auditl2User'], null, null, null);
|
|
1581
2347
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1582
2348
|
return callback(null, errorObj);
|
|
1583
2349
|
}
|
|
@@ -1594,22 +2360,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1594
2360
|
}
|
|
1595
2361
|
|
|
1596
2362
|
/**
|
|
1597
|
-
* @function
|
|
2363
|
+
* @function getIbnIntent
|
|
1598
2364
|
* @pronghornType method
|
|
1599
|
-
* @name
|
|
1600
|
-
* @summary
|
|
2365
|
+
* @name getIbnIntent
|
|
2366
|
+
* @summary GET ibn intent
|
|
1601
2367
|
*
|
|
1602
|
-
* @param {string} intent - the intent
|
|
2368
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
1603
2369
|
* @param {getCallback} callback - a callback function to return the result
|
|
1604
2370
|
* @return {object} results - An object containing the response of the action
|
|
1605
2371
|
*
|
|
1606
|
-
* @route {POST} /
|
|
2372
|
+
* @route {POST} /getIbnIntent
|
|
1607
2373
|
* @roles admin
|
|
1608
2374
|
* @task true
|
|
1609
2375
|
*/
|
|
1610
2376
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1611
|
-
|
|
1612
|
-
const meth = 'adapter-
|
|
2377
|
+
getIbnIntent(intent, callback) {
|
|
2378
|
+
const meth = 'adapter-getIbnIntent';
|
|
1613
2379
|
const origin = `${this.id}-${meth}`;
|
|
1614
2380
|
log.trace(origin);
|
|
1615
2381
|
|
|
@@ -1625,11 +2391,15 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1625
2391
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1626
2392
|
return callback(null, errorObj);
|
|
1627
2393
|
}
|
|
2394
|
+
let newIntent = intent;
|
|
2395
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2396
|
+
newIntent = `intent=${intent}`;
|
|
2397
|
+
}
|
|
1628
2398
|
|
|
1629
2399
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1630
2400
|
const queryParamsAvailable = {};
|
|
1631
2401
|
const queryParams = {};
|
|
1632
|
-
const pathVars = [
|
|
2402
|
+
const pathVars = [newIntent];
|
|
1633
2403
|
const bodyVars = {};
|
|
1634
2404
|
|
|
1635
2405
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
@@ -1651,7 +2421,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1651
2421
|
try {
|
|
1652
2422
|
// Make the call -
|
|
1653
2423
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1654
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2424
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'getIbnIntent', reqObj, true, (irReturnData, irReturnError) => {
|
|
1655
2425
|
// if we received an error or their is no response on the results
|
|
1656
2426
|
// return an error
|
|
1657
2427
|
if (irReturnError) {
|
|
@@ -1659,7 +2429,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1659
2429
|
return callback(null, irReturnError);
|
|
1660
2430
|
}
|
|
1661
2431
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1662
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2432
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getIbnIntent'], null, null, null);
|
|
1663
2433
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1664
2434
|
return callback(null, errorObj);
|
|
1665
2435
|
}
|
|
@@ -1676,22 +2446,23 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1676
2446
|
}
|
|
1677
2447
|
|
|
1678
2448
|
/**
|
|
1679
|
-
* @function
|
|
2449
|
+
* @function modifyIbnIntent
|
|
1680
2450
|
* @pronghornType method
|
|
1681
|
-
* @name
|
|
1682
|
-
* @summary
|
|
2451
|
+
* @name modifyIbnIntent
|
|
2452
|
+
* @summary Modify ibn intent
|
|
1683
2453
|
*
|
|
1684
|
-
* @param {string} intent - the intent
|
|
2454
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
2455
|
+
* @param {object} body - body param
|
|
1685
2456
|
* @param {getCallback} callback - a callback function to return the result
|
|
1686
2457
|
* @return {object} results - An object containing the response of the action
|
|
1687
2458
|
*
|
|
1688
|
-
* @route {POST} /
|
|
2459
|
+
* @route {POST} /modifyIbnIntent
|
|
1689
2460
|
* @roles admin
|
|
1690
2461
|
* @task true
|
|
1691
2462
|
*/
|
|
1692
2463
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1693
|
-
|
|
1694
|
-
const meth = 'adapter-
|
|
2464
|
+
modifyIbnIntent(intent, body, callback) {
|
|
2465
|
+
const meth = 'adapter-modifyIbnIntent';
|
|
1695
2466
|
const origin = `${this.id}-${meth}`;
|
|
1696
2467
|
log.trace(origin);
|
|
1697
2468
|
|
|
@@ -1707,12 +2478,21 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1707
2478
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1708
2479
|
return callback(null, errorObj);
|
|
1709
2480
|
}
|
|
2481
|
+
if (body === undefined || body === null || body === '') {
|
|
2482
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
2483
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2484
|
+
return callback(null, errorObj);
|
|
2485
|
+
}
|
|
2486
|
+
let newIntent = intent;
|
|
2487
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2488
|
+
newIntent = `intent=${intent}`;
|
|
2489
|
+
}
|
|
1710
2490
|
|
|
1711
2491
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1712
2492
|
const queryParamsAvailable = {};
|
|
1713
2493
|
const queryParams = {};
|
|
1714
|
-
const pathVars = [
|
|
1715
|
-
const bodyVars =
|
|
2494
|
+
const pathVars = [newIntent];
|
|
2495
|
+
const bodyVars = body;
|
|
1716
2496
|
|
|
1717
2497
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1718
2498
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
@@ -1733,7 +2513,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1733
2513
|
try {
|
|
1734
2514
|
// Make the call -
|
|
1735
2515
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1736
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2516
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'modifyIbnIntent', reqObj, false, (irReturnData, irReturnError) => {
|
|
1737
2517
|
// if we received an error or their is no response on the results
|
|
1738
2518
|
// return an error
|
|
1739
2519
|
if (irReturnError) {
|
|
@@ -1741,7 +2521,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1741
2521
|
return callback(null, irReturnError);
|
|
1742
2522
|
}
|
|
1743
2523
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1744
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2524
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['modifyIbnIntent'], null, null, null);
|
|
1745
2525
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1746
2526
|
return callback(null, errorObj);
|
|
1747
2527
|
}
|
|
@@ -1758,22 +2538,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1758
2538
|
}
|
|
1759
2539
|
|
|
1760
2540
|
/**
|
|
1761
|
-
* @function
|
|
2541
|
+
* @function deleteIbnIntent
|
|
1762
2542
|
* @pronghornType method
|
|
1763
|
-
* @name
|
|
1764
|
-
* @summary
|
|
2543
|
+
* @name deleteIbnIntent
|
|
2544
|
+
* @summary Delete ibn intent
|
|
1765
2545
|
*
|
|
1766
|
-
* @param {string} intent - the intent
|
|
2546
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
1767
2547
|
* @param {getCallback} callback - a callback function to return the result
|
|
1768
2548
|
* @return {object} results - An object containing the response of the action
|
|
1769
2549
|
*
|
|
1770
|
-
* @route {POST} /
|
|
2550
|
+
* @route {POST} /deleteIbnIntent
|
|
1771
2551
|
* @roles admin
|
|
1772
2552
|
* @task true
|
|
1773
2553
|
*/
|
|
1774
2554
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1775
|
-
|
|
1776
|
-
const meth = 'adapter-
|
|
2555
|
+
deleteIbnIntent(intent, callback) {
|
|
2556
|
+
const meth = 'adapter-deleteIbnIntent';
|
|
1777
2557
|
const origin = `${this.id}-${meth}`;
|
|
1778
2558
|
log.trace(origin);
|
|
1779
2559
|
|
|
@@ -1789,11 +2569,15 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1789
2569
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1790
2570
|
return callback(null, errorObj);
|
|
1791
2571
|
}
|
|
2572
|
+
let newIntent = intent;
|
|
2573
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2574
|
+
newIntent = `intent=${intent}`;
|
|
2575
|
+
}
|
|
1792
2576
|
|
|
1793
2577
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1794
2578
|
const queryParamsAvailable = {};
|
|
1795
2579
|
const queryParams = {};
|
|
1796
|
-
const pathVars = [
|
|
2580
|
+
const pathVars = [newIntent];
|
|
1797
2581
|
const bodyVars = {};
|
|
1798
2582
|
|
|
1799
2583
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
@@ -1815,7 +2599,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1815
2599
|
try {
|
|
1816
2600
|
// Make the call -
|
|
1817
2601
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1818
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2602
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'deleteIbnIntent', reqObj, false, (irReturnData, irReturnError) => {
|
|
1819
2603
|
// if we received an error or their is no response on the results
|
|
1820
2604
|
// return an error
|
|
1821
2605
|
if (irReturnError) {
|
|
@@ -1823,7 +2607,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1823
2607
|
return callback(null, irReturnError);
|
|
1824
2608
|
}
|
|
1825
2609
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1826
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2610
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteIbnIntent'], null, null, null);
|
|
1827
2611
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1828
2612
|
return callback(null, errorObj);
|
|
1829
2613
|
}
|
|
@@ -1840,22 +2624,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1840
2624
|
}
|
|
1841
2625
|
|
|
1842
2626
|
/**
|
|
1843
|
-
* @function
|
|
2627
|
+
* @function synchronizeIbnIntent
|
|
1844
2628
|
* @pronghornType method
|
|
1845
|
-
* @name
|
|
1846
|
-
* @summary Synchronize
|
|
2629
|
+
* @name synchronizeIbnIntent
|
|
2630
|
+
* @summary Synchronize ibn intent
|
|
1847
2631
|
*
|
|
1848
|
-
* @param {string} intent - the intent
|
|
2632
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
1849
2633
|
* @param {getCallback} callback - a callback function to return the result
|
|
1850
2634
|
* @return {object} results - An object containing the response of the action
|
|
1851
2635
|
*
|
|
1852
|
-
* @route {POST} /
|
|
2636
|
+
* @route {POST} /synchronizeIbnIntent
|
|
1853
2637
|
* @roles admin
|
|
1854
2638
|
* @task true
|
|
1855
2639
|
*/
|
|
1856
2640
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1857
|
-
|
|
1858
|
-
const meth = 'adapter-
|
|
2641
|
+
synchronizeIbnIntent(intent, callback) {
|
|
2642
|
+
const meth = 'adapter-synchronizeIbnIntent';
|
|
1859
2643
|
const origin = `${this.id}-${meth}`;
|
|
1860
2644
|
log.trace(origin);
|
|
1861
2645
|
|
|
@@ -1871,11 +2655,15 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1871
2655
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1872
2656
|
return callback(null, errorObj);
|
|
1873
2657
|
}
|
|
2658
|
+
let newIntent = intent;
|
|
2659
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2660
|
+
newIntent = `intent=${intent}`;
|
|
2661
|
+
}
|
|
1874
2662
|
|
|
1875
2663
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1876
2664
|
const queryParamsAvailable = {};
|
|
1877
2665
|
const queryParams = {};
|
|
1878
|
-
const pathVars = [
|
|
2666
|
+
const pathVars = [newIntent];
|
|
1879
2667
|
const bodyVars = {};
|
|
1880
2668
|
|
|
1881
2669
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
@@ -1897,7 +2685,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1897
2685
|
try {
|
|
1898
2686
|
// Make the call -
|
|
1899
2687
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1900
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2688
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'synchronizeIbnIntent', reqObj, true, (irReturnData, irReturnError) => {
|
|
1901
2689
|
// if we received an error or their is no response on the results
|
|
1902
2690
|
// return an error
|
|
1903
2691
|
if (irReturnError) {
|
|
@@ -1905,7 +2693,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1905
2693
|
return callback(null, irReturnError);
|
|
1906
2694
|
}
|
|
1907
2695
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1908
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2696
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['synchronizeIbnIntent'], null, null, null);
|
|
1909
2697
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1910
2698
|
return callback(null, errorObj);
|
|
1911
2699
|
}
|
|
@@ -1922,22 +2710,22 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1922
2710
|
}
|
|
1923
2711
|
|
|
1924
2712
|
/**
|
|
1925
|
-
* @function
|
|
2713
|
+
* @function auditIbnIntent
|
|
1926
2714
|
* @pronghornType method
|
|
1927
|
-
* @name
|
|
1928
|
-
* @summary
|
|
2715
|
+
* @name auditIbnIntent
|
|
2716
|
+
* @summary Audit ibn intent
|
|
1929
2717
|
*
|
|
1930
|
-
* @param {string} intent - the intent
|
|
2718
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
1931
2719
|
* @param {getCallback} callback - a callback function to return the result
|
|
1932
2720
|
* @return {object} results - An object containing the response of the action
|
|
1933
2721
|
*
|
|
1934
|
-
* @route {POST} /
|
|
2722
|
+
* @route {POST} /auditIbnIntent
|
|
1935
2723
|
* @roles admin
|
|
1936
2724
|
* @task true
|
|
1937
2725
|
*/
|
|
1938
2726
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1939
|
-
|
|
1940
|
-
const meth = 'adapter-
|
|
2727
|
+
auditIbnIntent(intent, callback) {
|
|
2728
|
+
const meth = 'adapter-auditIbnIntent';
|
|
1941
2729
|
const origin = `${this.id}-${meth}`;
|
|
1942
2730
|
log.trace(origin);
|
|
1943
2731
|
|
|
@@ -1953,11 +2741,15 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1953
2741
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1954
2742
|
return callback(null, errorObj);
|
|
1955
2743
|
}
|
|
2744
|
+
let newIntent = intent;
|
|
2745
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2746
|
+
newIntent = `intent=${intent}`;
|
|
2747
|
+
}
|
|
1956
2748
|
|
|
1957
2749
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1958
2750
|
const queryParamsAvailable = {};
|
|
1959
2751
|
const queryParams = {};
|
|
1960
|
-
const pathVars = [
|
|
2752
|
+
const pathVars = [newIntent];
|
|
1961
2753
|
const bodyVars = {};
|
|
1962
2754
|
|
|
1963
2755
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
@@ -1979,7 +2771,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1979
2771
|
try {
|
|
1980
2772
|
// Make the call -
|
|
1981
2773
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1982
|
-
return this.requestHandlerInst.identifyRequest('Intent', '
|
|
2774
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'auditIbnIntent', reqObj, true, (irReturnData, irReturnError) => {
|
|
1983
2775
|
// if we received an error or their is no response on the results
|
|
1984
2776
|
// return an error
|
|
1985
2777
|
if (irReturnError) {
|
|
@@ -1987,7 +2779,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
1987
2779
|
return callback(null, irReturnError);
|
|
1988
2780
|
}
|
|
1989
2781
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1990
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2782
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['auditIbnIntent'], null, null, null);
|
|
1991
2783
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1992
2784
|
return callback(null, errorObj);
|
|
1993
2785
|
}
|
|
@@ -2004,23 +2796,26 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
2004
2796
|
}
|
|
2005
2797
|
|
|
2006
2798
|
/**
|
|
2007
|
-
* @function
|
|
2799
|
+
* @function getEntityOntView
|
|
2008
2800
|
* @pronghornType method
|
|
2009
|
-
* @name
|
|
2010
|
-
* @summary
|
|
2801
|
+
* @name getEntityOntView
|
|
2802
|
+
* @summary Get ONT Network View
|
|
2011
2803
|
*
|
|
2012
|
-
* @param {string}
|
|
2013
|
-
* @param {
|
|
2804
|
+
* @param {string} isamVer - the ISAM Version
|
|
2805
|
+
* @param {string} shelfName - the Shelf Name
|
|
2806
|
+
* @param {string} demark - the Demark
|
|
2807
|
+
* @param {boolean} child - is this a child (default false)
|
|
2808
|
+
* @param {boolean} one - should there be only one (default true)
|
|
2014
2809
|
* @param {getCallback} callback - a callback function to return the result
|
|
2015
2810
|
* @return {object} results - An object containing the response of the action
|
|
2016
2811
|
*
|
|
2017
|
-
* @route {POST} /
|
|
2812
|
+
* @route {POST} /getEntityOntView
|
|
2018
2813
|
* @roles admin
|
|
2019
2814
|
* @task true
|
|
2020
2815
|
*/
|
|
2021
2816
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2022
|
-
|
|
2023
|
-
const meth = 'adapter-
|
|
2817
|
+
getEntityOntView(isamVer, shelfName, demark, child, one, callback) {
|
|
2818
|
+
const meth = 'adapter-getEntityOntView';
|
|
2024
2819
|
const origin = `${this.id}-${meth}`;
|
|
2025
2820
|
log.trace(origin);
|
|
2026
2821
|
|
|
@@ -2031,22 +2826,35 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
2031
2826
|
}
|
|
2032
2827
|
|
|
2033
2828
|
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2034
|
-
if (
|
|
2035
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['
|
|
2829
|
+
if (isamVer === undefined || isamVer === null || isamVer === '') {
|
|
2830
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['isamVer'], null, null, null);
|
|
2036
2831
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2037
2832
|
return callback(null, errorObj);
|
|
2038
2833
|
}
|
|
2039
|
-
if (
|
|
2040
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['
|
|
2834
|
+
if (shelfName === undefined || shelfName === null || shelfName === '') {
|
|
2835
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['shelfName'], null, null, null);
|
|
2836
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2837
|
+
return callback(null, errorObj);
|
|
2838
|
+
}
|
|
2839
|
+
if (demark === undefined || demark === null || demark === '') {
|
|
2840
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['demark'], null, null, null);
|
|
2041
2841
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2042
2842
|
return callback(null, errorObj);
|
|
2043
2843
|
}
|
|
2844
|
+
let isChild = false;
|
|
2845
|
+
if (child !== null && child !== undefined && child === true) {
|
|
2846
|
+
isChild = true;
|
|
2847
|
+
}
|
|
2848
|
+
let isOne = true;
|
|
2849
|
+
if (one !== null && one !== undefined && one === false) {
|
|
2850
|
+
isOne = false;
|
|
2851
|
+
}
|
|
2044
2852
|
|
|
2045
2853
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2046
|
-
const queryParamsAvailable = {};
|
|
2854
|
+
const queryParamsAvailable = { isChild, isOne };
|
|
2047
2855
|
const queryParams = {};
|
|
2048
|
-
const pathVars = [
|
|
2049
|
-
const bodyVars =
|
|
2856
|
+
const pathVars = [isamVer, shelfName, demark];
|
|
2857
|
+
const bodyVars = {};
|
|
2050
2858
|
|
|
2051
2859
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2052
2860
|
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
@@ -2067,7 +2875,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
2067
2875
|
try {
|
|
2068
2876
|
// Make the call -
|
|
2069
2877
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2070
|
-
return this.requestHandlerInst.identifyRequest('
|
|
2878
|
+
return this.requestHandlerInst.identifyRequest('Entity', 'getEntityOntView', reqObj, true, (irReturnData, irReturnError) => {
|
|
2071
2879
|
// if we received an error or their is no response on the results
|
|
2072
2880
|
// return an error
|
|
2073
2881
|
if (irReturnError) {
|
|
@@ -2075,7 +2883,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
2075
2883
|
return callback(null, irReturnError);
|
|
2076
2884
|
}
|
|
2077
2885
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2078
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2886
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getEntityOntView'], null, null, null);
|
|
2079
2887
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2080
2888
|
return callback(null, errorObj);
|
|
2081
2889
|
}
|
|
@@ -2092,22 +2900,26 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
2092
2900
|
}
|
|
2093
2901
|
|
|
2094
2902
|
/**
|
|
2095
|
-
* @function
|
|
2903
|
+
* @function getEntityOntPort
|
|
2096
2904
|
* @pronghornType method
|
|
2097
|
-
* @name
|
|
2098
|
-
* @summary
|
|
2905
|
+
* @name getEntityOntPort
|
|
2906
|
+
* @summary Get ONT Port
|
|
2099
2907
|
*
|
|
2100
|
-
* @param {string}
|
|
2908
|
+
* @param {string} isamVer - the ISAM Version
|
|
2909
|
+
* @param {string} shelfName - the Shelf Name
|
|
2910
|
+
* @param {string} demark - the Demark
|
|
2911
|
+
* @param {boolean} child - is this a child (default false)
|
|
2912
|
+
* @param {boolean} one - should there be only one (default true)
|
|
2101
2913
|
* @param {getCallback} callback - a callback function to return the result
|
|
2102
2914
|
* @return {object} results - An object containing the response of the action
|
|
2103
2915
|
*
|
|
2104
|
-
* @route {POST} /
|
|
2916
|
+
* @route {POST} /getEntityOntPort
|
|
2105
2917
|
* @roles admin
|
|
2106
2918
|
* @task true
|
|
2107
2919
|
*/
|
|
2108
2920
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2109
|
-
|
|
2110
|
-
const meth = 'adapter-
|
|
2921
|
+
getEntityOntPort(isamVer, shelfName, demark, child, one, callback) {
|
|
2922
|
+
const meth = 'adapter-getEntityOntPort';
|
|
2111
2923
|
const origin = `${this.id}-${meth}`;
|
|
2112
2924
|
log.trace(origin);
|
|
2113
2925
|
|
|
@@ -2118,16 +2930,34 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
2118
2930
|
}
|
|
2119
2931
|
|
|
2120
2932
|
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2121
|
-
if (
|
|
2122
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['
|
|
2933
|
+
if (isamVer === undefined || isamVer === null || isamVer === '') {
|
|
2934
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['isamVer'], null, null, null);
|
|
2935
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2936
|
+
return callback(null, errorObj);
|
|
2937
|
+
}
|
|
2938
|
+
if (shelfName === undefined || shelfName === null || shelfName === '') {
|
|
2939
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['shelfName'], null, null, null);
|
|
2940
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2941
|
+
return callback(null, errorObj);
|
|
2942
|
+
}
|
|
2943
|
+
if (demark === undefined || demark === null || demark === '') {
|
|
2944
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['demark'], null, null, null);
|
|
2123
2945
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2124
2946
|
return callback(null, errorObj);
|
|
2125
2947
|
}
|
|
2948
|
+
let isChild = false;
|
|
2949
|
+
if (child !== null && child !== undefined && child === true) {
|
|
2950
|
+
isChild = true;
|
|
2951
|
+
}
|
|
2952
|
+
let isOne = true;
|
|
2953
|
+
if (one !== null && one !== undefined && one === false) {
|
|
2954
|
+
isOne = false;
|
|
2955
|
+
}
|
|
2126
2956
|
|
|
2127
2957
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2128
|
-
const queryParamsAvailable = {};
|
|
2958
|
+
const queryParamsAvailable = { isChild, isOne };
|
|
2129
2959
|
const queryParams = {};
|
|
2130
|
-
const pathVars = [
|
|
2960
|
+
const pathVars = [isamVer, shelfName, demark];
|
|
2131
2961
|
const bodyVars = {};
|
|
2132
2962
|
|
|
2133
2963
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
@@ -2149,7 +2979,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
2149
2979
|
try {
|
|
2150
2980
|
// Make the call -
|
|
2151
2981
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2152
|
-
return this.requestHandlerInst.identifyRequest('
|
|
2982
|
+
return this.requestHandlerInst.identifyRequest('Entity', 'getEntityOntPort', reqObj, true, (irReturnData, irReturnError) => {
|
|
2153
2983
|
// if we received an error or their is no response on the results
|
|
2154
2984
|
// return an error
|
|
2155
2985
|
if (irReturnError) {
|
|
@@ -2157,7 +2987,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
2157
2987
|
return callback(null, irReturnError);
|
|
2158
2988
|
}
|
|
2159
2989
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2160
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2990
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getEntityOntPort'], null, null, null);
|
|
2161
2991
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2162
2992
|
return callback(null, errorObj);
|
|
2163
2993
|
}
|
|
@@ -2174,22 +3004,26 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
2174
3004
|
}
|
|
2175
3005
|
|
|
2176
3006
|
/**
|
|
2177
|
-
* @function
|
|
3007
|
+
* @function getEntityOntVlanAssociation
|
|
2178
3008
|
* @pronghornType method
|
|
2179
|
-
* @name
|
|
2180
|
-
* @summary
|
|
3009
|
+
* @name getEntityOntVlanAssociation
|
|
3010
|
+
* @summary Get ONT Vlan Association
|
|
2181
3011
|
*
|
|
2182
|
-
* @param {string}
|
|
3012
|
+
* @param {string} isamVer - the ISAM Version
|
|
3013
|
+
* @param {string} shelfName - the Shelf Name
|
|
3014
|
+
* @param {string} vlanAssociation - the VLAN Association
|
|
3015
|
+
* @param {boolean} child - is this a child (default false)
|
|
3016
|
+
* @param {boolean} one - should there be only one (default true)
|
|
2183
3017
|
* @param {getCallback} callback - a callback function to return the result
|
|
2184
3018
|
* @return {object} results - An object containing the response of the action
|
|
2185
3019
|
*
|
|
2186
|
-
* @route {POST} /
|
|
3020
|
+
* @route {POST} /getEntityOntVlanAssociation
|
|
2187
3021
|
* @roles admin
|
|
2188
3022
|
* @task true
|
|
2189
3023
|
*/
|
|
2190
3024
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2191
|
-
|
|
2192
|
-
const meth = 'adapter-
|
|
3025
|
+
getEntityOntVlanAssociation(isamVer, shelfName, vlanAssociation, child, one, callback) {
|
|
3026
|
+
const meth = 'adapter-getEntityOntVlanAssociation';
|
|
2193
3027
|
const origin = `${this.id}-${meth}`;
|
|
2194
3028
|
log.trace(origin);
|
|
2195
3029
|
|
|
@@ -2200,16 +3034,34 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
2200
3034
|
}
|
|
2201
3035
|
|
|
2202
3036
|
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2203
|
-
if (
|
|
2204
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['
|
|
3037
|
+
if (isamVer === undefined || isamVer === null || isamVer === '') {
|
|
3038
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['isamVer'], null, null, null);
|
|
3039
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3040
|
+
return callback(null, errorObj);
|
|
3041
|
+
}
|
|
3042
|
+
if (shelfName === undefined || shelfName === null || shelfName === '') {
|
|
3043
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['shelfName'], null, null, null);
|
|
3044
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3045
|
+
return callback(null, errorObj);
|
|
3046
|
+
}
|
|
3047
|
+
if (vlanAssociation === undefined || vlanAssociation === null || vlanAssociation === '') {
|
|
3048
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vlanAssociation'], null, null, null);
|
|
2205
3049
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2206
3050
|
return callback(null, errorObj);
|
|
2207
3051
|
}
|
|
3052
|
+
let isChild = false;
|
|
3053
|
+
if (child !== null && child !== undefined && child === true) {
|
|
3054
|
+
isChild = true;
|
|
3055
|
+
}
|
|
3056
|
+
let isOne = true;
|
|
3057
|
+
if (one !== null && one !== undefined && one === false) {
|
|
3058
|
+
isOne = false;
|
|
3059
|
+
}
|
|
2208
3060
|
|
|
2209
3061
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2210
|
-
const queryParamsAvailable = {};
|
|
3062
|
+
const queryParamsAvailable = { isChild, isOne };
|
|
2211
3063
|
const queryParams = {};
|
|
2212
|
-
const pathVars = [
|
|
3064
|
+
const pathVars = [isamVer, shelfName, vlanAssociation];
|
|
2213
3065
|
const bodyVars = {};
|
|
2214
3066
|
|
|
2215
3067
|
// loop in template. long callback arg name to avoid identifier conflicts
|
|
@@ -2231,7 +3083,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
2231
3083
|
try {
|
|
2232
3084
|
// Make the call -
|
|
2233
3085
|
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2234
|
-
return this.requestHandlerInst.identifyRequest('
|
|
3086
|
+
return this.requestHandlerInst.identifyRequest('Entity', 'getEntityOntVlanAssociation', reqObj, true, (irReturnData, irReturnError) => {
|
|
2235
3087
|
// if we received an error or their is no response on the results
|
|
2236
3088
|
// return an error
|
|
2237
3089
|
if (irReturnError) {
|
|
@@ -2239,7 +3091,7 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
2239
3091
|
return callback(null, irReturnError);
|
|
2240
3092
|
}
|
|
2241
3093
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2242
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
3094
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getEntityOntVlanAssociation'], null, null, null);
|
|
2243
3095
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2244
3096
|
return callback(null, errorObj);
|
|
2245
3097
|
}
|