@itentialopensource/adapter-nokia_altiplano 0.3.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/adapter.js CHANGED
@@ -80,10 +80,17 @@ class NokiaAltiplano extends AdapterBaseCl {
80
80
  }
81
81
 
82
82
  /**
83
- * @getWorkflowFunctions
83
+ * @iapGetAdapterWorkflowFunctions
84
84
  */
85
- getWorkflowFunctions(inIgnore) {
86
- let myIgnore = ['hasEntities', 'hasDevices'];
85
+ iapGetAdapterWorkflowFunctions(inIgnore) {
86
+ let myIgnore = [
87
+ 'healthCheck',
88
+ 'iapGetAdapterWorkflowFunctions',
89
+ 'iapHasAdapterEntity',
90
+ 'iapVerifyAdapterCapability',
91
+ 'iapUpdateAdapterEntityCache',
92
+ 'hasEntities'
93
+ ];
87
94
  if (!inIgnore && Array.isArray(inIgnore)) {
88
95
  myIgnore = inIgnore;
89
96
  } else if (!inIgnore && typeof inIgnore === 'string') {
@@ -94,15 +101,15 @@ class NokiaAltiplano extends AdapterBaseCl {
94
101
  // you can add specific methods that you do not want to be workflow functions to ignore like below
95
102
  // myIgnore.push('myMethodNotInWorkflow');
96
103
 
97
- return super.getWorkflowFunctions(myIgnore);
104
+ return super.iapGetAdapterWorkflowFunctions(myIgnore);
98
105
  }
99
106
 
100
107
  /**
101
- * updateAdapterConfiguration is used to update any of the adapter configuration files. This
108
+ * iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
102
109
  * allows customers to make changes to adapter configuration without having to be on the
103
110
  * file system.
104
111
  *
105
- * @function updateAdapterConfiguration
112
+ * @function iapUpdateAdapterConfiguration
106
113
  * @param {string} configFile - the name of the file being updated (required)
107
114
  * @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
108
115
  * @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
@@ -110,36 +117,42 @@ class NokiaAltiplano extends AdapterBaseCl {
110
117
  * @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
111
118
  * @param {Callback} callback - The results of the call
112
119
  */
113
- updateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
114
- const origin = `${this.id}-adapter-updateAdapterConfiguration`;
120
+ iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
121
+ const meth = 'adapter-iapUpdateAdapterConfiguration';
122
+ const origin = `${this.id}-${meth}`;
115
123
  log.trace(origin);
116
- super.updateAdapterConfiguration(configFile, changes, entity, type, action, callback);
124
+
125
+ super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
117
126
  }
118
127
 
119
128
  /**
120
129
  * See if the API path provided is found in this adapter
121
130
  *
122
- * @function findPath
131
+ * @function iapFindAdapterPath
123
132
  * @param {string} apiPath - the api path to check on
124
133
  * @param {Callback} callback - The results of the call
125
134
  */
126
- findPath(apiPath, callback) {
127
- const origin = `${this.id}-adapter-findPath`;
135
+ iapFindAdapterPath(apiPath, callback) {
136
+ const meth = 'adapter-iapFindAdapterPath';
137
+ const origin = `${this.id}-${meth}`;
128
138
  log.trace(origin);
129
- super.findPath(apiPath, callback);
139
+
140
+ super.iapFindAdapterPath(apiPath, callback);
130
141
  }
131
142
 
132
143
  /**
133
144
  * @summary Suspends adapter
134
145
  *
135
- * @function suspend
146
+ * @function iapSuspendAdapter
136
147
  * @param {Callback} callback - callback function
137
148
  */
138
- suspend(mode, callback) {
139
- const origin = `${this.id}-adapter-suspend`;
149
+ iapSuspendAdapter(mode, callback) {
150
+ const meth = 'adapter-iapSuspendAdapter';
151
+ const origin = `${this.id}-${meth}`;
140
152
  log.trace(origin);
153
+
141
154
  try {
142
- return super.suspend(mode, callback);
155
+ return super.iapSuspendAdapter(mode, callback);
143
156
  } catch (error) {
144
157
  log.error(`${origin}: ${error}`);
145
158
  return callback(null, error);
@@ -149,14 +162,16 @@ class NokiaAltiplano extends AdapterBaseCl {
149
162
  /**
150
163
  * @summary Unsuspends adapter
151
164
  *
152
- * @function unsuspend
165
+ * @function iapUnsuspendAdapter
153
166
  * @param {Callback} callback - callback function
154
167
  */
155
- unsuspend(callback) {
156
- const origin = `${this.id}-adapter-unsuspend`;
168
+ iapUnsuspendAdapter(callback) {
169
+ const meth = 'adapter-iapUnsuspendAdapter';
170
+ const origin = `${this.id}-${meth}`;
157
171
  log.trace(origin);
172
+
158
173
  try {
159
- return super.unsuspend(callback);
174
+ return super.iapUnsuspendAdapter(callback);
160
175
  } catch (error) {
161
176
  log.error(`${origin}: ${error}`);
162
177
  return callback(null, error);
@@ -166,29 +181,33 @@ class NokiaAltiplano extends AdapterBaseCl {
166
181
  /**
167
182
  * @summary Get the Adaoter Queue
168
183
  *
169
- * @function getQueue
184
+ * @function iapGetAdapterQueue
170
185
  * @param {Callback} callback - callback function
171
186
  */
172
- getQueue(callback) {
173
- const origin = `${this.id}-adapter-getQueue`;
187
+ iapGetAdapterQueue(callback) {
188
+ const meth = 'adapter-iapGetAdapterQueue';
189
+ const origin = `${this.id}-${meth}`;
174
190
  log.trace(origin);
175
- return super.getQueue(callback);
191
+
192
+ return super.iapGetAdapterQueue(callback);
176
193
  }
177
194
 
178
195
  /**
179
196
  * @summary Runs troubleshoot scripts for adapter
180
197
  *
181
- * @function troubleshoot
198
+ * @function iapTroubleshootAdapter
182
199
  * @param {Object} props - the connection, healthcheck and authentication properties
183
200
  *
184
201
  * @param {boolean} persistFlag - whether the adapter properties should be updated
185
202
  * @param {Callback} callback - The results of the call
186
203
  */
187
- troubleshoot(props, persistFlag, callback) {
188
- const origin = `${this.id}-adapter-troubleshoot`;
204
+ iapTroubleshootAdapter(props, persistFlag, callback) {
205
+ const meth = 'adapter-iapTroubleshootAdapter';
206
+ const origin = `${this.id}-${meth}`;
189
207
  log.trace(origin);
208
+
190
209
  try {
191
- return super.troubleshoot(props, persistFlag, this, callback);
210
+ return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
192
211
  } catch (error) {
193
212
  log.error(`${origin}: ${error}`);
194
213
  return callback(null, error);
@@ -198,15 +217,17 @@ class NokiaAltiplano extends AdapterBaseCl {
198
217
  /**
199
218
  * @summary runs healthcheck script for adapter
200
219
  *
201
- * @function runHealthcheck
220
+ * @function iapRunAdapterHealthcheck
202
221
  * @param {Adapter} adapter - adapter instance to troubleshoot
203
222
  * @param {Callback} callback - callback function
204
223
  */
205
- runHealthcheck(callback) {
206
- const origin = `${this.id}-adapter-runHealthcheck`;
224
+ iapRunAdapterHealthcheck(callback) {
225
+ const meth = 'adapter-iapRunAdapterHealthcheck';
226
+ const origin = `${this.id}-${meth}`;
207
227
  log.trace(origin);
228
+
208
229
  try {
209
- return super.runHealthcheck(this, callback);
230
+ return super.iapRunAdapterHealthcheck(this, callback);
210
231
  } catch (error) {
211
232
  log.error(`${origin}: ${error}`);
212
233
  return callback(null, error);
@@ -216,14 +237,16 @@ class NokiaAltiplano extends AdapterBaseCl {
216
237
  /**
217
238
  * @summary runs connectivity check script for adapter
218
239
  *
219
- * @function runConnectivity
240
+ * @function iapRunAdapterConnectivity
220
241
  * @param {Callback} callback - callback function
221
242
  */
222
- runConnectivity(callback) {
223
- const origin = `${this.id}-adapter-runConnectivity`;
243
+ iapRunAdapterConnectivity(callback) {
244
+ const meth = 'adapter-iapRunAdapterConnectivity';
245
+ const origin = `${this.id}-${meth}`;
224
246
  log.trace(origin);
247
+
225
248
  try {
226
- return super.runConnectivity(callback);
249
+ return super.iapRunAdapterConnectivity(callback);
227
250
  } catch (error) {
228
251
  log.error(`${origin}: ${error}`);
229
252
  return callback(null, error);
@@ -233,14 +256,16 @@ class NokiaAltiplano extends AdapterBaseCl {
233
256
  /**
234
257
  * @summary runs basicGet script for adapter
235
258
  *
236
- * @function runBasicGet
259
+ * @function iapRunAdapterBasicGet
237
260
  * @param {Callback} callback - callback function
238
261
  */
239
- runBasicGet(callback) {
240
- const origin = `${this.id}-adapter-runBasicGet`;
262
+ iapRunAdapterBasicGet(callback) {
263
+ const meth = 'adapter-iapRunAdapterBasicGet';
264
+ const origin = `${this.id}-${meth}`;
241
265
  log.trace(origin);
266
+
242
267
  try {
243
- return super.runBasicGet(callback);
268
+ return super.iapRunAdapterBasicGet(callback);
244
269
  } catch (error) {
245
270
  log.error(`${origin}: ${error}`);
246
271
  return callback(null, error);
@@ -250,45 +275,48 @@ class NokiaAltiplano extends AdapterBaseCl {
250
275
  /**
251
276
  * @summary moves entites into Mongo DB
252
277
  *
253
- * @function moveEntitiesToDB
278
+ * @function iapMoveAdapterEntitiesToDB
254
279
  * @param {getCallback} callback - a callback function to return the result (Generics)
255
280
  * or the error
256
281
  */
257
- moveEntitiesToDB(callback) {
258
- const origin = `${this.id}-adapter-moveEntitiesToDB`;
282
+ iapMoveAdapterEntitiesToDB(callback) {
283
+ const meth = 'adapter-iapMoveAdapterEntitiesToDB';
284
+ const origin = `${this.id}-${meth}`;
259
285
  log.trace(origin);
286
+
260
287
  try {
261
- return super.moveEntitiesToDB(callback);
288
+ return super.iapMoveAdapterEntitiesToDB(callback);
262
289
  } catch (err) {
263
290
  log.error(`${origin}: ${err}`);
264
291
  return callback(null, err);
265
292
  }
266
293
  }
267
294
 
295
+ /* BROKER CALLS */
268
296
  /**
269
297
  * @summary Determines if this adapter supports the specific entity
270
298
  *
271
- * @function hasEntity
299
+ * @function iapHasAdapterEntity
272
300
  * @param {String} entityType - the entity type to check for
273
301
  * @param {String/Array} entityId - the specific entity we are looking for
274
302
  *
275
303
  * @param {Callback} callback - An array of whether the adapter can has the
276
304
  * desired capability or an error
277
305
  */
278
- hasEntity(entityType, entityId, callback) {
279
- const origin = `${this.id}-adapter-hasEntity`;
306
+ iapHasAdapterEntity(entityType, entityId, callback) {
307
+ const origin = `${this.id}-adapter-iapHasAdapterEntity`;
280
308
  log.trace(origin);
281
309
 
282
310
  // Make the call -
283
- // verifyCapability(entityType, actionType, entityId, callback)
284
- return this.verifyCapability(entityType, null, entityId, callback);
311
+ // iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
312
+ return this.iapVerifyAdapterCapability(entityType, null, entityId, callback);
285
313
  }
286
314
 
287
315
  /**
288
316
  * @summary Provides a way for the adapter to tell north bound integrations
289
317
  * whether the adapter supports type, action and specific entity
290
318
  *
291
- * @function verifyCapability
319
+ * @function iapVerifyAdapterCapability
292
320
  * @param {String} entityType - the entity type to check for
293
321
  * @param {String} actionType - the action type to check for
294
322
  * @param {String/Array} entityId - the specific entity we are looking for
@@ -296,15 +324,15 @@ class NokiaAltiplano extends AdapterBaseCl {
296
324
  * @param {Callback} callback - An array of whether the adapter can has the
297
325
  * desired capability or an error
298
326
  */
299
- verifyCapability(entityType, actionType, entityId, callback) {
300
- const meth = 'adapterBase-verifyCapability';
327
+ iapVerifyAdapterCapability(entityType, actionType, entityId, callback) {
328
+ const meth = 'adapterBase-iapVerifyAdapterCapability';
301
329
  const origin = `${this.id}-${meth}`;
302
330
  log.trace(origin);
303
331
 
304
332
  // if caching
305
333
  if (this.caching) {
306
- // Make the call - verifyCapability(entityType, actionType, entityId, callback)
307
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (results, error) => {
334
+ // Make the call - iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
335
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (results, error) => {
308
336
  if (error) {
309
337
  return callback(null, error);
310
338
  }
@@ -322,7 +350,7 @@ class NokiaAltiplano extends AdapterBaseCl {
322
350
  }
323
351
 
324
352
  // need to check the cache again since it has been updated
325
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
353
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
326
354
  if (verror) {
327
355
  return callback(null, verror);
328
356
  }
@@ -355,7 +383,7 @@ class NokiaAltiplano extends AdapterBaseCl {
355
383
  // if no entity id
356
384
  if (!entityId) {
357
385
  // need to check the cache again since it has been updated
358
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
386
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
359
387
  if (verror) {
360
388
  return callback(null, verror);
361
389
  }
@@ -376,7 +404,7 @@ class NokiaAltiplano extends AdapterBaseCl {
376
404
  }
377
405
 
378
406
  // need to check the cache again since it has been updated
379
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
407
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
380
408
  if (verror) {
381
409
  return callback(null, verror);
382
410
  }
@@ -417,11 +445,11 @@ class NokiaAltiplano extends AdapterBaseCl {
417
445
  /**
418
446
  * @summary Updates the cache for all entities by call the get All entity method
419
447
  *
420
- * @function updateEntityCache
448
+ * @function iapUpdateAdapterEntityCache
421
449
  *
422
450
  */
423
- updateEntityCache() {
424
- const origin = `${this.id}-adapter-updateEntityCache`;
451
+ iapUpdateAdapterEntityCache() {
452
+ const origin = `${this.id}-adapter-iapUpdateAdapterEntityCache`;
425
453
  log.trace(origin);
426
454
 
427
455
  if (this.caching) {
@@ -434,6 +462,140 @@ class NokiaAltiplano extends AdapterBaseCl {
434
462
  }
435
463
  }
436
464
 
465
+ /**
466
+ * @summary Determines if this adapter supports any in a list of entities
467
+ *
468
+ * @function hasEntities
469
+ * @param {String} entityType - the entity type to check for
470
+ * @param {Array} entityList - the list of entities we are looking for
471
+ *
472
+ * @param {Callback} callback - A map where the entity is the key and the
473
+ * value is true or false
474
+ */
475
+ hasEntities(entityType, entityList, callback) {
476
+ const meth = 'adapter-hasEntities';
477
+ const origin = `${this.id}-${meth}`;
478
+ log.trace(origin);
479
+
480
+ try {
481
+ return super.hasEntities(entityType, entityList, callback);
482
+ } catch (err) {
483
+ log.error(`${origin}: ${err}`);
484
+ return callback(null, err);
485
+ }
486
+ }
487
+
488
+ /**
489
+ * @summary Get Appliance that match the deviceName
490
+ *
491
+ * @function getDevice
492
+ * @param {String} deviceName - the deviceName to find (required)
493
+ *
494
+ * @param {getCallback} callback - a callback function to return the result
495
+ * (appliance) or the error
496
+ */
497
+ getDevice(deviceName, callback) {
498
+ const meth = 'adapter-getDevice';
499
+ const origin = `${this.id}-${meth}`;
500
+ log.trace(origin);
501
+
502
+ try {
503
+ return super.getDevice(deviceName, callback);
504
+ } catch (err) {
505
+ log.error(`${origin}: ${err}`);
506
+ return callback(null, err);
507
+ }
508
+ }
509
+
510
+ /**
511
+ * @summary Get Appliances that match the filter
512
+ *
513
+ * @function getDevicesFiltered
514
+ * @param {Object} options - the data to use to filter the appliances (optional)
515
+ *
516
+ * @param {getCallback} callback - a callback function to return the result
517
+ * (appliances) or the error
518
+ */
519
+ getDevicesFiltered(options, callback) {
520
+ const meth = 'adapter-getDevicesFiltered';
521
+ const origin = `${this.id}-${meth}`;
522
+ log.trace(origin);
523
+
524
+ try {
525
+ return super.getDevicesFiltered(options, callback);
526
+ } catch (err) {
527
+ log.error(`${origin}: ${err}`);
528
+ return callback(null, err);
529
+ }
530
+ }
531
+
532
+ /**
533
+ * @summary Gets the status for the provided appliance
534
+ *
535
+ * @function isAlive
536
+ * @param {String} deviceName - the deviceName of the appliance. (required)
537
+ *
538
+ * @param {configCallback} callback - callback function to return the result
539
+ * (appliance isAlive) or the error
540
+ */
541
+ isAlive(deviceName, callback) {
542
+ const meth = 'adapter-isAlive';
543
+ const origin = `${this.id}-${meth}`;
544
+ log.trace(origin);
545
+
546
+ try {
547
+ return super.isAlive(deviceName, callback);
548
+ } catch (err) {
549
+ log.error(`${origin}: ${err}`);
550
+ return callback(null, err);
551
+ }
552
+ }
553
+
554
+ /**
555
+ * @summary Gets a config for the provided Appliance
556
+ *
557
+ * @function getConfig
558
+ * @param {String} deviceName - the deviceName of the appliance. (required)
559
+ * @param {String} format - the desired format of the config. (optional)
560
+ *
561
+ * @param {configCallback} callback - callback function to return the result
562
+ * (appliance config) or the error
563
+ */
564
+ getConfig(deviceName, format, callback) {
565
+ const meth = 'adapter-getConfig';
566
+ const origin = `${this.id}-${meth}`;
567
+ log.trace(origin);
568
+
569
+ try {
570
+ return super.getConfig(deviceName, format, callback);
571
+ } catch (err) {
572
+ log.error(`${origin}: ${err}`);
573
+ return callback(null, err);
574
+ }
575
+ }
576
+
577
+ /**
578
+ * @summary Gets the device count from the system
579
+ *
580
+ * @function iapGetDeviceCount
581
+ *
582
+ * @param {getCallback} callback - callback function to return the result
583
+ * (count) or the error
584
+ */
585
+ iapGetDeviceCount(callback) {
586
+ const meth = 'adapter-iapGetDeviceCount';
587
+ const origin = `${this.id}-${meth}`;
588
+ log.trace(origin);
589
+
590
+ try {
591
+ return super.iapGetDeviceCount(callback);
592
+ } catch (err) {
593
+ log.error(`${origin}: ${err}`);
594
+ return callback(null, err);
595
+ }
596
+ }
597
+
598
+ /* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
437
599
  /**
438
600
  * Makes the requested generic call
439
601
  *
@@ -544,79 +706,23 @@ class NokiaAltiplano extends AdapterBaseCl {
544
706
  }
545
707
  }
546
708
 
547
- /* BROKER CALLS */
548
- /**
549
- * @summary Determines if this adapter supports any in a list of entities
550
- *
551
- * @function hasEntities
552
- * @param {String} entityType - the entity type to check for
553
- * @param {Array} entityList - the list of entities we are looking for
554
- *
555
- * @param {Callback} callback - A map where the entity is the key and the
556
- * value is true or false
557
- */
558
- hasEntities(entityType, entityList, callback) {
559
- const origin = `${this.id}-adapter-hasEntities`;
560
- log.trace(origin);
561
-
562
- switch (entityType) {
563
- case 'Device':
564
- return this.hasDevices(entityList, callback);
565
- default:
566
- return callback(null, `${this.id} does not support entity ${entityType}`);
567
- }
568
- }
569
-
570
- /**
571
- * @summary Helper method for hasEntities for the specific device case
572
- *
573
- * @param {Array} deviceList - array of unique device identifiers
574
- * @param {Callback} callback - A map where the device is the key and the
575
- * value is true or false
576
- */
577
- hasDevices(deviceList, callback) {
578
- const origin = `${this.id}-adapter-hasDevices`;
579
- log.trace(origin);
580
-
581
- const findings = deviceList.reduce((map, device) => {
582
- // eslint-disable-next-line no-param-reassign
583
- map[device] = false;
584
- log.debug(`In reduce: ${JSON.stringify(map)}`);
585
- return map;
586
- }, {});
587
- const apiCalls = deviceList.map((device) => new Promise((resolve) => {
588
- this.getDevice(device, (result, error) => {
589
- if (error) {
590
- log.debug(`In map error: ${JSON.stringify(device)}`);
591
- return resolve({ name: device, found: false });
592
- }
593
- log.debug(`In map: ${JSON.stringify(device)}`);
594
- return resolve({ name: device, found: true });
595
- });
596
- }));
597
- Promise.all(apiCalls).then((results) => {
598
- results.forEach((device) => {
599
- findings[device.name] = device.found;
600
- });
601
- log.debug(`FINDINGS: ${JSON.stringify(findings)}`);
602
- return callback(findings);
603
- }).catch((errors) => {
604
- log.error('Unable to do device lookup.');
605
- return callback(null, { code: 503, message: 'Unable to do device lookup.', error: errors });
606
- });
607
- }
608
-
609
709
  /**
610
- * @summary Get Appliance that match the deviceName
710
+ * Makes the requested generic call with no base path or version
611
711
  *
612
- * @function getDevice
613
- * @param {String} deviceName - the deviceName to find (required)
614
- *
615
- * @param {getCallback} callback - a callback function to return the result
616
- * (appliance) or the error
712
+ * @function genericAdapterRequestNoBasePath
713
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
714
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
715
+ * @param {Object} queryData - the parameters to be put on the url (optional).
716
+ * Can be a stringified Object.
717
+ * @param {Object} requestBody - the body to add to the request (optional).
718
+ * Can be a stringified Object.
719
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
720
+ * Can be a stringified Object.
721
+ * @param {getCallback} callback - a callback function to return the result (Generics)
722
+ * or the error
617
723
  */
618
- getDevice(deviceName, callback) {
619
- const meth = 'adapter-getDevice';
724
+ genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
725
+ const meth = 'adapter-genericAdapterRequestNoBasePath';
620
726
  const origin = `${this.id}-${meth}`;
621
727
  log.trace(origin);
622
728
 
@@ -627,365 +733,81 @@ class NokiaAltiplano extends AdapterBaseCl {
627
733
  }
628
734
 
629
735
  /* HERE IS WHERE YOU VALIDATE DATA */
630
- if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
631
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
736
+ if (uriPath === undefined || uriPath === null || uriPath === '') {
737
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
632
738
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
633
739
  return callback(null, errorObj);
634
740
  }
635
-
636
- try {
637
- // need to get the device so we can convert the deviceName to an id
638
- // !! if we can do a lookup by name the getDevicesFiltered may not be necessary
639
- const opts = {
640
- filter: {
641
- name: deviceName
642
- }
643
- };
644
- return this.getDevicesFiltered(opts, (devs, ferr) => {
645
- // if we received an error or their is no response on the results return an error
646
- if (ferr) {
647
- return callback(null, ferr);
648
- }
649
- if (devs.list.length < 1) {
650
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
651
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
652
- return callback(null, errorObj);
653
- }
654
- // get the uuid from the device
655
- const { uuid } = devs.list[0];
656
-
657
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
658
- // !! you can also replace with a specific call if that is easier
659
- const uriPath = `/call/toget/device/${uuid}`;
660
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
661
- // if we received an error or their is no response on the results return an error
662
- if (error) {
663
- return callback(null, error);
664
- }
665
- if (!result.response || !result.response.applianceMo) {
666
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDevice'], null, null, null);
667
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
668
- return callback(null, errorObj);
669
- }
670
-
671
- // return the response
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);
680
- });
681
- });
682
- } catch (ex) {
683
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
741
+ if (restMethod === undefined || restMethod === null || restMethod === '') {
742
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
684
743
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
685
744
  return callback(null, errorObj);
686
745
  }
687
- }
688
-
689
- /**
690
- * @summary Get Appliances that match the filter
691
- *
692
- * @function getDevicesFiltered
693
- * @param {Object} options - the data to use to filter the appliances (optional)
694
- *
695
- * @param {getCallback} callback - a callback function to return the result
696
- * (appliances) or the error
697
- */
698
- getDevicesFiltered(options, callback) {
699
- const meth = 'adapter-getDevicesFiltered';
700
- const origin = `${this.id}-${meth}`;
701
- log.trace(origin);
702
746
 
703
- // verify the required fields have been provided
704
- if (options === undefined || options === null || options === '' || options.length === 0) {
705
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['options'], null, null, null);
706
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
707
- return callback(null, errorObj);
747
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
748
+ // remove any leading / and split the uripath into path variables
749
+ let myPath = uriPath;
750
+ while (myPath.indexOf('/') === 0) {
751
+ myPath = myPath.substring(1);
708
752
  }
709
- log.debug(`Device Filter Options: ${JSON.stringify(options)}`);
710
-
711
- // TODO - get pagination working
712
- // const nextToken = options.start;
713
- // const maxResults = options.limit;
753
+ const pathVars = myPath.split('/');
754
+ const queryParamsAvailable = queryData;
755
+ const queryParams = {};
756
+ const bodyVars = requestBody;
714
757
 
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];
758
+ // loop in template. long callback arg name to avoid identifier conflicts
759
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
760
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
761
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
762
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
724
763
  }
725
- }
764
+ });
726
765
 
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
- try {
737
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
738
- // !! you can also replace with a specific call if that is easier
739
- const uriPath = '/call/toget/devices';
740
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
741
- // if we received an error or their is no response on the results return an error
742
- if (error) {
743
- return callback(null, error);
744
- }
745
- if (!result.response) {
746
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDevicesFiltered'], null, null, null);
747
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
748
- return callback(null, errorObj);
749
- }
750
-
751
- // !! go through the response - may have to look for sub object
752
- // handle an array of devices
753
- if (Array.isArray(result.response)) {
754
- const myDevices = [];
755
-
756
- for (let d = 0; d < result.response.length; d += 1) {
757
- // !! format the data we send back
758
- // !! these fields are config manager fields you need to map to the data we receive
759
- const thisDevice = result.response;
760
- thisDevice.name = thisDevice.systemName;
761
- thisDevice.ostype = `System-${thisDevice.systemType}`;
762
- thisDevice.port = thisDevice.systemPort;
763
- thisDevice.ipaddress = thisDevice.systemIP;
764
-
765
- // if there is no filter - return the device
766
- if (filterName.length === 0) {
767
- myDevices.push(thisDevice);
768
- } else {
769
- // if we have to match a filter
770
- let found = false;
771
- for (let f = 0; f < filterName.length; f += 1) {
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);
780
- }
781
- }
782
- }
783
- log.debug(`${origin}: Found #${myDevices.length} devices.`);
784
- log.debug(`Devices: ${JSON.stringify(myDevices)}`);
785
- return callback({ total: myDevices.length, list: myDevices });
786
- }
787
- // handle a single device response
788
- // !! format the data we send back
789
- // !! these fields are config manager fields you need to map to the data we receive
790
- const thisDevice = result.response;
791
- thisDevice.name = thisDevice.systemName;
792
- thisDevice.ostype = `System-${thisDevice.systemType}`;
793
- thisDevice.port = thisDevice.systemPort;
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;
809
- }
810
- }
811
- // matching device
812
- if (found) {
813
- log.debug(`${origin}: Found #1 device.`);
814
- log.debug(`Device Found: ${JSON.stringify(thisDevice)}`);
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: [] });
820
- });
821
- } catch (ex) {
822
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
823
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
824
- return callback(null, errorObj);
825
- }
826
- }
827
-
828
- /**
829
- * @summary Gets the status for the provided appliance
830
- *
831
- * @function isAlive
832
- * @param {String} deviceName - the deviceName of the appliance. (required)
833
- *
834
- * @param {configCallback} callback - callback function to return the result
835
- * (appliance isAlive) or the error
836
- */
837
- isAlive(deviceName, callback) {
838
- const meth = 'adapter-isAlive';
839
- const origin = `${this.id}-${meth}`;
840
- log.trace(origin);
841
-
842
- // verify the required fields have been provided
843
- if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
844
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
845
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
846
- return callback(null, errorObj);
847
- }
848
-
849
- try {
850
- // need to get the device so we can convert the deviceName to an id
851
- // !! if we can do a lookup by name the getDevicesFiltered may not be necessary
852
- const opts = {
853
- filter: {
854
- name: deviceName
855
- }
856
- };
857
- return this.getDevicesFiltered(opts, (devs, ferr) => {
858
- // if we received an error or their is no response on the results return an error
859
- if (ferr) {
860
- return callback(null, ferr);
861
- }
862
- if (devs.list.length < 1) {
863
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
864
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
865
- return callback(null, errorObj);
866
- }
867
- // get the uuid from the device
868
- const { uuid } = devs.list[0];
869
-
870
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
871
- // !! you can also replace with a specific call if that is easier
872
- const uriPath = `/call/toget/status/${uuid}`;
873
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
874
- // if we received an error or their is no response on the results return an error
875
- if (error) {
876
- return callback(null, error);
877
- }
878
- // !! should update this to make sure we are checking for the appropriate object/field
879
- if (!result.response || !result.response.returnObj || !Object.hasOwnProperty.call(result.response.returnObj, 'statusField')) {
880
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['isAlive'], null, null, null);
881
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
882
- return callback(null, errorObj);
883
- }
884
-
885
- // !! return the response - Update to the appropriate object/field
886
- return callback(!result.response.returnObj.statusField);
887
- });
888
- });
889
- } catch (ex) {
890
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
891
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
892
- return callback(null, errorObj);
766
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
767
+ const reqObj = {
768
+ payload: bodyVars,
769
+ uriPathVars: pathVars,
770
+ uriQuery: queryParams,
771
+ uriOptions: {}
772
+ };
773
+ // add headers if provided
774
+ if (addlHeaders) {
775
+ reqObj.addlHeaders = addlHeaders;
893
776
  }
894
- }
895
-
896
- /**
897
- * @summary Gets a config for the provided Appliance
898
- *
899
- * @function getConfig
900
- * @param {String} deviceName - the deviceName of the appliance. (required)
901
- * @param {String} format - the desired format of the config. (optional)
902
- *
903
- * @param {configCallback} callback - callback function to return the result
904
- * (appliance config) or the error
905
- */
906
- getConfig(deviceName, format, callback) {
907
- const meth = 'adapter-getConfig';
908
- const origin = `${this.id}-${meth}`;
909
- log.trace(origin);
910
777
 
911
- // verify the required fields have been provided
912
- if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
913
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
914
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
915
- return callback(null, errorObj);
778
+ // determine the call and return flag
779
+ let action = 'getGenericsNoBase';
780
+ let returnF = true;
781
+ if (restMethod.toUpperCase() === 'POST') {
782
+ action = 'createGenericNoBase';
783
+ } else if (restMethod.toUpperCase() === 'PUT') {
784
+ action = 'updateGenericNoBase';
785
+ } else if (restMethod.toUpperCase() === 'PATCH') {
786
+ action = 'patchGenericNoBase';
787
+ } else if (restMethod.toUpperCase() === 'DELETE') {
788
+ action = 'deleteGenericNoBase';
789
+ returnF = false;
916
790
  }
917
791
 
918
792
  try {
919
- // need to get the device so we can convert the deviceName to an id
920
- // !! if we can do a lookup by name the getDevicesFiltered may not be necessary
921
- const opts = {
922
- filter: {
923
- name: deviceName
924
- }
925
- };
926
- return this.getDevicesFiltered(opts, (devs, ferr) => {
927
- // if we received an error or their is no response on the results return an error
928
- if (ferr) {
929
- return callback(null, ferr);
793
+ // Make the call -
794
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
795
+ return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
796
+ // if we received an error or their is no response on the results
797
+ // return an error
798
+ if (irReturnError) {
799
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
800
+ return callback(null, irReturnError);
930
801
  }
931
- if (devs.list.length < 1) {
932
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
802
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
803
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequestNoBasePath'], null, null, null);
933
804
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
934
805
  return callback(null, errorObj);
935
806
  }
936
- // get the uuid from the device
937
- const { uuid } = devs.list[0];
938
-
939
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
940
- // !! you can also replace with a specific call if that is easier
941
- const uriPath = `/call/toget/config/${uuid}`;
942
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
943
- // if we received an error or their is no response on the results return an error
944
- if (error) {
945
- return callback(null, error);
946
- }
947
-
948
- // return the result
949
- const newResponse = {
950
- response: JSON.stringify(result.response, null, 2)
951
- };
952
- return callback(newResponse);
953
- });
954
- });
955
- } catch (ex) {
956
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
957
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
958
- return callback(null, errorObj);
959
- }
960
- }
961
-
962
- /**
963
- * @summary Gets the device count from the system
964
- *
965
- * @function getCount
966
- *
967
- * @param {getCallback} callback - callback function to return the result
968
- * (count) or the error
969
- */
970
- getCount(callback) {
971
- const meth = 'adapter-getCount';
972
- const origin = `${this.id}-${meth}`;
973
- log.trace(origin);
974
-
975
- // verify the required fields have been provided
976
-
977
- try {
978
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
979
- // !! you can also replace with a specific call if that is easier
980
- const uriPath = '/call/toget/count';
981
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
982
- // if we received an error or their is no response on the results return an error
983
- if (error) {
984
- return callback(null, error);
985
- }
986
807
 
987
- // return the result
988
- return callback({ count: result.response });
808
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
809
+ // return the response
810
+ return callback(irReturnData, null);
989
811
  });
990
812
  } catch (ex) {
991
813
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
@@ -1213,8 +1035,671 @@ class NokiaAltiplano extends AdapterBaseCl {
1213
1035
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1214
1036
  const queryParamsAvailable = {};
1215
1037
  const queryParams = {};
1216
- const pathVars = [];
1217
- const bodyVars = body;
1038
+ const pathVars = [];
1039
+ const bodyVars = body;
1040
+
1041
+ // loop in template. long callback arg name to avoid identifier conflicts
1042
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1043
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1044
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1045
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1046
+ }
1047
+ });
1048
+
1049
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1050
+ // see adapter code documentation for more information on the request object's fields
1051
+ const reqObj = {
1052
+ payload: bodyVars,
1053
+ uriPathVars: pathVars,
1054
+ uriQuery: queryParams
1055
+ };
1056
+
1057
+ try {
1058
+ // Make the call -
1059
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1060
+ return this.requestHandlerInst.identifyRequest('Intent', 'getuplinkConnectionConfiguration', reqObj, true, (irReturnData, irReturnError) => {
1061
+ // if we received an error or their is no response on the results
1062
+ // return an error
1063
+ if (irReturnError) {
1064
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1065
+ return callback(null, irReturnError);
1066
+ }
1067
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1068
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getuplinkConnectionConfiguration'], null, null, null);
1069
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1070
+ return callback(null, errorObj);
1071
+ }
1072
+
1073
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1074
+ // return the response
1075
+ return callback(irReturnData, null);
1076
+ });
1077
+ } catch (ex) {
1078
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1079
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1080
+ return callback(null, errorObj);
1081
+ }
1082
+ }
1083
+
1084
+ /**
1085
+ * @function dependentsSummaryFiber
1086
+ * @pronghornType method
1087
+ * @name dependentsSummaryFiber
1088
+ * @summary Dependents summary fiber
1089
+ *
1090
+ * @param {string} intent - the intent
1091
+ * @param {getCallback} callback - a callback function to return the result
1092
+ * @return {object} results - An object containing the response of the action
1093
+ *
1094
+ * @route {POST} /dependentsSummaryFiber
1095
+ * @roles admin
1096
+ * @task true
1097
+ */
1098
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1099
+ dependentsSummaryFiber(intent, callback) {
1100
+ const meth = 'adapter-dependentsSummaryFiber';
1101
+ const origin = `${this.id}-${meth}`;
1102
+ log.trace(origin);
1103
+
1104
+ if (this.suspended && this.suspendMode === 'error') {
1105
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1106
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1107
+ return callback(null, errorObj);
1108
+ }
1109
+
1110
+ /* HERE IS WHERE YOU VALIDATE DATA */
1111
+ if (intent === undefined || intent === null || intent === '') {
1112
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
1113
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1114
+ return callback(null, errorObj);
1115
+ }
1116
+
1117
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1118
+ const queryParamsAvailable = {};
1119
+ const queryParams = {};
1120
+ const pathVars = [intent];
1121
+ const bodyVars = {};
1122
+
1123
+ // loop in template. long callback arg name to avoid identifier conflicts
1124
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1125
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1126
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1127
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1128
+ }
1129
+ });
1130
+
1131
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1132
+ // see adapter code documentation for more information on the request object's fields
1133
+ const reqObj = {
1134
+ payload: bodyVars,
1135
+ uriPathVars: pathVars,
1136
+ uriQuery: queryParams
1137
+ };
1138
+
1139
+ try {
1140
+ // Make the call -
1141
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1142
+ return this.requestHandlerInst.identifyRequest('Intent', 'dependentsSummaryFiber', reqObj, true, (irReturnData, irReturnError) => {
1143
+ // if we received an error or their is no response on the results
1144
+ // return an error
1145
+ if (irReturnError) {
1146
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1147
+ return callback(null, irReturnError);
1148
+ }
1149
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1150
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['dependentsSummaryFiber'], null, null, null);
1151
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1152
+ return callback(null, errorObj);
1153
+ }
1154
+
1155
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1156
+ // return the response
1157
+ return callback(irReturnData, null);
1158
+ });
1159
+ } catch (ex) {
1160
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1161
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1162
+ return callback(null, errorObj);
1163
+ }
1164
+ }
1165
+
1166
+ /**
1167
+ * @function createOnt
1168
+ * @pronghornType method
1169
+ * @name createOnt
1170
+ * @summary Create ont
1171
+ *
1172
+ * @param {object} body - body param
1173
+ * @param {getCallback} callback - a callback function to return the result
1174
+ * @return {object} results - An object containing the response of the action
1175
+ *
1176
+ * @route {POST} /createOnt
1177
+ * @roles admin
1178
+ * @task true
1179
+ */
1180
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1181
+ createOnt(body, callback) {
1182
+ const meth = 'adapter-createOnt';
1183
+ const origin = `${this.id}-${meth}`;
1184
+ log.trace(origin);
1185
+
1186
+ if (this.suspended && this.suspendMode === 'error') {
1187
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1188
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1189
+ return callback(null, errorObj);
1190
+ }
1191
+
1192
+ /* HERE IS WHERE YOU VALIDATE DATA */
1193
+ if (body === undefined || body === null || body === '') {
1194
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1195
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1196
+ return callback(null, errorObj);
1197
+ }
1198
+
1199
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1200
+ const queryParamsAvailable = {};
1201
+ const queryParams = {};
1202
+ const pathVars = [];
1203
+ const bodyVars = body;
1204
+
1205
+ // loop in template. long callback arg name to avoid identifier conflicts
1206
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1207
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1208
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1209
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1210
+ }
1211
+ });
1212
+
1213
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1214
+ // see adapter code documentation for more information on the request object's fields
1215
+ const reqObj = {
1216
+ payload: bodyVars,
1217
+ uriPathVars: pathVars,
1218
+ uriQuery: queryParams
1219
+ };
1220
+
1221
+ try {
1222
+ // Make the call -
1223
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1224
+ return this.requestHandlerInst.identifyRequest('Intent', 'createOnt', reqObj, true, (irReturnData, irReturnError) => {
1225
+ // if we received an error or their is no response on the results
1226
+ // return an error
1227
+ if (irReturnError) {
1228
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1229
+ return callback(null, irReturnError);
1230
+ }
1231
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1232
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createOnt'], null, null, null);
1233
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1234
+ return callback(null, errorObj);
1235
+ }
1236
+
1237
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1238
+ // return the response
1239
+ return callback(irReturnData, null);
1240
+ });
1241
+ } catch (ex) {
1242
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1243
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1244
+ return callback(null, errorObj);
1245
+ }
1246
+ }
1247
+
1248
+ /**
1249
+ * @function createOntWithQuery
1250
+ * @pronghornType method
1251
+ * @name createOntWithQuery
1252
+ * @summary Create ont with query params
1253
+ *
1254
+ * @param {object} body - body param
1255
+ * @param {object} query - query param
1256
+ * @param {getCallback} callback - a callback function to return the result
1257
+ * @return {object} results - An object containing the response of the action
1258
+ *
1259
+ * @route {POST} /createOntWithQuery
1260
+ * @roles admin
1261
+ * @task true
1262
+ */
1263
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1264
+ createOntWithQuery(body, query, callback) {
1265
+ const meth = 'adapter-createOntWithQuery';
1266
+ const origin = `${this.id}-${meth}`;
1267
+ log.trace(origin);
1268
+
1269
+ if (this.suspended && this.suspendMode === 'error') {
1270
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1271
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1272
+ return callback(null, errorObj);
1273
+ }
1274
+
1275
+ /* HERE IS WHERE YOU VALIDATE DATA */
1276
+ if (body === undefined || body === null || body === '') {
1277
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1278
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1279
+ return callback(null, errorObj);
1280
+ }
1281
+
1282
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1283
+ const queryParamsAvailable = query;
1284
+ const queryParams = {};
1285
+ const pathVars = [];
1286
+ const bodyVars = body;
1287
+
1288
+ // loop in template. long callback arg name to avoid identifier conflicts
1289
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1290
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1291
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1292
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1293
+ }
1294
+ });
1295
+
1296
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1297
+ // see adapter code documentation for more information on the request object's fields
1298
+ const reqObj = {
1299
+ payload: bodyVars,
1300
+ uriPathVars: pathVars,
1301
+ uriQuery: queryParams
1302
+ };
1303
+
1304
+ try {
1305
+ // Make the call -
1306
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1307
+ return this.requestHandlerInst.identifyRequest('Intent', 'createOnt', reqObj, true, (irReturnData, irReturnError) => {
1308
+ // if we received an error or their is no response on the results
1309
+ // return an error
1310
+ if (irReturnError) {
1311
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1312
+ return callback(null, irReturnError);
1313
+ }
1314
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1315
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createOntWithQuery'], null, null, null);
1316
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1317
+ return callback(null, errorObj);
1318
+ }
1319
+
1320
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1321
+ // return the response
1322
+ return callback(irReturnData, null);
1323
+ });
1324
+ } catch (ex) {
1325
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1326
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1327
+ return callback(null, errorObj);
1328
+ }
1329
+ }
1330
+
1331
+ /**
1332
+ * @function getOnt
1333
+ * @pronghornType method
1334
+ * @name getOnt
1335
+ * @summary GET ont
1336
+ *
1337
+ * @param {string} intent - the intent
1338
+ * @param {getCallback} callback - a callback function to return the result
1339
+ * @return {object} results - An object containing the response of the action
1340
+ *
1341
+ * @route {POST} /getOnt
1342
+ * @roles admin
1343
+ * @task true
1344
+ */
1345
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1346
+ getOnt(intent, callback) {
1347
+ const meth = 'adapter-getOnt';
1348
+ const origin = `${this.id}-${meth}`;
1349
+ log.trace(origin);
1350
+
1351
+ if (this.suspended && this.suspendMode === 'error') {
1352
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1353
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1354
+ return callback(null, errorObj);
1355
+ }
1356
+
1357
+ /* HERE IS WHERE YOU VALIDATE DATA */
1358
+ if (intent === undefined || intent === null || intent === '') {
1359
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
1360
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1361
+ return callback(null, errorObj);
1362
+ }
1363
+
1364
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1365
+ const queryParamsAvailable = {};
1366
+ const queryParams = {};
1367
+ const pathVars = [intent];
1368
+ const bodyVars = {};
1369
+
1370
+ // loop in template. long callback arg name to avoid identifier conflicts
1371
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1372
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1373
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1374
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1375
+ }
1376
+ });
1377
+
1378
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1379
+ // see adapter code documentation for more information on the request object's fields
1380
+ const reqObj = {
1381
+ payload: bodyVars,
1382
+ uriPathVars: pathVars,
1383
+ uriQuery: queryParams
1384
+ };
1385
+
1386
+ try {
1387
+ // Make the call -
1388
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1389
+ return this.requestHandlerInst.identifyRequest('Intent', 'getOnt', reqObj, true, (irReturnData, irReturnError) => {
1390
+ // if we received an error or their is no response on the results
1391
+ // return an error
1392
+ if (irReturnError) {
1393
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1394
+ return callback(null, irReturnError);
1395
+ }
1396
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1397
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getOnt'], null, null, null);
1398
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1399
+ return callback(null, errorObj);
1400
+ }
1401
+
1402
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1403
+ // return the response
1404
+ return callback(irReturnData, null);
1405
+ });
1406
+ } catch (ex) {
1407
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1408
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1409
+ return callback(null, errorObj);
1410
+ }
1411
+ }
1412
+
1413
+ /**
1414
+ * @function lockOnt
1415
+ * @pronghornType method
1416
+ * @name lockOnt
1417
+ * @summary Lock ont
1418
+ *
1419
+ * @param {string} intent - the intent
1420
+ * @param {object} body - body param
1421
+ * @param {getCallback} callback - a callback function to return the result
1422
+ * @return {object} results - An object containing the response of the action
1423
+ *
1424
+ * @route {POST} /lockOnt
1425
+ * @roles admin
1426
+ * @task true
1427
+ */
1428
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1429
+ lockOnt(intent, body, callback) {
1430
+ const meth = 'adapter-lockOnt';
1431
+ const origin = `${this.id}-${meth}`;
1432
+ log.trace(origin);
1433
+
1434
+ if (this.suspended && this.suspendMode === 'error') {
1435
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1436
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1437
+ return callback(null, errorObj);
1438
+ }
1439
+
1440
+ /* HERE IS WHERE YOU VALIDATE DATA */
1441
+ if (intent === undefined || intent === null || intent === '') {
1442
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
1443
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1444
+ return callback(null, errorObj);
1445
+ }
1446
+ if (body === undefined || body === null || body === '') {
1447
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1448
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1449
+ return callback(null, errorObj);
1450
+ }
1451
+
1452
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1453
+ const queryParamsAvailable = {};
1454
+ const queryParams = {};
1455
+ const pathVars = [intent];
1456
+ const bodyVars = body;
1457
+
1458
+ // loop in template. long callback arg name to avoid identifier conflicts
1459
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1460
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1461
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1462
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1463
+ }
1464
+ });
1465
+
1466
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1467
+ // see adapter code documentation for more information on the request object's fields
1468
+ const reqObj = {
1469
+ payload: bodyVars,
1470
+ uriPathVars: pathVars,
1471
+ uriQuery: queryParams
1472
+ };
1473
+
1474
+ try {
1475
+ // Make the call -
1476
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1477
+ return this.requestHandlerInst.identifyRequest('Intent', 'lockOnt', reqObj, false, (irReturnData, irReturnError) => {
1478
+ // if we received an error or their is no response on the results
1479
+ // return an error
1480
+ if (irReturnError) {
1481
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1482
+ return callback(null, irReturnError);
1483
+ }
1484
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1485
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['lockOnt'], null, null, null);
1486
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1487
+ return callback(null, errorObj);
1488
+ }
1489
+
1490
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1491
+ // return the response
1492
+ return callback(irReturnData, null);
1493
+ });
1494
+ } catch (ex) {
1495
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1496
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1497
+ return callback(null, errorObj);
1498
+ }
1499
+ }
1500
+
1501
+ /**
1502
+ * @function deleteOnt
1503
+ * @pronghornType method
1504
+ * @name deleteOnt
1505
+ * @summary Delete ont
1506
+ *
1507
+ * @param {string} intent - the intent
1508
+ * @param {getCallback} callback - a callback function to return the result
1509
+ * @return {object} results - An object containing the response of the action
1510
+ *
1511
+ * @route {POST} /deleteOnt
1512
+ * @roles admin
1513
+ * @task true
1514
+ */
1515
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1516
+ deleteOnt(intent, callback) {
1517
+ const meth = 'adapter-deleteOnt';
1518
+ const origin = `${this.id}-${meth}`;
1519
+ log.trace(origin);
1520
+
1521
+ if (this.suspended && this.suspendMode === 'error') {
1522
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1523
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1524
+ return callback(null, errorObj);
1525
+ }
1526
+
1527
+ /* HERE IS WHERE YOU VALIDATE DATA */
1528
+ if (intent === undefined || intent === null || intent === '') {
1529
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
1530
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1531
+ return callback(null, errorObj);
1532
+ }
1533
+
1534
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1535
+ const queryParamsAvailable = {};
1536
+ const queryParams = {};
1537
+ const pathVars = [intent];
1538
+ const bodyVars = {};
1539
+
1540
+ // loop in template. long callback arg name to avoid identifier conflicts
1541
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1542
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1543
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1544
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1545
+ }
1546
+ });
1547
+
1548
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1549
+ // see adapter code documentation for more information on the request object's fields
1550
+ const reqObj = {
1551
+ payload: bodyVars,
1552
+ uriPathVars: pathVars,
1553
+ uriQuery: queryParams
1554
+ };
1555
+
1556
+ try {
1557
+ // Make the call -
1558
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1559
+ return this.requestHandlerInst.identifyRequest('Intent', 'deleteOnt', reqObj, false, (irReturnData, irReturnError) => {
1560
+ // if we received an error or their is no response on the results
1561
+ // return an error
1562
+ if (irReturnError) {
1563
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1564
+ return callback(null, irReturnError);
1565
+ }
1566
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1567
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteOnt'], null, null, null);
1568
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1569
+ return callback(null, errorObj);
1570
+ }
1571
+
1572
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1573
+ // return the response
1574
+ return callback(irReturnData, null);
1575
+ });
1576
+ } catch (ex) {
1577
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1578
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1579
+ return callback(null, errorObj);
1580
+ }
1581
+ }
1582
+
1583
+ /**
1584
+ * @function synchronizeOnt
1585
+ * @pronghornType method
1586
+ * @name synchronizeOnt
1587
+ * @summary Synchronize ont
1588
+ *
1589
+ * @param {string} intent - the intent
1590
+ * @param {getCallback} callback - a callback function to return the result
1591
+ * @return {object} results - An object containing the response of the action
1592
+ *
1593
+ * @route {POST} /synchronizeOnt
1594
+ * @roles admin
1595
+ * @task true
1596
+ */
1597
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1598
+ synchronizeOnt(intent, callback) {
1599
+ const meth = 'adapter-synchronizeOnt';
1600
+ const origin = `${this.id}-${meth}`;
1601
+ log.trace(origin);
1602
+
1603
+ if (this.suspended && this.suspendMode === 'error') {
1604
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1605
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1606
+ return callback(null, errorObj);
1607
+ }
1608
+
1609
+ /* HERE IS WHERE YOU VALIDATE DATA */
1610
+ if (intent === undefined || intent === null || intent === '') {
1611
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
1612
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1613
+ return callback(null, errorObj);
1614
+ }
1615
+
1616
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1617
+ const queryParamsAvailable = {};
1618
+ const queryParams = {};
1619
+ const pathVars = [intent];
1620
+ const bodyVars = {};
1621
+
1622
+ // loop in template. long callback arg name to avoid identifier conflicts
1623
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1624
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1625
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1626
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1627
+ }
1628
+ });
1629
+
1630
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1631
+ // see adapter code documentation for more information on the request object's fields
1632
+ const reqObj = {
1633
+ payload: bodyVars,
1634
+ uriPathVars: pathVars,
1635
+ uriQuery: queryParams
1636
+ };
1637
+
1638
+ try {
1639
+ // Make the call -
1640
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1641
+ return this.requestHandlerInst.identifyRequest('Intent', 'synchronizeOnt', reqObj, true, (irReturnData, irReturnError) => {
1642
+ // if we received an error or their is no response on the results
1643
+ // return an error
1644
+ if (irReturnError) {
1645
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1646
+ return callback(null, irReturnError);
1647
+ }
1648
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1649
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['synchronizeOnt'], null, null, null);
1650
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1651
+ return callback(null, errorObj);
1652
+ }
1653
+
1654
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1655
+ // return the response
1656
+ return callback(irReturnData, null);
1657
+ });
1658
+ } catch (ex) {
1659
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1660
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1661
+ return callback(null, errorObj);
1662
+ }
1663
+ }
1664
+
1665
+ /**
1666
+ * @function auditOnt
1667
+ * @pronghornType method
1668
+ * @name auditOnt
1669
+ * @summary Audit ont
1670
+ *
1671
+ * @param {string} intent - the intent
1672
+ * @param {getCallback} callback - a callback function to return the result
1673
+ * @return {object} results - An object containing the response of the action
1674
+ *
1675
+ * @route {POST} /auditOnt
1676
+ * @roles admin
1677
+ * @task true
1678
+ */
1679
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1680
+ auditOnt(intent, callback) {
1681
+ const meth = 'adapter-auditOnt';
1682
+ const origin = `${this.id}-${meth}`;
1683
+ log.trace(origin);
1684
+
1685
+ if (this.suspended && this.suspendMode === 'error') {
1686
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1687
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1688
+ return callback(null, errorObj);
1689
+ }
1690
+
1691
+ /* HERE IS WHERE YOU VALIDATE DATA */
1692
+ if (intent === undefined || intent === null || intent === '') {
1693
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
1694
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1695
+ return callback(null, errorObj);
1696
+ }
1697
+
1698
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1699
+ const queryParamsAvailable = {};
1700
+ const queryParams = {};
1701
+ const pathVars = [intent];
1702
+ const bodyVars = {};
1218
1703
 
1219
1704
  // loop in template. long callback arg name to avoid identifier conflicts
1220
1705
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
@@ -1235,7 +1720,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1235
1720
  try {
1236
1721
  // Make the call -
1237
1722
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1238
- return this.requestHandlerInst.identifyRequest('Intent', 'getuplinkConnectionConfiguration', reqObj, true, (irReturnData, irReturnError) => {
1723
+ return this.requestHandlerInst.identifyRequest('Intent', 'auditOnt', reqObj, true, (irReturnData, irReturnError) => {
1239
1724
  // if we received an error or their is no response on the results
1240
1725
  // return an error
1241
1726
  if (irReturnError) {
@@ -1243,7 +1728,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1243
1728
  return callback(null, irReturnError);
1244
1729
  }
1245
1730
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1246
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getuplinkConnectionConfiguration'], null, null, null);
1731
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['auditOnt'], null, null, null);
1247
1732
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1248
1733
  return callback(null, errorObj);
1249
1734
  }
@@ -1260,22 +1745,22 @@ class NokiaAltiplano extends AdapterBaseCl {
1260
1745
  }
1261
1746
 
1262
1747
  /**
1263
- * @function dependentsSummaryFiber
1748
+ * @function synchronizel2User
1264
1749
  * @pronghornType method
1265
- * @name dependentsSummaryFiber
1266
- * @summary Dependents summary fiber
1750
+ * @name synchronizel2User
1751
+ * @summary Synchronize l2-user
1267
1752
  *
1268
1753
  * @param {string} intent - the intent
1269
1754
  * @param {getCallback} callback - a callback function to return the result
1270
1755
  * @return {object} results - An object containing the response of the action
1271
1756
  *
1272
- * @route {POST} /dependentsSummaryFiber
1757
+ * @route {POST} /synchronizel2User
1273
1758
  * @roles admin
1274
1759
  * @task true
1275
1760
  */
1276
1761
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1277
- dependentsSummaryFiber(intent, callback) {
1278
- const meth = 'adapter-dependentsSummaryFiber';
1762
+ synchronizel2User(intent, callback) {
1763
+ const meth = 'adapter-synchronizel2User';
1279
1764
  const origin = `${this.id}-${meth}`;
1280
1765
  log.trace(origin);
1281
1766
 
@@ -1317,7 +1802,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1317
1802
  try {
1318
1803
  // Make the call -
1319
1804
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1320
- return this.requestHandlerInst.identifyRequest('Intent', 'dependentsSummaryFiber', reqObj, true, (irReturnData, irReturnError) => {
1805
+ return this.requestHandlerInst.identifyRequest('Intent', 'synchronizel2User', reqObj, true, (irReturnData, irReturnError) => {
1321
1806
  // if we received an error or their is no response on the results
1322
1807
  // return an error
1323
1808
  if (irReturnError) {
@@ -1325,7 +1810,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1325
1810
  return callback(null, irReturnError);
1326
1811
  }
1327
1812
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1328
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['dependentsSummaryFiber'], null, null, null);
1813
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['synchronizel2User'], null, null, null);
1329
1814
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1330
1815
  return callback(null, errorObj);
1331
1816
  }
@@ -1342,22 +1827,22 @@ class NokiaAltiplano extends AdapterBaseCl {
1342
1827
  }
1343
1828
 
1344
1829
  /**
1345
- * @function createOnt
1830
+ * @function getl2User
1346
1831
  * @pronghornType method
1347
- * @name createOnt
1348
- * @summary Create ont
1832
+ * @name getl2User
1833
+ * @summary GET l2-user
1349
1834
  *
1350
- * @param {object} body - body param
1835
+ * @param {string} intent - the intent
1351
1836
  * @param {getCallback} callback - a callback function to return the result
1352
1837
  * @return {object} results - An object containing the response of the action
1353
1838
  *
1354
- * @route {POST} /createOnt
1839
+ * @route {POST} /getl2User
1355
1840
  * @roles admin
1356
1841
  * @task true
1357
1842
  */
1358
1843
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1359
- createOnt(body, callback) {
1360
- const meth = 'adapter-createOnt';
1844
+ getl2User(intent, callback) {
1845
+ const meth = 'adapter-getl2User';
1361
1846
  const origin = `${this.id}-${meth}`;
1362
1847
  log.trace(origin);
1363
1848
 
@@ -1368,8 +1853,8 @@ class NokiaAltiplano extends AdapterBaseCl {
1368
1853
  }
1369
1854
 
1370
1855
  /* HERE IS WHERE YOU VALIDATE DATA */
1371
- if (body === undefined || body === null || body === '') {
1372
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1856
+ if (intent === undefined || intent === null || intent === '') {
1857
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
1373
1858
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1374
1859
  return callback(null, errorObj);
1375
1860
  }
@@ -1377,8 +1862,8 @@ class NokiaAltiplano extends AdapterBaseCl {
1377
1862
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1378
1863
  const queryParamsAvailable = {};
1379
1864
  const queryParams = {};
1380
- const pathVars = [];
1381
- const bodyVars = body;
1865
+ const pathVars = [intent];
1866
+ const bodyVars = {};
1382
1867
 
1383
1868
  // loop in template. long callback arg name to avoid identifier conflicts
1384
1869
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
@@ -1399,7 +1884,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1399
1884
  try {
1400
1885
  // Make the call -
1401
1886
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1402
- return this.requestHandlerInst.identifyRequest('Intent', 'createOnt', reqObj, true, (irReturnData, irReturnError) => {
1887
+ return this.requestHandlerInst.identifyRequest('Intent', 'getl2User', reqObj, true, (irReturnData, irReturnError) => {
1403
1888
  // if we received an error or their is no response on the results
1404
1889
  // return an error
1405
1890
  if (irReturnError) {
@@ -1407,7 +1892,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1407
1892
  return callback(null, irReturnError);
1408
1893
  }
1409
1894
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1410
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createOnt'], null, null, null);
1895
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getl2User'], null, null, null);
1411
1896
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1412
1897
  return callback(null, errorObj);
1413
1898
  }
@@ -1424,23 +1909,23 @@ class NokiaAltiplano extends AdapterBaseCl {
1424
1909
  }
1425
1910
 
1426
1911
  /**
1427
- * @function createOntWithQuery
1912
+ * @function modifyl2User
1428
1913
  * @pronghornType method
1429
- * @name createOntWithQuery
1430
- * @summary Create ont with query params
1914
+ * @name modifyl2User
1915
+ * @summary Modify l2-user
1431
1916
  *
1917
+ * @param {string} intent - the intent
1432
1918
  * @param {object} body - body param
1433
- * @param {object} query - query param
1434
1919
  * @param {getCallback} callback - a callback function to return the result
1435
1920
  * @return {object} results - An object containing the response of the action
1436
1921
  *
1437
- * @route {POST} /createOntWithQuery
1922
+ * @route {POST} /modifyl2User
1438
1923
  * @roles admin
1439
1924
  * @task true
1440
1925
  */
1441
1926
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1442
- createOntWithQuery(body, query, callback) {
1443
- const meth = 'adapter-createOntWithQuery';
1927
+ modifyl2User(intent, body, callback) {
1928
+ const meth = 'adapter-modifyl2User';
1444
1929
  const origin = `${this.id}-${meth}`;
1445
1930
  log.trace(origin);
1446
1931
 
@@ -1451,6 +1936,11 @@ class NokiaAltiplano extends AdapterBaseCl {
1451
1936
  }
1452
1937
 
1453
1938
  /* HERE IS WHERE YOU VALIDATE DATA */
1939
+ if (intent === undefined || intent === null || intent === '') {
1940
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
1941
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1942
+ return callback(null, errorObj);
1943
+ }
1454
1944
  if (body === undefined || body === null || body === '') {
1455
1945
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1456
1946
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
@@ -1458,9 +1948,9 @@ class NokiaAltiplano extends AdapterBaseCl {
1458
1948
  }
1459
1949
 
1460
1950
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1461
- const queryParamsAvailable = query;
1951
+ const queryParamsAvailable = {};
1462
1952
  const queryParams = {};
1463
- const pathVars = [];
1953
+ const pathVars = [intent];
1464
1954
  const bodyVars = body;
1465
1955
 
1466
1956
  // loop in template. long callback arg name to avoid identifier conflicts
@@ -1482,7 +1972,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1482
1972
  try {
1483
1973
  // Make the call -
1484
1974
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1485
- return this.requestHandlerInst.identifyRequest('Intent', 'createOnt', reqObj, true, (irReturnData, irReturnError) => {
1975
+ return this.requestHandlerInst.identifyRequest('Intent', 'modifyl2User', reqObj, false, (irReturnData, irReturnError) => {
1486
1976
  // if we received an error or their is no response on the results
1487
1977
  // return an error
1488
1978
  if (irReturnError) {
@@ -1490,7 +1980,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1490
1980
  return callback(null, irReturnError);
1491
1981
  }
1492
1982
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1493
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createOntWithQuery'], null, null, null);
1983
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['modifyl2User'], null, null, null);
1494
1984
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1495
1985
  return callback(null, errorObj);
1496
1986
  }
@@ -1507,22 +1997,22 @@ class NokiaAltiplano extends AdapterBaseCl {
1507
1997
  }
1508
1998
 
1509
1999
  /**
1510
- * @function getOnt
2000
+ * @function deletel2User
1511
2001
  * @pronghornType method
1512
- * @name getOnt
1513
- * @summary GET ont
2002
+ * @name deletel2User
2003
+ * @summary Delete l2-user
1514
2004
  *
1515
2005
  * @param {string} intent - the intent
1516
2006
  * @param {getCallback} callback - a callback function to return the result
1517
2007
  * @return {object} results - An object containing the response of the action
1518
2008
  *
1519
- * @route {POST} /getOnt
2009
+ * @route {POST} /deletel2User
1520
2010
  * @roles admin
1521
2011
  * @task true
1522
2012
  */
1523
2013
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1524
- getOnt(intent, callback) {
1525
- const meth = 'adapter-getOnt';
2014
+ deletel2User(intent, callback) {
2015
+ const meth = 'adapter-deletel2User';
1526
2016
  const origin = `${this.id}-${meth}`;
1527
2017
  log.trace(origin);
1528
2018
 
@@ -1564,7 +2054,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1564
2054
  try {
1565
2055
  // Make the call -
1566
2056
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1567
- return this.requestHandlerInst.identifyRequest('Intent', 'getOnt', reqObj, true, (irReturnData, irReturnError) => {
2057
+ return this.requestHandlerInst.identifyRequest('Intent', 'deletel2User', reqObj, false, (irReturnData, irReturnError) => {
1568
2058
  // if we received an error or their is no response on the results
1569
2059
  // return an error
1570
2060
  if (irReturnError) {
@@ -1572,7 +2062,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1572
2062
  return callback(null, irReturnError);
1573
2063
  }
1574
2064
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1575
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getOnt'], null, null, null);
2065
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deletel2User'], null, null, null);
1576
2066
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1577
2067
  return callback(null, errorObj);
1578
2068
  }
@@ -1589,23 +2079,22 @@ class NokiaAltiplano extends AdapterBaseCl {
1589
2079
  }
1590
2080
 
1591
2081
  /**
1592
- * @function lockOnt
2082
+ * @function auditl2User
1593
2083
  * @pronghornType method
1594
- * @name lockOnt
1595
- * @summary Lock ont
2084
+ * @name auditl2User
2085
+ * @summary Audit l2-user
1596
2086
  *
1597
2087
  * @param {string} intent - the intent
1598
- * @param {object} body - body param
1599
2088
  * @param {getCallback} callback - a callback function to return the result
1600
2089
  * @return {object} results - An object containing the response of the action
1601
2090
  *
1602
- * @route {POST} /lockOnt
2091
+ * @route {POST} /auditl2User
1603
2092
  * @roles admin
1604
2093
  * @task true
1605
2094
  */
1606
2095
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1607
- lockOnt(intent, body, callback) {
1608
- const meth = 'adapter-lockOnt';
2096
+ auditl2User(intent, callback) {
2097
+ const meth = 'adapter-auditl2User';
1609
2098
  const origin = `${this.id}-${meth}`;
1610
2099
  log.trace(origin);
1611
2100
 
@@ -1621,17 +2110,12 @@ class NokiaAltiplano extends AdapterBaseCl {
1621
2110
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1622
2111
  return callback(null, errorObj);
1623
2112
  }
1624
- if (body === undefined || body === null || body === '') {
1625
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1626
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1627
- return callback(null, errorObj);
1628
- }
1629
2113
 
1630
2114
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1631
2115
  const queryParamsAvailable = {};
1632
2116
  const queryParams = {};
1633
2117
  const pathVars = [intent];
1634
- const bodyVars = body;
2118
+ const bodyVars = {};
1635
2119
 
1636
2120
  // loop in template. long callback arg name to avoid identifier conflicts
1637
2121
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
@@ -1652,7 +2136,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1652
2136
  try {
1653
2137
  // Make the call -
1654
2138
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1655
- return this.requestHandlerInst.identifyRequest('Intent', 'lockOnt', reqObj, false, (irReturnData, irReturnError) => {
2139
+ return this.requestHandlerInst.identifyRequest('Intent', 'auditl2User', reqObj, true, (irReturnData, irReturnError) => {
1656
2140
  // if we received an error or their is no response on the results
1657
2141
  // return an error
1658
2142
  if (irReturnError) {
@@ -1660,7 +2144,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1660
2144
  return callback(null, irReturnError);
1661
2145
  }
1662
2146
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1663
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['lockOnt'], null, null, null);
2147
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['auditl2User'], null, null, null);
1664
2148
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1665
2149
  return callback(null, errorObj);
1666
2150
  }
@@ -1677,22 +2161,22 @@ class NokiaAltiplano extends AdapterBaseCl {
1677
2161
  }
1678
2162
 
1679
2163
  /**
1680
- * @function deleteOnt
2164
+ * @function getIbnIntent
1681
2165
  * @pronghornType method
1682
- * @name deleteOnt
1683
- * @summary Delete ont
2166
+ * @name getIbnIntent
2167
+ * @summary GET ibn intent
1684
2168
  *
1685
- * @param {string} intent - the intent
2169
+ * @param {string} intent - the intent value, type (MYINTONT1,ont)
1686
2170
  * @param {getCallback} callback - a callback function to return the result
1687
2171
  * @return {object} results - An object containing the response of the action
1688
2172
  *
1689
- * @route {POST} /deleteOnt
2173
+ * @route {POST} /getIbnIntent
1690
2174
  * @roles admin
1691
2175
  * @task true
1692
2176
  */
1693
2177
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1694
- deleteOnt(intent, callback) {
1695
- const meth = 'adapter-deleteOnt';
2178
+ getIbnIntent(intent, callback) {
2179
+ const meth = 'adapter-getIbnIntent';
1696
2180
  const origin = `${this.id}-${meth}`;
1697
2181
  log.trace(origin);
1698
2182
 
@@ -1708,11 +2192,15 @@ class NokiaAltiplano extends AdapterBaseCl {
1708
2192
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1709
2193
  return callback(null, errorObj);
1710
2194
  }
2195
+ let newIntent = intent;
2196
+ if (intent.indexOf('intent=') !== 0) {
2197
+ newIntent = `intent=${intent}`;
2198
+ }
1711
2199
 
1712
2200
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1713
2201
  const queryParamsAvailable = {};
1714
2202
  const queryParams = {};
1715
- const pathVars = [intent];
2203
+ const pathVars = [newIntent];
1716
2204
  const bodyVars = {};
1717
2205
 
1718
2206
  // loop in template. long callback arg name to avoid identifier conflicts
@@ -1734,7 +2222,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1734
2222
  try {
1735
2223
  // Make the call -
1736
2224
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1737
- return this.requestHandlerInst.identifyRequest('Intent', 'deleteOnt', reqObj, false, (irReturnData, irReturnError) => {
2225
+ return this.requestHandlerInst.identifyRequest('Intent', 'getIbnIntent', reqObj, true, (irReturnData, irReturnError) => {
1738
2226
  // if we received an error or their is no response on the results
1739
2227
  // return an error
1740
2228
  if (irReturnError) {
@@ -1742,7 +2230,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1742
2230
  return callback(null, irReturnError);
1743
2231
  }
1744
2232
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1745
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteOnt'], null, null, null);
2233
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getIbnIntent'], null, null, null);
1746
2234
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1747
2235
  return callback(null, errorObj);
1748
2236
  }
@@ -1759,22 +2247,23 @@ class NokiaAltiplano extends AdapterBaseCl {
1759
2247
  }
1760
2248
 
1761
2249
  /**
1762
- * @function synchronizeOnt
2250
+ * @function modifyIbnIntent
1763
2251
  * @pronghornType method
1764
- * @name synchronizeOnt
1765
- * @summary Synchronize ont
2252
+ * @name modifyIbnIntent
2253
+ * @summary Modify ibn intent
1766
2254
  *
1767
- * @param {string} intent - the intent
2255
+ * @param {string} intent - the intent value, type (MYINTONT1,ont)
2256
+ * @param {object} body - body param
1768
2257
  * @param {getCallback} callback - a callback function to return the result
1769
2258
  * @return {object} results - An object containing the response of the action
1770
2259
  *
1771
- * @route {POST} /synchronizeOnt
2260
+ * @route {POST} /modifyIbnIntent
1772
2261
  * @roles admin
1773
2262
  * @task true
1774
2263
  */
1775
2264
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1776
- synchronizeOnt(intent, callback) {
1777
- const meth = 'adapter-synchronizeOnt';
2265
+ modifyIbnIntent(intent, body, callback) {
2266
+ const meth = 'adapter-modifyIbnIntent';
1778
2267
  const origin = `${this.id}-${meth}`;
1779
2268
  log.trace(origin);
1780
2269
 
@@ -1790,12 +2279,21 @@ class NokiaAltiplano extends AdapterBaseCl {
1790
2279
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1791
2280
  return callback(null, errorObj);
1792
2281
  }
2282
+ if (body === undefined || body === null || body === '') {
2283
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
2284
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2285
+ return callback(null, errorObj);
2286
+ }
2287
+ let newIntent = intent;
2288
+ if (intent.indexOf('intent=') !== 0) {
2289
+ newIntent = `intent=${intent}`;
2290
+ }
1793
2291
 
1794
2292
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1795
2293
  const queryParamsAvailable = {};
1796
2294
  const queryParams = {};
1797
- const pathVars = [intent];
1798
- const bodyVars = {};
2295
+ const pathVars = [newIntent];
2296
+ const bodyVars = body;
1799
2297
 
1800
2298
  // loop in template. long callback arg name to avoid identifier conflicts
1801
2299
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
@@ -1816,7 +2314,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1816
2314
  try {
1817
2315
  // Make the call -
1818
2316
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1819
- return this.requestHandlerInst.identifyRequest('Intent', 'synchronizeOnt', reqObj, true, (irReturnData, irReturnError) => {
2317
+ return this.requestHandlerInst.identifyRequest('Intent', 'modifyIbnIntent', reqObj, false, (irReturnData, irReturnError) => {
1820
2318
  // if we received an error or their is no response on the results
1821
2319
  // return an error
1822
2320
  if (irReturnError) {
@@ -1824,7 +2322,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1824
2322
  return callback(null, irReturnError);
1825
2323
  }
1826
2324
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1827
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['synchronizeOnt'], null, null, null);
2325
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['modifyIbnIntent'], null, null, null);
1828
2326
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1829
2327
  return callback(null, errorObj);
1830
2328
  }
@@ -1841,22 +2339,23 @@ class NokiaAltiplano extends AdapterBaseCl {
1841
2339
  }
1842
2340
 
1843
2341
  /**
1844
- * @function auditOnt
2342
+ * @function deleteIbnIntent
1845
2343
  * @pronghornType method
1846
- * @name auditOnt
1847
- * @summary Audit ont
2344
+ * @name deleteIbnIntent
2345
+ * @summary Delete ibn intent
1848
2346
  *
1849
- * @param {string} intent - the intent
2347
+ * @param {string} intentType - the intent type (mcast-user)
2348
+ * @param {string} target - the target intent to delete
1850
2349
  * @param {getCallback} callback - a callback function to return the result
1851
2350
  * @return {object} results - An object containing the response of the action
1852
2351
  *
1853
- * @route {POST} /auditOnt
2352
+ * @route {POST} /deleteIbnIntent
1854
2353
  * @roles admin
1855
2354
  * @task true
1856
2355
  */
1857
2356
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1858
- auditOnt(intent, callback) {
1859
- const meth = 'adapter-auditOnt';
2357
+ deleteIbnIntent(intentType, target, callback) {
2358
+ const meth = 'adapter-deleteIbnIntent';
1860
2359
  const origin = `${this.id}-${meth}`;
1861
2360
  log.trace(origin);
1862
2361
 
@@ -1867,8 +2366,13 @@ class NokiaAltiplano extends AdapterBaseCl {
1867
2366
  }
1868
2367
 
1869
2368
  /* HERE IS WHERE YOU VALIDATE DATA */
1870
- if (intent === undefined || intent === null || intent === '') {
1871
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
2369
+ if (intentType === undefined || intentType === null || intentType === '') {
2370
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intentType'], null, null, null);
2371
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2372
+ return callback(null, errorObj);
2373
+ }
2374
+ if (target === undefined || target === null || target === '') {
2375
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['target'], null, null, null);
1872
2376
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1873
2377
  return callback(null, errorObj);
1874
2378
  }
@@ -1876,8 +2380,13 @@ class NokiaAltiplano extends AdapterBaseCl {
1876
2380
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1877
2381
  const queryParamsAvailable = {};
1878
2382
  const queryParams = {};
1879
- const pathVars = [intent];
1880
- const bodyVars = {};
2383
+ const pathVars = [];
2384
+ const bodyVars = {
2385
+ 'ibn:delete-intent-from-network-and-controller': {
2386
+ 'intent-type': intentType,
2387
+ target
2388
+ }
2389
+ };
1881
2390
 
1882
2391
  // loop in template. long callback arg name to avoid identifier conflicts
1883
2392
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
@@ -1898,7 +2407,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1898
2407
  try {
1899
2408
  // Make the call -
1900
2409
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1901
- return this.requestHandlerInst.identifyRequest('Intent', 'auditOnt', reqObj, true, (irReturnData, irReturnError) => {
2410
+ return this.requestHandlerInst.identifyRequest('Intent', 'deleteIbnIntent', reqObj, false, (irReturnData, irReturnError) => {
1902
2411
  // if we received an error or their is no response on the results
1903
2412
  // return an error
1904
2413
  if (irReturnError) {
@@ -1906,7 +2415,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1906
2415
  return callback(null, irReturnError);
1907
2416
  }
1908
2417
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1909
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['auditOnt'], null, null, null);
2418
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteIbnIntent'], null, null, null);
1910
2419
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1911
2420
  return callback(null, errorObj);
1912
2421
  }
@@ -1923,22 +2432,22 @@ class NokiaAltiplano extends AdapterBaseCl {
1923
2432
  }
1924
2433
 
1925
2434
  /**
1926
- * @function synchronizel2User
2435
+ * @function synchronizeIbnIntent
1927
2436
  * @pronghornType method
1928
- * @name synchronizel2User
1929
- * @summary Synchronize l2-user
2437
+ * @name synchronizeIbnIntent
2438
+ * @summary Synchronize ibn intent
1930
2439
  *
1931
- * @param {string} intent - the intent
2440
+ * @param {string} intent - the intent value, type (MYINTONT1,ont)
1932
2441
  * @param {getCallback} callback - a callback function to return the result
1933
2442
  * @return {object} results - An object containing the response of the action
1934
2443
  *
1935
- * @route {POST} /synchronizel2User
2444
+ * @route {POST} /synchronizeIbnIntent
1936
2445
  * @roles admin
1937
2446
  * @task true
1938
2447
  */
1939
2448
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1940
- synchronizel2User(intent, callback) {
1941
- const meth = 'adapter-synchronizel2User';
2449
+ synchronizeIbnIntent(intent, callback) {
2450
+ const meth = 'adapter-synchronizeIbnIntent';
1942
2451
  const origin = `${this.id}-${meth}`;
1943
2452
  log.trace(origin);
1944
2453
 
@@ -1954,11 +2463,15 @@ class NokiaAltiplano extends AdapterBaseCl {
1954
2463
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1955
2464
  return callback(null, errorObj);
1956
2465
  }
2466
+ let newIntent = intent;
2467
+ if (intent.indexOf('intent=') !== 0) {
2468
+ newIntent = `intent=${intent}`;
2469
+ }
1957
2470
 
1958
2471
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1959
2472
  const queryParamsAvailable = {};
1960
2473
  const queryParams = {};
1961
- const pathVars = [intent];
2474
+ const pathVars = [newIntent];
1962
2475
  const bodyVars = {};
1963
2476
 
1964
2477
  // loop in template. long callback arg name to avoid identifier conflicts
@@ -1980,7 +2493,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1980
2493
  try {
1981
2494
  // Make the call -
1982
2495
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1983
- return this.requestHandlerInst.identifyRequest('Intent', 'synchronizel2User', reqObj, true, (irReturnData, irReturnError) => {
2496
+ return this.requestHandlerInst.identifyRequest('Intent', 'synchronizeIbnIntent', reqObj, true, (irReturnData, irReturnError) => {
1984
2497
  // if we received an error or their is no response on the results
1985
2498
  // return an error
1986
2499
  if (irReturnError) {
@@ -1988,7 +2501,7 @@ class NokiaAltiplano extends AdapterBaseCl {
1988
2501
  return callback(null, irReturnError);
1989
2502
  }
1990
2503
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1991
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['synchronizel2User'], null, null, null);
2504
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['synchronizeIbnIntent'], null, null, null);
1992
2505
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1993
2506
  return callback(null, errorObj);
1994
2507
  }
@@ -2005,22 +2518,22 @@ class NokiaAltiplano extends AdapterBaseCl {
2005
2518
  }
2006
2519
 
2007
2520
  /**
2008
- * @function getl2User
2521
+ * @function auditIbnIntent
2009
2522
  * @pronghornType method
2010
- * @name getl2User
2011
- * @summary GET l2-user
2523
+ * @name auditIbnIntent
2524
+ * @summary Audit ibn intent
2012
2525
  *
2013
- * @param {string} intent - the intent
2526
+ * @param {string} intent - the intent value, type (MYINTONT1,ont)
2014
2527
  * @param {getCallback} callback - a callback function to return the result
2015
2528
  * @return {object} results - An object containing the response of the action
2016
2529
  *
2017
- * @route {POST} /getl2User
2530
+ * @route {POST} /auditIbnIntent
2018
2531
  * @roles admin
2019
2532
  * @task true
2020
2533
  */
2021
2534
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2022
- getl2User(intent, callback) {
2023
- const meth = 'adapter-getl2User';
2535
+ auditIbnIntent(intent, callback) {
2536
+ const meth = 'adapter-auditIbnIntent';
2024
2537
  const origin = `${this.id}-${meth}`;
2025
2538
  log.trace(origin);
2026
2539
 
@@ -2036,11 +2549,15 @@ class NokiaAltiplano extends AdapterBaseCl {
2036
2549
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2037
2550
  return callback(null, errorObj);
2038
2551
  }
2552
+ let newIntent = intent;
2553
+ if (intent.indexOf('intent=') !== 0) {
2554
+ newIntent = `intent=${intent}`;
2555
+ }
2039
2556
 
2040
2557
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2041
2558
  const queryParamsAvailable = {};
2042
2559
  const queryParams = {};
2043
- const pathVars = [intent];
2560
+ const pathVars = [newIntent];
2044
2561
  const bodyVars = {};
2045
2562
 
2046
2563
  // loop in template. long callback arg name to avoid identifier conflicts
@@ -2062,7 +2579,7 @@ class NokiaAltiplano extends AdapterBaseCl {
2062
2579
  try {
2063
2580
  // Make the call -
2064
2581
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2065
- return this.requestHandlerInst.identifyRequest('Intent', 'getl2User', reqObj, true, (irReturnData, irReturnError) => {
2582
+ return this.requestHandlerInst.identifyRequest('Intent', 'auditIbnIntent', reqObj, true, (irReturnData, irReturnError) => {
2066
2583
  // if we received an error or their is no response on the results
2067
2584
  // return an error
2068
2585
  if (irReturnError) {
@@ -2070,7 +2587,7 @@ class NokiaAltiplano extends AdapterBaseCl {
2070
2587
  return callback(null, irReturnError);
2071
2588
  }
2072
2589
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2073
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getl2User'], null, null, null);
2590
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['auditIbnIntent'], null, null, null);
2074
2591
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2075
2592
  return callback(null, errorObj);
2076
2593
  }
@@ -2087,23 +2604,26 @@ class NokiaAltiplano extends AdapterBaseCl {
2087
2604
  }
2088
2605
 
2089
2606
  /**
2090
- * @function modifyl2User
2607
+ * @function getEntityOntView
2091
2608
  * @pronghornType method
2092
- * @name modifyl2User
2093
- * @summary Modify l2-user
2609
+ * @name getEntityOntView
2610
+ * @summary Get ONT Network View
2094
2611
  *
2095
- * @param {string} intent - the intent
2096
- * @param {object} body - body param
2612
+ * @param {string} isamVer - the ISAM Version
2613
+ * @param {string} shelfName - the Shelf Name
2614
+ * @param {string} demark - the Demark
2615
+ * @param {boolean} child - is this a child (default false)
2616
+ * @param {boolean} one - should there be only one (default true)
2097
2617
  * @param {getCallback} callback - a callback function to return the result
2098
2618
  * @return {object} results - An object containing the response of the action
2099
2619
  *
2100
- * @route {POST} /modifyl2User
2620
+ * @route {POST} /getEntityOntView
2101
2621
  * @roles admin
2102
2622
  * @task true
2103
2623
  */
2104
2624
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2105
- modifyl2User(intent, body, callback) {
2106
- const meth = 'adapter-modifyl2User';
2625
+ getEntityOntView(isamVer, shelfName, demark, child, one, callback) {
2626
+ const meth = 'adapter-getEntityOntView';
2107
2627
  const origin = `${this.id}-${meth}`;
2108
2628
  log.trace(origin);
2109
2629
 
@@ -2114,22 +2634,35 @@ class NokiaAltiplano extends AdapterBaseCl {
2114
2634
  }
2115
2635
 
2116
2636
  /* HERE IS WHERE YOU VALIDATE DATA */
2117
- if (intent === undefined || intent === null || intent === '') {
2118
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
2637
+ if (isamVer === undefined || isamVer === null || isamVer === '') {
2638
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['isamVer'], null, null, null);
2119
2639
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2120
2640
  return callback(null, errorObj);
2121
2641
  }
2122
- if (body === undefined || body === null || body === '') {
2123
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
2642
+ if (shelfName === undefined || shelfName === null || shelfName === '') {
2643
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['shelfName'], null, null, null);
2644
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2645
+ return callback(null, errorObj);
2646
+ }
2647
+ if (demark === undefined || demark === null || demark === '') {
2648
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['demark'], null, null, null);
2124
2649
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2125
2650
  return callback(null, errorObj);
2126
2651
  }
2652
+ let isChild = false;
2653
+ if (child !== null && child !== undefined && child === true) {
2654
+ isChild = true;
2655
+ }
2656
+ let isOne = true;
2657
+ if (one !== null && one !== undefined && one === false) {
2658
+ isOne = false;
2659
+ }
2127
2660
 
2128
2661
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2129
- const queryParamsAvailable = {};
2662
+ const queryParamsAvailable = { isChild, isOne };
2130
2663
  const queryParams = {};
2131
- const pathVars = [intent];
2132
- const bodyVars = body;
2664
+ const pathVars = [isamVer, shelfName, demark];
2665
+ const bodyVars = {};
2133
2666
 
2134
2667
  // loop in template. long callback arg name to avoid identifier conflicts
2135
2668
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
@@ -2150,7 +2683,7 @@ class NokiaAltiplano extends AdapterBaseCl {
2150
2683
  try {
2151
2684
  // Make the call -
2152
2685
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2153
- return this.requestHandlerInst.identifyRequest('Intent', 'modifyl2User', reqObj, false, (irReturnData, irReturnError) => {
2686
+ return this.requestHandlerInst.identifyRequest('Entity', 'getEntityOntView', reqObj, true, (irReturnData, irReturnError) => {
2154
2687
  // if we received an error or their is no response on the results
2155
2688
  // return an error
2156
2689
  if (irReturnError) {
@@ -2158,7 +2691,7 @@ class NokiaAltiplano extends AdapterBaseCl {
2158
2691
  return callback(null, irReturnError);
2159
2692
  }
2160
2693
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2161
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['modifyl2User'], null, null, null);
2694
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getEntityOntView'], null, null, null);
2162
2695
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2163
2696
  return callback(null, errorObj);
2164
2697
  }
@@ -2175,22 +2708,26 @@ class NokiaAltiplano extends AdapterBaseCl {
2175
2708
  }
2176
2709
 
2177
2710
  /**
2178
- * @function deletel2User
2711
+ * @function getEntityOntPort
2179
2712
  * @pronghornType method
2180
- * @name deletel2User
2181
- * @summary Delete l2-user
2713
+ * @name getEntityOntPort
2714
+ * @summary Get ONT Port
2182
2715
  *
2183
- * @param {string} intent - the intent
2716
+ * @param {string} isamVer - the ISAM Version
2717
+ * @param {string} shelfName - the Shelf Name
2718
+ * @param {string} demark - the Demark
2719
+ * @param {boolean} child - is this a child (default false)
2720
+ * @param {boolean} one - should there be only one (default true)
2184
2721
  * @param {getCallback} callback - a callback function to return the result
2185
2722
  * @return {object} results - An object containing the response of the action
2186
2723
  *
2187
- * @route {POST} /deletel2User
2724
+ * @route {POST} /getEntityOntPort
2188
2725
  * @roles admin
2189
2726
  * @task true
2190
2727
  */
2191
2728
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2192
- deletel2User(intent, callback) {
2193
- const meth = 'adapter-deletel2User';
2729
+ getEntityOntPort(isamVer, shelfName, demark, child, one, callback) {
2730
+ const meth = 'adapter-getEntityOntPort';
2194
2731
  const origin = `${this.id}-${meth}`;
2195
2732
  log.trace(origin);
2196
2733
 
@@ -2201,16 +2738,34 @@ class NokiaAltiplano extends AdapterBaseCl {
2201
2738
  }
2202
2739
 
2203
2740
  /* HERE IS WHERE YOU VALIDATE DATA */
2204
- if (intent === undefined || intent === null || intent === '') {
2205
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
2741
+ if (isamVer === undefined || isamVer === null || isamVer === '') {
2742
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['isamVer'], null, null, null);
2743
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2744
+ return callback(null, errorObj);
2745
+ }
2746
+ if (shelfName === undefined || shelfName === null || shelfName === '') {
2747
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['shelfName'], null, null, null);
2748
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2749
+ return callback(null, errorObj);
2750
+ }
2751
+ if (demark === undefined || demark === null || demark === '') {
2752
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['demark'], null, null, null);
2206
2753
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2207
2754
  return callback(null, errorObj);
2208
2755
  }
2756
+ let isChild = false;
2757
+ if (child !== null && child !== undefined && child === true) {
2758
+ isChild = true;
2759
+ }
2760
+ let isOne = true;
2761
+ if (one !== null && one !== undefined && one === false) {
2762
+ isOne = false;
2763
+ }
2209
2764
 
2210
2765
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2211
- const queryParamsAvailable = {};
2766
+ const queryParamsAvailable = { isChild, isOne };
2212
2767
  const queryParams = {};
2213
- const pathVars = [intent];
2768
+ const pathVars = [isamVer, shelfName, demark];
2214
2769
  const bodyVars = {};
2215
2770
 
2216
2771
  // loop in template. long callback arg name to avoid identifier conflicts
@@ -2232,7 +2787,7 @@ class NokiaAltiplano extends AdapterBaseCl {
2232
2787
  try {
2233
2788
  // Make the call -
2234
2789
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2235
- return this.requestHandlerInst.identifyRequest('Intent', 'deletel2User', reqObj, false, (irReturnData, irReturnError) => {
2790
+ return this.requestHandlerInst.identifyRequest('Entity', 'getEntityOntPort', reqObj, true, (irReturnData, irReturnError) => {
2236
2791
  // if we received an error or their is no response on the results
2237
2792
  // return an error
2238
2793
  if (irReturnError) {
@@ -2240,7 +2795,7 @@ class NokiaAltiplano extends AdapterBaseCl {
2240
2795
  return callback(null, irReturnError);
2241
2796
  }
2242
2797
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2243
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deletel2User'], null, null, null);
2798
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getEntityOntPort'], null, null, null);
2244
2799
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2245
2800
  return callback(null, errorObj);
2246
2801
  }
@@ -2257,22 +2812,26 @@ class NokiaAltiplano extends AdapterBaseCl {
2257
2812
  }
2258
2813
 
2259
2814
  /**
2260
- * @function auditl2User
2815
+ * @function getEntityOntVlanAssociation
2261
2816
  * @pronghornType method
2262
- * @name auditl2User
2263
- * @summary Audit l2-user
2817
+ * @name getEntityOntVlanAssociation
2818
+ * @summary Get ONT Vlan Association
2264
2819
  *
2265
- * @param {string} intent - the intent
2820
+ * @param {string} isamVer - the ISAM Version
2821
+ * @param {string} shelfName - the Shelf Name
2822
+ * @param {string} vlanAssociation - the VLAN Association
2823
+ * @param {boolean} child - is this a child (default false)
2824
+ * @param {boolean} one - should there be only one (default true)
2266
2825
  * @param {getCallback} callback - a callback function to return the result
2267
2826
  * @return {object} results - An object containing the response of the action
2268
2827
  *
2269
- * @route {POST} /auditl2User
2828
+ * @route {POST} /getEntityOntVlanAssociation
2270
2829
  * @roles admin
2271
2830
  * @task true
2272
2831
  */
2273
2832
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
2274
- auditl2User(intent, callback) {
2275
- const meth = 'adapter-auditl2User';
2833
+ getEntityOntVlanAssociation(isamVer, shelfName, vlanAssociation, child, one, callback) {
2834
+ const meth = 'adapter-getEntityOntVlanAssociation';
2276
2835
  const origin = `${this.id}-${meth}`;
2277
2836
  log.trace(origin);
2278
2837
 
@@ -2283,16 +2842,34 @@ class NokiaAltiplano extends AdapterBaseCl {
2283
2842
  }
2284
2843
 
2285
2844
  /* HERE IS WHERE YOU VALIDATE DATA */
2286
- if (intent === undefined || intent === null || intent === '') {
2287
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
2845
+ if (isamVer === undefined || isamVer === null || isamVer === '') {
2846
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['isamVer'], null, null, null);
2847
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2848
+ return callback(null, errorObj);
2849
+ }
2850
+ if (shelfName === undefined || shelfName === null || shelfName === '') {
2851
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['shelfName'], null, null, null);
2852
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2853
+ return callback(null, errorObj);
2854
+ }
2855
+ if (vlanAssociation === undefined || vlanAssociation === null || vlanAssociation === '') {
2856
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vlanAssociation'], null, null, null);
2288
2857
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2289
2858
  return callback(null, errorObj);
2290
2859
  }
2860
+ let isChild = false;
2861
+ if (child !== null && child !== undefined && child === true) {
2862
+ isChild = true;
2863
+ }
2864
+ let isOne = true;
2865
+ if (one !== null && one !== undefined && one === false) {
2866
+ isOne = false;
2867
+ }
2291
2868
 
2292
2869
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2293
- const queryParamsAvailable = {};
2870
+ const queryParamsAvailable = { isChild, isOne };
2294
2871
  const queryParams = {};
2295
- const pathVars = [intent];
2872
+ const pathVars = [isamVer, shelfName, vlanAssociation];
2296
2873
  const bodyVars = {};
2297
2874
 
2298
2875
  // loop in template. long callback arg name to avoid identifier conflicts
@@ -2314,7 +2891,7 @@ class NokiaAltiplano extends AdapterBaseCl {
2314
2891
  try {
2315
2892
  // Make the call -
2316
2893
  // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
2317
- return this.requestHandlerInst.identifyRequest('Intent', 'auditl2User', reqObj, true, (irReturnData, irReturnError) => {
2894
+ return this.requestHandlerInst.identifyRequest('Entity', 'getEntityOntVlanAssociation', reqObj, true, (irReturnData, irReturnError) => {
2318
2895
  // if we received an error or their is no response on the results
2319
2896
  // return an error
2320
2897
  if (irReturnError) {
@@ -2322,7 +2899,7 @@ class NokiaAltiplano extends AdapterBaseCl {
2322
2899
  return callback(null, irReturnError);
2323
2900
  }
2324
2901
  if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
2325
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['auditl2User'], null, null, null);
2902
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getEntityOntVlanAssociation'], null, null, null);
2326
2903
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2327
2904
  return callback(null, errorObj);
2328
2905
  }